All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-11-28 17:09 Otto Meier
  2020-12-05 11:54 ` Martin Blumenstingl
  0 siblings, 1 reply; 42+ messages in thread
From: Otto Meier @ 2020-11-28 17:09 UTC (permalink / raw)
  To: linux-amlogic

Hello,

I run an Odroid-c2 with newest kernel 5.10.0-rc5
usb recognises usb devices only when they are plugged in before boot.
after boot plugged in devices get not recognized.

Any idea where to search for a fix?

Best regards
Otto


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
  2020-11-28 17:09 [BUG]odroid-c2 does not hotplug usb-devices Otto Meier
@ 2020-12-05 11:54 ` Martin Blumenstingl
  2020-12-05 17:40   ` Otto Meier
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-05 11:54 UTC (permalink / raw)
  To: Otto Meier; +Cc: linux-amlogic

Hi Otto,

On Sat, Nov 28, 2020 at 6:10 PM Otto Meier <gf435@gmx.net> wrote:
>
> Hello,
>
> I run an Odroid-c2 with newest kernel 5.10.0-rc5
> usb recognises usb devices only when they are plugged in before boot.
> after boot plugged in devices get not recognized.
>
> Any idea where to search for a fix?
there are two answers to this:
- this was fixed two years ago with upstream commit cc10ce0c51b13d [0]
- I think it broke again. off-list I received a hint from a user that
setting kernel cmdline parameter usbcore.autosuspend=-1 works around
this issue. can you please try this? if it fixes USB hotplug for you
then this needs to be reported to the USB maintainers


Best regards
Martin


[0] https://github.com/torvalds/linux/commit/cc10ce0c51b13d1566d0ec1dcb472fb86330b391

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-05 11:54 ` Martin Blumenstingl
@ 2020-12-05 17:40   ` Otto Meier
  2020-12-05 19:55     ` Martin Blumenstingl
  0 siblings, 1 reply; 42+ messages in thread
From: Otto Meier @ 2020-12-05 17:40 UTC (permalink / raw)
  To: Martin Blumenstingl; +Cc: linux-amlogic

Hi Martin,

i have tried your second notice. but it does'nt solve the issue.
if at leased on device is pluged in new devices are detected. if
all devices have been removed, no new device will be detected anymore.

Best regards

Otto

Am 05.12.20 um 12:54 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Sat, Nov 28, 2020 at 6:10 PM Otto Meier <gf435@gmx.net> wrote:
>> Hello,
>>
>> I run an Odroid-c2 with newest kernel 5.10.0-rc5
>> usb recognises usb devices only when they are plugged in before boot.
>> after boot plugged in devices get not recognized.
>>
>> Any idea where to search for a fix?
> there are two answers to this:
> - this was fixed two years ago with upstream commit cc10ce0c51b13d [0]
> - I think it broke again. off-list I received a hint from a user that
> setting kernel cmdline parameter usbcore.autosuspend=-1 works around
> this issue. can you please try this? if it fixes USB hotplug for you
> then this needs to be reported to the USB maintainers
>
>
> Best regards
> Martin
>
>
> [0] https://github.com/torvalds/linux/commit/cc10ce0c51b13d1566d0ec1dcb472fb86330b391
>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-05 17:40   ` Otto Meier
@ 2020-12-05 19:55     ` Martin Blumenstingl
  2020-12-07 12:19         ` Otto Meier
  0 siblings, 1 reply; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-05 19:55 UTC (permalink / raw)
  To: Otto Meier; +Cc: linux-amlogic

Hi Otto,

On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>
> Hi Martin,
>
> i have tried your second notice. but it does'nt solve the issue.
> if at leased on device is pluged in new devices are detected. if
> all devices have been removed, no new device will be detected anymore.
thanks for trying this out and for reporting back.
can you please also test if running "lsusb -vvv" (as root) makes the
devices show up?

background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
uses a "dwc2" USB 2.0 controller.
I don't have any GXBB based board, but my Odroid-C1+ uses the same
controller and overall setup. There I can reproduce the problem you
are seeing.

I am not sure which part of the "infrastructure" (on-board 4-port USB
hub, dwc2 controller, ...) is causing this issue.
My suggestion is to involve the linux-usb mailing list and dwc2 driver
maintainer:
- Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
- linux-usb@vger.kernel.org (usb mailing list)

In the past they provided information and helped to debug issues.
Please also keep me Cc'ed so I can help with any Amlogic specific
questions, drivers, etc.


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-05 19:55     ` Martin Blumenstingl
@ 2020-12-07 12:19         ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-07 12:19 UTC (permalink / raw)
  To: u-boot

Hi Martin,


I did a lot of googling this weekend and found some interesting problems with
odroid-c2.

1. booting from emmc stop after u-boot 2020.04 (this hits me also)
2. usb did not work with newer kernels.

This gaves me the idea that something in the configuration of the s905 soc
is not ok.

here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html

in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.

i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
rendered the situation for odroid-c2 bad.

i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
a try ad it fixes the odroid-c2 boot issue.

--- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 17:20:04.624193561 +0100
+++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 17:23:18.472088934 +0100
@@ -403,36 +403,33 @@
                         gpio-ranges = <&pinctrl_periphs 0 0 119>;
                 };
  
-               emmc_pins: emmc {
-                       mux-0 {
-                               groups = "emmc_nand_d07",
-                                      "emmc_cmd";
-                               function = "emmc";
-                               bias-pull-up;
-                       };
  
-                       mux-1 {
-                               groups = "emmc_clk";
-                               function = "emmc";
-                               bias-disable;
-                       };
-               };
+                emmc_pins: emmc {
+                        mux {
+                                groups = "emmc_nand_d07",
+                                       "emmc_cmd",
+                                       "emmc_clk";
+                                function = "emmc";
+                        };
+                };
  
-               emmc_ds_pins: emmc-ds {
-                       mux {
-                               groups = "emmc_ds";
-                               function = "emmc";
-                               bias-pull-down;
-                       };
-               };
+                emmc_ds_pins: emmc-ds {
+                        mux {
+                                groups = "emmc_ds";
+                                function = "emmc";
+                        };
+                };
  
-               emmc_clk_gate_pins: emmc_clk_gate {
-                       mux {
-                               groups = "BOOT_8";
-                               function = "gpio_periphs";
-                               bias-pull-down;
-                       };
-               };
+                emmc_clk_gate_pins: emmc_clk_gate {
+                        mux {
+                                groups = "BOOT_8";
+                                function = "gpio_periphs";
+                        };
+                        cfg-pull-down {
+                                pins = "BOOT_8";
+                                bias-pull-down;
+                        };
+                };
  
                 nor_pins: nor {
                         mux {



So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
USB does hotplugging as expected.

For me this make it work again. But i`m sorry, I don?t know what would be a real fix.






Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
> Hi Otto,
> 
> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>
>> Hi Martin,
>>
>> i have tried your second notice. but it does'nt solve the issue.
>> if at leased on device is pluged in new devices are detected. if
>> all devices have been removed, no new device will be detected anymore.
> thanks for trying this out and for reporting back.
> can you please also test if running "lsusb -vvv" (as root) makes the
> devices show up?
> 
> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
> uses a "dwc2" USB 2.0 controller.
> I don't have any GXBB based board, but my Odroid-C1+ uses the same
> controller and overall setup. There I can reproduce the problem you
> are seeing.
> 
> I am not sure which part of the "infrastructure" (on-board 4-port USB
> hub, dwc2 controller, ...) is causing this issue.
> My suggestion is to involve the linux-usb mailing list and dwc2 driver
> maintainer:
> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
> - linux-usb at vger.kernel.org (usb mailing list)
> 
> In the past they provided information and helped to debug issues.
> Please also keep me Cc'ed so I can help with any Amlogic specific
> questions, drivers, etc.
> 
> 
> Best regards,
> Martin
> 

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-07 12:19         ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-07 12:19 UTC (permalink / raw)
  To: Martin Blumenstingl; +Cc: linux-amlogic, U-Boot Mailing List

Hi Martin,


I did a lot of googling this weekend and found some interesting problems with
odroid-c2.

1. booting from emmc stop after u-boot 2020.04 (this hits me also)
2. usb did not work with newer kernels.

This gaves me the idea that something in the configuration of the s905 soc
is not ok.

here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html

in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.

i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
rendered the situation for odroid-c2 bad.

i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
a try ad it fixes the odroid-c2 boot issue.

--- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 17:20:04.624193561 +0100
+++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 17:23:18.472088934 +0100
@@ -403,36 +403,33 @@
                         gpio-ranges = <&pinctrl_periphs 0 0 119>;
                 };
  
-               emmc_pins: emmc {
-                       mux-0 {
-                               groups = "emmc_nand_d07",
-                                      "emmc_cmd";
-                               function = "emmc";
-                               bias-pull-up;
-                       };
  
-                       mux-1 {
-                               groups = "emmc_clk";
-                               function = "emmc";
-                               bias-disable;
-                       };
-               };
+                emmc_pins: emmc {
+                        mux {
+                                groups = "emmc_nand_d07",
+                                       "emmc_cmd",
+                                       "emmc_clk";
+                                function = "emmc";
+                        };
+                };
  
-               emmc_ds_pins: emmc-ds {
-                       mux {
-                               groups = "emmc_ds";
-                               function = "emmc";
-                               bias-pull-down;
-                       };
-               };
+                emmc_ds_pins: emmc-ds {
+                        mux {
+                                groups = "emmc_ds";
+                                function = "emmc";
+                        };
+                };
  
-               emmc_clk_gate_pins: emmc_clk_gate {
-                       mux {
-                               groups = "BOOT_8";
-                               function = "gpio_periphs";
-                               bias-pull-down;
-                       };
-               };
+                emmc_clk_gate_pins: emmc_clk_gate {
+                        mux {
+                                groups = "BOOT_8";
+                                function = "gpio_periphs";
+                        };
+                        cfg-pull-down {
+                                pins = "BOOT_8";
+                                bias-pull-down;
+                        };
+                };
  
                 nor_pins: nor {
                         mux {



So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
USB does hotplugging as expected.

For me this make it work again. But i`m sorry, I don´t know what would be a real fix.






Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
> Hi Otto,
> 
> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>
>> Hi Martin,
>>
>> i have tried your second notice. but it does'nt solve the issue.
>> if at leased on device is pluged in new devices are detected. if
>> all devices have been removed, no new device will be detected anymore.
> thanks for trying this out and for reporting back.
> can you please also test if running "lsusb -vvv" (as root) makes the
> devices show up?
> 
> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
> uses a "dwc2" USB 2.0 controller.
> I don't have any GXBB based board, but my Odroid-C1+ uses the same
> controller and overall setup. There I can reproduce the problem you
> are seeing.
> 
> I am not sure which part of the "infrastructure" (on-board 4-port USB
> hub, dwc2 controller, ...) is causing this issue.
> My suggestion is to involve the linux-usb mailing list and dwc2 driver
> maintainer:
> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
> - linux-usb@vger.kernel.org (usb mailing list)
> 
> In the past they provided information and helped to debug issues.
> Please also keep me Cc'ed so I can help with any Amlogic specific
> questions, drivers, etc.
> 
> 
> Best regards,
> Martin
> 

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-07 12:19         ` Otto Meier
  (?)
@ 2020-12-07 12:29           ` Neil Armstrong
  -1 siblings, 0 replies; 42+ messages in thread
From: Neil Armstrong @ 2020-12-07 12:29 UTC (permalink / raw)
  To: u-boot

Hi,

(Please CC u-boot-amlogic at groups.io when U-Boot is concerned)

On 07/12/2020 13:19, Otto Meier wrote:
> Hi Martin,
> 
> 
> I did a lot of googling this weekend and found some interesting problems with
> odroid-c2.
> 
> 1. booting from emmc stop after u-boot 2020.04 (this hits me also)

Indeed, this already has been reported, but the root cause is unknown

> 2. usb did not work with newer kernels.
> 
> This gaves me the idea that something in the configuration of the s905 soc
> is not ok.
> 
> here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
> and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html
> 
> in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.
> 
> i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
> rendered the situation for odroid-c2 bad.
> 
> i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
> a try ad it fixes the odroid-c2 boot issue.
> 
> --- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig??????? 2020-11-27 17:20:04.624193561 +0100
> +++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi???? 2020-11-27 17:23:18.472088934 +0100
> @@ -403,36 +403,33 @@
> ??????????????????????? gpio-ranges = <&pinctrl_periphs 0 0 119>;
> ??????????????? };
> ?
> -?????????????? emmc_pins: emmc {
> -?????????????????????? mux-0 {
> -?????????????????????????????? groups = "emmc_nand_d07",
> -????????????????????????????????????? "emmc_cmd";
> -?????????????????????????????? function = "emmc";
> -?????????????????????????????? bias-pull-up;
> -?????????????????????? };
> ?
> -?????????????????????? mux-1 {
> -?????????????????????????????? groups = "emmc_clk";
> -?????????????????????????????? function = "emmc";
> -?????????????????????????????? bias-disable;
> -?????????????????????? };
> -?????????????? };
> +??????????????? emmc_pins: emmc {
> +??????????????????????? mux {
> +??????????????????????????????? groups = "emmc_nand_d07",
> +?????????????????????????????????????? "emmc_cmd",
> +?????????????????????????????????????? "emmc_clk";
> +??????????????????????????????? function = "emmc";
> +??????????????????????? };
> +??????????????? };
> ?
> -?????????????? emmc_ds_pins: emmc-ds {
> -?????????????????????? mux {
> -?????????????????????????????? groups = "emmc_ds";
> -?????????????????????????????? function = "emmc";
> -?????????????????????????????? bias-pull-down;
> -?????????????????????? };
> -?????????????? };
> +??????????????? emmc_ds_pins: emmc-ds {
> +??????????????????????? mux {
> +??????????????????????????????? groups = "emmc_ds";
> +??????????????????????????????? function = "emmc";
> +??????????????????????? };
> +??????????????? };
> ?
> -?????????????? emmc_clk_gate_pins: emmc_clk_gate {
> -?????????????????????? mux {
> -?????????????????????????????? groups = "BOOT_8";
> -?????????????????????????????? function = "gpio_periphs";
> -?????????????????????????????? bias-pull-down;
> -?????????????????????? };
> -?????????????? };
> +??????????????? emmc_clk_gate_pins: emmc_clk_gate {
> +??????????????????????? mux {
> +??????????????????????????????? groups = "BOOT_8";
> +??????????????????????????????? function = "gpio_periphs";
> +??????????????????????? };
> +??????????????????????? cfg-pull-down {
> +??????????????????????????????? pins = "BOOT_8";
> +??????????????????????????????? bias-pull-down;
> +??????????????????????? };
> +??????????????? };
> ?
> ??????????????? nor_pins: nor {
> ??????????????????????? mux {
> 
> 
> 
> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> USB does hotplugging as expected.

So, this fixes USB under Linux ?? It's not clear

Neil

> 
> For me this make it work again. But i`m sorry, I don?t know what would be a real fix.
> 
> 
> 
> 
> 
> 
> Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
>> Hi Otto,
>>
>> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>>
>>> Hi Martin,
>>>
>>> i have tried your second notice. but it does'nt solve the issue.
>>> if at leased on device is pluged in new devices are detected. if
>>> all devices have been removed, no new device will be detected anymore.
>> thanks for trying this out and for reporting back.
>> can you please also test if running "lsusb -vvv" (as root) makes the
>> devices show up?
>>
>> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
>> uses a "dwc2" USB 2.0 controller.
>> I don't have any GXBB based board, but my Odroid-C1+ uses the same
>> controller and overall setup. There I can reproduce the problem you
>> are seeing.
>>
>> I am not sure which part of the "infrastructure" (on-board 4-port USB
>> hub, dwc2 controller, ...) is causing this issue.
>> My suggestion is to involve the linux-usb mailing list and dwc2 driver
>> maintainer:
>> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
>> - linux-usb at vger.kernel.org (usb mailing list)
>>
>> In the past they provided information and helped to debug issues.
>> Please also keep me Cc'ed so I can help with any Amlogic specific
>> questions, drivers, etc.
>>
>>
>> Best regards,
>> Martin
>>

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-07 12:29           ` Neil Armstrong
  0 siblings, 0 replies; 42+ messages in thread
From: Neil Armstrong @ 2020-12-07 12:29 UTC (permalink / raw)
  To: Otto Meier, Martin Blumenstingl
  Cc: linux-amlogic, u-boot-amlogic, U-Boot Mailing List

Hi,

(Please CC u-boot-amlogic@groups.io when U-Boot is concerned)

On 07/12/2020 13:19, Otto Meier wrote:
> Hi Martin,
> 
> 
> I did a lot of googling this weekend and found some interesting problems with
> odroid-c2.
> 
> 1. booting from emmc stop after u-boot 2020.04 (this hits me also)

Indeed, this already has been reported, but the root cause is unknown

> 2. usb did not work with newer kernels.
> 
> This gaves me the idea that something in the configuration of the s905 soc
> is not ok.
> 
> here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
> and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html
> 
> in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.
> 
> i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
> rendered the situation for odroid-c2 bad.
> 
> i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
> a try ad it fixes the odroid-c2 boot issue.
> 
> --- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 17:20:04.624193561 +0100
> +++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 17:23:18.472088934 +0100
> @@ -403,36 +403,33 @@
>                         gpio-ranges = <&pinctrl_periphs 0 0 119>;
>                 };
>  
> -               emmc_pins: emmc {
> -                       mux-0 {
> -                               groups = "emmc_nand_d07",
> -                                      "emmc_cmd";
> -                               function = "emmc";
> -                               bias-pull-up;
> -                       };
>  
> -                       mux-1 {
> -                               groups = "emmc_clk";
> -                               function = "emmc";
> -                               bias-disable;
> -                       };
> -               };
> +                emmc_pins: emmc {
> +                        mux {
> +                                groups = "emmc_nand_d07",
> +                                       "emmc_cmd",
> +                                       "emmc_clk";
> +                                function = "emmc";
> +                        };
> +                };
>  
> -               emmc_ds_pins: emmc-ds {
> -                       mux {
> -                               groups = "emmc_ds";
> -                               function = "emmc";
> -                               bias-pull-down;
> -                       };
> -               };
> +                emmc_ds_pins: emmc-ds {
> +                        mux {
> +                                groups = "emmc_ds";
> +                                function = "emmc";
> +                        };
> +                };
>  
> -               emmc_clk_gate_pins: emmc_clk_gate {
> -                       mux {
> -                               groups = "BOOT_8";
> -                               function = "gpio_periphs";
> -                               bias-pull-down;
> -                       };
> -               };
> +                emmc_clk_gate_pins: emmc_clk_gate {
> +                        mux {
> +                                groups = "BOOT_8";
> +                                function = "gpio_periphs";
> +                        };
> +                        cfg-pull-down {
> +                                pins = "BOOT_8";
> +                                bias-pull-down;
> +                        };
> +                };
>  
>                 nor_pins: nor {
>                         mux {
> 
> 
> 
> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> USB does hotplugging as expected.

So, this fixes USB under Linux ?? It's not clear

Neil

> 
> For me this make it work again. But i`m sorry, I don´t know what would be a real fix.
> 
> 
> 
> 
> 
> 
> Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
>> Hi Otto,
>>
>> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>>
>>> Hi Martin,
>>>
>>> i have tried your second notice. but it does'nt solve the issue.
>>> if at leased on device is pluged in new devices are detected. if
>>> all devices have been removed, no new device will be detected anymore.
>> thanks for trying this out and for reporting back.
>> can you please also test if running "lsusb -vvv" (as root) makes the
>> devices show up?
>>
>> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
>> uses a "dwc2" USB 2.0 controller.
>> I don't have any GXBB based board, but my Odroid-C1+ uses the same
>> controller and overall setup. There I can reproduce the problem you
>> are seeing.
>>
>> I am not sure which part of the "infrastructure" (on-board 4-port USB
>> hub, dwc2 controller, ...) is causing this issue.
>> My suggestion is to involve the linux-usb mailing list and dwc2 driver
>> maintainer:
>> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
>> - linux-usb@vger.kernel.org (usb mailing list)
>>
>> In the past they provided information and helped to debug issues.
>> Please also keep me Cc'ed so I can help with any Amlogic specific
>> questions, drivers, etc.
>>
>>
>> Best regards,
>> Martin
>>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-07 12:29           ` Neil Armstrong
  0 siblings, 0 replies; 42+ messages in thread
From: Neil Armstrong @ 2020-12-07 12:29 UTC (permalink / raw)
  To: Otto Meier, Martin Blumenstingl
  Cc: linux-amlogic, U-Boot Mailing List, u-boot-amlogic

Hi,

(Please CC u-boot-amlogic@groups.io when U-Boot is concerned)

On 07/12/2020 13:19, Otto Meier wrote:
> Hi Martin,
> 
> 
> I did a lot of googling this weekend and found some interesting problems with
> odroid-c2.
> 
> 1. booting from emmc stop after u-boot 2020.04 (this hits me also)

Indeed, this already has been reported, but the root cause is unknown

> 2. usb did not work with newer kernels.
> 
> This gaves me the idea that something in the configuration of the s905 soc
> is not ok.
> 
> here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
> and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html
> 
> in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.
> 
> i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
> rendered the situation for odroid-c2 bad.
> 
> i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
> a try ad it fixes the odroid-c2 boot issue.
> 
> --- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 17:20:04.624193561 +0100
> +++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 17:23:18.472088934 +0100
> @@ -403,36 +403,33 @@
>                         gpio-ranges = <&pinctrl_periphs 0 0 119>;
>                 };
>  
> -               emmc_pins: emmc {
> -                       mux-0 {
> -                               groups = "emmc_nand_d07",
> -                                      "emmc_cmd";
> -                               function = "emmc";
> -                               bias-pull-up;
> -                       };
>  
> -                       mux-1 {
> -                               groups = "emmc_clk";
> -                               function = "emmc";
> -                               bias-disable;
> -                       };
> -               };
> +                emmc_pins: emmc {
> +                        mux {
> +                                groups = "emmc_nand_d07",
> +                                       "emmc_cmd",
> +                                       "emmc_clk";
> +                                function = "emmc";
> +                        };
> +                };
>  
> -               emmc_ds_pins: emmc-ds {
> -                       mux {
> -                               groups = "emmc_ds";
> -                               function = "emmc";
> -                               bias-pull-down;
> -                       };
> -               };
> +                emmc_ds_pins: emmc-ds {
> +                        mux {
> +                                groups = "emmc_ds";
> +                                function = "emmc";
> +                        };
> +                };
>  
> -               emmc_clk_gate_pins: emmc_clk_gate {
> -                       mux {
> -                               groups = "BOOT_8";
> -                               function = "gpio_periphs";
> -                               bias-pull-down;
> -                       };
> -               };
> +                emmc_clk_gate_pins: emmc_clk_gate {
> +                        mux {
> +                                groups = "BOOT_8";
> +                                function = "gpio_periphs";
> +                        };
> +                        cfg-pull-down {
> +                                pins = "BOOT_8";
> +                                bias-pull-down;
> +                        };
> +                };
>  
>                 nor_pins: nor {
>                         mux {
> 
> 
> 
> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> USB does hotplugging as expected.

So, this fixes USB under Linux ?? It's not clear

Neil

> 
> For me this make it work again. But i`m sorry, I don´t know what would be a real fix.
> 
> 
> 
> 
> 
> 
> Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
>> Hi Otto,
>>
>> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>>
>>> Hi Martin,
>>>
>>> i have tried your second notice. but it does'nt solve the issue.
>>> if at leased on device is pluged in new devices are detected. if
>>> all devices have been removed, no new device will be detected anymore.
>> thanks for trying this out and for reporting back.
>> can you please also test if running "lsusb -vvv" (as root) makes the
>> devices show up?
>>
>> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
>> uses a "dwc2" USB 2.0 controller.
>> I don't have any GXBB based board, but my Odroid-C1+ uses the same
>> controller and overall setup. There I can reproduce the problem you
>> are seeing.
>>
>> I am not sure which part of the "infrastructure" (on-board 4-port USB
>> hub, dwc2 controller, ...) is causing this issue.
>> My suggestion is to involve the linux-usb mailing list and dwc2 driver
>> maintainer:
>> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
>> - linux-usb@vger.kernel.org (usb mailing list)
>>
>> In the past they provided information and helped to debug issues.
>> Please also keep me Cc'ed so I can help with any Amlogic specific
>> questions, drivers, etc.
>>
>>
>> Best regards,
>> Martin
>>


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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-07 12:29           ` Neil Armstrong
  (?)
@ 2020-12-07 12:43             ` Otto Meier
  -1 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-07 12:43 UTC (permalink / raw)
  To: u-boot



Am 07.12.20 um 13:29 schrieb Neil Armstrong:
> Hi,
> 
> (Please CC u-boot-amlogic at groups.io when U-Boot is concerned)
> 
> On 07/12/2020 13:19, Otto Meier wrote:
>> Hi Martin,
>>
>>
>> I did a lot of googling this weekend and found some interesting problems with
>> odroid-c2.
>>
>> 1. booting from emmc stop after u-boot 2020.04 (this hits me also)
> 
> Indeed, this already has been reported, but the root cause is unknown
> 
>> 2. usb did not work with newer kernels.
>>
>> This gaves me the idea that something in the configuration of the s905 soc
>> is not ok.
>>
>> here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
>> and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html
>>
>> in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.
>>
>> i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
>> rendered the situation for odroid-c2 bad.
>>
>> i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
>> a try ad it fixes the odroid-c2 boot issue.
>>
>> --- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig??????? 2020-11-27 17:20:04.624193561 +0100
>> +++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi???? 2020-11-27 17:23:18.472088934 +0100
>> @@ -403,36 +403,33 @@
>>  ??????????????????????? gpio-ranges = <&pinctrl_periphs 0 0 119>;
>>  ??????????????? };
>>   
>> -?????????????? emmc_pins: emmc {
>> -?????????????????????? mux-0 {
>> -?????????????????????????????? groups = "emmc_nand_d07",
>> -????????????????????????????????????? "emmc_cmd";
>> -?????????????????????????????? function = "emmc";
>> -?????????????????????????????? bias-pull-up;
>> -?????????????????????? };
>>   
>> -?????????????????????? mux-1 {
>> -?????????????????????????????? groups = "emmc_clk";
>> -?????????????????????????????? function = "emmc";
>> -?????????????????????????????? bias-disable;
>> -?????????????????????? };
>> -?????????????? };
>> +??????????????? emmc_pins: emmc {
>> +??????????????????????? mux {
>> +??????????????????????????????? groups = "emmc_nand_d07",
>> +?????????????????????????????????????? "emmc_cmd",
>> +?????????????????????????????????????? "emmc_clk";
>> +??????????????????????????????? function = "emmc";
>> +??????????????????????? };
>> +??????????????? };
>>   
>> -?????????????? emmc_ds_pins: emmc-ds {
>> -?????????????????????? mux {
>> -?????????????????????????????? groups = "emmc_ds";
>> -?????????????????????????????? function = "emmc";
>> -?????????????????????????????? bias-pull-down;
>> -?????????????????????? };
>> -?????????????? };
>> +??????????????? emmc_ds_pins: emmc-ds {
>> +??????????????????????? mux {
>> +??????????????????????????????? groups = "emmc_ds";
>> +??????????????????????????????? function = "emmc";
>> +??????????????????????? };
>> +??????????????? };
>>   
>> -?????????????? emmc_clk_gate_pins: emmc_clk_gate {
>> -?????????????????????? mux {
>> -?????????????????????????????? groups = "BOOT_8";
>> -?????????????????????????????? function = "gpio_periphs";
>> -?????????????????????????????? bias-pull-down;
>> -?????????????????????? };
>> -?????????????? };
>> +??????????????? emmc_clk_gate_pins: emmc_clk_gate {
>> +??????????????????????? mux {
>> +??????????????????????????????? groups = "BOOT_8";
>> +??????????????????????????????? function = "gpio_periphs";
>> +??????????????????????? };
>> +??????????????????????? cfg-pull-down {
>> +??????????????????????????????? pins = "BOOT_8";
>> +??????????????????????????????? bias-pull-down;
>> +??????????????????????? };
>> +??????????????? };
>>   
>>  ??????????????? nor_pins: nor {
>>  ??????????????????????? mux {
>>
>>
>>
>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>> USB does hotplugging as expected.
> 
> So, this fixes USB under Linux ?? It's not clear
> 
> Neil

The above patch fixes booting from emmc for me.
Using a newer uboot then 2020.04 is mandatory for using the above mentioned kernel.
The usb issue, i had with earlier kernels from the above mentioned tree.

Hope that clearifies it. I wanted to run the newest kernel on my system which boots from emmc.
I think these issues are probaly independant but in my system they did interfere.

Best regards
Otto

> 
>>
>> For me this make it work again. But i`m sorry, I don?t know what would be a real fix.
>>
>>
>>
>>
>>
>>
>> Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
>>> Hi Otto,
>>>
>>> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>>>
>>>> Hi Martin,
>>>>
>>>> i have tried your second notice. but it does'nt solve the issue.
>>>> if at leased on device is pluged in new devices are detected. if
>>>> all devices have been removed, no new device will be detected anymore.
>>> thanks for trying this out and for reporting back.
>>> can you please also test if running "lsusb -vvv" (as root) makes the
>>> devices show up?
>>>
>>> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
>>> uses a "dwc2" USB 2.0 controller.
>>> I don't have any GXBB based board, but my Odroid-C1+ uses the same
>>> controller and overall setup. There I can reproduce the problem you
>>> are seeing.
>>>
>>> I am not sure which part of the "infrastructure" (on-board 4-port USB
>>> hub, dwc2 controller, ...) is causing this issue.
>>> My suggestion is to involve the linux-usb mailing list and dwc2 driver
>>> maintainer:
>>> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
>>> - linux-usb at vger.kernel.org (usb mailing list)
>>>
>>> In the past they provided information and helped to debug issues.
>>> Please also keep me Cc'ed so I can help with any Amlogic specific
>>> questions, drivers, etc.
>>>
>>>
>>> Best regards,
>>> Martin
>>>
> 
> 

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-07 12:43             ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-07 12:43 UTC (permalink / raw)
  To: Neil Armstrong, Martin Blumenstingl
  Cc: linux-amlogic, u-boot-amlogic, U-Boot Mailing List



Am 07.12.20 um 13:29 schrieb Neil Armstrong:
> Hi,
> 
> (Please CC u-boot-amlogic@groups.io when U-Boot is concerned)
> 
> On 07/12/2020 13:19, Otto Meier wrote:
>> Hi Martin,
>>
>>
>> I did a lot of googling this weekend and found some interesting problems with
>> odroid-c2.
>>
>> 1. booting from emmc stop after u-boot 2020.04 (this hits me also)
> 
> Indeed, this already has been reported, but the root cause is unknown
> 
>> 2. usb did not work with newer kernels.
>>
>> This gaves me the idea that something in the configuration of the s905 soc
>> is not ok.
>>
>> here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
>> and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html
>>
>> in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.
>>
>> i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
>> rendered the situation for odroid-c2 bad.
>>
>> i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
>> a try ad it fixes the odroid-c2 boot issue.
>>
>> --- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 17:20:04.624193561 +0100
>> +++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 17:23:18.472088934 +0100
>> @@ -403,36 +403,33 @@
>>                          gpio-ranges = <&pinctrl_periphs 0 0 119>;
>>                  };
>>   
>> -               emmc_pins: emmc {
>> -                       mux-0 {
>> -                               groups = "emmc_nand_d07",
>> -                                      "emmc_cmd";
>> -                               function = "emmc";
>> -                               bias-pull-up;
>> -                       };
>>   
>> -                       mux-1 {
>> -                               groups = "emmc_clk";
>> -                               function = "emmc";
>> -                               bias-disable;
>> -                       };
>> -               };
>> +                emmc_pins: emmc {
>> +                        mux {
>> +                                groups = "emmc_nand_d07",
>> +                                       "emmc_cmd",
>> +                                       "emmc_clk";
>> +                                function = "emmc";
>> +                        };
>> +                };
>>   
>> -               emmc_ds_pins: emmc-ds {
>> -                       mux {
>> -                               groups = "emmc_ds";
>> -                               function = "emmc";
>> -                               bias-pull-down;
>> -                       };
>> -               };
>> +                emmc_ds_pins: emmc-ds {
>> +                        mux {
>> +                                groups = "emmc_ds";
>> +                                function = "emmc";
>> +                        };
>> +                };
>>   
>> -               emmc_clk_gate_pins: emmc_clk_gate {
>> -                       mux {
>> -                               groups = "BOOT_8";
>> -                               function = "gpio_periphs";
>> -                               bias-pull-down;
>> -                       };
>> -               };
>> +                emmc_clk_gate_pins: emmc_clk_gate {
>> +                        mux {
>> +                                groups = "BOOT_8";
>> +                                function = "gpio_periphs";
>> +                        };
>> +                        cfg-pull-down {
>> +                                pins = "BOOT_8";
>> +                                bias-pull-down;
>> +                        };
>> +                };
>>   
>>                  nor_pins: nor {
>>                          mux {
>>
>>
>>
>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>> USB does hotplugging as expected.
> 
> So, this fixes USB under Linux ?? It's not clear
> 
> Neil

The above patch fixes booting from emmc for me.
Using a newer uboot then 2020.04 is mandatory for using the above mentioned kernel.
The usb issue, i had with earlier kernels from the above mentioned tree.

Hope that clearifies it. I wanted to run the newest kernel on my system which boots from emmc.
I think these issues are probaly independant but in my system they did interfere.

Best regards
Otto

> 
>>
>> For me this make it work again. But i`m sorry, I don´t know what would be a real fix.
>>
>>
>>
>>
>>
>>
>> Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
>>> Hi Otto,
>>>
>>> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>>>
>>>> Hi Martin,
>>>>
>>>> i have tried your second notice. but it does'nt solve the issue.
>>>> if at leased on device is pluged in new devices are detected. if
>>>> all devices have been removed, no new device will be detected anymore.
>>> thanks for trying this out and for reporting back.
>>> can you please also test if running "lsusb -vvv" (as root) makes the
>>> devices show up?
>>>
>>> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
>>> uses a "dwc2" USB 2.0 controller.
>>> I don't have any GXBB based board, but my Odroid-C1+ uses the same
>>> controller and overall setup. There I can reproduce the problem you
>>> are seeing.
>>>
>>> I am not sure which part of the "infrastructure" (on-board 4-port USB
>>> hub, dwc2 controller, ...) is causing this issue.
>>> My suggestion is to involve the linux-usb mailing list and dwc2 driver
>>> maintainer:
>>> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
>>> - linux-usb@vger.kernel.org (usb mailing list)
>>>
>>> In the past they provided information and helped to debug issues.
>>> Please also keep me Cc'ed so I can help with any Amlogic specific
>>> questions, drivers, etc.
>>>
>>>
>>> Best regards,
>>> Martin
>>>
> 
> 

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-07 12:43             ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-07 12:43 UTC (permalink / raw)
  To: Neil Armstrong, Martin Blumenstingl
  Cc: linux-amlogic, U-Boot Mailing List, u-boot-amlogic



Am 07.12.20 um 13:29 schrieb Neil Armstrong:
> Hi,
> 
> (Please CC u-boot-amlogic@groups.io when U-Boot is concerned)
> 
> On 07/12/2020 13:19, Otto Meier wrote:
>> Hi Martin,
>>
>>
>> I did a lot of googling this weekend and found some interesting problems with
>> odroid-c2.
>>
>> 1. booting from emmc stop after u-boot 2020.04 (this hits me also)
> 
> Indeed, this already has been reported, but the root cause is unknown
> 
>> 2. usb did not work with newer kernels.
>>
>> This gaves me the idea that something in the configuration of the s905 soc
>> is not ok.
>>
>> here: https://forum.libreelec.tv/thread/12330-balbes150-le-images-with-kodi-19-for-s9xxx/?postID=147212#post147212
>> and here: https://lists.denx.de/pipermail/u-boot/2020-November/thread.html
>>
>> in https://groups.io/g/u-boot-amlogic/topic/77816805#661 some problems in pinctrl related to booting from emmc is discussed.
>>
>> i found that commit dd5f2351e99aad8fcbedbc1305b8b51b09952336 of u-boot
>> rendered the situation for odroid-c2 bad.
>>
>> i gave the following patch on Top of commit ee1e04558ff8c8ed812b986939447f129bb0b0bb of u-boot
>> a try ad it fixes the odroid-c2 boot issue.
>>
>> --- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 17:20:04.624193561 +0100
>> +++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 17:23:18.472088934 +0100
>> @@ -403,36 +403,33 @@
>>                          gpio-ranges = <&pinctrl_periphs 0 0 119>;
>>                  };
>>   
>> -               emmc_pins: emmc {
>> -                       mux-0 {
>> -                               groups = "emmc_nand_d07",
>> -                                      "emmc_cmd";
>> -                               function = "emmc";
>> -                               bias-pull-up;
>> -                       };
>>   
>> -                       mux-1 {
>> -                               groups = "emmc_clk";
>> -                               function = "emmc";
>> -                               bias-disable;
>> -                       };
>> -               };
>> +                emmc_pins: emmc {
>> +                        mux {
>> +                                groups = "emmc_nand_d07",
>> +                                       "emmc_cmd",
>> +                                       "emmc_clk";
>> +                                function = "emmc";
>> +                        };
>> +                };
>>   
>> -               emmc_ds_pins: emmc-ds {
>> -                       mux {
>> -                               groups = "emmc_ds";
>> -                               function = "emmc";
>> -                               bias-pull-down;
>> -                       };
>> -               };
>> +                emmc_ds_pins: emmc-ds {
>> +                        mux {
>> +                                groups = "emmc_ds";
>> +                                function = "emmc";
>> +                        };
>> +                };
>>   
>> -               emmc_clk_gate_pins: emmc_clk_gate {
>> -                       mux {
>> -                               groups = "BOOT_8";
>> -                               function = "gpio_periphs";
>> -                               bias-pull-down;
>> -                       };
>> -               };
>> +                emmc_clk_gate_pins: emmc_clk_gate {
>> +                        mux {
>> +                                groups = "BOOT_8";
>> +                                function = "gpio_periphs";
>> +                        };
>> +                        cfg-pull-down {
>> +                                pins = "BOOT_8";
>> +                                bias-pull-down;
>> +                        };
>> +                };
>>   
>>                  nor_pins: nor {
>>                          mux {
>>
>>
>>
>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>> USB does hotplugging as expected.
> 
> So, this fixes USB under Linux ?? It's not clear
> 
> Neil

The above patch fixes booting from emmc for me.
Using a newer uboot then 2020.04 is mandatory for using the above mentioned kernel.
The usb issue, i had with earlier kernels from the above mentioned tree.

Hope that clearifies it. I wanted to run the newest kernel on my system which boots from emmc.
I think these issues are probaly independant but in my system they did interfere.

Best regards
Otto

> 
>>
>> For me this make it work again. But i`m sorry, I don´t know what would be a real fix.
>>
>>
>>
>>
>>
>>
>> Am 05.12.20 um 20:55 schrieb Martin Blumenstingl:
>>> Hi Otto,
>>>
>>> On Sat, Dec 5, 2020 at 6:40 PM Otto Meier <gf435@gmx.net> wrote:
>>>>
>>>> Hi Martin,
>>>>
>>>> i have tried your second notice. but it does'nt solve the issue.
>>>> if at leased on device is pluged in new devices are detected. if
>>>> all devices have been removed, no new device will be detected anymore.
>>> thanks for trying this out and for reporting back.
>>> can you please also test if running "lsusb -vvv" (as root) makes the
>>> devices show up?
>>>
>>> background info: the Amlogic Meson GXBB SoC on your Odroid-C2 board
>>> uses a "dwc2" USB 2.0 controller.
>>> I don't have any GXBB based board, but my Odroid-C1+ uses the same
>>> controller and overall setup. There I can reproduce the problem you
>>> are seeing.
>>>
>>> I am not sure which part of the "infrastructure" (on-board 4-port USB
>>> hub, dwc2 controller, ...) is causing this issue.
>>> My suggestion is to involve the linux-usb mailing list and dwc2 driver
>>> maintainer:
>>> - Minas Harutyunyan <hminas@synopsys.com> (dwc2 driver maintainer)
>>> - linux-usb@vger.kernel.org (usb mailing list)
>>>
>>> In the past they provided information and helped to debug issues.
>>> Please also keep me Cc'ed so I can help with any Amlogic specific
>>> questions, drivers, etc.
>>>
>>>
>>> Best regards,
>>> Martin
>>>
> 
> 

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-07 12:43             ` Otto Meier
  (?)
@ 2020-12-13 18:46               ` Martin Blumenstingl
  -1 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-13 18:46 UTC (permalink / raw)
  To: u-boot

Hi Otto,

On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
[...]
> >> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> >> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> >> USB does hotplugging as expected.
> >
> > So, this fixes USB under Linux ?? It's not clear
if you have time it would be great if you could figure out which of
the patches from Christian's tree fixes USB hotplugging for you.
Or is it fixed in Linux 5.10-rcX even without any patches?


Best regards,
Martin

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-13 18:46               ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-13 18:46 UTC (permalink / raw)
  To: Otto Meier
  Cc: U-Boot Mailing List, linux-amlogic, u-boot-amlogic, Neil Armstrong

Hi Otto,

On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
[...]
> >> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> >> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> >> USB does hotplugging as expected.
> >
> > So, this fixes USB under Linux ?? It's not clear
if you have time it would be great if you could figure out which of
the patches from Christian's tree fixes USB hotplugging for you.
Or is it fixed in Linux 5.10-rcX even without any patches?


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-13 18:46               ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-13 18:46 UTC (permalink / raw)
  To: Otto Meier
  Cc: Neil Armstrong, linux-amlogic, U-Boot Mailing List, u-boot-amlogic

Hi Otto,

On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
[...]
> >> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> >> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> >> USB does hotplugging as expected.
> >
> > So, this fixes USB under Linux ?? It's not clear
if you have time it would be great if you could figure out which of
the patches from Christian's tree fixes USB hotplugging for you.
Or is it fixed in Linux 5.10-rcX even without any patches?


Best regards,
Martin

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-13 18:46               ` Martin Blumenstingl
  (?)
@ 2020-12-14 19:33                 ` Otto Meier
  -1 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-14 19:33 UTC (permalink / raw)
  To: u-boot

Hi Martin,

Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> [...]
>>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>>>> USB does hotplugging as expected.
>>> So, this fixes USB under Linux ?? It's not clear
> if you have time it would be great if you could figure out which of
> the patches from Christian's tree fixes USB hotplugging for you.
> Or is it fixed in Linux 5.10-rcX even without any patches?
>
The new mainline kernel 5.10.0 from Linus, without any other patches 
does detect USB hotpluging,
when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS 
2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
and the following u-boot patch:

--- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig??????? 2020-11-27 
17:20:04.624193561 +0100
+++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi???? 2020-11-27 
17:23:18.472088934 +0100
@@ -403,36 +403,33 @@
 ??????????????????????? gpio-ranges = <&pinctrl_periphs 0 0 119>;
 ??????????????? };

-?????????????? emmc_pins: emmc {
-?????????????????????? mux-0 {
-?????????????????????????????? groups = "emmc_nand_d07",
-????????????????????????????????????? "emmc_cmd";
-?????????????????????????????? function = "emmc";
-?????????????????????????????? bias-pull-up;
-?????????????????????? };

-?????????????????????? mux-1 {
-?????????????????????????????? groups = "emmc_clk";
-?????????????????????????????? function = "emmc";
-?????????????????????????????? bias-disable;
-?????????????????????? };
-?????????????? };
+??????????????? emmc_pins: emmc {
+??????????????????????? mux {
+??????????????????????????????? groups = "emmc_nand_d07",
+?????????????????????????????????????? "emmc_cmd",
+?????????????????????????????????????? "emmc_clk";
+??????????????????????????????? function = "emmc";
+??????????????????????? };
+??????????????? };

-?????????????? emmc_ds_pins: emmc-ds {
-?????????????????????? mux {
-?????????????????????????????? groups = "emmc_ds";
-?????????????????????????????? function = "emmc";
-?????????????????????????????? bias-pull-down;
-?????????????????????? };
-?????????????? };
+??????????????? emmc_ds_pins: emmc-ds {
+??????????????????????? mux {
+??????????????????????????????? groups = "emmc_ds";
+??????????????????????????????? function = "emmc";
+??????????????????????? };
+??????????????? };

-?????????????? emmc_clk_gate_pins: emmc_clk_gate {
-?????????????????????? mux {
-?????????????????????????????? groups = "BOOT_8";
-?????????????????????????????? function = "gpio_periphs";
-?????????????????????????????? bias-pull-down;
-?????????????????????? };
-?????????????? };
+??????????????? emmc_clk_gate_pins: emmc_clk_gate {
+??????????????????????? mux {
+??????????????????????????????? groups = "BOOT_8";
+??????????????????????????????? function = "gpio_periphs";
+??????????????????????? };
+??????????????????????? cfg-pull-down {
+??????????????????????????????? pins = "BOOT_8";
+??????????????????????????????? bias-pull-down;
+??????????????????????? };
+??????????????? };

 ??????????????? nor_pins: nor {
 ??????????????????????? mux {

When i use the last unpatched emmc bootable u-boot 2020.04 the kernel 
boots, but usb hotplugging
does not work.

Hope this describes my findings. If i can help further, please give me a 
note.

> Best regards,
> Martin
>
Best regards
Otto

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-14 19:33                 ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-14 19:33 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: U-Boot Mailing List, linux-amlogic, u-boot-amlogic, Neil Armstrong

Hi Martin,

Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> [...]
>>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>>>> USB does hotplugging as expected.
>>> So, this fixes USB under Linux ?? It's not clear
> if you have time it would be great if you could figure out which of
> the patches from Christian's tree fixes USB hotplugging for you.
> Or is it fixed in Linux 5.10-rcX even without any patches?
>
The new mainline kernel 5.10.0 from Linus, without any other patches 
does detect USB hotpluging,
when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS 
2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
and the following u-boot patch:

--- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 
17:20:04.624193561 +0100
+++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 
17:23:18.472088934 +0100
@@ -403,36 +403,33 @@
                         gpio-ranges = <&pinctrl_periphs 0 0 119>;
                 };

-               emmc_pins: emmc {
-                       mux-0 {
-                               groups = "emmc_nand_d07",
-                                      "emmc_cmd";
-                               function = "emmc";
-                               bias-pull-up;
-                       };

-                       mux-1 {
-                               groups = "emmc_clk";
-                               function = "emmc";
-                               bias-disable;
-                       };
-               };
+                emmc_pins: emmc {
+                        mux {
+                                groups = "emmc_nand_d07",
+                                       "emmc_cmd",
+                                       "emmc_clk";
+                                function = "emmc";
+                        };
+                };

-               emmc_ds_pins: emmc-ds {
-                       mux {
-                               groups = "emmc_ds";
-                               function = "emmc";
-                               bias-pull-down;
-                       };
-               };
+                emmc_ds_pins: emmc-ds {
+                        mux {
+                                groups = "emmc_ds";
+                                function = "emmc";
+                        };
+                };

-               emmc_clk_gate_pins: emmc_clk_gate {
-                       mux {
-                               groups = "BOOT_8";
-                               function = "gpio_periphs";
-                               bias-pull-down;
-                       };
-               };
+                emmc_clk_gate_pins: emmc_clk_gate {
+                        mux {
+                                groups = "BOOT_8";
+                                function = "gpio_periphs";
+                        };
+                        cfg-pull-down {
+                                pins = "BOOT_8";
+                                bias-pull-down;
+                        };
+                };

                 nor_pins: nor {
                         mux {

When i use the last unpatched emmc bootable u-boot 2020.04 the kernel 
boots, but usb hotplugging
does not work.

Hope this describes my findings. If i can help further, please give me a 
note.

> Best regards,
> Martin
>
Best regards
Otto


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-14 19:33                 ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-14 19:33 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: Neil Armstrong, linux-amlogic, U-Boot Mailing List, u-boot-amlogic

Hi Martin,

Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> [...]
>>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>>>> USB does hotplugging as expected.
>>> So, this fixes USB under Linux ?? It's not clear
> if you have time it would be great if you could figure out which of
> the patches from Christian's tree fixes USB hotplugging for you.
> Or is it fixed in Linux 5.10-rcX even without any patches?
>
The new mainline kernel 5.10.0 from Linus, without any other patches 
does detect USB hotpluging,
when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS 
2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
and the following u-boot patch:

--- u-boot.git/arch/arm/dts/meson-gxbb.dtsi.orig        2020-11-27 
17:20:04.624193561 +0100
+++ u-boot.git/arch/arm/dts/meson-gxbb.dtsi     2020-11-27 
17:23:18.472088934 +0100
@@ -403,36 +403,33 @@
                         gpio-ranges = <&pinctrl_periphs 0 0 119>;
                 };

-               emmc_pins: emmc {
-                       mux-0 {
-                               groups = "emmc_nand_d07",
-                                      "emmc_cmd";
-                               function = "emmc";
-                               bias-pull-up;
-                       };

-                       mux-1 {
-                               groups = "emmc_clk";
-                               function = "emmc";
-                               bias-disable;
-                       };
-               };
+                emmc_pins: emmc {
+                        mux {
+                                groups = "emmc_nand_d07",
+                                       "emmc_cmd",
+                                       "emmc_clk";
+                                function = "emmc";
+                        };
+                };

-               emmc_ds_pins: emmc-ds {
-                       mux {
-                               groups = "emmc_ds";
-                               function = "emmc";
-                               bias-pull-down;
-                       };
-               };
+                emmc_ds_pins: emmc-ds {
+                        mux {
+                                groups = "emmc_ds";
+                                function = "emmc";
+                        };
+                };

-               emmc_clk_gate_pins: emmc_clk_gate {
-                       mux {
-                               groups = "BOOT_8";
-                               function = "gpio_periphs";
-                               bias-pull-down;
-                       };
-               };
+                emmc_clk_gate_pins: emmc_clk_gate {
+                        mux {
+                                groups = "BOOT_8";
+                                function = "gpio_periphs";
+                        };
+                        cfg-pull-down {
+                                pins = "BOOT_8";
+                                bias-pull-down;
+                        };
+                };

                 nor_pins: nor {
                         mux {

When i use the last unpatched emmc bootable u-boot 2020.04 the kernel 
boots, but usb hotplugging
does not work.

Hope this describes my findings. If i can help further, please give me a 
note.

> Best regards,
> Martin
>
Best regards
Otto


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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-14 19:33                 ` Otto Meier
  (?)
@ 2020-12-19 13:58                   ` Martin Blumenstingl
  -1 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-19 13:58 UTC (permalink / raw)
  To: u-boot

Hi Otto,

On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
>
> Hi Martin,
>
> Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> > Hi Otto,
> >
> > On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> > [...]
> >>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> >>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> >>>> USB does hotplugging as expected.
> >>> So, this fixes USB under Linux ?? It's not clear
> > if you have time it would be great if you could figure out which of
> > the patches from Christian's tree fixes USB hotplugging for you.
> > Or is it fixed in Linux 5.10-rcX even without any patches?
> >
> The new mainline kernel 5.10.0 from Linus, without any other patches
> does detect USB hotpluging,
> when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
> 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
> and the following u-boot patch:
[...]
> When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
> boots, but usb hotplugging
> does not work.
Thank you for testing this!

> Hope this describes my findings. If i can help further, please give me a
> note.
to be honest: I am a bit lost here. I don't understand how the BOOT_*
pins interfere with USB.
I also don't have any Odroid-C2 board myself so I cannot do any
experiments myself.
Neil, please let me know if you have any idea here.


Best regards,
Martin

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 13:58                   ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-19 13:58 UTC (permalink / raw)
  To: Otto Meier, Neil Armstrong
  Cc: linux-amlogic, u-boot-amlogic, U-Boot Mailing List

Hi Otto,

On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
>
> Hi Martin,
>
> Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> > Hi Otto,
> >
> > On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> > [...]
> >>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> >>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> >>>> USB does hotplugging as expected.
> >>> So, this fixes USB under Linux ?? It's not clear
> > if you have time it would be great if you could figure out which of
> > the patches from Christian's tree fixes USB hotplugging for you.
> > Or is it fixed in Linux 5.10-rcX even without any patches?
> >
> The new mainline kernel 5.10.0 from Linus, without any other patches
> does detect USB hotpluging,
> when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
> 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
> and the following u-boot patch:
[...]
> When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
> boots, but usb hotplugging
> does not work.
Thank you for testing this!

> Hope this describes my findings. If i can help further, please give me a
> note.
to be honest: I am a bit lost here. I don't understand how the BOOT_*
pins interfere with USB.
I also don't have any Odroid-C2 board myself so I cannot do any
experiments myself.
Neil, please let me know if you have any idea here.


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 13:58                   ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-19 13:58 UTC (permalink / raw)
  To: Otto Meier, Neil Armstrong
  Cc: linux-amlogic, U-Boot Mailing List, u-boot-amlogic

Hi Otto,

On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
>
> Hi Martin,
>
> Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> > Hi Otto,
> >
> > On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> > [...]
> >>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> >>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> >>>> USB does hotplugging as expected.
> >>> So, this fixes USB under Linux ?? It's not clear
> > if you have time it would be great if you could figure out which of
> > the patches from Christian's tree fixes USB hotplugging for you.
> > Or is it fixed in Linux 5.10-rcX even without any patches?
> >
> The new mainline kernel 5.10.0 from Linus, without any other patches
> does detect USB hotpluging,
> when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
> 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
> and the following u-boot patch:
[...]
> When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
> boots, but usb hotplugging
> does not work.
Thank you for testing this!

> Hope this describes my findings. If i can help further, please give me a
> note.
to be honest: I am a bit lost here. I don't understand how the BOOT_*
pins interfere with USB.
I also don't have any Odroid-C2 board myself so I cannot do any
experiments myself.
Neil, please let me know if you have any idea here.


Best regards,
Martin

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-19 13:58                   ` Martin Blumenstingl
  (?)
@ 2020-12-19 18:41                     ` Otto Meier
  -1 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-19 18:41 UTC (permalink / raw)
  To: u-boot

Hi Martin,

Am 19.12.20 um 14:58 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
>> Hi Martin,
>>
>> Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
>>> Hi Otto,
>>>
>>> On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
>>> [...]
>>>>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>>>>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>>>>>> USB does hotplugging as expected.
>>>>> So, this fixes USB under Linux ?? It's not clear
>>> if you have time it would be great if you could figure out which of
>>> the patches from Christian's tree fixes USB hotplugging for you.
>>> Or is it fixed in Linux 5.10-rcX even without any patches?
>>>
>> The new mainline kernel 5.10.0 from Linus, without any other patches
>> does detect USB hotpluging,
>> when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
>> 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
>> and the following u-boot patch:
> [...]
>> When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
>> boots, but usb hotplugging
>> does not work.
> Thank you for testing this!
>
>> Hope this describes my findings. If i can help further, please give me a
>> note.
> to be honest: I am a bit lost here. I don't understand how the BOOT_*
> pins interfere with USB.
> I also don't have any Odroid-C2 board myself so I cannot do any
> experiments myself.
> Neil, please let me know if you have any idea here.
The latest Patch from Neil in U-boot also
fixes all the problems:

This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.

Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
Reported-by: Anton Arapov<arapov@gmail.com>
Reported-by: Otto Meier<gf435@gmx.net>
Signed-off-by: Neil Armstrong<narmstrong@baylibre.com>
---
Hi Anton, Otto,

This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?

Thanks,
Neil

  drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index d4539b02d8..5065b62436 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
         }

         /* othewise, enable the bias and select level */
-       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
+       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
         ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
         if (ret)
                 return ret;

         clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
-                       param == PIN_CONFIG_BIAS_PULL_UP);
+                       (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));

         return 0;
  }
--
2.25.1

perhaps this gives an idea of what was wrong.
But anyhow for me the issues with U-boot and usb hotplug is solved so far.
For me this is even more i understand.


>
> Best regards,
> Martin
>
Thanks for your help.

Otto

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 18:41                     ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-19 18:41 UTC (permalink / raw)
  To: Martin Blumenstingl, Neil Armstrong
  Cc: linux-amlogic, u-boot-amlogic, U-Boot Mailing List

Hi Martin,

Am 19.12.20 um 14:58 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
>> Hi Martin,
>>
>> Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
>>> Hi Otto,
>>>
>>> On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
>>> [...]
>>>>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>>>>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>>>>>> USB does hotplugging as expected.
>>>>> So, this fixes USB under Linux ?? It's not clear
>>> if you have time it would be great if you could figure out which of
>>> the patches from Christian's tree fixes USB hotplugging for you.
>>> Or is it fixed in Linux 5.10-rcX even without any patches?
>>>
>> The new mainline kernel 5.10.0 from Linus, without any other patches
>> does detect USB hotpluging,
>> when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
>> 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
>> and the following u-boot patch:
> [...]
>> When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
>> boots, but usb hotplugging
>> does not work.
> Thank you for testing this!
>
>> Hope this describes my findings. If i can help further, please give me a
>> note.
> to be honest: I am a bit lost here. I don't understand how the BOOT_*
> pins interfere with USB.
> I also don't have any Odroid-C2 board myself so I cannot do any
> experiments myself.
> Neil, please let me know if you have any idea here.
The latest Patch from Neil in U-boot also
fixes all the problems:

This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.

Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
Reported-by: Anton Arapov<arapov@gmail.com>
Reported-by: Otto Meier<gf435@gmx.net>
Signed-off-by: Neil Armstrong<narmstrong@baylibre.com>
---
Hi Anton, Otto,

This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?

Thanks,
Neil

  drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index d4539b02d8..5065b62436 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
         }

         /* othewise, enable the bias and select level */
-       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
+       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
         ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
         if (ret)
                 return ret;

         clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
-                       param == PIN_CONFIG_BIAS_PULL_UP);
+                       (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));

         return 0;
  }
--
2.25.1

perhaps this gives an idea of what was wrong.
But anyhow for me the issues with U-boot and usb hotplug is solved so far.
For me this is even more i understand.


>
> Best regards,
> Martin
>
Thanks for your help.

Otto

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 18:41                     ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-19 18:41 UTC (permalink / raw)
  To: Martin Blumenstingl, Neil Armstrong
  Cc: linux-amlogic, U-Boot Mailing List, u-boot-amlogic

Hi Martin,

Am 19.12.20 um 14:58 schrieb Martin Blumenstingl:
> Hi Otto,
>
> On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
>> Hi Martin,
>>
>> Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
>>> Hi Otto,
>>>
>>> On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
>>> [...]
>>>>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
>>>>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
>>>>>> USB does hotplugging as expected.
>>>>> So, this fixes USB under Linux ?? It's not clear
>>> if you have time it would be great if you could figure out which of
>>> the patches from Christian's tree fixes USB hotplugging for you.
>>> Or is it fixed in Linux 5.10-rcX even without any patches?
>>>
>> The new mainline kernel 5.10.0 from Linus, without any other patches
>> does detect USB hotpluging,
>> when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
>> 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
>> and the following u-boot patch:
> [...]
>> When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
>> boots, but usb hotplugging
>> does not work.
> Thank you for testing this!
>
>> Hope this describes my findings. If i can help further, please give me a
>> note.
> to be honest: I am a bit lost here. I don't understand how the BOOT_*
> pins interfere with USB.
> I also don't have any Odroid-C2 board myself so I cannot do any
> experiments myself.
> Neil, please let me know if you have any idea here.
The latest Patch from Neil in U-boot also
fixes all the problems:

This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.

Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
Reported-by: Anton Arapov<arapov@gmail.com>
Reported-by: Otto Meier<gf435@gmx.net>
Signed-off-by: Neil Armstrong<narmstrong@baylibre.com>
---
Hi Anton, Otto,

This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?

Thanks,
Neil

  drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index d4539b02d8..5065b62436 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
         }

         /* othewise, enable the bias and select level */
-       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
+       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
         ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
         if (ret)
                 return ret;

         clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
-                       param == PIN_CONFIG_BIAS_PULL_UP);
+                       (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));

         return 0;
  }
--
2.25.1

perhaps this gives an idea of what was wrong.
But anyhow for me the issues with U-boot and usb hotplug is solved so far.
For me this is even more i understand.


>
> Best regards,
> Martin
>
Thanks for your help.

Otto

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-19 13:58                   ` Martin Blumenstingl
  (?)
@ 2020-12-19 19:53                     ` Anand Moon
  -1 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-19 19:53 UTC (permalink / raw)
  To: u-boot

Hi Martin,

On Sat, 19 Dec 2020 at 19:29, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Otto,
>
> On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
> >
> > Hi Martin,
> >
> > Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> > > Hi Otto,
> > >
> > > On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> > > [...]
> > >>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> > >>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> > >>>> USB does hotplugging as expected.
> > >>> So, this fixes USB under Linux ?? It's not clear
> > > if you have time it would be great if you could figure out which of
> > > the patches from Christian's tree fixes USB hotplugging for you.
> > > Or is it fixed in Linux 5.10-rcX even without any patches?
> > >
> > The new mainline kernel 5.10.0 from Linus, without any other patches
> > does detect USB hotpluging,
> > when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
> > 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
> > and the following u-boot patch:
> [...]
> > When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
> > boots, but usb hotplugging
> > does not work.
> Thank you for testing this!
>
> > Hope this describes my findings. If i can help further, please give me a
> > note.
> to be honest: I am a bit lost here. I don't understand how the BOOT_*
> pins interfere with USB.
> I also don't have any Odroid-C2 board myself so I cannot do any
> experiments myself.
> Neil, please let me know if you have any idea here.
>
>
> Best regards,
> Martin
>

I was also looking into this issue so I made some changes in the
phy driver to resolve the issue. Plz share your thoughts on the changes below.

Best Regards
-Anand

amoon at ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..363dd2ac17e6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -20,6 +20,7 @@ usb0_phy: phy at c0000000 {
                        #phy-cells = <0>;
                        reg = <0x0 0xc0000000 0x0 0x20>;
                        resets = <&reset RESET_USB_OTG>;
+                       reset-names = "phy-reset";
                        clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
                        clock-names = "usb_general", "usb";
                        status = "disabled";
@@ -30,6 +31,7 @@ usb1_phy: phy at c0000020 {
                        #phy-cells = <0>;
                        reg = <0x0 0xc0000020 0x0 0x20>;
                        resets = <&reset RESET_USB_OTG>;
+                       reset-names = "phy-reset";
                        clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
                        clock-names = "usb_general", "usb";
                        status = "disabled";
diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
b/drivers/phy/amlogic/phy-meson8b-usb2.c
index 03c061dd5f0d..31523becc878 100644
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
@@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
        u32 reg;
        int ret;

-       if (!IS_ERR_OR_NULL(priv->reset)) {
-               ret = reset_control_reset(priv->reset);
-               if (ret) {
-                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
-                       return ret;
-               }
-       }
-
        ret = clk_prepare_enable(priv->clk_usb_general);
        if (ret) {
                dev_err(&phy->dev, "Failed to enable USB general clock\n");
@@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
        return 0;
 }

+static int phy_meson8b_usb2_reset(struct phy *phy)
+{
+       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
+
+       if (priv->reset) {
+               reset_control_assert(priv->reset);
+               udelay(10);
+               reset_control_deassert(priv->reset);
+       }
+
+       return 0;
+}
+
 static const struct phy_ops phy_meson8b_usb2_ops = {
        .power_on       = phy_meson8b_usb2_power_on,
        .power_off      = phy_meson8b_usb2_power_off,
+       .reset          = phy_meson8b_usb2_reset,
        .owner          = THIS_MODULE,
 };

@@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
platform_device *pdev)
                return -EINVAL;
        }

+       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
"phy-reset");
+       if (IS_ERR(priv->reset))
+               priv->reset = NULL;
+
        phy = devm_phy_create(&pdev->dev, NULL, &phy_meson8b_usb2_ops);
        if (IS_ERR(phy)) {
                dev_err(&pdev->dev, "failed to create PHY\n");

> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 19:53                     ` Anand Moon
  0 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-19 19:53 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: U-Boot Mailing List, linux-amlogic, Neil Armstrong,
	u-boot-amlogic, Otto Meier

Hi Martin,

On Sat, 19 Dec 2020 at 19:29, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Otto,
>
> On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
> >
> > Hi Martin,
> >
> > Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> > > Hi Otto,
> > >
> > > On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> > > [...]
> > >>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> > >>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> > >>>> USB does hotplugging as expected.
> > >>> So, this fixes USB under Linux ?? It's not clear
> > > if you have time it would be great if you could figure out which of
> > > the patches from Christian's tree fixes USB hotplugging for you.
> > > Or is it fixed in Linux 5.10-rcX even without any patches?
> > >
> > The new mainline kernel 5.10.0 from Linus, without any other patches
> > does detect USB hotpluging,
> > when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
> > 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
> > and the following u-boot patch:
> [...]
> > When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
> > boots, but usb hotplugging
> > does not work.
> Thank you for testing this!
>
> > Hope this describes my findings. If i can help further, please give me a
> > note.
> to be honest: I am a bit lost here. I don't understand how the BOOT_*
> pins interfere with USB.
> I also don't have any Odroid-C2 board myself so I cannot do any
> experiments myself.
> Neil, please let me know if you have any idea here.
>
>
> Best regards,
> Martin
>

I was also looking into this issue so I made some changes in the
phy driver to resolve the issue. Plz share your thoughts on the changes below.

Best Regards
-Anand

amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..363dd2ac17e6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
                        #phy-cells = <0>;
                        reg = <0x0 0xc0000000 0x0 0x20>;
                        resets = <&reset RESET_USB_OTG>;
+                       reset-names = "phy-reset";
                        clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
                        clock-names = "usb_general", "usb";
                        status = "disabled";
@@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
                        #phy-cells = <0>;
                        reg = <0x0 0xc0000020 0x0 0x20>;
                        resets = <&reset RESET_USB_OTG>;
+                       reset-names = "phy-reset";
                        clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
                        clock-names = "usb_general", "usb";
                        status = "disabled";
diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
b/drivers/phy/amlogic/phy-meson8b-usb2.c
index 03c061dd5f0d..31523becc878 100644
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
@@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
        u32 reg;
        int ret;

-       if (!IS_ERR_OR_NULL(priv->reset)) {
-               ret = reset_control_reset(priv->reset);
-               if (ret) {
-                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
-                       return ret;
-               }
-       }
-
        ret = clk_prepare_enable(priv->clk_usb_general);
        if (ret) {
                dev_err(&phy->dev, "Failed to enable USB general clock\n");
@@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
        return 0;
 }

+static int phy_meson8b_usb2_reset(struct phy *phy)
+{
+       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
+
+       if (priv->reset) {
+               reset_control_assert(priv->reset);
+               udelay(10);
+               reset_control_deassert(priv->reset);
+       }
+
+       return 0;
+}
+
 static const struct phy_ops phy_meson8b_usb2_ops = {
        .power_on       = phy_meson8b_usb2_power_on,
        .power_off      = phy_meson8b_usb2_power_off,
+       .reset          = phy_meson8b_usb2_reset,
        .owner          = THIS_MODULE,
 };

@@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
platform_device *pdev)
                return -EINVAL;
        }

+       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
"phy-reset");
+       if (IS_ERR(priv->reset))
+               priv->reset = NULL;
+
        phy = devm_phy_create(&pdev->dev, NULL, &phy_meson8b_usb2_ops);
        if (IS_ERR(phy)) {
                dev_err(&pdev->dev, "failed to create PHY\n");

> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 19:53                     ` Anand Moon
  0 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-19 19:53 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: Otto Meier, Neil Armstrong, linux-amlogic, u-boot-amlogic,
	U-Boot Mailing List

Hi Martin,

On Sat, 19 Dec 2020 at 19:29, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Otto,
>
> On Mon, Dec 14, 2020 at 8:34 PM Otto Meier <gf435@gmx.net> wrote:
> >
> > Hi Martin,
> >
> > Am 13.12.20 um 19:46 schrieb Martin Blumenstingl:
> > > Hi Otto,
> > >
> > > On Mon, Dec 7, 2020 at 1:43 PM Otto Meier <gf435@gmx.net> wrote:
> > > [...]
> > >>>> So with the latest u-boot and the kernel from https://github.com/chewitt/linux/tree/amlogic-5.10.y
> > >>>> commit 725fc8df7898102f9031ba2075f763884ffa3ee8 everything is working again.
> > >>>> USB does hotplugging as expected.
> > >>> So, this fixes USB under Linux ?? It's not clear
> > > if you have time it would be great if you could figure out which of
> > > the patches from Christian's tree fixes USB hotplugging for you.
> > > Or is it fixed in Linux 5.10-rcX even without any patches?
> > >
> > The new mainline kernel 5.10.0 from Linus, without any other patches
> > does detect USB hotpluging,
> > when using u-boot DMI: Hardkernel Co., Ltd. ODROID-C2/ODROID-C2, BIOS
> > 2021.01-rc3-00039-gec79f5ce22-dirty 12/08/2020
> > and the following u-boot patch:
> [...]
> > When i use the last unpatched emmc bootable u-boot 2020.04 the kernel
> > boots, but usb hotplugging
> > does not work.
> Thank you for testing this!
>
> > Hope this describes my findings. If i can help further, please give me a
> > note.
> to be honest: I am a bit lost here. I don't understand how the BOOT_*
> pins interfere with USB.
> I also don't have any Odroid-C2 board myself so I cannot do any
> experiments myself.
> Neil, please let me know if you have any idea here.
>
>
> Best regards,
> Martin
>

I was also looking into this issue so I made some changes in the
phy driver to resolve the issue. Plz share your thoughts on the changes below.

Best Regards
-Anand

amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 7c029f552a23..363dd2ac17e6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
                        #phy-cells = <0>;
                        reg = <0x0 0xc0000000 0x0 0x20>;
                        resets = <&reset RESET_USB_OTG>;
+                       reset-names = "phy-reset";
                        clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
                        clock-names = "usb_general", "usb";
                        status = "disabled";
@@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
                        #phy-cells = <0>;
                        reg = <0x0 0xc0000020 0x0 0x20>;
                        resets = <&reset RESET_USB_OTG>;
+                       reset-names = "phy-reset";
                        clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
                        clock-names = "usb_general", "usb";
                        status = "disabled";
diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
b/drivers/phy/amlogic/phy-meson8b-usb2.c
index 03c061dd5f0d..31523becc878 100644
--- a/drivers/phy/amlogic/phy-meson8b-usb2.c
+++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
@@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
        u32 reg;
        int ret;

-       if (!IS_ERR_OR_NULL(priv->reset)) {
-               ret = reset_control_reset(priv->reset);
-               if (ret) {
-                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
-                       return ret;
-               }
-       }
-
        ret = clk_prepare_enable(priv->clk_usb_general);
        if (ret) {
                dev_err(&phy->dev, "Failed to enable USB general clock\n");
@@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
        return 0;
 }

+static int phy_meson8b_usb2_reset(struct phy *phy)
+{
+       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
+
+       if (priv->reset) {
+               reset_control_assert(priv->reset);
+               udelay(10);
+               reset_control_deassert(priv->reset);
+       }
+
+       return 0;
+}
+
 static const struct phy_ops phy_meson8b_usb2_ops = {
        .power_on       = phy_meson8b_usb2_power_on,
        .power_off      = phy_meson8b_usb2_power_off,
+       .reset          = phy_meson8b_usb2_reset,
        .owner          = THIS_MODULE,
 };

@@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
platform_device *pdev)
                return -EINVAL;
        }

+       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
"phy-reset");
+       if (IS_ERR(priv->reset))
+               priv->reset = NULL;
+
        phy = devm_phy_create(&pdev->dev, NULL, &phy_meson8b_usb2_ops);
        if (IS_ERR(phy)) {
                dev_err(&pdev->dev, "failed to create PHY\n");

> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-19 19:53                     ` Anand Moon
  (?)
@ 2020-12-19 22:31                       ` Martin Blumenstingl
  -1 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-19 22:31 UTC (permalink / raw)
  To: u-boot

Hi Anand,

On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> I was also looking into this issue so I made some changes in the
> phy driver to resolve the issue. Plz share your thoughts on the changes below.
first I have some questions :-)
1. do you see the same problem that Otto sees? this means: a) USB
hotplug works as long as at least one device is plugged in at boot b)
(if I understand Otto correctly then) it breaks once all USB devices
have been removed
2. does the mainline u-boot patch mentioned by Otto fix the problem
for you? according to him it fixes the problem and he did not have to
modify the USB PHY driver

> amoon at ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> index 7c029f552a23..363dd2ac17e6 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> @@ -20,6 +20,7 @@ usb0_phy: phy at c0000000 {
>                         #phy-cells = <0>;
>                         reg = <0x0 0xc0000000 0x0 0x20>;
>                         resets = <&reset RESET_USB_OTG>;
> +                       reset-names = "phy-reset";
>                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>                         clock-names = "usb_general", "usb";
>                         status = "disabled";
> @@ -30,6 +31,7 @@ usb1_phy: phy at c0000020 {
>                         #phy-cells = <0>;
>                         reg = <0x0 0xc0000020 0x0 0x20>;
>                         resets = <&reset RESET_USB_OTG>;
> +                       reset-names = "phy-reset";
>                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>                         clock-names = "usb_general", "usb";
>                         status = "disabled";
I don't see why the above two changes are needed
see my comment about of_reset_control_get_shared below

> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
> b/drivers/phy/amlogic/phy-meson8b-usb2.c
> index 03c061dd5f0d..31523becc878 100644
> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>         u32 reg;
>         int ret;
>
> -       if (!IS_ERR_OR_NULL(priv->reset)) {
> -               ret = reset_control_reset(priv->reset);
> -               if (ret) {
> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
> -                       return ret;
> -               }
> -       }
> -
>         ret = clk_prepare_enable(priv->clk_usb_general);
>         if (ret) {
>                 dev_err(&phy->dev, "Failed to enable USB general clock\n");
> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>         return 0;
>  }
>
> +static int phy_meson8b_usb2_reset(struct phy *phy)
> +{
> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> +
> +       if (priv->reset) {
> +               reset_control_assert(priv->reset);
> +               udelay(10);
> +               reset_control_deassert(priv->reset);
> +       }
> +
> +       return 0;
> +}
> +
>  static const struct phy_ops phy_meson8b_usb2_ops = {
>         .power_on       = phy_meson8b_usb2_power_on,
>         .power_off      = phy_meson8b_usb2_power_off,
> +       .reset          = phy_meson8b_usb2_reset,
>         .owner          = THIS_MODULE,
>  };
I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
after checking the dwc2 code this is expected: only in one very
specific case the dwc2 driver calls phy_reset
can you please find out how phy_meson8b_usb2_reset is called in your kernel?

> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> platform_device *pdev)
>                 return -EINVAL;
>         }
>
> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> "phy-reset");
this causes a memory-leak upon driver removal
also a few lines above we are already getting the reset line, so why
is this needed?


Best regards,
Martin

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 22:31                       ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-19 22:31 UTC (permalink / raw)
  To: Anand Moon
  Cc: U-Boot Mailing List, linux-amlogic, Neil Armstrong,
	u-boot-amlogic, Otto Meier

Hi Anand,

On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> I was also looking into this issue so I made some changes in the
> phy driver to resolve the issue. Plz share your thoughts on the changes below.
first I have some questions :-)
1. do you see the same problem that Otto sees? this means: a) USB
hotplug works as long as at least one device is plugged in at boot b)
(if I understand Otto correctly then) it breaks once all USB devices
have been removed
2. does the mainline u-boot patch mentioned by Otto fix the problem
for you? according to him it fixes the problem and he did not have to
modify the USB PHY driver

> amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> index 7c029f552a23..363dd2ac17e6 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
>                         #phy-cells = <0>;
>                         reg = <0x0 0xc0000000 0x0 0x20>;
>                         resets = <&reset RESET_USB_OTG>;
> +                       reset-names = "phy-reset";
>                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>                         clock-names = "usb_general", "usb";
>                         status = "disabled";
> @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
>                         #phy-cells = <0>;
>                         reg = <0x0 0xc0000020 0x0 0x20>;
>                         resets = <&reset RESET_USB_OTG>;
> +                       reset-names = "phy-reset";
>                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>                         clock-names = "usb_general", "usb";
>                         status = "disabled";
I don't see why the above two changes are needed
see my comment about of_reset_control_get_shared below

> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
> b/drivers/phy/amlogic/phy-meson8b-usb2.c
> index 03c061dd5f0d..31523becc878 100644
> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>         u32 reg;
>         int ret;
>
> -       if (!IS_ERR_OR_NULL(priv->reset)) {
> -               ret = reset_control_reset(priv->reset);
> -               if (ret) {
> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
> -                       return ret;
> -               }
> -       }
> -
>         ret = clk_prepare_enable(priv->clk_usb_general);
>         if (ret) {
>                 dev_err(&phy->dev, "Failed to enable USB general clock\n");
> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>         return 0;
>  }
>
> +static int phy_meson8b_usb2_reset(struct phy *phy)
> +{
> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> +
> +       if (priv->reset) {
> +               reset_control_assert(priv->reset);
> +               udelay(10);
> +               reset_control_deassert(priv->reset);
> +       }
> +
> +       return 0;
> +}
> +
>  static const struct phy_ops phy_meson8b_usb2_ops = {
>         .power_on       = phy_meson8b_usb2_power_on,
>         .power_off      = phy_meson8b_usb2_power_off,
> +       .reset          = phy_meson8b_usb2_reset,
>         .owner          = THIS_MODULE,
>  };
I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
after checking the dwc2 code this is expected: only in one very
specific case the dwc2 driver calls phy_reset
can you please find out how phy_meson8b_usb2_reset is called in your kernel?

> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> platform_device *pdev)
>                 return -EINVAL;
>         }
>
> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> "phy-reset");
this causes a memory-leak upon driver removal
also a few lines above we are already getting the reset line, so why
is this needed?


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-19 22:31                       ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-19 22:31 UTC (permalink / raw)
  To: Anand Moon
  Cc: Otto Meier, Neil Armstrong, linux-amlogic, u-boot-amlogic,
	U-Boot Mailing List

Hi Anand,

On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> I was also looking into this issue so I made some changes in the
> phy driver to resolve the issue. Plz share your thoughts on the changes below.
first I have some questions :-)
1. do you see the same problem that Otto sees? this means: a) USB
hotplug works as long as at least one device is plugged in at boot b)
(if I understand Otto correctly then) it breaks once all USB devices
have been removed
2. does the mainline u-boot patch mentioned by Otto fix the problem
for you? according to him it fixes the problem and he did not have to
modify the USB PHY driver

> amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> index 7c029f552a23..363dd2ac17e6 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
>                         #phy-cells = <0>;
>                         reg = <0x0 0xc0000000 0x0 0x20>;
>                         resets = <&reset RESET_USB_OTG>;
> +                       reset-names = "phy-reset";
>                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>                         clock-names = "usb_general", "usb";
>                         status = "disabled";
> @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
>                         #phy-cells = <0>;
>                         reg = <0x0 0xc0000020 0x0 0x20>;
>                         resets = <&reset RESET_USB_OTG>;
> +                       reset-names = "phy-reset";
>                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>                         clock-names = "usb_general", "usb";
>                         status = "disabled";
I don't see why the above two changes are needed
see my comment about of_reset_control_get_shared below

> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
> b/drivers/phy/amlogic/phy-meson8b-usb2.c
> index 03c061dd5f0d..31523becc878 100644
> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>         u32 reg;
>         int ret;
>
> -       if (!IS_ERR_OR_NULL(priv->reset)) {
> -               ret = reset_control_reset(priv->reset);
> -               if (ret) {
> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
> -                       return ret;
> -               }
> -       }
> -
>         ret = clk_prepare_enable(priv->clk_usb_general);
>         if (ret) {
>                 dev_err(&phy->dev, "Failed to enable USB general clock\n");
> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>         return 0;
>  }
>
> +static int phy_meson8b_usb2_reset(struct phy *phy)
> +{
> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> +
> +       if (priv->reset) {
> +               reset_control_assert(priv->reset);
> +               udelay(10);
> +               reset_control_deassert(priv->reset);
> +       }
> +
> +       return 0;
> +}
> +
>  static const struct phy_ops phy_meson8b_usb2_ops = {
>         .power_on       = phy_meson8b_usb2_power_on,
>         .power_off      = phy_meson8b_usb2_power_off,
> +       .reset          = phy_meson8b_usb2_reset,
>         .owner          = THIS_MODULE,
>  };
I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
after checking the dwc2 code this is expected: only in one very
specific case the dwc2 driver calls phy_reset
can you please find out how phy_meson8b_usb2_reset is called in your kernel?

> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> platform_device *pdev)
>                 return -EINVAL;
>         }
>
> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> "phy-reset");
this causes a memory-leak upon driver removal
also a few lines above we are already getting the reset line, so why
is this needed?


Best regards,
Martin

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-19 22:31                       ` Martin Blumenstingl
  (?)
@ 2020-12-20 10:28                         ` Otto Meier
  -1 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-20 10:28 UTC (permalink / raw)
  To: u-boot

Hi Martin,

i think the the u-boot fix made the new u-boot for me usable.
Because i boot from emmc it fixes a long standing problem since 2020.04
in not booting from emmc.
The latest uboot, booting from emmc before the fix was 2020.04, but this 
old uboot does not funktion well
(hotpluging and others) with newer kernel (5.8.10 was the latest i new 
of). Therefore
the latest Uboot initialized the kernel in a way that new kernels work 
again.

I haven't run kernel in between, with newer uboots like 2020.07 or 
2020.10, because they din't boot
from emmc.

so if the uboot patch is the real reason, i don't think.

best regrads

Otto

Am 19.12.20 um 23:31 schrieb Martin Blumenstingl:
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
>> I was also looking into this issue so I made some changes in the
>> phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed
> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>
>> amoon at ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> index 7c029f552a23..363dd2ac17e6 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> @@ -20,6 +20,7 @@ usb0_phy: phy at c0000000 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000000 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
>> @@ -30,6 +31,7 @@ usb1_phy: phy at c0000020 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000020 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>
>> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> index 03c061dd5f0d..31523becc878 100644
>> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>>          u32 reg;
>>          int ret;
>>
>> -       if (!IS_ERR_OR_NULL(priv->reset)) {
>> -               ret = reset_control_reset(priv->reset);
>> -               if (ret) {
>> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
>> -                       return ret;
>> -               }
>> -       }
>> -
>>          ret = clk_prepare_enable(priv->clk_usb_general);
>>          if (ret) {
>>                  dev_err(&phy->dev, "Failed to enable USB general clock\n");
>> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>>          return 0;
>>   }
>>
>> +static int phy_meson8b_usb2_reset(struct phy *phy)
>> +{
>> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
>> +
>> +       if (priv->reset) {
>> +               reset_control_assert(priv->reset);
>> +               udelay(10);
>> +               reset_control_deassert(priv->reset);
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>   static const struct phy_ops phy_meson8b_usb2_ops = {
>>          .power_on       = phy_meson8b_usb2_power_on,
>>          .power_off      = phy_meson8b_usb2_power_off,
>> +       .reset          = phy_meson8b_usb2_reset,
>>          .owner          = THIS_MODULE,
>>   };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>
>> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
>> platform_device *pdev)
>>                  return -EINVAL;
>>          }
>>
>> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
>> "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?
>
>
> Best regards,
> Martin
>

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-20 10:28                         ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-20 10:28 UTC (permalink / raw)
  To: Martin Blumenstingl, Anand Moon
  Cc: U-Boot Mailing List, linux-amlogic, u-boot-amlogic, Neil Armstrong

Hi Martin,

i think the the u-boot fix made the new u-boot for me usable.
Because i boot from emmc it fixes a long standing problem since 2020.04
in not booting from emmc.
The latest uboot, booting from emmc before the fix was 2020.04, but this 
old uboot does not funktion well
(hotpluging and others) with newer kernel (5.8.10 was the latest i new 
of). Therefore
the latest Uboot initialized the kernel in a way that new kernels work 
again.

I haven't run kernel in between, with newer uboots like 2020.07 or 
2020.10, because they din't boot
from emmc.

so if the uboot patch is the real reason, i don't think.

best regrads

Otto

Am 19.12.20 um 23:31 schrieb Martin Blumenstingl:
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
>> I was also looking into this issue so I made some changes in the
>> phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed
> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>
>> amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> index 7c029f552a23..363dd2ac17e6 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000000 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
>> @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000020 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>
>> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> index 03c061dd5f0d..31523becc878 100644
>> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>>          u32 reg;
>>          int ret;
>>
>> -       if (!IS_ERR_OR_NULL(priv->reset)) {
>> -               ret = reset_control_reset(priv->reset);
>> -               if (ret) {
>> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
>> -                       return ret;
>> -               }
>> -       }
>> -
>>          ret = clk_prepare_enable(priv->clk_usb_general);
>>          if (ret) {
>>                  dev_err(&phy->dev, "Failed to enable USB general clock\n");
>> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>>          return 0;
>>   }
>>
>> +static int phy_meson8b_usb2_reset(struct phy *phy)
>> +{
>> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
>> +
>> +       if (priv->reset) {
>> +               reset_control_assert(priv->reset);
>> +               udelay(10);
>> +               reset_control_deassert(priv->reset);
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>   static const struct phy_ops phy_meson8b_usb2_ops = {
>>          .power_on       = phy_meson8b_usb2_power_on,
>>          .power_off      = phy_meson8b_usb2_power_off,
>> +       .reset          = phy_meson8b_usb2_reset,
>>          .owner          = THIS_MODULE,
>>   };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>
>> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
>> platform_device *pdev)
>>                  return -EINVAL;
>>          }
>>
>> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
>> "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?
>
>
> Best regards,
> Martin
>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-20 10:28                         ` Otto Meier
  0 siblings, 0 replies; 42+ messages in thread
From: Otto Meier @ 2020-12-20 10:28 UTC (permalink / raw)
  To: Martin Blumenstingl, Anand Moon
  Cc: Neil Armstrong, linux-amlogic, u-boot-amlogic, U-Boot Mailing List

Hi Martin,

i think the the u-boot fix made the new u-boot for me usable.
Because i boot from emmc it fixes a long standing problem since 2020.04
in not booting from emmc.
The latest uboot, booting from emmc before the fix was 2020.04, but this 
old uboot does not funktion well
(hotpluging and others) with newer kernel (5.8.10 was the latest i new 
of). Therefore
the latest Uboot initialized the kernel in a way that new kernels work 
again.

I haven't run kernel in between, with newer uboots like 2020.07 or 
2020.10, because they din't boot
from emmc.

so if the uboot patch is the real reason, i don't think.

best regrads

Otto

Am 19.12.20 um 23:31 schrieb Martin Blumenstingl:
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
>> I was also looking into this issue so I made some changes in the
>> phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed
> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>
>> amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> index 7c029f552a23..363dd2ac17e6 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
>> @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000000 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
>> @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
>>                          #phy-cells = <0>;
>>                          reg = <0x0 0xc0000020 0x0 0x20>;
>>                          resets = <&reset RESET_USB_OTG>;
>> +                       reset-names = "phy-reset";
>>                          clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
>>                          clock-names = "usb_general", "usb";
>>                          status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>
>> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> index 03c061dd5f0d..31523becc878 100644
>> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
>> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
>> @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>>          u32 reg;
>>          int ret;
>>
>> -       if (!IS_ERR_OR_NULL(priv->reset)) {
>> -               ret = reset_control_reset(priv->reset);
>> -               if (ret) {
>> -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
>> -                       return ret;
>> -               }
>> -       }
>> -
>>          ret = clk_prepare_enable(priv->clk_usb_general);
>>          if (ret) {
>>                  dev_err(&phy->dev, "Failed to enable USB general clock\n");
>> @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
>>          return 0;
>>   }
>>
>> +static int phy_meson8b_usb2_reset(struct phy *phy)
>> +{
>> +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
>> +
>> +       if (priv->reset) {
>> +               reset_control_assert(priv->reset);
>> +               udelay(10);
>> +               reset_control_deassert(priv->reset);
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>   static const struct phy_ops phy_meson8b_usb2_ops = {
>>          .power_on       = phy_meson8b_usb2_power_on,
>>          .power_off      = phy_meson8b_usb2_power_off,
>> +       .reset          = phy_meson8b_usb2_reset,
>>          .owner          = THIS_MODULE,
>>   };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>
>> @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
>> platform_device *pdev)
>>                  return -EINVAL;
>>          }
>>
>> +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
>> "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?
>
>
> Best regards,
> Martin
>


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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-19 22:31                       ` Martin Blumenstingl
  (?)
@ 2020-12-20 13:46                         ` Anand Moon
  -1 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-20 13:46 UTC (permalink / raw)
  To: u-boot

Hi Martin,

Thanks for testing and sharing your view points.

On Sun, 20 Dec 2020 at 04:01, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > I was also looking into this issue so I made some changes in the
> > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed

On C1/C2 issue is when single usb hdd is connected to board it will
not get detected.
unless you connect another usb keyboard or wireless dongle to the board.

*USB hot plug only works if two ore more usb devices are connected.*

> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>

I have not check this out, I will verify this later.

> > amoon at ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > index 7c029f552a23..363dd2ac17e6 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > @@ -20,6 +20,7 @@ usb0_phy: phy at c0000000 {
> >                         #phy-cells = <0>;
> >                         reg = <0x0 0xc0000000 0x0 0x20>;
> >                         resets = <&reset RESET_USB_OTG>;
> > +                       reset-names = "phy-reset";
> >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> >                         clock-names = "usb_general", "usb";
> >                         status = "disabled";
> > @@ -30,6 +31,7 @@ usb1_phy: phy at c0000020 {
> >                         #phy-cells = <0>;
> >                         reg = <0x0 0xc0000020 0x0 0x20>;
> >                         resets = <&reset RESET_USB_OTG>;
> > +                       reset-names = "phy-reset";
> >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> >                         clock-names = "usb_general", "usb";
> >                         status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>

Yep I borrowed this logic from rockchip usb phy controller.
but I missed the action on reset.

err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
if (err)
return err;

> > diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
> > b/drivers/phy/amlogic/phy-meson8b-usb2.c
> > index 03c061dd5f0d..31523becc878 100644
> > --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> > +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> > @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
> >         u32 reg;
> >         int ret;
> >
> > -       if (!IS_ERR_OR_NULL(priv->reset)) {
> > -               ret = reset_control_reset(priv->reset);
> > -               if (ret) {
> > -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
> > -                       return ret;
> > -               }
> > -       }
> > -
> >         ret = clk_prepare_enable(priv->clk_usb_general);
> >         if (ret) {
> >                 dev_err(&phy->dev, "Failed to enable USB general clock\n");
> > @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
> >         return 0;
> >  }
> >
> > +static int phy_meson8b_usb2_reset(struct phy *phy)
> > +{
> > +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> > +
> > +       if (priv->reset) {
> > +               reset_control_assert(priv->reset);
> > +               udelay(10);
> > +               reset_control_deassert(priv->reset);
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> >  static const struct phy_ops phy_meson8b_usb2_ops = {
> >         .power_on       = phy_meson8b_usb2_power_on,
> >         .power_off      = phy_meson8b_usb2_power_off,
> > +       .reset          = phy_meson8b_usb2_reset,
> >         .owner          = THIS_MODULE,
> >  };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>

Yep, Its not getting called on my board, l might be missing some thing.

> > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > platform_device *pdev)
> >                 return -EINVAL;
> >         }
> >
> > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?

I had a feeling that USB_OTG reset will be shared between both the phy
controller.

Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
but Odroid C1 dose not have this feature.

Next time I will try to do more testing on both the devices C1/C2.
before sending some code for review or testing.

Best Regards
-Anand

>
>
> Best regards,
> Martin

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-20 13:46                         ` Anand Moon
  0 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-20 13:46 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: U-Boot Mailing List, linux-amlogic, Neil Armstrong,
	u-boot-amlogic, Otto Meier

Hi Martin,

Thanks for testing and sharing your view points.

On Sun, 20 Dec 2020 at 04:01, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > I was also looking into this issue so I made some changes in the
> > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed

On C1/C2 issue is when single usb hdd is connected to board it will
not get detected.
unless you connect another usb keyboard or wireless dongle to the board.

*USB hot plug only works if two ore more usb devices are connected.*

> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>

I have not check this out, I will verify this later.

> > amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > index 7c029f552a23..363dd2ac17e6 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
> >                         #phy-cells = <0>;
> >                         reg = <0x0 0xc0000000 0x0 0x20>;
> >                         resets = <&reset RESET_USB_OTG>;
> > +                       reset-names = "phy-reset";
> >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> >                         clock-names = "usb_general", "usb";
> >                         status = "disabled";
> > @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
> >                         #phy-cells = <0>;
> >                         reg = <0x0 0xc0000020 0x0 0x20>;
> >                         resets = <&reset RESET_USB_OTG>;
> > +                       reset-names = "phy-reset";
> >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> >                         clock-names = "usb_general", "usb";
> >                         status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>

Yep I borrowed this logic from rockchip usb phy controller.
but I missed the action on reset.

err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
if (err)
return err;

> > diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
> > b/drivers/phy/amlogic/phy-meson8b-usb2.c
> > index 03c061dd5f0d..31523becc878 100644
> > --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> > +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> > @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
> >         u32 reg;
> >         int ret;
> >
> > -       if (!IS_ERR_OR_NULL(priv->reset)) {
> > -               ret = reset_control_reset(priv->reset);
> > -               if (ret) {
> > -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
> > -                       return ret;
> > -               }
> > -       }
> > -
> >         ret = clk_prepare_enable(priv->clk_usb_general);
> >         if (ret) {
> >                 dev_err(&phy->dev, "Failed to enable USB general clock\n");
> > @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
> >         return 0;
> >  }
> >
> > +static int phy_meson8b_usb2_reset(struct phy *phy)
> > +{
> > +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> > +
> > +       if (priv->reset) {
> > +               reset_control_assert(priv->reset);
> > +               udelay(10);
> > +               reset_control_deassert(priv->reset);
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> >  static const struct phy_ops phy_meson8b_usb2_ops = {
> >         .power_on       = phy_meson8b_usb2_power_on,
> >         .power_off      = phy_meson8b_usb2_power_off,
> > +       .reset          = phy_meson8b_usb2_reset,
> >         .owner          = THIS_MODULE,
> >  };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>

Yep, Its not getting called on my board, l might be missing some thing.

> > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > platform_device *pdev)
> >                 return -EINVAL;
> >         }
> >
> > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?

I had a feeling that USB_OTG reset will be shared between both the phy
controller.

Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
but Odroid C1 dose not have this feature.

Next time I will try to do more testing on both the devices C1/C2.
before sending some code for review or testing.

Best Regards
-Anand

>
>
> Best regards,
> Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-20 13:46                         ` Anand Moon
  0 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-20 13:46 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: Otto Meier, Neil Armstrong, linux-amlogic, u-boot-amlogic,
	U-Boot Mailing List

Hi Martin,

Thanks for testing and sharing your view points.

On Sun, 20 Dec 2020 at 04:01, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > I was also looking into this issue so I made some changes in the
> > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> first I have some questions :-)
> 1. do you see the same problem that Otto sees? this means: a) USB
> hotplug works as long as at least one device is plugged in at boot b)
> (if I understand Otto correctly then) it breaks once all USB devices
> have been removed

On C1/C2 issue is when single usb hdd is connected to board it will
not get detected.
unless you connect another usb keyboard or wireless dongle to the board.

*USB hot plug only works if two ore more usb devices are connected.*

> 2. does the mainline u-boot patch mentioned by Otto fix the problem
> for you? according to him it fixes the problem and he did not have to
> modify the USB PHY driver
>

I have not check this out, I will verify this later.

> > amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > index 7c029f552a23..363dd2ac17e6 100644
> > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
> >                         #phy-cells = <0>;
> >                         reg = <0x0 0xc0000000 0x0 0x20>;
> >                         resets = <&reset RESET_USB_OTG>;
> > +                       reset-names = "phy-reset";
> >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> >                         clock-names = "usb_general", "usb";
> >                         status = "disabled";
> > @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
> >                         #phy-cells = <0>;
> >                         reg = <0x0 0xc0000020 0x0 0x20>;
> >                         resets = <&reset RESET_USB_OTG>;
> > +                       reset-names = "phy-reset";
> >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> >                         clock-names = "usb_general", "usb";
> >                         status = "disabled";
> I don't see why the above two changes are needed
> see my comment about of_reset_control_get_shared below
>

Yep I borrowed this logic from rockchip usb phy controller.
but I missed the action on reset.

err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
if (err)
return err;

> > diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c
> > b/drivers/phy/amlogic/phy-meson8b-usb2.c
> > index 03c061dd5f0d..31523becc878 100644
> > --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> > +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> > @@ -143,14 +143,6 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
> >         u32 reg;
> >         int ret;
> >
> > -       if (!IS_ERR_OR_NULL(priv->reset)) {
> > -               ret = reset_control_reset(priv->reset);
> > -               if (ret) {
> > -                       dev_err(&phy->dev, "Failed to trigger USB reset\n");
> > -                       return ret;
> > -               }
> > -       }
> > -
> >         ret = clk_prepare_enable(priv->clk_usb_general);
> >         if (ret) {
> >                 dev_err(&phy->dev, "Failed to enable USB general clock\n");
> > @@ -222,9 +214,23 @@ static int phy_meson8b_usb2_power_off(struct phy *phy)
> >         return 0;
> >  }
> >
> > +static int phy_meson8b_usb2_reset(struct phy *phy)
> > +{
> > +       struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
> > +
> > +       if (priv->reset) {
> > +               reset_control_assert(priv->reset);
> > +               udelay(10);
> > +               reset_control_deassert(priv->reset);
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> >  static const struct phy_ops phy_meson8b_usb2_ops = {
> >         .power_on       = phy_meson8b_usb2_power_on,
> >         .power_off      = phy_meson8b_usb2_power_off,
> > +       .reset          = phy_meson8b_usb2_reset,
> >         .owner          = THIS_MODULE,
> >  };
> I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> after checking the dwc2 code this is expected: only in one very
> specific case the dwc2 driver calls phy_reset
> can you please find out how phy_meson8b_usb2_reset is called in your kernel?
>

Yep, Its not getting called on my board, l might be missing some thing.

> > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > platform_device *pdev)
> >                 return -EINVAL;
> >         }
> >
> > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > "phy-reset");
> this causes a memory-leak upon driver removal
> also a few lines above we are already getting the reset line, so why
> is this needed?

I had a feeling that USB_OTG reset will be shared between both the phy
controller.

Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
but Odroid C1 dose not have this feature.

Next time I will try to do more testing on both the devices C1/C2.
before sending some code for review or testing.

Best Regards
-Anand

>
>
> Best regards,
> Martin

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-20 13:46                         ` Anand Moon
  (?)
@ 2020-12-20 14:33                           ` Martin Blumenstingl
  -1 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-20 14:33 UTC (permalink / raw)
  To: u-boot

Hi Anand,

On Sun, Dec 20, 2020 at 2:46 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> > On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > [...]
> > > I was also looking into this issue so I made some changes in the
> > > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> > first I have some questions :-)
> > 1. do you see the same problem that Otto sees? this means: a) USB
> > hotplug works as long as at least one device is plugged in at boot b)
> > (if I understand Otto correctly then) it breaks once all USB devices
> > have been removed
>
> On C1/C2 issue is when single usb hdd is connected to board it will
> not get detected.
> unless you connect another usb keyboard or wireless dongle to the board.
>
> *USB hot plug only works if two ore more usb devices are connected.*
I am not sure if that's really the same issue as described by Otto

[...]
> > > amoon at ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > index 7c029f552a23..363dd2ac17e6 100644
> > > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > @@ -20,6 +20,7 @@ usb0_phy: phy at c0000000 {
> > >                         #phy-cells = <0>;
> > >                         reg = <0x0 0xc0000000 0x0 0x20>;
> > >                         resets = <&reset RESET_USB_OTG>;
> > > +                       reset-names = "phy-reset";
> > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> > >                         clock-names = "usb_general", "usb";
> > >                         status = "disabled";
> > > @@ -30,6 +31,7 @@ usb1_phy: phy at c0000020 {
> > >                         #phy-cells = <0>;
> > >                         reg = <0x0 0xc0000020 0x0 0x20>;
> > >                         resets = <&reset RESET_USB_OTG>;
> > > +                       reset-names = "phy-reset";
> > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> > >                         clock-names = "usb_general", "usb";
> > >                         status = "disabled";
> > I don't see why the above two changes are needed
> > see my comment about of_reset_control_get_shared below
> >
>
> Yep I borrowed this logic from rockchip usb phy controller.
> but I missed the action on reset.
>
> err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
> if (err)
> return err;
(assuming that your comment relates to the of_reset_control_get_shared
call below)
I checked rockchip_usb_phy_action and it's not calling reset_control_put either
this looks strange to me and I would say that there's a memory leak.

[...]
> > >  static const struct phy_ops phy_meson8b_usb2_ops = {
> > >         .power_on       = phy_meson8b_usb2_power_on,
> > >         .power_off      = phy_meson8b_usb2_power_off,
> > > +       .reset          = phy_meson8b_usb2_reset,
> > >         .owner          = THIS_MODULE,
> > >  };
> > I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> > after checking the dwc2 code this is expected: only in one very
> > specific case the dwc2 driver calls phy_reset
> > can you please find out how phy_meson8b_usb2_reset is called in your kernel?
> >
>
> Yep, Its not getting called on my board, l might be missing some thing.
are you sure that your patch fixes USB hotplug for you?

the new reset callback is a no-op because it's not called
the code below (of_reset_control_get_shared) only fetches the same
reset line that we are already using
so I am not sure what changed behavior you are seeing - can you please
explain this in more detail?

> > > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > > platform_device *pdev)
> > >                 return -EINVAL;
> > >         }
> > >
> > > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > > "phy-reset");
> > this causes a memory-leak upon driver removal
> > also a few lines above we are already getting the reset line, so why
> > is this needed?
>
> I had a feeling that USB_OTG reset will be shared between both the phy
> controller.
indeed, the USB_OTG reset is shared

> Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
> but Odroid C1 dose not have this feature.
have you found where the patched Amlogic kernel/u-boot use these reset lines?
if they need to be managed by us then we probably have a bug, because
we're not currently using these anywhere

> Next time I will try to do more testing on both the devices C1/C2.
> before sending some code for review or testing.
I am happy about everyone who helps fixing the USB hotplug issue!
it's a tricky issue where I don't even know if the USB PHY, dwc2
controller or something else is the culprit
so any help is appreciated :)


Best regards,
Martin

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-20 14:33                           ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-20 14:33 UTC (permalink / raw)
  To: Anand Moon
  Cc: U-Boot Mailing List, linux-amlogic, Neil Armstrong,
	u-boot-amlogic, Otto Meier

Hi Anand,

On Sun, Dec 20, 2020 at 2:46 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> > On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > [...]
> > > I was also looking into this issue so I made some changes in the
> > > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> > first I have some questions :-)
> > 1. do you see the same problem that Otto sees? this means: a) USB
> > hotplug works as long as at least one device is plugged in at boot b)
> > (if I understand Otto correctly then) it breaks once all USB devices
> > have been removed
>
> On C1/C2 issue is when single usb hdd is connected to board it will
> not get detected.
> unless you connect another usb keyboard or wireless dongle to the board.
>
> *USB hot plug only works if two ore more usb devices are connected.*
I am not sure if that's really the same issue as described by Otto

[...]
> > > amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > index 7c029f552a23..363dd2ac17e6 100644
> > > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
> > >                         #phy-cells = <0>;
> > >                         reg = <0x0 0xc0000000 0x0 0x20>;
> > >                         resets = <&reset RESET_USB_OTG>;
> > > +                       reset-names = "phy-reset";
> > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> > >                         clock-names = "usb_general", "usb";
> > >                         status = "disabled";
> > > @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
> > >                         #phy-cells = <0>;
> > >                         reg = <0x0 0xc0000020 0x0 0x20>;
> > >                         resets = <&reset RESET_USB_OTG>;
> > > +                       reset-names = "phy-reset";
> > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> > >                         clock-names = "usb_general", "usb";
> > >                         status = "disabled";
> > I don't see why the above two changes are needed
> > see my comment about of_reset_control_get_shared below
> >
>
> Yep I borrowed this logic from rockchip usb phy controller.
> but I missed the action on reset.
>
> err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
> if (err)
> return err;
(assuming that your comment relates to the of_reset_control_get_shared
call below)
I checked rockchip_usb_phy_action and it's not calling reset_control_put either
this looks strange to me and I would say that there's a memory leak.

[...]
> > >  static const struct phy_ops phy_meson8b_usb2_ops = {
> > >         .power_on       = phy_meson8b_usb2_power_on,
> > >         .power_off      = phy_meson8b_usb2_power_off,
> > > +       .reset          = phy_meson8b_usb2_reset,
> > >         .owner          = THIS_MODULE,
> > >  };
> > I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> > after checking the dwc2 code this is expected: only in one very
> > specific case the dwc2 driver calls phy_reset
> > can you please find out how phy_meson8b_usb2_reset is called in your kernel?
> >
>
> Yep, Its not getting called on my board, l might be missing some thing.
are you sure that your patch fixes USB hotplug for you?

the new reset callback is a no-op because it's not called
the code below (of_reset_control_get_shared) only fetches the same
reset line that we are already using
so I am not sure what changed behavior you are seeing - can you please
explain this in more detail?

> > > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > > platform_device *pdev)
> > >                 return -EINVAL;
> > >         }
> > >
> > > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > > "phy-reset");
> > this causes a memory-leak upon driver removal
> > also a few lines above we are already getting the reset line, so why
> > is this needed?
>
> I had a feeling that USB_OTG reset will be shared between both the phy
> controller.
indeed, the USB_OTG reset is shared

> Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
> but Odroid C1 dose not have this feature.
have you found where the patched Amlogic kernel/u-boot use these reset lines?
if they need to be managed by us then we probably have a bug, because
we're not currently using these anywhere

> Next time I will try to do more testing on both the devices C1/C2.
> before sending some code for review or testing.
I am happy about everyone who helps fixing the USB hotplug issue!
it's a tricky issue where I don't even know if the USB PHY, dwc2
controller or something else is the culprit
so any help is appreciated :)


Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-20 14:33                           ` Martin Blumenstingl
  0 siblings, 0 replies; 42+ messages in thread
From: Martin Blumenstingl @ 2020-12-20 14:33 UTC (permalink / raw)
  To: Anand Moon
  Cc: Otto Meier, Neil Armstrong, linux-amlogic, u-boot-amlogic,
	U-Boot Mailing List

Hi Anand,

On Sun, Dec 20, 2020 at 2:46 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> > On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > [...]
> > > I was also looking into this issue so I made some changes in the
> > > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> > first I have some questions :-)
> > 1. do you see the same problem that Otto sees? this means: a) USB
> > hotplug works as long as at least one device is plugged in at boot b)
> > (if I understand Otto correctly then) it breaks once all USB devices
> > have been removed
>
> On C1/C2 issue is when single usb hdd is connected to board it will
> not get detected.
> unless you connect another usb keyboard or wireless dongle to the board.
>
> *USB hot plug only works if two ore more usb devices are connected.*
I am not sure if that's really the same issue as described by Otto

[...]
> > > amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > index 7c029f552a23..363dd2ac17e6 100644
> > > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
> > >                         #phy-cells = <0>;
> > >                         reg = <0x0 0xc0000000 0x0 0x20>;
> > >                         resets = <&reset RESET_USB_OTG>;
> > > +                       reset-names = "phy-reset";
> > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> > >                         clock-names = "usb_general", "usb";
> > >                         status = "disabled";
> > > @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
> > >                         #phy-cells = <0>;
> > >                         reg = <0x0 0xc0000020 0x0 0x20>;
> > >                         resets = <&reset RESET_USB_OTG>;
> > > +                       reset-names = "phy-reset";
> > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> > >                         clock-names = "usb_general", "usb";
> > >                         status = "disabled";
> > I don't see why the above two changes are needed
> > see my comment about of_reset_control_get_shared below
> >
>
> Yep I borrowed this logic from rockchip usb phy controller.
> but I missed the action on reset.
>
> err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
> if (err)
> return err;
(assuming that your comment relates to the of_reset_control_get_shared
call below)
I checked rockchip_usb_phy_action and it's not calling reset_control_put either
this looks strange to me and I would say that there's a memory leak.

[...]
> > >  static const struct phy_ops phy_meson8b_usb2_ops = {
> > >         .power_on       = phy_meson8b_usb2_power_on,
> > >         .power_off      = phy_meson8b_usb2_power_off,
> > > +       .reset          = phy_meson8b_usb2_reset,
> > >         .owner          = THIS_MODULE,
> > >  };
> > I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> > after checking the dwc2 code this is expected: only in one very
> > specific case the dwc2 driver calls phy_reset
> > can you please find out how phy_meson8b_usb2_reset is called in your kernel?
> >
>
> Yep, Its not getting called on my board, l might be missing some thing.
are you sure that your patch fixes USB hotplug for you?

the new reset callback is a no-op because it's not called
the code below (of_reset_control_get_shared) only fetches the same
reset line that we are already using
so I am not sure what changed behavior you are seeing - can you please
explain this in more detail?

> > > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > > platform_device *pdev)
> > >                 return -EINVAL;
> > >         }
> > >
> > > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > > "phy-reset");
> > this causes a memory-leak upon driver removal
> > also a few lines above we are already getting the reset line, so why
> > is this needed?
>
> I had a feeling that USB_OTG reset will be shared between both the phy
> controller.
indeed, the USB_OTG reset is shared

> Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
> but Odroid C1 dose not have this feature.
have you found where the patched Amlogic kernel/u-boot use these reset lines?
if they need to be managed by us then we probably have a bug, because
we're not currently using these anywhere

> Next time I will try to do more testing on both the devices C1/C2.
> before sending some code for review or testing.
I am happy about everyone who helps fixing the USB hotplug issue!
it's a tricky issue where I don't even know if the USB PHY, dwc2
controller or something else is the culprit
so any help is appreciated :)


Best regards,
Martin

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

* [BUG]odroid-c2 does not hotplug usb-devices
  2020-12-20 14:33                           ` Martin Blumenstingl
  (?)
@ 2020-12-21 14:15                             ` Anand Moon
  -1 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-21 14:15 UTC (permalink / raw)
  To: u-boot

Hi Martin,

On Sun, 20 Dec 2020 at 20:04, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sun, Dec 20, 2020 at 2:46 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > > On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > > [...]
> > > > I was also looking into this issue so I made some changes in the
> > > > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> > > first I have some questions :-)
> > > 1. do you see the same problem that Otto sees? this means: a) USB
> > > hotplug works as long as at least one device is plugged in at boot b)
> > > (if I understand Otto correctly then) it breaks once all USB devices
> > > have been removed
> >
> > On C1/C2 issue is when single usb hdd is connected to board it will
> > not get detected.
> > unless you connect another usb keyboard or wireless dongle to the board.
> >
> > *USB hot plug only works if two ore more usb devices are connected.*
> I am not sure if that's really the same issue as described by Otto
>
OK.
> [...]
> > > > amoon at ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > index 7c029f552a23..363dd2ac17e6 100644
> > > > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > @@ -20,6 +20,7 @@ usb0_phy: phy at c0000000 {
> > > >                         #phy-cells = <0>;
> > > >                         reg = <0x0 0xc0000000 0x0 0x20>;
> > > >                         resets = <&reset RESET_USB_OTG>;
> > > > +                       reset-names = "phy-reset";
> > > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> > > >                         clock-names = "usb_general", "usb";
> > > >                         status = "disabled";
> > > > @@ -30,6 +31,7 @@ usb1_phy: phy at c0000020 {
> > > >                         #phy-cells = <0>;
> > > >                         reg = <0x0 0xc0000020 0x0 0x20>;
> > > >                         resets = <&reset RESET_USB_OTG>;
> > > > +                       reset-names = "phy-reset";
> > > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> > > >                         clock-names = "usb_general", "usb";
> > > >                         status = "disabled";
> > > I don't see why the above two changes are needed
> > > see my comment about of_reset_control_get_shared below
> > >
> >
> > Yep I borrowed this logic from rockchip usb phy controller.
> > but I missed the action on reset.
> >
> > err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
> > if (err)
> > return err;
> (assuming that your comment relates to the of_reset_control_get_shared
> call below)
> I checked rockchip_usb_phy_action and it's not calling reset_control_put either
> this looks strange to me and I would say that there's a memory leak.
>
Ok, I will try to check this, my approach was just to get the reset code
to get trigger, but is seem that it is not getting triggered,

> [...]
> > > >  static const struct phy_ops phy_meson8b_usb2_ops = {
> > > >         .power_on       = phy_meson8b_usb2_power_on,
> > > >         .power_off      = phy_meson8b_usb2_power_off,
> > > > +       .reset          = phy_meson8b_usb2_reset,
> > > >         .owner          = THIS_MODULE,
> > > >  };
> > > I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> > > after checking the dwc2 code this is expected: only in one very
> > > specific case the dwc2 driver calls phy_reset
> > > can you please find out how phy_meson8b_usb2_reset is called in your kernel?
> > >
> >
> > Yep, Its not getting called on my board, l might be missing some thing.
> are you sure that your patch fixes USB hotplug for you?
>
> the new reset callback is a no-op because it's not called
> the code below (of_reset_control_get_shared) only fetches the same
> reset line that we are already using
> so I am not sure what changed behavior you are seeing - can you please
> explain this in more detail?

I am looking into the phy-meson-gxl-usb2.c and I will try to model these changes
and see if it works on my boards.

Thanks
-Anand

>
> > > > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > > > platform_device *pdev)
> > > >                 return -EINVAL;
> > > >         }
> > > >
> > > > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > > > "phy-reset");
> > > this causes a memory-leak upon driver removal
> > > also a few lines above we are already getting the reset line, so why
> > > is this needed?
> >
> > I had a feeling that USB_OTG reset will be shared between both the phy
> > controller.
> indeed, the USB_OTG reset is shared
>
> > Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
> > but Odroid C1 dose not have this feature.
> have you found where the patched Amlogic kernel/u-boot use these reset lines?
> if they need to be managed by us then we probably have a bug, because
> we're not currently using these anywhere
>
> > Next time I will try to do more testing on both the devices C1/C2.
> > before sending some code for review or testing.
> I am happy about everyone who helps fixing the USB hotplug issue!
> it's a tricky issue where I don't even know if the USB PHY, dwc2
> controller or something else is the culprit
> so any help is appreciated :)
>
Ok,
>
> Best regards,
> Martin

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-21 14:15                             ` Anand Moon
  0 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-21 14:15 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: U-Boot Mailing List, linux-amlogic, Neil Armstrong,
	u-boot-amlogic, Otto Meier

Hi Martin,

On Sun, 20 Dec 2020 at 20:04, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sun, Dec 20, 2020 at 2:46 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > > On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > > [...]
> > > > I was also looking into this issue so I made some changes in the
> > > > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> > > first I have some questions :-)
> > > 1. do you see the same problem that Otto sees? this means: a) USB
> > > hotplug works as long as at least one device is plugged in at boot b)
> > > (if I understand Otto correctly then) it breaks once all USB devices
> > > have been removed
> >
> > On C1/C2 issue is when single usb hdd is connected to board it will
> > not get detected.
> > unless you connect another usb keyboard or wireless dongle to the board.
> >
> > *USB hot plug only works if two ore more usb devices are connected.*
> I am not sure if that's really the same issue as described by Otto
>
OK.
> [...]
> > > > amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > index 7c029f552a23..363dd2ac17e6 100644
> > > > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
> > > >                         #phy-cells = <0>;
> > > >                         reg = <0x0 0xc0000000 0x0 0x20>;
> > > >                         resets = <&reset RESET_USB_OTG>;
> > > > +                       reset-names = "phy-reset";
> > > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> > > >                         clock-names = "usb_general", "usb";
> > > >                         status = "disabled";
> > > > @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
> > > >                         #phy-cells = <0>;
> > > >                         reg = <0x0 0xc0000020 0x0 0x20>;
> > > >                         resets = <&reset RESET_USB_OTG>;
> > > > +                       reset-names = "phy-reset";
> > > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> > > >                         clock-names = "usb_general", "usb";
> > > >                         status = "disabled";
> > > I don't see why the above two changes are needed
> > > see my comment about of_reset_control_get_shared below
> > >
> >
> > Yep I borrowed this logic from rockchip usb phy controller.
> > but I missed the action on reset.
> >
> > err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
> > if (err)
> > return err;
> (assuming that your comment relates to the of_reset_control_get_shared
> call below)
> I checked rockchip_usb_phy_action and it's not calling reset_control_put either
> this looks strange to me and I would say that there's a memory leak.
>
Ok, I will try to check this, my approach was just to get the reset code
to get trigger, but is seem that it is not getting triggered,

> [...]
> > > >  static const struct phy_ops phy_meson8b_usb2_ops = {
> > > >         .power_on       = phy_meson8b_usb2_power_on,
> > > >         .power_off      = phy_meson8b_usb2_power_off,
> > > > +       .reset          = phy_meson8b_usb2_reset,
> > > >         .owner          = THIS_MODULE,
> > > >  };
> > > I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> > > after checking the dwc2 code this is expected: only in one very
> > > specific case the dwc2 driver calls phy_reset
> > > can you please find out how phy_meson8b_usb2_reset is called in your kernel?
> > >
> >
> > Yep, Its not getting called on my board, l might be missing some thing.
> are you sure that your patch fixes USB hotplug for you?
>
> the new reset callback is a no-op because it's not called
> the code below (of_reset_control_get_shared) only fetches the same
> reset line that we are already using
> so I am not sure what changed behavior you are seeing - can you please
> explain this in more detail?

I am looking into the phy-meson-gxl-usb2.c and I will try to model these changes
and see if it works on my boards.

Thanks
-Anand

>
> > > > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > > > platform_device *pdev)
> > > >                 return -EINVAL;
> > > >         }
> > > >
> > > > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > > > "phy-reset");
> > > this causes a memory-leak upon driver removal
> > > also a few lines above we are already getting the reset line, so why
> > > is this needed?
> >
> > I had a feeling that USB_OTG reset will be shared between both the phy
> > controller.
> indeed, the USB_OTG reset is shared
>
> > Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
> > but Odroid C1 dose not have this feature.
> have you found where the patched Amlogic kernel/u-boot use these reset lines?
> if they need to be managed by us then we probably have a bug, because
> we're not currently using these anywhere
>
> > Next time I will try to do more testing on both the devices C1/C2.
> > before sending some code for review or testing.
> I am happy about everyone who helps fixing the USB hotplug issue!
> it's a tricky issue where I don't even know if the USB PHY, dwc2
> controller or something else is the culprit
> so any help is appreciated :)
>
Ok,
>
> Best regards,
> Martin

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [BUG]odroid-c2 does not hotplug usb-devices
@ 2020-12-21 14:15                             ` Anand Moon
  0 siblings, 0 replies; 42+ messages in thread
From: Anand Moon @ 2020-12-21 14:15 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: Otto Meier, Neil Armstrong, linux-amlogic, u-boot-amlogic,
	U-Boot Mailing List

Hi Martin,

On Sun, 20 Dec 2020 at 20:04, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Sun, Dec 20, 2020 at 2:46 PM Anand Moon <linux.amoon@gmail.com> wrote:
> [...]
> > > On Sat, Dec 19, 2020 at 8:53 PM Anand Moon <linux.amoon@gmail.com> wrote:
> > > [...]
> > > > I was also looking into this issue so I made some changes in the
> > > > phy driver to resolve the issue. Plz share your thoughts on the changes below.
> > > first I have some questions :-)
> > > 1. do you see the same problem that Otto sees? this means: a) USB
> > > hotplug works as long as at least one device is plugged in at boot b)
> > > (if I understand Otto correctly then) it breaks once all USB devices
> > > have been removed
> >
> > On C1/C2 issue is when single usb hdd is connected to board it will
> > not get detected.
> > unless you connect another usb keyboard or wireless dongle to the board.
> >
> > *USB hot plug only works if two ore more usb devices are connected.*
> I am not sure if that's really the same issue as described by Otto
>
OK.
> [...]
> > > > amoon@ThinkPad-T440s:~/mainline/linux-aml-5.y-devel$ git diff
> > > > diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > index 7c029f552a23..363dd2ac17e6 100644
> > > > --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
> > > > @@ -20,6 +20,7 @@ usb0_phy: phy@c0000000 {
> > > >                         #phy-cells = <0>;
> > > >                         reg = <0x0 0xc0000000 0x0 0x20>;
> > > >                         resets = <&reset RESET_USB_OTG>;
> > > > +                       reset-names = "phy-reset";
> > > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>;
> > > >                         clock-names = "usb_general", "usb";
> > > >                         status = "disabled";
> > > > @@ -30,6 +31,7 @@ usb1_phy: phy@c0000020 {
> > > >                         #phy-cells = <0>;
> > > >                         reg = <0x0 0xc0000020 0x0 0x20>;
> > > >                         resets = <&reset RESET_USB_OTG>;
> > > > +                       reset-names = "phy-reset";
> > > >                         clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>;
> > > >                         clock-names = "usb_general", "usb";
> > > >                         status = "disabled";
> > > I don't see why the above two changes are needed
> > > see my comment about of_reset_control_get_shared below
> > >
> >
> > Yep I borrowed this logic from rockchip usb phy controller.
> > but I missed the action on reset.
> >
> > err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,  rk_phy);
> > if (err)
> > return err;
> (assuming that your comment relates to the of_reset_control_get_shared
> call below)
> I checked rockchip_usb_phy_action and it's not calling reset_control_put either
> this looks strange to me and I would say that there's a memory leak.
>
Ok, I will try to check this, my approach was just to get the reset code
to get trigger, but is seem that it is not getting triggered,

> [...]
> > > >  static const struct phy_ops phy_meson8b_usb2_ops = {
> > > >         .power_on       = phy_meson8b_usb2_power_on,
> > > >         .power_off      = phy_meson8b_usb2_power_off,
> > > > +       .reset          = phy_meson8b_usb2_reset,
> > > >         .owner          = THIS_MODULE,
> > > >  };
> > > I tested this on my Odroid-C1: phy_meson8b_usb2_reset is never called
> > > after checking the dwc2 code this is expected: only in one very
> > > specific case the dwc2 driver calls phy_reset
> > > can you please find out how phy_meson8b_usb2_reset is called in your kernel?
> > >
> >
> > Yep, Its not getting called on my board, l might be missing some thing.
> are you sure that your patch fixes USB hotplug for you?
>
> the new reset callback is a no-op because it's not called
> the code below (of_reset_control_get_shared) only fetches the same
> reset line that we are already using
> so I am not sure what changed behavior you are seeing - can you please
> explain this in more detail?

I am looking into the phy-meson-gxl-usb2.c and I will try to model these changes
and see if it works on my boards.

Thanks
-Anand

>
> > > > @@ -271,6 +277,10 @@ static int phy_meson8b_usb2_probe(struct
> > > > platform_device *pdev)
> > > >                 return -EINVAL;
> > > >         }
> > > >
> > > > +       priv->reset = of_reset_control_get_shared(pdev->dev.of_node,
> > > > "phy-reset");
> > > this causes a memory-leak upon driver removal
> > > also a few lines above we are already getting the reset line, so why
> > > is this needed?
> >
> > I had a feeling that USB_OTG reset will be shared between both the phy
> > controller.
> indeed, the USB_OTG reset is shared
>
> > Odroid C2 reset controller have additional RESET_USB_DDR_[0,3] reset,
> > but Odroid C1 dose not have this feature.
> have you found where the patched Amlogic kernel/u-boot use these reset lines?
> if they need to be managed by us then we probably have a bug, because
> we're not currently using these anywhere
>
> > Next time I will try to do more testing on both the devices C1/C2.
> > before sending some code for review or testing.
> I am happy about everyone who helps fixing the USB hotplug issue!
> it's a tricky issue where I don't even know if the USB PHY, dwc2
> controller or something else is the culprit
> so any help is appreciated :)
>
Ok,
>
> Best regards,
> Martin

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

end of thread, other threads:[~2020-12-21 14:16 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 17:09 [BUG]odroid-c2 does not hotplug usb-devices Otto Meier
2020-12-05 11:54 ` Martin Blumenstingl
2020-12-05 17:40   ` Otto Meier
2020-12-05 19:55     ` Martin Blumenstingl
2020-12-07 12:19       ` Otto Meier
2020-12-07 12:19         ` Otto Meier
2020-12-07 12:29         ` Neil Armstrong
2020-12-07 12:29           ` Neil Armstrong
2020-12-07 12:29           ` Neil Armstrong
2020-12-07 12:43           ` Otto Meier
2020-12-07 12:43             ` Otto Meier
2020-12-07 12:43             ` Otto Meier
2020-12-13 18:46             ` Martin Blumenstingl
2020-12-13 18:46               ` Martin Blumenstingl
2020-12-13 18:46               ` Martin Blumenstingl
2020-12-14 19:33               ` Otto Meier
2020-12-14 19:33                 ` Otto Meier
2020-12-14 19:33                 ` Otto Meier
2020-12-19 13:58                 ` Martin Blumenstingl
2020-12-19 13:58                   ` Martin Blumenstingl
2020-12-19 13:58                   ` Martin Blumenstingl
2020-12-19 18:41                   ` Otto Meier
2020-12-19 18:41                     ` Otto Meier
2020-12-19 18:41                     ` Otto Meier
2020-12-19 19:53                   ` Anand Moon
2020-12-19 19:53                     ` Anand Moon
2020-12-19 19:53                     ` Anand Moon
2020-12-19 22:31                     ` Martin Blumenstingl
2020-12-19 22:31                       ` Martin Blumenstingl
2020-12-19 22:31                       ` Martin Blumenstingl
2020-12-20 10:28                       ` Otto Meier
2020-12-20 10:28                         ` Otto Meier
2020-12-20 10:28                         ` Otto Meier
2020-12-20 13:46                       ` Anand Moon
2020-12-20 13:46                         ` Anand Moon
2020-12-20 13:46                         ` Anand Moon
2020-12-20 14:33                         ` Martin Blumenstingl
2020-12-20 14:33                           ` Martin Blumenstingl
2020-12-20 14:33                           ` Martin Blumenstingl
2020-12-21 14:15                           ` Anand Moon
2020-12-21 14:15                             ` Anand Moon
2020-12-21 14:15                             ` Anand Moon

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.