aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@opensource.altera.com>2014-11-11 12:13:36 -0500
committerFelipe Balbi <balbi@ti.com>2014-11-14 15:59:43 -0500
commit510ffaa48eac2587a4df9ec7668e3274e5f96ee3 (patch)
treeeb74a9ee1e05155ddaf2411257744bb9741a0c0f /drivers/usb
parentbcc06078ba4da9a8b92342e7005c65ba4c06bdb9 (diff)
usb: dwc2: Initialize the USB core for peripheral mode
Initialize the USB driver to peripheral mode when a B-Device connector is attached. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc2/core.h4
-rw-r--r--drivers/usb/dwc2/gadget.c4
-rw-r--r--drivers/usb/dwc2/hcd.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 4905d8880869..4710935fbad3 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -966,6 +966,8 @@ extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
966extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2); 966extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
967extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2); 967extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
968extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq); 968extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
969extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2);
970extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg);
969#else 971#else
970static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) 972static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
971{ return 0; } 973{ return 0; }
@@ -975,6 +977,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
975{ return 0; } 977{ return 0; }
976static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) 978static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
977{ return 0; } 979{ return 0; }
980static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2) {}
981static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {}
978#endif 982#endif
979 983
980#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) 984#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 9caea513eb0c..ec853406a930 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2125,7 +2125,7 @@ static int s3c_hsotg_corereset(struct dwc2_hsotg *hsotg)
2125 * 2125 *
2126 * Issue a soft reset to the core, and await the core finishing it. 2126 * Issue a soft reset to the core, and await the core finishing it.
2127 */ 2127 */
2128static void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg) 2128void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg)
2129{ 2129{
2130 s3c_hsotg_corereset(hsotg); 2130 s3c_hsotg_corereset(hsotg);
2131 2131
@@ -2257,7 +2257,7 @@ static void s3c_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
2257 __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON); 2257 __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
2258} 2258}
2259 2259
2260static void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) 2260void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg)
2261{ 2261{
2262 /* remove the soft-disconnect and let's go */ 2262 /* remove the soft-disconnect and let's go */
2263 __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON); 2263 __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index e377f58f5f4d..1a6dea323c8f 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -1371,6 +1371,8 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
1371 hsotg->op_state = OTG_STATE_B_PERIPHERAL; 1371 hsotg->op_state = OTG_STATE_B_PERIPHERAL;
1372 dwc2_core_init(hsotg, false, -1); 1372 dwc2_core_init(hsotg, false, -1);
1373 dwc2_enable_global_interrupts(hsotg); 1373 dwc2_enable_global_interrupts(hsotg);
1374 s3c_hsotg_core_init_disconnected(hsotg);
1375 s3c_hsotg_core_connect(hsotg);
1374 } else { 1376 } else {
1375 /* A-Device connector (Host Mode) */ 1377 /* A-Device connector (Host Mode) */
1376 dev_dbg(hsotg->dev, "connId A\n"); 1378 dev_dbg(hsotg->dev, "connId A\n");