diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/dwc3/dwc3.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/dwc3/dwc3.c index bd11f29af..8e65f940f 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/dwc3/dwc3.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/dwc3/dwc3.c @@ -5,49 +5,49 @@ void dwc3_of_parse(struct dwc3 *dwc) { - uint8_t lpm_nyet_threshold; - uint8_t tx_de_emphasis; - uint8_t hird_threshold; + uint8_t lpm_nyet_threshold; + uint8_t tx_de_emphasis; + uint8_t hird_threshold; - /* default to highest possible threshold */ - lpm_nyet_threshold = 0xff; + /* default to highest possible threshold */ + lpm_nyet_threshold = 0xff; - /* default to -3.5dB de-emphasis */ - tx_de_emphasis = 1; + /* default to -3.5dB de-emphasis */ + tx_de_emphasis = 1; - /* - * default to assert utmi_sleep_n and use maximum allowed HIRD - * threshold value of 0b1100 - */ - hird_threshold = 12; + /* + * default to assert utmi_sleep_n and use maximum allowed HIRD + * threshold value of 0b1100 + */ + hird_threshold = 12; - dwc->hsphy_mode = usb_get_phy_mode(dwc->id); + dwc->hsphy_mode = usb_get_phy_mode(dwc->id); - /* xiuos: The parameters are updated according to the dts of RK3568 */ - dwc->has_lpm_erratum = 0; - lpm_nyet_threshold = lpm_nyet_threshold; - dwc->is_utmi_l1_suspend = 0; - hird_threshold = hird_threshold; - dwc->disable_scramble_quirk = 0; - dwc->u2exit_lfps_quirk = 0; - dwc->u2ss_inp3_quirk = 0; - dwc->req_p1p2p3_quirk = 0; - dwc->del_p1p2p3_quirk = 0; - dwc->del_phy_power_chg_quirk = 0; - dwc->lfps_filter_quirk = 0; - dwc->rx_detect_poll_quirk = 0; - dwc->dis_u3_susphy_quirk = 0; - dwc->dis_u2_susphy_quirk = 0; - dwc->dis_enblslpm_quirk = 1; - dwc->dis_u2_freeclk_exists_quirk = 1; - dwc->tx_de_emphasis_quirk = 0; - tx_de_emphasis = tx_de_emphasis; + /* xiuos: The parameters are updated according to the dts of RK3568 */ + dwc->has_lpm_erratum = 0; + lpm_nyet_threshold = lpm_nyet_threshold; + dwc->is_utmi_l1_suspend = 0; + hird_threshold = hird_threshold; + dwc->disable_scramble_quirk = 0; + dwc->u2exit_lfps_quirk = 0; + dwc->u2ss_inp3_quirk = 0; + dwc->req_p1p2p3_quirk = 0; + dwc->del_p1p2p3_quirk = 0; + dwc->del_phy_power_chg_quirk = 0; + dwc->lfps_filter_quirk = 0; + dwc->rx_detect_poll_quirk = 0; + dwc->dis_u3_susphy_quirk = 0; + dwc->dis_u2_susphy_quirk = 0; + dwc->dis_enblslpm_quirk = 1; + dwc->dis_u2_freeclk_exists_quirk = 1; + dwc->tx_de_emphasis_quirk = 0; + tx_de_emphasis = tx_de_emphasis; - dwc->lpm_nyet_threshold = lpm_nyet_threshold; - dwc->tx_de_emphasis = tx_de_emphasis; + dwc->lpm_nyet_threshold = lpm_nyet_threshold; + dwc->tx_de_emphasis = tx_de_emphasis; - dwc->hird_threshold = hird_threshold - | (dwc->is_utmi_l1_suspend << 4); + dwc->hird_threshold = hird_threshold + | (dwc->is_utmi_l1_suspend << 4); } @@ -72,17 +72,17 @@ int dwc3_setup_phy(void *dev, struct phy **array, int *num_phys){ void dwc3_cache_hwparams(struct dwc3 *dwc) { - struct dwc3_hwparams *parms = &dwc->hwparams; + struct dwc3_hwparams *parms = &dwc->hwparams; - parms->hwparams0 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS0); - parms->hwparams1 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS1); - parms->hwparams2 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS2); - parms->hwparams3 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS3); - parms->hwparams4 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS4); - parms->hwparams5 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS5); - parms->hwparams6 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS6); - parms->hwparams7 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS7); - parms->hwparams8 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS8); + parms->hwparams0 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS0); + parms->hwparams1 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS1); + parms->hwparams2 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS2); + parms->hwparams3 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS3); + parms->hwparams4 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS4); + parms->hwparams5 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS5); + parms->hwparams6 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS6); + parms->hwparams7 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS7); + parms->hwparams8 = dwc3_readl(dwc->regs_vir, DWC3_GHWPARAMS8); } @@ -265,9 +265,9 @@ int dwc3_alloc_scratch_buffers(struct dwc3 *dwc){ len = dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE; - vir_addr = USB_MEM_VIRADDR_ALLOC; + vir_addr = USB_MEM_VIRADDR_ALLOC; phy_addr = 0; - dwc->scratchbuf = (void *)vir_addr; + dwc->scratchbuf = (void *)vir_addr; ret = naive_mmap(&vir_addr, &phy_addr, len, true); @@ -355,52 +355,52 @@ void dwc3_set_mode(struct dwc3 *dwc, uint32_t mode){ int dwc3_init(struct dwc3 *dwc) { - int ret; + int ret; - dwc3_cache_hwparams(dwc); + dwc3_cache_hwparams(dwc); - ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE); - if (ret) { - USB_LOG_ERR("failed to allocate event buffers\n"); - return -ENOMEM; - } + ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE); + if (ret) { + USB_LOG_ERR("failed to allocate event buffers\n"); + return -ENOMEM; + } - ret = dwc3_core_init(dwc); - if (ret) { - USB_LOG_ERR("failed to initialize core\n"); - goto core_fail; - } + ret = dwc3_core_init(dwc); + if (ret) { + USB_LOG_ERR("failed to initialize core\n"); + goto core_fail; + } - ret = dwc3_event_buffers_setup(dwc); - if (ret) { - USB_LOG_ERR("failed to setup event buffers\n"); - goto event_fail; - } + ret = dwc3_event_buffers_setup(dwc); + if (ret) { + USB_LOG_ERR("failed to setup event buffers\n"); + goto event_fail; + } - ret = dwc3_core_init_mode(dwc); - if (ret) - goto mode_fail; + ret = dwc3_core_init_mode(dwc); + if (ret) + goto mode_fail; - return 0; + return 0; mode_fail: - dwc3_event_buffers_cleanup(dwc); + dwc3_event_buffers_cleanup(dwc); event_fail: - dwc3_core_exit(dwc); + dwc3_core_exit(dwc); core_fail: - dwc3_free_event_buffers(dwc); + dwc3_free_event_buffers(dwc); - return ret; + return ret; } int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, uint32_t param){ - uint32_t timeout = 500; - uint32_t reg; + uint32_t timeout = 500; + uint32_t reg; dwc3_writel(dwc->regs_vir, DWC3_DGCMDPAR, param); dwc3_writel(dwc->regs_vir, DWC3_DGCMD, cmd | DWC3_DGCMD_CMDACT); @@ -410,14 +410,14 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, uint32_t pa if(!(reg & DWC3_DGCMD_CMDACT)){ return 0; - } + } timeout--; usb_osal_msleep(1); if(!timeout) return -1; - }while(1); + }while(1); return 0; } \ No newline at end of file