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