--- linux-2.5-ocp/include/asm-ppc/ibm44x.h 2004-05-27 11:05:13.000000000 +0200 +++ linux-2.5-ocp/include/asm-ppc/ibm44x.h 2004-06-05 17:59:35.000000000 +0200 @@ -62,6 +62,12 @@ * SPRN definitions */ #define SPRN_CPC0_GPIO 0xe5/BEARLRL +#ifdef CONFIG_440GX +#define SPRN_MCSRR0 0x23a +#define SPRN_MCSRR1 0x23b +#define SPRN_MCSR 0x23c +#define SPRN_CCR1 0x378 +#endif /* * DCRN definitions --- linux-2.5-ocp/arch/ppc/platforms/4xx/ocotea.c.ori 2004-05-27 11:02:13.000000000 +0200 +++ linux-2.5-ocp/arch/ppc/platforms/4xx/ocotea.c 2004-06-05 17:43:20.000000000 +0200 @@ -63,8 +63,16 @@ static void __init ocotea_calibrate_decr(void) { unsigned int freq; + struct ibm44x_clocks clocks; - freq = OCOTEA_SYSCLK; + if (mfspr(SPRN_CCR1) & 0x00000080) { + /* CPU timers increment at TMR_CLK pin frequency */ + freq = OCOTEA_SYSCLK; + } else { + /* CPU timers increment at CPU clock frequency */ + ibm440gx_get_clocks(&clocks, 33333333, 6 * 1843200); + freq = clocks.cpu; + } tb_ticks_per_jiffy = freq / HZ; tb_to_us = mulhwu_scale_factor(freq, 1000000); @@ -240,8 +248,6 @@ ocotea_early_serial_map(const struct ibm static void __init ocotea_setup_arch(void) { - unsigned char *addr; - unsigned long long mac64; struct ocp_def *def; struct ocp_func_emac_data *emacdata; int i; @@ -259,6 +265,10 @@ ocotea_setup_arch(void) * the phy_map/phy_mode. */ /* Set phy_map, phy_mode, and mac_addr for each EMAC */ +#ifndef CONFIG_U_BOOT + unsigned char *addr; + unsigned long long mac64; + addr = ioremap64(OCOTEA_MAC_BASE, OCOTEA_MAC_SIZE); for (i=0; i<4; i++) { mac64 = simple_strtoull(addr+OCOTEA_MAC_OFFSET*i, 0, 16); @@ -275,7 +285,34 @@ ocotea_setup_arch(void) memcpy(emacdata->mac_addr, (char *)&mac64+2, 6); } iounmap(addr); - +#else + for (i=0; i<4; i++) { + def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i); + emacdata = def->additions; + if (i < 2) { + emacdata->phy_map = 0x00000001; /* Skip 0x00 */ + emacdata->phy_mode = PHY_MODE_SMII; + } + else { + emacdata->phy_map = 0x0000ffff; /* Skip 0x00-0x0f */ + emacdata->phy_mode = PHY_MODE_RGMII; + } + switch (i) { + case 0: + memcpy(emacdata->mac_addr, bd->bi_enetaddr, 6); + break; + case 1: + memcpy(emacdata->mac_addr, bd->bi_enet1addr, 6); + break; + case 2: + memcpy(emacdata->mac_addr, bd->bi_enet2addr, 6); + break; + case 3: + memcpy(emacdata->mac_addr, bd->bi_enet3addr, 6); + break; + } + } +#endif ibm440gx_tah_enable(); #if !defined(CONFIG_BDI_SWITCH)