From: Antony Pavlov <antonynpavlov@gmail.com>
To: Florian Vallee <fvallee@eukrea.fr>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] GPIO: add Microchip MCP23017 / MCP23008 GPIO driver
Date: Tue, 15 Dec 2015 21:16:47 +0300 [thread overview]
Message-ID: <20151215211647.172f804369dfefc5b4b0b0d2@gmail.com> (raw)
In-Reply-To: <1450200490-4488-1-git-send-email-fvallee@eukrea.fr>
On Tue, 15 Dec 2015 18:28:10 +0100
Florian Vallee <fvallee@eukrea.fr> wrote:
> This is based on the I2C implementation of the corresponding linux driver
>
> v2:
> - cleanup unused platform_data
> - fix base gpio number handling
>
> Signed-off-by: Florian Vallee <fvallee@eukrea.fr>
> ---
> drivers/gpio/Kconfig | 11 +-
> drivers/gpio/Makefile | 1 +
> drivers/gpio/gpio-mcp23s08.c | 341 +++++++++++++++++++++++++++++++++++++++
> include/platform_data/mcp23s08.h | 4 +
> 4 files changed, 356 insertions(+), 1 deletion(-)
> create mode 100644 drivers/gpio/gpio-mcp23s08.c
> create mode 100644 include/platform_data/mcp23s08.h
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 9cb2261..6428f2b 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -121,6 +121,15 @@ config GPIO_DESIGNWARE
> help
> Say Y or M here to build support for the Synopsys DesignWare APB
> GPIO block.
> -endmenu
>
> +config GPIO_MCP23S08
> + tristate "Microchip MCP23xxx I/O expander"
> + depends on I2C
> + help
> + I2C driver for Microchip MCP23008/MCP23017
> + I/O expanders.
> + This provides a GPIO interface supporting inputs and outputs.
> + The I2C versions of the chips can be used as interrupt-controller.
> +
> +endmenu
> endif
...
> --- /dev/null
> +++ b/drivers/gpio/gpio-mcp23s08.c
> @@ -0,0 +1,341 @@
...
> +struct mcp23s08_driver_data {
> + unsigned ngpio;
> + struct mcp23s08 *mcp[8];
> + struct mcp23s08 chip[];
> +};
> +
> +/*----------------------------------------------------------------------*/
> +
> +#if IS_ENABLED(CONFIG_I2C)
Hmmm.
You already have 'depends on I2C' in your Kconfig.
> +static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device_d *dev,
> + void *data, unsigned addr, unsigned type,
> + struct mcp23s08_platform_data *pdata, int cs)
> +{
> + int status;
> +
> + mcp->data = data;
> + mcp->addr = addr;
> +
> + switch (type) {
> +#if IS_ENABLED(CONFIG_I2C)
Just the same thing happened here.
> + case MCP_TYPE_008:
> + mcp->ops = &mcp23008_ops;
> + mcp->chip.ngpio = 8;
> + break;
> +
> + case MCP_TYPE_017:
> + mcp->ops = &mcp23017_ops;
> + mcp->chip.ngpio = 16;
> + break;
> +#endif /* CONFIG_I2C */
...
> diff --git a/include/platform_data/mcp23s08.h b/include/platform_data/mcp23s08.h
> new file mode 100644
> index 0000000..b5289ab
> --- /dev/null
> +++ b/include/platform_data/mcp23s08.h
> @@ -0,0 +1,4 @@
> +struct mcp23s08_platform_data {
> + /* "base" is the number of the first GPIO. */
> + unsigned base;
> +};
This header file has no guard macro.
However, linux version of this file has no guard macro either.
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-12-15 17:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 17:28 Florian Vallee
2015-12-15 18:16 ` Antony Pavlov [this message]
2015-12-15 19:15 ` Trent Piepho
2015-12-21 11:19 ` Florian Vallée
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=20151215211647.172f804369dfefc5b4b0b0d2@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=fvallee@eukrea.fr \
/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