From: "Raphaël Poggi" <poggi.raph@gmail.com>
To: barebox@lists.infradead.org
Cc: "Raphaël Poggi" <poggi.raph@gmail.com>
Subject: [PATCH] pinctrl: at91: retrieve device id in non dtb probe
Date: Mon, 8 Sep 2014 15:07:57 +0200 [thread overview]
Message-ID: <1410181677-17441-4-git-send-email-poggi.raph@gmail.com> (raw)
In-Reply-To: <1410181677-17441-1-git-send-email-poggi.raph@gmail.com>
We need to retrieve the device id in device tree/non device tree case.
Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com>
---
drivers/pinctrl/pinctrl-at91.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 3dc81c7..d3423d0 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -618,9 +618,14 @@ static int at91_gpio_probe(struct device_d *dev)
struct at91_gpio_chip *at91_gpio;
struct clk *clk;
int ret;
- int alias_idx = of_alias_get_id(dev->device_node, "gpio");
+ int alias_idx;
- BUG_ON(dev->id > MAX_GPIO_BANKS);
+ if (dev->device_node)
+ alias_idx = of_alias_get_id(dev->device_node, "gpio");
+ else
+ alias_idx = dev->id;
+
+ BUG_ON(alias_idx > MAX_GPIO_BANKS);
at91_gpio = &gpio_chip[alias_idx];
@@ -646,7 +651,7 @@ static int at91_gpio_probe(struct device_d *dev)
at91_gpio->chip.ops = &at91_gpio_ops;
at91_gpio->chip.ngpio = MAX_NB_GPIO_PER_BANK;
at91_gpio->chip.dev = dev;
- at91_gpio->chip.base = dev->id * MAX_NB_GPIO_PER_BANK;
+ at91_gpio->chip.base = alias_idx * MAX_NB_GPIO_PER_BANK;
ret = gpiochip_add(&at91_gpio->chip);
if (ret) {
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-09-08 13:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 13:07 [PATCH] mach-at91: declare device tree clock Raphaël Poggi
2014-09-08 13:07 ` [PATCH] pinctrl: at91: add driver data Raphaël Poggi
2014-09-08 13:46 ` Sascha Hauer
2014-09-08 13:07 ` [PATCH] pinctrl: at91: fix the pin_to_controller function Raphaël Poggi
2014-09-08 13:07 ` Raphaël Poggi [this message]
2014-09-08 13:37 ` [PATCH] mach-at91: declare device tree clock Sascha Hauer
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=1410181677-17441-4-git-send-email-poggi.raph@gmail.com \
--to=poggi.raph@gmail.com \
--cc=barebox@lists.infradead.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