* [PATCH v3 0/2] usb: dwc3: Enable PHY support @ 2022-03-09 9:05 Michal Simek 2022-03-09 9:05 ` [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ Michal Simek 2022-03-09 9:05 ` [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration Michal Simek 0 siblings, 2 replies; 11+ messages in thread From: Michal Simek @ 2022-03-09 9:05 UTC (permalink / raw) To: u-boot, git, Marek Vasut Cc: Angus Ainslie, Heinrich Schuchardt, Kunihiko Hayashi, Simon Glass, Wolfgang Denk 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/d7adc9a4-f505-eaab-8cd9-45f778bc3b4a@denx.de/ - 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(-) -- 2.35.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ 2022-03-09 9:05 [PATCH v3 0/2] usb: dwc3: Enable PHY support Michal Simek @ 2022-03-09 9:05 ` Michal Simek 2022-03-14 7:24 ` Bin Meng 2022-03-09 9:05 ` [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration Michal Simek 1 sibling, 1 reply; 11+ messages in thread From: Michal Simek @ 2022-03-09 9:05 UTC (permalink / raw) To: u-boot, git, Marek Vasut; +Cc: Heinrich Schuchardt, Wolfgang Denk Allow 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)/"). Signed-off-by: Michal Simek <michal.simek@xilinx.com> --- (no changes since v2) Changes in v2: - based on bug reported by Marek https://lore.kernel.org/all/d7adc9a4-f505-eaab-8cd9-45f778bc3b4a@denx.de/ include/generic-phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/generic-phy.h b/include/generic-phy.h index ff48b3708195..d40ce589b645 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -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 -- 2.35.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ 2022-03-09 9:05 ` [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ Michal Simek @ 2022-03-14 7:24 ` Bin Meng 0 siblings, 0 replies; 11+ messages in thread From: Bin Meng @ 2022-03-14 7:24 UTC (permalink / raw) To: Michal Simek Cc: U-Boot Mailing List, git, Marek Vasut, Heinrich Schuchardt, Wolfgang Denk On Wed, Mar 9, 2022 at 5:06 PM Michal Simek <michal.simek@xilinx.com> wrote: > > Allow 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)/"). > > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > --- > > (no changes since v2) > > Changes in v2: > - based on bug reported by Marek > https://lore.kernel.org/all/d7adc9a4-f505-eaab-8cd9-45f778bc3b4a@denx.de/ > > include/generic-phy.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-03-09 9:05 [PATCH v3 0/2] usb: dwc3: Enable PHY support Michal Simek 2022-03-09 9:05 ` [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ Michal Simek @ 2022-03-09 9:05 ` Michal Simek 2022-03-14 7:24 ` Bin Meng 2022-04-25 9:47 ` Jan Kiszka 1 sibling, 2 replies; 11+ messages in thread From: Michal Simek @ 2022-03-09 9:05 UTC (permalink / raw) To: u-boot, git, Marek Vasut; +Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass 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 <michal.simek@xilinx.com> --- Changes in v3: - Add cover letter Changes in v2: - Add missing header drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 01bd0ca190e3..2c5205df62cd 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -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; -- 2.35.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-03-09 9:05 ` [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration Michal Simek @ 2022-03-14 7:24 ` Bin Meng 2022-04-25 9:47 ` Jan Kiszka 1 sibling, 0 replies; 11+ messages in thread From: Bin Meng @ 2022-03-14 7:24 UTC (permalink / raw) To: Michal Simek Cc: U-Boot Mailing List, git, Marek Vasut, Angus Ainslie, Kunihiko Hayashi, Simon Glass On Wed, Mar 9, 2022 at 5:06 PM Michal Simek <michal.simek@xilinx.com> wrote: > > 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 <michal.simek@xilinx.com> > --- > > Changes in v3: > - Add cover letter > > Changes in v2: > - Add missing header > > drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-03-09 9:05 ` [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration Michal Simek 2022-03-14 7:24 ` Bin Meng @ 2022-04-25 9:47 ` Jan Kiszka 2022-04-25 9:56 ` Michal Simek 1 sibling, 1 reply; 11+ messages in thread From: Jan Kiszka @ 2022-04-25 9:47 UTC (permalink / raw) To: Michal Simek, u-boot, git, Marek Vasut Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass On 09.03.22 10:05, Michal Simek wrote: > 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 <michal.simek@xilinx.com> > --- > > Changes in v3: > - Add cover letter > > Changes in v2: > - Add missing header > > drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c > index 01bd0ca190e3..2c5205df62cd 100644 > --- a/drivers/usb/dwc3/dwc3-generic.c > +++ b/drivers/usb/dwc3/dwc3-generic.c > @@ -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; 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 -- Siemens AG, Technology Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-04-25 9:47 ` Jan Kiszka @ 2022-04-25 9:56 ` Michal Simek 2022-04-25 10:05 ` Jan Kiszka 0 siblings, 1 reply; 11+ messages in thread From: Michal Simek @ 2022-04-25 9:56 UTC (permalink / raw) To: Jan Kiszka, Michal Simek, u-boot, git, Marek Vasut Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass Hi Jan, On 4/25/22 11:47, Jan Kiszka wrote: > On 09.03.22 10:05, Michal Simek wrote: >> 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 <michal.simek@xilinx.com> >> --- >> >> Changes in v3: >> - Add cover letter >> >> Changes in v2: >> - Add missing header >> >> drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ >> 1 file changed, 18 insertions(+) >> >> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c >> index 01bd0ca190e3..2c5205df62cd 100644 >> --- a/drivers/usb/dwc3/dwc3-generic.c >> +++ b/drivers/usb/dwc3/dwc3-generic.c >> @@ -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; > > 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? -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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-04-25 9:56 ` Michal Simek @ 2022-04-25 10:05 ` Jan Kiszka 2022-04-25 10:06 ` Michal Simek 0 siblings, 1 reply; 11+ messages in thread From: Jan Kiszka @ 2022-04-25 10:05 UTC (permalink / raw) To: Michal Simek, u-boot, git, Marek Vasut Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass On 25.04.22 11:56, Michal Simek wrote: > Hi Jan, > > On 4/25/22 11:47, Jan Kiszka wrote: >> On 09.03.22 10:05, Michal Simek wrote: >>> 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 <michal.simek@xilinx.com> >>> --- >>> >>> Changes in v3: >>> - Add cover letter >>> >>> Changes in v2: >>> - Add missing header >>> >>> drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ >>> 1 file changed, 18 insertions(+) >>> >>> diff --git a/drivers/usb/dwc3/dwc3-generic.c >>> b/drivers/usb/dwc3/dwc3-generic.c >>> index 01bd0ca190e3..2c5205df62cd 100644 >>> --- a/drivers/usb/dwc3/dwc3-generic.c >>> +++ b/drivers/usb/dwc3/dwc3-generic.c >>> @@ -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; >> >> 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? > > -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 -- Siemens AG, Technology Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-04-25 10:05 ` Jan Kiszka @ 2022-04-25 10:06 ` Michal Simek 2022-04-25 10:09 ` Jan Kiszka 0 siblings, 1 reply; 11+ messages in thread From: Michal Simek @ 2022-04-25 10:06 UTC (permalink / raw) To: Jan Kiszka, Michal Simek, u-boot, git, Marek Vasut Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass On 4/25/22 12:05, Jan Kiszka wrote: > On 25.04.22 11:56, Michal Simek wrote: >> Hi Jan, >> >> On 4/25/22 11:47, Jan Kiszka wrote: >>> On 09.03.22 10:05, Michal Simek wrote: >>>> 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 <michal.simek@xilinx.com> >>>> --- >>>> >>>> Changes in v3: >>>> - Add cover letter >>>> >>>> Changes in v2: >>>> - Add missing header >>>> >>>> drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ >>>> 1 file changed, 18 insertions(+) >>>> >>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c >>>> b/drivers/usb/dwc3/dwc3-generic.c >>>> index 01bd0ca190e3..2c5205df62cd 100644 >>>> --- a/drivers/usb/dwc3/dwc3-generic.c >>>> +++ b/drivers/usb/dwc3/dwc3-generic.c >>>> @@ -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; >>> >>> 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? >> >> -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? yes above of headers in this file is enough. M ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-04-25 10:06 ` Michal Simek @ 2022-04-25 10:09 ` Jan Kiszka 2022-04-25 10:14 ` Jan Kiszka 0 siblings, 1 reply; 11+ messages in thread From: Jan Kiszka @ 2022-04-25 10:09 UTC (permalink / raw) To: Michal Simek, u-boot, git, Marek Vasut Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass On 25.04.22 12:06, Michal Simek wrote: > > > On 4/25/22 12:05, Jan Kiszka wrote: >> On 25.04.22 11:56, Michal Simek wrote: >>> Hi Jan, >>> >>> On 4/25/22 11:47, Jan Kiszka wrote: >>>> On 09.03.22 10:05, Michal Simek wrote: >>>>> 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 <michal.simek@xilinx.com> >>>>> --- >>>>> >>>>> Changes in v3: >>>>> - Add cover letter >>>>> >>>>> Changes in v2: >>>>> - Add missing header >>>>> >>>>> drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ >>>>> 1 file changed, 18 insertions(+) >>>>> >>>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c >>>>> b/drivers/usb/dwc3/dwc3-generic.c >>>>> index 01bd0ca190e3..2c5205df62cd 100644 >>>>> --- a/drivers/usb/dwc3/dwc3-generic.c >>>>> +++ b/drivers/usb/dwc3/dwc3-generic.c >>>>> @@ -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; >>>> >>>> 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? >>> >>> -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? > > 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 -- Siemens AG, Technology Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration 2022-04-25 10:09 ` Jan Kiszka @ 2022-04-25 10:14 ` Jan Kiszka 0 siblings, 0 replies; 11+ messages in thread From: Jan Kiszka @ 2022-04-25 10:14 UTC (permalink / raw) To: Michal Simek, u-boot, git, Marek Vasut Cc: Angus Ainslie, Kunihiko Hayashi, Simon Glass On 25.04.22 12:09, Jan Kiszka wrote: > On 25.04.22 12:06, Michal Simek wrote: >> >> >> On 4/25/22 12:05, Jan Kiszka wrote: >>> On 25.04.22 11:56, Michal Simek wrote: >>>> Hi Jan, >>>> >>>> On 4/25/22 11:47, Jan Kiszka wrote: >>>>> On 09.03.22 10:05, Michal Simek wrote: >>>>>> 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 <michal.simek@xilinx.com> >>>>>> --- >>>>>> >>>>>> Changes in v3: >>>>>> - Add cover letter >>>>>> >>>>>> Changes in v2: >>>>>> - Add missing header >>>>>> >>>>>> drivers/usb/dwc3/dwc3-generic.c | 18 ++++++++++++++++++ >>>>>> 1 file changed, 18 insertions(+) >>>>>> >>>>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c >>>>>> b/drivers/usb/dwc3/dwc3-generic.c >>>>>> index 01bd0ca190e3..2c5205df62cd 100644 >>>>>> --- a/drivers/usb/dwc3/dwc3-generic.c >>>>>> +++ b/drivers/usb/dwc3/dwc3-generic.c >>>>>> @@ -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; >>>>> >>>>> 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? >>>> >>>> -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? >> >> 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 > You need the -ENODATA check as well, see e.g. drivers/usb/dwc3/dwc3-meson-g12a.c. Jan -- Siemens AG, Technology Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-04-25 10:14 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-09 9:05 [PATCH v3 0/2] usb: dwc3: Enable PHY support Michal Simek 2022-03-09 9:05 ` [PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ Michal Simek 2022-03-14 7:24 ` Bin Meng 2022-03-09 9:05 ` [PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration Michal Simek 2022-03-14 7:24 ` Bin Meng 2022-04-25 9:47 ` Jan Kiszka 2022-04-25 9:56 ` Michal Simek 2022-04-25 10:05 ` Jan Kiszka 2022-04-25 10:06 ` Michal Simek 2022-04-25 10:09 ` Jan Kiszka 2022-04-25 10:14 ` Jan Kiszka
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox