All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
       [not found] <1607C7CBC1E2C0D1.18995@groups.io>
@ 2020-04-24  7:18   ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2020-04-24  7:18 UTC (permalink / raw)
  To: u-boot

On 21/04/2020 10:17, Neil Armstrong via groups.io wrote:
> Power on/off the PHYs to enable power to the USB ports, fixing USB support
> on Khadas VIM3/VIM3L boards.
> 
> The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
> DWC2 and DWC3 controller and the other one directly connected to the DWC3
> controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
> and a DW-PCIE controller.
> All PHYs are optional, but it's type (usb2/usb3) and position are important
> to determine it's capabilities, thus they are stored in a fixed size
> array and the phy-name determines it's position, it's position determining
> it's type and functionnalities.
> This is why we need to loop over the array to power on all the DT provided
> PHYs.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> Changes since v1:
> - removed extra space before semicolon
> - added clarification in commit message
> 
>  drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index d4453f8784..de964d6c10 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
>  			goto err_phy_init;
>  	}
>  
> +	for (i = 0; i < PHY_COUNT; ++i) {
> +		if (!priv->phys[i].dev)
> +			continue;
> +
> +		ret = generic_phy_power_on(&priv->phys[i]);
> +		if (ret)
> +			goto err_phy_init;
> +	}
> +
>  	return 0;
>  
>  err_phy_init:
> @@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
>  
>  	clk_release_all(&priv->clk, 1);
>  
> +	for (i = 0; i < PHY_COUNT; ++i) {
> +		if (!priv->phys[i].dev)
> +			continue;
> +
> +		 generic_phy_power_off(&priv->phys[i]);
> +	}
> +
>  	for (i = 0 ; i < PHY_COUNT ; ++i) {
>  		if (!priv->phys[i].dev)
>  			continue;
> 

Applied to u-boot-amlogic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
@ 2020-04-24  7:18   ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2020-04-24  7:18 UTC (permalink / raw)
  To: u-boot-amlogic, marex; +Cc: u-boot

On 21/04/2020 10:17, Neil Armstrong via groups.io wrote:
> Power on/off the PHYs to enable power to the USB ports, fixing USB support
> on Khadas VIM3/VIM3L boards.
> 
> The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
> DWC2 and DWC3 controller and the other one directly connected to the DWC3
> controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
> and a DW-PCIE controller.
> All PHYs are optional, but it's type (usb2/usb3) and position are important
> to determine it's capabilities, thus they are stored in a fixed size
> array and the phy-name determines it's position, it's position determining
> it's type and functionnalities.
> This is why we need to loop over the array to power on all the DT provided
> PHYs.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> Changes since v1:
> - removed extra space before semicolon
> - added clarification in commit message
> 
>  drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index d4453f8784..de964d6c10 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
>  			goto err_phy_init;
>  	}
>  
> +	for (i = 0; i < PHY_COUNT; ++i) {
> +		if (!priv->phys[i].dev)
> +			continue;
> +
> +		ret = generic_phy_power_on(&priv->phys[i]);
> +		if (ret)
> +			goto err_phy_init;
> +	}
> +
>  	return 0;
>  
>  err_phy_init:
> @@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
>  
>  	clk_release_all(&priv->clk, 1);
>  
> +	for (i = 0; i < PHY_COUNT; ++i) {
> +		if (!priv->phys[i].dev)
> +			continue;
> +
> +		 generic_phy_power_off(&priv->phys[i]);
> +	}
> +
>  	for (i = 0 ; i < PHY_COUNT ; ++i) {
>  		if (!priv->phys[i].dev)
>  			continue;
> 

Applied to u-boot-amlogic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
  2020-04-24  7:18   ` Neil Armstrong
  (?)
@ 2020-04-24  7:41   ` Marek Vasut
  2020-04-24  9:03       ` Neil Armstrong
  -1 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2020-04-24  7:41 UTC (permalink / raw)
  To: u-boot

On 4/24/20 9:18 AM, Neil Armstrong wrote:
> On 21/04/2020 10:17, Neil Armstrong via groups.io wrote:
>> Power on/off the PHYs to enable power to the USB ports, fixing USB support
>> on Khadas VIM3/VIM3L boards.
>>
>> The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
>> DWC2 and DWC3 controller and the other one directly connected to the DWC3
>> controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
>> and a DW-PCIE controller.
>> All PHYs are optional, but it's type (usb2/usb3) and position are important
>> to determine it's capabilities, thus they are stored in a fixed size
>> array and the phy-name determines it's position, it's position determining
>> it's type and functionnalities.
>> This is why we need to loop over the array to power on all the DT provided
>> PHYs.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>> Changes since v1:
>> - removed extra space before semicolon
>> - added clarification in commit message
>>
>>  drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
>> index d4453f8784..de964d6c10 100644
>> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
>> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
>> @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
>>  			goto err_phy_init;
>>  	}
>>  
>> +	for (i = 0; i < PHY_COUNT; ++i) {
>> +		if (!priv->phys[i].dev)
>> +			continue;
>> +
>> +		ret = generic_phy_power_on(&priv->phys[i]);
>> +		if (ret)
>> +			goto err_phy_init;
>> +	}
>> +
>>  	return 0;
>>  
>>  err_phy_init:
>> @@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
>>  
>>  	clk_release_all(&priv->clk, 1);
>>  
>> +	for (i = 0; i < PHY_COUNT; ++i) {
>> +		if (!priv->phys[i].dev)
>> +			continue;
>> +
>> +		 generic_phy_power_off(&priv->phys[i]);
>> +	}
>> +
>>  	for (i = 0 ; i < PHY_COUNT ; ++i) {
>>  		if (!priv->phys[i].dev)
>>  			continue;
>>
> 
> Applied to u-boot-amlogic

Did you apply V1 or V2 ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
  2020-04-24  7:41   ` Marek Vasut
@ 2020-04-24  9:03       ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2020-04-24  9:03 UTC (permalink / raw)
  To: u-boot

On 24/04/2020 09:41, Marek Vasut wrote:
> On 4/24/20 9:18 AM, Neil Armstrong wrote:
>> On 21/04/2020 10:17, Neil Armstrong via groups.io wrote:
>>> Power on/off the PHYs to enable power to the USB ports, fixing USB support
>>> on Khadas VIM3/VIM3L boards.
>>>
>>> The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
>>> DWC2 and DWC3 controller and the other one directly connected to the DWC3
>>> controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
>>> and a DW-PCIE controller.
>>> All PHYs are optional, but it's type (usb2/usb3) and position are important
>>> to determine it's capabilities, thus they are stored in a fixed size
>>> array and the phy-name determines it's position, it's position determining
>>> it's type and functionnalities.
>>> This is why we need to loop over the array to power on all the DT provided
>>> PHYs.
>>>
>>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>>> ---
>>> Changes since v1:
>>> - removed extra space before semicolon
>>> - added clarification in commit message
>>>
>>>  drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
>>>  1 file changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
>>> index d4453f8784..de964d6c10 100644
>>> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
>>> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
>>> @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
>>>  			goto err_phy_init;
>>>  	}
>>>  
>>> +	for (i = 0; i < PHY_COUNT; ++i) {
>>> +		if (!priv->phys[i].dev)
>>> +			continue;
>>> +
>>> +		ret = generic_phy_power_on(&priv->phys[i]);
>>> +		if (ret)
>>> +			goto err_phy_init;
>>> +	}
>>> +
>>>  	return 0;
>>>  
>>>  err_phy_init:
>>> @@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
>>>  
>>>  	clk_release_all(&priv->clk, 1);
>>>  
>>> +	for (i = 0; i < PHY_COUNT; ++i) {
>>> +		if (!priv->phys[i].dev)
>>> +			continue;
>>> +
>>> +		 generic_phy_power_off(&priv->phys[i]);
>>> +	}
>>> +
>>>  	for (i = 0 ; i < PHY_COUNT ; ++i) {
>>>  		if (!priv->phys[i].dev)
>>>  			continue;
>>>
>>
>> Applied to u-boot-amlogic
> 
> Did you apply V1 or V2 ?
> 

v2

Neil

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
@ 2020-04-24  9:03       ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2020-04-24  9:03 UTC (permalink / raw)
  To: Marek Vasut, u-boot-amlogic; +Cc: u-boot

On 24/04/2020 09:41, Marek Vasut wrote:
> On 4/24/20 9:18 AM, Neil Armstrong wrote:
>> On 21/04/2020 10:17, Neil Armstrong via groups.io wrote:
>>> Power on/off the PHYs to enable power to the USB ports, fixing USB support
>>> on Khadas VIM3/VIM3L boards.
>>>
>>> The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
>>> DWC2 and DWC3 controller and the other one directly connected to the DWC3
>>> controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
>>> and a DW-PCIE controller.
>>> All PHYs are optional, but it's type (usb2/usb3) and position are important
>>> to determine it's capabilities, thus they are stored in a fixed size
>>> array and the phy-name determines it's position, it's position determining
>>> it's type and functionnalities.
>>> This is why we need to loop over the array to power on all the DT provided
>>> PHYs.
>>>
>>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>>> ---
>>> Changes since v1:
>>> - removed extra space before semicolon
>>> - added clarification in commit message
>>>
>>>  drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
>>>  1 file changed, 16 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
>>> index d4453f8784..de964d6c10 100644
>>> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
>>> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
>>> @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
>>>  			goto err_phy_init;
>>>  	}
>>>  
>>> +	for (i = 0; i < PHY_COUNT; ++i) {
>>> +		if (!priv->phys[i].dev)
>>> +			continue;
>>> +
>>> +		ret = generic_phy_power_on(&priv->phys[i]);
>>> +		if (ret)
>>> +			goto err_phy_init;
>>> +	}
>>> +
>>>  	return 0;
>>>  
>>>  err_phy_init:
>>> @@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
>>>  
>>>  	clk_release_all(&priv->clk, 1);
>>>  
>>> +	for (i = 0; i < PHY_COUNT; ++i) {
>>> +		if (!priv->phys[i].dev)
>>> +			continue;
>>> +
>>> +		 generic_phy_power_off(&priv->phys[i]);
>>> +	}
>>> +
>>>  	for (i = 0 ; i < PHY_COUNT ; ++i) {
>>>  		if (!priv->phys[i].dev)
>>>  			continue;
>>>
>>
>> Applied to u-boot-amlogic
> 
> Did you apply V1 or V2 ?
> 

v2

Neil

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
  2020-04-21  8:17 ` Neil Armstrong
  (?)
@ 2020-04-21  8:24 ` Marek Vasut
  -1 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2020-04-21  8:24 UTC (permalink / raw)
  To: u-boot

On 4/21/20 10:17 AM, Neil Armstrong wrote:
> Power on/off the PHYs to enable power to the USB ports, fixing USB support
> on Khadas VIM3/VIM3L boards.
> 
> The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
> DWC2 and DWC3 controller and the other one directly connected to the DWC3
> controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
> and a DW-PCIE controller.
> All PHYs are optional, but it's type (usb2/usb3) and position are important
> to determine it's capabilities, thus they are stored in a fixed size
> array and the phy-name determines it's position, it's position determining
> it's type and functionnalities.
> This is why we need to loop over the array to power on all the DT provided
> PHYs.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> Changes since v1:
> - removed extra space before semicolon
> - added clarification in commit message
> 
>  drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
> index d4453f8784..de964d6c10 100644
> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c
> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
> @@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
>  			goto err_phy_init;
>  	}
>  
> +	for (i = 0; i < PHY_COUNT; ++i) {

i++ , unlike old c++ compilers, there's no difference here.

> +		if (!priv->phys[i].dev)
> +			continue;
> +
> +		ret = generic_phy_power_on(&priv->phys[i]);
> +		if (ret)
> +			goto err_phy_init;
> +	}
> +
>  	return 0;

Reviewed-by: Marek Vasut <marex@denx.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
@ 2020-04-21  8:17 ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2020-04-21  8:17 UTC (permalink / raw)
  To: u-boot

Power on/off the PHYs to enable power to the USB ports, fixing USB support
on Khadas VIM3/VIM3L boards.

The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
DWC2 and DWC3 controller and the other one directly connected to the DWC3
controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
and a DW-PCIE controller.
All PHYs are optional, but it's type (usb2/usb3) and position are important
to determine it's capabilities, thus they are stored in a fixed size
array and the phy-name determines it's position, it's position determining
it's type and functionnalities.
This is why we need to loop over the array to power on all the DT provided
PHYs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
Changes since v1:
- removed extra space before semicolon
- added clarification in commit message

 drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index d4453f8784..de964d6c10 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
 			goto err_phy_init;
 	}
 
+	for (i = 0; i < PHY_COUNT; ++i) {
+		if (!priv->phys[i].dev)
+			continue;
+
+		ret = generic_phy_power_on(&priv->phys[i]);
+		if (ret)
+			goto err_phy_init;
+	}
+
 	return 0;
 
 err_phy_init:
@@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
 
 	clk_release_all(&priv->clk, 1);
 
+	for (i = 0; i < PHY_COUNT; ++i) {
+		if (!priv->phys[i].dev)
+			continue;
+
+		 generic_phy_power_off(&priv->phys[i]);
+	}
+
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		if (!priv->phys[i].dev)
 			continue;
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs
@ 2020-04-21  8:17 ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2020-04-21  8:17 UTC (permalink / raw)
  To: u-boot-amlogic, marex; +Cc: u-boot, Neil Armstrong

Power on/off the PHYs to enable power to the USB ports, fixing USB support
on Khadas VIM3/VIM3L boards.

The G12A USB complex has at least 2 USB2 PHYs, but one is muxed between the
DWC2 and DWC3 controller and the other one directly connected to the DWC3
controller. The USB3+PCIe combo PHY is muxed between the DWC3 controller
and a DW-PCIE controller.
All PHYs are optional, but it's type (usb2/usb3) and position are important
to determine it's capabilities, thus they are stored in a fixed size
array and the phy-name determines it's position, it's position determining
it's type and functionnalities.
This is why we need to loop over the array to power on all the DT provided
PHYs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
Changes since v1:
- removed extra space before semicolon
- added clarification in commit message

 drivers/usb/dwc3/dwc3-meson-g12a.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index d4453f8784..de964d6c10 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -408,6 +408,15 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
 			goto err_phy_init;
 	}
 
+	for (i = 0; i < PHY_COUNT; ++i) {
+		if (!priv->phys[i].dev)
+			continue;
+
+		ret = generic_phy_power_on(&priv->phys[i]);
+		if (ret)
+			goto err_phy_init;
+	}
+
 	return 0;
 
 err_phy_init:
@@ -430,6 +439,13 @@ static int dwc3_meson_g12a_remove(struct udevice *dev)
 
 	clk_release_all(&priv->clk, 1);
 
+	for (i = 0; i < PHY_COUNT; ++i) {
+		if (!priv->phys[i].dev)
+			continue;
+
+		 generic_phy_power_off(&priv->phys[i]);
+	}
+
 	for (i = 0 ; i < PHY_COUNT ; ++i) {
 		if (!priv->phys[i].dev)
 			continue;
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-24  9:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1607C7CBC1E2C0D1.18995@groups.io>
2020-04-24  7:18 ` [PATCH v2] usb: dwc3-meson-g12a: add power-on/off of the PHYs Neil Armstrong
2020-04-24  7:18   ` Neil Armstrong
2020-04-24  7:41   ` Marek Vasut
2020-04-24  9:03     ` Neil Armstrong
2020-04-24  9:03       ` Neil Armstrong
2020-04-21  8:17 Neil Armstrong
2020-04-21  8:17 ` Neil Armstrong
2020-04-21  8:24 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.