usb: musb: add musb_host_setup() and musb_host_cleanup()

This patch re-introduces the bits that are necessary to use the musb
controller in host mode.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Daniel Mack
2013-04-10 21:55:47 +02:00
committed by Felipe Balbi
parent b7b741ea38
commit 2cc65feab2
3 changed files with 34 additions and 0 deletions

View File

@@ -2640,6 +2640,27 @@ void musb_host_free(struct musb *musb)
usb_put_hcd(musb->hcd);
}
int musb_host_setup(struct musb *musb, int power_budget)
{
int ret;
struct usb_hcd *hcd = musb->hcd;
MUSB_HST_MODE(musb);
musb->xceiv->otg->default_a = 1;
musb->xceiv->state = OTG_STATE_A_IDLE;
otg_set_host(musb->xceiv->otg, &hcd->self);
hcd->self.otg_port = 1;
musb->xceiv->otg->host = &hcd->self;
hcd->power_budget = 2 * (power_budget ? : 250);
ret = usb_add_hcd(hcd, 0, 0);
if (ret < 0)
return ret;
return 0;
}
void musb_host_resume_root_hub(struct musb *musb)
{
usb_hcd_resume_root_hub(musb->hcd);