From: Baruch Siach <baruch@tkos.co.il>
To: David Cohen <david.a.cohen@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, linux-xtensa@linux-xtensa.org
Subject: Re: [PATCH v3] gpio: driver for Xtensa GPIO32
Date: Thu, 12 Dec 2013 20:24:42 +0200 [thread overview]
Message-ID: <20131212182442.GN1217@tarshish> (raw)
In-Reply-To: <20131212181558.GA12555@psi-dev26.jf.intel.com>
Hi David,
On Thu, Dec 12, 2013 at 10:15:58AM -0800, David Cohen wrote:
> On Thu, Dec 12, 2013 at 11:18:41AM +0200, Baruch Siach wrote:
> > GPIO32 is a standard optional extension to the Xtensa architecture core that
> > provides preconfigured output and input ports for intra SoC signaling. The
> > GPIO32 option is implemented as 32bit Tensilica Instruction Extension (TIE)
> > output state called EXPSTATE, and 32bit input wire called IMPWIRE. This
> > driver treats input and output states as two distinct devices.
> >
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> > ---
> > v3:
> > * Use BUG() in xtensa_impwire_set_value() to indicate that it should never
> > be called (Linus Walleij)
> >
> > v2:
> > * Address the comments of Linus Walleij:
> > - Add a few comments
> > - Expand commit log message
> > - Use the BIT() macro for bit offsets
> > - Rewrite CPENABLE handling as static inlines
> > - Use device_initcall()
> >
> > * Depend on !SMP for reason explained in the comments (Marc Gauthier)
> >
> > * Use XCHAL_CP_ID_XTIOP to enable/disable GPIO32 only
> > ---
> > drivers/gpio/Kconfig | 8 +++
> > drivers/gpio/Makefile | 1 +
> > drivers/gpio/gpio-xtensa.c | 163 +++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 172 insertions(+)
> > create mode 100644 drivers/gpio/gpio-xtensa.c
> >
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 0f04444..67f5ce6 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -281,6 +281,14 @@ config GPIO_XILINX
> > help
> > Say yes here to support the Xilinx FPGA GPIO device
> >
> > +config GPIO_XTENSA
> > + bool "Xtensa GPIO32 support"
> > + depends on XTENSA
> > + depends on !SMP
> > + help
> > + Say yes here to support the Xtensa internal GPIO32 IMPWIRE (input)
> > + and EXPSTATE (output) ports
> > +
> > config GPIO_VR41XX
> > tristate "NEC VR4100 series General-purpose I/O Uint support"
> > depends on CPU_VR41XX
> > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> > index 7971e36..23b9c72 100644
> > --- a/drivers/gpio/Makefile
> > +++ b/drivers/gpio/Makefile
> > @@ -95,3 +95,4 @@ obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o
> > obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o
> > obj-$(CONFIG_GPIO_WM8994) += gpio-wm8994.o
> > obj-$(CONFIG_GPIO_XILINX) += gpio-xilinx.o
> > +obj-$(CONFIG_GPIO_XTENSA) += gpio-xtensa.o
> > diff --git a/drivers/gpio/gpio-xtensa.c b/drivers/gpio/gpio-xtensa.c
>
> [snip]
>
> > +static int __init xtensa_gpio_init(void)
> > +{
> > + struct platform_device *pdev;
> > +
> > + pdev = platform_device_register_simple("xtensa-gpio", 0, NULL, 0);
>
> Is it what you really want to do? It means this driver will probe
> regardless it really should or not.
If you have XCHAL_CP_ID_XTIOP defined in your xtensa variant tie.h header,
then this device is available. Otherwise, this driver doesn't even build. If
you don't want the kernel to manage the GPIO32 IO port, then just disable the
driver in the kernel configuration.
Does this sound reasonable enough?
baruch
> > + if (IS_ERR(pdev))
> > + return PTR_ERR(pdev);
> > +
> > + return platform_driver_register(&xtensa_gpio_driver);
> > +}
> > +device_initcall(xtensa_gpio_init);
> > +
> > +MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
> > +MODULE_DESCRIPTION("Xtensa LX4 GPIO32 driver");
> > +MODULE_LICENSE("GPL");
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
next prev parent reply other threads:[~2013-12-12 18:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 9:18 [PATCH v3] gpio: driver for Xtensa GPIO32 Baruch Siach
2013-12-12 13:35 ` Linus Walleij
2013-12-12 18:15 ` David Cohen
2013-12-12 18:24 ` Baruch Siach [this message]
2013-12-12 19:23 ` David Cohen
2013-12-16 5:50 ` Baruch Siach
2013-12-16 6:11 ` [Linux-Xtensa] " Marc Gauthier
2013-12-16 6:40 ` Baruch Siach
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=20131212182442.GN1217@tarshish \
--to=baruch@tkos.co.il \
--cc=david.a.cohen@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.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).