Olof Johansson said the following on 09/24/2009 03:38 AM:
> On Sep 23, 2009, at 7:34 PM, Nishanth Menon wrote:
>
>> Olof Johansson said the following on 09/23/2009 09:43 PM:
>>> On Sep 23, 2009, at 1:39 PM, Tom wrote:
>>>
>>>
>>>> Olof Johansson wrote:
>>>>
>>>>> diff --git a/board/overo/overo.c b/board/overo/overo.c
>>>>> index dd6d286..7d87e52 100644
>>>>> --- a/board/overo/overo.c
>>>>> +++ b/board/overo/overo.c
>>>>>
>>>>> +    writel(GPIO0, &gpio3_base->cleardataout);
>>>>> +    udelay(1);
>>>>> +    writel(GPIO0, &gpio3_base->setdataout);
>>>>>
>>>> Use the omap gpio interface described in README.omap3
>>>>
>>>>
>>>
>>> Seriously, this code is a 1:1 replica from the evm code. Obviously
>>> that code was good enough to merge.
>>>
>>
>> should'nt we be fixing evm code instead of moving similar code in for
>> another platform?
>
> Sure, but you forgot to attach the patch.
>
Silly me.. sorry about that.. as you pointed out, I did indeed forget..
need to catch my flight now, and as i dont own an evm, here is the patch
in attachment if someone would care to try it out..
Regards,
Nishanth Menon
>From 05a504c3f0bf9eb7cf06db5712abe70c907c8240 Mon Sep 17 00:00:00 2001
From: Nishanth Menon <n...@ti.com>
Date: Thu, 24 Sep 2009 04:02:45 +0300
Subject: [PATCH] [RFC] OMAP3:EVM: remove direct gpio hits

ONLY COMPILE TESTED
replace gpio direct access with gpio api calls

Signed-off-by: Nishanth Menon <n...@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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to