developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 1 | From f6aea6b89ce99b4f490fe1e1062b88042096703e Mon Sep 17 00:00:00 2001 |
| 2 | From: Sam Shih <sam.shih@mediatek.com> |
| 3 | Date: Fri, 2 Jun 2023 13:06:26 +0800 |
| 4 | Subject: [PATCH] |
developer | 3de3aca | 2023-06-07 20:44:59 +0800 | [diff] [blame] | 5 | [high-speed-io][999-2621-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch] |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 6 | |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 7 | --- |
developer | 3c58fe1 | 2022-08-15 17:17:33 +0800 | [diff] [blame] | 8 | drivers/usb/host/Kconfig | 9 +++++++++ |
| 9 | drivers/usb/host/Makefile | 10 ++++++++++ |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 10 | drivers/usb/host/xhci-mtk.c | 6 ++++-- |
developer | 3c58fe1 | 2022-08-15 17:17:33 +0800 | [diff] [blame] | 11 | drivers/usb/host/xhci-mtk.h | 7 +++++++ |
| 12 | drivers/usb/host/xhci.c | 2 +- |
| 13 | drivers/usb/host/xhci.h | 1 + |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 14 | 6 files changed, 32 insertions(+), 3 deletions(-) |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 15 | |
| 16 | diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 17 | index 79b2e79dd..12b1bf9aa 100644 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 18 | --- a/drivers/usb/host/Kconfig |
| 19 | +++ b/drivers/usb/host/Kconfig |
| 20 | @@ -69,6 +69,15 @@ config USB_XHCI_MTK |
| 21 | found in MediaTek SoCs. |
| 22 | If unsure, say N. |
| 23 | |
| 24 | +config USB_XHCI_MTK_DEBUGFS |
| 25 | + tristate "xHCI DEBUGFS support for Mediatek MT65xx" |
| 26 | + depends on USB_XHCI_MTK && DEBUG_FS |
| 27 | + default y |
| 28 | + ---help--- |
| 29 | + Say 'Y' to enable the debugfs support for the xHCI host controller |
| 30 | + found in Mediatek MT65xx SoCs. |
| 31 | + If don't need, say N. |
| 32 | + |
| 33 | config USB_XHCI_MVEBU |
| 34 | tristate "xHCI support for Marvell Armada 375/38x/37xx" |
| 35 | select USB_XHCI_PLATFORM |
| 36 | diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 37 | index b19136125..f064f836d 100644 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 38 | --- a/drivers/usb/host/Makefile |
| 39 | +++ b/drivers/usb/host/Makefile |
developer | 3c58fe1 | 2022-08-15 17:17:33 +0800 | [diff] [blame] | 40 | @@ -21,6 +21,16 @@ endif |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 41 | |
| 42 | ifneq ($(CONFIG_USB_XHCI_MTK), ) |
| 43 | xhci-hcd-y += xhci-mtk-sch.o |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 44 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-test.o |
| 45 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-unusual.o |
| 46 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-intr-en.o |
| 47 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-vrt-vref.o |
| 48 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-term-vref.o |
| 49 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-hstx-srctrl.o |
| 50 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-discth.o |
| 51 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-chgdt-en.o |
developer | abd06d7 | 2022-03-03 16:13:41 +0800 | [diff] [blame] | 52 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-reg.o |
developer | 3c58fe1 | 2022-08-15 17:17:33 +0800 | [diff] [blame] | 53 | + xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-preemphasic.o |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 54 | endif |
| 55 | |
| 56 | xhci-plat-hcd-y := xhci-plat.o |
| 57 | diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 58 | index 77ddb8c05..7a2007931 100644 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 59 | --- a/drivers/usb/host/xhci-mtk.c |
| 60 | +++ b/drivers/usb/host/xhci-mtk.c |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 61 | @@ -18,10 +18,10 @@ |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 62 | #include <linux/pm_runtime.h> |
| 63 | #include <linux/regmap.h> |
| 64 | #include <linux/regulator/consumer.h> |
| 65 | - |
| 66 | +#include <linux/usb/of.h> |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 67 | #include "xhci.h" |
| 68 | #include "xhci-mtk.h" |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 69 | - |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 70 | +#include "xhci-mtk-test.h" |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 71 | /* COMPLIANCE_CP5_CP7_TXDEEMPH_10G register */ |
| 72 | #define COMPLIANCE_CP5_CP7_TXDEEMPH_10G 0x2428 |
| 73 | #define CP5_CP7_TXDEEMPH_10G GENMASK(17, 0) |
| 74 | @@ -586,6 +586,7 @@ static int xhci_mtk_probe(struct platform_device *pdev) |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 75 | ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); |
| 76 | if (ret) |
| 77 | goto dealloc_usb2_hcd; |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 78 | + hqa_create_attr(dev); |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 79 | |
| 80 | return 0; |
| 81 | |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 82 | @@ -620,6 +621,7 @@ static int xhci_mtk_remove(struct platform_device *dev) |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 83 | struct usb_hcd *hcd = mtk->hcd; |
| 84 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 85 | struct usb_hcd *shared_hcd = xhci->shared_hcd; |
| 86 | + hqa_remove_attr(&dev->dev); |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 87 | |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 88 | pm_runtime_put_noidle(&dev->dev); |
| 89 | pm_runtime_disable(&dev->dev); |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 90 | diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 91 | index 8a884e7b4..e815d7091 100644 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 92 | --- a/drivers/usb/host/xhci-mtk.h |
| 93 | +++ b/drivers/usb/host/xhci-mtk.h |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 94 | @@ -157,6 +157,13 @@ struct xhci_hcd_mtk { |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 95 | u32 uwk_reg_base; |
| 96 | u32 uwk_vers; |
developer | 8cdcb26 | 2022-10-27 14:36:15 +0800 | [diff] [blame] | 97 | bool p0_speed_fixup; |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 98 | + |
| 99 | +#ifdef CONFIG_USB_XHCI_MTK_DEBUGFS |
developer | ba28e03 | 2021-12-07 10:40:00 +0800 | [diff] [blame] | 100 | + int test_mode; |
| 101 | + size_t hqa_size; |
| 102 | + u32 hqa_pos; |
| 103 | + char *hqa_buf; |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 104 | +#endif |
| 105 | }; |
| 106 | |
| 107 | static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd) |
| 108 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 109 | index b8915790a..dd1b520af 100644 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 110 | --- a/drivers/usb/host/xhci.c |
| 111 | +++ b/drivers/usb/host/xhci.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 112 | @@ -714,7 +714,7 @@ EXPORT_SYMBOL_GPL(xhci_run); |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 113 | * Disable device contexts, disable IRQs, and quiesce the HC. |
| 114 | * Reset the HC, finish any completed transactions, and cleanup memory. |
| 115 | */ |
| 116 | -static void xhci_stop(struct usb_hcd *hcd) |
| 117 | +void xhci_stop(struct usb_hcd *hcd) |
| 118 | { |
| 119 | u32 temp; |
| 120 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| 121 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 122 | index e696f1508..07f904167 100644 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 123 | --- a/drivers/usb/host/xhci.h |
| 124 | +++ b/drivers/usb/host/xhci.h |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 125 | @@ -2073,6 +2073,7 @@ int xhci_halt(struct xhci_hcd *xhci); |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 126 | int xhci_start(struct xhci_hcd *xhci); |
developer | 3c58fe1 | 2022-08-15 17:17:33 +0800 | [diff] [blame] | 127 | int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us); |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 128 | int xhci_run(struct usb_hcd *hcd); |
| 129 | +void xhci_stop(struct usb_hcd *hcd); |
| 130 | int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); |
| 131 | void xhci_shutdown(struct usb_hcd *hcd); |
| 132 | void xhci_init_driver(struct hc_driver *drv, |
| 133 | -- |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 134 | 2.34.1 |
developer | 9cd822e | 2021-06-24 09:16:06 +0800 | [diff] [blame] | 135 | |