提交 0afddf1e 编写于 作者: P Paul Cercueil 提交者: Greg Kroah-Hartman

usb: musb: Support setting OTG mode using generic PHY

When musb->xceiv is not provided but musb->phy is, support setting the
OTG mode (host, peripheral) using the generic PHY framework.
Signed-off-by: NPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-5-paul@crapouillou.netSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a6d45ea0
......@@ -1854,6 +1854,8 @@ static int musb_gadget_start(struct usb_gadget *g,
if (musb->xceiv)
otg_set_peripheral(musb->xceiv->otg, &musb->g);
else
phy_set_mode(musb->phy, PHY_MODE_USB_DEVICE);
musb_set_state(musb, OTG_STATE_B_IDLE);
spin_unlock_irqrestore(&musb->lock, flags);
......@@ -1905,6 +1907,8 @@ static int musb_gadget_stop(struct usb_gadget *g)
if (musb->xceiv)
otg_set_peripheral(musb->xceiv->otg, NULL);
else
phy_set_mode(musb->phy, PHY_MODE_INVALID);
musb->is_active = 0;
musb->gadget_driver = NULL;
......
......@@ -2726,6 +2726,8 @@ int musb_host_setup(struct musb *musb, int power_budget)
if (musb->xceiv) {
otg_set_host(musb->xceiv->otg, &hcd->self);
musb->xceiv->otg->host = &hcd->self;
} else {
phy_set_mode(musb->phy, PHY_MODE_USB_HOST);
}
/* don't support otg protocols */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册