kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / ramips / patches-3.18 / 0062-mt7621-add-ECHI-OCHI-XCHI-support.patch
index 98e8ca5..f407578 100644 (file)
  /*
   * For xHCI 1.0 host controllers, TD size is the number of max packet sized
   * packets remaining in the TD (*not* including this TRB).
-@@ -3141,6 +3175,7 @@ static int queue_bulk_sg_tx(struct xhci_
+@@ -3161,6 +3195,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 -
-@@ -3150,6 +3185,12 @@ static int queue_bulk_sg_tx(struct xhci_
+@@ -3170,6 +3205,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);
-@@ -3212,6 +3253,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3234,6 +3275,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);
-@@ -3237,6 +3281,25 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3258,6 +3302,25 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+               num_trbs++;
                running_total += TRB_MAX_BUFF_SIZE;
        }
-       /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */
 +#if defined (CONFIG_USB_MT7621_XHCI_PLATFORM)
 +      switch(urb->dev->speed){
 +              case USB_SPEED_SUPER:
  
        ret = prepare_transfer(xhci, xhci->devs[slot_id],
                        ep_index, urb->stream_id,
-@@ -3296,6 +3359,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3334,6 +3397,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 -
-@@ -3305,6 +3369,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd *
+@@ -3343,6 +3407,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);
-@@ -3394,7 +3462,11 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
+@@ -3432,7 +3500,11 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
                field |= 0x1;
  
-       /* xHCI 1.0 6.4.1.2.1: Transfer Type field */
+       /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */
 +#if defined (CONFIG_USB_MT7621_XHCI_PLATFORM)
 +      if (1) {
 +#else
-       if (xhci->hci_version == 0x100) {
+       if (xhci->hci_version >= 0x100) {
 +#endif
                if (urb->transfer_buffer_length > 0) {
                        if (setup->bRequestType & USB_DIR_IN)
                                field |= TRB_TX_TYPE(TRB_DATA_IN);
-@@ -3418,7 +3490,12 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
+@@ -3456,7 +3528,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)
-@@ -3541,6 +3618,9 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3579,6 +3656,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;
  
-@@ -3554,6 +3634,21 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3592,6 +3672,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++) {
-@@ -3625,9 +3720,13 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3663,9 +3758,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;
-@@ -3642,6 +3741,7 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3680,6 +3779,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);
-@@ -3651,6 +3751,10 @@ static int xhci_queue_isoc_tx(struct xhc
+@@ -3689,6 +3789,10 @@ static int xhci_queue_isoc_tx(struct xhc
                                                total_packet_count, urb,
                                                (trbs_per_td - j - 1));
                        }
  /* TODO: copied from ehci-hcd.c - can this be refactored? */
  /*
   * xhci_handshake - spin reading hc until handshake completes or fails
-@@ -198,7 +220,7 @@ int xhci_reset(struct xhci_hcd *xhci)
+@@ -199,7 +221,7 @@ int xhci_reset(struct xhci_hcd *xhci)
        return ret;
  }
  
  static int xhci_free_msi(struct xhci_hcd *xhci)
  {
        int i;
-@@ -448,6 +470,11 @@ static void compliance_mode_recovery(uns
+@@ -449,6 +471,11 @@ static void compliance_mode_recovery(uns
                                        "Attempting compliance mode recovery");
                        hcd = xhci->shared_hcd;
  
                        if (hcd->state == HC_STATE_SUSPENDED)
                                usb_hcd_resume_root_hub(hcd);
  
-@@ -497,6 +524,9 @@ static bool xhci_compliance_mode_recover
+@@ -498,6 +525,9 @@ static bool xhci_compliance_mode_recover
  {
        const char *dmi_product_name, *dmi_sys_vendor;
  
        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)
-@@ -542,6 +572,10 @@ int xhci_init(struct usb_hcd *hcd)
+@@ -543,6 +573,10 @@ int xhci_init(struct usb_hcd *hcd)
                xhci_dbg_trace(xhci, trace_xhci_dbg_init,
                                "xHCI doesn't need link TRB QUIRK");
        }
        retval = xhci_mem_init(xhci, GFP_KERNEL);
        xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished xhci_init");
  
-@@ -626,7 +660,11 @@ int xhci_run(struct usb_hcd *hcd)
+@@ -627,7 +661,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;
        writel(temp, &xhci->ir_set->irq_control);
  
        /* Set the HCD state before we enable the irqs */
-@@ -651,6 +689,9 @@ int xhci_run(struct usb_hcd *hcd)
+@@ -652,6 +690,9 @@ int xhci_run(struct usb_hcd *hcd)
                xhci_queue_vendor_command(xhci, command, 0, 0, 0,
                                TRB_TYPE(TRB_NEC_GET_FW));
        }
        xhci_dbg_trace(xhci, trace_xhci_dbg_init,
                        "Finished xhci_run for USB2 roothub");
        return 0;
-@@ -1642,6 +1683,14 @@ int xhci_drop_endpoint(struct usb_hcd *h
+@@ -1648,6 +1689,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)
-@@ -1689,6 +1738,40 @@ int xhci_drop_endpoint(struct usb_hcd *h
+@@ -1695,6 +1744,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,
-@@ -1721,6 +1804,19 @@ int xhci_add_endpoint(struct usb_hcd *hc
+@@ -1727,6 +1810,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) {
-@@ -1787,6 +1883,56 @@ int xhci_add_endpoint(struct usb_hcd *hc
+@@ -1793,6 +1889,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);
  
-@@ -4454,8 +4600,14 @@ static u16 xhci_call_host_update_timeout
+@@ -4463,8 +4609,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;
-@@ -4840,7 +4992,9 @@ int xhci_gen_setup(struct usb_hcd *hcd,
+@@ -4849,7 +5001,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);
-@@ -4903,6 +5057,10 @@ int xhci_gen_setup(struct usb_hcd *hcd,
+@@ -4912,6 +5066,10 @@ int xhci_gen_setup(struct usb_hcd *hcd,
                goto error;
        xhci_dbg(xhci, "Reset complete\n");
  
        /* Set dma_mask and coherent_dma_mask to 64-bits,
         * if xHC supports 64-bit addressing */
        if (HCC_64BIT_ADDR(xhci->hcc_params) &&
-@@ -4997,8 +5155,57 @@ MODULE_DESCRIPTION(DRIVER_DESC);
+@@ -5006,8 +5164,57 @@ MODULE_DESCRIPTION(DRIVER_DESC);
  MODULE_AUTHOR(DRIVER_AUTHOR);
  MODULE_LICENSE("GPL");