Commit 510ffaa4 authored by Dinh Nguyen's avatar Dinh Nguyen Committed by Felipe Balbi

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: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent bcc06078
...@@ -966,6 +966,8 @@ extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg); ...@@ -966,6 +966,8 @@ extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2); extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2); extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq); extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2);
extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg);
#else #else
static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
{ return 0; } { return 0; }
...@@ -975,6 +977,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2) ...@@ -975,6 +977,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
{ return 0; } { return 0; }
static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
{ return 0; } { return 0; }
static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2) {}
static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {}
#endif #endif
#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
......
...@@ -2125,7 +2125,7 @@ static int s3c_hsotg_corereset(struct dwc2_hsotg *hsotg) ...@@ -2125,7 +2125,7 @@ static int s3c_hsotg_corereset(struct dwc2_hsotg *hsotg)
* *
* Issue a soft reset to the core, and await the core finishing it. * Issue a soft reset to the core, and await the core finishing it.
*/ */
static void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg) void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg)
{ {
s3c_hsotg_corereset(hsotg); s3c_hsotg_corereset(hsotg);
...@@ -2257,7 +2257,7 @@ static void s3c_hsotg_core_disconnect(struct dwc2_hsotg *hsotg) ...@@ -2257,7 +2257,7 @@ static void s3c_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
__orr32(hsotg->regs + DCTL, DCTL_SFTDISCON); __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
} }
static void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg)
{ {
/* remove the soft-disconnect and let's go */ /* remove the soft-disconnect and let's go */
__bic32(hsotg->regs + DCTL, DCTL_SFTDISCON); __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON);
......
...@@ -1371,6 +1371,8 @@ static void dwc2_conn_id_status_change(struct work_struct *work) ...@@ -1371,6 +1371,8 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
hsotg->op_state = OTG_STATE_B_PERIPHERAL; hsotg->op_state = OTG_STATE_B_PERIPHERAL;
dwc2_core_init(hsotg, false, -1); dwc2_core_init(hsotg, false, -1);
dwc2_enable_global_interrupts(hsotg); dwc2_enable_global_interrupts(hsotg);
s3c_hsotg_core_init_disconnected(hsotg);
s3c_hsotg_core_connect(hsotg);
} else { } else {
/* A-Device connector (Host Mode) */ /* A-Device connector (Host Mode) */
dev_dbg(hsotg->dev, "connId A\n"); dev_dbg(hsotg->dev, "connId A\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment