* [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure
@ 2014-10-24 0:58 Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup() Simon Glass
` (11 more replies)
0 siblings, 12 replies; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
This function can fail if the device tree runs out of space. Rather than
silently booting with an incomplete device tree, allow the failure to be
detected.
Unfortunately this involves changing a lot of places in the code. I have
not changed behvaiour to return an error where one is not currently
returned, to avoid unexpected breakage.
Eventually it would be nice to allow boards to register functions to be
called to update the device tree. This would avoid all the many functions
to do this. However it's not clear yet if this should be done using driver
model or with a linker list. This work is left for later.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Fix return codes in board/amcc/sequoia/sequoia.c
- Fix return codes in board/freescale/p1_p2_rdb/p1_p2_rdb.c
- Fix return codes in board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
arch/nios2/cpu/fdt.c | 8 ++++--
arch/powerpc/cpu/ppc4xx/fdt.c | 7 +++--
board/a3m071/a3m071.c | 4 ++-
board/a4m072/a4m072.c | 5 ++--
board/amcc/canyonlands/canyonlands.c | 6 +++--
board/amcc/sequoia/sequoia.c | 19 ++++++-------
board/cm5200/cm5200.c | 4 ++-
board/compulab/cm_fx6/cm_fx6.c | 4 ++-
board/compulab/cm_t54/cm_t54.c | 4 ++-
board/davedenx/aria/aria.c | 4 ++-
board/esd/cpci405/cpci405.c | 4 ++-
board/esd/mecp5123/mecp5123.c | 4 ++-
board/esd/pmc405de/pmc405de.c | 4 ++-
board/esd/pmc440/pmc440.c | 4 ++-
board/esd/vme8349/vme8349.c | 4 ++-
board/exmeritus/hww1u1a/hww1u1a.c | 4 ++-
board/freescale/b4860qds/b4860qds.c | 4 ++-
board/freescale/bsc9131rdb/bsc9131rdb.c | 4 ++-
board/freescale/bsc9132qds/bsc9132qds.c | 4 ++-
board/freescale/c29xpcie/c29xpcie.c | 4 ++-
board/freescale/common/cds_pci_ft.c | 5 ++--
board/freescale/corenet_ds/corenet_ds.c | 4 ++-
board/freescale/ls1021aqds/ls1021aqds.c | 4 ++-
board/freescale/ls1021atwr/ls1021atwr.c | 4 ++-
board/freescale/ls2085a/ls2085a.c | 4 ++-
board/freescale/mpc5121ads/mpc5121ads.c | 4 ++-
board/freescale/mpc7448hpc2/mpc7448hpc2.c | 5 ++--
board/freescale/mpc8308rdb/mpc8308rdb.c | 4 ++-
board/freescale/mpc8313erdb/mpc8313erdb.c | 4 ++-
board/freescale/mpc8315erdb/mpc8315erdb.c | 4 ++-
board/freescale/mpc8323erdb/mpc8323erdb.c | 4 ++-
board/freescale/mpc832xemds/mpc832xemds.c | 4 ++-
board/freescale/mpc8349emds/mpc8349emds.c | 4 ++-
board/freescale/mpc8349itx/mpc8349itx.c | 4 ++-
board/freescale/mpc8360emds/mpc8360emds.c | 4 ++-
board/freescale/mpc8360erdk/mpc8360erdk.c | 4 ++-
board/freescale/mpc837xemds/mpc837xemds.c | 4 ++-
board/freescale/mpc837xerdb/mpc837xerdb.c | 4 ++-
board/freescale/mpc8536ds/mpc8536ds.c | 3 ++-
board/freescale/mpc8540ads/mpc8540ads.c | 5 ++--
board/freescale/mpc8544ds/mpc8544ds.c | 4 ++-
board/freescale/mpc8560ads/mpc8560ads.c | 5 ++--
board/freescale/mpc8568mds/mpc8568mds.c | 4 ++-
board/freescale/mpc8569mds/mpc8569mds.c | 4 ++-
board/freescale/mpc8572ds/mpc8572ds.c | 4 ++-
board/freescale/mpc8610hpcd/mpc8610hpcd.c | 5 ++--
board/freescale/mpc8641hpcn/mpc8641hpcn.c | 5 ++--
board/freescale/p1010rdb/p1010rdb.c | 4 ++-
board/freescale/p1022ds/p1022ds.c | 4 ++-
board/freescale/p1023rdb/p1023rdb.c | 4 ++-
board/freescale/p1_p2_rdb/p1_p2_rdb.c | 41 ++++++++++++++++-------------
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 36 ++++++++++++-------------
board/freescale/p1_twr/p1_twr.c | 4 ++-
board/freescale/p2020come/p2020come.c | 4 ++-
board/freescale/p2020ds/p2020ds.c | 4 ++-
board/freescale/p2041rdb/p2041rdb.c | 4 ++-
board/freescale/qemu-ppce500/qemu-ppce500.c | 4 ++-
board/freescale/t1040qds/t1040qds.c | 4 ++-
board/freescale/t104xrdb/t104xrdb.c | 4 ++-
board/freescale/t208xqds/t208xqds.c | 4 ++-
board/freescale/t208xrdb/t208xrdb.c | 4 ++-
board/freescale/t4qds/t4240emu.c | 4 ++-
board/freescale/t4qds/t4240qds.c | 4 ++-
board/freescale/t4rdb/t4240rdb.c | 4 ++-
board/galaxy5200/galaxy5200.c | 4 ++-
board/gateworks/gw_ventana/gw_ventana.c | 10 ++++---
board/gdsys/intip/intip.c | 4 ++-
board/gdsys/p1022/controlcenterd.c | 4 ++-
board/highbank/highbank.c | 4 ++-
board/icecube/icecube.c | 5 ++--
board/ids/ids8247/ids8247.c | 4 ++-
board/ids/ids8313/ids8313.c | 4 ++-
board/ifm/ac14xx/ac14xx.c | 4 ++-
board/ifm/o2dnt2/o2dnt2.c | 4 ++-
board/intercontrol/digsy_mtc/digsy_mtc.c | 4 ++-
board/ipek01/ipek01.c | 4 ++-
board/jupiter/jupiter.c | 5 ++--
board/keymile/km82xx/km82xx.c | 4 ++-
board/keymile/km83xx/km83xx.c | 4 ++-
board/keymile/kmp204x/kmp204x.c | 4 ++-
board/korat/korat.c | 4 ++-
board/kup/kup4k/kup4k.c | 4 ++-
board/manroland/mucmc52/mucmc52.c | 4 ++-
board/manroland/uc101/uc101.c | 4 ++-
board/motionpro/motionpro.c | 4 ++-
board/mpc8308_p1m/mpc8308_p1m.c | 4 ++-
board/muas3001/muas3001.c | 4 ++-
board/munices/munices.c | 5 ++--
board/pdm360ng/pdm360ng.c | 4 ++-
board/phytec/pcm030/pcm030.c | 4 ++-
board/raspberrypi/rpi_b/rpi_b.c | 4 ++-
board/sbc8349/sbc8349.c | 4 ++-
board/sbc8548/sbc8548.c | 4 ++-
board/sbc8641d/sbc8641d.c | 4 ++-
board/socrates/socrates.c | 5 ++--
board/stx/stxssa/stxssa.c | 4 ++-
board/ti/ks2_evm/board.c | 4 ++-
board/tqc/tqm5200/tqm5200.c | 4 ++-
board/tqc/tqm834x/tqm834x.c | 4 ++-
board/tqc/tqm8xx/tqm8xx.c | 4 ++-
board/tqc/tqma6/tqma6.c | 4 ++-
board/ve8313/ve8313.c | 4 ++-
board/xes/xpedite517x/xpedite517x.c | 4 ++-
board/xes/xpedite520x/xpedite520x.c | 4 ++-
board/xes/xpedite537x/xpedite537x.c | 4 ++-
board/xes/xpedite550x/xpedite550x.c | 4 ++-
include/fdt_support.h | 12 ++++++++-
107 files changed, 378 insertions(+), 167 deletions(-)
diff --git a/arch/nios2/cpu/fdt.c b/arch/nios2/cpu/fdt.c
index 4d88f16..5024682 100644
--- a/arch/nios2/cpu/fdt.c
+++ b/arch/nios2/cpu/fdt.c
@@ -18,11 +18,13 @@
DECLARE_GLOBAL_DATA_PTR;
-void __ft_board_setup(void *blob, bd_t *bd)
+int __ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
-void ft_board_setup(void *blob, bd_t *bd) \
+int ft_board_setup(void *blob, bd_t *bd)
__attribute__((weak, alias("__ft_board_setup")));
void ft_cpu_setup(void *blob, bd_t *bd)
@@ -32,5 +34,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
* Note: aliases in the dts are required for this
*/
fdt_fixup_ethernet(blob);
+
+ return 0;
}
#endif /* CONFIG_OF_LIBFDT && CONFIG_OF_BOARD_SETUP */
diff --git a/arch/powerpc/cpu/ppc4xx/fdt.c b/arch/powerpc/cpu/ppc4xx/fdt.c
index bd905d1..eef9c5a 100644
--- a/arch/powerpc/cpu/ppc4xx/fdt.c
+++ b/arch/powerpc/cpu/ppc4xx/fdt.c
@@ -18,7 +18,7 @@
DECLARE_GLOBAL_DATA_PTR;
-void __ft_board_setup(void *blob, bd_t *bd)
+int __ft_board_setup(void *blob, bd_t *bd)
{
int rc;
int i;
@@ -60,8 +60,11 @@ void __ft_board_setup(void *blob, bd_t *bd)
printf("Unable to update property EBC mappings, err=%s\n",
fdt_strerror(rc));
}
+
+ return 0;
}
-void ft_board_setup(void *blob, bd_t *bd) __attribute__((weak, alias("__ft_board_setup")));
+int ft_board_setup(void *blob, bd_t *bd)
+ __attribute__((weak, alias("__ft_board_setup")));
/*
* Fixup all PCIe nodes by setting the device_type property
diff --git a/board/a3m071/a3m071.c b/board/a3m071/a3m071.c
index b96ba81..ee1681b 100644
--- a/board/a3m071/a3m071.c
+++ b/board/a3m071/a3m071.c
@@ -392,9 +392,11 @@ int misc_init_r(void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t * bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/a4m072/a4m072.c b/board/a4m072/a4m072.c
index d3d4c18..c5d161b 100644
--- a/board/a4m072/a4m072.c
+++ b/board/a4m072/a4m072.c
@@ -171,10 +171,11 @@ void pci_init_board(void)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/amcc/canyonlands/canyonlands.c b/board/amcc/canyonlands/canyonlands.c
index 79d4bab..c5cc4ff 100644
--- a/board/amcc/canyonlands/canyonlands.c
+++ b/board/amcc/canyonlands/canyonlands.c
@@ -490,9 +490,9 @@ int misc_init_r(void)
#endif /* !defined(CONFIG_ARCHES) */
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-extern void __ft_board_setup(void *blob, bd_t *bd);
+extern int __ft_board_setup(void *blob, bd_t *bd);
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
__ft_board_setup(blob, bd);
@@ -515,5 +515,7 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_find_and_setprop(blob, "/plb/sata at bffd1000", "status",
"disabled", sizeof("disabled"), 1);
}
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c
index 53f9b34..91c6cbf 100644
--- a/board/amcc/sequoia/sequoia.c
+++ b/board/amcc/sequoia/sequoia.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <errno.h>
#include <libfdt.h>
#include <fdt_support.h>
#include <asm/ppc4xx.h>
@@ -363,7 +364,7 @@ void board_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
* On NAND-booting sequoia, we need to patch the chips select numbers
* in the dtb (CS0 - NAND, CS3 - NOR)
*/
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int rc;
int len;
@@ -381,15 +382,14 @@ void ft_board_setup(void *blob, bd_t *bd)
prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
if (prop == NULL) {
printf("Unable to update NOR chip select for NAND booting\n");
- return;
+ return -FDT_ERR_NOTFOUND;
}
reg = (u32 *)&prop->data[0];
reg[0] = 3;
rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
if (rc) {
- printf("Unable to update property NOR mappings, err=%s\n",
- fdt_strerror(rc));
- return;
+ printf("Unable to update property NOR mappings\n");
+ return rc;
}
/* And now configure NAND chip select to 0 instead of 3 */
@@ -398,15 +398,16 @@ void ft_board_setup(void *blob, bd_t *bd)
prop = fdt_get_property_w(blob, nodeoffset, "reg", &len);
if (prop == NULL) {
printf("Unable to update NDFC chip select for NAND booting\n");
- return;
+ return len;
}
reg = (u32 *)&prop->data[0];
reg[0] = 0;
rc = fdt_find_and_setprop(blob, path, "reg", reg, 3 * sizeof(u32), 1);
if (rc) {
- printf("Unable to update property NDFC mappings, err=%s\n",
- fdt_strerror(rc));
- return;
+ printf("Unable to update property NDFC mapping\n");
+ return rc;
}
+
+ return 0;
}
#endif /* CONFIG_SYS_RAMBOOT */
diff --git a/board/cm5200/cm5200.c b/board/cm5200/cm5200.c
index 048aa6c..5276907 100644
--- a/board/cm5200/cm5200.c
+++ b/board/cm5200/cm5200.c
@@ -359,9 +359,11 @@ int last_stage_init(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
ft_blob_update(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index f77ff48..bff372a 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -452,7 +452,7 @@ int cm_fx6_setup_ecspi(void) { return 0; }
#endif
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
uint8_t enetaddr[6];
@@ -461,6 +461,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_find_and_setprop(blob, "/fec", "local-mac-address",
enetaddr, 6, 1);
}
+
+ return 0;
}
#endif
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 944b723..910c7be 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -126,7 +126,7 @@ int board_mmc_init(bd_t *bis)
#ifdef CONFIG_USB_HOST_ETHER
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
uint8_t enetaddr[6];
@@ -135,6 +135,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_find_and_setprop(blob, "/smsc95xx at 0", "mac-address",
enetaddr, 6, 1);
}
+
+ return 0;
}
static void generate_mac_addr(uint8_t *enetaddr)
diff --git a/board/davedenx/aria/aria.c b/board/davedenx/aria/aria.c
index c740669..a15a9ed 100644
--- a/board/davedenx/aria/aria.c
+++ b/board/davedenx/aria/aria.c
@@ -107,8 +107,10 @@ int checkboard (void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c
index 63cd862..e23ec55 100644
--- a/board/esd/cpci405/cpci405.c
+++ b/board/esd/cpci405/cpci405.c
@@ -508,7 +508,7 @@ int pci_pre_init(struct pci_controller *hose)
#endif /* defined(CONFIG_PCI) */
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int rc;
@@ -526,6 +526,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_strerror(rc));
}
}
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/esd/mecp5123/mecp5123.c b/board/esd/mecp5123/mecp5123.c
index 9700611..cda1d7b 100644
--- a/board/esd/mecp5123/mecp5123.c
+++ b/board/esd/mecp5123/mecp5123.c
@@ -199,8 +199,10 @@ int checkboard(void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/esd/pmc405de/pmc405de.c b/board/esd/pmc405de/pmc405de.c
index 4409ea6..3e17132 100644
--- a/board/esd/pmc405de/pmc405de.c
+++ b/board/esd/pmc405de/pmc405de.c
@@ -300,7 +300,7 @@ int pci_pre_init(struct pci_controller *hose)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int rc;
@@ -318,6 +318,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_strerror(rc));
}
}
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/esd/pmc440/pmc440.c b/board/esd/pmc440/pmc440.c
index 062ae67..15c3151 100644
--- a/board/esd/pmc440/pmc440.c
+++ b/board/esd/pmc440/pmc440.c
@@ -882,7 +882,7 @@ int board_usb_cleanup(int index, enum usb_init_type init)
#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_BOARD_INIT) */
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int rc;
@@ -899,5 +899,7 @@ void ft_board_setup(void *blob, bd_t *bd)
printf("err=%s\n", fdt_strerror(rc));
}
}
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/esd/vme8349/vme8349.c b/board/esd/vme8349/vme8349.c
index 01365dc..f8f1834 100644
--- a/board/esd/vme8349/vme8349.c
+++ b/board/esd/vme8349/vme8349.c
@@ -74,13 +74,15 @@ int board_eth_init(bd_t *bis)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/exmeritus/hww1u1a/hww1u1a.c b/board/exmeritus/hww1u1a/hww1u1a.c
index 643ece1..1e77e9b 100644
--- a/board/exmeritus/hww1u1a/hww1u1a.c
+++ b/board/exmeritus/hww1u1a/hww1u1a.c
@@ -252,7 +252,7 @@ int board_eth_init(bd_t *bis)
return pci_eth_init(bis);
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -265,4 +265,6 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
FT_FSL_PCI_SETUP;
+
+ return 0;
}
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index 34d66d5..bed8f56 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -1110,7 +1110,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -1136,6 +1136,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
/*
diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c
index 7fe4ae7..3c8d6f1 100644
--- a/board/freescale/bsc9131rdb/bsc9131rdb.c
+++ b/board/freescale/bsc9131rdb/bsc9131rdb.c
@@ -50,7 +50,7 @@ int checkboard(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -63,5 +63,7 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_memory(blob, (u64)base, (u64)size);
fdt_fixup_dr_usb(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c
index 10580bc..6b99035 100644
--- a/board/freescale/bsc9132qds/bsc9132qds.c
+++ b/board/freescale/bsc9132qds/bsc9132qds.c
@@ -354,7 +354,7 @@ void fdt_del_node_compat(void *blob, const char *compatible)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -411,5 +411,7 @@ void ft_board_setup(void *blob, bd_t *bd)
printf("\nRemove sim from hwconfig and reset\n");
}
}
+
+ return 0;
}
#endif
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c
index 534c6d1..d757709 100644
--- a/board/freescale/c29xpcie/c29xpcie.c
+++ b/board/freescale/c29xpcie/c29xpcie.c
@@ -128,7 +128,7 @@ void fdt_del_sec(void *blob, int offset)
}
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -150,5 +150,7 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_del_sec(blob, 1);
else if (cpu->soc_ver == SVR_C292)
fdt_del_sec(blob, 2);
+
+ return 0;
}
#endif
diff --git a/board/freescale/common/cds_pci_ft.c b/board/freescale/common/cds_pci_ft.c
index 2e5dcdf..571dfbb 100644
--- a/board/freescale/common/cds_pci_ft.c
+++ b/board/freescale/common/cds_pci_ft.c
@@ -63,13 +63,14 @@ static void cds_pci_fixup(void *blob)
}
}
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
cds_pci_fixup(blob);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c
index 65b3867..6f0fea1 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -190,7 +190,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -213,4 +213,6 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c
index 5fafc85..7441a6b 100644
--- a/board/freescale/ls1021aqds/ls1021aqds.c
+++ b/board/freescale/ls1021aqds/ls1021aqds.c
@@ -240,9 +240,11 @@ int board_init(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
u8 flash_read8(void *addr)
diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c
index 50d5640..ee78769 100644
--- a/board/freescale/ls1021atwr/ls1021atwr.c
+++ b/board/freescale/ls1021atwr/ls1021atwr.c
@@ -290,9 +290,11 @@ int misc_init_r(void)
}
#endif
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
u8 flash_read8(void *addr)
diff --git a/board/freescale/ls2085a/ls2085a.c b/board/freescale/ls2085a/ls2085a.c
index 2c79a71..163a4c4 100644
--- a/board/freescale/ls2085a/ls2085a.c
+++ b/board/freescale/ls2085a/ls2085a.c
@@ -100,7 +100,7 @@ void fdt_fixup_board_enet(void *fdt)
#endif
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -115,5 +115,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_FSL_MC_ENET
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc5121ads/mpc5121ads.c b/board/freescale/mpc5121ads/mpc5121ads.c
index 940978e..40bd55d 100644
--- a/board/freescale/mpc5121ads/mpc5121ads.c
+++ b/board/freescale/mpc5121ads/mpc5121ads.c
@@ -275,8 +275,10 @@ int checkboard (void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/freescale/mpc7448hpc2/mpc7448hpc2.c b/board/freescale/mpc7448hpc2/mpc7448hpc2.c
index 71b760c..11747ca 100644
--- a/board/freescale/mpc7448hpc2/mpc7448hpc2.c
+++ b/board/freescale/mpc7448hpc2/mpc7448hpc2.c
@@ -70,11 +70,12 @@ phys_size_t initdram (int board_type)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8308rdb/mpc8308rdb.c b/board/freescale/mpc8308rdb/mpc8308rdb.c
index fba41fe..93e1c50 100644
--- a/board/freescale/mpc8308rdb/mpc8308rdb.c
+++ b/board/freescale/mpc8308rdb/mpc8308rdb.c
@@ -161,11 +161,13 @@ int misc_init_r(void)
return 0;
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
fdt_fixup_dr_usb(blob, bd);
fdt_fixup_esdhc(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8313erdb/mpc8313erdb.c b/board/freescale/mpc8313erdb/mpc8313erdb.c
index 69e98a5..eac193e 100644
--- a/board/freescale/mpc8313erdb/mpc8313erdb.c
+++ b/board/freescale/mpc8313erdb/mpc8313erdb.c
@@ -116,12 +116,14 @@ int misc_init_r(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
#else /* CONFIG_SPL_BUILD */
diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c b/board/freescale/mpc8315erdb/mpc8315erdb.c
index e6f091f..ed611c5 100644
--- a/board/freescale/mpc8315erdb/mpc8315erdb.c
+++ b/board/freescale/mpc8315erdb/mpc8315erdb.c
@@ -188,7 +188,7 @@ void fdt_tsec1_fixup(void *fdt, bd_t *bd)
do_fixup_by_path(fdt, path, "status", disabled, sizeof(disabled), 1);
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
@@ -196,6 +196,8 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
fdt_fixup_dr_usb(blob, bd);
fdt_tsec1_fixup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index 3dce362..0a0152a 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -172,12 +172,14 @@ void pci_init_board(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc832xemds/mpc832xemds.c b/board/freescale/mpc832xemds/mpc832xemds.c
index b7ea0e4..adf4254 100644
--- a/board/freescale/mpc832xemds/mpc832xemds.c
+++ b/board/freescale/mpc832xemds/mpc832xemds.c
@@ -154,11 +154,13 @@ int checkboard(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c
index d909220..02b5040 100644
--- a/board/freescale/mpc8349emds/mpc8349emds.c
+++ b/board/freescale/mpc8349emds/mpc8349emds.c
@@ -273,11 +273,13 @@ void spi_cs_deactivate(struct spi_slave *slave)
#endif /* CONFIG_HARD_SPI */
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8349itx/mpc8349itx.c b/board/freescale/mpc8349itx/mpc8349itx.c
index 803d722..22a1d99 100644
--- a/board/freescale/mpc8349itx/mpc8349itx.c
+++ b/board/freescale/mpc8349itx/mpc8349itx.c
@@ -378,11 +378,13 @@ int misc_init_r(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8360emds/mpc8360emds.c b/board/freescale/mpc8360emds/mpc8360emds.c
index 5ff9dff..f0a55f8 100644
--- a/board/freescale/mpc8360emds/mpc8360emds.c
+++ b/board/freescale/mpc8360emds/mpc8360emds.c
@@ -402,7 +402,7 @@ static void ft_board_fixup_qe_usb(void *blob, bd_t *bd)
"peripheral", sizeof("peripheral"), 1);
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
@@ -447,5 +447,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
}
}
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8360erdk/mpc8360erdk.c b/board/freescale/mpc8360erdk/mpc8360erdk.c
index fef230b..478f820 100644
--- a/board/freescale/mpc8360erdk/mpc8360erdk.c
+++ b/board/freescale/mpc8360erdk/mpc8360erdk.c
@@ -340,9 +340,11 @@ void pci_init_board(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
ft_pci_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c
index c749e55..572913c 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -328,7 +328,7 @@ static void ft_pci_fixup(void *blob, bd_t *bd)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
ft_tsec_fixup(blob, bd);
@@ -340,5 +340,7 @@ void ft_board_setup(void *blob, bd_t *bd)
ft_pci_fixup(blob, bd);
ft_pcie_fixup(blob, bd);
#endif
+
+ return 0;
}
#endif /* CONFIG_OF_BOARD_SETUP */
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 9afdcaf..e0a1031 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -199,7 +199,7 @@ int misc_init_r(void)
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
@@ -207,5 +207,7 @@ void ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
fdt_fixup_dr_usb(blob, bd);
fdt_fixup_esdhc(blob, bd);
+
+ return 0;
}
#endif /* CONFIG_OF_BOARD_SETUP */
diff --git a/board/freescale/mpc8536ds/mpc8536ds.c b/board/freescale/mpc8536ds/mpc8536ds.c
index 93eed59..7b0f461 100644
--- a/board/freescale/mpc8536ds/mpc8536ds.c
+++ b/board/freescale/mpc8536ds/mpc8536ds.c
@@ -271,7 +271,7 @@ int board_eth_init(bd_t *bis)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
@@ -285,5 +285,6 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_dr_usb(blob, bd);
#endif
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8540ads/mpc8540ads.c b/board/freescale/mpc8540ads/mpc8540ads.c
index 93288c7..1069e2c 100644
--- a/board/freescale/mpc8540ads/mpc8540ads.c
+++ b/board/freescale/mpc8540ads/mpc8540ads.c
@@ -218,8 +218,7 @@ pci_init_board(void)
#if defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int node, tmp[2];
const char *path;
@@ -237,5 +236,7 @@ ft_board_setup(void *blob, bd_t *bd)
}
#endif
}
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8544ds/mpc8544ds.c b/board/freescale/mpc8544ds/mpc8544ds.c
index 1b33db6..66fb228 100644
--- a/board/freescale/mpc8544ds/mpc8544ds.c
+++ b/board/freescale/mpc8544ds/mpc8544ds.c
@@ -305,7 +305,7 @@ int board_eth_init(bd_t *bis)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
@@ -314,5 +314,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_FSL_SGMII_RISER
fsl_sgmii_riser_fdt_fixup(blob);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8560ads/mpc8560ads.c b/board/freescale/mpc8560ads/mpc8560ads.c
index 7104e33..f99d639 100644
--- a/board/freescale/mpc8560ads/mpc8560ads.c
+++ b/board/freescale/mpc8560ads/mpc8560ads.c
@@ -438,8 +438,7 @@ pci_init_board(void)
#if defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int node, tmp[2];
const char *path;
@@ -457,5 +456,7 @@ ft_board_setup(void *blob, bd_t *bd)
}
#endif
}
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8568mds/mpc8568mds.c b/board/freescale/mpc8568mds/mpc8568mds.c
index a8fdcb5..a5c5d9d 100644
--- a/board/freescale/mpc8568mds/mpc8568mds.c
+++ b/board/freescale/mpc8568mds/mpc8568mds.c
@@ -345,10 +345,12 @@ void pci_init_board(void)
#endif /* CONFIG_PCI */
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
FT_FSL_PCI_SETUP;
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c
index cb55e1c..836578f 100644
--- a/board/freescale/mpc8569mds/mpc8569mds.c
+++ b/board/freescale/mpc8569mds/mpc8569mds.c
@@ -514,7 +514,7 @@ void pci_init_board(void)
#endif /* CONFIG_PCI */
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
#if defined(CONFIG_SYS_UCC_RMII_MODE)
int nodeoff, off, err;
@@ -579,5 +579,7 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_board_fixup_esdhc(blob, bd);
fdt_board_fixup_qe_uart(blob, bd);
fdt_board_fixup_qe_usb(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c
index 1bbf832..3f68cf4 100644
--- a/board/freescale/mpc8572ds/mpc8572ds.c
+++ b/board/freescale/mpc8572ds/mpc8572ds.c
@@ -232,7 +232,7 @@ int board_eth_init(bd_t *bis)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -249,5 +249,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_FSL_SGMII_RISER
fsl_sgmii_riser_fdt_fixup(blob);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd.c b/board/freescale/mpc8610hpcd/mpc8610hpcd.c
index d8740dd..95e398c 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd.c
@@ -258,12 +258,13 @@ void pci_init_board(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
FT_FSL_PCI_SETUP;
+
+ return 0;
}
#endif
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index a58b5f9..1ab72f9 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -119,8 +119,7 @@ void pci_init_board(void)
#if defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int off;
u64 *tmp;
@@ -152,6 +151,8 @@ ft_board_setup(void *blob, bd_t *bd)
"in u-boot. This means your .dts might "
"be old.\n");
}
+
+ return 0;
}
#endif
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index 491b576..1cf0ab7 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -444,7 +444,7 @@ void fdt_disable_uart1(void *blob)
}
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -496,6 +496,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_del_flexcan(blob);
fdt_disable_uart1(blob);
}
+
+ return 0;
}
#endif
diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c
index f5e1851..d7dd478 100644
--- a/board/freescale/p1022ds/p1022ds.c
+++ b/board/freescale/p1022ds/p1022ds.c
@@ -332,7 +332,7 @@ static void ft_codec_setup(void *blob, const char *compatible)
}
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -356,5 +356,7 @@ void ft_board_setup(void *blob, bd_t *bd)
/* Update the WM8776 node's clock frequency property */
ft_codec_setup(blob, "wlf,wm8776");
+
+ return 0;
}
#endif
diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c
index d4d277b..56f561a 100644
--- a/board/freescale/p1023rdb/p1023rdb.c
+++ b/board/freescale/p1023rdb/p1023rdb.c
@@ -130,7 +130,7 @@ int board_eth_init(bd_t *bis)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -147,5 +147,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
fdt_fixup_fman_ethernet(blob);
+
+ return 0;
}
#endif
diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
index aba4f53..19fef50 100644
--- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
+++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <errno.h>
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/cache.h>
@@ -234,7 +235,7 @@ int board_eth_init(bd_t *bis)
#if defined(CONFIG_OF_BOARD_SETUP)
extern void ft_pci_board_setup(void *blob);
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
const char *soc_usb_compat = "fsl-usb2-dr";
int err, usb1_off, usb2_off;
@@ -263,39 +264,41 @@ void ft_board_setup(void *blob, bd_t *bd)
int off = fdt_node_offset_by_compatible(blob, -1,
soc_elbc_compat);
if (off < 0) {
- printf("WARNING: could not find compatible node"
- " %s: %s.\n", soc_elbc_compat,
- fdt_strerror(off));
- return;
+ printf("WARNING: could not find compatible node %s\n",
+ soc_elbc_compat);
+ return off;
}
err = fdt_del_node(blob, off);
if (err < 0) {
- printf("WARNING: could not remove %s: %s.\n",
- soc_elbc_compat, fdt_strerror(err));
+ printf("WARNING: could not remove %s\n",
+ soc_elbc_compat);
+ return err;
}
- return;
+ return 0;
}
#endif
/* Delete USB2 node as it is muxed with eLBC */
usb1_off = fdt_node_offset_by_compatible(blob, -1,
soc_usb_compat);
if (usb1_off < 0) {
- printf("WARNING: could not find compatible node"
- " %s: %s.\n", soc_usb_compat,
- fdt_strerror(usb1_off));
- return;
+ printf("WARNING: could not find compatible node %s\n",
+ soc_usb_compat);
+ return usb1_off;
}
usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
soc_usb_compat);
if (usb2_off < 0) {
- printf("WARNING: could not find compatible node"
- " %s: %s.\n", soc_usb_compat,
- fdt_strerror(usb2_off));
- return;
+ printf("WARNING: could not find compatible node %s\n",
+ soc_usb_compat);
+ return usb2_off;
}
err = fdt_del_node(blob, usb2_off);
- if (err < 0)
- printf("WARNING: could not remove %s: %s.\n",
- soc_usb_compat, fdt_strerror(err));
+ if (err < 0) {
+ printf("WARNING: could not remove %s\n", soc_usb_compat);
+ return err;
+ }
+
+ return 0;
}
+
#endif
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index a6756c6..66bc041 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <errno.h>
#include <hwconfig.h>
#include <pci.h>
#include <i2c.h>
@@ -424,7 +425,7 @@ static void fdt_board_fixup_qe_pins(void *blob)
#endif
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -459,17 +460,17 @@ void ft_board_setup(void *blob, bd_t *bd)
int off = fdt_node_offset_by_compatible(blob, -1,
soc_elbc_compat);
if (off < 0) {
- printf("WARNING: could not find compatible node %s: %s.\n",
- soc_elbc_compat,
- fdt_strerror(off));
- return;
+ printf("WARNING: could not find compatible node %s\n",
+ soc_elbc_compat);
+ return off;
}
err = fdt_del_node(blob, off);
if (err < 0) {
- printf("WARNING: could not remove %s: %s.\n",
- soc_elbc_compat, fdt_strerror(err));
+ printf("WARNING: could not remove %s\n",
+ soc_elbc_compat);
+ return err;
}
- return;
+ return 0;
}
#endif
@@ -477,24 +478,23 @@ void ft_board_setup(void *blob, bd_t *bd)
usb1_off = fdt_node_offset_by_compatible(blob, -1,
soc_usb_compat);
if (usb1_off < 0) {
- printf("WARNING: could not find compatible node %s: %s.\n",
- soc_usb_compat,
- fdt_strerror(usb1_off));
- return;
+ printf("WARNING: could not find compatible node %s\n",
+ soc_usb_compat);
+ return usb1_off;
}
usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
soc_usb_compat);
if (usb2_off < 0) {
- printf("WARNING: could not find compatible node %s: %s.\n",
- soc_usb_compat,
- fdt_strerror(usb2_off));
- return;
+ printf("WARNING: could not find compatible node %s\n",
+ soc_usb_compat);
+ return usb2_off;
}
err = fdt_del_node(blob, usb2_off);
if (err < 0) {
- printf("WARNING: could not remove %s: %s.\n",
- soc_usb_compat, fdt_strerror(err));
+ printf("WARNING: could not remove %s\n", soc_usb_compat);
+ return err;
}
+ return 0;
}
#endif
diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c
index a0a416b..a40bea3 100644
--- a/board/freescale/p1_twr/p1_twr.c
+++ b/board/freescale/p1_twr/p1_twr.c
@@ -261,7 +261,7 @@ static void fdt_board_fixup_qe_pins(void *blob)
#endif
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -283,5 +283,7 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_board_fixup_qe_pins(blob);
#endif
fdt_fixup_dr_usb(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/freescale/p2020come/p2020come.c b/board/freescale/p2020come/p2020come.c
index f777bb9..1db37e3 100644
--- a/board/freescale/p2020come/p2020come.c
+++ b/board/freescale/p2020come/p2020come.c
@@ -250,7 +250,7 @@ int board_eth_init(bd_t *bis)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -269,5 +269,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_HAS_FSL_DR_USB
fdt_fixup_dr_usb(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/p2020ds/p2020ds.c b/board/freescale/p2020ds/p2020ds.c
index b72fcff..5d18e8d 100644
--- a/board/freescale/p2020ds/p2020ds.c
+++ b/board/freescale/p2020ds/p2020ds.c
@@ -236,7 +236,7 @@ int board_eth_init(bd_t *bis)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -257,5 +257,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_FSL_SGMII_RISER
fsl_sgmii_riser_fdt_fixup(blob);
#endif
+
+ return 0;
}
#endif
diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c
index a14b43b..e600bdb 100644
--- a/board/freescale/p2041rdb/p2041rdb.c
+++ b/board/freescale/p2041rdb/p2041rdb.c
@@ -215,7 +215,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -239,4 +239,6 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_SYS_DPAA_FMAN
fdt_fixup_fman_ethernet(blob);
#endif
+
+ return 0;
}
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index 230870d..a0fca0d 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -235,9 +235,11 @@ int board_eth_init(bd_t *bis)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
FT_FSL_PCI_SETUP;
+
+ return 0;
}
#endif
diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c
index 19af46e..13285be 100644
--- a/board/freescale/t1040qds/t1040qds.c
+++ b/board/freescale/t1040qds/t1040qds.c
@@ -233,7 +233,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -259,6 +259,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
void qixis_dump_switch(void)
diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c
index ddb669f..4734f9d 100644
--- a/board/freescale/t104xrdb/t104xrdb.c
+++ b/board/freescale/t104xrdb/t104xrdb.c
@@ -85,7 +85,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -110,6 +110,8 @@ void ft_board_setup(void *blob, bd_t *bd)
#ifdef CONFIG_SYS_DPAA_FMAN
fdt_fixup_fman_ethernet(blob);
#endif
+
+ return 0;
}
#ifdef CONFIG_DEEP_SLEEP
diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c
index fc6d256..5c470c3 100644
--- a/board/freescale/t208xqds/t208xqds.c
+++ b/board/freescale/t208xqds/t208xqds.c
@@ -437,7 +437,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -460,4 +460,6 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c
index be99fb8..341453b 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -103,7 +103,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -126,4 +126,6 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c
index 479e124..5441094 100644
--- a/board/freescale/t4qds/t4240emu.c
+++ b/board/freescale/t4qds/t4240emu.c
@@ -69,7 +69,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -83,4 +83,6 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
fdt_fixup_dr_usb(blob, bd);
+
+ return 0;
}
diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c
index 6205fea..4f2cccd 100644
--- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c
@@ -683,7 +683,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -706,6 +706,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
/*
diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c
index afef7e9..d688f09 100644
--- a/board/freescale/t4rdb/t4240rdb.c
+++ b/board/freescale/t4rdb/t4240rdb.c
@@ -76,7 +76,7 @@ int misc_init_r(void)
return 0;
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -99,6 +99,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_board_enet(blob);
#endif
+
+ return 0;
}
/*
diff --git a/board/galaxy5200/galaxy5200.c b/board/galaxy5200/galaxy5200.c
index 29e40eb..5d957b7 100644
--- a/board/galaxy5200/galaxy5200.c
+++ b/board/galaxy5200/galaxy5200.c
@@ -146,9 +146,11 @@ int checkboard(void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t * bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 1038d9d..29499bf 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -1482,7 +1482,7 @@ int misc_init_r(void)
* - board (full model from EEPROM)
* - peripherals removed from DTB if not loaded on board (per EEPROM config)
*/
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
struct ventana_board_info *info = &ventana_info;
struct ventana_eeprom_config *cfg;
@@ -1494,7 +1494,7 @@ void ft_board_setup(void *blob, bd_t *bd)
if (getenv("fdt_noauto")) {
puts(" Skiping ft_board_setup (fdt_noauto defined)\n");
- return;
+ return 0;
}
/* Update partition nodes using info from mtdparts env var */
@@ -1503,7 +1503,7 @@ void ft_board_setup(void *blob, bd_t *bd)
if (!model) {
puts("invalid board info: Leaving FDT fully enabled\n");
- return;
+ return 0;
}
printf(" Adjusting FDT per EEPROM for %s...\n", model);
@@ -1522,7 +1522,7 @@ void ft_board_setup(void *blob, bd_t *bd)
*/
if (getenv("fdt_noconfig")) {
puts(" Skiping periperhal config (fdt_noconfig defined)\n");
- return;
+ return 0;
}
cfg = econfig;
while (cfg->name) {
@@ -1532,6 +1532,8 @@ void ft_board_setup(void *blob, bd_t *bd)
}
cfg++;
}
+
+ return 0;
}
#endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/gdsys/intip/intip.c b/board/gdsys/intip/intip.c
index ee6f9e0..8d01d8b 100644
--- a/board/gdsys/intip/intip.c
+++ b/board/gdsys/intip/intip.c
@@ -206,7 +206,7 @@ int misc_init_r(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
extern void __ft_board_setup(void *blob, bd_t *bd);
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
__ft_board_setup(blob, bd);
@@ -215,5 +215,7 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_find_and_setprop(blob, "/plb/sata at bffd1000", "status",
"disabled", sizeof("disabled"), 1);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index f76d968..64d90dd 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -326,7 +326,7 @@ int board_eth_init(bd_t *bis)
}
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -343,6 +343,8 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
FT_FSL_PCI_SETUP;
+
+ return 0;
}
#endif
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index a1b6749..fc2385c 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -94,7 +94,7 @@ void dram_init_banksize(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *fdt, bd_t *bd)
+int ft_board_setup(void *fdt, bd_t *bd)
{
static const char disabled[] = "disabled";
u32 reg = readl(HB_SREG_A9_PWRDOM_STAT);
@@ -106,6 +106,8 @@ void ft_board_setup(void *fdt, bd_t *bd)
if (!(reg & PWRDOM_STAT_EMMC))
do_fixup_by_compat(fdt, "calxeda,hb-sdhci", "status",
disabled, sizeof(disabled), 1);
+
+ return 0;
}
#endif
diff --git a/board/icecube/icecube.c b/board/icecube/icecube.c
index a99416b..f0af24a 100644
--- a/board/icecube/icecube.c
+++ b/board/icecube/icecube.c
@@ -311,10 +311,11 @@ void ide_set_reset (int idereset)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/ids/ids8247/ids8247.c b/board/ids/ids8247/ids8247.c
index 1b2d0e0..3514720 100644
--- a/board/ids/ids8247/ids8247.c
+++ b/board/ids/ids8247/ids8247.c
@@ -383,8 +383,10 @@ int board_nand_init(struct nand_chip *nand)
#endif /* CONFIG_CMD_NAND */
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup( blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/ids/ids8313/ids8313.c b/board/ids/ids8313/ids8313.c
index f742143..e7838dc 100644
--- a/board/ids/ids8313/ids8313.c
+++ b/board/ids/ids8313/ids8313.c
@@ -138,9 +138,11 @@ phys_size_t initdram(int board_type)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/ifm/ac14xx/ac14xx.c b/board/ifm/ac14xx/ac14xx.c
index 0fbdfdb..5d2ab2f 100644
--- a/board/ifm/ac14xx/ac14xx.c
+++ b/board/ifm/ac14xx/ac14xx.c
@@ -608,8 +608,10 @@ int checkboard(void)
}
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/ifm/o2dnt2/o2dnt2.c b/board/ifm/o2dnt2/o2dnt2.c
index 6716ffc..ca09767 100644
--- a/board/ifm/o2dnt2/o2dnt2.c
+++ b/board/ifm/o2dnt2/o2dnt2.c
@@ -364,7 +364,7 @@ int update_flash_size(int flash_size)
}
#endif /* defined(CONFIG_SYS_UPDATE_FLASH_SIZE) */
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int phy_addr = CONFIG_PHY_ADDR;
char eth_path[] = "/soc5200 at f0000000/mdio at 3000/ethernet-phy at 0";
@@ -380,5 +380,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
/* fix up the phy address */
do_fixup_by_path(blob, eth_path, "reg", &phy_addr, sizeof(int), 0);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/intercontrol/digsy_mtc/digsy_mtc.c b/board/intercontrol/digsy_mtc/digsy_mtc.c
index 5843725..4ab7160 100644
--- a/board/intercontrol/digsy_mtc/digsy_mtc.c
+++ b/board/intercontrol/digsy_mtc/digsy_mtc.c
@@ -454,7 +454,7 @@ int update_flash_size (int flash_size)
}
#endif /* defined(CONFIG_SYS_UPDATE_FLASH_SIZE) */
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int phy_addr = CONFIG_PHY_ADDR;
char eth_path[] = "/soc5200 at f0000000/mdio at 3000/ethernet-phy at 0";
@@ -478,5 +478,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
/* fix up the phy address */
do_fixup_by_path(blob, eth_path, "reg", &phy_addr, sizeof(int), 0);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/ipek01/ipek01.c b/board/ipek01/ipek01.c
index d44c4bf..2078f53 100644
--- a/board/ipek01/ipek01.c
+++ b/board/ipek01/ipek01.c
@@ -196,10 +196,12 @@ void pci_init_board (void)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup (void *blob, bd_t * bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup (blob, bd);
fdt_fixup_memory (blob, (u64) bd->bi_memstart, (u64) bd->bi_memsize);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/jupiter/jupiter.c b/board/jupiter/jupiter.c
index 78e4b5d..8856393 100644
--- a/board/jupiter/jupiter.c
+++ b/board/jupiter/jupiter.c
@@ -283,9 +283,10 @@ void ide_set_reset (int idereset)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index dfbfab8..e200935 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -460,8 +460,10 @@ static void setports(int gpio)
}
#endif
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 0543483..1da0dcb 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -359,9 +359,11 @@ int checkboard(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 4a73613..a74f75b 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -261,7 +261,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
}
#endif
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
@@ -286,6 +286,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_fman_ethernet(blob);
fdt_fixup_fman_mac_addresses(blob);
#endif
+
+ return 0;
}
#if defined(CONFIG_POST)
diff --git a/board/korat/korat.c b/board/korat/korat.c
index 8b83000..d9ab2fd 100644
--- a/board/korat/korat.c
+++ b/board/korat/korat.c
@@ -610,7 +610,7 @@ void pci_target_init(struct pci_controller *hose)
#endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT) */
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
u32 val[4];
int rc;
@@ -627,5 +627,7 @@ void ft_board_setup(void *blob, bd_t *bd)
if (rc)
printf("Unable to update property NOR mapping, err=%s\n",
fdt_strerror(rc));
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/kup/kup4k/kup4k.c b/board/kup/kup4k/kup4k.c
index a4c1998..71c6a79 100644
--- a/board/kup/kup4k/kup4k.c
+++ b/board/kup/kup4k/kup4k.c
@@ -280,8 +280,10 @@ static unsigned char swapbyte(unsigned char c)
* Device Tree Support
*/
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/manroland/mucmc52/mucmc52.c b/board/manroland/mucmc52/mucmc52.c
index c3ce66d..c8ed5b7 100644
--- a/board/manroland/mucmc52/mucmc52.c
+++ b/board/manroland/mucmc52/mucmc52.c
@@ -385,8 +385,10 @@ void pci_init_board (void)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/manroland/uc101/uc101.c b/board/manroland/uc101/uc101.c
index 5c5afa2..e794c46 100644
--- a/board/manroland/uc101/uc101.c
+++ b/board/manroland/uc101/uc101.c
@@ -358,8 +358,10 @@ void hw_watchdog_reset(void)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/motionpro/motionpro.c b/board/motionpro/motionpro.c
index a6235e5..4d0ebaa 100644
--- a/board/motionpro/motionpro.c
+++ b/board/motionpro/motionpro.c
@@ -185,9 +185,11 @@ int checkboard(void)
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/mpc8308_p1m/mpc8308_p1m.c b/board/mpc8308_p1m/mpc8308_p1m.c
index 2009e62..688cc12 100644
--- a/board/mpc8308_p1m/mpc8308_p1m.c
+++ b/board/mpc8308_p1m/mpc8308_p1m.c
@@ -62,10 +62,12 @@ void pci_init_board(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
fdt_fixup_dr_usb(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/muas3001/muas3001.c b/board/muas3001/muas3001.c
index 08eb5e8..529a58c 100644
--- a/board/muas3001/muas3001.c
+++ b/board/muas3001/muas3001.c
@@ -329,9 +329,11 @@ void ft_blob_update (void *blob, bd_t *bd)
}
}
-void ft_board_setup (void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup (blob, bd);
ft_blob_update (blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/munices/munices.c b/board/munices/munices.c
index 319fa8c..23d0f56 100644
--- a/board/munices/munices.c
+++ b/board/munices/munices.c
@@ -146,9 +146,10 @@ void pci_init_board(void)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index 15f8f31..81f3024 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -477,7 +477,7 @@ static unsigned char edid_buf[128] = {
};
#endif
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
u32 val[8];
int rc, i = 0;
@@ -526,6 +526,8 @@ void ft_board_setup(void *blob, bd_t *bd)
if (rc)
printf("Unable to update flash reg property, err=%s\n",
fdt_strerror(rc));
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/phytec/pcm030/pcm030.c b/board/phytec/pcm030/pcm030.c
index ce515d8..ed41de1 100644
--- a/board/phytec/pcm030/pcm030.c
+++ b/board/phytec/pcm030/pcm030.c
@@ -164,9 +164,11 @@ void pci_init_board(void)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t * bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/raspberrypi/rpi_b/rpi_b.c b/board/raspberrypi/rpi_b/rpi_b.c
index 447c940..edc10eb 100644
--- a/board/raspberrypi/rpi_b/rpi_b.c
+++ b/board/raspberrypi/rpi_b/rpi_b.c
@@ -125,7 +125,7 @@ int board_mmc_init(bd_t *bis)
msg_clk->get_clock_rate.body.resp.rate_hz);
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
/*
* For now, we simply always add the simplefb DT node. Later, we
@@ -133,4 +133,6 @@ void ft_board_setup(void *blob, bd_t *bd)
* node exists for the "real" graphics driver.
*/
lcd_dt_simplefb_add_node(blob);
+
+ return 0;
}
diff --git a/board/sbc8349/sbc8349.c b/board/sbc8349/sbc8349.c
index 89da47e..72786d2 100644
--- a/board/sbc8349/sbc8349.c
+++ b/board/sbc8349/sbc8349.c
@@ -214,11 +214,13 @@ void sdram_init(void)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/sbc8548/sbc8548.c b/board/sbc8548/sbc8548.c
index d584276..25329e4 100644
--- a/board/sbc8548/sbc8548.c
+++ b/board/sbc8548/sbc8548.c
@@ -301,12 +301,14 @@ int last_stage_init(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_FSL_PCI_INIT
FT_FSL_PCI_SETUP;
#endif
+
+ return 0;
}
#endif
diff --git a/board/sbc8641d/sbc8641d.c b/board/sbc8641d/sbc8641d.c
index 4906be4..6bdf1a2 100644
--- a/board/sbc8641d/sbc8641d.c
+++ b/board/sbc8641d/sbc8641d.c
@@ -173,11 +173,13 @@ void pci_init_board(void)
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup (void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
FT_FSL_PCI_SETUP;
+
+ return 0;
}
#endif
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index 2caefbb..953a43f 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -218,8 +218,7 @@ int board_early_init_r (void)
#endif /* CONFIG_BOARD_EARLY_INIT_R */
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void
-ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
u32 val[12];
int rc, i = 0;
@@ -251,6 +250,8 @@ ft_board_setup(void *blob, bd_t *bd)
if (rc)
printf("Unable to update localbus ranges, err=%s\n",
fdt_strerror(rc));
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/stx/stxssa/stxssa.c b/board/stx/stxssa/stxssa.c
index f5c3d75..6e4eed8 100644
--- a/board/stx/stxssa/stxssa.c
+++ b/board/stx/stxssa/stxssa.c
@@ -233,9 +233,11 @@ reset_phy(void)
}
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup (blob, bd);
+
+ return 0;
}
#endif /* CONFIG_OF_BOARD_SETUP */
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index dfe7be6..0c53a39 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -84,7 +84,7 @@ int board_eth_init(bd_t *bis)
#endif
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
int lpae;
char *env;
@@ -190,6 +190,8 @@ void ft_board_setup(void *blob, bd_t *bd)
}
}
}
+
+ return 0;
}
void ft_board_setup_ex(void *blob, bd_t *bd)
diff --git a/board/tqc/tqm5200/tqm5200.c b/board/tqc/tqm5200/tqm5200.c
index a1f56cd..e9363ea 100644
--- a/board/tqc/tqm5200/tqm5200.c
+++ b/board/tqc/tqm5200/tqm5200.c
@@ -863,12 +863,14 @@ int board_get_height (void)
#endif /* CONFIG_VIDEO_SM501 */
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#if defined(CONFIG_VIDEO)
fdt_add_edid(blob, "smi,sm501", edid_buf);
#endif
+
+ return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
diff --git a/board/tqc/tqm834x/tqm834x.c b/board/tqc/tqm834x/tqm834x.c
index 814fcb2..d891a38 100644
--- a/board/tqc/tqm834x/tqm834x.c
+++ b/board/tqc/tqm834x/tqm834x.c
@@ -414,12 +414,14 @@ static void set_ddr_config(void) {
}
#ifdef CONFIG_OF_BOARD_SETUP
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif /* CONFIG_PCI */
+
+ return 0;
}
#endif /* CONFIG_OF_BOARD_SETUP */
diff --git a/board/tqc/tqm8xx/tqm8xx.c b/board/tqc/tqm8xx/tqm8xx.c
index 9ce2a57..3b5230a 100644
--- a/board/tqc/tqm8xx/tqm8xx.c
+++ b/board/tqc/tqm8xx/tqm8xx.c
@@ -674,10 +674,12 @@ void ft_blob_update (void *blob, bd_t *bd)
}
}
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
ft_blob_update(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index b552bb8..fa35e8b 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -251,12 +251,14 @@ int checkboard(void)
* Device Tree Support
*/
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
/* bring in eMMC dsr settings */
do_fixup_by_path_u32(blob,
"/soc/aips-bus at 02100000/usdhc at 02198000",
"dsr", tqma6_emmc_dsr, 2);
tqma6_bb_ft_board_setup(blob, bd);
+
+ return 0;
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/ve8313/ve8313.c b/board/ve8313/ve8313.c
index c4feef8..7f24a30 100644
--- a/board/ve8313/ve8313.c
+++ b/board/ve8313/ve8313.c
@@ -192,11 +192,13 @@ void pci_init_board(void)
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
ft_cpu_setup(blob, bd);
#ifdef CONFIG_PCI
ft_pci_setup(blob, bd);
#endif
+
+ return 0;
}
#endif
diff --git a/board/xes/xpedite517x/xpedite517x.c b/board/xes/xpedite517x/xpedite517x.c
index b7ad349..0028870 100644
--- a/board/xes/xpedite517x/xpedite517x.c
+++ b/board/xes/xpedite517x/xpedite517x.c
@@ -69,11 +69,13 @@ phys_size_t initdram(int board_type)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
#ifdef CONFIG_PCI
ft_board_pci_setup(blob, bd);
#endif
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/xes/xpedite520x/xpedite520x.c b/board/xes/xpedite520x/xpedite520x.c
index aa9e99d..6a3df52 100644
--- a/board/xes/xpedite520x/xpedite520x.c
+++ b/board/xes/xpedite520x/xpedite520x.c
@@ -70,11 +70,13 @@ int board_early_init_r(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
#ifdef CONFIG_PCI
ft_board_pci_setup(blob, bd);
#endif
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/xes/xpedite537x/xpedite537x.c b/board/xes/xpedite537x/xpedite537x.c
index efd563b..41419fe 100644
--- a/board/xes/xpedite537x/xpedite537x.c
+++ b/board/xes/xpedite537x/xpedite537x.c
@@ -72,11 +72,13 @@ int board_early_init_r(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
#ifdef CONFIG_PCI
ft_board_pci_setup(blob, bd);
#endif
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/board/xes/xpedite550x/xpedite550x.c b/board/xes/xpedite550x/xpedite550x.c
index e64d682..1f05150 100644
--- a/board/xes/xpedite550x/xpedite550x.c
+++ b/board/xes/xpedite550x/xpedite550x.c
@@ -72,11 +72,13 @@ int board_early_init_r(void)
}
#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
{
#ifdef CONFIG_PCI
ft_board_pci_setup(blob, bd);
#endif
ft_cpu_setup(blob, bd);
+
+ return 0;
}
#endif
diff --git a/include/fdt_support.h b/include/fdt_support.h
index c3d1fbc..41ce535 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -64,7 +64,17 @@ static inline void fdt_fixup_crypto_node(void *blob, int sec_rev) {}
int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose);
#endif
-void ft_board_setup(void *blob, bd_t *bd);
+/**
+ * Add board-specific data to the FDT before booting the OS.
+ *
+ * Use CONFIG_SYS_FDT_PAD to ensure there is sufficient space.
+ *
+ * @param blob FDT blob to update
+ * @param bd_t Pointer to board data
+ * @return 0 if ok, or -FDT_ERR_... on error
+ */
+int ft_board_setup(void *blob, bd_t *bd);
+
/*
* The keystone2 SOC requires all 32 bit aliased addresses to be converted
* to their 36 physical format. This has to happen after all fdt nodes
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup()
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 15:15 ` Anatolij Gustschin
2014-10-24 18:05 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function Simon Glass
` (10 subsequent siblings)
11 siblings, 2 replies; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
Since this function can fail, print a message when it does.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Improve error message on failure
common/cmd_fdt.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 5640ded..6f7ea08 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -566,8 +566,15 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
#ifdef CONFIG_OF_BOARD_SETUP
/* Call the board-specific fixup routine */
- else if (strncmp(argv[1], "boa", 3) == 0)
- ft_board_setup(working_fdt, gd->bd);
+ else if (strncmp(argv[1], "boa", 3) == 0) {
+ int err = ft_board_setup(working_fdt, gd->bd);
+
+ if (err) {
+ printf("Failed to update board information in FDT: %s\n",
+ fdt_strerror(err));
+ return CMD_RET_FAILURE;
+ }
+ }
#endif
/* Create a chosen node */
else if (strncmp(argv[1], "cho", 3) == 0) {
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup()
2014-10-24 0:58 ` [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup() Simon Glass
@ 2014-10-24 15:15 ` Anatolij Gustschin
2014-10-24 18:05 ` Tom Rini
1 sibling, 0 replies; 46+ messages in thread
From: Anatolij Gustschin @ 2014-10-24 15:15 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Thu, 23 Oct 2014 18:58:48 -0600
Simon Glass <sjg@chromium.org> wrote:
> Since this function can fail, print a message when it does.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Improve error message on failure
>
> common/cmd_fdt.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Acked-by: Anatolij Gustschin <agust@denx.de>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup()
2014-10-24 0:58 ` [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup() Simon Glass
2014-10-24 15:15 ` Anatolij Gustschin
@ 2014-10-24 18:05 ` Tom Rini
2014-11-21 3:24 ` Simon Glass
1 sibling, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:05 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:48PM -0600, Simon Glass wrote:
> Since this function can fail, print a message when it does.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/3a49d628/attachment-0001.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup()
2014-10-24 18:05 ` Tom Rini
@ 2014-11-21 3:24 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-21 3:24 UTC (permalink / raw)
To: u-boot
On 24 October 2014 19:05, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:48PM -0600, Simon Glass wrote:
>
>> Since this function can fail, print a message when it does.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Tom Rini <trini@ti.com>
Applied to u-boot-fdt.
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup() Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 16:48 ` Anatolij Gustschin
2014-10-24 18:05 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings Simon Glass
` (9 subsequent siblings)
11 siblings, 2 replies; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
This function is useful for ensuring that a node exists. Export it so it
can be used more widely.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Leave function documentation hidden in the C file
common/fdt_support.c | 6 +++---
include/fdt_support.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 3f64156..46a15e7 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -113,7 +113,8 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
}
/**
- * fdt_find_or_add_subnode - find or possibly add a subnode of a given node
+ * fdt_find_or_add_subnode() - find or possibly add a subnode of a given node
+ *
* @fdt: pointer to the device tree blob
* @parentoffset: structure block offset of a node
* @name: name of the subnode to locate
@@ -121,8 +122,7 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
* fdt_subnode_offset() finds a subnode of the node with a given name.
* If the subnode does not exist, it will be created.
*/
-static int fdt_find_or_add_subnode(void *fdt, int parentoffset,
- const char *name)
+int fdt_find_or_add_subnode(void *fdt, int parentoffset, const char *name)
{
int offset;
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 41ce535..e17e609 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -64,6 +64,8 @@ static inline void fdt_fixup_crypto_node(void *blob, int sec_rev) {}
int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose);
#endif
+int fdt_find_or_add_subnode(void *fdt, int parentoffset, const char *name);
+
/**
* Add board-specific data to the FDT before booting the OS.
*
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function
2014-10-24 0:58 ` [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function Simon Glass
@ 2014-10-24 16:48 ` Anatolij Gustschin
2014-10-24 18:05 ` Tom Rini
1 sibling, 0 replies; 46+ messages in thread
From: Anatolij Gustschin @ 2014-10-24 16:48 UTC (permalink / raw)
To: u-boot
On Thu, 23 Oct 2014 18:58:49 -0600
Simon Glass <sjg@chromium.org> wrote:
> This function is useful for ensuring that a node exists. Export it so it
> can be used more widely.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Leave function documentation hidden in the C file
>
> common/fdt_support.c | 6 +++---
> include/fdt_support.h | 2 ++
> 2 files changed, 5 insertions(+), 3 deletions(-)
Acked-by: Anatolij Gustschin <agust@denx.de>
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function
2014-10-24 0:58 ` [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function Simon Glass
2014-10-24 16:48 ` Anatolij Gustschin
@ 2014-10-24 18:05 ` Tom Rini
2014-11-21 3:24 ` Simon Glass
1 sibling, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:05 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:49PM -0600, Simon Glass wrote:
> This function is useful for ensuring that a node exists. Export it so it
> can be used more widely.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/ea33a7cd/attachment-0001.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function
2014-10-24 18:05 ` Tom Rini
@ 2014-11-21 3:24 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-21 3:24 UTC (permalink / raw)
To: u-boot
On 24 October 2014 20:05, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:49PM -0600, Simon Glass wrote:
>
>> This function is useful for ensuring that a node exists. Export it so it
>> can be used more widely.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Tom Rini <trini@ti.com>
Applied to u-boot-fdt.
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup() Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 05/11] fdt: Use the correct return types for fdtdec_decode_region() Simon Glass
` (8 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
From: Michael Pratt <mpratt@chromium.org>
Support a default memory bank, specified in reg, as well as
board-specific memory banks in subtree board-id nodes.
This allows memory information to be provided in the device tree,
rather than hard-coded in, which will make it simpler to handle
similar devices with different memory banks, as the board-id values
or masks can be used to match devices.
Signed-off-by: Michael Pratt <mpratt@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
---
Changes in v2: None
common/fdt_support.c | 2 +-
doc/device-tree-bindings/memory/memory.txt | 67 ++++++++++++++++++
include/fdtdec.h | 33 +++++++++
lib/fdtdec.c | 107 +++++++++++++++++++++++++++++
4 files changed, 208 insertions(+), 1 deletion(-)
create mode 100644 doc/device-tree-bindings/memory/memory.txt
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 46a15e7..6da5297 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -382,7 +382,7 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
/*
* fdt_pack_reg - pack address and size array into the "reg"-suitable stream
*/
-static int fdt_pack_reg(const void *fdt, void *buf, uint64_t *address,
+int fdt_pack_reg(const void *fdt, void *buf, uint64_t *address,
uint64_t *size, int n)
{
int i;
diff --git a/doc/device-tree-bindings/memory/memory.txt b/doc/device-tree-bindings/memory/memory.txt
new file mode 100644
index 0000000..321894e
--- /dev/null
+++ b/doc/device-tree-bindings/memory/memory.txt
@@ -0,0 +1,67 @@
+* Memory binding
+
+The memory binding for U-Boot is as in the ePAPR with the following additions:
+
+Optional subnodes can be used defining the memory layout for different board
+ID masks. To match a set of board ids, a board-id node may define match-mask
+and match-value ints to define a mask to apply to the board id, and the value
+that the result should have for the match to be considered valid. The mask
+defaults to -1, meaning that the value must fully match the board id.
+
+If subnodes are present, then the /memory node must define these properties:
+
+- #address-cells: should be 1.
+- #size-cells: should be 0.
+
+Each subnode must define
+
+ reg - board ID or mask for this subnode
+ memory-banks - list of memory banks in the same format as normal
+
+Each subnode may optionally define:
+
+ match-mask - A mask to apply to the board id. This must be accompanied by
+ match-value.
+ match-value - The required resulting value of the board id mask for the given
+ node to be considered a match.
+ auto-size - Indicates that the value given for a bank is the maximum size,
+ each bank is probed to determine its actual size, which may be
+ smaller
+
+
+The board id determination is up to the vendor and is not defined by this
+binding.
+
+Example:
+
+memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0x20000000 0x20000000
+ 0x40000000 0x20000000
+ 0x60000000 0x20000000
+ 0x80000000 0x20000000>;
+ auto-size;
+ board-id at 0 {
+ match-value = <17>;
+ reg = <0x20000000 0x20000000
+ 0x40000000 0x20000000>;
+ };
+ board-id at 1 {
+ match-mask = <2>;
+ match-value = <2>;
+ reg = <0x20000000 0x20000000
+ 0x40000000 0x20000000
+ 0x60000000 0x20000000
+ 0x80000000 0x20000000
+ 0xa0000000 0x20000000
+ 0xc0000000 0x20000000
+ 0xe0000000 0x20000000>;
+ };
+};
+
+
+This shows a system with the following properties:
+* Default of 2GB of memory, auto-sized, so could be smaller
+* 3.5GB of memory (with no auto-size) if (board id & 2) is 2
+* 1GB of memory (with no auto-size) if board id is 17.
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 4ae77be..5fb86b0 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -661,4 +661,37 @@ int fdt_get_named_resource(const void *fdt, int node, const char *property,
*/
int fdtdec_pci_get_bdf(const void *fdt, int node, int *bdf);
+/**
+ * Decode the size of memory
+ *
+ * RAM size is normally set in a /memory node and consists of a list of
+ * (base, size) cells in the 'reg' property. This information is used to
+ * determine the total available memory as well as the address and size
+ * of each bank.
+ *
+ * Optionally the memory configuration can vary depending on a board id,
+ * typically read from strapping resistors or an EEPROM on the board.
+ *
+ * Finally, memory size can be detected (within certain limits) by probing
+ * the available memory. It is safe to do so within the limits provides by
+ * the board's device tree information. This makes it possible to produce
+ * boards with different memory sizes, where the device tree specifies the
+ * maximum memory configuration, and the smaller memory configuration is
+ * probed.
+ *
+ * This function decodes that information, returning the memory base address,
+ * size and bank information. See the memory.txt binding for full
+ * documentation.
+ *
+ * @param blob Device tree blob
+ * @param area Name of node to check (NULL means "/memory")
+ * @param board_id Board ID to look up
+ * @param basep Returns base address of first memory bank (NULL to
+ * ignore)
+ * @param sizep Returns total memory size (NULL to ignore)
+ * @param bd Updated with the memory bank information (NULL to skip)
+ * @return 0 if OK, -ve on error
+ */
+int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
+ phys_addr_t *basep, phys_size_t *sizep, bd_t *bd);
#endif
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 9714620..d5a6a3e 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -6,10 +6,12 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <errno.h>
+#include <fdt_support.h>
#include <serial.h>
#include <libfdt.h>
#include <fdtdec.h>
#include <linux/ctype.h>
+#include <asm/types.h>
#include <asm/gpio.h>
@@ -780,4 +782,109 @@ int fdtdec_pci_get_bdf(const void *fdt, int node, int *bdf)
return 0;
}
+
+int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
+ phys_addr_t *basep, phys_size_t *sizep, bd_t *bd)
+{
+ int addr_cells, size_cells;
+ const u32 *cell, *end;
+ u64 total_size, size, addr;
+ int node, child;
+ bool auto_size;
+ int bank;
+ int len;
+
+ debug("%s: board_id=%d\n", __func__, board_id);
+ if (!area)
+ area = "/memory";
+ node = fdt_path_offset(blob, area);
+ if (node < 0) {
+ debug("No %s node found\n", area);
+ return -ENOENT;
+ }
+
+ cell = fdt_getprop(blob, node, "reg", &len);
+ if (!cell) {
+ debug("No reg property found\n");
+ return -ENOENT;
+ }
+
+ addr_cells = fdt_address_cells(blob, node);
+ size_cells = fdt_size_cells(blob, node);
+
+ /* Check the board id and mask */
+ for (child = fdt_first_subnode(blob, node);
+ child >= 0;
+ child = fdt_next_subnode(blob, child)) {
+ int match_mask, match_value;
+
+ match_mask = fdtdec_get_int(blob, child, "match-mask", -1);
+ match_value = fdtdec_get_int(blob, child, "match-value", -1);
+
+ if (match_value >= 0 &&
+ ((board_id & match_mask) == match_value)) {
+ /* Found matching mask */
+ debug("Found matching mask %d\n", match_mask);
+ node = child;
+ cell = fdt_getprop(blob, node, "reg", &len);
+ if (!cell) {
+ debug("No memory-banks property found\n");
+ return -EINVAL;
+ }
+ break;
+ }
+ }
+ /* Note: if no matching subnode was found we use the parent node */
+
+ if (bd) {
+ memset(bd->bi_dram, '\0', sizeof(bd->bi_dram[0]) *
+ CONFIG_NR_DRAM_BANKS);
+ }
+
+ auto_size = fdtdec_get_bool(blob, node, "auto-size");
+
+ total_size = 0;
+ end = cell + len / 4 - addr_cells - size_cells;
+ debug("cell at %p, end %p\n", cell, end);
+ for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+ if (cell > end)
+ break;
+ addr = 0;
+ if (addr_cells == 2)
+ addr += (u64)fdt32_to_cpu(*cell++) << 32UL;
+ addr += fdt32_to_cpu(*cell++);
+ if (bd)
+ bd->bi_dram[bank].start = addr;
+ if (basep && !bank)
+ *basep = (phys_addr_t)addr;
+
+ size = 0;
+ if (size_cells == 2)
+ size += (u64)fdt32_to_cpu(*cell++) << 32UL;
+ size += fdt32_to_cpu(*cell++);
+
+ if (auto_size) {
+ u64 new_size;
+
+ debug("Auto-sizing %llx, size %llx: ", addr, size);
+ new_size = get_ram_size((long *)(uintptr_t)addr, size);
+ if (new_size == size) {
+ debug("OK\n");
+ } else {
+ debug("sized to %llx\n", new_size);
+ size = new_size;
+ }
+ }
+
+ if (bd)
+ bd->bi_dram[bank].size = size;
+ total_size += size;
+ }
+
+ debug("Memory size %llu\n", total_size);
+ if (sizep)
+ *sizep = (phys_size_t)total_size;
+
+ return 0;
+}
#endif
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-24 0:58 ` [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings Simon Glass
@ 2014-10-24 18:49 ` Tom Rini
2014-10-24 20:04 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:49 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
> From: Michael Pratt <mpratt@chromium.org>
>
> Support a default memory bank, specified in reg, as well as
> board-specific memory banks in subtree board-id nodes.
>
> This allows memory information to be provided in the device tree,
> rather than hard-coded in, which will make it simpler to handle
> similar devices with different memory banks, as the board-id values
> or masks can be used to match devices.
[snip]
> +++ b/doc/device-tree-bindings/memory/memory.txt
> @@ -0,0 +1,67 @@
> +* Memory binding
> +
> +The memory binding for U-Boot is as in the ePAPR with the following additions:
I am wary of being different from ePAPR / Linux Kernel. What do we need
this for / when do we use it?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/ea4d1ae6/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-24 18:49 ` Tom Rini
@ 2014-10-24 20:04 ` Simon Glass
2014-10-27 14:24 ` Tom Rini
0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 20:04 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 24 October 2014 12:49, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
>
>> From: Michael Pratt <mpratt@chromium.org>
>>
>> Support a default memory bank, specified in reg, as well as
>> board-specific memory banks in subtree board-id nodes.
>>
>> This allows memory information to be provided in the device tree,
>> rather than hard-coded in, which will make it simpler to handle
>> similar devices with different memory banks, as the board-id values
>> or masks can be used to match devices.
> [snip]
>> +++ b/doc/device-tree-bindings/memory/memory.txt
>> @@ -0,0 +1,67 @@
>> +* Memory binding
>> +
>> +The memory binding for U-Boot is as in the ePAPR with the following additions:
>
> I am wary of being different from ePAPR / Linux Kernel. What do we need
> this for / when do we use it?
This extends the existing binding. It allows the location and size of
memory to be set by a board ID. Unfortunately on sopme hardware you
get a hang if you try to access memory that doesn't exist, so this
allows the range of available memory to be defined - or at least the
maximum bound since we still probe the memory size within that range.
This feature is used on several Exynos Chromebooks.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-24 20:04 ` Simon Glass
@ 2014-10-27 14:24 ` Tom Rini
2014-10-27 18:50 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-27 14:24 UTC (permalink / raw)
To: u-boot
On Fri, Oct 24, 2014 at 02:04:00PM -0600, Simon Glass wrote:
> Hi Tom,
>
> On 24 October 2014 12:49, Tom Rini <trini@ti.com> wrote:
> > On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
> >
> >> From: Michael Pratt <mpratt@chromium.org>
> >>
> >> Support a default memory bank, specified in reg, as well as
> >> board-specific memory banks in subtree board-id nodes.
> >>
> >> This allows memory information to be provided in the device tree,
> >> rather than hard-coded in, which will make it simpler to handle
> >> similar devices with different memory banks, as the board-id values
> >> or masks can be used to match devices.
> > [snip]
> >> +++ b/doc/device-tree-bindings/memory/memory.txt
> >> @@ -0,0 +1,67 @@
> >> +* Memory binding
> >> +
> >> +The memory binding for U-Boot is as in the ePAPR with the following additions:
> >
> > I am wary of being different from ePAPR / Linux Kernel. What do we need
> > this for / when do we use it?
>
> This extends the existing binding. It allows the location and size of
> memory to be set by a board ID. Unfortunately on sopme hardware you
> get a hang if you try to access memory that doesn't exist, so this
> allows the range of available memory to be defined - or at least the
> maximum bound since we still probe the memory size within that range.
>
> This feature is used on several Exynos Chromebooks.
So that you can use the same DT on several disjoint boards? How does
this work with the kernel, does U-Boot then pass along only the correct
map? Patches to the kernel to also deal with this?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141027/b8e1029d/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-27 14:24 ` Tom Rini
@ 2014-10-27 18:50 ` Simon Glass
2014-11-12 15:13 ` Simon Glass
2014-11-12 21:42 ` Tom Rini
0 siblings, 2 replies; 46+ messages in thread
From: Simon Glass @ 2014-10-27 18:50 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 27 October 2014 08:24, Tom Rini <trini@ti.com> wrote:
> On Fri, Oct 24, 2014 at 02:04:00PM -0600, Simon Glass wrote:
>> Hi Tom,
>>
>> On 24 October 2014 12:49, Tom Rini <trini@ti.com> wrote:
>> > On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
>> >
>> >> From: Michael Pratt <mpratt@chromium.org>
>> >>
>> >> Support a default memory bank, specified in reg, as well as
>> >> board-specific memory banks in subtree board-id nodes.
>> >>
>> >> This allows memory information to be provided in the device tree,
>> >> rather than hard-coded in, which will make it simpler to handle
>> >> similar devices with different memory banks, as the board-id values
>> >> or masks can be used to match devices.
>> > [snip]
>> >> +++ b/doc/device-tree-bindings/memory/memory.txt
>> >> @@ -0,0 +1,67 @@
>> >> +* Memory binding
>> >> +
>> >> +The memory binding for U-Boot is as in the ePAPR with the following additions:
>> >
>> > I am wary of being different from ePAPR / Linux Kernel. What do we need
>> > this for / when do we use it?
>>
>> This extends the existing binding. It allows the location and size of
>> memory to be set by a board ID. Unfortunately on sopme hardware you
>> get a hang if you try to access memory that doesn't exist, so this
>> allows the range of available memory to be defined - or at least the
>> maximum bound since we still probe the memory size within that range.
>>
>> This feature is used on several Exynos Chromebooks.
>
> So that you can use the same DT on several disjoint boards? How does
> this work with the kernel, does U-Boot then pass along only the correct
> map? Patches to the kernel to also deal with this?
Typically a board may have variants with different amounts of memory,
detected at run-time by GPIOs. We want the option of using the same DT
for these, similar to what the Compulab people were talking about -
otherwise we have something of an explosion of combinations.
Yes U-Boot (already) puts the correct memory map together for the
kernel, so it all works from start to finish.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-27 18:50 ` Simon Glass
@ 2014-11-12 15:13 ` Simon Glass
2014-11-12 21:42 ` Tom Rini
1 sibling, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-12 15:13 UTC (permalink / raw)
To: u-boot
Hi,
On 27 October 2014 12:50, Simon Glass <sjg@chromium.org> wrote:
> Hi Tom,
>
> On 27 October 2014 08:24, Tom Rini <trini@ti.com> wrote:
>> On Fri, Oct 24, 2014 at 02:04:00PM -0600, Simon Glass wrote:
>>> Hi Tom,
>>>
>>> On 24 October 2014 12:49, Tom Rini <trini@ti.com> wrote:
>>> > On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
>>> >
>>> >> From: Michael Pratt <mpratt@chromium.org>
>>> >>
>>> >> Support a default memory bank, specified in reg, as well as
>>> >> board-specific memory banks in subtree board-id nodes.
>>> >>
>>> >> This allows memory information to be provided in the device tree,
>>> >> rather than hard-coded in, which will make it simpler to handle
>>> >> similar devices with different memory banks, as the board-id values
>>> >> or masks can be used to match devices.
>>> > [snip]
>>> >> +++ b/doc/device-tree-bindings/memory/memory.txt
>>> >> @@ -0,0 +1,67 @@
>>> >> +* Memory binding
>>> >> +
>>> >> +The memory binding for U-Boot is as in the ePAPR with the following additions:
>>> >
>>> > I am wary of being different from ePAPR / Linux Kernel. What do we need
>>> > this for / when do we use it?
>>>
>>> This extends the existing binding. It allows the location and size of
>>> memory to be set by a board ID. Unfortunately on sopme hardware you
>>> get a hang if you try to access memory that doesn't exist, so this
>>> allows the range of available memory to be defined - or at least the
>>> maximum bound since we still probe the memory size within that range.
>>>
>>> This feature is used on several Exynos Chromebooks.
>>
>> So that you can use the same DT on several disjoint boards? How does
>> this work with the kernel, does U-Boot then pass along only the correct
>> map? Patches to the kernel to also deal with this?
>
> Typically a board may have variants with different amounts of memory,
> detected at run-time by GPIOs. We want the option of using the same DT
> for these, similar to what the Compulab people were talking about -
> otherwise we have something of an explosion of combinations.
>
> Yes U-Boot (already) puts the correct memory map together for the
> kernel, so it all works from start to finish.
Are there any more thoughts on this one? I'd like to pull this series
into the u-boot-fdt tree.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-10-27 18:50 ` Simon Glass
2014-11-12 15:13 ` Simon Glass
@ 2014-11-12 21:42 ` Tom Rini
2014-11-12 22:14 ` Simon Glass
1 sibling, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-11-12 21:42 UTC (permalink / raw)
To: u-boot
On Mon, Oct 27, 2014 at 12:50:39PM -0600, Simon Glass wrote:
> Hi Tom,
>
> On 27 October 2014 08:24, Tom Rini <trini@ti.com> wrote:
> > On Fri, Oct 24, 2014 at 02:04:00PM -0600, Simon Glass wrote:
> >> Hi Tom,
> >>
> >> On 24 October 2014 12:49, Tom Rini <trini@ti.com> wrote:
> >> > On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
> >> >
> >> >> From: Michael Pratt <mpratt@chromium.org>
> >> >>
> >> >> Support a default memory bank, specified in reg, as well as
> >> >> board-specific memory banks in subtree board-id nodes.
> >> >>
> >> >> This allows memory information to be provided in the device tree,
> >> >> rather than hard-coded in, which will make it simpler to handle
> >> >> similar devices with different memory banks, as the board-id values
> >> >> or masks can be used to match devices.
> >> > [snip]
> >> >> +++ b/doc/device-tree-bindings/memory/memory.txt
> >> >> @@ -0,0 +1,67 @@
> >> >> +* Memory binding
> >> >> +
> >> >> +The memory binding for U-Boot is as in the ePAPR with the following additions:
> >> >
> >> > I am wary of being different from ePAPR / Linux Kernel. What do we need
> >> > this for / when do we use it?
> >>
> >> This extends the existing binding. It allows the location and size of
> >> memory to be set by a board ID. Unfortunately on sopme hardware you
> >> get a hang if you try to access memory that doesn't exist, so this
> >> allows the range of available memory to be defined - or at least the
> >> maximum bound since we still probe the memory size within that range.
> >>
> >> This feature is used on several Exynos Chromebooks.
> >
> > So that you can use the same DT on several disjoint boards? How does
> > this work with the kernel, does U-Boot then pass along only the correct
> > map? Patches to the kernel to also deal with this?
>
> Typically a board may have variants with different amounts of memory,
> detected at run-time by GPIOs. We want the option of using the same DT
> for these, similar to what the Compulab people were talking about -
> otherwise we have something of an explosion of combinations.
>
> Yes U-Boot (already) puts the correct memory map together for the
> kernel, so it all works from start to finish.
I'm still not super happy here. If you have different boards then you
provide different device trees and the binary that can deal with board A
or B, based on what the DT says.
If you can't just use get_ram_size, can't you use one of the other
existing hooks such as ft_board_setup (which runs after arch_fixup_fdt)
to set the memory size? On PowerPC boards for example this is where the
memory node is set anyhow, not arch_fixup_fdt (which is one of those ARM
vs PowerPC/everyone-else things I dislike).
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141112/eb7c5bcd/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-11-12 21:42 ` Tom Rini
@ 2014-11-12 22:14 ` Simon Glass
2014-11-20 14:37 ` Tom Rini
0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-11-12 22:14 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 12 November 2014 14:42, Tom Rini <trini@ti.com> wrote:
> On Mon, Oct 27, 2014 at 12:50:39PM -0600, Simon Glass wrote:
>> Hi Tom,
>>
>> On 27 October 2014 08:24, Tom Rini <trini@ti.com> wrote:
>> > On Fri, Oct 24, 2014 at 02:04:00PM -0600, Simon Glass wrote:
>> >> Hi Tom,
>> >>
>> >> On 24 October 2014 12:49, Tom Rini <trini@ti.com> wrote:
>> >> > On Thu, Oct 23, 2014 at 06:58:50PM -0600, Simon Glass wrote:
>> >> >
>> >> >> From: Michael Pratt <mpratt@chromium.org>
>> >> >>
>> >> >> Support a default memory bank, specified in reg, as well as
>> >> >> board-specific memory banks in subtree board-id nodes.
>> >> >>
>> >> >> This allows memory information to be provided in the device tree,
>> >> >> rather than hard-coded in, which will make it simpler to handle
>> >> >> similar devices with different memory banks, as the board-id values
>> >> >> or masks can be used to match devices.
>> >> > [snip]
>> >> >> +++ b/doc/device-tree-bindings/memory/memory.txt
>> >> >> @@ -0,0 +1,67 @@
>> >> >> +* Memory binding
>> >> >> +
>> >> >> +The memory binding for U-Boot is as in the ePAPR with the following additions:
>> >> >
>> >> > I am wary of being different from ePAPR / Linux Kernel. What do we need
>> >> > this for / when do we use it?
>> >>
>> >> This extends the existing binding. It allows the location and size of
>> >> memory to be set by a board ID. Unfortunately on sopme hardware you
>> >> get a hang if you try to access memory that doesn't exist, so this
>> >> allows the range of available memory to be defined - or at least the
>> >> maximum bound since we still probe the memory size within that range.
>> >>
>> >> This feature is used on several Exynos Chromebooks.
>> >
>> > So that you can use the same DT on several disjoint boards? How does
>> > this work with the kernel, does U-Boot then pass along only the correct
>> > map? Patches to the kernel to also deal with this?
>>
>> Typically a board may have variants with different amounts of memory,
>> detected at run-time by GPIOs. We want the option of using the same DT
>> for these, similar to what the Compulab people were talking about -
>> otherwise we have something of an explosion of combinations.
>>
>> Yes U-Boot (already) puts the correct memory map together for the
>> kernel, so it all works from start to finish.
>
> I'm still not super happy here. If you have different boards then you
> provide different device trees and the binary that can deal with board A
> or B, based on what the DT says.
(Note: I'm talking about the U-Boot device tree, and indeed for the
kernel we will have two different device trees)
That assumes that you can put a different binary on two different
boards. The same discussion came up with the Compulab series, where
they have different features but what to use the same U-Boot binary in
production for them, since it is such a pain to deal with different
incompatible binaries for board variants. It gets worse when you have
a module and want to support different base boards.
>
> If you can't just use get_ram_size, can't you use one of the other
> existing hooks such as ft_board_setup (which runs after arch_fixup_fdt)
> to set the memory size? On PowerPC boards for example this is where the
> memory node is set anyhow, not arch_fixup_fdt (which is one of those ARM
> vs PowerPC/everyone-else things I dislike).
I think here you are talking about setting up the device tree for the
kernel. Yes, U-Boot correctly sets up the memory for the kernel, by
copying information from the SDRAM bank list into the kernel's device
tree. The question is of course, how do we get the correct SDRAM bank
list in the first place.
What I am talking about here is the memory for U-Boot - i.e. how does
U-Boot know how much memory is available. The scheme here is that you
can have a board ID which controls this, with the U-Boot device tree
allowing the options to be specified (i.e. the mapping from board ID
to SDRAM banks)
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-11-12 22:14 ` Simon Glass
@ 2014-11-20 14:37 ` Tom Rini
2014-11-20 17:42 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-11-20 14:37 UTC (permalink / raw)
To: u-boot
On Wed, Nov 12, 2014 at 03:14:35PM -0700, Simon Glass wrote:
[snip, and sorry for the late reply]
> What I am talking about here is the memory for U-Boot - i.e. how does
> U-Boot know how much memory is available. The scheme here is that you
> can have a board ID which controls this, with the U-Boot device tree
> allowing the options to be specified (i.e. the mapping from board ID
> to SDRAM banks)
OK. So what I'm getting at is how is this different from other boards
where we say "Oh, this is $FOO, it has $X LPDRR2 RAM" and "Oh, this is
$BAR, it has $Y DDR3 RAM" ? The only thing I'm able to think of is that
we cannot call get_ram_size() to see the _size_ of the RAM after doing
$whatever to see what board we're on and doing the right configuration
for the DDR controller or whatever.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141120/0d358d68/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-11-20 14:37 ` Tom Rini
@ 2014-11-20 17:42 ` Simon Glass
2014-12-10 5:31 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-11-20 17:42 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 20 November 2014 14:37, Tom Rini <trini@ti.com> wrote:
> On Wed, Nov 12, 2014 at 03:14:35PM -0700, Simon Glass wrote:
>
> [snip, and sorry for the late reply]
>> What I am talking about here is the memory for U-Boot - i.e. how does
>> U-Boot know how much memory is available. The scheme here is that you
>> can have a board ID which controls this, with the U-Boot device tree
>> allowing the options to be specified (i.e. the mapping from board ID
>> to SDRAM banks)
>
> OK. So what I'm getting at is how is this different from other boards
> where we say "Oh, this is $FOO, it has $X LPDRR2 RAM" and "Oh, this is
> $BAR, it has $Y DDR3 RAM" ? The only thing I'm able to think of is that
> we cannot call get_ram_size() to see the _size_ of the RAM after doing
> $whatever to see what board we're on and doing the right configuration
> for the DDR controller or whatever.
Yes the memory type can go in the FDT too (and does for snow and pit).
That's right, we can call get_ram_size() but only within the known
boundaries. If we try to probe a 2GB machine as if it has 4GB of RAM
it will hang. So we have to *know*.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings
2014-11-20 17:42 ` Simon Glass
@ 2014-12-10 5:31 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-12-10 5:31 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 20 November 2014 at 10:42, Simon Glass <sjg@chromium.org> wrote:
> Hi Tom,
>
> On 20 November 2014 14:37, Tom Rini <trini@ti.com> wrote:
>> On Wed, Nov 12, 2014 at 03:14:35PM -0700, Simon Glass wrote:
>>
>> [snip, and sorry for the late reply]
>>> What I am talking about here is the memory for U-Boot - i.e. how does
>>> U-Boot know how much memory is available. The scheme here is that you
>>> can have a board ID which controls this, with the U-Boot device tree
>>> allowing the options to be specified (i.e. the mapping from board ID
>>> to SDRAM banks)
>>
>> OK. So what I'm getting at is how is this different from other boards
>> where we say "Oh, this is $FOO, it has $X LPDRR2 RAM" and "Oh, this is
>> $BAR, it has $Y DDR3 RAM" ? The only thing I'm able to think of is that
>> we cannot call get_ram_size() to see the _size_ of the RAM after doing
>> $whatever to see what board we're on and doing the right configuration
>> for the DDR controller or whatever.
>
> Yes the memory type can go in the FDT too (and does for snow and pit).
>
> That's right, we can call get_ram_size() but only within the known
> boundaries. If we try to probe a 2GB machine as if it has 4GB of RAM
> it will hang. So we have to *know*.
I have left this one out so far, but would like to apply it. With this
I can support Pit and Pi (and with a bit more work Snow and Spring)
with the same U-Boot board, dealing with the memory differences
between the boards.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 05/11] fdt: Use the correct return types for fdtdec_decode_region()
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (2 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:07 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 06/11] fdt: Enhance flashmap function to deal with region properties Simon Glass
` (7 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
Use the correct FDT data types for this function. Also add more debugging.
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
include/fdtdec.h | 10 +++++-----
lib/fdtdec.c | 19 ++++++++++++-------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 5fb86b0..3915fe0 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -595,12 +595,12 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node,
* @param blob FDT blob
* @param node node to examine
* @param prop_name name of property to find
- * @param ptrp returns pointer to region, or NULL if no address
- * @param size returns size of region
- * @return 0 if ok, -1 on error (propery not found)
+ * @param basep Returns base address of region
+ * @param size Returns size of region
+ * @return 0 if ok, -1 on error (property not found)
*/
-int fdtdec_decode_region(const void *blob, int node,
- const char *prop_name, void **ptrp, size_t *size);
+int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
+ fdt_addr_t *basep, fdt_size_t *sizep);
/* A flash map entry, containing an offset and length */
struct fmap_entry {
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index d5a6a3e..4b5e9cd 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -671,20 +671,25 @@ char *fdtdec_get_config_string(const void *blob, const char *prop_name)
return (char *)nodep;
}
-int fdtdec_decode_region(const void *blob, int node,
- const char *prop_name, void **ptrp, size_t *size)
+int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
+ fdt_addr_t *basep, fdt_size_t *sizep)
{
const fdt_addr_t *cell;
int len;
- debug("%s: %s\n", __func__, prop_name);
+ debug("%s: %s: %s\n", __func__, fdt_get_name(blob, node, NULL),
+ prop_name);
cell = fdt_getprop(blob, node, prop_name, &len);
- if (!cell || (len != sizeof(fdt_addr_t) * 2))
+ if (!cell || (len < sizeof(fdt_addr_t) * 2)) {
+ debug("cell=%p, len=%d\n", cell, len);
return -1;
+ }
+
+ *basep = fdt_addr_to_cpu(*cell);
+ *sizep = fdt_size_to_cpu(cell[1]);
+ debug("%s: base=%08lx, size=%lx\n", __func__, (ulong)*basep,
+ (ulong)*sizep);
- *ptrp = map_sysmem(fdt_addr_to_cpu(*cell), *size);
- *size = fdt_size_to_cpu(cell[1]);
- debug("%s: size=%zx\n", __func__, *size);
return 0;
}
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 06/11] fdt: Enhance flashmap function to deal with region properties
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (3 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 05/11] fdt: Use the correct return types for fdtdec_decode_region() Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:08 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt() Simon Glass
` (6 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
Flash regions can optionally be compressed or hashed. Add the ability to
read this information from the flashmap.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---
Changes in v2: None
include/fdtdec.h | 16 ++++++++++++++++
lib/fdtdec.c | 8 ++++++++
2 files changed, 24 insertions(+)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 3915fe0..9d9627f 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -602,10 +602,26 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node,
int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
fdt_addr_t *basep, fdt_size_t *sizep);
+enum fmap_compress_t {
+ FMAP_COMPRESS_NONE,
+ FMAP_COMPRESS_LZO,
+};
+
+enum fmap_hash_t {
+ FMAP_HASH_NONE,
+ FMAP_HASH_SHA1,
+ FMAP_HASH_SHA256,
+};
+
/* A flash map entry, containing an offset and length */
struct fmap_entry {
uint32_t offset;
uint32_t length;
+ uint32_t used; /* Number of bytes used in region */
+ enum fmap_compress_t compress_algo; /* Compression type */
+ enum fmap_hash_t hash_algo; /* Hash algorithm */
+ const uint8_t *hash; /* Hash value */
+ int hash_size; /* Hash size */
};
/**
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 4b5e9cd..0b16534 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -705,6 +705,7 @@ int fdtdec_decode_region(const void *blob, int node, const char *prop_name,
int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
struct fmap_entry *entry)
{
+ const char *prop;
u32 reg[2];
if (fdtdec_get_int_array(blob, node, "reg", reg, 2)) {
@@ -713,6 +714,13 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
}
entry->offset = reg[0];
entry->length = reg[1];
+ entry->used = fdtdec_get_int(blob, node, "used", entry->length);
+ prop = fdt_getprop(blob, node, "compress", NULL);
+ entry->compress_algo = prop && !strcmp(prop, "lzo") ?
+ FMAP_COMPRESS_LZO : FMAP_COMPRESS_NONE;
+ prop = fdt_getprop(blob, node, "hash", &entry->hash_size);
+ entry->hash_algo = prop ? FMAP_HASH_SHA256 : FMAP_HASH_NONE;
+ entry->hash = (uint8_t *)prop;
return 0;
}
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt()
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (4 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 06/11] fdt: Enhance flashmap function to deal with region properties Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:09 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions Simon Glass
` (5 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
The message about needing to reset should be printed no matter what error
is printed. Also, an error should always be printed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---
Changes in v2: None
common/image-fdt.c | 30 ++++++++++++++++++++----------
include/fdt_support.h | 1 +
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/common/image-fdt.c b/common/image-fdt.c
index a2342fa..01be803 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -460,19 +460,25 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
{
ulong *initrd_start = &images->initrd_start;
ulong *initrd_end = &images->initrd_end;
- int ret;
+ int ret = -EPERM;
+ int fdt_ret;
if (fdt_chosen(blob) < 0) {
- puts("ERROR: /chosen node create failed");
- puts(" - must RESET the board to recover.\n");
- return -1;
+ printf("ERROR: /chosen node create failed\n");
+ goto err;
}
if (arch_fixup_fdt(blob) < 0) {
- puts("ERROR: arch specific fdt fixup failed");
- return -1;
+ printf("ERROR: arch-specific fdt fixup failed\n");
+ goto err;
+ }
+ if (IMAGE_OF_BOARD_SETUP) {
+ fdt_ret = ft_board_setup(blob, gd->bd);
+ if (fdt_ret) {
+ printf("ERROR: board-specific fdt fixup failed: %s\n",
+ fdt_strerror(fdt_ret));
+ goto err;
+ }
}
- if (IMAGE_OF_BOARD_SETUP)
- ft_board_setup(blob, gd->bd);
fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
@@ -481,7 +487,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
ret = fdt_shrink_to_minimum(blob);
if (ret < 0)
- return ret;
+ goto err;
of_size = ret;
if (*initrd_start && *initrd_end) {
@@ -493,7 +499,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
fdt_initrd(blob, *initrd_start, *initrd_end);
if (!ft_verify_fdt(blob))
- return -1;
+ goto err;
#if defined(CONFIG_SOC_KEYSTONE)
if (IMAGE_OF_BOARD_SETUP)
@@ -501,4 +507,8 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
#endif
return 0;
+err:
+ printf(" - must RESET the board to recover.\n\n");
+
+ return ret;
}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index e17e609..fb90988 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -70,6 +70,7 @@ int fdt_find_or_add_subnode(void *fdt, int parentoffset, const char *name);
* Add board-specific data to the FDT before booting the OS.
*
* Use CONFIG_SYS_FDT_PAD to ensure there is sufficient space.
+ * This function is called if CONFIG_OF_BOARD_SETUP is defined
*
* @param blob FDT blob to update
* @param bd_t Pointer to board data
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt()
2014-10-24 0:58 ` [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt() Simon Glass
@ 2014-10-24 18:09 ` Tom Rini
2014-11-21 3:25 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:09 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:53PM -0600, Simon Glass wrote:
> The message about needing to reset should be printed no matter what error
> is printed. Also, an error should always be printed.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Tom Rini <trini@ti.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/34ac1aa3/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt()
2014-10-24 18:09 ` Tom Rini
@ 2014-11-21 3:25 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-21 3:25 UTC (permalink / raw)
To: u-boot
On 24 October 2014 20:09, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:53PM -0600, Simon Glass wrote:
>
>> The message about needing to reset should be printed no matter what error
>> is printed. Also, an error should always be printed.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> Acked-by: Anatolij Gustschin <agust@denx.de>
>
> Reviewed-by: Tom Rini <trini@ti.com>
Applied to u-boot-fdt.
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (5 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt() Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:50 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 09/11] fdt: Change fdt_pack_reg() to static and fix types Simon Glass
` (4 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
Add an additional function for adding information to the device tree before
booting. This permits additions which are not board-specific.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---
Changes in v2:
- Report FDT error from ft_system_setup()
- Fix ft_board_setup error in README
README | 9 ++++++++-
common/cmd_fdt.c | 15 +++++++++++++++
common/image-fdt.c | 7 +++++++
include/fdt_support.h | 12 ++++++++++++
include/image.h | 6 ++++++
5 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/README b/README
index 4dbf2d4..ee06e13 100644
--- a/README
+++ b/README
@@ -676,6 +676,13 @@ The following options need to be configured:
Board code has addition modification that it wants to make
to the flat device tree before handing it off to the kernel
+ CONFIG_OF_SYSTEM_SETUP
+
+ Other code has addition modification that it wants to make
+ to the flat device tree before handing it off to the kernel.
+ This causes ft_system_setup() to be called before booting
+ the kernel.
+
CONFIG_OF_BOOT_CPU
This define fills in the correct boot CPU in the boot
@@ -3411,7 +3418,7 @@ FIT uImage format:
to 128 or 256, although it does not have to be power of 2).
default: 4096
-
+
CONFIG_MTD_UBI_BEB_LIMIT
This option specifies the maximum bad physical eraseblocks UBI
expects on the MTD device (per 1024 eraseblocks). If the
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 6f7ea08..25b4675 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -576,6 +576,18 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}
#endif
+#ifdef CONFIG_OF_SYSTEM_SETUP
+ /* Call the board-specific fixup routine */
+ else if (strncmp(argv[1], "sys", 3) == 0) {
+ int err = ft_system_setup(working_fdt, gd->bd);
+
+ if (err) {
+ printf("Failed to add system information to FDT: %s\n",
+ fdt_strerror(err));
+ return CMD_RET_FAILURE;
+ }
+ }
+#endif
/* Create a chosen node */
else if (strncmp(argv[1], "cho", 3) == 0) {
unsigned long initrd_start = 0, initrd_end = 0;
@@ -1015,6 +1027,9 @@ static char fdt_help_text[] =
#ifdef CONFIG_OF_BOARD_SETUP
"fdt boardsetup - Do board-specific set up\n"
#endif
+#ifdef CONFIG_OF_SYSTEM_SETUP
+ "fdt systemsetup - Do system-specific set up\n"
+#endif
"fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active\n"
"fdt resize - Resize fdt to size + padding to 4k addr\n"
"fdt print <path> [<prop>] - Recursive print starting at <path>\n"
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 01be803..8db3ccb 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -479,6 +479,13 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
goto err;
}
}
+ if (IMAGE_OF_SYSTEM_SETUP) {
+ if (ft_system_setup(blob, gd->bd)) {
+ printf("ERROR: system-specific fdt fixup failed: %s\n",
+ fdt_strerror(fdt_ret));
+ goto err;
+ }
+ }
fdt_fixup_ethernet(blob);
/* Delete the old LMB reservation */
diff --git a/include/fdt_support.h b/include/fdt_support.h
index fb90988..b1092be 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -88,6 +88,18 @@ void ft_board_setup_ex(void *blob, bd_t *bd);
void ft_cpu_setup(void *blob, bd_t *bd);
void ft_pci_setup(void *blob, bd_t *bd);
+/**
+ * Add system-specific data to the FDT before booting the OS.
+ *
+ * Use CONFIG_SYS_FDT_PAD to ensure there is sufficient space.
+ * This function is called if CONFIG_OF_SYSTEM_SETUP is defined
+ *
+ * @param blob FDT blob to update
+ * @param bd_t Pointer to board data
+ * @return 0 if ok, or -FDT_ERR_... on error
+ */
+int ft_system_setup(void *blob, bd_t *bd);
+
void set_working_fdt_addr(void *addr);
int fdt_shrink_to_minimum(void *blob);
int fdt_increase_size(void *fdt, int add_len);
diff --git a/include/image.h b/include/image.h
index a13a302..08ddcc7 100644
--- a/include/image.h
+++ b/include/image.h
@@ -119,6 +119,12 @@ struct lmb;
# define IMAGE_OF_BOARD_SETUP 0
#endif
+#ifdef CONFIG_OF_SYSTEM_SETUP
+# define IMAGE_OF_SYSTEM_SETUP 1
+#else
+# define IMAGE_OF_SYSTEM_SETUP 0
+#endif
+
/*
* Operating System Codes
*/
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions
2014-10-24 0:58 ` [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions Simon Glass
@ 2014-10-24 18:50 ` Tom Rini
2014-11-13 2:40 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:50 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:54PM -0600, Simon Glass wrote:
> Add an additional function for adding information to the device tree before
> booting. This permits additions which are not board-specific.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Acked-by: Anatolij Gustschin <agust@denx.de>
[snip]
> @@ -3411,7 +3418,7 @@ FIT uImage format:
> to 128 or 256, although it does not have to be power of 2).
>
> default: 4096
> -
> +
> CONFIG_MTD_UBI_BEB_LIMIT
> This option specifies the maximum bad physical eraseblocks UBI
> expects on the MTD device (per 1024 eraseblocks). If the
Was this the only whitespace thinko in README? If so, yeah, OK, lets
just fix it, if not, drop it. Otherwise...
Reviewed-by: Tom Rini <trini@ti.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/3f90b535/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions
2014-10-24 18:50 ` Tom Rini
@ 2014-11-13 2:40 ` Simon Glass
2014-11-21 3:25 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-11-13 2:40 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 24 October 2014 12:50, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:54PM -0600, Simon Glass wrote:
>
>> Add an additional function for adding information to the device tree before
>> booting. This permits additions which are not board-specific.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> Acked-by: Anatolij Gustschin <agust@denx.de>
> [snip]
>> @@ -3411,7 +3418,7 @@ FIT uImage format:
>> to 128 or 256, although it does not have to be power of 2).
>>
>> default: 4096
>> -
>> +
>> CONFIG_MTD_UBI_BEB_LIMIT
>> This option specifies the maximum bad physical eraseblocks UBI
>> expects on the MTD device (per 1024 eraseblocks). If the
>
> Was this the only whitespace thinko in README? If so, yeah, OK, lets
> just fix it, if not, drop it. Otherwise...
>
> Reviewed-by: Tom Rini <trini@ti.com>
Yes I think it is the only one.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions
2014-11-13 2:40 ` Simon Glass
@ 2014-11-21 3:25 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-21 3:25 UTC (permalink / raw)
To: u-boot
On 13 November 2014 03:40, Simon Glass <sjg@chromium.org> wrote:
> Hi Tom,
>
> On 24 October 2014 12:50, Tom Rini <trini@ti.com> wrote:
>> On Thu, Oct 23, 2014 at 06:58:54PM -0600, Simon Glass wrote:
>>
>>> Add an additional function for adding information to the device tree before
>>> booting. This permits additions which are not board-specific.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>> Acked-by: Anatolij Gustschin <agust@denx.de>
>> [snip]
>>> @@ -3411,7 +3418,7 @@ FIT uImage format:
>>> to 128 or 256, although it does not have to be power of 2).
>>>
>>> default: 4096
>>> -
>>> +
>>> CONFIG_MTD_UBI_BEB_LIMIT
>>> This option specifies the maximum bad physical eraseblocks UBI
>>> expects on the MTD device (per 1024 eraseblocks). If the
>>
>> Was this the only whitespace thinko in README? If so, yeah, OK, lets
>> just fix it, if not, drop it. Otherwise...
>>
>> Reviewed-by: Tom Rini <trini@ti.com>
>
> Yes I think it is the only one.
>
> Regards,
> Simon
Applied to u-boot-fdt.
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 09/11] fdt: Change fdt_pack_reg() to static and fix types
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (6 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region Simon Glass
` (3 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
This function is only called within this file so make it static. Also
fix its argument types to be consistent with its caller.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---
Changes in v2: None
common/fdt_support.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 6da5297..f9b81c6 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -382,8 +382,8 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
/*
* fdt_pack_reg - pack address and size array into the "reg"-suitable stream
*/
-int fdt_pack_reg(const void *fdt, void *buf, uint64_t *address,
- uint64_t *size, int n)
+static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
+ int n)
{
int i;
int address_len = get_cells_len(fdt, "#address-cells");
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (7 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 09/11] fdt: Change fdt_pack_reg() to static and fix types Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-10-24 0:58 ` [U-Boot] [PATCH v2 11/11] fdt: Try to use fdt_address_cells()/fdt_size_cells() Simon Glass
` (2 subsequent siblings)
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
Permit decoding of a named memory region from the device tree. This allows
easy run-time configuration of the address of on-chip SRAM, SDRAM, etc.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
include/fdtdec.h | 28 ++++++++++++++++++++++++++
lib/fdtdec.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 9d9627f..8c12d2d 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -710,4 +710,32 @@ int fdtdec_pci_get_bdf(const void *fdt, int node, int *bdf);
*/
int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
phys_addr_t *basep, phys_size_t *sizep, bd_t *bd);
+
+/**
+ * Decode a named region within a memory bank of a given type.
+ *
+ * This function handles selection of a memory region. The region is
+ * specified as an offset/size within a particular type of memory.
+ *
+ * The properties used are:
+ *
+ * <mem_type>-memory<suffix> for the name of the memory bank
+ * <mem_type>-offset<suffix> for the offset in that bank
+ *
+ * The property value must have an offset and a size. The function checks
+ * that the region is entirely within the memory bank.5
+ *
+ * @param blob FDT blob
+ * @param node Node containing the properties (-1 for /config)
+ * @param mem_type Type of memory to use, which is a name, such as
+ * "u-boot" or "kernel".
+ * @param suffix String to append to the memory/offset
+ * property names
+ * @param basep Returns base of region
+ * @param sizep Returns size of region
+ * @return 0 if OK, -ive on error
+ */
+int fdtdec_decode_memory_region(const void *blob, int node,
+ const char *mem_type, const char *suffix,
+ fdt_addr_t *basep, fdt_size_t *sizep);
#endif
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 0b16534..6cf0786 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -900,4 +900,65 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
return 0;
}
+
+int fdtdec_decode_memory_region(const void *blob, int config_node,
+ const char *mem_type, const char *suffix,
+ fdt_addr_t *basep, fdt_size_t *sizep)
+{
+ char prop_name[50];
+ const char *mem;
+ fdt_size_t size, offset_size;
+ fdt_addr_t base, offset;
+ int node;
+
+ if (config_node == -1) {
+ config_node = fdt_path_offset(blob, "/config");
+ if (config_node < 0) {
+ debug("%s: Cannot find /config node\n", __func__);
+ return -ENOENT;
+ }
+ }
+ if (!suffix)
+ suffix = "";
+
+ snprintf(prop_name, sizeof(prop_name), "%s-memory%s", mem_type,
+ suffix);
+ mem = fdt_getprop(blob, config_node, prop_name, NULL);
+ if (!mem) {
+ debug("%s: No memory type for '%s', using /memory\n", __func__,
+ prop_name);
+ mem = "/memory";
+ }
+
+ node = fdt_path_offset(blob, mem);
+ if (node < 0) {
+ debug("%s: Failed to find node '%s': %s\n", __func__, mem,
+ fdt_strerror(node));
+ return -ENOENT;
+ }
+
+ /*
+ * Not strictly correct - the memory may have multiple banks. We just
+ * use the first
+ */
+ if (fdtdec_decode_region(blob, node, "reg", &base, &size)) {
+ debug("%s: Failed to decode memory region %s\n", __func__,
+ mem);
+ return -EINVAL;
+ }
+
+ snprintf(prop_name, sizeof(prop_name), "%s-offset%s", mem_type,
+ suffix);
+ if (fdtdec_decode_region(blob, config_node, prop_name, &offset,
+ &offset_size)) {
+ debug("%s: Failed to decode memory region '%s'\n", __func__,
+ prop_name);
+ return -EINVAL;
+ }
+
+ *basep = base + offset;
+ *sizep = offset_size;
+
+ return 0;
+}
#endif
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region
2014-10-24 0:58 ` [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region Simon Glass
@ 2014-10-24 18:49 ` Tom Rini
2014-11-21 3:26 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:49 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:56PM -0600, Simon Glass wrote:
> Permit decoding of a named memory region from the device tree. This allows
> easy run-time configuration of the address of on-chip SRAM, SDRAM, etc.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/0f139393/attachment.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region
2014-10-24 18:49 ` Tom Rini
@ 2014-11-21 3:26 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-21 3:26 UTC (permalink / raw)
To: u-boot
On 24 October 2014 19:49, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:56PM -0600, Simon Glass wrote:
>
>> Permit decoding of a named memory region from the device tree. This allows
>> easy run-time configuration of the address of on-chip SRAM, SDRAM, etc.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Tom Rini <trini@ti.com>
Applied to u-boot-fdt.
^ permalink raw reply [flat|nested] 46+ messages in thread
* [U-Boot] [PATCH v2 11/11] fdt: Try to use fdt_address_cells()/fdt_size_cells()
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (8 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region Simon Glass
@ 2014-10-24 0:58 ` Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-10-24 15:50 ` [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Anatolij Gustschin
2014-10-24 18:04 ` Tom Rini
11 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 0:58 UTC (permalink / raw)
To: u-boot
Use these new functions where possible. They default to a value of 2 so we
cannot use them in some places where we need a default value of 1.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
board/freescale/mpc8641hpcn/mpc8641hpcn.c | 7 +++---
common/fdt_support.c | 41 ++++++-------------------------
2 files changed, 12 insertions(+), 36 deletions(-)
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index 1ab72f9..94633b5 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -123,7 +123,7 @@ int ft_board_setup(void *blob, bd_t *bd)
{
int off;
u64 *tmp;
- u32 *addrcells;
+ int addrcells;
ft_cpu_setup(blob, bd);
@@ -135,12 +135,13 @@ int ft_board_setup(void *blob, bd_t *bd)
* which is defined by the "reg" property in the soc node.
*/
off = fdt_path_offset(blob, "/soc8641");
- addrcells = (u32 *)fdt_getprop(blob, 0, "#address-cells", NULL);
+ addrcells = fdt_address_cells(blob, 0);
tmp = (u64 *)fdt_getprop(blob, off, "reg", NULL);
if (tmp) {
u64 addr;
- if (addrcells && (*addrcells == 1))
+
+ if (addrcells == 1)
addr = *(u32 *)tmp;
else
addr = *tmp;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index f9b81c6..a405cb8 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -16,22 +16,6 @@
#include <fdt_support.h>
#include <exports.h>
-/*
- * Get cells len in bytes
- * if #NNNN-cells property is 2 then len is 8
- * otherwise len is 4
- */
-static int get_cells_len(const void *fdt, const char *nr_cells_name)
-{
- const fdt32_t *cell;
-
- cell = fdt_getprop(fdt, 0, nr_cells_name, NULL);
- if (cell && fdt32_to_cpu(*cell) == 2)
- return 8;
-
- return 4;
-}
-
/**
* fdt_getprop_u32_default_node - Return a node's property or a default
*
@@ -246,7 +230,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
return err;
}
- is_u64 = (get_cells_len(fdt, "#address-cells") == 8);
+ is_u64 = (fdt_address_cells(fdt, 0) == 2);
err = fdt_setprop_uxx(fdt, nodeoffset, "linux,initrd-start",
(uint64_t)initrd_start, is_u64);
@@ -386,18 +370,18 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
int n)
{
int i;
- int address_len = get_cells_len(fdt, "#address-cells");
- int size_len = get_cells_len(fdt, "#size-cells");
+ int address_len = fdt_address_cells(fdt, 0);
+ int size_len = fdt_size_cells(fdt, 0);
char *p = buf;
for (i = 0; i < n; i++) {
- if (address_len == 8)
+ if (address_len == 2)
*(fdt64_t *)p = cpu_to_fdt64(address[i]);
else
*(fdt32_t *)p = cpu_to_fdt32(address[i]);
p += address_len;
- if (size_len == 8)
+ if (size_len == 2)
*(fdt64_t *)p = cpu_to_fdt64(size[i]);
else
*(fdt32_t *)p = cpu_to_fdt32(size[i]);
@@ -968,13 +952,8 @@ void of_bus_default_count_cells(void *blob, int parentoffset,
{
const fdt32_t *prop;
- if (addrc) {
- prop = fdt_getprop(blob, parentoffset, "#address-cells", NULL);
- if (prop)
- *addrc = be32_to_cpup(prop);
- else
- *addrc = 2;
- }
+ if (addrc)
+ *addrc = fdt_address_cells(blob, parentoffset);
if (sizec) {
prop = fdt_getprop(blob, parentoffset, "#size-cells", NULL);
@@ -1419,11 +1398,7 @@ u64 fdt_get_base_address(void *fdt, int node)
u32 naddr;
const fdt32_t *prop;
- prop = fdt_getprop(fdt, node, "#address-cells", &size);
- if (prop && size == 4)
- naddr = be32_to_cpup(prop);
- else
- naddr = 2;
+ naddr = fdt_address_cells(fdt, node);
prop = fdt_getprop(fdt, node, "ranges", &size);
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (9 preceding siblings ...)
2014-10-24 0:58 ` [U-Boot] [PATCH v2 11/11] fdt: Try to use fdt_address_cells()/fdt_size_cells() Simon Glass
@ 2014-10-24 15:50 ` Anatolij Gustschin
2014-10-24 18:04 ` Tom Rini
11 siblings, 0 replies; 46+ messages in thread
From: Anatolij Gustschin @ 2014-10-24 15:50 UTC (permalink / raw)
To: u-boot
On Thu, 23 Oct 2014 18:58:47 -0600
Simon Glass <sjg@chromium.org> wrote:
> This function can fail if the device tree runs out of space. Rather than
> silently booting with an incomplete device tree, allow the failure to be
> detected.
>
> Unfortunately this involves changing a lot of places in the code. I have
> not changed behvaiour to return an error where one is not currently
> returned, to avoid unexpected breakage.
>
> Eventually it would be nice to allow boards to register functions to be
> called to update the device tree. This would avoid all the many functions
> to do this. However it's not clear yet if this should be done using driver
> model or with a linker list. This work is left for later.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Fix return codes in board/amcc/sequoia/sequoia.c
> - Fix return codes in board/freescale/p1_p2_rdb/p1_p2_rdb.c
> - Fix return codes in board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
Acked-by: Anatolij Gustschin <agust@denx.de>
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
` (10 preceding siblings ...)
2014-10-24 15:50 ` [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Anatolij Gustschin
@ 2014-10-24 18:04 ` Tom Rini
2014-10-24 19:56 ` Simon Glass
11 siblings, 1 reply; 46+ messages in thread
From: Tom Rini @ 2014-10-24 18:04 UTC (permalink / raw)
To: u-boot
On Thu, Oct 23, 2014 at 06:58:47PM -0600, Simon Glass wrote:
> This function can fail if the device tree runs out of space. Rather than
> silently booting with an incomplete device tree, allow the failure to be
> detected.
>
> Unfortunately this involves changing a lot of places in the code. I have
> not changed behvaiour to return an error where one is not currently
> returned, to avoid unexpected breakage.
>
> Eventually it would be nice to allow boards to register functions to be
> called to update the device tree. This would avoid all the many functions
> to do this. However it's not clear yet if this should be done using driver
> model or with a linker list. This work is left for later.
[snip]
> diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
> index aba4f53..19fef50 100644
> --- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
> +++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
> @@ -6,6 +6,7 @@
>
> #include <common.h>
> #include <command.h>
> +#include <errno.h>
> #include <asm/processor.h>
> #include <asm/mmu.h>
> #include <asm/cache.h>
> @@ -234,7 +235,7 @@ int board_eth_init(bd_t *bis)
> #if defined(CONFIG_OF_BOARD_SETUP)
> extern void ft_pci_board_setup(void *blob);
>
> -void ft_board_setup(void *blob, bd_t *bd)
> +int ft_board_setup(void *blob, bd_t *bd)
> {
> const char *soc_usb_compat = "fsl-usb2-dr";
> int err, usb1_off, usb2_off;
> @@ -263,39 +264,41 @@ void ft_board_setup(void *blob, bd_t *bd)
> int off = fdt_node_offset_by_compatible(blob, -1,
> soc_elbc_compat);
> if (off < 0) {
> - printf("WARNING: could not find compatible node"
> - " %s: %s.\n", soc_elbc_compat,
> - fdt_strerror(off));
> - return;
> + printf("WARNING: could not find compatible node %s\n",
> + soc_elbc_compat);
> + return off;
> }
> err = fdt_del_node(blob, off);
> if (err < 0) {
> - printf("WARNING: could not remove %s: %s.\n",
> - soc_elbc_compat, fdt_strerror(err));
> + printf("WARNING: could not remove %s\n",
> + soc_elbc_compat);
> + return err;
> }
> - return;
> + return 0;
> }
> #endif
> /* Delete USB2 node as it is muxed with eLBC */
> usb1_off = fdt_node_offset_by_compatible(blob, -1,
> soc_usb_compat);
> if (usb1_off < 0) {
> - printf("WARNING: could not find compatible node"
> - " %s: %s.\n", soc_usb_compat,
> - fdt_strerror(usb1_off));
> - return;
> + printf("WARNING: could not find compatible node %s\n",
> + soc_usb_compat);
> + return usb1_off;
> }
> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
> soc_usb_compat);
> if (usb2_off < 0) {
> - printf("WARNING: could not find compatible node"
> - " %s: %s.\n", soc_usb_compat,
> - fdt_strerror(usb2_off));
> - return;
> + printf("WARNING: could not find compatible node %s\n",
> + soc_usb_compat);
> + return usb2_off;
> }
> err = fdt_del_node(blob, usb2_off);
> - if (err < 0)
> - printf("WARNING: could not remove %s: %s.\n",
> - soc_usb_compat, fdt_strerror(err));
> + if (err < 0) {
> + printf("WARNING: could not remove %s\n", soc_usb_compat);
> + return err;
> + }
> +
> + return 0;
> }
> +
> #endif
> diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> index a6756c6..66bc041 100644
> --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> @@ -6,6 +6,7 @@
>
> #include <common.h>
> #include <command.h>
> +#include <errno.h>
> #include <hwconfig.h>
> #include <pci.h>
> #include <i2c.h>
> @@ -424,7 +425,7 @@ static void fdt_board_fixup_qe_pins(void *blob)
> #endif
>
> #ifdef CONFIG_OF_BOARD_SETUP
> -void ft_board_setup(void *blob, bd_t *bd)
> +int ft_board_setup(void *blob, bd_t *bd)
> {
> phys_addr_t base;
> phys_size_t size;
> @@ -459,17 +460,17 @@ void ft_board_setup(void *blob, bd_t *bd)
> int off = fdt_node_offset_by_compatible(blob, -1,
> soc_elbc_compat);
> if (off < 0) {
> - printf("WARNING: could not find compatible node %s: %s.\n",
> - soc_elbc_compat,
> - fdt_strerror(off));
> - return;
> + printf("WARNING: could not find compatible node %s\n",
> + soc_elbc_compat);
> + return off;
> }
> err = fdt_del_node(blob, off);
> if (err < 0) {
> - printf("WARNING: could not remove %s: %s.\n",
> - soc_elbc_compat, fdt_strerror(err));
> + printf("WARNING: could not remove %s\n",
> + soc_elbc_compat);
> + return err;
> }
> - return;
> + return 0;
> }
> #endif
>
> @@ -477,24 +478,23 @@ void ft_board_setup(void *blob, bd_t *bd)
> usb1_off = fdt_node_offset_by_compatible(blob, -1,
> soc_usb_compat);
> if (usb1_off < 0) {
> - printf("WARNING: could not find compatible node %s: %s.\n",
> - soc_usb_compat,
> - fdt_strerror(usb1_off));
> - return;
> + printf("WARNING: could not find compatible node %s\n",
> + soc_usb_compat);
> + return usb1_off;
> }
> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
> soc_usb_compat);
> if (usb2_off < 0) {
> - printf("WARNING: could not find compatible node %s: %s.\n",
> - soc_usb_compat,
> - fdt_strerror(usb2_off));
> - return;
> + printf("WARNING: could not find compatible node %s\n",
> + soc_usb_compat);
> + return usb2_off;
> }
> err = fdt_del_node(blob, usb2_off);
> if (err < 0) {
> - printf("WARNING: could not remove %s: %s.\n",
> - soc_usb_compat, fdt_strerror(err));
> + printf("WARNING: could not remove %s\n", soc_usb_compat);
> + return err;
> }
>
> + return 0;
> }
> #endif
In both of these boards you add <errno.h> but don't make use of it, did
you intend to make something return -FDT_ERR_NOTFOUND and then not need
to after all? Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141024/c914842f/attachment-0001.pgp>
^ permalink raw reply [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure
2014-10-24 18:04 ` Tom Rini
@ 2014-10-24 19:56 ` Simon Glass
2014-11-21 3:24 ` Simon Glass
0 siblings, 1 reply; 46+ messages in thread
From: Simon Glass @ 2014-10-24 19:56 UTC (permalink / raw)
To: u-boot
Hi Tom,
On 24 October 2014 12:04, Tom Rini <trini@ti.com> wrote:
> On Thu, Oct 23, 2014 at 06:58:47PM -0600, Simon Glass wrote:
>
>> This function can fail if the device tree runs out of space. Rather than
>> silently booting with an incomplete device tree, allow the failure to be
>> detected.
>>
>> Unfortunately this involves changing a lot of places in the code. I have
>> not changed behvaiour to return an error where one is not currently
>> returned, to avoid unexpected breakage.
>>
>> Eventually it would be nice to allow boards to register functions to be
>> called to update the device tree. This would avoid all the many functions
>> to do this. However it's not clear yet if this should be done using driver
>> model or with a linker list. This work is left for later.
> [snip]
>> diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
>> index aba4f53..19fef50 100644
>> --- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
>> +++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
>> @@ -6,6 +6,7 @@
>>
>> #include <common.h>
>> #include <command.h>
>> +#include <errno.h>
>> #include <asm/processor.h>
>> #include <asm/mmu.h>
>> #include <asm/cache.h>
>> @@ -234,7 +235,7 @@ int board_eth_init(bd_t *bis)
>> #if defined(CONFIG_OF_BOARD_SETUP)
>> extern void ft_pci_board_setup(void *blob);
>>
>> -void ft_board_setup(void *blob, bd_t *bd)
>> +int ft_board_setup(void *blob, bd_t *bd)
>> {
>> const char *soc_usb_compat = "fsl-usb2-dr";
>> int err, usb1_off, usb2_off;
>> @@ -263,39 +264,41 @@ void ft_board_setup(void *blob, bd_t *bd)
>> int off = fdt_node_offset_by_compatible(blob, -1,
>> soc_elbc_compat);
>> if (off < 0) {
>> - printf("WARNING: could not find compatible node"
>> - " %s: %s.\n", soc_elbc_compat,
>> - fdt_strerror(off));
>> - return;
>> + printf("WARNING: could not find compatible node %s\n",
>> + soc_elbc_compat);
>> + return off;
>> }
>> err = fdt_del_node(blob, off);
>> if (err < 0) {
>> - printf("WARNING: could not remove %s: %s.\n",
>> - soc_elbc_compat, fdt_strerror(err));
>> + printf("WARNING: could not remove %s\n",
>> + soc_elbc_compat);
>> + return err;
>> }
>> - return;
>> + return 0;
>> }
>> #endif
>> /* Delete USB2 node as it is muxed with eLBC */
>> usb1_off = fdt_node_offset_by_compatible(blob, -1,
>> soc_usb_compat);
>> if (usb1_off < 0) {
>> - printf("WARNING: could not find compatible node"
>> - " %s: %s.\n", soc_usb_compat,
>> - fdt_strerror(usb1_off));
>> - return;
>> + printf("WARNING: could not find compatible node %s\n",
>> + soc_usb_compat);
>> + return usb1_off;
>> }
>> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
>> soc_usb_compat);
>> if (usb2_off < 0) {
>> - printf("WARNING: could not find compatible node"
>> - " %s: %s.\n", soc_usb_compat,
>> - fdt_strerror(usb2_off));
>> - return;
>> + printf("WARNING: could not find compatible node %s\n",
>> + soc_usb_compat);
>> + return usb2_off;
>> }
>> err = fdt_del_node(blob, usb2_off);
>> - if (err < 0)
>> - printf("WARNING: could not remove %s: %s.\n",
>> - soc_usb_compat, fdt_strerror(err));
>> + if (err < 0) {
>> + printf("WARNING: could not remove %s\n", soc_usb_compat);
>> + return err;
>> + }
>> +
>> + return 0;
>> }
>> +
>> #endif
>> diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
>> index a6756c6..66bc041 100644
>> --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
>> +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
>> @@ -6,6 +6,7 @@
>>
>> #include <common.h>
>> #include <command.h>
>> +#include <errno.h>
>> #include <hwconfig.h>
>> #include <pci.h>
>> #include <i2c.h>
>> @@ -424,7 +425,7 @@ static void fdt_board_fixup_qe_pins(void *blob)
>> #endif
>>
>> #ifdef CONFIG_OF_BOARD_SETUP
>> -void ft_board_setup(void *blob, bd_t *bd)
>> +int ft_board_setup(void *blob, bd_t *bd)
>> {
>> phys_addr_t base;
>> phys_size_t size;
>> @@ -459,17 +460,17 @@ void ft_board_setup(void *blob, bd_t *bd)
>> int off = fdt_node_offset_by_compatible(blob, -1,
>> soc_elbc_compat);
>> if (off < 0) {
>> - printf("WARNING: could not find compatible node %s: %s.\n",
>> - soc_elbc_compat,
>> - fdt_strerror(off));
>> - return;
>> + printf("WARNING: could not find compatible node %s\n",
>> + soc_elbc_compat);
>> + return off;
>> }
>> err = fdt_del_node(blob, off);
>> if (err < 0) {
>> - printf("WARNING: could not remove %s: %s.\n",
>> - soc_elbc_compat, fdt_strerror(err));
>> + printf("WARNING: could not remove %s\n",
>> + soc_elbc_compat);
>> + return err;
>> }
>> - return;
>> + return 0;
>> }
>> #endif
>>
>> @@ -477,24 +478,23 @@ void ft_board_setup(void *blob, bd_t *bd)
>> usb1_off = fdt_node_offset_by_compatible(blob, -1,
>> soc_usb_compat);
>> if (usb1_off < 0) {
>> - printf("WARNING: could not find compatible node %s: %s.\n",
>> - soc_usb_compat,
>> - fdt_strerror(usb1_off));
>> - return;
>> + printf("WARNING: could not find compatible node %s\n",
>> + soc_usb_compat);
>> + return usb1_off;
>> }
>> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
>> soc_usb_compat);
>> if (usb2_off < 0) {
>> - printf("WARNING: could not find compatible node %s: %s.\n",
>> - soc_usb_compat,
>> - fdt_strerror(usb2_off));
>> - return;
>> + printf("WARNING: could not find compatible node %s\n",
>> + soc_usb_compat);
>> + return usb2_off;
>> }
>> err = fdt_del_node(blob, usb2_off);
>> if (err < 0) {
>> - printf("WARNING: could not remove %s: %s.\n",
>> - soc_usb_compat, fdt_strerror(err));
>> + printf("WARNING: could not remove %s\n", soc_usb_compat);
>> + return err;
>> }
>>
>> + return 0;
>> }
>> #endif
>
> In both of these boards you add <errno.h> but don't make use of it, did
> you intend to make something return -FDT_ERR_NOTFOUND and then not need
> to after all? Thanks!
Actually -ENOENT I think, but it was a v1 mistake and I removed it. I
can remove these headers also.
Regards,
Simon
^ permalink raw reply [flat|nested] 46+ messages in thread* [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure
2014-10-24 19:56 ` Simon Glass
@ 2014-11-21 3:24 ` Simon Glass
0 siblings, 0 replies; 46+ messages in thread
From: Simon Glass @ 2014-11-21 3:24 UTC (permalink / raw)
To: u-boot
On 24 October 2014 21:56, Simon Glass <sjg@chromium.org> wrote:
> Hi Tom,
>
> On 24 October 2014 12:04, Tom Rini <trini@ti.com> wrote:
>> On Thu, Oct 23, 2014 at 06:58:47PM -0600, Simon Glass wrote:
>>
>>> This function can fail if the device tree runs out of space. Rather than
>>> silently booting with an incomplete device tree, allow the failure to be
>>> detected.
>>>
>>> Unfortunately this involves changing a lot of places in the code. I have
>>> not changed behvaiour to return an error where one is not currently
>>> returned, to avoid unexpected breakage.
>>>
>>> Eventually it would be nice to allow boards to register functions to be
>>> called to update the device tree. This would avoid all the many functions
>>> to do this. However it's not clear yet if this should be done using driver
>>> model or with a linker list. This work is left for later.
>> [snip]
>>> diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
>>> index aba4f53..19fef50 100644
>>> --- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
>>> +++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
>>> @@ -6,6 +6,7 @@
>>>
>>> #include <common.h>
>>> #include <command.h>
>>> +#include <errno.h>
>>> #include <asm/processor.h>
>>> #include <asm/mmu.h>
>>> #include <asm/cache.h>
>>> @@ -234,7 +235,7 @@ int board_eth_init(bd_t *bis)
>>> #if defined(CONFIG_OF_BOARD_SETUP)
>>> extern void ft_pci_board_setup(void *blob);
>>>
>>> -void ft_board_setup(void *blob, bd_t *bd)
>>> +int ft_board_setup(void *blob, bd_t *bd)
>>> {
>>> const char *soc_usb_compat = "fsl-usb2-dr";
>>> int err, usb1_off, usb2_off;
>>> @@ -263,39 +264,41 @@ void ft_board_setup(void *blob, bd_t *bd)
>>> int off = fdt_node_offset_by_compatible(blob, -1,
>>> soc_elbc_compat);
>>> if (off < 0) {
>>> - printf("WARNING: could not find compatible node"
>>> - " %s: %s.\n", soc_elbc_compat,
>>> - fdt_strerror(off));
>>> - return;
>>> + printf("WARNING: could not find compatible node %s\n",
>>> + soc_elbc_compat);
>>> + return off;
>>> }
>>> err = fdt_del_node(blob, off);
>>> if (err < 0) {
>>> - printf("WARNING: could not remove %s: %s.\n",
>>> - soc_elbc_compat, fdt_strerror(err));
>>> + printf("WARNING: could not remove %s\n",
>>> + soc_elbc_compat);
>>> + return err;
>>> }
>>> - return;
>>> + return 0;
>>> }
>>> #endif
>>> /* Delete USB2 node as it is muxed with eLBC */
>>> usb1_off = fdt_node_offset_by_compatible(blob, -1,
>>> soc_usb_compat);
>>> if (usb1_off < 0) {
>>> - printf("WARNING: could not find compatible node"
>>> - " %s: %s.\n", soc_usb_compat,
>>> - fdt_strerror(usb1_off));
>>> - return;
>>> + printf("WARNING: could not find compatible node %s\n",
>>> + soc_usb_compat);
>>> + return usb1_off;
>>> }
>>> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
>>> soc_usb_compat);
>>> if (usb2_off < 0) {
>>> - printf("WARNING: could not find compatible node"
>>> - " %s: %s.\n", soc_usb_compat,
>>> - fdt_strerror(usb2_off));
>>> - return;
>>> + printf("WARNING: could not find compatible node %s\n",
>>> + soc_usb_compat);
>>> + return usb2_off;
>>> }
>>> err = fdt_del_node(blob, usb2_off);
>>> - if (err < 0)
>>> - printf("WARNING: could not remove %s: %s.\n",
>>> - soc_usb_compat, fdt_strerror(err));
>>> + if (err < 0) {
>>> + printf("WARNING: could not remove %s\n", soc_usb_compat);
>>> + return err;
>>> + }
>>> +
>>> + return 0;
>>> }
>>> +
>>> #endif
>>> diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
>>> index a6756c6..66bc041 100644
>>> --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
>>> +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
>>> @@ -6,6 +6,7 @@
>>>
>>> #include <common.h>
>>> #include <command.h>
>>> +#include <errno.h>
>>> #include <hwconfig.h>
>>> #include <pci.h>
>>> #include <i2c.h>
>>> @@ -424,7 +425,7 @@ static void fdt_board_fixup_qe_pins(void *blob)
>>> #endif
>>>
>>> #ifdef CONFIG_OF_BOARD_SETUP
>>> -void ft_board_setup(void *blob, bd_t *bd)
>>> +int ft_board_setup(void *blob, bd_t *bd)
>>> {
>>> phys_addr_t base;
>>> phys_size_t size;
>>> @@ -459,17 +460,17 @@ void ft_board_setup(void *blob, bd_t *bd)
>>> int off = fdt_node_offset_by_compatible(blob, -1,
>>> soc_elbc_compat);
>>> if (off < 0) {
>>> - printf("WARNING: could not find compatible node %s: %s.\n",
>>> - soc_elbc_compat,
>>> - fdt_strerror(off));
>>> - return;
>>> + printf("WARNING: could not find compatible node %s\n",
>>> + soc_elbc_compat);
>>> + return off;
>>> }
>>> err = fdt_del_node(blob, off);
>>> if (err < 0) {
>>> - printf("WARNING: could not remove %s: %s.\n",
>>> - soc_elbc_compat, fdt_strerror(err));
>>> + printf("WARNING: could not remove %s\n",
>>> + soc_elbc_compat);
>>> + return err;
>>> }
>>> - return;
>>> + return 0;
>>> }
>>> #endif
>>>
>>> @@ -477,24 +478,23 @@ void ft_board_setup(void *blob, bd_t *bd)
>>> usb1_off = fdt_node_offset_by_compatible(blob, -1,
>>> soc_usb_compat);
>>> if (usb1_off < 0) {
>>> - printf("WARNING: could not find compatible node %s: %s.\n",
>>> - soc_usb_compat,
>>> - fdt_strerror(usb1_off));
>>> - return;
>>> + printf("WARNING: could not find compatible node %s\n",
>>> + soc_usb_compat);
>>> + return usb1_off;
>>> }
>>> usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
>>> soc_usb_compat);
>>> if (usb2_off < 0) {
>>> - printf("WARNING: could not find compatible node %s: %s.\n",
>>> - soc_usb_compat,
>>> - fdt_strerror(usb2_off));
>>> - return;
>>> + printf("WARNING: could not find compatible node %s\n",
>>> + soc_usb_compat);
>>> + return usb2_off;
>>> }
>>> err = fdt_del_node(blob, usb2_off);
>>> if (err < 0) {
>>> - printf("WARNING: could not remove %s: %s.\n",
>>> - soc_usb_compat, fdt_strerror(err));
>>> + printf("WARNING: could not remove %s\n", soc_usb_compat);
>>> + return err;
>>> }
>>>
>>> + return 0;
>>> }
>>> #endif
>>
>> In both of these boards you add <errno.h> but don't make use of it, did
>> you intend to make something return -FDT_ERR_NOTFOUND and then not need
>> to after all? Thanks!
>
> Actually -ENOENT I think, but it was a v1 mistake and I removed it. I
> can remove these headers also.
Fixed, and applied to u-boot-fdt.
^ permalink raw reply [flat|nested] 46+ messages in thread
end of thread, other threads:[~2014-12-10 5:31 UTC | newest]
Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 0:58 [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 02/11] fdt: Report failure of ft_board_setup() Simon Glass
2014-10-24 15:15 ` Anatolij Gustschin
2014-10-24 18:05 ` Tom Rini
2014-11-21 3:24 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 03/11] fdt: Export the fdt_find_or_add_subnode() function Simon Glass
2014-10-24 16:48 ` Anatolij Gustschin
2014-10-24 18:05 ` Tom Rini
2014-11-21 3:24 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 04/11] fdt: Add device tree memory bindings Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-10-24 20:04 ` Simon Glass
2014-10-27 14:24 ` Tom Rini
2014-10-27 18:50 ` Simon Glass
2014-11-12 15:13 ` Simon Glass
2014-11-12 21:42 ` Tom Rini
2014-11-12 22:14 ` Simon Glass
2014-11-20 14:37 ` Tom Rini
2014-11-20 17:42 ` Simon Glass
2014-12-10 5:31 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 05/11] fdt: Use the correct return types for fdtdec_decode_region() Simon Glass
2014-10-24 18:07 ` Tom Rini
2014-11-21 3:25 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 06/11] fdt: Enhance flashmap function to deal with region properties Simon Glass
2014-10-24 18:08 ` Tom Rini
2014-11-21 3:25 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 07/11] fdt: Tidy up error handling in image_setup_libfdt() Simon Glass
2014-10-24 18:09 ` Tom Rini
2014-11-21 3:25 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 08/11] fdt: Add ft_system_setup() function for system device tree additions Simon Glass
2014-10-24 18:50 ` Tom Rini
2014-11-13 2:40 ` Simon Glass
2014-11-21 3:25 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 09/11] fdt: Change fdt_pack_reg() to static and fix types Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-11-21 3:25 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 10/11] fdt: Add a function to decode a named memory region Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-11-21 3:26 ` Simon Glass
2014-10-24 0:58 ` [U-Boot] [PATCH v2 11/11] fdt: Try to use fdt_address_cells()/fdt_size_cells() Simon Glass
2014-10-24 18:49 ` Tom Rini
2014-11-21 3:26 ` Simon Glass
2014-10-24 15:50 ` [U-Boot] [PATCH v2 01/11] fdt: Allow ft_board_setup() to report failure Anatolij Gustschin
2014-10-24 18:04 ` Tom Rini
2014-10-24 19:56 ` Simon Glass
2014-11-21 3:24 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox