Skip to contentSkip to conversation

USB: ehci-omap: Don't select any PHY driver

PATCH In review Roger Quadros 2 participants 7 messages Apr 15, 2013 – Apr 17, 2013

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

PATCH 1/2 USB: ehci-omap: Don't select any PHY driver

Don't select NOP_USB_XCEIV. Instead, board config must select USB_PHY and the appropriate PHY driver.

Also add a hint in Kconfig so that users enabling this driver manually enable the right PHY drivers as well.

Gets rid of the below warnings when USB_EHCI_HCD_OMAP is enabled.

warning: (USB_EHCI_HCD_OMAP) selects NOP_USB_XCEIV which has unmet direct dependencies (USB_SUPPORT && USB_PHY)
warning: (USB_EHCI_HCD_OMAP) selects NOP_USB_XCEIV which has unmet direct dependencies (USB_SUPPORT && USB_PHY)

---
 drivers/usb/host/Kconfig |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/host/Kconfig +3 -1
index c0be25c..c558472 100644
@@ -150,11 +150,13 @@ config USB_EHCI_MXC
 config USB_EHCI_HCD_OMAP
 	tristate "EHCI support for OMAP3 and later chips"
 	depends on ARCH_OMAP
-	select NOP_USB_XCEIV
 	default y
 	---help---
 	  Enables support for the on-chip EHCI controller on
 	  OMAP3 and later chips.
+	  If your system uses a PHY on the USB port, you will need to
+	  enable USB_PHY and the appropriate PHY driver as well. Most
+	  boards need the NOP_USB_XCEIV PHY driver.
 
 config USB_EHCI_HCD_ORION
 	tristate  "Support for Marvell EBU on-chip EHCI USB controller"
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/2 USB: ehci-omap: Improve PHY error handling

As the USB PHY layer never returns NULL we don't need to check for that condition.

If we fail to get the PHY device it could be due to missing USB PHY drivers. Give this hint to the user in the error message.

---
 drivers/usb/host/ehci-omap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-omap.c +3 -3
index 5de3e43..2e34ddd 100644
@@ -175,13 +175,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 			phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
 		else
 			phy = devm_usb_get_phy_dev(dev, i);
-		if (IS_ERR(phy) || !phy) {
+		if (IS_ERR(phy)) {
 			/* Don't bail out if PHY is not absolutely necessary */
 			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
 				continue;
 
-			ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
-			dev_err(dev, "Can't get PHY device for port %d: %d\n",
+			ret = PTR_ERR(phy);
+			dev_err(dev, "Can't get PHY device for port %d: %d. Is USB_PHY driver enabled?\n",
 					i, ret);
 			goto err_phy;
 		}
Signature · 1 line
1.7.4.1
maintainer
#2 lore raw

Re: [PATCH 2/2] USB: ehci-omap: Improve PHY error handling

Quoted 24 lines · Roger Quadros

As the USB PHY layer never returns NULL we don't need to check for that condition.

If we fail to get the PHY device it could be due to missing USB PHY drivers. Give this hint to the user in the error message.

---
 drivers/usb/host/ehci-omap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-omap.c +1 -1
index 5de3e43..2e34ddd 100644
@@ -175,13 +175,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 			phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
 		else
 			phy = devm_usb_get_phy_dev(dev, i);
-		if (IS_ERR(phy) || !phy) {
+		if (IS_ERR(phy)) {
 			/* Don't bail out if PHY is not absolutely necessary */

drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 187

Quoted 10 lines
drivers/usb/host/ehci-omap.c +2 -2
 			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
 				continue;
 
-			ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
-			dev_err(dev, "Can't get PHY device for port %d: %d\n",
+			ret = PTR_ERR(phy);
+			dev_err(dev, "Can't get PHY device for port %d: %d. Is USB_PHY driver enabled?\n",
 					i, ret);
 			goto err_phy;
 		}

Getting rid of the !phy test is good. But I'm doubtful about the change to the error message. Are you going to make a similar change to every platform driver? There doesn't seem to be any reason to do this for ehci-omap but not the others.

Alan Stern

#3 lore raw

Re: [PATCH 2/2] USB: ehci-omap: Improve PHY error handling

Quoted 29 lines · Alan Stern
Quoted 27 lines · Roger Quadros

As the USB PHY layer never returns NULL we don't need to check for that condition.

If we fail to get the PHY device it could be due to missing USB PHY drivers. Give this hint to the user in the error message.

---
 drivers/usb/host/ehci-omap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-omap.c +1 -1
index 5de3e43..2e34ddd 100644
@@ -175,13 +175,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 			phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
 		else
 			phy = devm_usb_get_phy_dev(dev, i);
-		if (IS_ERR(phy) || !phy) {
+		if (IS_ERR(phy)) {
 			/* Don't bail out if PHY is not absolutely necessary */
 			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
 				continue;
 
Quoted 12 lines

drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 187

Quoted 7 lines
drivers/usb/host/ehci-omap.c +2 -2
-			ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
-			dev_err(dev, "Can't get PHY device for port %d: %d\n",
+			ret = PTR_ERR(phy);
+			dev_err(dev, "Can't get PHY device for port %d: %d. Is USB_PHY driver enabled?\n",
 					i, ret);
 			goto err_phy;
 		}

Getting rid of the !phy test is good. But I'm doubtful about the change to the error message. Are you going to make a similar change to every platform driver? There doesn't seem to be any reason to do this for ehci-omap but not the others.

I'm not very sure about that. If using the PHY API while USB_PHY is disabled is to be treated as a universal failure, then the print might as well come from the dummy stub for xx_usb_get_phy_xx().

For this patch, I'll just undo the print message change and resend. That could be done in a separate patch instead.

cheers,
-roger

#4 lore raw

PATCH v2 2/2 USB: ehci-omap: Improve PHY error handling

In reply to Roger Quadros

As the USB PHY layer never returns NULL we don't need to check for that condition.

CC Alan Stern <stern-nwvwT67g6+6dFdvTe/[email protected]>
---
 drivers/usb/host/ehci-omap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-omap.c +2 -2
index 5de3e43..3d1491b 100644
@@ -175,12 +175,12 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 			phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
 		else
 			phy = devm_usb_get_phy_dev(dev, i);
-		if (IS_ERR(phy) || !phy) {
+		if (IS_ERR(phy)) {
 			/* Don't bail out if PHY is not absolutely necessary */
 			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
 				continue;
 
-			ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
+			ret = PTR_ERR(phy);
 			dev_err(dev, "Can't get PHY device for port %d: %d\n",
 					i, ret);
 			goto err_phy;
Signature · 6 lines
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Acked-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] USB: ehci-omap: Improve PHY error handling

Quoted 18 lines · Roger Quadros

As the USB PHY layer never returns NULL we don't need to check for that condition.

---
 drivers/usb/host/ehci-omap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-omap.c +0 -1
index 5de3e43..3d1491b 100644
@@ -175,12 +175,12 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 			phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
 		else
 			phy = devm_usb_get_phy_dev(dev, i);
-		if (IS_ERR(phy) || !phy) {

drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 186

Quoted 10 lines
drivers/usb/host/ehci-omap.c +2 -1
+		if (IS_ERR(phy)) {
 			/* Don't bail out if PHY is not absolutely necessary */
 			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
 				continue;
 
-			ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
+			ret = PTR_ERR(phy);
 			dev_err(dev, "Can't get PHY device for port %d: %d\n",
 					i, ret);
 			goto err_phy;
maintainer Acked-by on v1 1/2
#6 lore raw
In reply to Roger Quadros
Quoted 27 lines · Roger Quadros

Don't select NOP_USB_XCEIV. Instead, board config must select USB_PHY and the appropriate PHY driver.

Also add a hint in Kconfig so that users enabling this driver manually enable the right PHY drivers as well.

Gets rid of the below warnings when USB_EHCI_HCD_OMAP is enabled.

warning: (USB_EHCI_HCD_OMAP) selects NOP_USB_XCEIV which has unmet direct dependencies (USB_SUPPORT && USB_PHY)
warning: (USB_EHCI_HCD_OMAP) selects NOP_USB_XCEIV which has unmet direct dependencies (USB_SUPPORT && USB_PHY)

---
 drivers/usb/host/Kconfig |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/host/Kconfig +0 -1
index c0be25c..c558472 100644
@@ -150,11 +150,13 @@ config USB_EHCI_MXC
 config USB_EHCI_HCD_OMAP
 	tristate "EHCI support for OMAP3 and later chips"
 	depends on ARCH_OMAP
-	select NOP_USB_XCEIV

drivers/usb/host/Kconfig config USB_EHCI_MXC · line 162

Quoted 10 lines
drivers/usb/host/Kconfig +3 -0
 	default y
 	---help---
 	  Enables support for the on-chip EHCI controller on
 	  OMAP3 and later chips.
+	  If your system uses a PHY on the USB port, you will need to
+	  enable USB_PHY and the appropriate PHY driver as well. Most
+	  boards need the NOP_USB_XCEIV PHY driver.
 
 config USB_EHCI_HCD_ORION
 	tristate  "Support for Marvell EBU on-chip EHCI USB controller"