[U-Boot] [PATCH V2] ppc4xx: Fix UART baudrate setup by FDT
Matthias Fuchs
matthias.fuchs at esd-electronics.com
Fri Jan 2 12:15:13 CET 2009
On ppc4xx platforms __ft_board_setup updates clock-frequency
properties of all ns16550 compatible UARTs. This is not a good
idea when those UARTs are external discrete UARTs that are
not clocked by some internal clocks. So any external clock value
in the DTB is overwritten and those UARTs will not be setup correctly
by the Linux kernel.
This patch uses the approach from fdt_fixup_ethernet(). Only UART nodes
that have a serial* alias are updated.
Signed-off-by: Matthias Fuchs <matthias.fuchs at esd-electronics.com>
---
common/fdt_support.c | 20 ++++++++++++++++++++
cpu/ppc4xx/fdt.c | 3 ++-
include/fdt_support.h | 1 +
3 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 5a83bca..99d4c3f 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -454,6 +454,26 @@ void fdt_fixup_ethernet(void *fdt)
}
}
+void fdt_fixup_serial(void *fdt)
+{
+ int node, i;
+ char serial[10];
+ const char *path;
+
+ node = fdt_path_offset(fdt, "/aliases");
+ if (node < 0)
+ return;
+
+ i = 0;
+ while (1) {
+ sprintf(serial, "serial%d", i++);
+ path = fdt_getprop(fdt, node, serial, NULL);
+ if (path == NULL)
+ break;
+ do_fixup_by_path_u32(fdt, path, "clock-frequency", gd->uart_clk, 1);
+ }
+}
+
#ifdef CONFIG_HAS_FSL_DR_USB
void fdt_fixup_dr_usb(void *blob, bd_t *bd)
{
diff --git a/cpu/ppc4xx/fdt.c b/cpu/ppc4xx/fdt.c
index c55e1cf..5b267d1 100644
--- a/cpu/ppc4xx/fdt.c
+++ b/cpu/ppc4xx/fdt.c
@@ -134,8 +134,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
/*
* Setup all baudrates for the UARTs
+ * Note: aliases in the dts are required for this
*/
- do_fixup_by_compat_u32(blob, "ns16550", "clock-frequency", gd->uart_clk, 1);
+ fdt_fixup_serial(blob);
/*
* Fixup all ethernet nodes
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 6062df9..bf3df60 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -49,6 +49,7 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
const char *prop, u32 val, int create);
int fdt_fixup_memory(void *blob, u64 start, u64 size);
void fdt_fixup_ethernet(void *fdt);
+void fdt_fixup_serial(void *fdt);
int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
const void *val, int len, int create);
void fdt_fixup_qe_firmware(void *fdt);
--
1.5.6.3
More information about the U-Boot
mailing list