From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] [RFC] pinctrl: add a driver for Energy Micro's efm32 SoCs
Date: Fri, 9 Dec 2011 09:53:27 -0800 [thread overview]
Message-ID: <20111209175327.GQ31337@atomide.com> (raw)
In-Reply-To: <20111209172407.GP31337@atomide.com>
* Tony Lindgren <tony@atomide.com> [111209 08:53]:
> * Stephen Warren <swarren@nvidia.com> [111209 08:17]:
> > Dong Aisheng wrote at Friday, December 09, 2011 8:03 AM:
> > ...
> > > I agree that parsing data from device tree increases much effort
> > > because we can not using any help functions like microes in dts file and we have
> > > to construct the structure we need in driver by parsing that data.
> > > And it will increase dtsi file's size a lot when after adding all functions.
> > >
> > > I wonder if we can define that data as a pdata in a .c file and only
> > > get a pointer from dts file. That would make life much easier.
> >
> > You can't get pointers themselves directly from a .dts file, since the
> > .dts file author has no idea what the memory layout (or even which OS)
> > is present on the running system.
> >
> > An alternative is to key off the compatible flag in the device tree,
> > and use that to index a table that points at the various structures you
> > want pointers to.
> >
> > struct of_device_id's .data field, and the function of_match_device()
> > are for exactly that purpose; see the way the Tegra pinctrl driver that
> > I posted uses them for an example of mapping compatible flag to per-
> > SoC initialization function pointers.
>
> For letting a device do it's pingroup in DT, I've played with the
> following:
>
> /* mux func phandle mux func name hw initial flags */
> pins = <&uart3_rx_irrx>, "uart3_rx_irrx", <0xdeadbeef>,
> <&uart3_tx_irtx>, "uart3_tx_irtx", <0xdeadbeef>;
>
> But it seems that doing mixed-property arrays gets nasty as any
> data after a string has a high likelihood of getting misaligned
> since a mixed-property array is a string array with the string
> embedded in it with the registers. That leads into nasty string
> parsing that can be extremely flakey with buggy DT data. So it
> seems that using a string there is only safe as the last element,
> which means we can't use names for multiple pins.
>
> So I've pretty much come to the conclusion that we would have to
> use something like this instead:
>
> /* phandle f hw specific initial flags */
> pins = <&uart3_rx_irrx 0 0xdeadbeef
> &uart3_tx_irtx 0 0xdeadbeef>;
>
> This however has a problem for cases where we may not have a phandle
> in DT for the mux function. For example, let's assume that we'll have
> tens of thousands of lines of mux data for omaps (we already have
> over 6k LOC) and just want to load that from /lib/firmware to avoid
> bloating the kernel. In that case we won't have the phandle for the
> mux function in DT.
>
> It would be _really_nice_ to use DT in the missing phandle case also
> for doing the device to mux function mapping based on a function name
> when no phandle is available.
>
> But so far I have not found a good way of doing both phandle and
> optional name type thing. Anybody got some good ideas for that?
Oh forgot to mention of course what Benoit came up which is reg-names.
That of course is doable with both phandles and pin names:
So optionally either
pins = <&uart3_rx_irrx &uart3_tx_irtx>;
or
pin-names = "uart3_rx_irrx", "uart3_tx_irtx";
and both pins and pin-names could have optional hardware specific
board default flags:
pin-flags = <0xdeadbeef 0xdeadbeef>;
The pin-flags could end up being defines if dtc will at some point
support preprocessing the .dtc files.
> BTW, this same problem applies also to clock framwork where we may
> have multiple sources of clocks to register and map to devices.
Regards,
Tony
next prev parent reply other threads:[~2011-12-09 17:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-08 22:40 [PATCH] [RFC] pinctrl: add a driver for Energy Micro's efm32 SoCs Uwe Kleine-König
2011-12-08 22:55 ` Arnd Bergmann
2011-12-09 9:23 ` Uwe Kleine-König
2011-12-09 13:55 ` Arnd Bergmann
2011-12-09 14:15 ` Uwe Kleine-König
2011-12-08 23:14 ` Stephen Warren
2011-12-09 1:01 ` Shawn Guo
2011-12-09 3:44 ` Stephen Warren
2011-12-09 4:32 ` Shawn Guo
2011-12-09 4:47 ` Stephen Warren
2011-12-09 5:14 ` Shawn Guo
2011-12-09 11:08 ` Sascha Hauer
2011-12-09 13:01 ` Uwe Kleine-König
2011-12-10 0:18 ` Linus Walleij
2011-12-12 14:37 ` Sascha Hauer
2011-12-12 15:29 ` Uwe Kleine-König
2011-12-13 0:41 ` Linus Walleij
2011-12-09 16:53 ` Stephen Warren
2011-12-09 15:03 ` Dong Aisheng
2011-12-09 16:49 ` Stephen Warren
2011-12-09 17:24 ` Tony Lindgren
2011-12-09 17:53 ` Tony Lindgren [this message]
2011-12-10 0:14 ` Stephen Warren
2011-12-11 19:34 ` Tony Lindgren
2011-12-09 9:31 ` Uwe Kleine-König
2011-12-10 0:04 ` Linus Walleij
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=20111209175327.GQ31337@atomide.com \
--to=tony@atomide.com \
--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).