Skip to contentSkip to conversation

dm: core: device: set pinctrl state for pinctrl device

PATCH New Peng Fan 3 participants 4 messages Mar 12, 2016 – Apr 6, 2016

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 dm: core: device: set pinctrl state for pinctrl device

We may have pinmux settings for pinctrl device, like the following example:
"

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_hog_1>;
	imx6ul-evk {
		pinctrl_hog_1: hoggrp-1 {
			fsl,pins = <
				MX6UL_PAD_UART1_RTS_B__GPIO1_IO19	0x17059 /* SD1 CD */
				MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT	0x17059 /* SD1 VSELECT */
				MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059 /* SD1 RESET */
				MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00	0x80000000
			>;
		};
	[......]
};

"

We should not only select pinctrl state for non pinctrl devices, we need also to handle pin mux settings such as pinctrl_log for pinctrl devices.

So at the end of probing process of pinctrl device, select the default state of pinctrl device.

---
 drivers/core/device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/core/device.c +3 -0
index cb24a61..6b1ba22 100644
@@ -332,6 +332,9 @@ int device_probe(struct udevice *dev)
 	if (ret)
 		goto fail_uclass;
 
+	if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL)
+		pinctrl_select_state(dev, "default");
+
 	return 0;
 fail_uclass:
 	if (device_remove(dev)) {
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 dm: core: device: set pinctrl state for pinctrl device

+Masahiro

Quoted 47 lines · Peng Fan

We may have pinmux settings for pinctrl device, like the following example:
"

&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog_1>;
        imx6ul-evk {
                pinctrl_hog_1: hoggrp-1 {
                        fsl,pins = <
                                MX6UL_PAD_UART1_RTS_B__GPIO1_IO19       0x17059 /* SD1 CD */
                                MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT    0x17059 /* SD1 VSELECT */
                                MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059 /* SD1 RESET */
                                MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00      0x80000000
                        >;
                };
        [......]
};

"

We should not only select pinctrl state for non pinctrl devices, we need also to handle pin mux settings such as pinctrl_log for pinctrl devices.

So at the end of probing process of pinctrl device, select the default state of pinctrl device.

---
 drivers/core/device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/core/device.c +3 -1
index cb24a61..6b1ba22 100644
@@ -332,6 +332,9 @@ int device_probe(struct udevice *dev)
        if (ret)
                goto fail_uclass;
 
+       if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL)
+               pinctrl_select_state(dev, "default");
+
        return 0;
 fail_uclass:
        if (device_remove(dev)) {
--
Quoted 2 lines

2.6.2

author
#2 lore raw

PATCH 1/1 dm: core: device: set pinctrl state for pinctrl device

Hi Simon,

Quoted 43 lines · Simon Glass

+Masahiro

Quoted 40 lines · Peng Fan

We may have pinmux settings for pinctrl device, like the following example:
"

&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog_1>;
        imx6ul-evk {
                pinctrl_hog_1: hoggrp-1 {
                        fsl,pins = <
                                MX6UL_PAD_UART1_RTS_B__GPIO1_IO19       0x17059 /* SD1 CD */
                                MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT    0x17059 /* SD1 VSELECT */
                                MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059 /* SD1 RESET */
                                MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00      0x80000000
                        >;
                };
        [......]
};

"

We should not only select pinctrl state for non pinctrl devices, we need also to handle pin mux settings such as pinctrl_log for pinctrl devices.

So at the end of probing process of pinctrl device, select the default state of pinctrl device.

---
 drivers/core/device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/core/device.c +0 -0
index cb24a61..6b1ba22 100644
@@ -332,6 +332,9 @@ int device_probe(struct udevice *dev)
        if (ret)
                goto fail_uclass;
 
Quoted 11 lines
Quoted 9 lines
drivers/core/device.c +3 -1
+       if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL)
+               pinctrl_select_state(dev, "default");
+
        return 0;
 fail_uclass:
        if (device_remove(dev)) {
--

2.6.2

Will you pick up this patch?

Thanks,
Peng.

#3 lore raw

PATCH 1/1 dm: core: device: set pinctrl state for pinctrl device

Hi.

I missed this patch. Sorry for chiming in late.

2016-03-31 14:26 GMT+09:00 Peng Fan <[email protected]>:

Quoted 46 lines

Hi Simon,

Quoted 43 lines · Simon Glass

+Masahiro

Quoted 40 lines · Peng Fan

We may have pinmux settings for pinctrl device, like the following example:
"

&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog_1>;
        imx6ul-evk {
                pinctrl_hog_1: hoggrp-1 {
                        fsl,pins = <
                                MX6UL_PAD_UART1_RTS_B__GPIO1_IO19       0x17059 /* SD1 CD */
                                MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT    0x17059 /* SD1 VSELECT */
                                MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059 /* SD1 RESET */
                                MX6UL_PAD_SNVS_TAMPER0__GPIO5_IO00      0x80000000
                        >;
                };
        [......]
};

"

We should not only select pinctrl state for non pinctrl devices, we need also to handle pin mux settings such as pinctrl_log for pinctrl devices.

So at the end of probing process of pinctrl device, select the default state of pinctrl device.

---
 drivers/core/device.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/core/device.c +0 -0
index cb24a61..6b1ba22 100644
@@ -332,6 +332,9 @@ int device_probe(struct udevice *dev)
        if (ret)
                goto fail_uclass;
 
Quoted 3 lines
Quoted 3 lines

drivers/core/device.c int device_probe(struct udevice *dev) · line 337

Quoted 3 lines
drivers/core/device.c +3 -0
+       if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL)
+               pinctrl_select_state(dev, "default");
+

I think "dev->parent && " is for making sure that it is not the root node, while pinctrl devices never become the root.

Can we simplify the code like follows?

Quoted 3 lines
Quoted 3 lines

drivers/core/device.c int device_probe(struct udevice *dev) · line 337

Quoted 3 lines
drivers/core/device.c +3 -0
+       if (device_get_uclass_id(dev) == UCLASS_PINCTRL)
+               pinctrl_select_state(dev, "default");
+

Otherwise, feel free to add my

Signature · 2 lines
Best Regards
Masahiro Yamada