Lines Matching +full:usb3 +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0
3 * xHCI host controller driver for R-Car SoCs
17 #include "xhci-plat.h"
18 #include "xhci-rcar.h"
21 * - The V3 firmware is for almost all R-Car Gen3 (except r8a7795 ES1.x)
22 * - The V2 firmware is for r8a7795 ES1.x.
23 * - The V2 firmware is possible to use on R-Car Gen2. However, the V2 causes
24 * performance degradation. So, this driver continues to use the V1 if R-Car
26 * - The V1 firmware is impossible to use on R-Car Gen3.
39 #define RCAR_USB3_CONF1 0xa48 /* USB3.0 Configuration1 */
40 #define RCAR_USB3_CONF2 0xa5c /* USB3.0 Configuration2 */
41 #define RCAR_USB3_CONF3 0xaa8 /* USB3.0 Configuration3 */
42 #define RCAR_USB3_RX_POL 0xab0 /* USB3.0 RX Polarity */
43 #define RCAR_USB3_TX_POL 0xab8 /* USB3.0 TX Polarity */
67 /* USB3.0 Configuration */
72 /* USB3.0 Polarity */
91 writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK); in xhci_rcar_start_gen2()
92 /* USB3.0 Configuration */ in xhci_rcar_start_gen2()
93 writel(RCAR_USB3_CONF1_VAL, hcd->regs + RCAR_USB3_CONF1); in xhci_rcar_start_gen2()
94 writel(RCAR_USB3_CONF2_VAL, hcd->regs + RCAR_USB3_CONF2); in xhci_rcar_start_gen2()
95 writel(RCAR_USB3_CONF3_VAL, hcd->regs + RCAR_USB3_CONF3); in xhci_rcar_start_gen2()
96 /* USB3.0 Polarity */ in xhci_rcar_start_gen2()
97 writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL); in xhci_rcar_start_gen2()
98 writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL); in xhci_rcar_start_gen2()
103 struct device_node *node = dev->of_node; in xhci_rcar_is_gen2()
105 return of_device_is_compatible(node, "renesas,xhci-r8a7790") || in xhci_rcar_is_gen2()
106 of_device_is_compatible(node, "renesas,xhci-r8a7791") || in xhci_rcar_is_gen2()
107 of_device_is_compatible(node, "renesas,xhci-r8a7793") || in xhci_rcar_is_gen2()
108 of_device_is_compatible(node, "renesas,rcar-gen2-xhci"); in xhci_rcar_is_gen2()
115 if (hcd->regs != NULL) { in xhci_rcar_start()
117 temp = readl(hcd->regs + RCAR_USB3_INT_ENA); in xhci_rcar_start()
119 writel(temp, hcd->regs + RCAR_USB3_INT_ENA); in xhci_rcar_start()
120 if (xhci_rcar_is_gen2(hcd->self.controller)) in xhci_rcar_start()
127 struct device *dev = hcd->self.controller; in xhci_rcar_download_firmware()
128 void __iomem *regs = hcd->regs; in xhci_rcar_download_firmware()
141 if (readl(regs + RCAR_USB3_DL_CTRL) & RCAR_USB3_DL_CTRL_FW_SUCCESS) in xhci_rcar_download_firmware()
145 if (attr) in xhci_rcar_download_firmware()
146 quirks = (uintptr_t)attr->data; in xhci_rcar_download_firmware()
148 if (quirks & RCAR_XHCI_FIRMWARE_V2) in xhci_rcar_download_firmware()
150 else if (quirks & RCAR_XHCI_FIRMWARE_V3) in xhci_rcar_download_firmware()
153 firmware_name = priv->firmware_name; in xhci_rcar_download_firmware()
155 /* request R-Car USB3.0 firmware */ in xhci_rcar_download_firmware()
157 if (retval) in xhci_rcar_download_firmware()
160 /* download R-Car USB3.0 firmware */ in xhci_rcar_download_firmware()
165 for (index = 0; index < fw->size; index += 4) { in xhci_rcar_download_firmware()
167 for (data = 0, j = 3; j >= 0; j--) { in xhci_rcar_download_firmware()
168 if ((j + index) < fw->size) in xhci_rcar_download_firmware()
169 data |= fw->data[index + j] << (8 * j); in xhci_rcar_download_firmware()
179 if (retval < 0) in xhci_rcar_download_firmware()
200 retval = readl_poll_timeout_atomic(hcd->regs + RCAR_USB3_AXH_STA, in xhci_rcar_wait_for_pll_active()
208 /* If hcd->regs is NULL, we don't just call the following function */ in xhci_rcar_init_quirk()
209 if (!hcd->regs) in xhci_rcar_init_quirk()
212 if (!xhci_rcar_wait_for_pll_active(hcd)) in xhci_rcar_init_quirk()
213 return -ETIMEDOUT; in xhci_rcar_init_quirk()
223 if (!ret) in xhci_rcar_resume_quirk()