diff -Nur orig/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c code/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c --- orig/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c 2004-12-24 13:35:40.000000000 -0800 +++ code/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c 2005-02-23 10:05:32.043954000 -0800 @@ -49,10 +49,14 @@ #include #include #include +#include #include +#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h" + static struct ibm44x_clocks clocks __initdata; +bd_t __res; /* * Ebony IRQ triggering/polarity settings @@ -182,6 +186,41 @@ (writel(value, (u32)pcix_reg_base+offset)) /* + * Set mac address for each EMAC + * If uboot sets MAC addresses for each EMAC, use them. + * Otherwise fetch from Ebony VPD. + * + */ +static void __init +ebony_set_emacdata(void) +{ + unsigned char * vpd_base; + struct ocp_def *def; + struct ocp_func_emac_data *emacdata; + + vpd_base = ioremap64(EBONY_VPD_BASE, EBONY_VPD_SIZE); + + def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0); + emacdata = def->additions; + emacdata->phy_mode = PHY_MODE_RMII; + if (!strncmp(__res.bi_enetaddr, "\0xFF\0xFF\0xFF\0xFF\0xFF\0xFF", 6)) + memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6); + else + memcpy(emacdata->mac_addr, EBONY_NA0_ADDR(vpd_base), 6); + + def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1); + emacdata = def->additions; + emacdata->phy_mode = PHY_MODE_RMII; + if (!strncmp(__res.bi_enet1addr, "\0xFF\0xFF\0xFF\0xFF\0xFF\0xFF", 6)) + memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6); + else + memcpy(emacdata->mac_addr, EBONY_NA1_ADDR(vpd_base), 6); + + iounmap(vpd_base); + +} + +/* * FIXME: This is only here to "make it work". This will move * to a ibm_pcix.c which will contain a generic IBM PCIX bridge * configuration library. -Matt @@ -309,19 +348,7 @@ static void __init ebony_setup_arch(void) { - unsigned char * vpd_base; - struct ocp_def *def; - struct ocp_func_emac_data *emacdata; - - /* Set mac_addr for each EMAC */ - vpd_base = ioremap64(EBONY_VPD_BASE, EBONY_VPD_SIZE); - def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0); - emacdata = def->additions; - memcpy(emacdata->mac_addr, EBONY_NA0_ADDR(vpd_base), 6); - def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1); - emacdata = def->additions; - memcpy(emacdata->mac_addr, EBONY_NA1_ADDR(vpd_base), 6); - iounmap(vpd_base); + ebony_set_emacdata(); /* * Determine various clocks. @@ -368,7 +395,20 @@ void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { - parse_bootinfo((struct bi_record *) (r3 + KERNELBASE)); + parse_bootinfo(find_bootinfo()); + + /* + * If we were passed in a board information, copy it into the + * residual data area. + */ + if (r3) + __res = *(bd_t *)(r3 + KERNELBASE); + + /* Copy the kernel command line arguments to a safe place. */ + if (r6) { + *(char *) (r7 + KERNELBASE) = 0; + strcpy(cmd_line, (char *) (r6 + KERNELBASE)); + } ibm44x_platform_init();