[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3422ee23-53b5-8d09-2a5e-d700358ab09d@cadence.com>
Date: Thu, 30 Mar 2017 18:26:01 +0100
From: Simon Hatliff <hatliff@...ence.com>
To: Boris Brezillon <boris.brezillon@...e-electrons.com>,
Linus Walleij <linus.walleij@...aro.org>
CC: Alexandre Courbot <gnurou@...il.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
Subject: Re: [PATCH 1/2] gpio: Add a driver for Cadence GPIO controller
Hi Boris, Linus,
On 30/03/17 12:29, Boris Brezillon wrote:
> Hi Linus,
>
> On Thu, 30 Mar 2017 11:03:45 +0200
> Linus Walleij <linus.walleij@...aro.org> wrote:
>
>> On Wed, Mar 29, 2017 at 6:04 PM, Boris Brezillon
>> <boris.brezillon@...e-electrons.com> wrote:
>>
>>> Add a driver for Cadence GPIO controller.
>> IIUC Cadence do a lot of things. Are there variants of this controller?
> I'll let Simon answer that one.
This is a controller that has been around since 2000. It is not
configurable in any way, so there are no variants. Cadence do not offer
any other GPIO controllers as IP.
>>> +static irqreturn_t cdns_gpio_irq_handler(int irq, void *dev)
>>> +{
>>> + struct cdns_gpio_chip *cgpio = dev;
>>> + unsigned long status;
>>> + int hwirq;
>>> +
>>> + /*
>>> + * FIXME: If we have an edge irq that is masked we might lose it
>>> + * since reading the STATUS register clears all IRQ flags.
>>> + * We could store the status of all masked IRQ in the cdns_gpio_chip
>>> + * struct but we then have no way to re-trigger the interrupt when
>>> + * it is unmasked.
>>> + */
>> It is marked FIXME but do you think it can even be fixed? It seems
>> like a hardware flaw. :(
> Maybe not. Unless Simon comes up with a magic register to re-trigger an
> interrupt :-).
There are no plans to update the controller.
> Another solution would be to write 0xffffffff into CDNS_GPIO_OUTPUT_EN
> at probe time so that each time CDNS_GPIO_DIRECTION_MODE is modified to
> set a pin in output mode, the CDNS_GPIO_OUTPUT_EN is already correctly
> configured.
> Simon, would that work? Is there a good reason to keep a bit in
> CDNS_GPIO_OUTPUT_EN set to 0 when the GPIO is in input mode (power
> consumption?)?
If direction_mode is set to input then output_en is ignored so this
should work. The hardware defaults to output mode, so as long as you
set all pins to input mode before you set all output_en bits there
should be no negative effect.
Cheers,
-- Simon
Powered by blists - more mailing lists