From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] ppc4xx: Fix UART baudrate setup by FDT
Date: Fri, 2 Jan 2009 12:15:13 +0100 [thread overview]
Message-ID: <200901021215.13810.matthias.fuchs@esd-electronics.com> (raw)
In-Reply-To: <200812281835.40995.mfuchs@ma-fu.de>
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@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
next prev parent reply other threads:[~2009-01-02 11:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-28 17:35 [U-Boot] [PATCH] ppc4xx: Fix UART baudrate setup by FDT Matthias Fuchs
2009-01-02 11:15 ` Matthias Fuchs [this message]
2009-01-05 13:08 ` [U-Boot] [PATCH V2] " Stefan Roese
2009-01-05 20:10 ` Matthias Fuchs
2009-01-06 8:07 ` Stefan Roese
2009-01-06 19:15 ` Matthias Fuchs
2009-01-07 15:37 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200901021215.13810.matthias.fuchs@esd-electronics.com \
--to=matthias.fuchs@esd-electronics.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox