author | Jianxin Qin <jianxin.qin@amlogic.com> | 2018-07-25 05:43:26 (GMT) |
---|---|---|
committer | Yixun Lan <yixun.lan@amlogic.com> | 2018-08-02 04:30:41 (GMT) |
commit | d5f0d6596544f65ef9bedbeb20775f3c6b4a7fb7 (patch) | |
tree | 5e2272c51e6f91a5b0d764f749158d9b13d647d7 | |
parent | a122e7c9ce1d04c4e63ae4d8b894bb4bbda831ae (diff) | |
download | common-d5f0d6596544f65ef9bedbeb20775f3c6b4a7fb7.zip common-d5f0d6596544f65ef9bedbeb20775f3c6b4a7fb7.tar.gz common-d5f0d6596544f65ef9bedbeb20775f3c6b4a7fb7.tar.bz2 |
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>
-rw-r--r-- | drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.h | 2 | ||||
-rw-r--r-- | drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd.c | 12 | ||||
-rw-r--r-- | drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c | 8 |
3 files changed, 14 insertions, 8 deletions
diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.h b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.h index d438e47..a58ba8c 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.h +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_cil.h @@ -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 diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd.c index cb6ae09..a240ef6 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd.c @@ -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 } diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c index 9066ca3..ecfc09b 100644 --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c @@ -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) { |