usb: dwc3: Enable PHY support
Subsystems (2)
PATCH v3 1/2 generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/
In reply to Michal SimekAllow to disable PHY driver in SPL because it checks the CONFIG_SPL_PHY variable for SPL builds.
The same change was done for usb by commit fd09c205fc57 ("usb:
s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/").
---
(no changes since v2)
Changes in v2:
- based on bug reported by Marek
https://lore.kernel.org/all/[email protected]/
include/generic-phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/generic-phy.h +1 -1
@@ -155,7 +155,7 @@ struct phy_bulk {unsigned int count; }; -#ifdef CONFIG_PHY +#if CONFIG_IS_ENABLED (PHY )/** * generic_phy_init() - initialize the PHY port
Signature · 1 line
2.35.1
v3 cover usb: dwc3: Enable PHY support
Hi,
I am sending two patches for adding PHY support for DWC3 driver. For getting this work one header patch is required to fix issue with am57xx_hs_evm_usb_defconfig which enabled CONFIG_PHY and DWC3 drivers for U-Boot proper but doesn't enable CONFIG_SPL_PHY support. That's why there is a need to use CONFIG_IS_ENABLED macro to also properly handle SPL builds.
Marek: Please take both of these patches via your usb tree.
Thanks,
Michal
Changes in v3:
- Add cover letter
Changes in v2:
- based on bug reported by Marek
https://lore.kernel.org/all/[email protected]/
- Add missing header
Michal Simek (2):
generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/
usb: dwc3: Add support for usb3-phy PHY configuration
drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ include/generic-phy.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-)
Signature · 1 line
2.35.1
PATCH v3 2/2 usb: dwc3: Add support for usb3-phy PHY configuration
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT.
---
Changes in v3:
- Add cover letter
Changes in v2:
- Add missing header
drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/usb/dwc3/dwc3-generic.c +18 -0
@@ -14,6 +14,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h>
@@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev)struct udevice *child =NULL ;int index =0 ;int ret; +struct phy phy; + + ret =generic_phy_get_by_name (dev,"usb3-phy" , &phy); +if (!ret) { + ret =generic_phy_init (&phy); +if (ret) +return ret; + }else if (ret != -ENOENT ) { +debug ("could not get phy (err %d)\n" , ret); +return ret; + } glue->regs =dev_read_addr (dev);
@@ -420,6 +432,12 @@ static int dwc3_glue_probe(struct udevice *dev)if (ret)return ret; +if (phy.dev) { + ret =generic_phy_power_on (&phy); +if (ret) +return ret; + } + ret =device_find_first_child (dev, &child);if (ret)return ret;
Signature · 1 line
2.35.1
Re: [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/
In reply to Michal SimekQuoted 10 lines · Michal Simek
Allow to disable PHY driver in SPL because it checks the
CONFIG_SPL_PHYvariable for SPL builds.The same change was done for usb by commit
fd09c205fc57("usb:
s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/").Signed-off-by Michal Simek <[email protected]>---
Quoted 9 lines
(no changes since v2)
Changes in v2:
- based on bug reported by Marek
https://lore.kernel.org/all/[email protected]/include/generic-phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
In reply to Michal SimekQuoted 8 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT.
Signed-off-by Michal Simek <[email protected]>---
Quoted 9 lines
Changes in v3:
- Add cover letterChanges in v2:
- Add missing headerdrivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
In reply to Michal SimekQuoted 49 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT.
Signed-off-by Michal Simek <[email protected]>---
Changes in v3:
- Add cover letterChanges in v2:
- Add missing headerdrivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/usb/dwc3/dwc3-generic.c +12
-0@@ -14,6 +14,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h> @@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev)struct udevice *child =NULL ;int index =0 ;int ret; +struct phy phy; + + ret =generic_phy_get_by_name (dev,"usb3-phy" , &phy); +if (!ret) { + ret =generic_phy_init (&phy); +if (ret) +return ret; + }else if (ret != -ENOENT ) { +debug ("could not get phy (err %d)\n" , ret); +return ret; + } glue->regs =dev_read_addr (dev);@@ -420,6 +432,12 @@ static int dwc3_glue_probe(struct udevice *dev)if (ret)return ret;
drivers/usb/dwc3/dwc3-generic.c static int dwc3_glue_probe(struct udevice *dev) · line 443
Quoted 10 lines
drivers/usb/dwc3/dwc3-generic.c +6
-0+if (phy.dev) { + ret =generic_phy_power_on (&phy); +if (ret) +return ret; + } + ret =device_find_first_child (dev, &child);if (ret)return ret;
Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
...
starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first.
Is there anything that boards need to consider now?
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
Hi Jan,
Quoted 80 lines · Jan Kiszka
Quoted 49 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT.
Signed-off-by Michal Simek <[email protected]>---
Changes in v3:
- Add cover letterChanges in v2:
- Add missing headerdrivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/usb/dwc3/dwc3-generic.c +12
-0@@ -14,6 +14,7 @@#include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h> @@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev)struct udevice *child =NULL ;int index =0 ;int ret; +struct phy phy; + + ret =generic_phy_get_by_name (dev,"usb3-phy" , &phy); +if (!ret) { + ret =generic_phy_init (&phy); +if (ret) +return ret; + }else if (ret != -ENOENT ) { +debug ("could not get phy (err %d)\n" , ret); +return ret; + } glue->regs =dev_read_addr (dev);@@ -420,6 +432,12 @@ static int dwc3_glue_probe(struct udevice *dev)if (ret)return ret;drivers/usb/dwc3/dwc3-generic.c static int dwc3_glue_probe(struct udevice *dev) · line 443
Quoted 10 lines
drivers/usb/dwc3/dwc3-generic.c +6
-0+if (phy.dev) { + ret =generic_phy_power_on (&phy); +if (ret) +return ret; + } + ret =device_find_first_child (dev, &child);if (ret)return ret;Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
...
starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first.
Quoted 1 line
Is there anything that boards need to consider now?
-61 is ENODATA. I have looked at DT and there is no usb3-phy property. That's why generic_phy_get_by_name() can't return 0. Does it return -ENOENT?
Maybe it returns ENODATA and it should be also handled in else part.
Can you please enable debug and see?
Thanks,
Michal
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
Quoted 83 lines · Michal Simek
Hi Jan,
Quoted 78 lines · Jan Kiszka
Quoted 49 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT.
Signed-off-by Michal Simek <[email protected]>---
Changes in v3:
- Add cover letterChanges in v2:
- Add missing header
drivers/usb/dwc3/dwc3-generic.c| 18 ++++++++++++++++++1 file changed, 18 insertions(+)drivers/usb/dwc3/dwc3-generic.c +12
-0@@ -14,6 +14,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h>@@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev) struct udevice *child = NULL; int index = 0; int ret; + struct phy phy; + + ret = generic_phy_get_by_name(dev, "usb3-phy", &phy); + if (!ret) { + ret = generic_phy_init(&phy); + if (ret) + return ret; + } else if (ret != -ENOENT) { + debug("could not get phy (err %d)\n", ret); + return ret; + } glue->regs = dev_read_addr(dev); @@ -420,6 +432,12 @@ static int dwc3_glue_probe(struct udevice *dev) if (ret)return ret;
+ if (phy.dev) {Quoted 8 lines
+ ret =
generic_phy_power_on(&phy);
+ if (ret)
+ return ret;
+ }
+
ret =device_find_first_child(dev, &child);
if (ret)
return ret;Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
...
starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first.Quoted 1 line
Is there anything that boards need to consider now?
Quoted 8 lines
-61 is ENODATA. I have looked at DT and there is no usb3-phy property. That's why
generic_phy_get_by_name()can't return 0. Does it return-ENOENT?Maybe it returns ENODATA and it should be also handled in else part.
Can you please enable debug and see?
#define DEBUG in the patched file or where?
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
Quoted 88 lines · Jan Kiszka
Quoted 87 lines · Michal Simek
Hi Jan,
Quoted 78 lines · Jan Kiszka
Quoted 49 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT.
Signed-off-by Michal Simek <[email protected]>---
Changes in v3:
- Add cover letterChanges in v2:
- Add missing headerdrivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/usb/dwc3/dwc3-generic.c +12
-0@@ -14,6 +14,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h>@@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev) struct udevice *child = NULL; int index = 0; int ret; + struct phy phy; + + ret = generic_phy_get_by_name(dev, "usb3-phy", &phy); + if (!ret) { + ret = generic_phy_init(&phy); + if (ret) + return ret; + } else if (ret != -ENOENT) { + debug("could not get phy (err %d)\n", ret); + return ret; + } glue->regs = dev_read_addr(dev); @@ -420,6 +432,12 @@ static int dwc3_glue_probe(struct udevice *dev) if (ret)return ret;
+ if (phy.dev) {Quoted 8 lines
+ ret =
generic_phy_power_on(&phy); + if (ret)
+ return ret;
+ }
+
ret =device_find_first_child(dev, &child); if (ret)
return ret;Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
...
starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first.Quoted 1 line
Is there anything that boards need to consider now?
-61 is ENODATA. I have looked at DT and there is no usb3-phy property. That's why
generic_phy_get_by_name()can't return 0. Does it return-ENOENT?
Quoted 6 lines
Quoted 4 lines
Maybe it returns ENODATA and it should be also handled in else part.
Can you please enable debug and see?
#define DEBUG in the patched file or where?
yes above of headers in this file is enough.
M
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
Quoted 95 lines · Michal Simek
Quoted 92 lines · Jan Kiszka
Quoted 91 lines · Michal Simek
Hi Jan,
Quoted 80 lines · Jan Kiszka
Quoted 51 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT
lines based on description in DT.Signed-off-by Michal Simek <[email protected]>---
Changes in v3:
- Add cover letterChanges in v2:
- Add missing header
drivers/usb/dwc3/dwc3-generic.c| 18 ++++++++++++++++++1 file changed, 18 insertions(+)drivers/usb/dwc3/dwc3-generic.c +12
-0@@ -14,6 +14,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h>@@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev) struct udevice *child = NULL; int index = 0; int ret; + struct phy phy; + + ret = generic_phy_get_by_name(dev, "usb3-phy", &phy); + if (!ret) { + ret = generic_phy_init(&phy); + if (ret) + return ret; + } else if (ret != -ENOENT) { + debug("could not get phy (err %d)\n", ret); + return ret; + } glue->regs = dev_read_addr(dev);@@ -420,6 +432,12 @@ static int
dwc3_glue_probe(struct udevice *dev)
if (ret)
return ret;
+ if (phy.dev) {Quoted 8 lines
+ ret =
generic_phy_power_on(&phy); + if (ret)
+ return ret;
+ }
+
ret =device_find_first_child(dev, &child); if (ret)
return ret;Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
...
starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first.Quoted 1 line
Is there anything that boards need to consider now?
-61 is ENODATA. I have looked at DT and there is no usb3-phy property. That's why
generic_phy_get_by_name()can't return 0. Does it return-ENOENT?Maybe it returns ENODATA and it should be also handled in else part.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Can you please enable debug and see?
#define DEBUG in the patched file or where?
yes above of headers in this file is enough.
M
starting USB...
Bus usb@10000: could not get phy (err -61)
probe failed, error -61
Bus usb@10000: could not get phy (err -61)
probe failed, error -61
No working controllers found
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
Quoted 103 lines · Jan Kiszka
Quoted 102 lines · Michal Simek
Quoted 90 lines · Jan Kiszka
Quoted 89 lines · Michal Simek
Hi Jan,
Quoted 80 lines · Jan Kiszka
Quoted 51 lines · Michal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT
lines based on description in DT.Signed-off-by Michal Simek <[email protected]>---
Changes in v3:
- Add cover letterChanges in v2:
- Add missing header
drivers/usb/dwc3/dwc3-generic.c| 18 ++++++++++++++++++1 file changed, 18 insertions(+)drivers/usb/dwc3/dwc3-generic.c +12
-0@@ -14,6 +14,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <dwc3-uboot.h> +#include <generic-phy.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/usb/ch9.h>@@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev) struct udevice *child = NULL; int index = 0; int ret; + struct phy phy; + + ret = generic_phy_get_by_name(dev, "usb3-phy", &phy); + if (!ret) { + ret = generic_phy_init(&phy); + if (ret) + return ret; + } else if (ret != -ENOENT) { + debug("could not get phy (err %d)\n", ret); + return ret; + } glue->regs = dev_read_addr(dev);@@ -420,6 +432,12 @@ static int
dwc3_glue_probe(struct udevice *dev)
if (ret)
return ret;
+ if (phy.dev) {Quoted 8 lines
+ ret =
generic_phy_power_on(&phy); + if (ret)
+ return ret;
+ }
+
ret =device_find_first_child(dev, &child); if (ret)
return ret;Breaks USB on the iot2050-pg1 (am65x) - this one has NO usb3-phy:
...
starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first. starting USB...
Bus usb@10000: probe failed, error -61 Bus usb@10000: probe failed, error -61 No working controllers found
USB is stopped. Please issue 'usb start' first.Quoted 1 line
Is there anything that boards need to consider now?
-61 is ENODATA. I have looked at DT and there is no usb3-phy property. That's why
generic_phy_get_by_name()can't return 0. Does it return-ENOENT?Quoted 6 lines
Quoted 4 lines
Maybe it returns ENODATA and it should be also handled in else part.
Can you please enable debug and see?
#define DEBUG in the patched file or where?
yes above of headers in this file is enough.
Quoted 9 lines
Quoted 1 line
M
starting USB...
Bus usb@10000: could not get phy (err -61)
probe failed, error -61
Bus usb@10000: could not get phy (err -61)
probe failed, error -61
No working controllers found
You need the -ENODATA check as well, see e.g.drivers/usb/dwc3/dwc3-meson-g12a.c.
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux