Commit 1fc4e6f4 authored by Tom Rini's avatar Tom Rini
Browse files
parents 94092e36 933cdbb4
......@@ -783,6 +783,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
......@@ -3510,7 +3517,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
......
......@@ -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 */
......@@ -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
......
......@@ -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) */
......
......@@ -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
......
......@@ -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@bffd1000", "status",
"disabled", sizeof("disabled"), 1);
}
return 0;
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
......@@ -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 */
......@@ -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) */
......@@ -458,7 +458,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];
......@@ -467,6 +467,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
......
......@@ -121,7 +121,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];
......@@ -130,6 +130,8 @@ void ft_board_setup(void *blob, bd_t *bd)
fdt_find_and_setprop(blob, "/smsc95xx@0", "mac-address",
enetaddr, 6, 1);
}
return 0;
}
static void generate_mac_addr(uint8_t *enetaddr)
......
......@@ -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) */
......@@ -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) */
......
......@@ -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) */
......@@ -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) */
......
......@@ -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) */
......@@ -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
......
......@@ -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;
}
/*
......
......@@ -58,7 +58,7 @@ struct node_info nodes[] = {
{ "fsl,ifc-nand", MTD_DEV_TYPE_NAND, },
};
#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;
......@@ -74,5 +74,7 @@ void ft_board_setup(void *blob, bd_t *bd)
#endif
fdt_fixup_dr_usb(blob, bd);
return 0;
}
#endif
......@@ -363,7 +363,7 @@ struct node_info nodes[] = {
{ "fsl,ifc-nand", MTD_DEV_TYPE_NAND, },
};
#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;
......@@ -423,5 +423,7 @@ void ft_board_setup(void *blob, bd_t *bd)
printf("\nRemove sim from hwconfig and reset\n");
}
}
return 0;
}
#endif
......@@ -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
......@@ -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
......@@ -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;
}
......@@ -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)
......
......@@ -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)
......
......@@ -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
......@@ -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) */
......@@ -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
......
......@@ -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
......
......@@ -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 */
......
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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;
}