Re: [PATCH] MIPS: Loongson64: env: Fixup serial clock-frequency when using LEFI

From: Thomas Bogendoerfer

Date: Thu Feb 05 2026 - 04:25:07 EST


On Mon, Feb 02, 2026 at 04:53:22AM +0000, Yao Zi wrote:
> When booting from LEFI firmware, the devicetree is chosen by matching
> bridge type and CPU PRID. However, serials on Loongson devices may not
> have the same clock frequency across different boards. For example,
> CPU UARTs found on Loongson 3A4000 is supplied by the system clock,
> which may be either 25MHz or 100MHz.
>
> Luckily, LEFI firmware interface provides information about UART
> address and corresponding clock frequency. Let's fixup clock-frequency
> properties for serials after FDT selection by matching FDT nodes with
> addresses provided by firmware.
>
> Signed-off-by: Yao Zi <me@xxxxxxxx>
> ---
>
> This is tested on LS3A4000_7A1000_NUC_BOARD_V2.1, which utilizes a 25MHz
> oscillator as system clock input. Without the patch, serial output is
> completely broken after kernel initialization.
>
> arch/mips/loongson64/env.c | 98 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 98 insertions(+)

applied to mips-next
Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]