diff mbox

pinctrl: imx1-core populate subdevices

Message ID 1384193987-20740-1-git-send-email-mpa@pengutronix.de
State Accepted, archived
Commit 31d610f19670825a0058b70f44570e9ab21a0011
Headers show

Commit Message

Markus Pargmann Nov. 11, 2013, 6:19 p.m. UTC
Support gpio devicetree subnodes to allow a more detailed DT hardware
description.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---

Hi,

This is an incremental patch for the imx1-core and imx27-pinctrl patches to
support the gpio nodes as iomux subdevices.

Linus, I can resend this integrated into the other two patches if you want.

Regards,

Markus Pargmann


 .../bindings/pinctrl/fsl,imx27-pinctrl.txt         | 22 ++++++++++++++++++++++
 drivers/pinctrl/pinctrl-imx1-core.c                |  7 +++++++
 2 files changed, 29 insertions(+)

Comments

Linus Walleij Nov. 19, 2013, 8:01 p.m. UTC | #1
On Mon, Nov 11, 2013 at 7:19 PM, Markus Pargmann <mpa@pengutronix.de> wrote:

> Support gpio devicetree subnodes to allow a more detailed DT hardware
> description.
>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>

Looks good to me.

Tentatively applied this, the DT people may want to say something
about this.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Ruehl Nov. 27, 2013, 3:33 a.m. UTC | #2
On Wednesday, November 20, 2013 04:01 AM, Linus Walleij wrote:
> On Mon, Nov 11, 2013 at 7:19 PM, Markus Pargmann<mpa@pengutronix.de>  wrote:
>
>> Support gpio devicetree subnodes to allow a more detailed DT hardware
>> description.
>>
>> Signed-off-by: Markus Pargmann<mpa@pengutronix.de>
>
> Looks good to me.
>
> Tentatively applied this, the DT people may want to say something
> about this.
>
> Yours,
> Linus Walleij
> --

Hi,

I tried the new configuration but the kernel oops when probing the
dm9000 caused by insufficient resources more likely the real reason
that somehow the gpio6: triggers a problem


[    0.115718] irq: no irq domain found for 
/soc/aipi@10000000/iomuxc@10015000/gpio@10015500 !
[    0.115768] ------------[ cut here ]------------
[    0.115853] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 
of_device_alloc+0x110/0x15c()
[    0.117824] ---[ end trace 0e10ae727e6e0ab1 ]---
[    0.121236] Failed to request board ext/int gpios
[    0.152712] imx27-pinctrl 10015000.iomuxc: initialized IMX pinctrl driver


iomuxc: iomuxc@10015000 {
         compatible = "fsl,imx27-iomuxc";
         reg = <0x10015000 0x600>;
         #address-cells = <1>;
         #size-cells = <1>;
         ranges;

         gpio1: gpio@10015000 {
              compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
              reg = <0x10015000 0x100>;
              interrupts = <8>;
              gpio-controller;
              #gpio-cells = <2>;
              interrupt-controller;
              #interrupt-cells = <2>;
         };
...
         gpio6: gpio@10015500 {
              compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
              reg = <0x10015500 0x100>;
              interrupts = <8>;
              gpio-controller;
              #gpio-cells = <2>;
              interrupt-controller;
              #interrupt-cells = <2>;
         };
};

Kernel Linux version 3.13.0-rc1-next-20131125-dirty

With kind regards
Chris

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Ruehl Nov. 27, 2013, 5:19 a.m. UTC | #3
On Wednesday, November 27, 2013 11:33 AM, Chris Ruehl wrote:
> On Wednesday, November 20, 2013 04:01 AM, Linus Walleij wrote:
>> On Mon, Nov 11, 2013 at 7:19 PM, Markus Pargmann<mpa@pengutronix.de>
>> wrote:
>>
>>> Support gpio devicetree subnodes to allow a more detailed DT hardware
>>> description.
>>>
>>> Signed-off-by: Markus Pargmann<mpa@pengutronix.de>
>>
>> Looks good to me.
>>
>> Tentatively applied this, the DT people may want to say something
>> about this.
>>
>> Yours,
>> Linus Walleij
>> --
>
> Hi,
>
> I tried the new configuration but the kernel oops when probing the
> dm9000 caused by insufficient resources more likely the real reason
> that somehow the gpio6: triggers a problem
>
>
> [ 0.115718] irq: no irq domain found for
> /soc/aipi@10000000/iomuxc@10015000/gpio@10015500 !
> [ 0.115768] ------------[ cut here ]------------
> [ 0.115853] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171
> of_device_alloc+0x110/0x15c()
> [ 0.117824] ---[ end trace 0e10ae727e6e0ab1 ]---
> [ 0.121236] Failed to request board ext/int gpios
> [ 0.152712] imx27-pinctrl 10015000.iomuxc: initialized IMX pinctrl driver
>
>
> iomuxc: iomuxc@10015000 {
> compatible = "fsl,imx27-iomuxc";
> reg = <0x10015000 0x600>;
> #address-cells = <1>;
> #size-cells = <1>;
> ranges;
>
> gpio1: gpio@10015000 {
> compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
> reg = <0x10015000 0x100>;
> interrupts = <8>;
> gpio-controller;
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> };
> ...
> gpio6: gpio@10015500 {
> compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
> reg = <0x10015500 0x100>;
> interrupts = <8>;
> gpio-controller;
> #gpio-cells = <2>;
> interrupt-controller;
> #interrupt-cells = <2>;
> };
> };
>

More info
board-dts-definition for the dm9000 which trigger the oops

/ {
         model = "GTSYS IR module";
         compatible = "gtsys,mx27gtsir","fsl,imx27";

         memory {
                 reg = <0xa0000000 0x10000000>;
         };

         enet1: ethernet@d4000000 {
                         compatible = "davicom,dm9000";
                         #address-cells = <1>;
                         #size-cells = <1>;
                         reg = <0xd4000000 0x2
                                0xd4000004 0x2>;
                         interrupt-parent = <&gpio6>;
                         interrupts = <18 2>;   /* DM9000IRQ IMX_GPIO_NR(6,18) 2 
= high edge trigger */
                         local-mac-address = [00 00 00 00 00 00];
                         davicom,no-eeprom;
                         status = "okay";
         };


> Kernel Linux version 3.13.0-rc1-next-20131125-dirty
>
> With kind regards
> Chris
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Markus Pargmann Nov. 27, 2013, 7:31 a.m. UTC | #4
Hi,

On Wed, Nov 27, 2013 at 11:33:15AM +0800, Chris Ruehl wrote:
> On Wednesday, November 20, 2013 04:01 AM, Linus Walleij wrote:
> >On Mon, Nov 11, 2013 at 7:19 PM, Markus Pargmann<mpa@pengutronix.de>  wrote:
> >
> >>Support gpio devicetree subnodes to allow a more detailed DT hardware
> >>description.
> >>
> >>Signed-off-by: Markus Pargmann<mpa@pengutronix.de>
> >
> >Looks good to me.
> >
> >Tentatively applied this, the DT people may want to say something
> >about this.
> >
> >Yours,
> >Linus Walleij
> >--
> 
> Hi,
> 
> I tried the new configuration but the kernel oops when probing the
> dm9000 caused by insufficient resources more likely the real reason
> that somehow the gpio6: triggers a problem
> 
> 
> [    0.115718] irq: no irq domain found for
> /soc/aipi@10000000/iomuxc@10015000/gpio@10015500 !
> [    0.115768] ------------[ cut here ]------------
> [    0.115853] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171
> of_device_alloc+0x110/0x15c()
> [    0.117824] ---[ end trace 0e10ae727e6e0ab1 ]---
> [    0.121236] Failed to request board ext/int gpios
> [    0.152712] imx27-pinctrl 10015000.iomuxc: initialized IMX pinctrl driver

The imx27-pinctrl driver seems to be initialized after the irq is
requested. So this issue should be the same as in [1].

Regards,

Markus

[1] [PATCH] of/platform: Fix no irq domain found errors when populating interrupts
http://archive.arm.linux.org.uk/lurker/message/20131123.004335.61d5c21b.en.html

> 
> 
> iomuxc: iomuxc@10015000 {
>         compatible = "fsl,imx27-iomuxc";
>         reg = <0x10015000 0x600>;
>         #address-cells = <1>;
>         #size-cells = <1>;
>         ranges;
> 
>         gpio1: gpio@10015000 {
>              compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
>              reg = <0x10015000 0x100>;
>              interrupts = <8>;
>              gpio-controller;
>              #gpio-cells = <2>;
>              interrupt-controller;
>              #interrupt-cells = <2>;
>         };
> ...
>         gpio6: gpio@10015500 {
>              compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
>              reg = <0x10015500 0x100>;
>              interrupts = <8>;
>              gpio-controller;
>              #gpio-cells = <2>;
>              interrupt-controller;
>              #interrupt-cells = <2>;
>         };
> };
> 
> Kernel Linux version 3.13.0-rc1-next-20131125-dirty
> 
> With kind regards
> Chris
> 
>
Chris Ruehl Nov. 27, 2013, 8:45 a.m. UTC | #5
On Wednesday, November 27, 2013 03:31 PM, Markus Pargmann wrote:
> Hi,
>
> On Wed, Nov 27, 2013 at 11:33:15AM +0800, Chris Ruehl wrote:
>> On Wednesday, November 20, 2013 04:01 AM, Linus Walleij wrote:
>>> On Mon, Nov 11, 2013 at 7:19 PM, Markus Pargmann<mpa@pengutronix.de>   wrote:
>>>
>>>> Support gpio devicetree subnodes to allow a more detailed DT hardware
>>>> description.
>>>>
>>>> Signed-off-by: Markus Pargmann<mpa@pengutronix.de>
>>>
>>> Looks good to me.
>>>
>>> Tentatively applied this, the DT people may want to say something
>>> about this.
>>>
>>> Yours,
>>> Linus Walleij
>>> --
>>
>> Hi,
>>
>> I tried the new configuration but the kernel oops when probing the
>> dm9000 caused by insufficient resources more likely the real reason
>> that somehow the gpio6: triggers a problem
>>
>>
>> [    0.115718] irq: no irq domain found for
>> /soc/aipi@10000000/iomuxc@10015000/gpio@10015500 !
>> [    0.115768] ------------[ cut here ]------------
>> [    0.115853] WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171
>> of_device_alloc+0x110/0x15c()
>> [    0.117824] ---[ end trace 0e10ae727e6e0ab1 ]---
>> [    0.121236] Failed to request board ext/int gpios
>> [    0.152712] imx27-pinctrl 10015000.iomuxc: initialized IMX pinctrl driver
>
> The imx27-pinctrl driver seems to be initialized after the irq is
> requested. So this issue should be the same as in [1].
>
> Regards,
>
> Markus

Markus,

Thank you for point this out!  I patched the Linux-next and
my problems went away. I will test now a bit more..

Cheers
Chris

>
> [1] [PATCH] of/platform: Fix no irq domain found errors when populating interrupts
> http://archive.arm.linux.org.uk/lurker/message/20131123.004335.61d5c21b.en.html
>
>>
>>
>> iomuxc: iomuxc@10015000 {
>>          compatible = "fsl,imx27-iomuxc";
>>          reg =<0x10015000 0x600>;
>>          #address-cells =<1>;
>>          #size-cells =<1>;
>>          ranges;
>>
>>          gpio1: gpio@10015000 {
>>               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
>>               reg =<0x10015000 0x100>;
>>               interrupts =<8>;
>>               gpio-controller;
>>               #gpio-cells =<2>;
>>               interrupt-controller;
>>               #interrupt-cells =<2>;
>>          };
>> ...
>>          gpio6: gpio@10015500 {
>>               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
>>               reg =<0x10015500 0x100>;
>>               interrupts =<8>;
>>               gpio-controller;
>>               #gpio-cells =<2>;
>>               interrupt-controller;
>>               #interrupt-cells =<2>;
>>          };
>> };
>>
>> Kernel Linux version 3.13.0-rc1-next-20131125-dirty
>>
>> With kind regards
>> Chris
>>
>>
>
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt
index 353eca0..d1706ea 100644
--- a/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt
@@ -52,12 +52,25 @@  Required properties for pin configuration node:
   CONFIG can be 0 or 1, meaning Pullup disable/enable.
 
 
+The iomux controller has gpio child nodes which are embedded in the iomux
+control registers. They have to be defined as child nodes of the iomux device
+node. If gpio subnodes are defined "#address-cells", "#size-cells" and "ranges"
+properties for the iomux device node are required.
 
 Example:
 
 iomuxc: iomuxc@10015000 {
 	compatible = "fsl,imx27-iomuxc";
 	reg = <0x10015000 0x600>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges;
+
+	gpio1: gpio@10015000 {
+		...
+	};
+
+	...
 
 	uart {
 		pinctrl_uart1: uart-1 {
@@ -83,6 +96,15 @@  The above example using macros:
 iomuxc: iomuxc@10015000 {
 	compatible = "fsl,imx27-iomuxc";
 	reg = <0x10015000 0x600>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges;
+
+	gpio1: gpio@10015000 {
+		...
+	};
+
+	...
 
 	uart {
 		pinctrl_uart1: uart-1 {
diff --git a/drivers/pinctrl/pinctrl-imx1-core.c b/drivers/pinctrl/pinctrl-imx1-core.c
index 4d5a9e7..2eadba7 100644
--- a/drivers/pinctrl/pinctrl-imx1-core.c
+++ b/drivers/pinctrl/pinctrl-imx1-core.c
@@ -638,6 +638,13 @@  int imx1_pinctrl_core_probe(struct platform_device *pdev,
 		return -EINVAL;
 	}
 
+	ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+	if (ret) {
+		pinctrl_unregister(ipctl->pctl);
+		dev_err(&pdev->dev, "Failed to populate subdevices\n");
+		return ret;
+	}
+
 	dev_info(&pdev->dev, "initialized IMX pinctrl driver\n");
 
 	return 0;