diff options
author | Sriram <srk@ti.com> | 2009-06-18 01:53:03 +0530 |
---|---|---|
committer | Justin Waters <justin.waters@timesys.com> | 2009-10-21 16:46:34 -0400 |
commit | a74b88e542841397d176621d157da3d576a24c2f (patch) | |
tree | 9ddf0456ffcaa877db9332344d4ab4786ee7bce2 /board | |
parent | dce76597be2aa1fc3148d2294d519527a613a786 (diff) |
EMAC driver: Implement GPIO driven PHY reset.
Diffstat (limited to 'board')
-rw-r--r-- | board/omap3/omap3517evm/omap3517evm.c | 33 | ||||
-rw-r--r-- | board/omap3/omap3517evm/omap3517evm.h | 6 |
2 files changed, 36 insertions, 3 deletions
diff --git a/board/omap3/omap3517evm/omap3517evm.c b/board/omap3/omap3517evm/omap3517evm.c index bf304e33e3f..0f8dc744aee 100644 --- a/board/omap3/omap3517evm/omap3517evm.c +++ b/board/omap3/omap3517evm/omap3517evm.c @@ -65,7 +65,8 @@ int misc_init_r(void) #endif #if defined(CONFIG_CMD_NET) - //setup_net_chip(); + /* Drive the PHY reset thru GPIO 30 */ + setup_net_chip(); if (!eth_hw_init()) { printf("error:Ethernet init failed\n"); } @@ -95,6 +96,7 @@ void set_muxconf_regs(void) *****************************************************************************/ static void setup_net_chip(void) { + #if 0 gpio_t *gpio3_base = (gpio_t *)OMAP34XX_GPIO3_BASE; gpmc_csx_t *gpmc_cs6_base = (gpmc_csx_t *)GPMC_CONFIG_CS6_BASE; ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE; @@ -125,4 +127,33 @@ static void setup_net_chip(void) writel(GPIO0, &gpio3_base->cleardataout); udelay(1); writel(GPIO0, &gpio3_base->setdataout); + #else + volatile unsigned int ctr; + + gpio_t *gpio1_base = (gpio_t *)OMAP34XX_GPIO1_BASE; + ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE; + + + /* Make GPIO 30 as output pin */ + writel(readl(&gpio1_base->oe) & ~(GPIO30), &gpio1_base->oe); + + /* Now send a pulse on the GPIO pin */ + printf("Driving GPIO 30 low \n"); + writel(GPIO30, &gpio1_base->cleardataout); + ctr = 0; + do{ + udelay(1000); + ctr++; + }while (ctr <300); + + printf("Driving GPIO 30 high \n"); + writel(GPIO30, &gpio1_base->setdataout); + ctr =0; + /* allow the PHY to stabilize and settle down */ + do{ + udelay(1000); + ctr++; + }while (ctr <300); + + #endif } diff --git a/board/omap3/omap3517evm/omap3517evm.h b/board/omap3/omap3517evm/omap3517evm.h index 65276b8b9bf..074d4ffd451 100644 --- a/board/omap3/omap3517evm/omap3517evm.h +++ b/board/omap3/omap3517evm/omap3517evm.h @@ -287,6 +287,8 @@ static void setup_net_chip(void); MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)) /*SYS_32K*/\ MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)) /*SYS_CLKREQ*/\ MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)) /*SYS_nIRQ*/\ + MUX_VAL(CP(SYS_NRESWARM), (IDIS | PTU | DIS | M4)) /*SYS_nRESWARM */\ + /* GPIO 30 */\ MUX_VAL(CP(SYS_BOOT0), (IEN | PTD | DIS | M4)) /*GPIO_2*/\ /* - PEN_IRQ */\ MUX_VAL(CP(SYS_BOOT1), (IEN | PTD | DIS | M4)) /*GPIO_3 */\ @@ -337,8 +339,8 @@ static void setup_net_chip(void); MUX_VAL(CP(CCDC_DATA5), (IEN | PTD | EN | M0)) /*ccdc_data5*/\ MUX_VAL(CP(CCDC_DATA6), (IEN | PTD | EN | M0)) /*ccdc_data6*/\ MUX_VAL(CP(CCDC_DATA7), (IEN | PTD | EN | M0)) /*ccdc_data7*/\ - MUX_VAL(CP(RMII_MDIO_DATA), (PTD | M0)) /*rmii_mdio_data*/\ - MUX_VAL(CP(RMII_MDIO_CLK), (PTD | M0)) /*rmii_mdio_clk*/\ + MUX_VAL(CP(RMII_MDIO_DATA), (IEN | M0)) /*rmii_mdio_data*/\ + MUX_VAL(CP(RMII_MDIO_CLK), (M0)) /*rmii_mdio_clk*/\ MUX_VAL(CP(RMII_RXD0) , (IEN | PTD | M0)) /*rmii_rxd0*/\ MUX_VAL(CP(RMII_RXD1), (IEN | PTD | M0)) /*rmii_rxd1*/\ MUX_VAL(CP(RMII_CRS_DV), (IEN | PTD | M0)) /*rmii_crs_dv*/\ |