From: Ken Xue <Ken.Xue@amd.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH V2] pinctrl: add AMD GPIO driver support.
Date: Tue, 10 Mar 2015 14:43:31 +0800 [thread overview]
Message-ID: <1425969811.14295.8.camel@kxue-X58A-UD3R> (raw)
In-Reply-To: <CACRpkdZiSaMUQxU5HHuMn0kZhdXqAX6OYVQGmoNriP0jamuHPA@mail.gmail.com>
On Mon, 2015-03-09 at 16:02 +0100, Linus Walleij wrote:
> On Wed, Mar 4, 2015 at 7:53 AM, Ken Xue <Ken.Xue@amd.com> wrote:
>
> > From c2258b4b550d8f61a5eb64fee25d4c0fdd3a1e91 Mon Sep 17 00:00:00 2001
> > From: Ken Xue <Ken.Xue@amd.com>
> > Date: Wed, 4 Mar 2015 14:48:36 +0800
> > Subject: [PATCH] pinctrl: add AMD GPIO driver support.
> >
> > KERNCZ GPIO is a new IP from AMD. it can be implemented in both x86 and ARM.
> > Current driver patch only support GPIO in x86.
> >
> > Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> > +#include <linux/io.h>
> > +#include <linux/gpio.h>
>
> Should still be #include <linux/gpio/driver.h>
> isn't it compiling like so?
>
ok. i will change <linux/gpio.h> to <linux/gpio/driver.h>.
And then i shall add <linux/pinctrl/pinctrl.h> for macro PINCTRL_PIN and
add <asm-generic/gpio.h> for "gpiochip_add_pin_range".
> > +static void amd_gpio_irq_mask(struct irq_data *d)
> > +{
> > + u32 pin_reg;
> > + unsigned long flags;
> > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> > + struct amd_gpio *gpio_dev = to_amd_gpio(gc);
> > +
> > + spin_lock_irqsave(&gpio_dev->lock, flags);
> > + pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
> > + pin_reg &= ~(1UL << INTERRUPT_MASK_OFF);
> > + writel(pin_reg, gpio_dev->base + (d->hwirq)*4);
> > + spin_unlock_irqrestore(&gpio_dev->lock, flags);
> > +}
> > +
> > +static void amd_gpio_irq_unmask(struct irq_data *d)
> > +{
> > + u32 pin_reg;
> > + unsigned long flags;
> > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> > + struct amd_gpio *gpio_dev = to_amd_gpio(gc);
> > +
> > + spin_lock_irqsave(&gpio_dev->lock, flags);
> > + pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
> > + pin_reg |= 1UL << INTERRUPT_MASK_OFF;
> > + writel(pin_reg, gpio_dev->base + (d->hwirq)*4);
> > + spin_unlock_irqrestore(&gpio_dev->lock, flags);
> > +}
>
> I don't know if it's necessary to implement both enable/disable
> and mask/unmask. I guess you should only mask in the
> mask() function and only enable in the enable() function then.
AMD GPIO interrupt is masked by default. I want to unmask GPIO interrupt
when irq is enabled. So that, interrupt can work right after driver
request_threaded_irq.
next prev parent reply other threads:[~2015-03-10 7:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 7:49 pinctrl: add AMD GPIO driver support Ken Xue
2015-02-04 13:30 ` Linus Walleij
2015-02-28 1:41 ` Ken Xue
2015-03-27 9:44 ` [Patch] pinctrl: fix warning from static analysis tools for AMD GPIO driver Ken Xue
2015-04-07 9:38 ` Linus Walleij
[not found] ` <1423111885.18208.41.camel@kxue-X58A-UD3R>
2015-03-04 6:53 ` [PATCH V2] pinctrl: add AMD GPIO driver support Ken Xue
2015-03-09 15:02 ` Linus Walleij
2015-03-10 6:43 ` Ken Xue [this message]
2015-03-10 7:02 ` [PATCH V3] " Ken Xue
2015-03-18 0:49 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425969811.14295.8.camel@kxue-X58A-UD3R \
--to=ken.xue@amd.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).