* [U-Boot-Users] [FDT][UPDATE][PATCH] Convert boards that set memory node to use fdt_fixup_memory()
@ 2007-11-28 21:54 Kumar Gala
2007-11-29 2:21 ` gvb.uboot
0 siblings, 1 reply; 2+ messages in thread
From: Kumar Gala @ 2007-11-28 21:54 UTC (permalink / raw)
To: u-boot
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
We needed a (u64) cast to make thing work properly. Again updated my
libfdt_testing branch with this fix.
board/cm5200/cm5200.c | 15 ++-------------
board/ids8247/ids8247.c | 17 +++--------------
cpu/mpc83xx/cpu.c | 18 ++----------------
3 files changed, 7 insertions(+), 43 deletions(-)
diff --git a/board/cm5200/cm5200.c b/board/cm5200/cm5200.c
index 4a86d3c..79fb71d 100644
--- a/board/cm5200/cm5200.c
+++ b/board/cm5200/cm5200.c
@@ -263,7 +263,6 @@ static void ft_blob_update(void *blob, bd_t *bd)
{
int len, ret, nodeoffset = 0;
char module_name[MODULE_NAME_MAXLEN] = {0};
- ulong memory_data[2] = {0};
compose_module_name(hw_id, module_name);
len = strlen(module_name) + 1;
@@ -273,22 +272,12 @@ static void ft_blob_update(void *blob, bd_t *bd)
printf("ft_blob_update(): cannot set /model property err:%s\n",
fdt_strerror(ret));
- memory_data[0] = cpu_to_be32(bd->bi_memstart);
- memory_data[1] = cpu_to_be32(bd->bi_memsize);
+ ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
- nodeoffset = fdt_path_offset (blob, "/memory");
- if (nodeoffset >= 0) {
- ret = fdt_setprop(blob, nodeoffset, "reg", memory_data,
- sizeof(memory_data));
- if (ret < 0)
+ if (ret < 0) {
printf("ft_blob_update): cannot set /memory/reg "
"property err:%s\n", fdt_strerror(ret));
}
- else {
- /* memory node is required in dts */
- printf("ft_blob_update(): cannot find /memory node "
- "err:%s\n", fdt_strerror(nodeoffset));
- }
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/ids8247/ids8247.c b/board/ids8247/ids8247.c
index d1d8c56..7176770 100644
--- a/board/ids8247/ids8247.c
+++ b/board/ids8247/ids8247.c
@@ -329,25 +329,14 @@ nand_init (void)
*/
void ft_blob_update(void *blob, bd_t *bd)
{
- int ret, nodeoffset = 0;
- ulong memory_data[2] = {0};
+ int ret;
- memory_data[0] = cpu_to_be32(bd->bi_memstart);
- memory_data[1] = cpu_to_be32(bd->bi_memsize);
+ ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
- nodeoffset = fdt_path_offset (blob, "/memory");
- if (nodeoffset >= 0) {
- ret = fdt_setprop(blob, nodeoffset, "reg", memory_data,
- sizeof(memory_data));
- if (ret < 0)
+ if (ret < 0) {
printf("ft_blob_update): cannot set /memory/reg "
"property err:%s\n", fdt_strerror(ret));
}
- else {
- /* memory node is required in dts */
- printf("ft_blob_update(): cannot find /memory node "
- "err:%s\n", fdt_strerror(nodeoffset));
- }
}
void ft_board_setup(void *blob, bd_t *bd)
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index b2c35d3..f1ea17d 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -35,6 +35,7 @@
#include <ft_build.h>
#elif defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
+#include <fdt_support.h>
#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -526,7 +527,6 @@ ft_cpu_setup(void *blob, bd_t *bd)
int nodeoffset;
int err;
int j;
- int tmp[2];
for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) {
nodeoffset = fdt_path_offset(blob, fixup_props[j].node);
@@ -543,21 +543,7 @@ ft_cpu_setup(void *blob, bd_t *bd)
}
}
- /* update, or add and update /memory node */
- nodeoffset = fdt_path_offset(blob, "/memory");
- if (nodeoffset < 0) {
- nodeoffset = fdt_add_subnode(blob, 0, "memory");
- if (nodeoffset < 0)
- debug("failed to add /memory node: %s\n",
- fdt_strerror(nodeoffset));
- }
- if (nodeoffset >= 0) {
- fdt_setprop(blob, nodeoffset, "device_type",
- "memory", sizeof("memory"));
- tmp[0] = cpu_to_be32(bd->bi_memstart);
- tmp[1] = cpu_to_be32(bd->bi_memsize);
- fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp));
- }
+ fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
}
#elif defined(CONFIG_OF_FLAT_TREE)
void
--
1.5.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot-Users] [FDT][UPDATE][PATCH] Convert boards that set memory node to use fdt_fixup_memory()
2007-11-28 21:54 [U-Boot-Users] [FDT][UPDATE][PATCH] Convert boards that set memory node to use fdt_fixup_memory() Kumar Gala
@ 2007-11-29 2:21 ` gvb.uboot
0 siblings, 0 replies; 2+ messages in thread
From: gvb.uboot @ 2007-11-29 2:21 UTC (permalink / raw)
To: u-boot
Kumar Gala wrote:
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>
> We needed a (u64) cast to make thing work properly. Again updated my
> libfdt_testing branch with this fix.
>
> board/cm5200/cm5200.c | 15 ++-------------
> board/ids8247/ids8247.c | 17 +++--------------
> cpu/mpc83xx/cpu.c | 18 ++----------------
> 3 files changed, 7 insertions(+), 43 deletions(-)
This and Kumar's previous fdt patches are working for me (mpc8360emds).
I've pushed them to the testing branch in u-boot-fdt. Thanks.
Machine format:
git://www.denx.de/git/u-boot-fdt testing
Human format:
<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot/u-boot-fdt.git;a=shortlog;h=testing>
I noticed that we have warnings on a couple of boards that don't have an
ethernet defined. Patch coming in a couple minutes...
$ less LOG/cm5200.ERR
fdt_support.c: In function 'fdt_fixup_ethernet':
fdt_support.c:565: warning: unused variable 'path
$ ll LOG/*.ERR | grep "[0-9][0-9] 2007" | grep 100
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:35 LOG/cm5200.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:37 LOG/fo300.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:37 LOG/icecube_5100.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:38 LOG/icecube_5200.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:38 LOG/lite5200b.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:39 LOG/motionpro.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:44 LOG/TQM5200_B.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:43 LOG/TQM5200.ERR
-rw-r--r-- 1 vanbaren users 100 2007-11-27 20:45 LOG/TQM5200S.ERR
Best regards,
gvb
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-29 2:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-28 21:54 [U-Boot-Users] [FDT][UPDATE][PATCH] Convert boards that set memory node to use fdt_fixup_memory() Kumar Gala
2007-11-29 2:21 ` gvb.uboot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox