pm9g45_v1.3: make ethernet works
PATCH 1/1 pm9g45_v1.3: make ethernet works
--- board/ronetix/pm9g45/pm9g45.c | 15 +++++++++++++++ include/configs/pm9g45.h | 5 +++++ 2 files changed, 20 insertions(+), 0 deletions(-)
board/ronetix/pm9g45/pm9g45.c +15 -0
@@ -96,6 +96,8 @@ static void pm9g45_nand_hw_init(void)static void pm9g45_macb_hw_init (void ) {at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE ; +at91_rstc_t *rstc = (at91_rstc_t *)AT91_RSTC_BASE ; +unsigned long erstl;/* * PD2 enables the 50MHz oscillator for Ethernet PHY
@@ -120,6 +122,19 @@ static void pm9g45_macb_hw_init(void)at91_set_pio_pullup (AT91_PIO_PORTA ,12 ,0 );at91_set_pio_pullup (AT91_PIO_PORTA ,13 ,0 ); + erstl =readl (&rstc->mr) &AT91_RSTC_MR_ERSTL_MASK ; + +/* Need to reset PHY -> 500ms reset */ +writel (AT91_RSTC_KEY |AT91_RSTC_MR_ERSTL (0x0D ) | +AT91_RSTC_MR_URSTEN , &rstc->mr); +writel (AT91_RSTC_KEY |AT91_RSTC_CR_EXTRST , &rstc->cr); + +/* Wait for end hardware reset */ +while (!(readl (&rstc->sr) &AT91_RSTC_SR_NRSTL )); + +/* Restore NRST value */ +writel (AT91_RSTC_KEY | erstl |AT91_RSTC_MR_URSTEN , &rstc->mr); +/* Re-enable pull-up */ at91_set_pio_pullup (AT91_PIO_PORTA ,15 ,1 );at91_set_pio_pullup (AT91_PIO_PORTA ,12 ,1 );
include/configs/pm9g45.h +5 -0
@@ -125,6 +125,11 @@#define CONFIG_NET_MULTI 1#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_RESET_PHY_R 1 +#define CONFIG_MACB_SEARCH_PHY +#define CONFIG_CMD_MII +#define CONFIG_OVERWRITE_ETHADDR_ONCE +/* MAC is Organizationally Unique Identifier + 3 octects user numbers */ +#define CONFIG_ETHADDR "02:00:00:fe:ed:00"/* USB */ #define CONFIG_USB_ATMEL
Signature · 1 line
1.5.5.6
PATCH 1/1 pm9g45_v1.3: make ethernet works
Hello,
Asen Dimov with Message-Id:
Quoted 46 lines · <[email protected]> wrote:
Signed-off-by Asen Dimov <[email protected]>--- board/ronetix/pm9g45/pm9g45.c | 15 +++++++++++++++ include/configs/pm9g45.h | 5 +++++ 2 files changed, 20 insertions(+), 0 deletions(-)board/ronetix/pm9g45/pm9g45.c +15
-0@@ -96,6 +96,8 @@ static void pm9g45_nand_hw_init(void)static void pm9g45_macb_hw_init (void ) {at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE ; +at91_rstc_t *rstc = (at91_rstc_t *)AT91_RSTC_BASE ; +unsigned long erstl;/* * PD2 enables the 50MHz oscillator for Ethernet PHY @@ -120,6 +122,19 @@ static void pm9g45_macb_hw_init(void)at91_set_pio_pullup (AT91_PIO_PORTA ,12 ,0 );at91_set_pio_pullup (AT91_PIO_PORTA ,13 ,0 ); + erstl =readl (&rstc->mr) &AT91_RSTC_MR_ERSTL_MASK ; + +/* Need to reset PHY -> 500ms reset */ +writel (AT91_RSTC_KEY |AT91_RSTC_MR_ERSTL (0x0D ) | +AT91_RSTC_MR_URSTEN , &rstc->mr); +writel (AT91_RSTC_KEY |AT91_RSTC_CR_EXTRST , &rstc->cr); + +/* Wait for end hardware reset */ +while (!(readl (&rstc->sr) &AT91_RSTC_SR_NRSTL )); + +/* Restore NRST value */ +writel (AT91_RSTC_KEY | erstl |AT91_RSTC_MR_URSTEN , &rstc->mr); +/* Re-enable pull-up */ at91_set_pio_pullup (AT91_PIO_PORTA ,15 ,1 );at91_set_pio_pullup (AT91_PIO_PORTA ,12 ,1 );include/configs/pm9g45.h +0
-0@@ -125,6 +125,11 @@#define CONFIG_NET_MULTI 1
include/configs/pm9g45.h line 135
Quoted 10 lines
include/configs/pm9g45.h +5
-0#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_RESET_PHY_R 1 +#define CONFIG_MACB_SEARCH_PHY +#define CONFIG_CMD_MII +#define CONFIG_OVERWRITE_ETHADDR_ONCE +/* MAC is Organizationally Unique Identifier + 3 octects user numbers */ +#define CONFIG_ETHADDR "02:00:00:fe:ed:00"/* USB */ #define CONFIG_USB_ATMEL
is this fix lost or there is something wrong with it?
Regards,
Asen
PATCH 1/1 pm9g45_v1.3: make ethernet works
In reply to Asen DimovDear Asen Dimov,
sorry for the late reply.
This patch needs to be rebased on top of u-boot-atmel/next,
also please observe the following comments:
Quoted 11 lines
Signed-off-by Asen Dimov <[email protected]>--- board/ronetix/pm9g45/pm9g45.c | 15 +++++++++++++++ include/configs/pm9g45.h | 5 +++++ 2 files changed, 20 insertions(+), 0 deletions(-)board/ronetix/pm9g45/pm9g45.c +0
-0
board/ronetix/pm9g45/pm9g45.c static void pm9g45_nand_hw_init(void) · line 98
Quoted 3 lines
board/ronetix/pm9g45/pm9g45.c +0
-0@@ -96,6 +96,8 @@ static void pm9g45_nand_hw_init(void)static void pm9g45_macb_hw_init (void ) {at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE ;
New name: ATMEL_BASE_PMC
board/ronetix/pm9g45/pm9g45.c static void pm9g45_nand_hw_init(void) · line 99
Quoted 1 line
board/ronetix/pm9g45/pm9g45.c +1
-0+at91_rstc_t *rstc = (at91_rstc_t *)AT91_RSTC_BASE ;
New name: ATMEL_BASE_RSTC
Quoted 29 lines
board/ronetix/pm9g45/pm9g45.c +14
-0+unsigned long erstl;/* * PD2 enables the 50MHz oscillator for Ethernet PHY @@ -120,6 +122,19 @@ static void pm9g45_macb_hw_init(void)at91_set_pio_pullup (AT91_PIO_PORTA ,12 ,0 );at91_set_pio_pullup (AT91_PIO_PORTA ,13 ,0 ); + erstl =readl (&rstc->mr) &AT91_RSTC_MR_ERSTL_MASK ; + +/* Need to reset PHY -> 500ms reset */ +writel (AT91_RSTC_KEY |AT91_RSTC_MR_ERSTL (0x0D ) | +AT91_RSTC_MR_URSTEN , &rstc->mr); +writel (AT91_RSTC_KEY |AT91_RSTC_CR_EXTRST , &rstc->cr); + +/* Wait for end hardware reset */ +while (!(readl (&rstc->sr) &AT91_RSTC_SR_NRSTL )); + +/* Restore NRST value */ +writel (AT91_RSTC_KEY | erstl |AT91_RSTC_MR_URSTEN , &rstc->mr); +/* Re-enable pull-up */ at91_set_pio_pullup (AT91_PIO_PORTA ,15 ,1 );at91_set_pio_pullup (AT91_PIO_PORTA ,12 ,1 );include/configs/pm9g45.h +0
-0
include/configs/pm9g45.h line 125
Quoted 1 line
include/configs/pm9g45.h +0
-0@@ -125,6 +125,11 @@#define CONFIG_NET_MULTI 1
Please no "1" where the define has no numerical significance, e.g. tested by #ifdef
include/configs/pm9g45.h line 127
Quoted 2 lines
include/configs/pm9g45.h +0
-0#define CONFIG_NET_RETRY_COUNT 20#define CONFIG_RESET_PHY_R 1
ditto
include/configs/pm9g45.h line 132
Quoted 5 lines
include/configs/pm9g45.h +5
-0+#define CONFIG_MACB_SEARCH_PHY +#define CONFIG_CMD_MII +#define CONFIG_OVERWRITE_ETHADDR_ONCE +/* MAC is Organizationally Unique Identifier + 3 octects user numbers */ +#define CONFIG_ETHADDR "02:00:00:fe:ed:00"
This is not an official OUI, neither should it be defined as a constant here... However I am not sure what the rules for boards are that apparently lack a storage medium for board-unique MAC adresses...?
Wolfgang?
Quoted 3 lines
include/configs/pm9g45.h +0
-0/* USB */ #define CONFIG_USB_ATMEL