usb: dwc2: modify SOF interrupt

PD#170407: usb: dwc2: modify SOF interrupt

SOF interrupt leads to the system overloading, so we reduce the
workload in the SOF interrupt handler.

Change-Id: I6bf11e672e0f024ac4b2da1ba47effe1da1ab476
Signed-off-by: Jianxin Qin <jianxin.qin@amlogic.com>
This commit is contained in:
Jianxin Qin
2018-07-25 13:43:26 +08:00
committed by Yixun Lan
parent a122e7c9ce
commit d5f0d65965
3 changed files with 14 additions and 8 deletions

View File

@@ -1061,6 +1061,8 @@ struct dwc_otg_core_if {
uint32_t phy_interface;
dwc_timer_t *device_connect_timer;
uint64_t sof_counter;
};
#ifdef DEBUG

View File

@@ -1161,9 +1161,17 @@ static void sof_timeout(void *ptr)
{
#ifdef CONFIG_AMLOGIC_USB3PHY
dwc_otg_core_if_t *core_if = (dwc_otg_core_if_t *) ptr;
dwc_timer_t *timer = core_if->device_connect_timer;
static uint64_t sof_cnt_pre;
if (core_if->phy_interface == 0)
set_usb_phy_device_tuning(1, 1);
if (core_if->phy_interface == 0) {
if (sof_cnt_pre == core_if->sof_counter) {
set_usb_phy_device_tuning(1, 1);
} else {
sof_cnt_pre = core_if->sof_counter;
DWC_TIMER_SCHEDULE(timer, 1000);
}
}
#endif
}

View File

@@ -294,19 +294,15 @@ void start_next_request(dwc_otg_pcd_ep_t *ep)
int32_t dwc_otg_pcd_handle_sof_intr(dwc_otg_pcd_t *pcd)
{
dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd);
gintsts_data_t gintsts;
DWC_DEBUGPL(DBG_PCD, "SOF\n");
DWC_TIMER_CANCEL(core_if->device_connect_timer);
core_if->sof_counter++;
/* Clear interrupt */
gintsts.d32 = 0;
gintsts.b.sofintr = 1;
DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32);
DWC_TIMER_SCHEDULE(core_if->device_connect_timer, 10);
return 1;
}
@@ -857,7 +853,7 @@ int32_t dwc_otg_pcd_handle_usb_reset_intr(dwc_otg_pcd_t *pcd)
DWC_PRINTF("USB RESET\n");
if (core_if->phy_interface == 0)
DWC_TIMER_SCHEDULE(core_if->device_connect_timer, 100);
DWC_TIMER_SCHEDULE(core_if->device_connect_timer, 1000);
#ifdef DWC_EN_ISOC
for (i = 1; i < 16; ++i) {