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

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

 



On Wed, 5 May 2010 22:09:22 +0300
Felipe Balbi <felipe.balbi@xxxxxxxxx> wrote:

> 
> still, i think this patch is ok for mainline, that would allow 
> developers to play with other stuff but I'd like to see a big fat 
> warning when that happens. Can you update the patch ?
> 

Attach the updated version, thanks.

>From da0d21f481c98ed5c7d6f0bf19bdadcd8a462ffe Mon Sep 17 00:00:00 2001
From: Ming Lei <tom.leiming@xxxxxxxxx>
Date: Wed, 5 May 2010 00:10:19 +0800
Subject: [PATCH] usb: musb: fix HOST or PERIPHERAL only mode(v2)

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.

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
---
 drivers/usb/musb/musb_core.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0e8b8ab..17f8ddd 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1908,8 +1908,18 @@ 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
+	dev_info(dev, "degrade from otg to %s-only mode\n",
+		(plat->mode == MUSB_HOST) ? "host" : "peripheral");
+	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