Snap for 9370682 from b53dd730f2
to android12-5.10-keystone-qcom-release
Change-Id: Ia7c68e3582707a657bc63972640898ec8978f197
This commit is contained in:
@@ -228,6 +228,8 @@ SYM_FUNC_END_PI(__dma_flush_area)
|
||||
* - dir - DMA direction
|
||||
*/
|
||||
SYM_FUNC_START_PI(__dma_map_area)
|
||||
cmp w2, #DMA_FROM_DEVICE
|
||||
b.eq __dma_flush_area
|
||||
b __dma_clean_area
|
||||
SYM_FUNC_END_PI(__dma_map_area)
|
||||
|
||||
|
@@ -218,7 +218,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
|
||||
void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
|
||||
{
|
||||
struct dwc3_ep *dep;
|
||||
|
||||
@@ -1087,13 +1087,18 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc)
|
||||
__dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
|
||||
}
|
||||
|
||||
static void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep)
|
||||
void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep)
|
||||
{
|
||||
struct dwc3_gadget_ep_cmd_params params;
|
||||
u32 cmd;
|
||||
int ret;
|
||||
|
||||
if (!dep->resource_index)
|
||||
/*
|
||||
* For status/DATA OUT stage, TRB will be queued on ep0 out
|
||||
* endpoint for which resource index is zero. Hence allow
|
||||
* queuing ENDXFER command for ep0 out endpoint.
|
||||
*/
|
||||
if (!dep->resource_index && dep->number)
|
||||
return;
|
||||
|
||||
cmd = DWC3_DEPCMD_ENDTRANSFER;
|
||||
|
@@ -869,12 +869,13 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
|
||||
reg |= DWC3_DALEPENA_EP(dep->number);
|
||||
dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);
|
||||
|
||||
dep->trb_dequeue = 0;
|
||||
dep->trb_enqueue = 0;
|
||||
|
||||
if (usb_endpoint_xfer_control(desc))
|
||||
goto out;
|
||||
|
||||
/* Initialize the TRB ring */
|
||||
dep->trb_dequeue = 0;
|
||||
dep->trb_enqueue = 0;
|
||||
memset(dep->trb_pool, 0,
|
||||
sizeof(struct dwc3_trb) * DWC3_TRB_NUM);
|
||||
|
||||
@@ -2711,6 +2712,7 @@ static int __dwc3_gadget_start(struct dwc3 *dwc)
|
||||
|
||||
/* begin to receive SETUP packets */
|
||||
dwc->ep0state = EP0_SETUP_PHASE;
|
||||
dwc->ep0_bounced = false;
|
||||
dwc->link_state = DWC3_LINK_STATE_SS_DIS;
|
||||
dwc->delayed_status = false;
|
||||
dwc3_ep0_out_start(dwc);
|
||||
@@ -3742,13 +3744,24 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
|
||||
reg &= ~DWC3_DCTL_INITU2ENA;
|
||||
dwc3_gadget_dctl_write_safe(dwc, reg);
|
||||
|
||||
dwc->connected = false;
|
||||
|
||||
dwc3_disconnect_gadget(dwc);
|
||||
|
||||
dwc->gadget->speed = USB_SPEED_UNKNOWN;
|
||||
dwc->setup_packet_pending = false;
|
||||
usb_gadget_set_state(dwc->gadget, USB_STATE_NOTATTACHED);
|
||||
|
||||
dwc->connected = false;
|
||||
if (dwc->ep0state != EP0_SETUP_PHASE) {
|
||||
unsigned int dir;
|
||||
|
||||
dir = !!dwc->ep0_expect_in;
|
||||
if (dwc->ep0state == EP0_DATA_PHASE)
|
||||
dwc3_ep0_end_control_data(dwc, dwc->eps[dir]);
|
||||
else
|
||||
dwc3_ep0_end_control_data(dwc, dwc->eps[!dir]);
|
||||
dwc3_ep0_stall_and_restart(dwc);
|
||||
}
|
||||
}
|
||||
|
||||
static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
|
||||
@@ -3796,6 +3809,27 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
|
||||
}
|
||||
|
||||
dwc3_reset_gadget(dwc);
|
||||
|
||||
/*
|
||||
* From SNPS databook section 8.1.2, the EP0 should be in setup
|
||||
* phase. So ensure that EP0 is in setup phase by issuing a stall
|
||||
* and restart if EP0 is not in setup phase.
|
||||
*/
|
||||
if (dwc->ep0state != EP0_SETUP_PHASE) {
|
||||
unsigned int dir;
|
||||
|
||||
dir = !!dwc->ep0_expect_in;
|
||||
if (dwc->ep0state == EP0_DATA_PHASE)
|
||||
dwc3_ep0_end_control_data(dwc, dwc->eps[dir]);
|
||||
else
|
||||
dwc3_ep0_end_control_data(dwc, dwc->eps[!dir]);
|
||||
|
||||
dwc->eps[0]->trb_enqueue = 0;
|
||||
dwc->eps[1]->trb_enqueue = 0;
|
||||
|
||||
dwc3_ep0_stall_and_restart(dwc);
|
||||
}
|
||||
|
||||
/*
|
||||
* In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a
|
||||
* Section 4.1.2 Table 4-2, it states that during a USB reset, the SW
|
||||
|
@@ -110,6 +110,8 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
|
||||
void dwc3_ep0_interrupt(struct dwc3 *dwc,
|
||||
const struct dwc3_event_depevt *event);
|
||||
void dwc3_ep0_out_start(struct dwc3 *dwc);
|
||||
void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep);
|
||||
void dwc3_ep0_stall_and_restart(struct dwc3 *dwc);
|
||||
int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value);
|
||||
int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value);
|
||||
int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
|
||||
|
Reference in New Issue
Block a user