Skip to contentSkip to conversation

usb: dwc3: Handle case where setup_phy is not needed

PATCH New Siva Durga Prasad Paladugu 4 participants 8 messages Apr 1, 2019 – Jun 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional so modify error check to handle this -ENOTSUPP.

---
 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +1 -1
index 3e6c494..a261d8d 100644
@@ -47,7 +47,7 @@ static int dwc3_generic_peripheral_probe(struct udevice *dev)
 	struct dwc3 *dwc3 = &priv->dwc3;
 
 	rc = dwc3_setup_phy(dev, &priv->phys, &priv->num_phys);
-	if (rc)
+	if (rc && rc != -ENOTSUPP)
 		return rc;
 
 	dwc3->regs = map_physmem(priv->base, DWC3_OTG_REGS_END, MAP_NOCACHE);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

^^^^^^^^^^^^^^^^^^^^^^^^^^^ - could you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

Quoted 20 lines

so modify error check to handle this -ENOTSUPP.

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]> ---

 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/dwc3/dwc3-generic.c index 3e6c494..a261d8d 100644

drivers/usb/dwc3/dwc3-generic.c +1 -1
@@ -47,7 +47,7 @@ static int dwc3_generic_peripheral_probe(struct
 udevice *dev) struct dwc3 *dwc3 = &priv->dwc3;
 
 	rc = dwc3_setup_phy(dev, &priv->phys, &priv->num_phys);
-	if (rc)
+	if (rc && rc != -ENOTSUPP)
 		return rc;
 
 	dwc3->regs = map_physmem(priv->base, DWC3_OTG_REGS_END,
Quoted 1 line

MAP_NOCACHE);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190401/d89f7183/attachment.sig>

#2 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Hi Lukasz,

Quoted 10 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 1:03 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 8 lines

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

^^^^^^^^^^^^^^^^^^^^^^^^^^^ - could you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

In the cases where phy will be setup by First stage boot loader itself and don't want to do it again at u-boot.

Thanks,
Siva

Quoted 36 lines
Quoted 21 lines

so modify error check to handle this -ENOTSUPP.

Signed-off-by: Siva Durga Prasad Paladugu <[email protected]> --- drivers/usb/dwc3/dwc3-generic.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/dwc3/dwc3-generic.c index 3e6c494..a261d8d 100644

drivers/usb/dwc3/dwc3-generic.c +1 -1
@@ -47,7 +47,7 @@ static int dwc3_generic_peripheral_probe(struct
 udevice *dev) struct dwc3 *dwc3 = &priv->dwc3;
 
 	rc = dwc3_setup_phy(dev, &priv->phys, &priv->num_phys);
-	if (rc)
+	if (rc && rc != -ENOTSUPP)
 		return rc;
 
 	dwc3->regs = map_physmem(priv->base, DWC3_OTG_REGS_END,
Quoted 1 line

MAP_NOCACHE);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#3 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Quoted 16 lines · On Mon, 1 Apr 2019 10:23:42 +0000 Siva Durga Prasad Paladugu…

Hi Lukasz,

Quoted 14 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 1:03 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

Quoted 7 lines
Quoted 4 lines
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - could

you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

In the cases where phy will be setup by First stage boot loader itself and don't want to do it again at u-boot.

I think that I saw some time ago similar patch for uart - on IMX IIRC (it was also setup by BootROM on SoC).

Maybe we would need some kind of switch in Kconfig to indicate this use case?

Another option would be to mark this in DTS as TI specific property?

My point is that we shall not proceed with the flow when we do receive -ENOTSUPP

Quoted 40 lines

Thanks,
Siva

Quoted 36 lines
Quoted 21 lines

so modify error check to handle this -ENOTSUPP.

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]> ---
drivers/usb/dwc3/dwc3-generic.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/dwc3/dwc3-generic.c index 3e6c494..a261d8d 100644

drivers/usb/dwc3/dwc3-generic.c +1 -1
@@ -47,7 +47,7 @@ static int dwc3_generic_peripheral_probe(struct
 udevice *dev) struct dwc3 *dwc3 = &priv->dwc3;
 
 	rc = dwc3_setup_phy(dev, &priv->phys, &priv->num_phys);
-	if (rc)
+	if (rc && rc != -ENOTSUPP)
 		return rc;
 
 	dwc3->regs = map_physmem(priv->base, DWC3_OTG_REGS_END,
Quoted 1 line

MAP_NOCACHE);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190401/1916899a/attachment.sig>

#4 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Hi Lukasz,

Quoted 40 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 4:04 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 16 lines · On Mon, 1 Apr 2019 10:23:42 +0000 Siva Durga Prasad Paladugu…

Hi Lukasz,

Quoted 14 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 1:03 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

Quoted 7 lines
Quoted 4 lines
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - could

you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

In the cases where phy will be setup by First stage boot loader itself and don't want to do it again at u-boot.

I think that I saw some time ago similar patch for uart - on IMX IIRC (it was also setup by BootROM on SoC).

Quoted 7 lines

Maybe we would need some kind of switch in Kconfig to indicate this use case?

Another option would be to mark this in DTS as TI specific property?

My point is that we shall not proceed with the flow when we do receive - ENOTSUPP

TBH, I feel we should not call dwc3_setup_phy() if CONFIG_PHY is not enabled. If we look at dwc3_setup_phy() definition, it is under CONFIG_PHY.

Thanks,
Siva

Quoted 56 lines
Quoted 40 lines

Thanks,
Siva

Quoted 35 lines
Quoted 21 lines

so modify error check to handle this -ENOTSUPP.

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]> ---
drivers/usb/dwc3/dwc3-generic.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/usb/dwc3/dwc3-generic.c index 3e6c494..a261d8d 100644

drivers/usb/dwc3/dwc3-generic.c +1 -1
@@ -47,7 +47,7 @@ static int dwc3_generic_peripheral_probe(struct
 udevice *dev) struct dwc3 *dwc3 = &priv->dwc3;
 
 	rc = dwc3_setup_phy(dev, &priv->phys, &priv->num_phys);
-	if (rc)
+	if (rc && rc != -ENOTSUPP)
 		return rc;
 
 	dwc3->regs = map_physmem(priv->base, DWC3_OTG_REGS_END,
Quoted 1 line

MAP_NOCACHE);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80

Email:

Quoted 1 line
Quoted 1 line

lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#5 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Quoted 45 lines · Siva Durga Prasad Paladugu

Hi Lukasz,

Quoted 43 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 4:04 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 16 lines · On Mon, 1 Apr 2019 10:23:42 +0000 Siva Durga Prasad Paladugu…

Hi Lukasz,

Quoted 14 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 1:03 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

Quoted 7 lines
Quoted 4 lines
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - could

you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

In the cases where phy will be setup by First stage boot loader itself and don't want to do it again at u-boot.

I think that I saw some time ago similar patch for uart - on IMX IIRC (it was also setup by BootROM on SoC).

Maybe we would need some kind of switch in Kconfig to indicate this use case?

Quoted 6 lines
Quoted 4 lines

Another option would be to mark this in DTS as TI specific property?

My point is that we shall not proceed with the flow when we do receive - ENOTSUPP

TBH, I feel we should not call dwc3_setup_phy() if CONFIG_PHY is not enabled. If we look at dwc3_setup_phy() definition, it is under

CONFIG_PHY.

+1 on this.

M

#6 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Hi,

Quoted 57 lines

-----Original Message-----
From: Michal Simek [mailto:michal.simek at xilinx.com]
Sent: Monday, April 1, 2019 4:10 PM
To: Siva Durga Prasad Paladugu <[email protected]>; Lukasz Majewski <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 47 lines · Siva Durga Prasad Paladugu

Hi Lukasz,

Quoted 45 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 4:04 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 16 lines · On Mon, 1 Apr 2019 10:23:42 +0000 Siva Durga Prasad Paladugu…

Hi Lukasz,

Quoted 14 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 1:03 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

Quoted 7 lines
Quoted 4 lines
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - could

you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

In the cases where phy will be setup by First stage boot loader itself and don't want to do it again at u-boot.

I think that I saw some time ago similar patch for uart - on IMX IIRC (it was also setup by BootROM on SoC).

Maybe we would need some kind of switch in Kconfig to indicate this use case?

Another option would be to mark this in DTS as TI specific property?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

My point is that we shall not proceed with the flow when we do receive - ENOTSUPP

TBH, I feel we should not call dwc3_setup_phy() if CONFIG_PHY is not enabled. If we look at dwc3_setup_phy() definition, it is under

CONFIG_PHY.

+1 on this.

Any update on this patch?

Thanks,
Siva

Quoted 2 lines

M

#7 lore raw

PATCH 1/1 usb: dwc3: Handle case where setup_phy is not needed

Hi,

Quoted 72 lines

-----Original Message-----
From: Siva Durga Prasad Paladugu
Sent: Tuesday, May 28, 2019 3:36 PM
To: Michal Simek <[email protected]>; Lukasz Majewski <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com
Subject: RE: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Hi,

Quoted 61 lines

-----Original Message-----
From: Michal Simek [mailto:michal.simek at xilinx.com]
Sent: Monday, April 1, 2019 4:10 PM
To: Siva Durga Prasad Paladugu <[email protected]>; Lukasz Majewski <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 50 lines · Siva Durga Prasad Paladugu

Hi Lukasz,

Quoted 47 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 4:04 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Quoted 16 lines · On Mon, 1 Apr 2019 10:23:42 +0000 Siva Durga Prasad Paladugu…

Hi Lukasz,

Quoted 14 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: Monday, April 01, 2019 1:03 PM
To: Siva Durga Prasad Paladugu <[email protected]>
Cc: u-boot at lists.denx.de; marex at denx.de; jjhiblot at ti.com; sjg at chromium.org; patrick.delaunay at st.com; Michal Simek <[email protected]>
Subject: Re: [PATCH] usb: dwc3: Handle case where setup_phy is not needed

Hi Siva Durga Prasad Paladugu,

Quoted 2 lines

If CONFIG_PHY is not enabled then the dwc3_setup_phy() returns ENOTSUPP which can be still valid and intentional

Quoted 7 lines
Quoted 4 lines
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -

could you elaborate on this a bit more?

What is the use case when -ENOTSUPP is valid and intentional ?

In the cases where phy will be setup by First stage boot loader itself and don't want to do it again at u-boot.

I think that I saw some time ago similar patch for uart - on IMX IIRC (it was also setup by BootROM on SoC).

Maybe we would need some kind of switch in Kconfig to indicate this use case?

Another option would be to mark this in DTS as TI specific property?

My point is that we shall not proceed with the flow when we do receive - ENOTSUPP

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

TBH, I feel we should not call dwc3_setup_phy() if CONFIG_PHY is not enabled. If we look at dwc3_setup_phy() definition, it is under

CONFIG_PHY.

+1 on this.

Any update on this patch?

This is how its already being handled in drivers/usb/host/xhci-dwc3.c at line 127 in routine xhci_dwc3_probe() (snippet below)

ret = dwc3_setup_phy(dev, &plat->usb_phys, &plat->num_phys); if (ret && (ret != -ENOTSUPP))

	return ret;

We have two options either treat -ENOTSUPP as valid as above patch which I sent or don’t invoke dwc3_setup_phy() if CONFIG_PHY is not enabled.

Thanks,
Siva

Quoted 6 lines

Thanks,
Siva

Quoted 2 lines

M