* [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY @ 2014-10-27 21:43 Roman Byshko 2014-10-27 21:43 ` [PATCH 1/5] phy: sun4i: add support for USB phy0 Roman Byshko ` (5 more replies) 0 siblings, 6 replies; 14+ messages in thread From: Roman Byshko @ 2014-10-27 21:43 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, devicetree Cc: Kishon Vijay Abraham I, Maxime Ripard, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring Hi, There is already support for two USB phys, which are used for USB host controllers on Allwinner SoC aka sunxi. This patch series add support for the USB OTG phy (aka phy0). The code has been tested on Allwinner A20 aka sun7i (Cubietruck). Best regards, Roman Byshko Roman Byshko (5): phy: sun4i: add support for USB phy0 ARM: dtsi: sunxi: add common VBUS regulator ARM: sun7i: dtsi: add support for usbphy0 ARM: dts: sun7i: Cubietruck: override regulator pin ARM: dts: sun7i: Cubietruck: add power supply regulator for USB OTG VBUS arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 14 ++++++++++++++ arch/arm/boot/dts/sun7i-a20.dtsi | 4 ++-- arch/arm/boot/dts/sunxi-common-regulators.dtsi | 19 +++++++++++++++++++ drivers/phy/phy-sun4i-usb.c | 9 ++++++--- 4 files changed, 41 insertions(+), 5 deletions(-) -- 2.1.2 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/5] phy: sun4i: add support for USB phy0 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko @ 2014-10-27 21:43 ` Roman Byshko [not found] ` <668c1b5541fc0175957573bd5f8d40dd2eaccae1.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-10-27 21:43 ` [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator Roman Byshko ` (4 subsequent siblings) 5 siblings, 1 reply; 14+ messages in thread From: Roman Byshko @ 2014-10-27 21:43 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, devicetree Cc: Kishon Vijay Abraham I, Maxime Ripard, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring The driver for sun4i USB phys currently supports only phy1 and phy2 which are used for USB host controllers. This patch adds support for USB phy0, which is used by the musb hdrc USB controller. --- drivers/phy/phy-sun4i-usb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index 0baf5ef..a24728b 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c @@ -157,6 +157,10 @@ static int sun4i_usb_phy_init(struct phy *_phy) return ret; } + /* Regulation 45 ohms */ + if (phy->index == 0) + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1); + /* Adjust PHY's magnitude and rate */ sun4i_usb_phy_write(phy, PHY_TX_AMPLITUDE_TUNE, 0x14, 5); @@ -213,7 +217,7 @@ static struct phy *sun4i_usb_phy_xlate(struct device *dev, { struct sun4i_usb_phy_data *data = dev_get_drvdata(dev); - if (WARN_ON(args->args[0] == 0 || args->args[0] >= data->num_phys)) + if (args->args[0] >= data->num_phys) return ERR_PTR(-ENODEV); return data->phys[args->args[0]].phy; @@ -255,8 +259,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) if (IS_ERR(data->base)) return PTR_ERR(data->base); - /* Skip 0, 0 is the phy for otg which is not yet supported. */ - for (i = 1; i < data->num_phys; i++) { + for (i = 0; i < data->num_phys; i++) { struct sun4i_usb_phy *phy = data->phys + i; char name[16]; -- 2.1.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
[parent not found: <668c1b5541fc0175957573bd5f8d40dd2eaccae1.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 1/5] phy: sun4i: add support for USB phy0 [not found] ` <668c1b5541fc0175957573bd5f8d40dd2eaccae1.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2014-10-28 21:47 ` Maxime Ripard 2014-10-29 2:24 ` Chen-Yu Tsai 0 siblings, 1 reply; 14+ messages in thread From: Maxime Ripard @ 2014-10-28 21:47 UTC (permalink / raw) To: Roman Byshko Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, Kishon Vijay Abraham I, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring [-- Attachment #1: Type: text/plain, Size: 1136 bytes --] Hi Roman, Thanks for your patches On Mon, Oct 27, 2014 at 10:43:01PM +0100, Roman Byshko wrote: > The driver for sun4i USB phys currently supports > only phy1 and phy2 which are used for USB host > controllers. This patch adds support for USB phy0, > which is used by the musb hdrc USB controller. Like Andreas already pointed out, your signed-off-by is missing from all your patches. > --- > drivers/phy/phy-sun4i-usb.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c > index 0baf5ef..a24728b 100644 > --- a/drivers/phy/phy-sun4i-usb.c > +++ b/drivers/phy/phy-sun4i-usb.c > @@ -157,6 +157,10 @@ static int sun4i_usb_phy_init(struct phy *_phy) > return ret; > } > > + /* Regulation 45 ohms */ > + if (phy->index == 0) > + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1); What is this code supposed to do? Some define for this bit and/or a better comment would be nice. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/5] phy: sun4i: add support for USB phy0 2014-10-28 21:47 ` Maxime Ripard @ 2014-10-29 2:24 ` Chen-Yu Tsai 2014-10-29 13:46 ` Roman Byshko 2014-10-30 16:40 ` Maxime Ripard 0 siblings, 2 replies; 14+ messages in thread From: Chen-Yu Tsai @ 2014-10-29 2:24 UTC (permalink / raw) To: Maxime Ripard Cc: Roman Byshko, Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell, linux-kernel, Kishon Vijay Abraham I, Rob Herring, Kumar Gala, linux-arm-kernel On Wed, Oct 29, 2014 at 5:47 AM, Maxime Ripard <maxime.ripard@free-electrons.com> wrote: > Hi Roman, > > Thanks for your patches > > On Mon, Oct 27, 2014 at 10:43:01PM +0100, Roman Byshko wrote: >> The driver for sun4i USB phys currently supports >> only phy1 and phy2 which are used for USB host >> controllers. This patch adds support for USB phy0, >> which is used by the musb hdrc USB controller. > > Like Andreas already pointed out, your signed-off-by is missing from > all your patches. > >> --- >> drivers/phy/phy-sun4i-usb.c | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c >> index 0baf5ef..a24728b 100644 >> --- a/drivers/phy/phy-sun4i-usb.c >> +++ b/drivers/phy/phy-sun4i-usb.c >> @@ -157,6 +157,10 @@ static int sun4i_usb_phy_init(struct phy *_phy) >> return ret; >> } >> >> + /* Regulation 45 ohms */ >> + if (phy->index == 0) >> + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1); > > What is this code supposed to do? > > Some define for this bit and/or a better comment would be nice. >From Allwinner's sources: "Enable/Disable USB res45 Calibration" which I think refers to the internal 45 ohm termination resistors for the USB data lines. But I'm not an expert on USB hardware. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/5] phy: sun4i: add support for USB phy0 2014-10-29 2:24 ` Chen-Yu Tsai @ 2014-10-29 13:46 ` Roman Byshko 2014-10-30 16:40 ` Maxime Ripard 1 sibling, 0 replies; 14+ messages in thread From: Roman Byshko @ 2014-10-29 13:46 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Maxime Ripard, Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell, linux-kernel, Kishon Vijay Abraham I, Rob Herring, Kumar Gala, linux-arm-kernel Hi all, sorry for missing Signed-offs, they will be added, of course. >>> + /* Regulation 45 ohms */ >>> + if (phy->index == 0) >>> + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1); >> >> What is this code supposed to do? >> >> Some define for this bit and/or a better comment would be nice. > > From Allwinner's sources: "Enable/Disable USB res45 Calibration" > > which I think refers to the internal 45 ohm termination resistors > for the USB data lines. But I'm not an expert on USB hardware. Same with me. I will however change the comment to make it more informative. Thanks for your review, Roman ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/5] phy: sun4i: add support for USB phy0 2014-10-29 2:24 ` Chen-Yu Tsai 2014-10-29 13:46 ` Roman Byshko @ 2014-10-30 16:40 ` Maxime Ripard 1 sibling, 0 replies; 14+ messages in thread From: Maxime Ripard @ 2014-10-30 16:40 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Roman Byshko, Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell, linux-kernel, Kishon Vijay Abraham I, Rob Herring, Kumar Gala, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 1684 bytes --] Hi, On Wed, Oct 29, 2014 at 10:24:12AM +0800, Chen-Yu Tsai wrote: > On Wed, Oct 29, 2014 at 5:47 AM, Maxime Ripard > <maxime.ripard@free-electrons.com> wrote: > > Hi Roman, > > > > Thanks for your patches > > > > On Mon, Oct 27, 2014 at 10:43:01PM +0100, Roman Byshko wrote: > >> The driver for sun4i USB phys currently supports > >> only phy1 and phy2 which are used for USB host > >> controllers. This patch adds support for USB phy0, > >> which is used by the musb hdrc USB controller. > > > > Like Andreas already pointed out, your signed-off-by is missing from > > all your patches. > > > >> --- > >> drivers/phy/phy-sun4i-usb.c | 9 ++++++--- > >> 1 file changed, 6 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c > >> index 0baf5ef..a24728b 100644 > >> --- a/drivers/phy/phy-sun4i-usb.c > >> +++ b/drivers/phy/phy-sun4i-usb.c > >> @@ -157,6 +157,10 @@ static int sun4i_usb_phy_init(struct phy *_phy) > >> return ret; > >> } > >> > >> + /* Regulation 45 ohms */ > >> + if (phy->index == 0) > >> + sun4i_usb_phy_write(phy, PHY_RES45_CAL_EN, 0x01, 1); > > > > What is this code supposed to do? > > > > Some define for this bit and/or a better comment would be nice. > > From Allwinner's sources: "Enable/Disable USB res45 Calibration" > > which I think refers to the internal 45 ohm termination resistors > for the USB data lines. But I'm not an expert on USB hardware. That would make a great comment ;) Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko 2014-10-27 21:43 ` [PATCH 1/5] phy: sun4i: add support for USB phy0 Roman Byshko @ 2014-10-27 21:43 ` Roman Byshko [not found] ` <210cc2a03d43e3d65b08f302b3b32663044ad94f.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-10-27 21:43 ` [PATCH 3/5] ARM: sun7i: dtsi: add support for usbphy0 Roman Byshko ` (3 subsequent siblings) 5 siblings, 1 reply; 14+ messages in thread From: Roman Byshko @ 2014-10-27 21:43 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, devicetree Cc: Kishon Vijay Abraham I, Maxime Ripard, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring Until now the regulator nodes for powering USB VBUS existed only for the two host controllers. Now the regulator is added for USB OTG too. --- arch/arm/boot/dts/sunxi-common-regulators.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/sunxi-common-regulators.dtsi b/arch/arm/boot/dts/sunxi-common-regulators.dtsi index c9c5b10..f521672 100644 --- a/arch/arm/boot/dts/sunxi-common-regulators.dtsi +++ b/arch/arm/boot/dts/sunxi-common-regulators.dtsi @@ -21,6 +21,13 @@ allwinner,pull = <0>; }; + usb0_vbus_pin_a: usb0_vbus_pin@0 { + allwinner,pins = "PB9"; + allwinner,function = "gpio_out"; + allwinner,drive = <0>; + allwinner,pull = <0>; + }; + usb1_vbus_pin_a: usb1_vbus_pin@0 { allwinner,pins = "PH6"; allwinner,function = "gpio_out"; @@ -49,6 +56,18 @@ status = "disabled"; }; + reg_usb0_vbus: usb0-vbus { + compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&usb0_vbus_pin_a>; + regulator-name = "usb0-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&pio 1 9 0>; + status = "disabled"; + }; + reg_usb1_vbus: usb1-vbus { compatible = "regulator-fixed"; pinctrl-names = "default"; -- 2.1.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
[parent not found: <210cc2a03d43e3d65b08f302b3b32663044ad94f.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator [not found] ` <210cc2a03d43e3d65b08f302b3b32663044ad94f.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2014-10-28 21:51 ` Maxime Ripard 2014-10-29 20:13 ` Roman Byshko 0 siblings, 1 reply; 14+ messages in thread From: Maxime Ripard @ 2014-10-28 21:51 UTC (permalink / raw) To: Roman Byshko Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, Kishon Vijay Abraham I, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring [-- Attachment #1: Type: text/plain, Size: 1728 bytes --] On Mon, Oct 27, 2014 at 10:43:02PM +0100, Roman Byshko wrote: > Until now the regulator nodes for powering USB VBUS > existed only for the two host controllers. Now the regulator > is added for USB OTG too. > --- > arch/arm/boot/dts/sunxi-common-regulators.dtsi | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/arch/arm/boot/dts/sunxi-common-regulators.dtsi b/arch/arm/boot/dts/sunxi-common-regulators.dtsi > index c9c5b10..f521672 100644 > --- a/arch/arm/boot/dts/sunxi-common-regulators.dtsi > +++ b/arch/arm/boot/dts/sunxi-common-regulators.dtsi > @@ -21,6 +21,13 @@ > allwinner,pull = <0>; > }; > > + usb0_vbus_pin_a: usb0_vbus_pin@0 { > + allwinner,pins = "PB9"; > + allwinner,function = "gpio_out"; > + allwinner,drive = <0>; > + allwinner,pull = <0>; > + }; > + > usb1_vbus_pin_a: usb1_vbus_pin@0 { > allwinner,pins = "PH6"; > allwinner,function = "gpio_out"; > @@ -49,6 +56,18 @@ > status = "disabled"; > }; > > + reg_usb0_vbus: usb0-vbus { > + compatible = "regulator-fixed"; > + pinctrl-names = "default"; > + pinctrl-0 = <&usb0_vbus_pin_a>; > + regulator-name = "usb0-vbus"; > + regulator-min-microvolt = <5000000>; > + regulator-max-microvolt = <5000000>; > + enable-active-high; > + gpio = <&pio 1 9 0>; > + status = "disabled"; > + }; We're using these regulators because a huuuge majority of the boards out there, regardless of their SoC, are using the same GPIO to drive the same regulator. Is this the case here? What board have you looked at? Thanks, Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator 2014-10-28 21:51 ` Maxime Ripard @ 2014-10-29 20:13 ` Roman Byshko 2014-10-30 16:41 ` Maxime Ripard 0 siblings, 1 reply; 14+ messages in thread From: Roman Byshko @ 2014-10-29 20:13 UTC (permalink / raw) To: Maxime Ripard Cc: linux-kernel, linux-arm-kernel, devicetree, Kishon Vijay Abraham I, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring Hi Maxime, thank you for the review! On Tue, Oct 28, 2014 at 10:51 PM, Maxime Ripard <maxime.ripard@free-electrons.com> wrote: > On Mon, Oct 27, 2014 at 10:43:02PM +0100, Roman Byshko wrote: >> Until now the regulator nodes for powering USB VBUS >> existed only for the two host controllers. Now the regulator >> is added for USB OTG too. >> --- >> arch/arm/boot/dts/sunxi-common-regulators.dtsi | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/arch/arm/boot/dts/sunxi-common-regulators.dtsi b/arch/arm/boot/dts/sunxi-common-regulators.dtsi >> index c9c5b10..f521672 100644 >> --- a/arch/arm/boot/dts/sunxi-common-regulators.dtsi >> +++ b/arch/arm/boot/dts/sunxi-common-regulators.dtsi >> @@ -21,6 +21,13 @@ >> allwinner,pull = <0>; >> }; >> >> + usb0_vbus_pin_a: usb0_vbus_pin@0 { >> + allwinner,pins = "PB9"; >> + allwinner,function = "gpio_out"; >> + allwinner,drive = <0>; >> + allwinner,pull = <0>; >> + }; >> + >> usb1_vbus_pin_a: usb1_vbus_pin@0 { >> allwinner,pins = "PH6"; >> allwinner,function = "gpio_out"; >> @@ -49,6 +56,18 @@ >> status = "disabled"; >> }; >> >> + reg_usb0_vbus: usb0-vbus { >> + compatible = "regulator-fixed"; >> + pinctrl-names = "default"; >> + pinctrl-0 = <&usb0_vbus_pin_a>; >> + regulator-name = "usb0-vbus"; >> + regulator-min-microvolt = <5000000>; >> + regulator-max-microvolt = <5000000>; >> + enable-active-high; >> + gpio = <&pio 1 9 0>; >> + status = "disabled"; >> + }; > > We're using these regulators because a huuuge majority of the boards > out there, regardless of their SoC, are using the same GPIO to drive > the same regulator. Is this the case here? What board have you looked > at? Currently I'm developing and testing for Cubietruck. I also have a few other boards (with different SoC), I will add corresponding DT nodes for them later. As for GPIO which is used to drive the USB0 VBUS pin. $ git remote show origin * remote origin Fetch URL: https://github.com/linux-sunxi/sunxi-boards.git Push URL: https://github.com/linux-sunxi/sunxi-boards.git ... $ grep -A7 usbc0 -r . | grep usb_drv_vbus_gpio | grep port | sort | cut -d: -f2 | cut -d "<" -f1 | sort | uniq -c 1 PA16 1 PA17 67 PB09 4 PB10 1 PB9 1 PC17 1 PD25 4 PG11 21 PG12 1 PG13 1 PH17 4 power4 So PB09 is most often used. PG12 is used on (alsmost always) A13. So propose to make PB09 default, then override it in sun5i-a13.dtsi and later in board dts file if needed. Cubietruck uses PH17. That is why I override PB09 in its dts file. Sounds good? Best, Roman > Thanks, > Maxime > > -- > Maxime Ripard, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator 2014-10-29 20:13 ` Roman Byshko @ 2014-10-30 16:41 ` Maxime Ripard 0 siblings, 0 replies; 14+ messages in thread From: Maxime Ripard @ 2014-10-30 16:41 UTC (permalink / raw) To: Roman Byshko Cc: linux-kernel, linux-arm-kernel, devicetree, Kishon Vijay Abraham I, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring [-- Attachment #1: Type: text/plain, Size: 3475 bytes --] Hi, On Wed, Oct 29, 2014 at 09:13:50PM +0100, Roman Byshko wrote: > Hi Maxime, > > thank you for the review! > > On Tue, Oct 28, 2014 at 10:51 PM, Maxime Ripard > <maxime.ripard@free-electrons.com> wrote: > > On Mon, Oct 27, 2014 at 10:43:02PM +0100, Roman Byshko wrote: > >> Until now the regulator nodes for powering USB VBUS > >> existed only for the two host controllers. Now the regulator > >> is added for USB OTG too. > >> --- > >> arch/arm/boot/dts/sunxi-common-regulators.dtsi | 19 +++++++++++++++++++ > >> 1 file changed, 19 insertions(+) > >> > >> diff --git a/arch/arm/boot/dts/sunxi-common-regulators.dtsi b/arch/arm/boot/dts/sunxi-common-regulators.dtsi > >> index c9c5b10..f521672 100644 > >> --- a/arch/arm/boot/dts/sunxi-common-regulators.dtsi > >> +++ b/arch/arm/boot/dts/sunxi-common-regulators.dtsi > >> @@ -21,6 +21,13 @@ > >> allwinner,pull = <0>; > >> }; > >> > >> + usb0_vbus_pin_a: usb0_vbus_pin@0 { > >> + allwinner,pins = "PB9"; > >> + allwinner,function = "gpio_out"; > >> + allwinner,drive = <0>; > >> + allwinner,pull = <0>; > >> + }; > >> + > >> usb1_vbus_pin_a: usb1_vbus_pin@0 { > >> allwinner,pins = "PH6"; > >> allwinner,function = "gpio_out"; > >> @@ -49,6 +56,18 @@ > >> status = "disabled"; > >> }; > >> > >> + reg_usb0_vbus: usb0-vbus { > >> + compatible = "regulator-fixed"; > >> + pinctrl-names = "default"; > >> + pinctrl-0 = <&usb0_vbus_pin_a>; > >> + regulator-name = "usb0-vbus"; > >> + regulator-min-microvolt = <5000000>; > >> + regulator-max-microvolt = <5000000>; > >> + enable-active-high; > >> + gpio = <&pio 1 9 0>; > >> + status = "disabled"; > >> + }; > > > > We're using these regulators because a huuuge majority of the boards > > out there, regardless of their SoC, are using the same GPIO to drive > > the same regulator. Is this the case here? What board have you looked > > at? > > Currently I'm developing and testing for Cubietruck. I also have a few > other boards (with different SoC), I will add corresponding DT nodes > for them later. > > As for GPIO which is used to drive the USB0 VBUS pin. > > $ git remote show origin > * remote origin > Fetch URL: https://github.com/linux-sunxi/sunxi-boards.git > Push URL: https://github.com/linux-sunxi/sunxi-boards.git > ... > $ grep -A7 usbc0 -r . | grep usb_drv_vbus_gpio | grep port | sort | > cut -d: -f2 | cut -d "<" -f1 | sort | uniq -c > 1 PA16 > 1 PA17 > 67 PB09 > 4 PB10 > 1 PB9 > 1 PC17 > 1 PD25 > 4 PG11 > 21 PG12 > 1 PG13 > 1 PH17 > 4 power4 > > So PB09 is most often used. PG12 is used on (alsmost always) A13. So > propose to make PB09 default, then override it in sun5i-a13.dtsi and > later in board dts file if needed. > > Cubietruck uses PH17. That is why I override PB09 in its dts file. > > Sounds good? It does :) Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/5] ARM: sun7i: dtsi: add support for usbphy0 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko 2014-10-27 21:43 ` [PATCH 1/5] phy: sun4i: add support for USB phy0 Roman Byshko 2014-10-27 21:43 ` [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator Roman Byshko @ 2014-10-27 21:43 ` Roman Byshko 2014-10-27 21:43 ` [PATCH 4/5] ARM: dts: sun7i: Cubietruck: override regulator pin Roman Byshko ` (2 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Roman Byshko @ 2014-10-27 21:43 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, devicetree Cc: Kishon Vijay Abraham I, Maxime Ripard, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring --- arch/arm/boot/dts/sun7i-a20.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 82097c9..f787ccb 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -552,8 +552,8 @@ reg-names = "phy_ctrl", "pmu1", "pmu2"; clocks = <&usb_clk 8>; clock-names = "usb_phy"; - resets = <&usb_clk 1>, <&usb_clk 2>; - reset-names = "usb1_reset", "usb2_reset"; + resets = <&usb_clk 0>, <&usb_clk 1>, <&usb_clk 2>; + reset-names = "usb0_reset", "usb1_reset", "usb2_reset"; status = "disabled"; }; -- 2.1.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] ARM: dts: sun7i: Cubietruck: override regulator pin 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko ` (2 preceding siblings ...) 2014-10-27 21:43 ` [PATCH 3/5] ARM: sun7i: dtsi: add support for usbphy0 Roman Byshko @ 2014-10-27 21:43 ` Roman Byshko 2014-10-27 21:43 ` [PATCH 5/5] ARM: dts: sun7i: Cubietruck: add power supply regulator for USB OTG VBUS Roman Byshko 2014-10-27 22:27 ` [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Andreas Färber 5 siblings, 0 replies; 14+ messages in thread From: Roman Byshko @ 2014-10-27 21:43 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, devicetree Cc: Kishon Vijay Abraham I, Maxime Ripard, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring Cubietruck uses different pin for the USB OTG VBUS that is why we override the one defined in sunxi-common-regulators.dtsi --- arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts index a6c1a3c..1682307 100644 --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts @@ -92,6 +92,13 @@ allwinner,drive = <0>; allwinner,pull = <0>; }; + + usb0_vbus_pin_a: usb0_vbus_pin@0 { + allwinner,pins = "PH17"; + allwinner,function = "gpio_out"; + allwinner,drive = <0>; + allwinner,pull = <0>; + }; }; pwm: pwm@01c20e00 { @@ -185,6 +192,12 @@ status = "okay"; }; + reg_usb0_vbus: usb0-vbus { + pinctrl-0 = <&usb0_vbus_pin_a>; + gpio = <&pio 7 17 0>; + status = "okay"; + }; + reg_usb1_vbus: usb1-vbus { status = "okay"; }; -- 2.1.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/5] ARM: dts: sun7i: Cubietruck: add power supply regulator for USB OTG VBUS 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko ` (3 preceding siblings ...) 2014-10-27 21:43 ` [PATCH 4/5] ARM: dts: sun7i: Cubietruck: override regulator pin Roman Byshko @ 2014-10-27 21:43 ` Roman Byshko 2014-10-27 22:27 ` [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Andreas Färber 5 siblings, 0 replies; 14+ messages in thread From: Roman Byshko @ 2014-10-27 21:43 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, devicetree Cc: Kishon Vijay Abraham I, Maxime Ripard, Russell King, Kumar Gala, Ian Campbell, Mark Rutland, Pawel Moll, Rob Herring --- arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts index 1682307..a281d25 100644 --- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts +++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts @@ -40,6 +40,7 @@ }; usbphy: phy@01c13400 { + usb0_vbus-supply = <®_usb0_vbus>; usb1_vbus-supply = <®_usb1_vbus>; usb2_vbus-supply = <®_usb2_vbus>; status = "okay"; -- 2.1.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko ` (4 preceding siblings ...) 2014-10-27 21:43 ` [PATCH 5/5] ARM: dts: sun7i: Cubietruck: add power supply regulator for USB OTG VBUS Roman Byshko @ 2014-10-27 22:27 ` Andreas Färber 5 siblings, 0 replies; 14+ messages in thread From: Andreas Färber @ 2014-10-27 22:27 UTC (permalink / raw) To: Roman Byshko, linux-kernel, linux-arm-kernel, devicetree Cc: Mark Rutland, Russell King, Pawel Moll, Ian Campbell, Kishon Vijay Abraham I, Rob Herring, Kumar Gala, Maxime Ripard Hi Roman, Am 27.10.2014 um 22:43 schrieb Roman Byshko: > There is already support for two USB phys, which are used for > USB host controllers on Allwinner SoC aka sunxi. > > This patch series add support for the USB OTG phy (aka phy0). > > The code has been tested on Allwinner A20 aka sun7i (Cubietruck). All these patches are lacking a Signed-off-by. Regards, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-10-30 16:41 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-27 21:43 [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Roman Byshko 2014-10-27 21:43 ` [PATCH 1/5] phy: sun4i: add support for USB phy0 Roman Byshko [not found] ` <668c1b5541fc0175957573bd5f8d40dd2eaccae1.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-10-28 21:47 ` Maxime Ripard 2014-10-29 2:24 ` Chen-Yu Tsai 2014-10-29 13:46 ` Roman Byshko 2014-10-30 16:40 ` Maxime Ripard 2014-10-27 21:43 ` [PATCH 2/5] ARM: dtsi: sunxi: add common VBUS regulator Roman Byshko [not found] ` <210cc2a03d43e3d65b08f302b3b32663044ad94f.1414444953.git.rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-10-28 21:51 ` Maxime Ripard 2014-10-29 20:13 ` Roman Byshko 2014-10-30 16:41 ` Maxime Ripard 2014-10-27 21:43 ` [PATCH 3/5] ARM: sun7i: dtsi: add support for usbphy0 Roman Byshko 2014-10-27 21:43 ` [PATCH 4/5] ARM: dts: sun7i: Cubietruck: override regulator pin Roman Byshko 2014-10-27 21:43 ` [PATCH 5/5] ARM: dts: sun7i: Cubietruck: add power supply regulator for USB OTG VBUS Roman Byshko 2014-10-27 22:27 ` [PATCH 0/5] ARM: sunxi: Add support for USB OTG PHY Andreas Färber
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).