ramips: clean up and refresh kernel patches
[openwrt.git] / target / linux / ramips / patches-4.3 / 0033-USB-add-xhci-hooks.patch
index 8f28f86..07c2eac 100644 (file)
@@ -43,7 +43,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 
 --- a/drivers/usb/core/hcd-pci.c
 +++ b/drivers/usb/core/hcd-pci.c
-@@ -214,8 +214,13 @@
+@@ -214,8 +214,13 @@ int usb_hcd_pci_probe(struct pci_dev *de
                goto disable_pci;
        }
  
@@ -59,7 +59,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                /* EHCI, OHCI */
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
-@@ -1287,7 +1287,7 @@
+@@ -1287,7 +1287,7 @@ static void hub_quiesce(struct usb_hub *
        if (type != HUB_SUSPEND) {
                /* Disconnect all the children */
                for (i = 0; i < hdev->maxchild; ++i) {
@@ -70,7 +70,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        }
 --- a/drivers/usb/core/port.c
 +++ b/drivers/usb/core/port.c
-@@ -480,8 +480,10 @@
+@@ -480,8 +480,10 @@ void usb_hub_remove_port_device(struct u
        struct usb_port *port_dev = hub->ports[port1 - 1];
        struct usb_port *peer;
  
@@ -87,7 +87,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  }
 --- a/drivers/usb/host/Kconfig
 +++ b/drivers/usb/host/Kconfig
-@@ -41,6 +41,13 @@
+@@ -41,6 +41,13 @@ config USB_XHCI_PLATFORM
  
          If unsure, say N.
  
@@ -101,7 +101,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  config USB_XHCI_MVEBU
        tristate "xHCI support for Marvell Armada 375/38x"
        select USB_XHCI_PLATFORM
-@@ -590,7 +597,7 @@
+@@ -590,7 +597,7 @@ endif # USB_OHCI_HCD
  
  config USB_UHCI_HCD
        tristate "UHCI HCD (most Intel and VIA) support"
@@ -112,7 +112,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
          accessing the USB hardware in the PC (which is also called the USB
 --- a/drivers/usb/host/Makefile
 +++ b/drivers/usb/host/Makefile
-@@ -14,7 +14,12 @@
+@@ -14,7 +14,12 @@ xhci-hcd-y := xhci.o xhci-mem.o
  xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o
  xhci-hcd-y += xhci-trace.o
  
@@ -125,7 +125,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  ifneq ($(CONFIG_USB_XHCI_MVEBU), )
        xhci-plat-hcd-y         += xhci-mvebu.o
  endif
-@@ -24,11 +29,10 @@
+@@ -24,11 +29,10 @@ endif
  
  obj-$(CONFIG_USB_WHCI_HCD)    += whci/
  
@@ -3834,7 +3834,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
 --- a/drivers/usb/host/xhci-mem.c
 +++ b/drivers/usb/host/xhci-mem.c
-@@ -67,6 +67,9 @@
+@@ -67,6 +67,9 @@ static struct xhci_segment *xhci_segment
  
  static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg)
  {
@@ -3844,7 +3844,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        if (seg->trbs) {
                dma_pool_free(xhci->segment_pool, seg->trbs, seg->dma);
                seg->trbs = NULL;
-@@ -1471,9 +1474,17 @@
+@@ -1471,9 +1474,17 @@ int xhci_endpoint_init(struct xhci_hcd *
                        max_burst = (usb_endpoint_maxp(&ep->desc)
                                     & 0x1800) >> 11;
                }
@@ -5080,7 +5080,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +#endif
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c
-@@ -43,6 +43,13 @@
+@@ -43,6 +43,13 @@ static void xhci_plat_quirks(struct devi
         * dev struct in order to setup MSI
         */
        xhci->quirks |= XHCI_PLAT;
@@ -5094,7 +5094,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  }
  
  /* called during probe() after chip reset completes */
-@@ -89,7 +96,11 @@
+@@ -89,7 +96,11 @@ static int xhci_plat_probe(struct platfo
  
        driver = &xhci_plat_hc_driver;
  
@@ -5108,7 +5108,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
 --- a/drivers/usb/host/xhci-ring.c
 +++ b/drivers/usb/host/xhci-ring.c
-@@ -254,16 +254,20 @@
+@@ -254,16 +254,20 @@ static void inc_enq(struct xhci_hcd *xhc
  static inline int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring,
                unsigned int num_trbs)
  {
@@ -5129,7 +5129,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        return 1;
  }
-@@ -2869,6 +2873,7 @@
+@@ -2869,6 +2873,7 @@ static int prepare_ring(struct xhci_hcd
                next = ring->enqueue;
  
                while (last_trb(xhci, ring, ring->enq_seg, next)) {
@@ -5137,7 +5137,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                        /* If we're not dealing with 0.95 hardware or isoc rings
                         * on AMD 0.96 host, clear the chain bit.
                         */
-@@ -2878,6 +2883,9 @@
+@@ -2878,6 +2883,9 @@ static int prepare_ring(struct xhci_hcd
                                next->link.control &= cpu_to_le32(~TRB_CHAIN);
                        else
                                next->link.control |= cpu_to_le32(TRB_CHAIN);
@@ -5147,7 +5147,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
                        wmb();
                        next->link.control ^= cpu_to_le32(TRB_CYCLE);
-@@ -3008,6 +3016,9 @@
+@@ -3008,6 +3016,9 @@ static void giveback_first_trb(struct xh
                start_trb->field[3] |= cpu_to_le32(start_cycle);
        else
                start_trb->field[3] &= cpu_to_le32(~TRB_CYCLE);
@@ -5157,7 +5157,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id);
  }
  
-@@ -3063,6 +3074,29 @@
+@@ -3063,6 +3074,29 @@ static u32 xhci_td_remainder(unsigned in
                return (remainder >> 10) << 17;
  }
  
@@ -5187,7 +5187,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  /*
   * For xHCI 1.0 host controllers, TD size is the number of max packet sized
   * packets remaining in the TD (*not* including this TRB).
-@@ -3220,6 +3254,7 @@
+@@ -3220,6 +3254,7 @@ static int queue_bulk_sg_tx(struct xhci_
                }
  
                /* Set the TRB length, TD size, and interrupter fields. */
@@ -5195,7 +5195,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (xhci->hci_version < 0x100) {
                        remainder = xhci_td_remainder(
                                        urb->transfer_buffer_length -
-@@ -3229,6 +3264,12 @@
+@@ -3229,6 +3264,12 @@ static int queue_bulk_sg_tx(struct xhci_
                                        trb_buff_len, total_packet_count, urb,
                                        num_trbs - 1);
                }
@@ -5208,7 +5208,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                length_field = TRB_LEN(trb_buff_len) |
                        remainder |
                        TRB_INTR_TARGET(0);
-@@ -3293,6 +3334,9 @@
+@@ -3293,6 +3334,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
        int running_total, trb_buff_len, ret;
        unsigned int total_packet_count;
        u64 addr;
@@ -5218,7 +5218,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        if (urb->num_sgs)
                return queue_bulk_sg_tx(xhci, mem_flags, urb, slot_id, ep_index);
-@@ -3317,6 +3361,25 @@
+@@ -3317,6 +3361,25 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
                num_trbs++;
                running_total += TRB_MAX_BUFF_SIZE;
        }
@@ -5244,7 +5244,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        ret = prepare_transfer(xhci, xhci->devs[slot_id],
                        ep_index, urb->stream_id,
-@@ -3393,6 +3456,7 @@
+@@ -3393,6 +3456,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
                        field |= TRB_ISP;
  
                /* Set the TRB length, TD size, and interrupter fields. */
@@ -5252,7 +5252,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (xhci->hci_version < 0x100) {
                        remainder = xhci_td_remainder(
                                        urb->transfer_buffer_length -
-@@ -3402,6 +3466,10 @@
+@@ -3402,6 +3466,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
                                        trb_buff_len, total_packet_count, urb,
                                        num_trbs - 1);
                }
@@ -5263,7 +5263,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                length_field = TRB_LEN(trb_buff_len) |
                        remainder |
                        TRB_INTR_TARGET(0);
-@@ -3491,7 +3559,11 @@
+@@ -3491,7 +3559,11 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
                field |= 0x1;
  
        /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */
@@ -5275,7 +5275,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (urb->transfer_buffer_length > 0) {
                        if (setup->bRequestType & USB_DIR_IN)
                                field |= TRB_TX_TYPE(TRB_DATA_IN);
-@@ -3515,7 +3587,12 @@
+@@ -3515,7 +3587,12 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
                field = TRB_TYPE(TRB_DATA);
  
        length_field = TRB_LEN(urb->transfer_buffer_length) |
@@ -5288,7 +5288,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                TRB_INTR_TARGET(0);
        if (urb->transfer_buffer_length > 0) {
                if (setup->bRequestType & USB_DIR_IN)
-@@ -3731,6 +3808,9 @@
+@@ -3731,6 +3808,9 @@ static int xhci_queue_isoc_tx(struct xhc
        bool more_trbs_coming;
        struct xhci_virt_ep *xep;
  
@@ -5298,7 +5298,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        xep = &xhci->devs[slot_id]->eps[ep_index];
        ep_ring = xhci->devs[slot_id]->eps[ep_index].ring;
  
-@@ -3744,6 +3824,21 @@
+@@ -3744,6 +3824,21 @@ static int xhci_queue_isoc_tx(struct xhc
        start_trb = &ep_ring->enqueue->generic;
        start_cycle = ep_ring->cycle_state;
  
@@ -5320,7 +5320,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        urb_priv = urb->hcpriv;
        /* Queue the first TRB, even if it's zero-length */
        for (i = 0; i < num_tds; i++) {
-@@ -3828,9 +3923,13 @@
+@@ -3828,9 +3923,13 @@ static int xhci_queue_isoc_tx(struct xhc
                        } else {
                                td->last_trb = ep_ring->enqueue;
                                field |= TRB_IOC;
@@ -5334,7 +5334,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                                        /* Set BEI bit except for the last td */
                                        if (i < num_tds - 1)
                                                field |= TRB_BEI;
-@@ -3845,6 +3944,7 @@
+@@ -3845,6 +3944,7 @@ static int xhci_queue_isoc_tx(struct xhc
                                trb_buff_len = td_remain_len;
  
                        /* Set the TRB length, TD size, & interrupter fields. */
@@ -5342,7 +5342,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                        if (xhci->hci_version < 0x100) {
                                remainder = xhci_td_remainder(
                                                td_len - running_total);
-@@ -3854,6 +3954,10 @@
+@@ -3854,6 +3954,10 @@ static int xhci_queue_isoc_tx(struct xhc
                                                total_packet_count, urb,
                                                (trbs_per_td - j - 1));
                        }
@@ -5372,7 +5372,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  #define DRIVER_AUTHOR "Sarah Sharp"
  #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"
  
-@@ -46,6 +56,18 @@
+@@ -46,6 +56,18 @@ static unsigned int quirks;
  module_param(quirks, uint, S_IRUGO);
  MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
  
@@ -5391,7 +5391,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  /* TODO: copied from ehci-hcd.c - can this be refactored? */
  /*
   * xhci_handshake - spin reading hc until handshake completes or fails
-@@ -198,7 +220,7 @@
+@@ -198,7 +220,7 @@ int xhci_reset(struct xhci_hcd *xhci)
        return ret;
  }
  
@@ -5400,7 +5400,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  static int xhci_free_msi(struct xhci_hcd *xhci)
  {
        int i;
-@@ -448,6 +470,11 @@
+@@ -448,6 +470,11 @@ static void compliance_mode_recovery(uns
                                        "Attempting compliance mode recovery");
                        hcd = xhci->shared_hcd;
  
@@ -5412,7 +5412,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                        if (hcd->state == HC_STATE_SUSPENDED)
                                usb_hcd_resume_root_hub(hcd);
  
-@@ -495,6 +522,9 @@
+@@ -495,6 +522,9 @@ static bool xhci_compliance_mode_recover
  {
        const char *dmi_product_name, *dmi_sys_vendor;
  
@@ -5422,7 +5422,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        dmi_product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
        dmi_sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
        if (!dmi_product_name || !dmi_sys_vendor)
-@@ -540,6 +570,10 @@
+@@ -540,6 +570,10 @@ int xhci_init(struct usb_hcd *hcd)
                xhci_dbg_trace(xhci, trace_xhci_dbg_init,
                                "xHCI doesn't need link TRB QUIRK");
        }
@@ -5433,7 +5433,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        retval = xhci_mem_init(xhci, GFP_KERNEL);
        xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished xhci_init");
  
-@@ -624,7 +658,11 @@
+@@ -624,7 +658,11 @@ int xhci_run(struct usb_hcd *hcd)
                        "// Set the interrupt modulation register");
        temp = readl(&xhci->ir_set->irq_control);
        temp &= ~ER_IRQ_INTERVAL_MASK;
@@ -5445,7 +5445,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        writel(temp, &xhci->ir_set->irq_control);
  
        /* Set the HCD state before we enable the irqs */
-@@ -649,6 +687,9 @@
+@@ -649,6 +687,9 @@ int xhci_run(struct usb_hcd *hcd)
                xhci_queue_vendor_command(xhci, command, 0, 0, 0,
                                TRB_TYPE(TRB_NEC_GET_FW));
        }
@@ -5455,7 +5455,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        xhci_dbg_trace(xhci, trace_xhci_dbg_init,
                        "Finished xhci_run for USB2 roothub");
        return 0;
-@@ -1639,6 +1680,14 @@
+@@ -1639,6 +1680,14 @@ int xhci_drop_endpoint(struct usb_hcd *h
        u32 drop_flag;
        u32 new_add_flags, new_drop_flags;
        int ret;
@@ -5470,7 +5470,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        ret = xhci_check_args(hcd, udev, ep, 1, true, __func__);
        if (ret <= 0)
-@@ -1688,6 +1737,40 @@
+@@ -1688,6 +1737,40 @@ int xhci_drop_endpoint(struct usb_hcd *h
  
        xhci_endpoint_zero(xhci, xhci->devs[udev->slot_id], ep);
  
@@ -5511,7 +5511,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        xhci_dbg(xhci, "drop ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n",
                        (unsigned int) ep->desc.bEndpointAddress,
                        udev->slot_id,
-@@ -1720,6 +1803,19 @@
+@@ -1720,6 +1803,19 @@ int xhci_add_endpoint(struct usb_hcd *hc
        u32 new_add_flags, new_drop_flags;
        struct xhci_virt_device *virt_dev;
        int ret = 0;
@@ -5531,7 +5531,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        ret = xhci_check_args(hcd, udev, ep, 1, true, __func__);
        if (ret <= 0) {
-@@ -1783,6 +1879,56 @@
+@@ -1783,6 +1879,56 @@ int xhci_add_endpoint(struct usb_hcd *hc
                return -ENOMEM;
        }
  
@@ -5588,7 +5588,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        ctrl_ctx->add_flags |= cpu_to_le32(added_ctxs);
        new_add_flags = le32_to_cpu(ctrl_ctx->add_flags);
  
-@@ -4446,8 +4592,14 @@
+@@ -4446,8 +4592,14 @@ static u16 xhci_call_host_update_timeout
                u16 *timeout)
  {
        if (state == USB3_LPM_U1)
@@ -5603,7 +5603,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                return xhci_calculate_u2_timeout(xhci, udev, desc);
  
        return USB3_LPM_DISABLED;
-@@ -4839,7 +4991,9 @@
+@@ -4839,7 +4991,9 @@ int xhci_gen_setup(struct usb_hcd *hcd,
        hcd->self.no_sg_constraint = 1;
  
        /* XHCI controllers don't stop the ep queue on short packets :| */
@@ -5613,7 +5613,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        if (usb_hcd_is_primary_hcd(hcd)) {
                xhci = hcd_to_xhci(hcd);
-@@ -4900,6 +5054,10 @@
+@@ -4900,6 +5054,10 @@ int xhci_gen_setup(struct usb_hcd *hcd,
                return retval;
        xhci_dbg(xhci, "Reset complete\n");
  
@@ -5624,7 +5624,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        /* Set dma_mask and coherent_dma_mask to 64-bits,
         * if xHC supports 64-bit addressing */
        if (HCC_64BIT_ADDR(xhci->hcc_params) &&
-@@ -5005,8 +5163,57 @@
+@@ -5005,8 +5163,57 @@ MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_LICENSE("GPL");
  
@@ -5706,7 +5706,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  /* xHCI PCI Configuration Registers */
  #define XHCI_SBRN_OFFSET      (0x60)
  
-@@ -1597,8 +1612,12 @@
+@@ -1597,8 +1612,12 @@ struct xhci_hcd {
        /* Compliance Mode Recovery Data */
        struct timer_list       comp_mode_recovery_timer;
        u32                     port_status_u0;
@@ -5719,7 +5719,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  };
  
  /* Platform specific overrides to generic XHCI hc_driver ops */
-@@ -1763,6 +1782,26 @@
+@@ -1763,6 +1782,26 @@ void xhci_urb_free_priv(struct urb_priv
  void xhci_free_command(struct xhci_hcd *xhci,
                struct xhci_command *command);