Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Freescale USB Controller |
| 4 | * |
| 5 | * Copyright 2013 Freescale Semiconductor, Inc. |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 6 | */ |
| 7 | |
Chris Packham | 434f058 | 2018-10-04 20:03:53 +1300 | [diff] [blame] | 8 | #include <hwconfig.h> |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 9 | #include <fsl_errata.h> |
| 10 | #include<fsl_usb.h> |
Simon Glass | 89e0a3a | 2017-05-17 08:23:10 -0600 | [diff] [blame] | 11 | #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \ |
| 12 | defined(CONFIG_ARM) |
Simon Glass | 243182c | 2017-05-17 08:23:06 -0600 | [diff] [blame] | 13 | #include <asm/arch/clock.h> |
| 14 | #endif |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 15 | |
| 16 | /* USB Erratum Checking code */ |
| 17 | #if defined(CONFIG_PPC) || defined(CONFIG_ARM) |
| 18 | bool has_dual_phy(void) |
| 19 | { |
| 20 | u32 svr = get_svr(); |
| 21 | u32 soc = SVR_SOC_VER(svr); |
| 22 | |
| 23 | switch (soc) { |
| 24 | #ifdef CONFIG_PPC |
| 25 | case SVR_T1023: |
| 26 | case SVR_T1024: |
| 27 | case SVR_T1013: |
| 28 | case SVR_T1014: |
| 29 | return IS_SVR_REV(svr, 1, 0); |
| 30 | case SVR_T1040: |
| 31 | case SVR_T1042: |
| 32 | case SVR_T1020: |
| 33 | case SVR_T1022: |
| 34 | case SVR_T2080: |
| 35 | case SVR_T2081: |
| 36 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); |
| 37 | case SVR_T4240: |
| 38 | case SVR_T4160: |
| 39 | case SVR_T4080: |
| 40 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 41 | #endif |
| 42 | } |
| 43 | |
| 44 | return false; |
| 45 | } |
| 46 | |
Chris Packham | 434f058 | 2018-10-04 20:03:53 +1300 | [diff] [blame] | 47 | bool has_erratum_a005275(void) |
| 48 | { |
| 49 | u32 svr = get_svr(); |
| 50 | u32 soc = SVR_SOC_VER(svr); |
| 51 | |
| 52 | if (hwconfig("no_erratum_a005275")) |
| 53 | return false; |
| 54 | |
| 55 | switch (soc) { |
| 56 | #ifdef CONFIG_PPC |
| 57 | case SVR_P3041: |
| 58 | case SVR_P2041: |
| 59 | case SVR_P2040: |
| 60 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); |
| 61 | case SVR_P5010: |
| 62 | case SVR_P5020: |
| 63 | case SVR_P5021: |
| 64 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 65 | case SVR_P5040: |
| 66 | case SVR_P1010: |
| 67 | return IS_SVR_REV(svr, 1, 0); |
| 68 | #endif |
| 69 | } |
| 70 | |
| 71 | return false; |
| 72 | } |
| 73 | |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 74 | bool has_erratum_a006261(void) |
| 75 | { |
| 76 | u32 svr = get_svr(); |
| 77 | u32 soc = SVR_SOC_VER(svr); |
| 78 | |
| 79 | switch (soc) { |
| 80 | #ifdef CONFIG_PPC |
| 81 | case SVR_P1010: |
| 82 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 83 | case SVR_P2041: |
| 84 | case SVR_P2040: |
| 85 | return IS_SVR_REV(svr, 1, 0) || |
Sriram Dash | 5467da2 | 2016-08-17 11:47:54 +0530 | [diff] [blame] | 86 | IS_SVR_REV(svr, 1, 1) || |
| 87 | IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1); |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 88 | case SVR_P3041: |
| 89 | return IS_SVR_REV(svr, 1, 0) || |
| 90 | IS_SVR_REV(svr, 1, 1) || |
| 91 | IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1); |
| 92 | case SVR_P5010: |
| 93 | case SVR_P5020: |
| 94 | case SVR_P5021: |
| 95 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 96 | case SVR_T4240: |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 97 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 98 | case SVR_P5040: |
Sriram Dash | 5467da2 | 2016-08-17 11:47:54 +0530 | [diff] [blame] | 99 | return IS_SVR_REV(svr, 1, 0) || |
| 100 | IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1); |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 101 | #endif |
| 102 | } |
| 103 | |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | bool has_erratum_a007075(void) |
| 108 | { |
| 109 | u32 svr = get_svr(); |
| 110 | u32 soc = SVR_SOC_VER(svr); |
| 111 | |
| 112 | switch (soc) { |
| 113 | #ifdef CONFIG_PPC |
| 114 | case SVR_B4860: |
| 115 | case SVR_B4420: |
| 116 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 117 | case SVR_P1010: |
| 118 | return IS_SVR_REV(svr, 1, 0); |
| 119 | case SVR_P4080: |
| 120 | return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0); |
| 121 | #endif |
| 122 | } |
| 123 | return false; |
| 124 | } |
| 125 | |
| 126 | bool has_erratum_a007798(void) |
| 127 | { |
| 128 | #ifdef CONFIG_PPC |
| 129 | return SVR_SOC_VER(get_svr()) == SVR_T4240 && |
| 130 | IS_SVR_REV(get_svr(), 2, 0); |
| 131 | #endif |
| 132 | return false; |
| 133 | } |
| 134 | |
| 135 | bool has_erratum_a007792(void) |
| 136 | { |
| 137 | u32 svr = get_svr(); |
| 138 | u32 soc = SVR_SOC_VER(svr); |
| 139 | |
| 140 | switch (soc) { |
| 141 | #ifdef CONFIG_PPC |
| 142 | case SVR_T4240: |
| 143 | case SVR_T4160: |
| 144 | case SVR_T4080: |
| 145 | return IS_SVR_REV(svr, 2, 0); |
| 146 | case SVR_T1024: |
| 147 | case SVR_T1023: |
| 148 | return IS_SVR_REV(svr, 1, 0); |
| 149 | case SVR_T1040: |
| 150 | case SVR_T1042: |
| 151 | case SVR_T1020: |
| 152 | case SVR_T1022: |
| 153 | case SVR_T2080: |
| 154 | case SVR_T2081: |
| 155 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); |
| 156 | #endif |
| 157 | } |
| 158 | return false; |
| 159 | } |
| 160 | |
| 161 | bool has_erratum_a005697(void) |
| 162 | { |
| 163 | u32 svr = get_svr(); |
| 164 | u32 soc = SVR_SOC_VER(svr); |
| 165 | |
| 166 | switch (soc) { |
| 167 | #ifdef CONFIG_PPC |
| 168 | case SVR_9131: |
| 169 | case SVR_9132: |
| 170 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); |
| 171 | #endif |
jerry.huang@nxp.com | f3dece7 | 2016-12-01 11:44:25 +0800 | [diff] [blame] | 172 | #ifdef ONFIG_ARM64 |
| 173 | case SVR_LS1012A: |
| 174 | return IS_SVR_REV(svr, 1, 0); |
| 175 | #endif |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 176 | } |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | bool has_erratum_a004477(void) |
| 181 | { |
| 182 | u32 svr = get_svr(); |
| 183 | u32 soc = SVR_SOC_VER(svr); |
| 184 | |
| 185 | switch (soc) { |
| 186 | #ifdef CONFIG_PPC |
| 187 | case SVR_P1010: |
| 188 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 189 | case SVR_P1022: |
| 190 | case SVR_9131: |
| 191 | case SVR_9132: |
| 192 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); |
| 193 | case SVR_P2020: |
| 194 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) || |
| 195 | IS_SVR_REV(svr, 2, 1); |
| 196 | case SVR_B4860: |
| 197 | case SVR_B4420: |
| 198 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); |
| 199 | case SVR_P4080: |
| 200 | return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0); |
| 201 | #endif |
| 202 | } |
| 203 | |
| 204 | return false; |
| 205 | } |
| 206 | |
Sriram Dash | 0182095 | 2016-06-13 09:58:36 +0530 | [diff] [blame] | 207 | bool has_erratum_a008751(void) |
| 208 | { |
| 209 | u32 svr = get_svr(); |
| 210 | u32 soc = SVR_SOC_VER(svr); |
| 211 | |
| 212 | switch (soc) { |
| 213 | #ifdef CONFIG_ARM64 |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 214 | case SVR_LS2080A: |
| 215 | case SVR_LS2085A: |
Sriram Dash | 0182095 | 2016-06-13 09:58:36 +0530 | [diff] [blame] | 216 | return IS_SVR_REV(svr, 1, 0); |
| 217 | #endif |
| 218 | } |
| 219 | return false; |
| 220 | } |
| 221 | |
Sriram Dash | a1f422e | 2016-09-23 12:57:52 +0530 | [diff] [blame] | 222 | bool has_erratum_a010151(void) |
| 223 | { |
| 224 | u32 svr = get_svr(); |
| 225 | u32 soc = SVR_SOC_VER(svr); |
| 226 | |
Wenbin song | 5d8a61c | 2017-12-04 12:18:28 +0800 | [diff] [blame] | 227 | #ifdef CONFIG_ARM64 |
| 228 | if (IS_SVR_DEV(svr, SVR_DEV(SVR_LS1043A))) |
| 229 | return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); |
| 230 | #endif |
| 231 | |
Sriram Dash | a1f422e | 2016-09-23 12:57:52 +0530 | [diff] [blame] | 232 | switch (soc) { |
| 233 | #ifdef CONFIG_ARM64 |
| 234 | case SVR_LS2080A: |
| 235 | case SVR_LS2085A: |
Santan Kumar | 53c6226 | 2017-06-09 11:48:07 +0530 | [diff] [blame] | 236 | /* fallthrough */ |
| 237 | case SVR_LS2088A: |
| 238 | /* fallthrough */ |
| 239 | case SVR_LS2081A: |
Sriram Dash | a1f422e | 2016-09-23 12:57:52 +0530 | [diff] [blame] | 240 | case SVR_LS1046A: |
| 241 | case SVR_LS1012A: |
| 242 | return IS_SVR_REV(svr, 1, 0); |
Sriram Dash | a1f422e | 2016-09-23 12:57:52 +0530 | [diff] [blame] | 243 | #endif |
York Sun | c4f047c | 2017-03-27 11:41:03 -0700 | [diff] [blame] | 244 | #ifdef CONFIG_ARCH_LS1021A |
Sriram Dash | a1f422e | 2016-09-23 12:57:52 +0530 | [diff] [blame] | 245 | case SOC_VER_LS1020: |
| 246 | case SOC_VER_LS1021: |
| 247 | case SOC_VER_LS1022: |
| 248 | case SOC_VER_SLS1020: |
| 249 | return IS_SVR_REV(svr, 2, 0); |
| 250 | #endif |
| 251 | } |
| 252 | return false; |
| 253 | } |
| 254 | |
Sriram Dash | 9e8da5c | 2016-06-13 09:58:34 +0530 | [diff] [blame] | 255 | #endif |