| .. | .. |
|---|
| 9 | 9 | */ |
|---|
| 10 | 10 | |
|---|
| 11 | 11 | #include <linux/pci.h> |
|---|
| 12 | +#ifndef __GENKSYMS__ /* ANDROID: KABI CRC preservation hack */ |
|---|
| 13 | +#include <linux/iommu.h> |
|---|
| 14 | +#endif |
|---|
| 12 | 15 | #include <linux/iopoll.h> |
|---|
| 13 | 16 | #include <linux/irq.h> |
|---|
| 14 | 17 | #include <linux/log2.h> |
|---|
| .. | .. |
|---|
| 223 | 226 | static void xhci_zero_64b_regs(struct xhci_hcd *xhci) |
|---|
| 224 | 227 | { |
|---|
| 225 | 228 | struct device *dev = xhci_to_hcd(xhci)->self.sysdev; |
|---|
| 229 | + struct iommu_domain *domain; |
|---|
| 226 | 230 | int err, i; |
|---|
| 227 | 231 | u64 val; |
|---|
| 228 | 232 | u32 intrs; |
|---|
| .. | .. |
|---|
| 241 | 245 | * an iommu. Doing anything when there is no iommu is definitely |
|---|
| 242 | 246 | * unsafe... |
|---|
| 243 | 247 | */ |
|---|
| 244 | | - if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !device_iommu_mapped(dev)) |
|---|
| 248 | + domain = iommu_get_domain_for_dev(dev); |
|---|
| 249 | + if (!(xhci->quirks & XHCI_ZERO_64B_REGS) || !domain || |
|---|
| 250 | + domain->type == IOMMU_DOMAIN_IDENTITY) |
|---|
| 245 | 251 | return; |
|---|
| 246 | 252 | |
|---|
| 247 | 253 | xhci_info(xhci, "Zeroing 64bit base registers, expecting fault\n"); |
|---|
| .. | .. |
|---|
| 692 | 698 | } |
|---|
| 693 | 699 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
|---|
| 694 | 700 | "Finished xhci_run for USB2 roothub"); |
|---|
| 701 | + |
|---|
| 702 | + set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); |
|---|
| 695 | 703 | |
|---|
| 696 | 704 | xhci_dbc_init(xhci); |
|---|
| 697 | 705 | |
|---|
| .. | .. |
|---|
| 1258 | 1266 | * the first wake signalling failed, give it that chance. |
|---|
| 1259 | 1267 | */ |
|---|
| 1260 | 1268 | pending_portevent = xhci_pending_portevent(xhci); |
|---|
| 1261 | | - if (!pending_portevent) { |
|---|
| 1269 | + if (!pending_portevent && !IS_ENABLED(CONFIG_ARCH_ROCKCHIP)) { |
|---|
| 1262 | 1270 | msleep(120); |
|---|
| 1263 | 1271 | pending_portevent = xhci_pending_portevent(xhci); |
|---|
| 1264 | 1272 | } |
|---|
| .. | .. |
|---|
| 3865 | 3873 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
|---|
| 3866 | 3874 | struct xhci_virt_device *virt_dev; |
|---|
| 3867 | 3875 | struct xhci_slot_ctx *slot_ctx; |
|---|
| 3876 | + unsigned long flags; |
|---|
| 3868 | 3877 | int i, ret; |
|---|
| 3869 | 3878 | |
|---|
| 3870 | 3879 | /* |
|---|
| .. | .. |
|---|
| 3893 | 3902 | } |
|---|
| 3894 | 3903 | virt_dev->udev = NULL; |
|---|
| 3895 | 3904 | xhci_disable_slot(xhci, udev->slot_id); |
|---|
| 3905 | + |
|---|
| 3906 | + spin_lock_irqsave(&xhci->lock, flags); |
|---|
| 3896 | 3907 | xhci_free_virt_device(xhci, udev->slot_id); |
|---|
| 3908 | + spin_unlock_irqrestore(&xhci->lock, flags); |
|---|
| 3909 | + |
|---|
| 3897 | 3910 | } |
|---|
| 3898 | 3911 | |
|---|
| 3899 | 3912 | int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) |
|---|