diff options
-rw-r--r-- | target/linux/ramips/patches-3.10/0214-usb-add-mt7621-xhci-support.patch | 234 |
1 files changed, 140 insertions, 94 deletions
diff --git a/target/linux/ramips/patches-3.10/0214-usb-add-mt7621-xhci-support.patch b/target/linux/ramips/patches-3.10/0214-usb-add-mt7621-xhci-support.patch index bcac2b43e6..c0270da3b5 100644 --- a/target/linux/ramips/patches-3.10/0214-usb-add-mt7621-xhci-support.patch +++ b/target/linux/ramips/patches-3.10/0214-usb-add-mt7621-xhci-support.patch @@ -40,9 +40,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org> create mode 100644 drivers/usb/host/xhci-mtk.c create mode 100644 drivers/usb/host/xhci-mtk.h ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -1254,7 +1254,7 @@ static void hub_quiesce(struct usb_hub * +Index: linux-3.10.44/drivers/usb/core/hub.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/core/hub.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/core/hub.c 2014-07-02 11:20:15.817675027 +0100 +@@ -1254,7 +1254,7 @@ if (type != HUB_SUSPEND) { /* Disconnect all the children */ for (i = 0; i < hdev->maxchild; ++i) { @@ -51,9 +53,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org> usb_disconnect(&hub->ports[i]->child); } } ---- a/drivers/usb/core/port.c -+++ b/drivers/usb/core/port.c -@@ -193,6 +193,7 @@ exit: +Index: linux-3.10.44/drivers/usb/core/port.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/core/port.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/core/port.c 2014-07-02 11:20:15.817675027 +0100 +@@ -193,6 +193,7 @@ void usb_hub_remove_port_device(struct usb_hub *hub, int port1) { @@ -62,24 +66,30 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + device_unregister(&hub->ports[port1 - 1]->dev); } ---- a/drivers/usb/host/Kconfig -+++ b/drivers/usb/host/Kconfig -@@ -28,7 +28,11 @@ config USB_XHCI_HCD +Index: linux-3.10.44/drivers/usb/host/Kconfig +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/Kconfig 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/Kconfig 2014-07-02 11:27:17.469659353 +0100 +@@ -28,7 +28,13 @@ if USB_XHCI_HCD config USB_XHCI_PLATFORM - tristate + bool "xHCI platform" ++ depends on SOC_MT7621 + +config USB_MT7621_XHCI_PLATFORM + bool "MTK MT7621 xHCI" + depends on USB_XHCI_PLATFORM ++ depends on SOC_MT7621 config USB_XHCI_HCD_DEBUGGING bool "Debugging for the xHCI host controller" ---- a/drivers/usb/host/Makefile -+++ b/drivers/usb/host/Makefile -@@ -13,15 +13,23 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o +Index: linux-3.10.44/drivers/usb/host/Makefile +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/Makefile 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/Makefile 2014-07-02 11:20:15.817675027 +0100 +@@ -13,15 +13,23 @@ xhci-hcd-y := xhci.o xhci-mem.o xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o @@ -104,8 +114,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o ---- /dev/null -+++ b/drivers/usb/host/mtk-phy-7621.c +Index: linux-3.10.44/drivers/usb/host/mtk-phy-7621.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/mtk-phy-7621.c 2014-07-02 11:20:15.817675027 +0100 @@ -0,0 +1,445 @@ +#include "mtk-phy.h" + @@ -552,8 +564,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> +} + +#endif ---- /dev/null -+++ b/drivers/usb/host/mtk-phy-7621.h +Index: linux-3.10.44/drivers/usb/host/mtk-phy-7621.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/mtk-phy-7621.h 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,2871 @@ +#ifdef CONFIG_PROJECT_7621 +#ifndef __MTK_PHY_7621_H @@ -3426,8 +3440,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + +#endif +#endif ---- /dev/null -+++ b/drivers/usb/host/mtk-phy-ahb.c +Index: linux-3.10.44/drivers/usb/host/mtk-phy-ahb.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/mtk-phy-ahb.c 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,58 @@ +#include "mtk-phy.h" +#ifdef CONFIG_U3D_HAL_SUPPORT @@ -3487,8 +3503,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + +#endif + ---- /dev/null -+++ b/drivers/usb/host/mtk-phy.c +Index: linux-3.10.44/drivers/usb/host/mtk-phy.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/mtk-phy.c 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,102 @@ +#include <linux/gfp.h> +#include <linux/kernel.h> @@ -3592,8 +3610,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + return ((U3PhyReadReg32(addr) & mask) >> offset); +} + ---- /dev/null -+++ b/drivers/usb/host/mtk-phy.h +Index: linux-3.10.44/drivers/usb/host/mtk-phy.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/mtk-phy.h 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,179 @@ +#ifndef __MTK_PHY_NEW_H +#define __MTK_PHY_NEW_H @@ -3774,8 +3794,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> +/***********************************/ +#endif + ---- a/drivers/usb/host/pci-quirks.h -+++ b/drivers/usb/host/pci-quirks.h +Index: linux-3.10.44/drivers/usb/host/pci-quirks.h +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/pci-quirks.h 2014-07-02 11:20:14.589675072 +0100 ++++ linux-3.10.44/drivers/usb/host/pci-quirks.h 2014-07-02 11:20:15.821675026 +0100 @@ -1,7 +1,7 @@ #ifndef __LINUX_USB_PCI_QUIRKS_H #define __LINUX_USB_PCI_QUIRKS_H @@ -3785,8 +3807,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); #endif /* CONFIG_PCI */ ---- a/drivers/usb/host/xhci-dbg.c -+++ b/drivers/usb/host/xhci-dbg.c +Index: linux-3.10.44/drivers/usb/host/xhci-dbg.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/xhci-dbg.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/xhci-dbg.c 2014-07-02 11:20:15.821675026 +0100 @@ -21,6 +21,9 @@ */ @@ -3797,9 +3821,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org> #define XHCI_INIT_VALUE 0x0 ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -65,6 +65,9 @@ static struct xhci_segment *xhci_segment +Index: linux-3.10.44/drivers/usb/host/xhci-mem.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/xhci-mem.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/xhci-mem.c 2014-07-02 11:20:15.821675026 +0100 +@@ -65,6 +65,9 @@ static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg) { @@ -3809,7 +3835,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; -@@ -1446,9 +1449,17 @@ int xhci_endpoint_init(struct xhci_hcd * +@@ -1446,9 +1449,17 @@ max_burst = (usb_endpoint_maxp(&ep->desc) & 0x1800) >> 11; } @@ -3827,8 +3853,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> break; default: BUG(); ---- /dev/null -+++ b/drivers/usb/host/xhci-mtk-power.c +Index: linux-3.10.44/drivers/usb/host/xhci-mtk-power.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/xhci-mtk-power.c 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,115 @@ +#include "xhci-mtk.h" +#include "xhci-mtk-power.h" @@ -3945,8 +3973,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + } +} + ---- /dev/null -+++ b/drivers/usb/host/xhci-mtk-power.h +Index: linux-3.10.44/drivers/usb/host/xhci-mtk-power.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/xhci-mtk-power.h 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,13 @@ +#ifndef _XHCI_MTK_POWER_H +#define _XHCI_MTK_POWER_H @@ -3961,8 +3991,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> +void enablePortClockPower(int port_index, int port_rev); + +#endif ---- /dev/null -+++ b/drivers/usb/host/xhci-mtk-scheduler.c +Index: linux-3.10.44/drivers/usb/host/xhci-mtk-scheduler.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/xhci-mtk-scheduler.c 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,608 @@ +#include "xhci-mtk-scheduler.h" +#include <linux/kernel.h> /* printk() */ @@ -4572,8 +4604,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + return SCH_FAIL; + } +} ---- /dev/null -+++ b/drivers/usb/host/xhci-mtk-scheduler.h +Index: linux-3.10.44/drivers/usb/host/xhci-mtk-scheduler.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/xhci-mtk-scheduler.h 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,77 @@ +#ifndef _XHCI_MTK_SCHEDULER_H +#define _XHCI_MTK_SCHEDULER_H @@ -4652,8 +4686,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + + +#endif ---- /dev/null -+++ b/drivers/usb/host/xhci-mtk.c +Index: linux-3.10.44/drivers/usb/host/xhci-mtk.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/xhci-mtk.c 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,265 @@ +#include "xhci-mtk.h" +#include "xhci-mtk-power.h" @@ -4920,8 +4956,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + + + ---- /dev/null -+++ b/drivers/usb/host/xhci-mtk.h +Index: linux-3.10.44/drivers/usb/host/xhci-mtk.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.44/drivers/usb/host/xhci-mtk.h 2014-07-02 11:20:15.821675026 +0100 @@ -0,0 +1,120 @@ +#ifndef _XHCI_MTK_H +#define _XHCI_MTK_H @@ -5043,9 +5081,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + + +#endif ---- a/drivers/usb/host/xhci-plat.c -+++ b/drivers/usb/host/xhci-plat.c -@@ -25,6 +25,13 @@ static void xhci_plat_quirks(struct devi +Index: linux-3.10.44/drivers/usb/host/xhci-plat.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/xhci-plat.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/xhci-plat.c 2014-07-02 11:20:15.821675026 +0100 +@@ -25,6 +25,13 @@ * dev struct in order to setup MSI */ xhci->quirks |= XHCI_PLAT; @@ -5059,7 +5099,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> } /* called during probe() after chip reset completes */ -@@ -96,20 +103,32 @@ static int xhci_plat_probe(struct platfo +@@ -96,20 +103,32 @@ driver = &xhci_plat_xhci_driver; @@ -5092,9 +5132,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, driver->description)) { ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -236,7 +236,6 @@ static void inc_enq(struct xhci_hcd *xhc +Index: linux-3.10.44/drivers/usb/host/xhci-ring.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/xhci-ring.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/xhci-ring.c 2014-07-02 11:20:15.821675026 +0100 +@@ -236,7 +236,6 @@ */ if (!chain && !more_trbs_coming) break; @@ -5102,7 +5144,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, * carry over the chain bit of the previous TRB -@@ -273,16 +272,20 @@ static void inc_enq(struct xhci_hcd *xhc +@@ -273,16 +272,20 @@ static inline int room_on_ring(struct xhci_hcd *xhci, struct xhci_ring *ring, unsigned int num_trbs) { @@ -5123,7 +5165,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return 1; } -@@ -2910,6 +2913,7 @@ static int prepare_ring(struct xhci_hcd +@@ -2910,6 +2913,7 @@ next = ring->enqueue; while (last_trb(xhci, ring, ring->enq_seg, next)) { @@ -5131,7 +5173,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. */ -@@ -2919,7 +2923,9 @@ static int prepare_ring(struct xhci_hcd +@@ -2919,7 +2923,9 @@ next->link.control &= cpu_to_le32(~TRB_CHAIN); else next->link.control |= cpu_to_le32(TRB_CHAIN); @@ -5142,7 +5184,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> wmb(); next->link.control ^= cpu_to_le32(TRB_CYCLE); -@@ -3049,6 +3055,9 @@ static void giveback_first_trb(struct xh +@@ -3049,6 +3055,9 @@ start_trb->field[3] |= cpu_to_le32(start_cycle); else start_trb->field[3] &= cpu_to_le32(~TRB_CYCLE); @@ -5152,7 +5194,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id); } -@@ -3108,6 +3117,29 @@ static u32 xhci_td_remainder(unsigned in +@@ -3108,6 +3117,29 @@ return (remainder >> 10) << 17; } @@ -5182,7 +5224,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). -@@ -3245,6 +3277,7 @@ static int queue_bulk_sg_tx(struct xhci_ +@@ -3245,6 +3277,7 @@ } /* Set the TRB length, TD size, and interrupter fields. */ @@ -5190,7 +5232,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (xhci->hci_version < 0x100) { remainder = xhci_td_remainder( urb->transfer_buffer_length - -@@ -3254,6 +3287,13 @@ static int queue_bulk_sg_tx(struct xhci_ +@@ -3254,6 +3287,13 @@ trb_buff_len, total_packet_count, urb, num_trbs - 1); } @@ -5204,7 +5246,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> length_field = TRB_LEN(trb_buff_len) | remainder | TRB_INTR_TARGET(0); -@@ -3316,6 +3356,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3316,6 +3356,9 @@ int running_total, trb_buff_len, ret; unsigned int total_packet_count; u64 addr; @@ -5214,7 +5256,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); -@@ -3341,6 +3384,25 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3341,6 +3384,25 @@ running_total += TRB_MAX_BUFF_SIZE; } /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ @@ -5240,7 +5282,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> ret = prepare_transfer(xhci, xhci->devs[slot_id], ep_index, urb->stream_id, -@@ -3400,6 +3462,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3400,6 +3462,7 @@ field |= TRB_ISP; /* Set the TRB length, TD size, and interrupter fields. */ @@ -5248,7 +5290,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (xhci->hci_version < 0x100) { remainder = xhci_td_remainder( urb->transfer_buffer_length - -@@ -3409,6 +3472,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3409,6 +3472,10 @@ trb_buff_len, total_packet_count, urb, num_trbs - 1); } @@ -5259,7 +5301,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> length_field = TRB_LEN(trb_buff_len) | remainder | TRB_INTR_TARGET(0); -@@ -3498,7 +3565,11 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -3498,7 +3565,11 @@ field |= 0x1; /* xHCI 1.0 6.4.1.2.1: Transfer Type field */ @@ -5271,7 +5313,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); -@@ -3522,7 +3593,12 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -3522,7 +3593,12 @@ field = TRB_TYPE(TRB_DATA); length_field = TRB_LEN(urb->transfer_buffer_length) | @@ -5284,7 +5326,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) -@@ -3533,7 +3609,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -3533,7 +3609,7 @@ length_field, field | ep_ring->cycle_state); } @@ -5293,7 +5335,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> /* Save the DMA address of the last TRB in the TD */ td->last_trb = ep_ring->enqueue; -@@ -3645,6 +3721,9 @@ static int xhci_queue_isoc_tx(struct xhc +@@ -3645,6 +3721,9 @@ u64 start_addr, addr; int i, j; bool more_trbs_coming; @@ -5303,7 +5345,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> ep_ring = xhci->devs[slot_id]->eps[ep_index].ring; -@@ -3658,6 +3737,21 @@ static int xhci_queue_isoc_tx(struct xhc +@@ -3658,6 +3737,21 @@ start_trb = &ep_ring->enqueue->generic; start_cycle = ep_ring->cycle_state; @@ -5325,7 +5367,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++) { -@@ -3729,9 +3823,13 @@ static int xhci_queue_isoc_tx(struct xhc +@@ -3729,9 +3823,13 @@ } else { td->last_trb = ep_ring->enqueue; field |= TRB_IOC; @@ -5339,7 +5381,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; -@@ -3746,6 +3844,7 @@ static int xhci_queue_isoc_tx(struct xhc +@@ -3746,6 +3844,7 @@ trb_buff_len = td_remain_len; /* Set the TRB length, TD size, & interrupter fields. */ @@ -5347,7 +5389,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (xhci->hci_version < 0x100) { remainder = xhci_td_remainder( td_len - running_total); -@@ -3755,6 +3854,10 @@ static int xhci_queue_isoc_tx(struct xhc +@@ -3755,6 +3854,10 @@ total_packet_count, urb, (trbs_per_td - j - 1)); } @@ -5358,8 +5400,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> length_field = TRB_LEN(trb_buff_len) | remainder | TRB_INTR_TARGET(0); ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c +Index: linux-3.10.44/drivers/usb/host/xhci.c +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/xhci.c 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/xhci.c 2014-07-02 11:20:15.825675026 +0100 @@ -30,6 +30,16 @@ #include "xhci.h" @@ -5377,7 +5421,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> #define DRIVER_AUTHOR "Sarah Sharp" #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" -@@ -38,6 +48,18 @@ static int link_quirk; +@@ -38,6 +48,18 @@ module_param(link_quirk, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(link_quirk, "Don't clear the chain bit on a link TRB"); @@ -5396,7 +5440,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 -@@ -189,7 +211,7 @@ int xhci_reset(struct xhci_hcd *xhci) +@@ -189,7 +211,7 @@ return ret; } @@ -5405,7 +5449,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> static int xhci_free_msi(struct xhci_hcd *xhci) { int i; -@@ -389,6 +411,7 @@ static int xhci_try_enable_msi(struct us +@@ -389,6 +411,7 @@ return ret; } hcd->irq = pdev->irq; @@ -5413,7 +5457,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return 0; } -@@ -430,6 +453,11 @@ static void compliance_mode_recovery(uns +@@ -430,6 +453,11 @@ xhci_dbg(xhci, "Attempting compliance mode recovery\n"); hcd = xhci->shared_hcd; @@ -5425,7 +5469,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (hcd->state == HC_STATE_SUSPENDED) usb_hcd_resume_root_hub(hcd); -@@ -478,6 +506,9 @@ bool xhci_compliance_mode_recovery_timer +@@ -478,6 +506,9 @@ { const char *dmi_product_name, *dmi_sys_vendor; @@ -5435,7 +5479,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) -@@ -521,6 +552,10 @@ int xhci_init(struct usb_hcd *hcd) +@@ -521,6 +552,10 @@ } else { xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n"); } @@ -5446,7 +5490,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> retval = xhci_mem_init(xhci, GFP_KERNEL); xhci_dbg(xhci, "Finished xhci_init\n"); -@@ -664,7 +699,11 @@ int xhci_run(struct usb_hcd *hcd) +@@ -664,7 +699,11 @@ xhci_dbg(xhci, "// Set the interrupt modulation register\n"); temp = xhci_readl(xhci, &xhci->ir_set->irq_control); temp &= ~ER_IRQ_INTERVAL_MASK; @@ -5458,7 +5502,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> xhci_writel(xhci, temp, &xhci->ir_set->irq_control); /* Set the HCD state before we enable the irqs */ -@@ -685,6 +724,9 @@ int xhci_run(struct usb_hcd *hcd) +@@ -685,6 +724,9 @@ xhci_queue_vendor_command(xhci, 0, 0, 0, TRB_TYPE(TRB_NEC_GET_FW)); @@ -5468,7 +5512,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> xhci_dbg(xhci, "Finished xhci_run for USB2 roothub\n"); return 0; } -@@ -1002,7 +1044,6 @@ int xhci_resume(struct xhci_hcd *xhci, b +@@ -1002,7 +1044,6 @@ /* If restore operation fails, re-initialize the HC during resume */ if ((temp & STS_SRE) || hibernated) { @@ -5476,7 +5520,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !(xhci_all_ports_seen_u0(xhci))) { del_timer_sync(&xhci->comp_mode_recovery_timer); -@@ -1586,6 +1627,13 @@ int xhci_drop_endpoint(struct usb_hcd *h +@@ -1586,6 +1627,13 @@ u32 drop_flag; u32 new_add_flags, new_drop_flags, new_slot_info; int ret; @@ -5490,7 +5534,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> ret = xhci_check_args(hcd, udev, ep, 1, true, __func__); if (ret <= 0) -@@ -1637,6 +1685,40 @@ int xhci_drop_endpoint(struct usb_hcd *h +@@ -1637,6 +1685,40 @@ xhci_endpoint_zero(xhci, xhci->devs[udev->slot_id], ep); @@ -5531,7 +5575,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, new slot info = %#x\n", (unsigned int) ep->desc.bEndpointAddress, udev->slot_id, -@@ -1672,6 +1754,18 @@ int xhci_add_endpoint(struct usb_hcd *hc +@@ -1672,6 +1754,18 @@ u32 new_add_flags, new_drop_flags, new_slot_info; struct xhci_virt_device *virt_dev; int ret = 0; @@ -5550,7 +5594,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> ret = xhci_check_args(hcd, udev, ep, 1, true, __func__); if (ret <= 0) { -@@ -1734,6 +1828,56 @@ int xhci_add_endpoint(struct usb_hcd *hc +@@ -1734,6 +1828,56 @@ return -ENOMEM; } @@ -5607,7 +5651,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); -@@ -2697,7 +2841,7 @@ int xhci_check_bandwidth(struct usb_hcd +@@ -2697,7 +2841,7 @@ if (ctrl_ctx->add_flags == cpu_to_le32(SLOT_FLAG) && ctrl_ctx->drop_flags == 0) return 0; @@ -5616,7 +5660,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> xhci_dbg(xhci, "New Input Control Context:\n"); slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx); xhci_dbg_ctx(xhci, virt_dev->in_ctx, -@@ -4233,10 +4377,14 @@ static u16 xhci_call_host_update_timeout +@@ -4233,10 +4377,14 @@ u16 *timeout) { if (state == USB3_LPM_U1) { @@ -5631,7 +5675,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return xhci_calculate_intel_u2_timeout(udev, desc); } -@@ -4662,7 +4810,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, +@@ -4662,7 +4810,9 @@ /* Accept arbitrarily long scatter-gather lists */ hcd->self.sg_tablesize = ~0; /* XHCI controllers don't stop the ep queue on short packets :| */ @@ -5641,7 +5685,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (usb_hcd_is_primary_hcd(hcd)) { xhci = kzalloc(sizeof(struct xhci_hcd), GFP_KERNEL); -@@ -4731,6 +4881,10 @@ int xhci_gen_setup(struct usb_hcd *hcd, +@@ -4731,6 +4881,10 @@ goto error; xhci_dbg(xhci, "Reset complete\n"); @@ -5652,7 +5696,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> temp = xhci_readl(xhci, &xhci->cap_regs->hcc_params); if (HCC_64BIT_ADDR(temp)) { xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n"); -@@ -4755,8 +4909,21 @@ MODULE_DESCRIPTION(DRIVER_DESC); +@@ -4755,8 +4909,21 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_LICENSE("GPL"); @@ -5674,7 +5718,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> int retval; retval = xhci_register_pci(); -@@ -4769,6 +4936,33 @@ static int __init xhci_hcd_init(void) +@@ -4769,6 +4936,33 @@ printk(KERN_DEBUG "Problem registering platform driver."); goto unreg_pci; } @@ -5708,7 +5752,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> /* * Check the compiler generated sizes of structures that must be laid * out in specific ways for hardware access. -@@ -4786,6 +4980,7 @@ static int __init xhci_hcd_init(void) +@@ -4786,6 +4980,7 @@ BUILD_BUG_ON(sizeof(struct xhci_intr_reg) != 8*32/8); /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); @@ -5716,8 +5760,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return 0; unreg_pci: xhci_unregister_pci(); ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h +Index: linux-3.10.44/drivers/usb/host/xhci.h +=================================================================== +--- linux-3.10.44.orig/drivers/usb/host/xhci.h 2014-06-16 21:43:06.000000000 +0100 ++++ linux-3.10.44/drivers/usb/host/xhci.h 2014-07-02 11:20:15.825675026 +0100 @@ -29,9 +29,24 @@ #include <linux/usb/hcd.h> @@ -5744,7 +5790,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> /* xHCI PCI Configuration Registers */ #define XHCI_SBRN_OFFSET (0x60) -@@ -1536,8 +1551,12 @@ struct xhci_hcd { +@@ -1536,8 +1551,12 @@ /* Compliance Mode Recovery Data */ struct timer_list comp_mode_recovery_timer; u32 port_status_u0; @@ -5757,7 +5803,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> }; /* convert between an HCD pointer and the corresponding EHCI_HCD */ -@@ -1703,7 +1722,7 @@ void xhci_urb_free_priv(struct xhci_hcd +@@ -1703,7 +1722,7 @@ void xhci_free_command(struct xhci_hcd *xhci, struct xhci_command *command); |