[PATCH] usb: musb: fix HOST or PERIPHERAL only mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ming Lei <tom.leiming@xxxxxxxxx>

The plat->mode passed from platform_data always is MUSB_OTG,
so the init failures below will happen if we configure musb as
HOST or PERIPHERAL mode in Kconfig:

	"incompatible Kconfig role setting"

The patch fixes the issue by degrading otg mode to
host or peripheral mode in such case.
---
 drivers/usb/musb/musb_core.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0e8b8ab..a783dac 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1908,8 +1908,16 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 #ifdef CONFIG_USB_MUSB_OTG
 		break;
 #else
-bad_config:
+#ifdef CONFIG_USB_MUSB_HDRC_HCD
+		plat->mode = MUSB_HOST;
 #endif
+
+#ifdef CONFIG_USB_GADGET_MUSB_HDRC
+		plat->mode = MUSB_PERIPHERAL;
+#endif
+	break;
+#endif
+bad_config:
 	default:
 		dev_err(dev, "incompatible Kconfig role setting\n");
 		return -EINVAL;
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux