From: Bill Pringlemeir <bpringlemeir@nbsps.com>
To: Stefan Agner <stefan@agner.ch>
Cc: Shawn Guo <shawn.guo@freescale.com>,
linus.walleij@linaro.org, gnurou@gmail.com,
kernel@pengutronix.de, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] pinctrl: imx: add gpio pinmux support for vf610
Date: Thu, 25 Sep 2014 12:43:04 -0400 [thread overview]
Message-ID: <877g0rlkh3.fsf@nbsps.com> (raw)
In-Reply-To: <26008fa68a3eaf5f806a7dc4df48f77e@agner.ch> (Stefan Agner's message of "Thu, 25 Sep 2014 11:36:48 +0200")
On 25 Sep 2014, stefan@agner.ch wrote:
> Am 2014-09-25 11:07, schrieb Shawn Guo:
>> On Thu, Sep 25, 2014 at 09:00:41AM +0200, Stefan Agner wrote:
>>> Am 2014-09-25 04:47, schrieb Shawn Guo:
>>>> On Tue, Sep 23, 2014 at 07:37:54PM +0200, Stefan Agner wrote:
>>>>> Add pinmux support for GPIO for Vybrid (vf610) IOMUX controller.
>>>>> This is needed since direction configuration is not part of the
>>>>> GPIO module in Vybrid.
>>>>>
>>>>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>>>>> ---
[snip]
>>>>> + reg = readl(ipctl->base + pin_reg->mux_reg);
>>>>> + reg &= ~(0x7 << 20);
>>>>> + writel(reg, ipctl->base + pin_reg->mux_reg);
>>>> Isn't this setup redundant at all, since imx_pmx_enable() already
>>>> takes care of setting mux register including GPIO mode?
>>> Yes currently this is redundant, when a pinmux is actually
>>> applied. What is the expected behaviour? Is a explicit pinmux
>>> necessary before we can use GPIO? If not, maybe it would make more
>>> sense to use imx_pmx_enable here to write all pinctrl settings?
>> Okay, as per Documentation/pinctrl.txt, it's required that GPIO and
>> PINCTRL can be used as orthogonal. That said, your code does the
>> right thing. Sorry for the noisy comment.
> I'm happy you came up with this, since its the thing which I'm must
> unsure whether this is right.
> Right now, if you just export a random pin (which has no pinmux
> configured in dt), you get an error since this function fails (mux_reg
> == -1). But I guess we can't avoid it, we need the pinctrl framework
> to have a valid setting before we fiddle around with the pad.
> But now, if there is a pinmux configuration in dt, but its not applied
> (using pinctrl-0 = ...), the export will succeed, however the GPIO
> will not really be usable since no sane pad configuration is not
> applied (input/output buffer disabled, no drive-strength)... So we
> might well just don't change the mux here too.
> IMHO, fully orthogonal is not possible, since on Vybrid those two
> depend on each other. But in order to make it "more orthogonal", we
> maybe should force applying the full configuration in
> imx_pmx_gpio_request_enable (e.g. drive strenght etc), rather then
> only mux the pad to to GPIO...
> What do you think?
The muxing must have been done, that is correct. However, this could be
by a boot loader, by some other API, etc. People maybe concerned about
Linux affecting 'CAN' (or some 'mission critical' pins) muxing for
instance, but want the A5 to handle GPIO.
If somewhere, somehow the pin was muxed properly and the GPIO code still
works, I believe this is a win. I see that this flexibility makes it
more difficult to get something that just works. I think the device
trees take care of this for normal users. It might be appropriate to
add a DT node that sets 'GPIO_CONTROL' and put a note in the DT-GPIO
document, that pinctrl is needed for a normal case or if some external
muxing is used or not needed, then 'control=false' can be set (or
whatever good DT terminology)? Then the 'GPIO_CONTROL' check would be
in the 'vf610_gpio_direction_input()' functions. The 'pinctrl'
functions are currently compiled to stubs if that is configured out.
Then there is 'multi-machine' support with DT and compile time selects
with CONFIG_PINCTRL and I don't think there is a lot of additional code
or confusion?
Fwiw,
Bill Pringlemeir.
next prev parent reply other threads:[~2014-09-25 16:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 17:37 [PATCH v2 0/5] vf610: Add GPIO support Stefan Agner
2014-09-23 17:37 ` [PATCH v2 1/5] pinctrl: imx: detect uninitialized pins Stefan Agner
2014-09-25 2:15 ` Shawn Guo
2014-09-23 17:37 ` [PATCH v2 2/5] pinctrl: imx: add gpio pinmux support for vf610 Stefan Agner
2014-09-25 2:47 ` Shawn Guo
2014-09-25 7:00 ` Stefan Agner
2014-09-25 9:07 ` Shawn Guo
2014-09-25 9:36 ` Stefan Agner
2014-09-25 16:43 ` Bill Pringlemeir [this message]
2014-09-26 10:50 ` Stefan Agner
2014-09-29 15:05 ` Bill Pringlemeir
2014-09-29 17:25 ` Stefan Agner
2014-09-23 17:37 ` [PATCH v2 3/5] gpio: vf610: add gpiolib/IRQ chip driver for Vybrid Stefan Agner
2014-09-25 5:55 ` Shawn Guo
2014-09-25 8:10 ` Stefan Agner
2014-09-23 17:37 ` [PATCH v2 4/5] ARM: dts: vf610: use new GPIO support Stefan Agner
2014-09-23 17:37 ` [PATCH v2 5/5] Documentation: dts: Add bindings for Vybrid GPIO/PORT module Stefan Agner
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=877g0rlkh3.fsf@nbsps.com \
--to=bpringlemeir@nbsps.com \
--cc=gnurou@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shawn.guo@freescale.com \
--cc=stefan@agner.ch \
/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).