* [U-Boot] [PATCH 2/2] 8xx, kup4: add FDT support
@ 2010-07-07 13:46 Heiko Schocher
2010-07-15 21:20 ` Wolfgang Denk
0 siblings, 1 reply; 2+ messages in thread
From: Heiko Schocher @ 2010-07-07 13:46 UTC (permalink / raw)
To: u-boot
Signed-off-by: Heiko Schocher <hs@denx.de>
---
board/kup/kup4k/kup4k.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
include/configs/KUP4K.h | 4 +++
2 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/board/kup/kup4k/kup4k.c b/board/kup/kup4k/kup4k.c
index 9feee68..a35e3e6 100644
--- a/board/kup/kup4k/kup4k.c
+++ b/board/kup/kup4k/kup4k.c
@@ -24,6 +24,7 @@
#include <common.h>
#include <command.h>
+#include <libfdt.h>
#include <mpc8xx.h>
#include <hwconfig.h>
#include <i2c.h>
@@ -295,4 +296,62 @@ static unsigned char swapbyte(unsigned char c)
return result;
}
+/*
+ * Device Tree Support
+ */
+#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
+int fdt_set_node_and_value (void *blob,
+ char *nodename,
+ char *regname,
+ void *var,
+ int size)
+{
+ int ret = 0;
+ int nodeoffset = 0;
+
+ nodeoffset = fdt_path_offset (blob, nodename);
+ if (nodeoffset >= 0) {
+ ret = fdt_setprop (blob, nodeoffset, regname, var,
+ size);
+ if (ret < 0) {
+ printf("ft_blob_update(): "
+ "cannot set %s/%s property; err: %s\n",
+ nodename, regname, fdt_strerror (ret));
+ }
+ } else {
+ printf("ft_blob_update(): "
+ "cannot find %s node err:%s\n",
+ nodename, fdt_strerror (nodeoffset));
+ }
+ return ret;
+}
+/*
+ * update "brg" property in the blob
+ */
+void ft_blob_update (void *blob, bd_t *bd)
+{
+ uchar enetaddr[6];
+ ulong brg_data = 0;
+
+ /* BRG */
+ brg_data = cpu_to_be32(bd->bi_busfreq);
+ fdt_set_node_and_value(blob,
+ "/soc/cpm", "brg-frequency",
+ &brg_data, sizeof(brg_data));
+
+ /* MAC addr */
+ if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ fdt_set_node_and_value(blob,
+ "ethernet0", "local-mac-address",
+ enetaddr, sizeof(u8) * 6);
+ }
+
+}
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+ ft_cpu_setup(blob, bd);
+ ft_blob_update(blob, bd);
+}
+#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/include/configs/KUP4K.h b/include/configs/KUP4K.h
index 1b4c1a9..4b38210 100644
--- a/include/configs/KUP4K.h
+++ b/include/configs/KUP4K.h
@@ -520,5 +520,9 @@
#define CONFIG_SYS_DEVICE_NULLDEV 1 /* enble null device */
#define CONFIG_VERSION_VARIABLE 1
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT 1
+#define CONFIG_OF_BOARD_SETUP 1
+
#endif /* __CONFIG_H */
--
1.6.2.5
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH 2/2] 8xx, kup4: add FDT support
2010-07-07 13:46 [U-Boot] [PATCH 2/2] 8xx, kup4: add FDT support Heiko Schocher
@ 2010-07-15 21:20 ` Wolfgang Denk
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Denk @ 2010-07-15 21:20 UTC (permalink / raw)
To: u-boot
Dear Heiko Schocher,
In message <4C34853D.3060404@denx.de> you wrote:
> Signed-off-by: Heiko Schocher <hs@denx.de>
> ---
> board/kup/kup4k/kup4k.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
> include/configs/KUP4K.h | 4 +++
> 2 files changed, 63 insertions(+), 0 deletions(-)
...
> +int fdt_set_node_and_value (void *blob,
> + char *nodename,
> + char *regname,
> + void *var,
> + int size)
...
> + ret = fdt_setprop (blob, nodeoffset, regname, var,
> + size);
> + if (ret < 0) {
> + printf("ft_blob_update(): "
> + "cannot set %s/%s property; err: %s\n",
> + nodename, regname, fdt_strerror (ret));
> + }
> + } else {
> + printf("ft_blob_update(): "
> + "cannot find %s node err:%s\n",
> + nodename, fdt_strerror (nodeoffset));
Where is the "ft_blob_update()" in these messages coming from? It
seems unrelated to the functions actually called?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A committee is a group that keeps the minutes and loses hours.
-- Milton Berle
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-15 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-07 13:46 [U-Boot] [PATCH 2/2] 8xx, kup4: add FDT support Heiko Schocher
2010-07-15 21:20 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox