提交 1b7a66b4 编写于 作者: G Gregory Herrero 提交者: Felipe Balbi

usb: dwc2: gadget: force gadget initialization in dev mode

When booting with id pin grounded, dwc2 default to host mode.
Thus, force device mode prior initializing gadget part.
Else fifo init will fail since fifo values are not correct
in host mode.
Tested-by: NRobert Baldyga <r.baldyga@samsung.com>
Acked-by: NPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: NGregory Herrero <gregory.herrero@intel.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 596d696a
......@@ -3675,6 +3675,19 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
/* usb phy enable */
s3c_hsotg_phy_enable(hsotg);
/*
* Force Device mode before initialization.
* This allows correctly configuring fifo for device mode.
*/
__bic32(hsotg->regs + GUSBCFG, GUSBCFG_FORCEHOSTMODE);
__orr32(hsotg->regs + GUSBCFG, GUSBCFG_FORCEDEVMODE);
/*
* According to Synopsys databook, this sleep is needed for the force
* device mode to take effect.
*/
msleep(25);
s3c_hsotg_corereset(hsotg);
ret = s3c_hsotg_hw_cfg(hsotg);
if (ret) {
......@@ -3684,6 +3697,9 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
s3c_hsotg_init(hsotg);
/* Switch back to default configuration */
__bic32(hsotg->regs + GUSBCFG, GUSBCFG_FORCEDEVMODE);
hsotg->ctrl_buff = devm_kzalloc(hsotg->dev,
DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
if (!hsotg->ctrl_buff) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册