[PATCH] [RFC] OMAP3:EVM: remove direct gpio hits

Nishanth Menon nm at ti.com
Thu Sep 24 03:02:45 CEST 2009


ONLY COMPILE TESTED
replace gpio direct access with gpio api calls

Signed-off-by: Nishanth Menon <nm at ti.com>
---
 board/ti/evm/evm.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 0718a08..f0ebaad 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -35,6 +35,7 @@
 #include <asm/arch/sys_proto.h>
 #include <i2c.h>
 #include <asm/mach-types.h>
+#include <asm/arch/gpio.h>
 #include "evm.h"
 
 /*
@@ -92,7 +93,6 @@ void set_muxconf_regs(void)
  */
 static void setup_net_chip(void)
 {
-	struct gpio *gpio3_base = (struct gpio *)OMAP34XX_GPIO3_BASE;
 	struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
 
 	/* Configure GPMC registers */
@@ -112,15 +112,15 @@ static void setup_net_chip(void)
 	writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
 		&ctrl_base->gpmc_nadv_ale);
 
-	/* Make GPIO 64 as output pin */
-	writel(readl(&gpio3_base->oe) & ~(GPIO0), &gpio3_base->oe);
-
-	/* Now send a pulse on the GPIO pin */
-	writel(GPIO0, &gpio3_base->setdataout);
-	udelay(1);
-	writel(GPIO0, &gpio3_base->cleardataout);
-	udelay(1);
-	writel(GPIO0, &gpio3_base->setdataout);
+	/* Make GPIO 64 as output pin and send a magic pulse through it */
+	if (!omap_request_gpio(64)) {
+		omap_set_gpio_direction(64, 0);
+		omap_set_gpio_dataout(64, 1);
+		udelay(1);
+		omap_set_gpio_dataout(64, 0);
+		udelay(1);
+		omap_set_gpio_dataout(64, 1);
+	}
 }
 
 int board_eth_init(bd_t *bis)
-- 
1.6.0.4


--------------070100000504080108000804--


More information about the U-Boot mailing list