2014-11-04 13:07:37

by Stefan Agner

[permalink] [raw]
Subject: [PATCH 0/3] ARM: dts: vf610: USB/GPIO fixes

Hi Shawn,

This patchset collects some vf610 device tree fixes. The first patch
was part of the "vf610: Add GPIO support" patchset. GPIO support is
merged by know, so I rebased that on top of your for-next branch.

The second patch is a USB fix I uncovered while testing the 3rd patch,
which adds regulators, mainly for proper USB VBUS support, as we have
them on our carrier boards.

Stefan Agner (3):
ARM: dts: vf610: use new GPIO support
ARM: dts: vf610: enable USB misc/phy nodes where necessary
ARM: dts: vf-colibri: add USB regulators

arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 45 ++++++++++++++++++++++++++++++-
arch/arm/boot/dts/vf-colibri.dtsi | 37 +++++++++++++++++++++++++
arch/arm/boot/dts/vf610-twr.dts | 9 +++++++
arch/arm/boot/dts/vfxxx.dtsi | 1 +
4 files changed, 91 insertions(+), 1 deletion(-)

--
2.1.3


2014-11-04 13:07:32

by Stefan Agner

[permalink] [raw]
Subject: [PATCH 1/3] ARM: dts: vf610: use new GPIO support

Use GPIO support by adding SD card detection configuration and
GPIO pinmux for Colibri's standard GPIO pins. Attach the GPIO
pins to the iomuxc node to get the GPIO pin settings applied.

Signed-off-by: Stefan Agner <[email protected]>
Acked-by: Linus Walleij <[email protected]>
---
arch/arm/boot/dts/vf-colibri.dtsi | 9 +++++++++
arch/arm/boot/dts/vf610-twr.dts | 1 +
arch/arm/boot/dts/vfxxx.dtsi | 1 +
3 files changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
index ab40367..ab9616d7 100644
--- a/arch/arm/boot/dts/vf-colibri.dtsi
+++ b/arch/arm/boot/dts/vf-colibri.dtsi
@@ -31,6 +31,7 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_esdhc1>;
bus-width = <4>;
+ cd-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
};

&fec1 {
@@ -76,6 +77,14 @@

&iomuxc {
vf610-colibri {
+ pinctrl_gpio_ext: gpio_ext {
+ fsl,pins = <
+ VF610_PAD_PTD10__GPIO_89 0x22ed /* EXT_IO_0 */
+ VF610_PAD_PTD9__GPIO_88 0x22ed /* EXT_IO_1 */
+ VF610_PAD_PTD26__GPIO_68 0x22ed /* EXT_IO_2 */
+ >;
+ };
+
pinctrl_esdhc1: esdhc1grp {
fsl,pins = <
VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index ebc906b..793a376 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -123,6 +123,7 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_esdhc1>;
bus-width = <4>;
+ cd-gpios = <&gpio5 6 GPIO_ACTIVE_LOW>;
status = "okay";
};

diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index 4e70833..505969a 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -10,6 +10,7 @@
#include "vf610-pinfunc.h"
#include <dt-bindings/clock/vf610-clock.h>
#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>

/ {
aliases {
--
2.1.3

2014-11-04 13:07:29

by Stefan Agner

[permalink] [raw]
Subject: [PATCH 2/3] ARM: dts: vf610: enable USB misc/phy nodes where necessary

Since restructuring of the device tree files, the USB misc/phy
nodes are disabled by default. Hence we need to enable those
explicitly when USB is used.

Signed-off-by: Stefan Agner <[email protected]>
---
arch/arm/boot/dts/vf-colibri.dtsi | 16 ++++++++++++++++
arch/arm/boot/dts/vf610-twr.dts | 8 ++++++++
2 files changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
index ab9616d7..2371760 100644
--- a/arch/arm/boot/dts/vf-colibri.dtsi
+++ b/arch/arm/boot/dts/vf-colibri.dtsi
@@ -75,6 +75,22 @@
status = "okay";
};

+&usbmisc0 {
+ status = "okay";
+};
+
+&usbmisc1 {
+ status = "okay";
+};
+
+&usbphy0 {
+ status = "okay";
+};
+
+&usbphy1 {
+ status = "okay";
+};
+
&iomuxc {
vf610-colibri {
pinctrl_gpio_ext: gpio_ext {
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index 793a376..a0f7621 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -294,6 +294,14 @@
status = "okay";
};

+&usbmisc0 {
+ status = "okay";
+};
+
+&usbmisc1 {
+ status = "okay";
+};
+
&usbphy0 {
status = "okay";
};
--
2.1.3

2014-11-04 13:07:34

by Stefan Agner

[permalink] [raw]
Subject: [PATCH 3/3] ARM: dts: vf-colibri: add USB regulators

Add structure of USB supply logic. Especially, the USB hosts power
enable regulator is needed to control VBUS supply.

Signed-off-by: Stefan Agner <[email protected]>
---
arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 45 ++++++++++++++++++++++++++++++-
arch/arm/boot/dts/vf-colibri.dtsi | 12 +++++++++
2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
index 80e8fbc..eb4ca50 100644
--- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
@@ -11,6 +11,41 @@
chosen {
bootargs = "console=ttyLP0,115200";
};
+
+ regulators {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ sys_5v0_reg: regulator@1 {
+ compatible = "regulator-fixed";
+ reg = <1>;
+ regulator-name = "5v0";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ };
+
+ usbc_vbus_reg: regulator@2 {
+ compatible = "regulator-fixed";
+ reg = <2>;
+ regulator-name = "usbc_vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&sys_5v0_reg>;
+ };
+
+ /* USBH_PEN */
+ usbh_vbus_reg: regulator@3 {
+ compatible = "regulator-fixed";
+ reg = <3>;
+ regulator-name = "usbh_vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ gpio = <&gpio3 19 GPIO_ACTIVE_LOW>;
+ vin-supply = <&sys_5v0_reg>;
+ };
+ };
};

&bl {
@@ -51,4 +86,12 @@

&uart2 {
status = "okay";
-};
\ No newline at end of file
+};
+
+&usbdev0 {
+ vbus-supply = <&usbc_vbus_reg>;
+};
+
+&usbh1 {
+ vbus-supply = <&usbh_vbus_reg>;
+};
diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
index 2371760..79ccfe2 100644
--- a/arch/arm/boot/dts/vf-colibri.dtsi
+++ b/arch/arm/boot/dts/vf-colibri.dtsi
@@ -163,5 +163,17 @@
VF610_PAD_PTD3__UART2_CTS 0x21a1
>;
};
+
+ pinctrl_usbh1_ext: gpio_usb_vbus {
+ fsl,pins = <
+ VF610_PAD_PTD4__GPIO_83 0x22ed
+ >;
+ };
+
+ pinctrl_usbdev0_ext: gpio_usb_cdet {
+ fsl,pins = <
+ VF610_PAD_PTC29__GPIO_102 0x22ed
+ >;
+ };
};
};
--
2.1.3

2014-11-11 14:12:50

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 3/3] ARM: dts: vf-colibri: add USB regulators

On Tue, Nov 04, 2014 at 02:07:10PM +0100, Stefan Agner wrote:
> Add structure of USB supply logic. Especially, the USB hosts power
> enable regulator is needed to control VBUS supply.
>
> Signed-off-by: Stefan Agner <[email protected]>
> ---
> arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 45 ++++++++++++++++++++++++++++++-
> arch/arm/boot/dts/vf-colibri.dtsi | 12 +++++++++
> 2 files changed, 56 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
> index 80e8fbc..eb4ca50 100644
> --- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
> +++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
> @@ -11,6 +11,41 @@
> chosen {
> bootargs = "console=ttyLP0,115200";
> };
> +
> + regulators {
> + compatible = "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + sys_5v0_reg: regulator@1 {
> + compatible = "regulator-fixed";
> + reg = <1>;

The numbering generally starts from 0 instead of 1.

> + regulator-name = "5v0";
> + regulator-min-microvolt = <5000000>;
> + regulator-max-microvolt = <5000000>;
> + regulator-always-on;
> + };
> +
> + usbc_vbus_reg: regulator@2 {
> + compatible = "regulator-fixed";
> + reg = <2>;
> + regulator-name = "usbc_vbus";
> + regulator-min-microvolt = <5000000>;
> + regulator-max-microvolt = <5000000>;
> + vin-supply = <&sys_5v0_reg>;
> + };
> +
> + /* USBH_PEN */
> + usbh_vbus_reg: regulator@3 {
> + compatible = "regulator-fixed";
> + reg = <3>;
> + regulator-name = "usbh_vbus";
> + regulator-min-microvolt = <5000000>;
> + regulator-max-microvolt = <5000000>;
> + gpio = <&gpio3 19 GPIO_ACTIVE_LOW>;
> + vin-supply = <&sys_5v0_reg>;
> + };
> + };
> };
>
> &bl {
> @@ -51,4 +86,12 @@
>
> &uart2 {
> status = "okay";
> -};
> \ No newline at end of file
> +};
> +
> +&usbdev0 {
> + vbus-supply = <&usbc_vbus_reg>;
> +};
> +
> +&usbh1 {
> + vbus-supply = <&usbh_vbus_reg>;
> +};
> diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
> index 2371760..79ccfe2 100644
> --- a/arch/arm/boot/dts/vf-colibri.dtsi
> +++ b/arch/arm/boot/dts/vf-colibri.dtsi
> @@ -163,5 +163,17 @@
> VF610_PAD_PTD3__UART2_CTS 0x21a1
> >;
> };
> +
> + pinctrl_usbh1_ext: gpio_usb_vbus {
> + fsl,pins = <
> + VF610_PAD_PTD4__GPIO_83 0x22ed

We used to know the GPIO usage by looking for the phandle reference to
the node. But it doesn't work for VF610 case now.

I guess this is for usbh_vbus_reg usage? It would be nice to have a
comment telling the usage of the GPIO.

> + >;
> + };
> +
> + pinctrl_usbdev0_ext: gpio_usb_cdet {
> + fsl,pins = <
> + VF610_PAD_PTC29__GPIO_102 0x22ed

How is this one used?

Shawn

> + >;
> + };
> };
> };
> --
> 2.1.3
>

2014-11-11 14:14:32

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM: dts: vf610: USB/GPIO fixes

On Tue, Nov 04, 2014 at 02:07:07PM +0100, Stefan Agner wrote:
> Hi Shawn,
>
> This patchset collects some vf610 device tree fixes. The first patch
> was part of the "vf610: Add GPIO support" patchset. GPIO support is
> merged by know, so I rebased that on top of your for-next branch.
>
> The second patch is a USB fix I uncovered while testing the 3rd patch,
> which adds regulators, mainly for proper USB VBUS support, as we have
> them on our carrier boards.
>
> Stefan Agner (3):
> ARM: dts: vf610: use new GPIO support
> ARM: dts: vf610: enable USB misc/phy nodes where necessary

Applied the first two, thanks.

Shawn

> ARM: dts: vf-colibri: add USB regulators
>
> arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 45 ++++++++++++++++++++++++++++++-
> arch/arm/boot/dts/vf-colibri.dtsi | 37 +++++++++++++++++++++++++
> arch/arm/boot/dts/vf610-twr.dts | 9 +++++++
> arch/arm/boot/dts/vfxxx.dtsi | 1 +
> 4 files changed, 91 insertions(+), 1 deletion(-)
>
> --
> 2.1.3
>

2014-11-12 15:50:11

by Stefan Agner

[permalink] [raw]
Subject: Re: [PATCH 3/3] ARM: dts: vf-colibri: add USB regulators

On 2014-11-11 15:12, Shawn Guo wrote:
> On Tue, Nov 04, 2014 at 02:07:10PM +0100, Stefan Agner wrote:
>> Add structure of USB supply logic. Especially, the USB hosts power
>> enable regulator is needed to control VBUS supply.
>>
>> Signed-off-by: Stefan Agner <[email protected]>
>> ---
>> arch/arm/boot/dts/vf-colibri-eval-v3.dtsi | 45 ++++++++++++++++++++++++++++++-
>> arch/arm/boot/dts/vf-colibri.dtsi | 12 +++++++++
>> 2 files changed, 56 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
>> index 80e8fbc..eb4ca50 100644
>> --- a/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
>> +++ b/arch/arm/boot/dts/vf-colibri-eval-v3.dtsi
>> @@ -11,6 +11,41 @@
>> chosen {
>> bootargs = "console=ttyLP0,115200";
>> };
>> +
>> + regulators {
>> + compatible = "simple-bus";
>> + #address-cells = <1>;
>> + #size-cells = <0>;
>> +
>> + sys_5v0_reg: regulator@1 {
>> + compatible = "regulator-fixed";
>> + reg = <1>;
>
> The numbering generally starts from 0 instead of 1.
>
>> + regulator-name = "5v0";
>> + regulator-min-microvolt = <5000000>;
>> + regulator-max-microvolt = <5000000>;
>> + regulator-always-on;
>> + };
>> +
>> + usbc_vbus_reg: regulator@2 {
>> + compatible = "regulator-fixed";
>> + reg = <2>;
>> + regulator-name = "usbc_vbus";
>> + regulator-min-microvolt = <5000000>;
>> + regulator-max-microvolt = <5000000>;
>> + vin-supply = <&sys_5v0_reg>;
>> + };
>> +
>> + /* USBH_PEN */
>> + usbh_vbus_reg: regulator@3 {
>> + compatible = "regulator-fixed";
>> + reg = <3>;
>> + regulator-name = "usbh_vbus";
>> + regulator-min-microvolt = <5000000>;
>> + regulator-max-microvolt = <5000000>;
>> + gpio = <&gpio3 19 GPIO_ACTIVE_LOW>;
>> + vin-supply = <&sys_5v0_reg>;
>> + };
>> + };
>> };
>>
>> &bl {
>> @@ -51,4 +86,12 @@
>>
>> &uart2 {
>> status = "okay";
>> -};
>> \ No newline at end of file
>> +};
>> +
>> +&usbdev0 {
>> + vbus-supply = <&usbc_vbus_reg>;
>> +};
>> +
>> +&usbh1 {
>> + vbus-supply = <&usbh_vbus_reg>;
>> +};
>> diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
>> index 2371760..79ccfe2 100644
>> --- a/arch/arm/boot/dts/vf-colibri.dtsi
>> +++ b/arch/arm/boot/dts/vf-colibri.dtsi
>> @@ -163,5 +163,17 @@
>> VF610_PAD_PTD3__UART2_CTS 0x21a1
>> >;
>> };
>> +
>> + pinctrl_usbh1_ext: gpio_usb_vbus {
>> + fsl,pins = <
>> + VF610_PAD_PTD4__GPIO_83 0x22ed
>
> We used to know the GPIO usage by looking for the phandle reference to
> the node. But it doesn't work for VF610 case now.
>
> I guess this is for usbh_vbus_reg usage? It would be nice to have a
> comment telling the usage of the GPIO.

Yeah its true, its assign is not required for Vybird. However, we could
assign them anyway, it would even enforce correct pin setup from
Startup... This would then make a comment superfluous. What do you
think?


>
>> + >;
>> + };
>> +
>> + pinctrl_usbdev0_ext: gpio_usb_cdet {
>> + fsl,pins = <
>> + VF610_PAD_PTC29__GPIO_102 0x22ed
>
> How is this one used?

This is not yet used. It is more or less the OTG-ID pin, but on 3.3V
level. We use that on the Colibri standard to switch between Host/Device
mode, however a driver which uses that GPIO is still outstanding. I can
also leave that away for now, if you prefer....

--
Stefan

>
> Shawn
>
>> + >;
>> + };
>> };
>> };
>> --
>> 2.1.3
>>

2014-11-13 01:24:15

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH 3/3] ARM: dts: vf-colibri: add USB regulators

On Wed, Nov 12, 2014 at 04:51:16PM +0100, Stefan Agner wrote:
> >> diff --git a/arch/arm/boot/dts/vf-colibri.dtsi b/arch/arm/boot/dts/vf-colibri.dtsi
> >> index 2371760..79ccfe2 100644
> >> --- a/arch/arm/boot/dts/vf-colibri.dtsi
> >> +++ b/arch/arm/boot/dts/vf-colibri.dtsi
> >> @@ -163,5 +163,17 @@
> >> VF610_PAD_PTD3__UART2_CTS 0x21a1
> >> >;
> >> };
> >> +
> >> + pinctrl_usbh1_ext: gpio_usb_vbus {
> >> + fsl,pins = <
> >> + VF610_PAD_PTD4__GPIO_83 0x22ed
> >
> > We used to know the GPIO usage by looking for the phandle reference to
> > the node. But it doesn't work for VF610 case now.
> >
> > I guess this is for usbh_vbus_reg usage? It would be nice to have a
> > comment telling the usage of the GPIO.
>
> Yeah its true, its assign is not required for Vybird. However, we could
> assign them anyway, it would even enforce correct pin setup from
> Startup... This would then make a comment superfluous. What do you
> think?

I agree with the approach of assigning the phandle anyway.

>
>
> >
> >> + >;
> >> + };
> >> +
> >> + pinctrl_usbdev0_ext: gpio_usb_cdet {
> >> + fsl,pins = <
> >> + VF610_PAD_PTC29__GPIO_102 0x22ed
> >
> > How is this one used?
>
> This is not yet used. It is more or less the OTG-ID pin, but on 3.3V
> level. We use that on the Colibri standard to switch between Host/Device
> mode, however a driver which uses that GPIO is still outstanding. I can
> also leave that away for now, if you prefer....

Then let's add it when it's actually required.

Shawn