From: Keerthy <j-keerthy@ti.com>
To: <linus.walleij@linaro.org>
Cc: <linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gnurou@gmail.com>, <grygorii.strashko@ti.com>,
<j-keerthy@ti.com>, <t-kristo@ti.com>
Subject: [PATCH V3 4/5] gpio: davinci: Add support for multiple GPIO controllers
Date: Tue, 17 Jan 2017 21:49:14 +0530 [thread overview]
Message-ID: <1484669955-5349-5-git-send-email-j-keerthy@ti.com> (raw)
In-Reply-To: <1484669955-5349-1-git-send-email-j-keerthy@ti.com>
Update GPIO driver to support Multiple GPIO controllers by updating
the base of subsequent GPIO chips with total of previous chips
gpio count so that gpio_add_chip gets unique numbers.
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/gpio/gpio-davinci.c | 4 +++-
include/linux/platform_data/gpio-davinci.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index a527e88..2a5ae04 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -186,7 +186,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc,
static int davinci_gpio_probe(struct platform_device *pdev)
{
- static int ctrl_num;
+ static int ctrl_num, bank_base;
int gpio, bank;
unsigned ngpio, nbank;
struct davinci_gpio_controller *chips;
@@ -240,6 +240,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
chips->chip.set = davinci_gpio_set;
chips->chip.ngpio = ngpio;
+ chips->chip.base = bank_base;
#ifdef CONFIG_OF_GPIO
chips->chip.of_gpio_n_cells = 2;
@@ -248,6 +249,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
chips->chip.of_node = dev->of_node;
#endif
spin_lock_init(&chips->lock);
+ bank_base += ngpio;
for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++)
chips->regs[bank] = gpio_base + offset_array[bank];
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
index c62a943..90ae19c 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -42,6 +42,7 @@ struct davinci_gpio_controller {
void __iomem *regs[MAX_REGS_BANKS];
int gpio_unbanked;
unsigned int base_irq;
+ unsigned int base;
};
/*
--
1.9.1
next prev parent reply other threads:[~2017-01-17 16:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 16:19 [PATCH V3 0/5] gpio: davinci: Redesign driver to accommodate ngpios in one gpio chip Keerthy
2017-01-17 16:19 ` [PATCH V3 1/5] gpio: davinci: Remove gpio2regs function to accommodate multi instances Keerthy
2017-01-18 23:17 ` Linus Walleij
2017-01-17 16:19 ` [PATCH V3 2/5] gpio: davinci: Remove unwanted blank line Keerthy
2017-01-18 23:18 ` Linus Walleij
2017-01-17 16:19 ` [PATCH V3 3/5] gpio: davinci: Redesign driver to accommodate ngpios in one gpio chip Keerthy
2017-01-17 16:19 ` Keerthy [this message]
2017-01-18 23:23 ` [PATCH V3 4/5] gpio: davinci: Add support for multiple GPIO controllers Linus Walleij
2017-01-17 16:32 ` [PATCH V3 0/5] gpio: davinci: Redesign driver to accommodate ngpios in one gpio chip Keerthy
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=1484669955-5349-5-git-send-email-j-keerthy@ti.com \
--to=j-keerthy@ti.com \
--cc=gnurou@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=t-kristo@ti.com \
/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).