hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/usb/host/xhci-mem.c
....@@ -2236,7 +2236,7 @@
22362236 {
22372237 u32 temp, port_offset, port_count;
22382238 int i;
2239
- u8 major_revision, minor_revision;
2239
+ u8 major_revision, minor_revision, tmp_minor_revision;
22402240 struct xhci_hub *rhub;
22412241 struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
22422242 struct xhci_port_cap *port_cap;
....@@ -2256,6 +2256,15 @@
22562256 */
22572257 if (minor_revision > 0x00 && minor_revision < 0x10)
22582258 minor_revision <<= 4;
2259
+ /*
2260
+ * Some zhaoxin's xHCI controller that follow usb3.1 spec
2261
+ * but only support Gen1.
2262
+ */
2263
+ if (xhci->quirks & XHCI_ZHAOXIN_HOST) {
2264
+ tmp_minor_revision = minor_revision;
2265
+ minor_revision = 0;
2266
+ }
2267
+
22592268 } else if (major_revision <= 0x02) {
22602269 rhub = &xhci->usb2_rhub;
22612270 } else {
....@@ -2265,10 +2274,6 @@
22652274 /* Ignoring port protocol we can't understand. FIXME */
22662275 return;
22672276 }
2268
- rhub->maj_rev = XHCI_EXT_PORT_MAJOR(temp);
2269
-
2270
- if (rhub->min_rev < minor_revision)
2271
- rhub->min_rev = minor_revision;
22722277
22732278 /* Port offset and count in the third dword, see section 7.2 */
22742279 temp = readl(addr + 2);
....@@ -2287,8 +2292,6 @@
22872292 if (xhci->num_port_caps > max_caps)
22882293 return;
22892294
2290
- port_cap->maj_rev = major_revision;
2291
- port_cap->min_rev = minor_revision;
22922295 port_cap->psi_count = XHCI_EXT_PORT_PSIC(temp);
22932296
22942297 if (port_cap->psi_count) {
....@@ -2309,6 +2312,11 @@
23092312 XHCI_EXT_PORT_PSIV(port_cap->psi[i - 1])))
23102313 port_cap->psi_uid_count++;
23112314
2315
+ if (xhci->quirks & XHCI_ZHAOXIN_HOST &&
2316
+ major_revision == 0x03 &&
2317
+ XHCI_EXT_PORT_PSIV(port_cap->psi[i]) >= 5)
2318
+ minor_revision = tmp_minor_revision;
2319
+
23122320 xhci_dbg(xhci, "PSIV:%d PSIE:%d PLT:%d PFD:%d LP:%d PSIM:%d\n",
23132321 XHCI_EXT_PORT_PSIV(port_cap->psi[i]),
23142322 XHCI_EXT_PORT_PSIE(port_cap->psi[i]),
....@@ -2318,6 +2326,15 @@
23182326 XHCI_EXT_PORT_PSIM(port_cap->psi[i]));
23192327 }
23202328 }
2329
+
2330
+ rhub->maj_rev = major_revision;
2331
+
2332
+ if (rhub->min_rev < minor_revision)
2333
+ rhub->min_rev = minor_revision;
2334
+
2335
+ port_cap->maj_rev = major_revision;
2336
+ port_cap->min_rev = minor_revision;
2337
+
23212338 /* cache usb2 port capabilities */
23222339 if (major_revision < 0x03 && xhci->num_ext_caps < max_caps)
23232340 xhci->ext_caps[xhci->num_ext_caps++] = temp;
....@@ -2568,8 +2585,12 @@
25682585 * and our use of dma addresses in the trb_address_map radix tree needs
25692586 * TRB_SEGMENT_SIZE alignment, so we pick the greater alignment need.
25702587 */
2571
- xhci->segment_pool = dma_pool_create("xHCI ring segments", dev,
2572
- TRB_SEGMENT_SIZE, TRB_SEGMENT_SIZE, xhci->page_size);
2588
+ if (xhci->quirks & XHCI_ZHAOXIN_TRB_FETCH)
2589
+ xhci->segment_pool = dma_pool_create("xHCI ring segments", dev,
2590
+ TRB_SEGMENT_SIZE * 2, TRB_SEGMENT_SIZE * 2, xhci->page_size * 2);
2591
+ else
2592
+ xhci->segment_pool = dma_pool_create("xHCI ring segments", dev,
2593
+ TRB_SEGMENT_SIZE, TRB_SEGMENT_SIZE, xhci->page_size);
25732594
25742595 /* See Table 46 and Note on Figure 55 */
25752596 xhci->device_pool = dma_pool_create("xHCI input/output contexts", dev,