[PATCH 05/11] MXS: Modify the ci13xxx_udc to avoid adding UDC

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


On the i.MX platform, we are adding the UDC ourselves from the PHY driver. This
patch adds a flag into the ci13xxx_udc that avoids adding the UDC if set.

Signed-off-by: Marek Vasut <marex@xxxxxxx>
Cc: Chen Peter-B29397 <B29397@xxxxxxxxxxxxx>
Cc: Detlev Zundel <dzu@xxxxxxx>
Cc: Fabio Estevam <festevam@xxxxxxxxx>
Cc: Felipe Balbi <balbi@xxxxxx>
Cc: Li Frank-B20596 <B20596@xxxxxxxxxxxxx>
Cc: Linux USB <linux-usb@xxxxxxxxxxxxxxx>
Cc: Liu JunJie-B08287 <B08287@xxxxxxxxxxxxx>
Cc: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Cc: Shawn Guo <shawn.guo@xxxxxxxxxx>
Cc: Shi Make-B15407 <B15407@xxxxxxxxxxxxx>
Cc: Stefano Babic <sbabic@xxxxxxx>
Cc: Subodh Nijsure <snijsure@xxxxxxxxxxxx>
Cc: Wolfgang Denk <wd@xxxxxxx>
---
 drivers/usb/gadget/ci13xxx_udc.c |   12 ++++++++----
 drivers/usb/gadget/ci13xxx_udc.h |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 243ef1a..94f8b19 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2935,9 +2935,11 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
 			goto remove_dbg;
 	}
 
-	retval = usb_add_gadget_udc(dev, &udc->gadget);
-	if (retval)
-		goto remove_trans;
+	if (!(udc->udc_driver->flags & CI13XXX_DONT_REGISTER_GADGET)) {
+		retval = usb_add_gadget_udc(dev, &udc->gadget);
+		if (retval)
+			goto remove_trans;
+	}
 
 	pm_runtime_no_callbacks(&udc->gadget.dev);
 	pm_runtime_enable(&udc->gadget.dev);
@@ -2980,7 +2982,9 @@ static void udc_remove(void)
 		err("EINVAL");
 		return;
 	}
-	usb_del_gadget_udc(&udc->gadget);
+
+	if (!(udc->udc_driver->flags & CI13XXX_DONT_REGISTER_GADGET))
+		usb_del_gadget_udc(&udc->gadget);
 
 	if (udc->transceiver) {
 		otg_set_peripheral(udc->transceiver->otg, &udc->gadget);
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h
index 0d31af5..9f2efa2 100644
--- a/drivers/usb/gadget/ci13xxx_udc.h
+++ b/drivers/usb/gadget/ci13xxx_udc.h
@@ -108,6 +108,7 @@ struct ci13xxx_udc_driver {
 #define CI13XXX_REQUIRE_TRANSCEIVER	BIT(1)
 #define CI13XXX_PULLUP_ON_VBUS		BIT(2)
 #define CI13XXX_DISABLE_STREAMING	BIT(3)
+#define CI13XXX_DONT_REGISTER_GADGET	BIT(4)
 
 #define CI13XXX_CONTROLLER_RESET_EVENT		0
 #define CI13XXX_CONTROLLER_STOPPED_EVENT	1
-- 
1.7.10

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


B and H Foto and Electronics Corp.

[Linux Media]     [Video for Linux]     [Linux Input]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]     [More Archives]

Add to Google Powered by Linux