From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/4] Pinmux subsystem
Date: Wed, 11 May 2011 01:15:12 +0200 [thread overview]
Message-ID: <BANLkTinhDWsZuUdeNObSOmsS2_ES9G3Bww@mail.gmail.com> (raw)
In-Reply-To: <20110510214518.GB5315@n2100.arm.linux.org.uk>
2011/5/10 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Tue, May 10, 2011 at 11:25:44PM +0200, Linus Walleij wrote:
>> It can, basically:
>>
>> struct pinmux *pmx;
>>
>> pmx = pinmux_get(dev, "irda-uart");
>> pinmux_enable(pmx);
>> (... SIR UART operations ...)
>> pinmux_disable(pmx);
>> pinmux_put(pmx);
>> (... stuff to init FIR silicon ...)
>> pmx = pinmux_get(dev, "irda-fir");
>> pinmux_enable(pmx);
>> (... etc ...)
>
> You really don't want to do this. ?It's not that SIR and FIR are that
> exclusive. ?You only switch to FIR mode when you've negotiated in SIR
> mode, and then there's tight timings for doing that. ?Essentially you
> agree in SIR mode to switch to FIR mode, switch to FIR mode and expect
> a response in FIR mode from the remote end.
>
> Calling out to lots of functions to perform the switch is asking for
> that response to be missed because you've not set things up for it.
>
> You'd want to have SIR and FIR mode 'got', and then switch as quickly
> as possible between them.
Sorry I might have got things backwards here, let me see if I got it:
Either the SIR and FIR modes use the exact same pins albeit pushing
in a differnt silicon block to control them without any side-effects.
In that case from the pinmux API point of view there is no conflict,
since there is no competition for using the same pins, the pinmux API
get/put is about resolving such conflicts.
So if we want to use the pinmux_enable()/disable() to quickly poke
some bit to switch between these two, I could think about things like
encoding the pins in the first setting and not encoding any pins at
all in the second one and then they can both be be get/put without
conflicting, and the only possible conflict would be if you tried
to enable both at the same time and this can be handled by the
specific pinmux driver.
Albeit not elegant, it works for this scenario.
A more elegant way is that I supply the same custom configuration
extension mechanism for pinmux as for GPIO, similar to ioctl()
like so:
pmx = pinmux_get(dev, "irda-sir-fir");
pmx_enable(pmx);
/* Unless the first enablement implies SIR mode */
pmx_config(pmx, PINMUX_CONFIG_CUSTOM_SIR, NULL);
(... negotiated ...)
pmx_config(pmx, PINMUX_CONFIG_CUSTOM_FIR, NULL);
(...)
pmx_disable(pmx);
pmx_put(pmx);
I planned to add this interface anyway (needed for pin biasing and
such fun stuff), so I'll poke it in.
The latter would be analog to suppling an enumerated "what" to
the pinmux_enable() function, if it turns out to be an everyday
thing we can think about a more generic extension like
pinmux_enable_selector(struct pinmux *pmx, unsigned selector);
in the API but I feel the above will cut it just as fine.
Yours,
Linus Walleij
next prev parent reply other threads:[~2011-05-10 23:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 19:16 [PATCH 0/4] Pinmux subsystem Linus Walleij
2011-05-02 22:57 ` Russell King - ARM Linux
2011-05-10 21:25 ` Linus Walleij
2011-05-10 21:45 ` Russell King - ARM Linux
2011-05-10 23:15 ` Linus Walleij [this message]
2011-05-03 17:27 ` Andrew Lunn
2011-05-03 19:29 ` Valdis.Kletnieks at vt.edu
2011-05-10 21:42 ` Linus Walleij
2011-05-11 9:50 ` Andrew Lunn
2011-05-12 0:41 ` Linus Walleij
2011-05-12 7:00 ` Andrew Lunn
2011-05-15 13:33 ` Andrew Lunn
2011-05-15 17:50 ` Linus Walleij
2011-05-17 1:57 ` Kyungmin Park
2011-05-18 20:02 ` Linus Walleij
2011-05-18 21:21 ` Mark Brown
2011-05-12 7:44 ` Sascha Hauer
2011-05-12 9:40 ` Tony Lindgren
2011-05-12 14:02 ` Linus Walleij
2011-05-12 21:17 ` Matthieu Castet
2011-05-13 7:05 ` Linus Walleij
2011-05-13 16:03 ` Matthieu CASTET
2011-05-14 7:57 ` Linus Walleij
2011-05-13 9:59 ` 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=BANLkTinhDWsZuUdeNObSOmsS2_ES9G3Bww@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).