Skip to contentSkip to conversation

musb: removing otg protocol support

RFC New Bin Liu 1 participant 1 message Mar 16, 2018

Subsystems (2)
lore
Share & tools
lore

Bin Liu

author maintainer
#0 lore raw

RFC 1/1 musb: removing otg protocol support

Hi,

The kernel usb stack and musb drivers have gone through some changes in the past several kernel versions, such as adding otg fsm, musb runtime PM, and musb otg state moving from musb to musb->xceiv... I am wondering if the otg protocol (hnp, srp) functions are already broken in the musb drivers, but I don't have a platform to confirm it.

Do we know by any chance there is still someone using the musb otg functions in any relatively newer kernel and we still need to support otg in musb? If not, I am thinking to clean up the otg functions in musb drivers to make the code easy to read and maintain.

If we can make the conclusion to remove it, I propose the patch below to disable musb otg first, then clean up the driver later if nobody complains about the otg function removal.

Regards,
-Bin.

8<---

drivers/usb/musb/musb_gadget.c +1 -4
index 86066328e480..4403b4cdd0b8 100644
@@ -1865,11 +1865,8 @@ int musb_gadget_setup(struct musb *musb)
 
 	/* this "gadget" abstracts/virtualizes the controller */
 	musb->g.name = musb_driver_name;
-#if IS_ENABLED(CONFIG_USB_MUSB_DUAL_ROLE)
-	musb->g.is_otg = 1;
-#elif IS_ENABLED(CONFIG_USB_MUSB_GADGET)
+	/* don't support otg protocols */
 	musb->g.is_otg = 0;
-#endif
 	INIT_DELAYED_WORK(&musb->gadget_work, musb_gadget_work);
 	musb_g_init_endpoints(musb);
 
drivers/usb/musb/musb_host.c +2 -1
index 069a1f775048..a3a5bd36ee98 100644
@@ -2795,7 +2795,8 @@ int musb_host_setup(struct musb *musb, int power_budget)
 		musb->xceiv->otg->state = OTG_STATE_A_IDLE;
 	}
 	otg_set_host(musb->xceiv->otg, &hcd->self);
-	hcd->self.otg_port = 1;
+	/* don't support otg protocols */
+	hcd->self.otg_port = 0;
 	musb->xceiv->otg->host = &hcd->self;
 	hcd->power_budget = 2 * (power_budget ? : 250);