diff mbox series

usb: dwc2: Force 8bit UTMI width for Samsung Exynos SoCs

Message ID 20190506130046.20898-1-m.szyprowski@samsung.com (mailing list archive)
State Superseded
Headers show
Series usb: dwc2: Force 8bit UTMI width for Samsung Exynos SoCs | expand

Commit Message

Marek Szyprowski May 6, 2019, 1 p.m. UTC
Samsung Exynos SoCs require to force UTMI width to 8bit, otherwise the
host side of the shared USB2 PHY doesn't work.

Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/usb/dwc2/params.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jules Maselbas May 6, 2019, 1:40 p.m. UTC | #1
Hi,

On Mon, May 06, 2019 at 03:00:46PM +0200, Marek Szyprowski wrote:
> Samsung Exynos SoCs require to force UTMI width to 8bit, otherwise the
> host side of the shared USB2 PHY doesn't work.
> 
> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/usb/dwc2/params.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index 6900eea57526..9ece4affb9d4 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -76,6 +76,7 @@ static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
>  	struct dwc2_core_params *p = &hsotg->params;
>  
>  	p->power_down = 0;
> +	p->phy_utmi_width = 8;

Nice catch.

I though that 8bits would be the default value, I am curious to know why it's not ny default at 8.

Thanks.


---
Jules

>  }
>  
>  static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
> -- 
> 2.17.1
>
Minas Harutyunyan May 7, 2019, 6:22 a.m. UTC | #2
On 5/6/2019 5:01 PM, Marek Szyprowski wrote:
> Samsung Exynos SoCs require to force UTMI width to 8bit, otherwise the
> host side of the shared USB2 PHY doesn't work.
> 
> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Acked-by: Minas Harutyunyan <hminas@synopsys.com>

> ---
>   drivers/usb/dwc2/params.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index 6900eea57526..9ece4affb9d4 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -76,6 +76,7 @@ static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
>   	struct dwc2_core_params *p = &hsotg->params;
>   
>   	p->power_down = 0;
> +	p->phy_utmi_width = 8;
>   }
>   
>   static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
>
Markus Reichl May 7, 2019, 8:12 a.m. UTC | #3
Hi Marek,

your patch did not help on stable v5.1

[    3.255963] samsung-usb2-phy 125b0000.exynos-usbphy: 125b0000.exynos-usbphy supply vbus not found, using dummy regulator
[    4.044547] usbcore: registered new interface driver smsc95xx
[    4.112261] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.01
[    4.120363] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    4.127560] usb usb1: Product: EHCI Host Controller
[    4.132415] usb usb1: Manufacturer: Linux 5.1.0-00005-geb4efae48eb5 ehci_hcd
[    4.139446] usb usb1: SerialNumber: 12580000.ehci
[    4.183056] usb3503 0-0008: switched to HUB mode
[    4.183121] usb3503 0-0008: usb3503_probe: probed in hub mode
[    4.488344] usb 1-2: new high-speed USB device number 2 using exynos-ehci
[    4.675605] usb 1-2: New USB device found, idVendor=0424, idProduct=3503, bcdDevice=a1.a0
[    4.678166] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    4.686140] usb 1-2: skipping disabled interface 0

root@odroid-x2:~# lsusb
Bus 001 Device 002: ID 0424:3503 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub



Am 06.05.19 um 15:00 schrieb Marek Szyprowski:
> Samsung Exynos SoCs require to force UTMI width to 8bit, otherwise the
> host side of the shared USB2 PHY doesn't work.
> 
> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/usb/dwc2/params.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index 6900eea57526..9ece4affb9d4 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -76,6 +76,7 @@ static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
>  	struct dwc2_core_params *p = &hsotg->params;
>  
>  	p->power_down = 0;
> +	p->phy_utmi_width = 8;
>  }
>  
>  static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)
> 

Gruß,
Marek Szyprowski May 7, 2019, 9:17 a.m. UTC | #4
Hi Markus,

On 2019-05-07 10:12, Markus Reichl wrote:
> Hi Marek,
>
> your patch did not help on stable v5.1
>
> [    3.255963] samsung-usb2-phy 125b0000.exynos-usbphy: 125b0000.exynos-usbphy supply vbus not found, using dummy regulator
> [    4.044547] usbcore: registered new interface driver smsc95xx
> [    4.112261] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.01
> [    4.120363] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [    4.127560] usb usb1: Product: EHCI Host Controller
> [    4.132415] usb usb1: Manufacturer: Linux 5.1.0-00005-geb4efae48eb5 ehci_hcd
> [    4.139446] usb usb1: SerialNumber: 12580000.ehci
> [    4.183056] usb3503 0-0008: switched to HUB mode
> [    4.183121] usb3503 0-0008: usb3503_probe: probed in hub mode
> [    4.488344] usb 1-2: new high-speed USB device number 2 using exynos-ehci
> [    4.675605] usb 1-2: New USB device found, idVendor=0424, idProduct=3503, bcdDevice=a1.a0
> [    4.678166] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> [    4.686140] usb 1-2: skipping disabled interface 0
>
> root@odroid-x2:~# lsusb
> Bus 001 Device 002: ID 0424:3503 Standard Microsystems Corp.
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This patch fixes the issue introduced by "usb: dwc2: gadget: Replace 
phyif with phy_utmi_width" commit, which is queued only to linux-next so 
far. Stable v5.1 doesn't include it, so the fix doesn't change anything 
on v5.1.

I've checked and OdroidU3 works fine with v5.1 release, but X2 fails to 
detect USB devices. I will investigate this in a few minutes...

Best regards
Marek Szyprowski May 7, 2019, 12:03 p.m. UTC | #5
Hi All,

On 2019-05-07 11:17, Marek Szyprowski wrote:
> Hi Markus,
>
> On 2019-05-07 10:12, Markus Reichl wrote:
>> Hi Marek,
>>
>> your patch did not help on stable v5.1
>>
>> [    3.255963] samsung-usb2-phy 125b0000.exynos-usbphy: 
>> 125b0000.exynos-usbphy supply vbus not found, using dummy regulator
>> [    4.044547] usbcore: registered new interface driver smsc95xx
>> [    4.112261] usb usb1: New USB device found, idVendor=1d6b, 
>> idProduct=0002, bcdDevice= 5.01
>> [    4.120363] usb usb1: New USB device strings: Mfr=3, Product=2, 
>> SerialNumber=1
>> [    4.127560] usb usb1: Product: EHCI Host Controller
>> [    4.132415] usb usb1: Manufacturer: Linux 
>> 5.1.0-00005-geb4efae48eb5 ehci_hcd
>> [    4.139446] usb usb1: SerialNumber: 12580000.ehci
>> [    4.183056] usb3503 0-0008: switched to HUB mode
>> [    4.183121] usb3503 0-0008: usb3503_probe: probed in hub mode
>> [    4.488344] usb 1-2: new high-speed USB device number 2 using 
>> exynos-ehci
>> [    4.675605] usb 1-2: New USB device found, idVendor=0424, 
>> idProduct=3503, bcdDevice=a1.a0
>> [    4.678166] usb 1-2: New USB device strings: Mfr=0, Product=0, 
>> SerialNumber=0
>> [    4.686140] usb 1-2: skipping disabled interface 0
>>
>> root@odroid-x2:~# lsusb
>> Bus 001 Device 002: ID 0424:3503 Standard Microsystems Corp.
>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>
> This patch fixes the issue introduced by "usb: dwc2: gadget: Replace 
> phyif with phy_utmi_width" commit, which is queued only to linux-next 
> so far. Stable v5.1 doesn't include it, so the fix doesn't change 
> anything on v5.1.
>
> I've checked and OdroidU3 works fine with v5.1 release, but X2 fails 
> to detect USB devices. I will investigate this in a few minutes...


Broken USB on X2 is caused by commit 
01fdf179f4b064d4c9d30b39aba178caf32649f4 ("usb: core: skip interfaces 
disabled in devicetree").

I looks that the mentioned commit conflicts with the Exynos EHCI and 
OHCI bindings and the way the PHY ports are defined for those drivers. 
It worked on U3 only by the pure coincidence. This is probably a 
"minimal" fix for this issue:

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 82239f27c4cc..cd455c4add25 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -2007,6 +2007,7 @@ int usb_set_configuration(struct usb_device *dev, 
int configuration)
                 struct usb_interface *intf = cp->interface[i];

                 if (intf->dev.of_node &&
+                   of_device_is_compatible(intf->dev.of_node, NULL) &&
                     !of_device_is_available(intf->dev.of_node)) {
                         dev_info(&dev->dev, "skipping disabled 
interface %d\n",
intf->cur_altsetting->desc.bInterfaceNumber);

I will try to describe the problem in details and discuss it on the usb 
mailing list.

Best regards
Markus Reichl May 7, 2019, 12:38 p.m. UTC | #6
Hi Marek,

Am 07.05.19 um 14:03 schrieb Marek Szyprowski:
> Hi All,
> 
> On 2019-05-07 11:17, Marek Szyprowski wrote:
>> Hi Markus,
>>
>> On 2019-05-07 10:12, Markus Reichl wrote:
>>> Hi Marek,
>>>
>>> your patch did not help on stable v5.1
>>>
>>> [    3.255963] samsung-usb2-phy 125b0000.exynos-usbphy: 
>>> 125b0000.exynos-usbphy supply vbus not found, using dummy regulator
>>> [    4.044547] usbcore: registered new interface driver smsc95xx
>>> [    4.112261] usb usb1: New USB device found, idVendor=1d6b, 
>>> idProduct=0002, bcdDevice= 5.01
>>> [    4.120363] usb usb1: New USB device strings: Mfr=3, Product=2, 
>>> SerialNumber=1
>>> [    4.127560] usb usb1: Product: EHCI Host Controller
>>> [    4.132415] usb usb1: Manufacturer: Linux 
>>> 5.1.0-00005-geb4efae48eb5 ehci_hcd
>>> [    4.139446] usb usb1: SerialNumber: 12580000.ehci
>>> [    4.183056] usb3503 0-0008: switched to HUB mode
>>> [    4.183121] usb3503 0-0008: usb3503_probe: probed in hub mode
>>> [    4.488344] usb 1-2: new high-speed USB device number 2 using 
>>> exynos-ehci
>>> [    4.675605] usb 1-2: New USB device found, idVendor=0424, 
>>> idProduct=3503, bcdDevice=a1.a0
>>> [    4.678166] usb 1-2: New USB device strings: Mfr=0, Product=0, 
>>> SerialNumber=0
>>> [    4.686140] usb 1-2: skipping disabled interface 0
>>>
>>> root@odroid-x2:~# lsusb
>>> Bus 001 Device 002: ID 0424:3503 Standard Microsystems Corp.
>>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>>
>> This patch fixes the issue introduced by "usb: dwc2: gadget: Replace 
>> phyif with phy_utmi_width" commit, which is queued only to linux-next 
>> so far. Stable v5.1 doesn't include it, so the fix doesn't change 
>> anything on v5.1.
>>
>> I've checked and OdroidU3 works fine with v5.1 release, but X2 fails 
>> to detect USB devices. I will investigate this in a few minutes...
> 
> 
> Broken USB on X2 is caused by commit 
> 01fdf179f4b064d4c9d30b39aba178caf32649f4 ("usb: core: skip interfaces 
> disabled in devicetree").
> 
> I looks that the mentioned commit conflicts with the Exynos EHCI and 
> OHCI bindings and the way the PHY ports are defined for those drivers. 
> It worked on U3 only by the pure coincidence. This is probably a 
> "minimal" fix for this issue:

Thanks Marek, below fix enables USB on Odroid-X2 with stable v5.1.

> 
> diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
> index 82239f27c4cc..cd455c4add25 100644
> --- a/drivers/usb/core/message.c
> +++ b/drivers/usb/core/message.c
> @@ -2007,6 +2007,7 @@ int usb_set_configuration(struct usb_device *dev, 
> int configuration)
>                  struct usb_interface *intf = cp->interface[i];
> 
>                  if (intf->dev.of_node &&
> +                   of_device_is_compatible(intf->dev.of_node, NULL) &&
>                      !of_device_is_available(intf->dev.of_node)) {
>                          dev_info(&dev->dev, "skipping disabled 
> interface %d\n",
> intf->cur_altsetting->desc.bInterfaceNumber);
> 
> I will try to describe the problem in details and discuss it on the usb 
> mailing list.
> 
> Best regards
> 

Gruß,
Krzysztof Kozlowski June 5, 2019, 8:57 a.m. UTC | #7
On Mon, 6 May 2019 at 15:00, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> Samsung Exynos SoCs require to force UTMI width to 8bit, otherwise the
> host side of the shared USB2 PHY doesn't work.
>
> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 6900eea57526..9ece4affb9d4 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -76,6 +76,7 @@  static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg)
 	struct dwc2_core_params *p = &hsotg->params;
 
 	p->power_down = 0;
+	p->phy_utmi_width = 8;
 }
 
 static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg)