diff options
author | Daniel Mack | 2013-04-10 21:55:49 +0200 |
---|---|---|
committer | Felipe Balbi | 2013-05-28 18:22:25 +0200 |
commit | 6c5f6a6f532ad3c14fbed04b6f2dd0e0cab1a143 (patch) | |
tree | ff0e5004f0c13e207c811f62afdaa967bcc640cd /drivers/usb/musb/musb_core.c | |
parent | usb: musb: re-introduce musb->port_mode (diff) | |
download | kernel-qcow2-linux-6c5f6a6f532ad3c14fbed04b6f2dd0e0cab1a143.tar.gz kernel-qcow2-linux-6c5f6a6f532ad3c14fbed04b6f2dd0e0cab1a143.tar.xz kernel-qcow2-linux-6c5f6a6f532ad3c14fbed04b6f2dd0e0cab1a143.zip |
usb: musb: use musb->port_mode
Initialize the host and gadget subsystems of the musb driver only when
the appropriate mode is selected from platform data, or device-tree
information, respectively.
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_core.c')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index a1aa75eb51e2..a04cf8b1678b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1904,11 +1904,23 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb->xceiv->state = OTG_STATE_B_IDLE; } - status = musb_host_setup(musb, plat->power); - if (status < 0) - goto fail3; - - status = musb_gadget_setup(musb); + switch (musb->port_mode) { + case MUSB_PORT_MODE_HOST: + status = musb_host_setup(musb, plat->power); + break; + case MUSB_PORT_MODE_GADGET: + status = musb_gadget_setup(musb); + break; + case MUSB_PORT_MODE_DUAL_ROLE: + status = musb_host_setup(musb, plat->power); + if (status < 0) + goto fail3; + status = musb_gadget_setup(musb); + break; + default: + dev_err(dev, "unsupported port mode %d\n", musb->port_mode); + break; + } if (status < 0) goto fail3; |