boards with QUICC Engines require OF_QE to set UCC mac addresses
- CONFIG_OF_HAS_BD_T
-
- * CONFIG_OF_LIBFDT - enables the "fdt bd_t" command
- * CONFIG_OF_FLAT_TREE - The resulting flat device tree
- will have a copy of the bd_t. Space should be
- pre-allocated in the dts for the bd_t.
-
- CONFIG_OF_HAS_UBOOT_ENV
-
- * CONFIG_OF_LIBFDT - enables the "fdt env" command
- * CONFIG_OF_FLAT_TREE - The resulting flat device tree
- will have a copy of u-boot's environment variables
-
CONFIG_OF_BOARD_SETUP
Board code has addition modification that it wants to make
/* Function that returns a character from the environment */
extern uchar(*env_get_char) (int);
-#define BDM(x) { .name = #x, .offset = offsetof(bd_t, bi_ ##x ) }
-
-#ifdef CONFIG_OF_HAS_BD_T
-static const struct {
- const char *name;
- int offset;
-} bd_map[] = {
- BDM(memstart),
- BDM(memsize),
- BDM(flashstart),
- BDM(flashsize),
- BDM(flashoffset),
- BDM(sramstart),
- BDM(sramsize),
-#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260) \
- || defined(CONFIG_E500)
- BDM(immr_base),
-#endif
-#if defined(CONFIG_MPC5xxx)
- BDM(mbar_base),
-#endif
-#if defined(CONFIG_MPC83XX)
- BDM(immrbar),
-#endif
-#if defined(CONFIG_MPC8220)
- BDM(mbar_base),
- BDM(inpfreq),
- BDM(pcifreq),
- BDM(pevfreq),
- BDM(flbfreq),
- BDM(vcofreq),
-#endif
- BDM(bootflags),
- BDM(ip_addr),
- BDM(intfreq),
- BDM(busfreq),
-#ifdef CONFIG_CPM2
- BDM(cpmfreq),
- BDM(brgfreq),
- BDM(sccfreq),
- BDM(vco),
-#endif
-#if defined(CONFIG_MPC5xxx)
- BDM(ipbfreq),
- BDM(pcifreq),
-#endif
- BDM(baudrate),
-};
-#endif
-
void ft_setup(void *blob, bd_t * bd, ulong initrd_start, ulong initrd_end)
{
u32 *p;
int len;
struct ft_cxt cxt;
ulong clock;
-#if defined(CONFIG_OF_HAS_UBOOT_ENV)
- int k, nxt;
-#endif
-#if defined(CONFIG_OF_HAS_BD_T)
- u8 *end;
-#endif
-#if defined(CONFIG_OF_HAS_UBOOT_ENV) || defined(CONFIG_OF_HAS_BD_T)
- int i;
- static char tmpenv[256];
-#endif
/* disable OF tree; booting old kernel */
if (getenv("disable_of") != NULL) {
/* back into root */
ft_backtrack_node(&cxt);
-#ifdef CONFIG_OF_HAS_UBOOT_ENV
- ft_begin_node(&cxt, "u-boot-env");
-
- for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
- char *s, *lval, *rval;
-
- for (nxt = i; env_get_char(nxt) != '\0'; ++nxt) ;
- s = tmpenv;
- for (k = i; k < nxt && s < &tmpenv[sizeof(tmpenv) - 1]; ++k)
- *s++ = env_get_char(k);
- *s++ = '\0';
- lval = tmpenv;
- s = strchr(tmpenv, '=');
- if (s != NULL) {
- *s++ = '\0';
- rval = s;
- } else
- continue;
- ft_prop_str(&cxt, lval, rval);
- }
-
- ft_end_node(&cxt);
-#endif
-
ft_begin_node(&cxt, "chosen");
ft_prop_str(&cxt, "name", "chosen");
ft_end_tree(&cxt);
ft_finalize_tree(&cxt);
-#ifdef CONFIG_OF_HAS_BD_T
- /* paste the bd_t at the end of the flat tree */
- end = (char *)blob +
- be32_to_cpu(((struct boot_param_header *)blob)->totalsize);
- memcpy(end, bd, sizeof(*bd));
-#endif
-
#ifdef CONFIG_PPC
-
-#ifdef CONFIG_OF_HAS_BD_T
- for (i = 0; i < sizeof(bd_map)/sizeof(bd_map[0]); i++) {
- uint32_t v;
-
- sprintf(tmpenv, "/bd_t/%s", bd_map[i].name);
- v = *(uint32_t *)((char *)bd + bd_map[i].offset);
-
- p = ft_get_prop(blob, tmpenv, &len);
- if (p != NULL)
- *p = cpu_to_be32(v);
- }
-
- p = ft_get_prop(blob, "/bd_t/enetaddr", &len);
- if (p != NULL)
- memcpy(p, bd->bi_enetaddr, 6);
-
- p = ft_get_prop(blob, "/bd_t/ethspeed", &len);
- if (p != NULL)
- *p = cpu_to_be32((uint32_t) bd->bi_ethspeed);
-#endif
-
clock = bd->bi_intfreq;
p = ft_get_prop(blob, "/cpus/" OF_CPU "/clock-frequency", &len);
if (p != NULL)
fdt_error ("/chosen node create failed");
goto error;
}
-#ifdef CONFIG_OF_HAS_UBOOT_ENV
- if (fdt_env(of_flat_tree) < 0) {
- fdt_error ("/u-boot-env node create failed");
- goto error;
- }
-#endif
-#ifdef CONFIG_OF_HAS_BD_T
- if (fdt_bd_t(of_flat_tree) < 0) {
- fdt_error ("/bd_t node create failed");
- goto error;
- }
-#endif
#ifdef CONFIG_OF_BOARD_SETUP
/* Call the board-specific fixup routine */
ft_board_setup(of_flat_tree, gd->bd);