[PATCH v2 2/8] MIPS: Loongson64: env: Don't warn if UART has clocks node when fixing up FDT

From: Rong Zhang

Date: Fri Nov 13 2026 - 09:00:14 EST


A UART with clocks node cannot (and doesn't need to) be fixed up.

The fixup is solely for the case in which the UART use a dedicated clock
source on board (say, a crystal oscillator). IOW, when a UART has a
valid clocks node, it should use an internal clock source that is either
nonconfigurable by the board manufacturer, or retrievable by software.

When fixing up FDT using UART information from LEFI, don't warn if a
UART has a valid clocks node.

Signed-off-by: Rong Zhang <rongrong@xxxxxxxxxxxxxxxxx>
---
Currently no Loongson64 platform has such UART nodes, so this is not a
fix. Later changes will convert some nodes and depends on this.
---
arch/mips/loongson64/env.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 7abcca7ab4ed..8135d50c777e 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -73,6 +73,12 @@ static int __init lefi_fixup_fdt_serial(void *fdt, u64 uart_addr, u32 uart_clk)
if (!reg || len <= 8 || fdt64_ld(reg) != uart_addr)
continue;

+ if (fdt_getprop(fdt, node, "clocks", &len) && len >= 4) {
+ /* The UART cannot (and doesn't need to) be fixed up. */
+ pr_devel("UART 0x%llx has clocks property\n", uart_addr);
+ return 0;
+ }
+
clk = fdt_getprop_w(fdt, node, "clock-frequency", &len);
if (!clk) {
pr_warn("UART 0x%llx misses clock-frequency property\n",

--
2.55.0