Skip to contentSkip to conversation

USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected

PATCH Superseded Shawn Guo 1 participant 1 message Jul 3, 2018 USB

lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH v2 1/1 USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected

Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Since commit 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51") the kernel hangs on a imx51-babbage board, when using the ULPI interface with the CONFIG_USB_CHIPIDEA_ULPI option unselected.

Quoted 6 lines

Instead of hanging the kernel, let's warn the user that CONFIG_USB_CHIPIDEA_ULPI needs to be selected, propagate an error and continue with booting the kernel.

The user can then react to the warning and select
CONFIG_USB_CHIPIDEA_ULPI as needed.

A second thought on this - shouldn't such dependency be solved by Kconfig select clause?

Shawn

Quoted 36 lines
Fixes 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51")

---
Changes since v1:
- Only propagate the error when CONFIG_USB_CHIPIDEA_ULPI is unselected

 drivers/usb/chipidea/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/usb/chipidea/core.c +11 -0
index 85fc6db..e7018a1 100644
@@ -608,6 +608,17 @@ static int ci_get_platdata(struct device *dev,
 	if (!platdata->phy_mode)
 		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
 
+	if (platdata->phy_mode == USBPHY_INTERFACE_MODE_ULPI) {
+		/*
+		 * CONFIG_USB_CHIPIDEA_ULPI needs to be selected
+		 * for proper usage of the ULPI mode
+		 */
+		if (!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)) {
+			WARN_ONCE(1, "Select CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode\n");
+			return -EINVAL;
+		}
+	}
+
 	if (!platdata->dr_mode)
 		platdata->dr_mode = usb_get_dr_mode(dev);
 
Signature · 1 line
2.7.4

---
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