From: Stephen Warren <swarren@wwwdotorg.org>
To: Sonic Zhang <sonic.adi@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Grant Likely <grant.likely@linaro.org>,
Steven Miao <realmz6@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
adi-buildroot-devel@lists.sourceforge.net,
Sonic Zhang <sonic.zhang@analog.com>
Subject: Re: [PATCH 1/3 v3] pinctrl: ADI PIN control driver for the GPIO controller on bf54x and bf60x.
Date: Wed, 21 Aug 2013 12:45:45 -0600 [thread overview]
Message-ID: <52150AD9.3040808@wwwdotorg.org> (raw)
In-Reply-To: <1377066607-19061-1-git-send-email-sonic.adi@gmail.com>
On 08/21/2013 12:30 AM, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
>
> The new ADI GPIO2 controller was introduced since the BF548 and BF60x
> processors. It differs a lot from the old one on BF5xx processors. So,
> create a pinctrl driver under the pinctrl framework.
> drivers/pinctrl/Kconfig | 17 +
> drivers/pinctrl/Makefile | 3 +
> drivers/pinctrl/pinctrl-adi2-bf54x.c | 572 +++++++++++
> drivers/pinctrl/pinctrl-adi2-bf60x.c | 454 +++++++++
Those files look reasonable.
> drivers/pinctrl/pinctrl-adi2.c | 1501 ++++++++++++++++++++++++++++
> drivers/pinctrl/pinctrl-adi2.h | 75 ++
> include/linux/platform_data/pinctrl-adi2.h | 40 +
> diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
> +/**
> + * struct gpio_reserve_map - a GPIO map structure containing the
> + * reservation status of each PIN.
> + *
> + * @owner: who request the reservation
> + * @rsv_gpio: if this pin is reserved as GPIO
> + * @rsv_int: if this pin is reserved as interrupt
> + * @rsv_peri: if this pin is reserved as part of a peripheral device
> + */
> +struct gpio_reserve_map {
> + unsigned char owner[RESOURCE_LABEL_SIZE];
> + bool rsv_gpio;
> + bool rsv_int;
> + bool rsv_peri;
> +};
Why is that needed; don't the pinctrl/GPIO cores already know which
pinctrl pins and which GPIOs are used, and for what?
> +#if defined(CONFIG_DEBUG_FS)
> +static inline unsigned short get_gpio_dir(struct gpio_port *port,
> ...
Why aren't the existing GPIO/pinctrl subsystem debugfs files enough?
> +static int adi_pinmux_request(struct pinctrl_dev *pctldev, unsigned pin)
...
> + /* If a pin can be muxed as either GPIO or peripheral, make
> + * sure it is not already a GPIO pin when we request it.
> + */
> + if (port->rsvmap[offset].rsv_gpio) {
> + if (system_state == SYSTEM_BOOTING)
> + dump_stack();
> + dev_err(pctldev->dev,
> + "%s: Peripheral PIN %d is already reserved as GPIO by %s!\n",
> + __func__, pin, get_label(port, offset));
> + spin_unlock_irqrestore(&port->lock, flags);
> + return -EBUSY;
> + }
Yes, this definitely warrants some more explanation. It looks odd. What
is "system_state"?
> +static int adi_gpio_probe(struct platform_device *pdev)
...
> + /* Add gpio pin range */
> + snprintf(pinctrl_devname, RESOURCE_LABEL_SIZE, "pinctrl-adi2.%d",
> + pdata->pinctrl_id);
> + pinctrl_devname[RESOURCE_LABEL_SIZE - 1] = 0;
> + ret = gpiochip_add_pin_range(&port->chip, pinctrl_devname,
> + 0, pdata->port_pin_base, port->width);
This looks like platform data is providing the GPIO <-> pinctrl pin ID
mapping, or at least part of it. Surely that mapping is fixed by the HW
design, and hence isn't something platform data should influence. Do the
files pinctrl-adi2-bf*.c not contain complete information about each HW
configuration for some reason?
> +static struct platform_driver adi_pinctrl_driver = {
> + .probe = adi_pinctrl_probe,
> + .remove = adi_pinctrl_remove,
> + .driver = {
> + .name = DRIVER_NAME,
> + },
> +};
> +
> +static struct platform_driver adi_gpio_pint_driver = {
> + .probe = adi_gpio_pint_probe,
> + .remove = adi_gpio_pint_remove,
> + .driver = {
> + .name = "adi-gpio-pint",
> + },
> +};
> +
> +static struct platform_driver adi_gpio_driver = {
> + .probe = adi_gpio_probe,
> + .remove = adi_gpio_remove,
> + .driver = {
> + .name = "adi-gpio",
> + },
> +};
Hmmm. Is there one HW block that controls GPIOs and pinctrl, or are
there separate HW blocks?
If there's one HW block, why not have just one driver?
If there are separate HW blocks, then having separate GPIO and pinctrl
drivers seems like it would make sense.
next prev parent reply other threads:[~2013-08-21 18:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-21 6:30 [PATCH 1/3 v3] pinctrl: ADI PIN control driver for the GPIO controller on bf54x and bf60x Sonic Zhang
2013-08-21 6:30 ` [PATCH 2/3 v3] blackfin: gpio: Remove none gpio lib code Sonic Zhang
2013-08-21 6:30 ` [PATCH 3/3 v3] blackfin: pinctrl-adi2: Enable PINCTRL framework for BF54x and BF60x Sonic Zhang
2013-08-21 18:45 ` Stephen Warren [this message]
2013-08-22 7:07 ` [PATCH 1/3 v3] pinctrl: ADI PIN control driver for the GPIO controller on bf54x and bf60x Sonic Zhang
2013-08-22 20:48 ` Stephen Warren
2013-08-27 9:30 ` Sonic Zhang
2013-08-27 21:39 ` Stephen Warren
2013-08-28 3:56 ` Sonic Zhang
2013-08-28 14:23 ` Stephen Warren
2013-08-29 9:18 ` Sonic Zhang
2013-08-29 8:19 ` Linus Walleij
2013-08-29 9:36 ` Sonic Zhang
2013-08-30 8:43 ` Linus Walleij
2013-08-29 8:06 ` Linus Walleij
2013-08-29 8:12 ` Linus Walleij
2013-08-29 9:31 ` Sonic Zhang
2013-08-30 8:40 ` Linus Walleij
2013-08-29 8:02 ` Linus Walleij
2013-08-29 9:17 ` Sonic Zhang
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=52150AD9.3040808@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=adi-buildroot-devel@lists.sourceforge.net \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=realmz6@gmail.com \
--cc=sonic.adi@gmail.com \
--cc=sonic.zhang@analog.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