From befc1e66c5bd39b9f779bb77055788fa1f1fa40b Mon Sep 17 00:00:00 2001 From: MSE500 Team Date: Thu, 3 Nov 2011 17:07:35 +0100 Subject: cleo/u-boot: adapt Ethernet driver to spc300dini, refs #2758 --- cleopatre/u-boot-1.1.6/cpu/spc300/eth_init.S | 4 +++ cleopatre/u-boot-1.1.6/cpu/spc300/start.S | 4 +++ cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c | 38 ++++++++++++++++++++-- cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.h | 2 ++ .../u-boot-1.1.6/include/configs/spc300_arch.h | 3 ++ 5 files changed, 49 insertions(+), 2 deletions(-) (limited to 'cleopatre/u-boot-1.1.6') diff --git a/cleopatre/u-boot-1.1.6/cpu/spc300/eth_init.S b/cleopatre/u-boot-1.1.6/cpu/spc300/eth_init.S index ff748e267b..043db6acce 100644 --- a/cleopatre/u-boot-1.1.6/cpu/spc300/eth_init.S +++ b/cleopatre/u-boot-1.1.6/cpu/spc300/eth_init.S @@ -20,6 +20,9 @@ */ #include + +#ifndef CONFIG_CHIP_FEATURE_SYNOP3504_FIXED_CLOCK + #include #include @@ -177,3 +180,4 @@ ethernet_config: /* back to my caller */ mov pc, lr +#endif /* CONFIG_CHIP_FEATURE_SYNOP3504_FIXED_CLOCK */ diff --git a/cleopatre/u-boot-1.1.6/cpu/spc300/start.S b/cleopatre/u-boot-1.1.6/cpu/spc300/start.S index f5e81f4e97..f055819e66 100644 --- a/cleopatre/u-boot-1.1.6/cpu/spc300/start.S +++ b/cleopatre/u-boot-1.1.6/cpu/spc300/start.S @@ -278,6 +278,8 @@ in_sdram: */ bl gpio_pio_init /* we pass NVRAM addr in r10; do not corrupt r10 in this function */ +#ifndef CONFIG_CHIP_FEATURE_SYNOP3504_FIXED_CLOCK + /* * Configure Ethernet IP */ @@ -285,6 +287,8 @@ in_sdram: bl ethernet_config /* we pass NVRAM addr in r10; do not corrupt r10 in this function */ mov lr, ip /* restore link */ +#endif + #ifndef CONFIG_CHIP_FEATURE_NO_RESET /* diff --git a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c index c31cc039ed..0ed9a99003 100644 --- a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c +++ b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c @@ -259,6 +259,33 @@ int spcmac_phy_reset (int phy_addr, unsigned long phy_id) return 1; } +#ifdef CONFIG_CHIP_FEATURE_SYNOP3504_PHY_DINI + + /* The PHY used on SPC300DINI is VSC8601. */ + if ((PHYSID_GET_OUI (phy_id) != VITESSE_OUI) + ||(PHYSID_GET_MODEL (phy_id) != VITESSE_VSC8601)) + BUG(); + + /* Add a 2ns delay for TX and RX clock */ + + /* In register 23 "Extended Phy Control 1", enable "RGMII skew timing + * compensation". */ + spcmac_mii_write(phy_addr, 23, 0x0100); + + /* To access the extended register 28E, put 1 in register 31 "Extended + * Page Access". */ + spcmac_mii_write(phy_addr, 31, 0x0001); + + /* In register 28E "RGMII Skew Control", set both TX and RX RGMII Skew + * compensation to 2ns. */ + spcmac_mii_write(phy_addr, 28, 0xf000); + + /* Switch back to main register space, by putting 0 in register 31 + * "Extended Page Access". */ + spcmac_mii_write(phy_addr, 31, 0x0000); + +#endif /* CONFIG_CHIP_FEATURE_SYNOP3504_PHY_DINI */ + /* Fix hardware bug */ { DECLARE_GLOBAL_DATA_PTR; @@ -329,7 +356,7 @@ static unsigned long spcmac_phy_get_id (unsigned long phyaddr) static int spcmac_phy_init (void) { - uint advertised_caps, value, extvalue, lp_an_able; + uint advertised_caps, value, lp_an_able; uint status = 0; ulong now = 0; @@ -399,13 +426,20 @@ static int spcmac_phy_init (void) /* Check Giga bits capabilities */ if(value & BMSR_EXT) { - extvalue = spcmac_mii_read(eth_phy_addr, MII_EMSR); advertised_caps = spcmac_mii_read(eth_phy_addr, MII_MCR_1000); +#ifdef CONFIG_CHIP_FEATURE_SYNOP3504_NO_GIGABIT + /* The Dini prototype does not support 1000-BaseT. */ + advertised_caps &= ~ADVERTISE_1000FULL; + advertised_caps &= ~ADVERTISE_1000HALF; +#else + uint extvalue = spcmac_mii_read(eth_phy_addr, MII_EMSR); + if(extvalue & EMSR_1000FULL) advertised_caps |= ADVERTISE_1000FULL; if(extvalue & EMSR_1000HALF) advertised_caps |= ADVERTISE_1000HALF; +#endif spcmac_mii_write(eth_phy_addr, MII_MCR_1000, advertised_caps); } diff --git a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.h b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.h index fc181f038a..98c6e00128 100644 --- a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.h +++ b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.h @@ -414,6 +414,8 @@ #define ICPLUS_OUI 0x0090C3 #define ICPLUS_IP175 0x18 #define ICPLUS_IP1001 0x19 +#define VITESSE_OUI 0x0001C1 +#define VITESSE_VSC8601 0x02 /* internal IP175D PHY ID */ #define ICPLUS_ID_IP175D 0x175D diff --git a/cleopatre/u-boot-1.1.6/include/configs/spc300_arch.h b/cleopatre/u-boot-1.1.6/include/configs/spc300_arch.h index 32a8956169..fcc41f6ec7 100644 --- a/cleopatre/u-boot-1.1.6/include/configs/spc300_arch.h +++ b/cleopatre/u-boot-1.1.6/include/configs/spc300_arch.h @@ -34,6 +34,9 @@ # define CONFIG_CHIP_FEATURE_INT_MAP_V2 1 # define CONFIG_CHIP_FEATURE_MIU_CTRL 1 # define CONFIG_CHIP_FEATURE_SYNOP3504 1 +# define CONFIG_CHIP_FEATURE_SYNOP3504_NO_GIGABIT 1 +# define CONFIG_CHIP_FEATURE_SYNOP3504_FIXED_CLOCK 1 +# define CONFIG_CHIP_FEATURE_SYNOP3504_PHY_DINI 1 # define CONFIG_CHIP_FEATURE_DINI_UART_SELECT 1 # define CONFIG_CHIP_FEATURE_FIXED_MASTER_CLOCK 1 # define CONFIG_CHIP_MAX_MASTER_CLOCK 47000000 -- cgit v1.2.3