summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/at91sam9260ek
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-05 15:44:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-05 15:53:42 +0100
commit21d3a53a4f7573a15fb719d49771641c5cf0bb34 (patch)
tree50693427a33f85149cf68bd7997a76f9afe6f03d /arch/arm/boards/at91sam9260ek
parent4f9e24935c78c1c13613054e024ea75446dcb4a4 (diff)
downloadbarebox-21d3a53a4f7573a15fb719d49771641c5cf0bb34.tar.gz
barebox-21d3a53a4f7573a15fb719d49771641c5cf0bb34.tar.xz
ARM: at91: consolidate phy reset functions
Many boards have the same ethernet phy reset function, so share the code in a common function. While at it remove the AT91_RSTC offset from the rstc register defines. AT91_RSTC was the offset between the AT91_SYSTEM_BASE and the reset controller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/at91sam9260ek')
-rw-r--r--arch/arm/boards/at91sam9260ek/init.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c
index 5a21ac12fe..de74835d78 100644
--- a/arch/arm/boards/at91sam9260ek/init.c
+++ b/arch/arm/boards/at91sam9260ek/init.c
@@ -125,11 +125,6 @@ static struct macb_platform_data macb_pdata = {
static void at91sam9260ek_phy_reset(void)
{
- unsigned long rstc;
- struct clk *clk = clk_get(NULL, "macb_clk");
-
- clk_enable(clk);
-
at91_set_gpio_input(AT91_PIN_PA14, 0);
at91_set_gpio_input(AT91_PIN_PA15, 0);
at91_set_gpio_input(AT91_PIN_PA17, 0);
@@ -137,21 +132,7 @@ static void at91sam9260ek_phy_reset(void)
at91_set_gpio_input(AT91_PIN_PA26, 0);
at91_set_gpio_input(AT91_PIN_PA28, 0);
- rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
-
- /* Need to reset PHY -> 500ms reset */
- at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
- (AT91_RSTC_ERSTL & (0x0d << 8)) |
- AT91_RSTC_URSTEN);
-
- at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_EXTRST);
-
- /* Wait for end hardware reset */
- while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL))
- ;
-
- /* Restore NRST value */
- at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY | (rstc) | AT91_RSTC_URSTEN);
+ at91sam_phy_reset(IOMEM(AT91SAM9260_BASE_RSTC));
}
/*