CC: upgrade kernel to 3.18.68
[15.05/openwrt.git] / target / linux / ramips / patches-3.18 / 0062-mt7621-add-ECHI-OCHI-XCHI-support.patch
index a5e4665..37b7903 100644 (file)
@@ -16,7 +16,7 @@
                /* EHCI, OHCI */
 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
-@@ -1304,7 +1304,7 @@ static void hub_quiesce(struct usb_hub *
+@@ -1261,7 +1261,7 @@ static void hub_quiesce(struct usb_hub *
        if (type != HUB_SUSPEND) {
                /* Disconnect all the children */
                for (i = 0; i < hdev->maxchild; ++i) {
        irq = platform_get_irq(pdev, 0);
 +#endif
        if (irq < 0)
-               return -ENODEV;
+               return irq;
  
 --- a/drivers/usb/host/xhci-ring.c
 +++ b/drivers/usb/host/xhci-ring.c
  
        return 1;
  }
-@@ -2843,6 +2847,7 @@ static int prepare_ring(struct xhci_hcd
+@@ -2835,6 +2839,7 @@ static int prepare_ring(struct xhci_hcd
                next = ring->enqueue;
  
                while (last_trb(xhci, ring, ring->enq_seg, next)) {
                        /* If we're not dealing with 0.95 hardware or isoc rings
                         * on AMD 0.96 host, clear the chain bit.
                         */
-@@ -2852,6 +2857,9 @@ static int prepare_ring(struct xhci_hcd
+@@ -2844,6 +2849,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);
  
                        wmb();
                        next->link.control ^= cpu_to_le32(TRB_CYCLE);
-@@ -2982,6 +2990,9 @@ static void giveback_first_trb(struct xh
+@@ -2974,6 +2982,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);
        xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id);
  }
  
-@@ -3037,6 +3048,29 @@ static u32 xhci_td_remainder(unsigned in
+@@ -3029,6 +3040,29 @@ static u32 xhci_td_remainder(unsigned in
                return (remainder >> 10) << 17;
  }
  
  /*
   * For xHCI 1.0 host controllers, TD size is the number of max packet sized
   * packets remaining in the TD (*not* including this TRB).
-@@ -3194,6 +3228,7 @@ static int queue_bulk_sg_tx(struct xhci_
+@@ -3186,6 +3220,7 @@ static int queue_bulk_sg_tx(struct xhci_
                }
  
                /* Set the TRB length, TD size, and interrupter fields. */
                if (xhci->hci_version < 0x100) {
                        remainder = xhci_td_remainder(
                                        urb->transfer_buffer_length -
-@@ -3203,6 +3238,12 @@ static int queue_bulk_sg_tx(struct xhci_
+@@ -3195,6 +3230,12 @@ static int queue_bulk_sg_tx(struct xhci_
                                        trb_buff_len, total_packet_count, urb,
                                        num_trbs - 1);
                }
                length_field = TRB_LEN(trb_buff_len) |
                        remainder |
                        TRB_INTR_TARGET(0);
-@@ -3267,6 +3308,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3259,6 +3300,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
        int running_total, trb_buff_len, ret;
        unsigned int total_packet_count;
        u64 addr;
  
        if (urb->num_sgs)
                return queue_bulk_sg_tx(xhci, mem_flags, urb, slot_id, ep_index);
-@@ -3291,6 +3335,25 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3283,6 +3327,25 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
                num_trbs++;
                running_total += TRB_MAX_BUFF_SIZE;
        }
  
        ret = prepare_transfer(xhci, xhci->devs[slot_id],
                        ep_index, urb->stream_id,
-@@ -3367,6 +3430,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3359,6 +3422,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
                        field |= TRB_ISP;
  
                /* Set the TRB length, TD size, and interrupter fields. */
                if (xhci->hci_version < 0x100) {
                        remainder = xhci_td_remainder(
                                        urb->transfer_buffer_length -
-@@ -3376,6 +3440,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3368,6 +3432,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
                                        trb_buff_len, total_packet_count, urb,
                                        num_trbs - 1);
                }
                length_field = TRB_LEN(trb_buff_len) |
                        remainder |
                        TRB_INTR_TARGET(0);
-@@ -3465,7 +3533,11 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
+@@ -3457,7 +3525,11 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
                field |= 0x1;
  
        /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */
                if (urb->transfer_buffer_length > 0) {
                        if (setup->bRequestType & USB_DIR_IN)
                                field |= TRB_TX_TYPE(TRB_DATA_IN);
-@@ -3489,7 +3561,12 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
+@@ -3481,7 +3553,12 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
                field = TRB_TYPE(TRB_DATA);
  
        length_field = TRB_LEN(urb->transfer_buffer_length) |
                TRB_INTR_TARGET(0);
        if (urb->transfer_buffer_length > 0) {
                if (setup->bRequestType & USB_DIR_IN)
-@@ -3612,6 +3689,9 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3604,6 +3681,9 @@ static int xhci_queue_isoc_tx(struct xhc
        u64 start_addr, addr;
        int i, j;
        bool more_trbs_coming;
  
        ep_ring = xhci->devs[slot_id]->eps[ep_index].ring;
  
-@@ -3625,6 +3705,21 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3617,6 +3697,21 @@ static int xhci_queue_isoc_tx(struct xhc
        start_trb = &ep_ring->enqueue->generic;
        start_cycle = ep_ring->cycle_state;
  
        urb_priv = urb->hcpriv;
        /* Queue the first TRB, even if it's zero-length */
        for (i = 0; i < num_tds; i++) {
-@@ -3696,9 +3791,13 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3688,9 +3783,13 @@ static int xhci_queue_isoc_tx(struct xhc
                        } else {
                                td->last_trb = ep_ring->enqueue;
                                field |= TRB_IOC;
                                        /* Set BEI bit except for the last td */
                                        if (i < num_tds - 1)
                                                field |= TRB_BEI;
-@@ -3713,6 +3812,7 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3705,6 +3804,7 @@ static int xhci_queue_isoc_tx(struct xhc
                                trb_buff_len = td_remain_len;
  
                        /* Set the TRB length, TD size, & interrupter fields. */
                        if (xhci->hci_version < 0x100) {
                                remainder = xhci_td_remainder(
                                                td_len - running_total);
-@@ -3722,6 +3822,10 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3714,6 +3814,10 @@ static int xhci_queue_isoc_tx(struct xhc
                                                total_packet_count, urb,
                                                (trbs_per_td - j - 1));
                        }
        xhci_dbg_trace(xhci, trace_xhci_dbg_init,
                        "Finished xhci_run for USB2 roothub");
        return 0;
-@@ -1651,6 +1692,14 @@ int xhci_drop_endpoint(struct usb_hcd *h
+@@ -1638,6 +1679,14 @@ int xhci_drop_endpoint(struct usb_hcd *h
        u32 drop_flag;
        u32 new_add_flags, new_drop_flags;
        int ret;
  
        ret = xhci_check_args(hcd, udev, ep, 1, true, __func__);
        if (ret <= 0)
-@@ -1698,6 +1747,40 @@ int xhci_drop_endpoint(struct usb_hcd *h
+@@ -1685,6 +1734,40 @@ int xhci_drop_endpoint(struct usb_hcd *h
  
        xhci_endpoint_zero(xhci, xhci->devs[udev->slot_id], ep);
  
        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,
-@@ -1730,6 +1813,19 @@ int xhci_add_endpoint(struct usb_hcd *hc
+@@ -1717,6 +1800,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;
  
        ret = xhci_check_args(hcd, udev, ep, 1, true, __func__);
        if (ret <= 0) {
-@@ -1796,6 +1892,56 @@ int xhci_add_endpoint(struct usb_hcd *hc
+@@ -1783,6 +1879,56 @@ int xhci_add_endpoint(struct usb_hcd *hc
                return -ENOMEM;
        }
  
        ctrl_ctx->add_flags |= cpu_to_le32(added_ctxs);
        new_add_flags = le32_to_cpu(ctrl_ctx->add_flags);
  
-@@ -4467,8 +4613,14 @@ static u16 xhci_call_host_update_timeout
+@@ -4454,8 +4600,14 @@ static u16 xhci_call_host_update_timeout
                u16 *timeout)
  {
        if (state == USB3_LPM_U1)
                return xhci_calculate_u2_timeout(xhci, udev, desc);
  
        return USB3_LPM_DISABLED;
-@@ -4853,7 +5005,9 @@ int xhci_gen_setup(struct usb_hcd *hcd,
+@@ -4840,7 +4992,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 :| */
  
        if (usb_hcd_is_primary_hcd(hcd)) {
                xhci = kzalloc(sizeof(struct xhci_hcd), GFP_KERNEL);
-@@ -4926,6 +5080,10 @@ int xhci_gen_setup(struct usb_hcd *hcd,
+@@ -4913,6 +5067,10 @@ int xhci_gen_setup(struct usb_hcd *hcd,
        if (xhci->quirks & XHCI_NO_64BIT_SUPPORT)
                xhci->hcc_params &= ~BIT(0);
  
        /* Set dma_mask and coherent_dma_mask to 64-bits,
         * if xHC supports 64-bit addressing */
        if (HCC_64BIT_ADDR(xhci->hcc_params) &&
-@@ -5020,8 +5178,57 @@ MODULE_DESCRIPTION(DRIVER_DESC);
+@@ -5007,8 +5165,57 @@ MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_LICENSE("GPL");