cpuat91: unbreak ethernet
Subsystems (3)
PATCH 1/2 cpuat91: unbreak ethernet
* the following problems are met :
config was set to use the new driver as a default but
- RMII was not enabled for the new driver
- the new driver didn't compile with RMII enabled
- the new driver initialize a PHY at address O when the PHY of this board is at 1 thus we get "AT91 EMAC RMII: No PHY present"
* to fix these problems, this patch :
- enable RMII for the new driver
- fix the wrong define used in the at91_emac.c
- allow the config file to set a default phy address (and use 0 as a default as in the actual at91_emac.c driver)
--- drivers/net/at91_emac.c | 24 ++++++++++++++---------- include/configs/cpuat91.h | 9 +++------ 2 files changed, 17 insertions(+), 16 deletions(-)
drivers/net/at91_emac.c +14 -10
@@ -53,6 +53,10 @@ Please decrease the CONFIG_SYS_RX_ETH_BUFFER value#endif +#ifndef CONFIG_DRIVER_AT91EMAC_PHYADDR +#define CONFIG_DRIVER_AT91EMAC_PHYADDR 0 +#endif +/* MDIO clock must not exceed 2.5 MHz, so enable MCK divider */ #if (AT91C_MASTER_CLOCK >80000000 )#define HCLK_DIV AT91_EMAC_CFG_MCLK_64
@@ -198,12 +202,12 @@ static int at91emac_phy_reset(struct eth_device *netdev) emac = (at91_emac_t *) netdev->iobase; adv =ADVERTISE_CSMA |ADVERTISE_ALL ; -at91emac_write (emac,0 ,MII_ADVERTISE , adv); +at91emac_write (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_ADVERTISE , adv);VERBOSEP ("%s: Starting autonegotiation...\n" , netdev->name); -at91emac_write (emac,0 ,MII_BMCR , (BMCR_ANENABLE |BMCR_ANRESTART )); +at91emac_write (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMCR , (BMCR_ANENABLE |BMCR_ANRESTART ));for (i =0 ; i <100000 /100 ; i++) { -at91emac_read (emac,0 ,MII_BMSR , &status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR , &status);if (status &BMSR_ANEGCOMPLETE )break ;udelay (100 );
@@ -229,13 +233,13 @@ static int at91emac_phy_init(struct eth_device *netdev) emac = (at91_emac_t *) netdev->iobase;/* Check if the PHY is up to snuff... */ -at91emac_read (emac,0 ,MII_PHYSID1 , &phy_id); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_PHYSID1 , &phy_id);if (phy_id ==0xffff ) {printf ("%s: No PHY present\n" , netdev->name);return 1 ; } -at91emac_read (emac,0 ,MII_BMSR , &status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR , &status);if (!(status &BMSR_LSTATUS )) {/* Try to re-negotiate if we don't have link already. */
@@ -243,7 +247,7 @@ static int at91emac_phy_init(struct eth_device *netdev)return 2 ;for (i =0 ; i <100000 /100 ; i++) { -at91emac_read (emac,0 ,MII_BMSR , &status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR , &status);if (status &BMSR_LSTATUS )break ;udelay (100 );
@@ -253,8 +257,8 @@ static int at91emac_phy_init(struct eth_device *netdev)VERBOSEP ("%s: link down\n" , netdev->name);return 3 ; }else { -at91emac_read (emac,0 ,MII_ADVERTISE , &adv); -at91emac_read (emac,0 ,MII_LPA , &lpa); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_ADVERTISE , &adv); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_LPA , &lpa); media =mii_nway_result (lpa & adv); speed = (media & (ADVERTISE_100FULL |ADVERTISE_100HALF ) ?1 :0 );
@@ -271,7 +275,7 @@ int at91emac_UpdateLinkSpeed(at91_emac_t *emac) {unsigned short stat1; -at91emac_read (emac,0 ,MII_BMSR , &stat1); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR , &stat1);if (!(stat1 &BMSR_LSTATUS ))/* link status up? */ return 1 ;
@@ -372,7 +376,7 @@ static int at91emac_init(struct eth_device *netdev, bd_t *bd) value =AT91_EMAC_CFG_CAF |AT91_EMAC_CFG_NBC |HCLK_DIV ;#ifdef CONFIG_RMII - value |=AT91C_EMAC_RMII ; + value |=AT91_EMAC_CFG_RMII ;#endif writel (value, &emac->cfg);
include/configs/cpuat91.h +3 -6
@@ -131,15 +131,12 @@ (CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 512 * 1024)#define CONFIG_NET_MULTI 1 -#ifdef CONFIG_NET_MULTI #define CONFIG_DRIVER_AT91EMAC 1#define CONFIG_SYS_RX_ETH_BUFFER 8 -#else -#define CONFIG_DRIVER_ETHER 1 -#endif +#define CONFIG_RMII 1 +#define CONFIG_MII 1 +#define CONFIG_DRIVER_AT91EMAC_PHYADDR 1#define CONFIG_NET_RETRY_COUNT 20 -#define CONFIG_AT91C_USE_RMII 1 -#define CONFIG_PHY_ADDRESS (1 << 5)#define CONFIG_KS8721_PHY 1#define CONFIG_SYS_FLASH_CFI 1
Signature · 1 line
1.6.3.3
PATCH 2/2 cpuat91: convert to new at91 soc architecture
convert the board to the new soc architecture
update default config
i2c upgrade taken from eb_cpux9k2.h & board/BuS/eb_cpux9k2/cpux9k2.c
--- Makefile | 2 +- board/eukrea/cpuat91/cpuat91.c | 53 ++++++++++++++++----------------------- include/configs/cpuat91.h | 45 +++++++++++++++++++++++---------- 3 files changed, 54 insertions(+), 46 deletions(-)
Makefile +1 -1
@@ -2693,7 +2693,7 @@ CPUAT91_RAM_config \ CPUAT91_config : unconfig @mkdir -p $(obj)include @echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h - @$(MKCONFIG) -a cpuat91 arm arm920t cpuat91 eukrea at91rm9200 + @$(MKCONFIG) -a cpuat91 arm arm920t cpuat91 eukrea at91 csb637_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t csb637 NULL at91rm9200
board/eukrea/cpuat91/cpuat91.c +22 -31
74 lines not on this page · raw message
include/configs/cpuat91.h +31 -14
93 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 1/2 cpuat91: unbreak ethernet
In reply to Eric BénardHi Eric,
Quoted 35 lines · Eric B?nard
* the following problems are met :
config was set to use the new driver as a default but
- RMII was not enabled for the new driver
- the new driver didn't compile with RMII enabled
- the new driver initialize a PHY at address O when the PHY of this board is at 1 thus we get "AT91 EMAC RMII: No PHY present"* to fix these problems, this patch :
- enable RMII for the new driver
- fix the wrong define used in theat91_emac.c
- allow the config file to set a default phy address (and use 0 as a default as in the actualat91_emac.cdriver)Signed-off-by Eric B?nard<[email protected]>--- drivers/net/at91_emac.c | 24 ++++++++++++++---------- include/configs/cpuat91.h | 9 +++------ 2 files changed, 17 insertions(+), 16 deletions(-)drivers/net/at91_emac.c +4
-0@@ -53,6 +53,10 @@ Please decrease the CONFIG_SYS_RX_ETH_BUFFER value#endif +#ifndef CONFIG_DRIVER_AT91EMAC_PHYADDR +#define CONFIG_DRIVER_AT91EMAC_PHYADDR 0 +#endif +/* MDIO clock must not exceed 2.5 MHz, so enable MCK divider */ #if (AT91C_MASTER_CLOCK >80000000 )#define HCLK_DIV AT91_EMAC_CFG_MCLK_64
drivers/net/at91_emac.c static int at91emac_phy_reset(struct eth_device *netdev) · line 208
Quoted 9 lines
drivers/net/at91_emac.c +2
-2@@ -198,12 +202,12 @@ static int at91emac_phy_reset(struct eth_device *netdev) emac = (at91_emac_t *) netdev->iobase; adv =ADVERTISE_CSMA |ADVERTISE_ALL ; -at91emac_write (emac,0 ,MII_ADVERTISE , adv); +at91emac_write (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_ADVERTISE , adv);VERBOSEP ("%s: Starting autonegotiation...\n" , netdev->name); -at91emac_write (emac,0 ,MII_BMCR , (BMCR_ANENABLE |BMCR_ANRESTART )); +at91emac_write (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMCR , (BMCR_ANENABLE |BMCR_ANRESTART ));
This line's too long. Please check the other ones too. Try to keep less than 78 characters.
Quoted 75 lines
drivers/net/at91_emac.c +8
-8for (i =0 ; i<100000 /100 ; i++) { -at91emac_read (emac,0 ,MII_BMSR ,&status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR ,&status);if (status&BMSR_ANEGCOMPLETE )break ;udelay (100 );@@ -229,13 +233,13 @@ static int at91emac_phy_init(struct eth_device *netdev) emac = (at91_emac_t *) netdev->iobase;/* Check if the PHY is up to snuff... */ -at91emac_read (emac,0 ,MII_PHYSID1 ,&phy_id); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_PHYSID1 ,&phy_id);if (phy_id ==0xffff ) {printf ("%s: No PHY present\n" , netdev->name);return 1 ; } -at91emac_read (emac,0 ,MII_BMSR ,&status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR ,&status);if (!(status&BMSR_LSTATUS )) {/* Try to re-negotiate if we don't have link already. */ @@ -243,7 +247,7 @@ static int at91emac_phy_init(struct eth_device *netdev)return 2 ;for (i =0 ; i<100000 /100 ; i++) { -at91emac_read (emac,0 ,MII_BMSR ,&status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR ,&status);if (status&BMSR_LSTATUS )break ;udelay (100 );@@ -253,8 +257,8 @@ static int at91emac_phy_init(struct eth_device *netdev)VERBOSEP ("%s: link down\n" , netdev->name);return 3 ; }else { -at91emac_read (emac,0 ,MII_ADVERTISE ,&adv); -at91emac_read (emac,0 ,MII_LPA ,&lpa); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_ADVERTISE ,&adv); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_LPA ,&lpa); media =mii_nway_result (lpa& adv); speed = (media& (ADVERTISE_100FULL |ADVERTISE_100HALF ) ?1 :0 );@@ -271,7 +275,7 @@ int at91emac_UpdateLinkSpeed(at91_emac_t *emac) {unsigned short stat1; -at91emac_read (emac,0 ,MII_BMSR ,&stat1); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR ,&stat1);if (!(stat1&BMSR_LSTATUS ))/* link status up? */ return 1 ;@@ -372,7 +376,7 @@ static int at91emac_init(struct eth_device *netdev, bd_t *bd) value =AT91_EMAC_CFG_CAF |AT91_EMAC_CFG_NBC |HCLK_DIV ;#ifdef CONFIG_RMII - value |=AT91C_EMAC_RMII ; + value |=AT91_EMAC_CFG_RMII ;#endif writel (value,&emac->cfg);include/configs/cpuat91.h +0
-3@@ -131,15 +131,12 @@ (CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 512 * 1024)#define CONFIG_NET_MULTI 1 -#ifdef CONFIG_NET_MULTI #define CONFIG_DRIVER_AT91EMAC 1#define CONFIG_SYS_RX_ETH_BUFFER 8 -#else -#define CONFIG_DRIVER_ETHER 1
include/configs/cpuat91.h line 142
Quoted 10 lines
include/configs/cpuat91.h +3
-3-#endif +#define CONFIG_RMII 1 +#define CONFIG_MII 1 +#define CONFIG_DRIVER_AT91EMAC_PHYADDR 1#define CONFIG_NET_RETRY_COUNT 20 -#define CONFIG_AT91C_USE_RMII 1 -#define CONFIG_PHY_ADDRESS (1<< 5)#define CONFIG_KS8721_PHY 1#define CONFIG_SYS_FLASH_CFI 1
regards,
Ben
PATCH v2 1/1 cpuat91: unbreak ethernet
* the following problems are met :
config was set to use the new driver as a default but
- RMII was not enabled for the new driver
- the new driver didn't compile with RMII enabled
- the new driver initialize a PHY at address O when the PHY of this board is at 1 thus we get "AT91 EMAC RMII: No PHY present"
* to fix these problems, this patch :
- enable RMII for the new driver
- fix the wrong define used in the at91_emac.c
- allow the config file to set a default phy address (and use 0 as a default as in the actual at91_emac.c driver)
---
v2 :
fix line lengths
drivers/net/at91_emac.c | 32 ++++++++++++++++++++++---------- include/configs/cpuat91.h | 9 +++------ 2 files changed, 25 insertions(+), 16 deletions(-)
drivers/net/at91_emac.c +22 -10
@@ -53,6 +53,10 @@ Please decrease the CONFIG_SYS_RX_ETH_BUFFER value#endif +#ifndef CONFIG_DRIVER_AT91EMAC_PHYADDR +#define CONFIG_DRIVER_AT91EMAC_PHYADDR 0 +#endif +/* MDIO clock must not exceed 2.5 MHz, so enable MCK divider */ #if (AT91C_MASTER_CLOCK >80000000 )#define HCLK_DIV AT91_EMAC_CFG_MCLK_64
@@ -198,12 +202,15 @@ static int at91emac_phy_reset(struct eth_device *netdev) emac = (at91_emac_t *) netdev->iobase; adv =ADVERTISE_CSMA |ADVERTISE_ALL ; -at91emac_write (emac,0 ,MII_ADVERTISE , adv); +at91emac_write (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_ADVERTISE , adv);VERBOSEP ("%s: Starting autonegotiation...\n" , netdev->name); -at91emac_write (emac,0 ,MII_BMCR , (BMCR_ANENABLE |BMCR_ANRESTART )); +at91emac_write (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMCR , + (BMCR_ANENABLE |BMCR_ANRESTART ));for (i =0 ; i <100000 /100 ; i++) { -at91emac_read (emac,0 ,MII_BMSR , &status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_BMSR , &status);if (status &BMSR_ANEGCOMPLETE )break ;udelay (100 );
@@ -229,13 +236,15 @@ static int at91emac_phy_init(struct eth_device *netdev) emac = (at91_emac_t *) netdev->iobase;/* Check if the PHY is up to snuff... */ -at91emac_read (emac,0 ,MII_PHYSID1 , &phy_id); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_PHYSID1 , &phy_id);if (phy_id ==0xffff ) {printf ("%s: No PHY present\n" , netdev->name);return 1 ; } -at91emac_read (emac,0 ,MII_BMSR , &status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_BMSR , &status);if (!(status &BMSR_LSTATUS )) {/* Try to re-negotiate if we don't have link already. */
@@ -243,7 +252,8 @@ static int at91emac_phy_init(struct eth_device *netdev)return 2 ;for (i =0 ; i <100000 /100 ; i++) { -at91emac_read (emac,0 ,MII_BMSR , &status); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_BMSR , &status);if (status &BMSR_LSTATUS )break ;udelay (100 );
@@ -253,8 +263,10 @@ static int at91emac_phy_init(struct eth_device *netdev)VERBOSEP ("%s: link down\n" , netdev->name);return 3 ; }else { -at91emac_read (emac,0 ,MII_ADVERTISE , &adv); -at91emac_read (emac,0 ,MII_LPA , &lpa); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_ADVERTISE , &adv); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR , +MII_LPA , &lpa); media =mii_nway_result (lpa & adv); speed = (media & (ADVERTISE_100FULL |ADVERTISE_100HALF ) ?1 :0 );
@@ -271,7 +283,7 @@ int at91emac_UpdateLinkSpeed(at91_emac_t *emac) {unsigned short stat1; -at91emac_read (emac,0 ,MII_BMSR , &stat1); +at91emac_read (emac,CONFIG_DRIVER_AT91EMAC_PHYADDR ,MII_BMSR , &stat1);if (!(stat1 &BMSR_LSTATUS ))/* link status up? */ return 1 ;
@@ -372,7 +384,7 @@ static int at91emac_init(struct eth_device *netdev, bd_t *bd) value =AT91_EMAC_CFG_CAF |AT91_EMAC_CFG_NBC |HCLK_DIV ;#ifdef CONFIG_RMII - value |=AT91C_EMAC_RMII ; + value |=AT91_EMAC_CFG_RMII ;#endif writel (value, &emac->cfg);
include/configs/cpuat91.h +3 -6
@@ -131,15 +131,12 @@ (CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 512 * 1024)#define CONFIG_NET_MULTI 1 -#ifdef CONFIG_NET_MULTI #define CONFIG_DRIVER_AT91EMAC 1#define CONFIG_SYS_RX_ETH_BUFFER 8 -#else -#define CONFIG_DRIVER_ETHER 1 -#endif +#define CONFIG_RMII 1 +#define CONFIG_MII 1 +#define CONFIG_DRIVER_AT91EMAC_PHYADDR 1#define CONFIG_NET_RETRY_COUNT 20 -#define CONFIG_AT91C_USE_RMII 1 -#define CONFIG_PHY_ADDRESS (1 << 5)#define CONFIG_KS8721_PHY 1#define CONFIG_SYS_FLASH_CFI 1
Signature · 1 line
1.6.3.3
Ben Warren
AppliedPATCH v2 1/1 cpuat91: unbreak ethernet
Hi Eric,
Quoted 7 lines · Eric B?nard
* the following problems are met :
config was set to use the new driver as a default but
- RMII was not enabled for the new driver
- the new driver didn't compile with RMII enabled
- the new driver initialize a PHY at address O when the PHY of this board is at 1 thus we get "AT91 EMAC RMII: No PHY present"
Quoted 9 lines
* to fix these problems, this patch :
- enable RMII for the new driver
- fix the wrong define used in theat91_emac.c
- allow the config file to set a default phy address (and use 0 as a default as in the actualat91_emac.cdriver)Signed-off-by Eric B?nard<[email protected]>---
Applied to net/next repo.
regards,
Ben