Commit ef53b8c4ce2919d6685d2dc0c51a91a180433ff0
Committed by
Marek Vasut
1 parent
32fbd46f38
Exists in
v2017.01-smarct4x
and in
25 other branches
usb: xhci: fsl: Add workaround for USB erratum A008751
This patch is doing the following: 1. Implementing the errata for LS2080. 2. Adding fixup for fdt for LS2080. Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Showing 7 changed files with 52 additions and 0 deletions Side-by-side Diff
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
... | ... | @@ -139,6 +139,7 @@ |
139 | 139 | /* Supplemental Configuration */ |
140 | 140 | #define SCFG_BASE 0x01fc0000 |
141 | 141 | #define SCFG_USB3PRM1CR 0x000 |
142 | +#define SCFG_USB3PRM1CR_INIT 0x27672b2a | |
142 | 143 | |
143 | 144 | #define TP_ITYP_AV 0x00000001 /* Initiator available */ |
144 | 145 | #define TP_ITYP_TYPE(x) (((x) & 0x6) >> 1) /* Initiator Type */ |
board/freescale/ls2080aqds/ls2080aqds.c
board/freescale/ls2080ardb/ls2080ardb.c
drivers/usb/common/fsl-dt-fixup.c
... | ... | @@ -139,6 +139,7 @@ |
139 | 139 | int usb_erratum_a007075_off = -1; |
140 | 140 | int usb_erratum_a007792_off = -1; |
141 | 141 | int usb_erratum_a005697_off = -1; |
142 | + int usb_erratum_a008751_off = -1; | |
142 | 143 | int usb_mode_off = -1; |
143 | 144 | int usb_phy_off = -1; |
144 | 145 | char str[5]; |
... | ... | @@ -217,6 +218,12 @@ |
217 | 218 | has_erratum_a005697); |
218 | 219 | if (ret == -ENOSPC) |
219 | 220 | return; |
221 | + ret = fdt_fixup_erratum(&usb_erratum_a008751_off, blob, | |
222 | + SNPS_DWC3, "a008751", | |
223 | + has_erratum_a008751); | |
224 | + if (ret == -ENOSPC) | |
225 | + return; | |
226 | + | |
220 | 227 | } |
221 | 228 | } |
drivers/usb/common/fsl-errata.c
... | ... | @@ -175,5 +175,20 @@ |
175 | 175 | return false; |
176 | 176 | } |
177 | 177 | |
178 | +bool has_erratum_a008751(void) | |
179 | +{ | |
180 | + u32 svr = get_svr(); | |
181 | + u32 soc = SVR_SOC_VER(svr); | |
182 | + | |
183 | + switch (soc) { | |
184 | +#ifdef CONFIG_ARM64 | |
185 | + case SVR_LS2080: | |
186 | + case SVR_LS2085: | |
187 | + return IS_SVR_REV(svr, 1, 0); | |
188 | +#endif | |
189 | + } | |
190 | + return false; | |
191 | +} | |
192 | + | |
178 | 193 | #endif |
drivers/usb/host/xhci-fsl.c
... | ... | @@ -15,6 +15,8 @@ |
15 | 15 | #include <linux/usb/xhci-fsl.h> |
16 | 16 | #include <linux/usb/dwc3.h> |
17 | 17 | #include "xhci.h" |
18 | +#include <fsl_errata.h> | |
19 | +#include <fsl_usb.h> | |
18 | 20 | |
19 | 21 | /* Declare global data pointer */ |
20 | 22 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -27,6 +29,26 @@ |
27 | 29 | return 0; |
28 | 30 | } |
29 | 31 | |
32 | +static int erratum_a008751(void) | |
33 | +{ | |
34 | +#if defined(CONFIG_TARGET_LS2080AQDS) || defined(CONFIG_TARGET_LS2080ARDB) | |
35 | + u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE; | |
36 | + writel(SCFG_USB3PRM1CR_INIT, scfg + SCFG_USB3PRM1CR / 4); | |
37 | + return 0; | |
38 | +#endif | |
39 | + return 1; | |
40 | +} | |
41 | + | |
42 | +static void fsl_apply_xhci_errata(void) | |
43 | +{ | |
44 | + int ret; | |
45 | + if (has_erratum_a008751()) { | |
46 | + ret = erratum_a008751(); | |
47 | + if (ret != 0) | |
48 | + puts("Failed to apply erratum a008751\n"); | |
49 | + } | |
50 | +} | |
51 | + | |
30 | 52 | static int fsl_xhci_core_init(struct fsl_xhci *fsl_xhci) |
31 | 53 | { |
32 | 54 | int ret = 0; |
... | ... | @@ -68,6 +90,8 @@ |
68 | 90 | puts("Failed to initialize board for USB\n"); |
69 | 91 | return ret; |
70 | 92 | } |
93 | + | |
94 | + fsl_apply_xhci_errata(); | |
71 | 95 | |
72 | 96 | ret = fsl_xhci_core_init(ctx); |
73 | 97 | if (ret < 0) { |