* [U-Boot] [PATCH] mpc83xx fdt: do not adjust clock frequency of external UARTs
@ 2011-04-15 12:30 David Müller
2011-04-15 17:44 ` Timur Tabi
2011-05-02 16:33 ` Kim Phillips
0 siblings, 2 replies; 6+ messages in thread
From: David Müller @ 2011-04-15 12:30 UTC (permalink / raw)
To: u-boot
The current 83xx FDT implementation adjusts the clock frequency of all
16550 UARTs found in the device tree. This behaviour is ok for the UARTs
which are part of the SoC, but wrong for any additional external UART.
Signed-off-by: David M??ller <d.mueller@elsoft.ch>
---
arch/powerpc/cpu/mpc83xx/fdt.c | 27 +++++++++++++++++++++++++--
1 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/cpu/mpc83xx/fdt.c b/arch/powerpc/cpu/mpc83xx/fdt.c
index daf73a6..e13e2b3 100644
--- a/arch/powerpc/cpu/mpc83xx/fdt.c
+++ b/arch/powerpc/cpu/mpc83xx/fdt.c
@@ -50,6 +50,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
{
immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
int spridr = immr->sysconf.spridr;
+ int off;
/*
* delete crypto node if not on an E-processor
@@ -131,8 +132,30 @@ void ft_cpu_setup(void *blob, bd_t *bd)
#endif
#ifdef CONFIG_SYS_NS16550
- do_fixup_by_compat_u32(blob, "ns16550",
- "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
+ /*
+ * fixup all UART clocks for CPU internal UARTs
+ * (clock-frequency is usually 0) but do not touch
+ * any other (external) UARTs
+ */
+ off = fdt_node_offset_by_compatible(blob, -1, "ns16550");
+
+ while (off != -FDT_ERR_NOTFOUND) {
+ const struct fdt_property *prop;
+ int len;
+
+ prop = fdt_get_property(blob, off, "clock-frequency", &len);
+ if (prop && (len == 4)) {
+ u32 *data = (u32 *)prop->data;
+ u32 val = fdt32_to_cpu(*data);
+ if (val == 0) {
+ val = cpu_to_fdt32(CONFIG_SYS_NS16550_CLK);
+ fdt_setprop(blob, off,
+ "clock-frequency", &val, 4);
+ }
+ }
+
+ off = fdt_node_offset_by_compatible(blob, off, "ns16550");
+ }
#endif
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] mpc83xx fdt: do not adjust clock frequency of external UARTs
2011-04-15 12:30 [U-Boot] [PATCH] mpc83xx fdt: do not adjust clock frequency of external UARTs David Müller
@ 2011-04-15 17:44 ` Timur Tabi
2011-04-16 5:30 ` "David Müller (ELSOFT AG)"
2011-05-02 16:33 ` Kim Phillips
1 sibling, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2011-04-15 17:44 UTC (permalink / raw)
To: u-boot
On Fri, Apr 15, 2011 at 7:30 AM, David M?ller <d.mueller@elsoft.ch> wrote:
> The current 83xx FDT implementation adjusts the clock frequency of all
> 16550 UARTs found in the device tree. This behaviour is ok for the UARTs
> which are part of the SoC, but wrong for any additional external UART.
Just out of curiosity -- do you have an example of a device tree with
an external UART?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] mpc83xx fdt: do not adjust clock frequency of external UARTs
2011-04-15 12:30 [U-Boot] [PATCH] mpc83xx fdt: do not adjust clock frequency of external UARTs David Müller
2011-04-15 17:44 ` Timur Tabi
@ 2011-05-02 16:33 ` Kim Phillips
1 sibling, 0 replies; 6+ messages in thread
From: Kim Phillips @ 2011-05-02 16:33 UTC (permalink / raw)
To: u-boot
On Fri, 15 Apr 2011 14:30:33 +0200
David M?ller <d.mueller@elsoft.ch> wrote:
> The current 83xx FDT implementation adjusts the clock frequency of all
> 16550 UARTs found in the device tree. This behaviour is ok for the UARTs
> which are part of the SoC, but wrong for any additional external UART.
>
> Signed-off-by: David M?ller <d.mueller@elsoft.ch>
>
> ---
> arch/powerpc/cpu/mpc83xx/fdt.c | 27 +++++++++++++++++++++++++--
> 1 files changed, 25 insertions(+), 2 deletions(-)
(a) this is not an mpc83xx-specific issue
(b) the fdt code here should instead be modified to only adjust clock
properties on UART nodes contained within the SoC node, not the entire
fdt.
Any UARTs not a part of the SoC should get their clocks updated in
board/ code (or, as in this case, set manually in the device tree).
Kim
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-02 16:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-15 12:30 [U-Boot] [PATCH] mpc83xx fdt: do not adjust clock frequency of external UARTs David Müller
2011-04-15 17:44 ` Timur Tabi
2011-04-16 5:30 ` "David Müller (ELSOFT AG)"
2011-04-16 12:41 ` Tabi Timur-B04825
2011-04-18 6:58 ` "David Müller (ELSOFT AG)"
2011-05-02 16:33 ` Kim Phillips
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox