linux-mips
[Top] [All Lists]

Re: [PATCH][MIPS][1/6]: AR7: core

To: Matteo Croce <technoboy85@gmail.com>
Subject: Re: [PATCH][MIPS][1/6]: AR7: core
From: Florian Lohoff <flo@rfc822.org>
Date: Sat, 29 Mar 2008 11:34:27 +0100
Cc: linux-mips@linux-mips.org, Florian Fainelli <florian@openwrt.org>, Felix Fietkau <nbd@openwrt.org>, Eugene Konev <ejka@imfi.kspu.ru>, Nicolas Thill <nico@openwrt.org>, ralf@linux-mips.org
In-reply-to: <200803121906.25546.technoboy85@gmail.com>
Organization: rfc822 - pure communication
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200803120221.25044.technoboy85@gmail.com> <200803121906.25546.technoboy85@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.13 (2006-08-11)
Hi,

On Wed, Mar 12, 2008 at 07:06:25PM +0100, Matteo Croce wrote:
> 
> Sorry but the linux-mips mailing list can't accept this patch for unknown 
> reasons.
> I'll send a gz file, that will work

i have a plattform AR7VWi which has a High Active reset for the
vlynq_low so the code is not sufficient to get the ACX up and running

+static struct plat_vlynq_data vlynq_low_data = {
+       .ops.on = vlynq_on,
+       .ops.off = vlynq_off,
+       .reset_bit = 20,
+       .gpio_bit = 18,
+};
+
+static struct plat_vlynq_data vlynq_high_data = {
+       .ops.on = vlynq_on,
+       .ops.off = vlynq_off,
+       .reset_bit = 16,
+       .gpio_bit = 19,
+};

The gpio_bit's are okay but they are high active so the generic code:

+static int vlynq_on(struct vlynq_device *dev)
+{
+       int result;
+       struct plat_vlynq_data *pdata = dev->dev.platform_data;
+
+       if ((result = gpio_request(pdata->gpio_bit, "vlynq")))
+               goto out;
+
+       ar7_device_reset(pdata->reset_bit);
+
+       if ((result = ar7_gpio_disable(pdata->gpio_bit)))
+               goto out_enabled;
+
+       if ((result = ar7_gpio_enable(pdata->gpio_bit)))
+               goto out_enabled;
+
+       if ((result = gpio_direction_output(pdata->gpio_bit, 0)))
+               goto out_gpio_enabled;
+
+       mdelay(50);
+
+       gpio_set_value(pdata->gpio_bit, 1);

Is not enough here - gpios might be reverse polarity ... The right thing
to actually reset a device would need a toggle not a static state.

+       mdelay(50);
+
+       return 0;


+static void vlynq_off(struct vlynq_device *dev)
+{
+       struct plat_vlynq_data *pdata = dev->dev.platform_data;
+       ar7_gpio_disable(pdata->gpio_bit);
+       gpio_free(pdata->gpio_bit);
+       ar7_device_disable(pdata->reset_bit);
+}

gpio_disable to gpio_bit will put the gpio to tristate or special function
which will lead to unpredicted results. So gpio_set_value would be needed
and then the same as for vlynq_on applies concerning the reverse polarity.

Flo
-- 
Florian Lohoff                  flo@rfc822.org             +49-171-2280134
        Those who would give up a little freedom to get a little 
          security shall soon have neither - Benjamin Franklin

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>