diff mbox

[U-Boot,V2] dm: core: device: set pinctrl state for pinctrl device

Message ID 1459948887-31630-1-git-send-email-van.freenix@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Peng Fan April 6, 2016, 1:21 p.m. UTC
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.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

V2:
 To pinctrl node, it is not root node. No need to check dev->parent.

 drivers/core/device.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass April 9, 2016, 4:08 p.m. UTC | #1
On 6 April 2016 at 07:21, Peng Fan <van.freenix@gmail.com> wrote:
> 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.
>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> V2:
>  To pinctrl node, it is not root node. No need to check dev->parent.
>
>  drivers/core/device.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/drivers/core/device.c b/drivers/core/device.c
index cb24a61..636a895 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -332,6 +332,9 @@  int device_probe(struct udevice *dev)
 	if (ret)
 		goto fail_uclass;
 
+	if (device_get_uclass_id(dev) == UCLASS_PINCTRL)
+		pinctrl_select_state(dev, "default");
+
 	return 0;
 fail_uclass:
 	if (device_remove(dev)) {