linux-mips
[Top] [All Lists]

Re: [PATCH] provide functions for gpio configuration

To: Linux-Mips List <linux-mips@linux-mips.org>
Subject: Re: [PATCH] provide functions for gpio configuration
From: Phil Sutter <n0-1@freewrt.org>
Date: Thu, 30 Oct 2008 18:47:15 +0100
In-reply-to: <200810301813.05710.florian@openwrt.org>
Mail-followup-to: Linux-Mips List <linux-mips@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1225310409-4440-1-git-send-email-n0-1@freewrt.org> <200810292107.43818.florian@openwrt.org> <20081029211046.GC17108@nuty> <200810301813.05710.florian@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.11
Hi,

On Thu, Oct 30, 2008 at 06:13:05PM +0100, Florian Fainelli wrote:
> Le Wednesday 29 October 2008 22:10:46 Phil Sutter, vous avez écrit :
> > Yes it does, but that's not part of gpiolib itself. Accessing them needs
> > a combination of gpio_to_chip() and container_of() to be used, which I
> > doubt makes sense on a device with a single, platform gpio chip.
> 
> Yes, that makes it unexportable the way it is done yet. What I suggest is not 
> overriding the struct rb532_gpio_chip with thoses callbacks, but do like you 
> suggested initially.
> 
> > I'm not sure if this is absolutely true. The original CompactFlash
> > driver e.g. clears interrupt level in cf_irq_handler() and sets it in
> > prepare_cf_irq(). The latter function is called more than once.
> 
> This should be moved the IRQ handler, where a specific check for the IRQ 
> being 
> a GPIO one should set the interrupt status and level accordingly.

Sounds reasonable to me. So I'll prepare a patch which:
* removes the function pointers from rb532_gpio_chip
* exports getters and setters for interrupt status and level

The GPIO config and function registers should indeed only be accessed at
bootup, so the corresponding getters/setters will be only locally
accessible in arch/mips/rb532/gpio.c. Doing it this way also prevents
any driver from breaking others, as the complete GPIO configuration will
be done at a single place (i.e., inside gpio.c). IIRC pata-rb532-cf did
use them only at initialisation state and to prevent the described
situation.

I got the pata driver working by the way. I just wanted to get a
solution for the GPIO problem first, as it needs to access interrupt
level and status at least.

Greetings, Phil

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