linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: Dong Aisheng-B29396 <B29396@freescale.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linus.walleij@stericsson.com" <linus.walleij@stericsson.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"cjb@laptop.org" <cjb@laptop.org>,
	"devicetree-discuss@lists.ozlabs.org" 
	<devicetree-discuss@lists.ozlabs.org>
Subject: RE: [RFC PATCH v3 2/5] pinctrl: add dt binding support for pinmux mappings
Date: Thu, 5 Jan 2012 15:38:06 -0800	[thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF17761F1887@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <7FE21149F4667147B645348EC6057885077F82@039-SN2MPN1-013.039d.mgd.msft.net>

Dong Aisheng-B29396 wrote at Tuesday, December 27, 2011 7:41 AM:
> Stephen Warren wrote at Sunday, December 25, 2011 11:37 AM:
> > Dong Aisheng-B29396 wrote at Thursday, December 22, 2011 1:18 AM:
> > > Stephen Warren wrote at Wednesday, December 21, 2011 8:39 AM:
> > > > Dong Aisheng wrote at Tuesday, December 20, 2011 10:41 AM:
> > > > > This patch provies a common API for driver to use to register
> > > > > pinmux mappings from dts file. It is needed for dt support.
> > > >
> > > > Dong,
> > > >
> > > > Thanks for providing a concrete binding to get discussion started. I
> > > > had intended to do this myself, but got side-tracked on other things.
> > > >
> > > > I'll comment exclusively on the documentation in this patch, since
> > > > any changes there will require the code to be changed.
...
> > > > b) The top-level node ("imx6q-sabreauto-map" below) is not tied to
> > > > any particular piece of hardware (no compatible flag, not reg
> > > > property etc.)
> > >
> > > My original purpose was that it was not a hw device node, it was just
> > > created for containing pin map information and referenced by a phandle
> > > in iomuxc deivce node
> > > like:
> > >
> > > iomuxc@020e0000 {
> > >         compatible = "fsl,imx6q-iomuxc";
> > >         reg = <0x020e0000 0x4000>;
> > >         fsl,pinmux-map = <&pinmux>;
> > > 	  ...
> > > }
> > >
> > > I could also make it as a sub node of iomuxc, but original design is
> > > that sub nodes of Ioxmuc are already representing each pinmux functions.
> > > To avoid conflict, I put the imx6q-sabreauto-map node out of iomuxc
> > > since a phandle (fsl,pinmux-map ) does the same work well.
> >
> > You could have nested sub-nodes, say something like:
> >
> > iomuxc@020e0000 {
> >     compatible = "fsl,imx6q-iomuxc";
> >     reg = <0x020e0000 0x4000>;
> >     fsl,pins {
> >         ... // fsl-specific pin properties
> >     };
> >     fsl,groups {
> >         ... // fsl-specific group properties
> >     };
> >     fsl,functions {
> >         ... // fsl-specific mux function properties
> >     };
> >     pinmux-usage {
> >         // standardized pinmux "table" properties
> >         sd4 { // pin group name
> >             function = "sdio4"; // this function active on it
> >             ...
> >         };
> >         ...
> >     }
> >     ...
> > }
> >
> Yes, I could do that.
> The extra effort is that we have to manually exclude one pinmux-usage
> node in pinmux driver since originally i take the child node count of
> iomuxc as the function count since all child nodes are functions,
> that why I firstly took the mapping node out of iomuxc, in addition
> the old way i used seems to be more brief and clear.
> 
> I tried adding pinmux-usage as a sub node of iomuxc and got two issues:
> Taking imx6q as an example:
>
> iomuxc@020e0000 {
>         uart4 {
>                 func-name = "uart4";
>                 grp-name = "uart4grp";
>                 grp-pins = <107 108>;
>                 num-pins = <2>;
>                 grp-mux = <4 4>;
>                 num-mux = <2>;
>         };
> 
>         sd4 {
>                 func-name = "sd4";
>                 grp-name = "sd4grp";
>                 grp-pins = <170 171 180 181 182 183 184 185 186 187>;
>                 num-pins = <10>;
>                 grp-mux = <0 0 1 1 1 1 1 1 1 1>;
>                 num-mux = <10>;
>         };
> 
>         pinmux-mapping {
>                 uart4 {
>                         function = "uart4";
>                         dev = <&uart4>;
>                 };
> 
>                 usdhc4 {
> /*			    ctrl-dev-name = "20e0000.iomuxc"; */
>                         function = "sd4";
>                         dev = <&usdhc4>;
>                 };
>         };
> };
> 
> If we remove ctrl-dev-name and get it from its parent node in drivers as
> you suggested,
> first, since this work will be done in the common API (pinmux_of_register_mappings
> Requires pass the pinmux mapping node to it for construct the mapping table)
> It will introduce a restriction that all platforms should define this node
> under their pinctrl device node.

This seems reasonable to me; the pinmux controller would be defining the
mux options/... that it's providing to the rest of the DT.

> Second, it seems we cannot get its parent node device or device name in driver
> (can only get node Name which is not sufficient for construct the pin map table
> required by pinctrl core) and current device tree subsystem seems do not support
> get its associated device from a device node.
> We may not be able to construct ctrl-dev-name or ctrl-dev for struct pinmux_map.
> I'm not sure if I missed something, if missed please let me know.
> To support it, we may need to add support for converting device node
> to device. Not sure it's applicable since I still have not tried it.

That functionality is pretty easy to implement; it already exists for
other subsystems that refer to parent/controller/... nodes using phandles.
for example, take a look at the implementation of of_node_to_gpiochip()
in drivers/of/gpio.c, which calls gpiochip_find() with a custom match
function that simply compares the gpio_chip's of_node field. Once you
have the chip, you have the device, and can store that in the constructed
mapping table, or call dev_name() on it. I assume there's something similar
for interrupts.

...
> > > The same question applies to clock and regulator: does each device
> > > need Define its clock and regulator properties?
> >
> > Yes, in those cases I believe each device does contain a phandle to the
> > resources it uses.
>
> I was ever thought putting a phandle of pinmux function in each device,
> Then pinmux mapping table seems not need anymore. Like:
> 
> usdhc4: usdhc@0219c000 { /* uSDHC4 */
>         compatible = "fsl,imx6q-usdhc";
> 	....
>         pinmux = <&pinmux-sd4>;
> };
> 
> iomuxc@020e0000 {
>         pinmux-sd4 : sd4 {
>                 func-name = "sd4";
>                 grp-name = "sd4grp";
>                 grp-pins = <170 171 180 181 182 183 184 185 186 187>;
>                 num-pins = <10>;
>                 grp-mux = <0 0 1 1 1 1 1 1 1 1>;
>                 num-mux = <10>;
>         };
> 
> It is a pure hw point of view to define node.
> And it may need to implement a of_pinmux_get.

> But what about the pin maps without device associated?

Indeed; that's why I'd tend towards defining a table of pinmux usage in
the pinmux node, and having other devices refer to that table.

Still, if the pinmux definitions are in the device nodes, we could simply
make the pinmux controller have such a definition itself too, for the
"system hog" case.

-- 
nvpublic


  parent reply	other threads:[~2012-01-05 23:38 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20 17:40 [RFC PATCH v3 0/5] pinctrl: imx: add pinnmux support Dong Aisheng
2011-12-20 17:40 ` [RFC PATCH v3 1/5] dt: add of_get_child_count helper function Dong Aisheng
2011-12-20 18:35   ` Rob Herring
2011-12-21  2:56     ` Dong Aisheng-B29396
2012-01-01 13:58       ` Linus Walleij
2011-12-20 19:47   ` Marek Vasut
2011-12-21  3:27     ` Dong Aisheng-B29396
2011-12-21  6:05       ` Lothar Waßmann
2011-12-20 23:58   ` Stephen Warren
2011-12-21  3:18     ` Dong Aisheng-B29396
2011-12-20 17:40 ` [RFC PATCH v3 2/5] pinctrl: add dt binding support for pinmux mappings Dong Aisheng
2011-12-20 19:48   ` Marek Vasut
2011-12-21  0:39   ` Stephen Warren
2011-12-22  8:18     ` Dong Aisheng-B29396
2011-12-25  3:37       ` Stephen Warren
2011-12-27 14:41         ` Dong Aisheng-B29396
2011-12-29  2:46           ` Shawn Guo
2012-01-05 13:14             ` Dong Aisheng
2012-01-05 23:45             ` Stephen Warren
2012-01-06  6:21               ` Shawn Guo
2012-01-05 23:38           ` Stephen Warren [this message]
2012-01-06 10:51             ` Dong Aisheng-B29396
2012-01-06 17:23               ` Stephen Warren
2012-01-10  7:02                 ` Dong Aisheng-B29396
2012-01-05 13:47         ` Dong Aisheng
2012-01-06  1:05           ` Stephen Warren
2012-01-06  5:27             ` Shawn Guo
2012-01-06 11:33             ` Dong Aisheng-B29396
2012-01-06 13:14               ` Shawn Guo
2012-01-06 18:03               ` Stephen Warren
2012-01-07 13:54                 ` Shawn Guo
2012-01-08 12:51                   ` Richard Zhao
2012-01-09  1:56                     ` Shawn Guo
2012-01-09  6:18                       ` Simon Glass
2012-01-10 11:30                         ` Dong Aisheng-B29396
2012-01-11 19:19                         ` Stephen Warren
2012-01-11 18:37                       ` Stephen Warren
2012-01-11 23:56                         ` Shawn Guo
2012-01-11 23:59                           ` Stephen Warren
2012-01-12  4:03                             ` Shawn Guo
2012-01-12  7:45                               ` Dong Aisheng-B29396
2012-01-11 18:28                     ` Stephen Warren
2012-01-11 18:17                   ` Stephen Warren
2012-01-12  3:39                     ` Shawn Guo
2012-01-12  7:40                       ` Dong Aisheng-B29396
2012-01-12 20:46                       ` Stephen Warren
2012-01-12 21:10                         ` Stephen Warren
2012-01-13  3:46                         ` Shawn Guo
2012-01-13 18:16                           ` Stephen Warren
2012-01-14  1:22                             ` Shawn Guo
2012-01-14 18:21                               ` Dong Aisheng
2012-01-16 16:08                               ` Linus Walleij
2012-01-17  2:32                                 ` Shawn Guo
2012-01-17 19:50                                 ` Stephen Warren
2012-01-18  2:30                                   ` Shawn Guo
2012-01-19 16:55                                   ` Linus Walleij
2012-01-19 19:30                                     ` Stephen Warren
2012-01-20 17:51                                       ` Linus Walleij
2012-01-10  8:21                 ` Dong Aisheng-B29396
2012-01-10 13:05                   ` Shawn Guo
2012-01-11 19:41                     ` Stephen Warren
2012-01-11 23:01                       ` Shawn Guo
2012-01-11 22:58                         ` Stephen Warren
2012-01-11 20:17                   ` Stephen Warren
2012-01-11 23:21                     ` Shawn Guo
2012-01-12  8:36                     ` Dong Aisheng-B29396
2012-01-12 20:56                       ` Stephen Warren
2012-01-13  3:55                         ` Shawn Guo
2012-01-13  8:07                           ` Dong Aisheng-B29396
2012-01-13 13:35                             ` Shawn Guo
2012-01-13 13:48                               ` Linus Walleij
2012-01-13 14:23                                 ` Shawn Guo
2012-01-13 17:11                     ` Dong Aisheng
2012-01-13 18:33                       ` Stephen Warren
2012-01-14  1:10                         ` Shawn Guo
2012-01-17 19:35                           ` Stephen Warren
2012-01-17 19:48                             ` Rob Herring
2012-01-14 17:58                         ` Dong Aisheng
2012-01-17 19:44                           ` Stephen Warren
2012-01-01 14:07   ` Linus Walleij
2012-01-01 15:22     ` Rob Herring
2012-01-05 13:59     ` Dong Aisheng
2011-12-20 17:40 ` [RFC PATCH v3 3/5] pinctrl: imx: add pinctrl imx driver Dong Aisheng
2011-12-20 19:50   ` Marek Vasut
2011-12-21  3:09     ` Dong Aisheng-B29396
2012-01-01 14:02   ` Linus Walleij
2012-01-08 13:05   ` Richard Zhao
2012-01-09  2:08     ` Shawn Guo
2012-01-09  2:17       ` Richard Zhao
2012-01-09  6:32         ` Shawn Guo
2012-01-10  8:38           ` Richard Zhao
2012-01-10 10:43             ` Linus Walleij
2012-01-10 10:55               ` Dong Aisheng-B29396
2012-01-10 13:51               ` Shawn Guo
2012-01-11  9:28                 ` Linus Walleij
2011-12-20 17:40 ` [RFC PATCH v3 4/5] ARM: imx6q: using pinmux subsystem Dong Aisheng
2011-12-20 17:40 ` [RFC PATCH v3 5/5] mmc: sdhci-esdhc-imx: " Dong Aisheng
2012-01-01 13:54   ` 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=74CDBE0F657A3D45AFBB94109FB122FF17761F1887@HQMAIL01.nvidia.com \
    --to=swarren@nvidia.com \
    --cc=B29396@freescale.com \
    --cc=cjb@laptop.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=s.hauer@pengutronix.de \
    /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).