forked from xuos/xiuos
dwc3 init direction mode
This commit is contained in:
parent
7b5369a1f3
commit
0027373c86
|
@ -585,18 +585,39 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc){
|
|||
|
||||
|
||||
|
||||
int dwc3_core_init_mode(struct dwc3 *dwc){
|
||||
int dwc3_core_init_mode(struct dwc3 *dwc)
|
||||
{
|
||||
int ret;
|
||||
|
||||
switch (dwc->dr_mode) {
|
||||
case USB_DR_MODE_HOST:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
|
||||
ret = dwc3_host_init(dwc);
|
||||
if (ret) {
|
||||
USB_LOG_ERR("failed to initialize host\n");
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
USB_LOG_ERR("Unsupported mode of operation %d\n", dwc->dr_mode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void dwc3_set_mode(struct dwc3 *dwc, uint32_t mode)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
void dwc3_set_mode(struct dwc3 *dwc, uint32_t mode){
|
||||
|
||||
reg = dwc3_readl(dwc->regs_vir, DWC3_GCTL);
|
||||
reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));
|
||||
reg |= DWC3_GCTL_PRTCAPDIR(mode);
|
||||
dwc3_writel(dwc->regs_vir, DWC3_GCTL, reg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int dwc3_init(struct dwc3 *dwc)
|
||||
{
|
||||
int ret;
|
||||
|
|
Loading…
Reference in New Issue