summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/musb_host.c
diff options
context:
space:
mode:
authorDaniel Mack2013-04-10 21:55:47 +0200
committerFelipe Balbi2013-05-28 18:22:24 +0200
commit2cc65feab2f18dfa4297209829ce228989c7356b (patch)
tree83666f8e5a3a445e11cf891dab4458588df52ed5 /drivers/usb/musb/musb_host.c
parentusb: musb: add Kconfig options for HOST, GAGDET or DUAL_ROLE modes (diff)
downloadkernel-qcow2-linux-2cc65feab2f18dfa4297209829ce228989c7356b.tar.gz
kernel-qcow2-linux-2cc65feab2f18dfa4297209829ce228989c7356b.tar.xz
kernel-qcow2-linux-2cc65feab2f18dfa4297209829ce228989c7356b.zip
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>
Diffstat (limited to 'drivers/usb/musb/musb_host.c')
-rw-r--r--drivers/usb/musb/musb_host.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index e6ece8a4e8b6..6057c2363e86 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -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);