Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 1 | /* |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 2 | * Copyright 2014-2015 Freescale Semiconductor |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <fsl_ifc.h> |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 9 | #include <ahci.h> |
| 10 | #include <scsi.h> |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 11 | #include <asm/arch/fsl_serdes.h> |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 12 | #include <asm/arch/soc.h> |
Scott Wood | ae1df32 | 2015-03-20 19:28:13 -0700 | [diff] [blame] | 13 | #include <asm/io.h> |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 14 | #include <asm/global_data.h> |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 15 | #include <asm/arch-fsl-layerscape/config.h> |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 16 | #ifdef CONFIG_LAYERSCAPE_NS_ACCESS |
Hou Zhiqiang | 5ac9a5c | 2016-08-02 19:03:23 +0800 | [diff] [blame] | 17 | #include <fsl_csu.h> |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 18 | #endif |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 19 | #ifdef CONFIG_SYS_FSL_DDR |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 20 | #include <fsl_ddr_sdram.h> |
| 21 | #include <fsl_ddr.h> |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 22 | #endif |
Aneesh Bansal | 39d5b3b | 2016-01-22 16:37:26 +0530 | [diff] [blame] | 23 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 24 | #include <fsl_validate.h> |
| 25 | #endif |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 26 | |
| 27 | DECLARE_GLOBAL_DATA_PTR; |
Scott Wood | ae1df32 | 2015-03-20 19:28:13 -0700 | [diff] [blame] | 28 | |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 29 | bool soc_has_dp_ddr(void) |
| 30 | { |
| 31 | struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 32 | u32 svr = gur_in32(&gur->svr); |
| 33 | |
| 34 | /* LS2085A has DP_DDR */ |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 35 | if (SVR_SOC_VER(svr) == SVR_LS2085A) |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 36 | return true; |
| 37 | |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | bool soc_has_aiop(void) |
| 42 | { |
| 43 | struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 44 | u32 svr = gur_in32(&gur->svr); |
| 45 | |
| 46 | /* LS2085A has AIOP */ |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 47 | if (SVR_SOC_VER(svr) == SVR_LS2085A) |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 48 | return true; |
| 49 | |
| 50 | return false; |
| 51 | } |
| 52 | |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 53 | #if defined(CONFIG_FSL_LSCH3) |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 54 | /* |
| 55 | * This erratum requires setting a value to eddrtqcr1 to |
| 56 | * optimal the DDR performance. |
| 57 | */ |
| 58 | static void erratum_a008336(void) |
| 59 | { |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 60 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008336 |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 61 | u32 *eddrtqcr1; |
| 62 | |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 63 | #ifdef CONFIG_SYS_FSL_DCSR_DDR_ADDR |
| 64 | eddrtqcr1 = (void *)CONFIG_SYS_FSL_DCSR_DDR_ADDR + 0x800; |
Shengzhou Liu | 7beb0c4 | 2016-08-26 18:30:38 +0800 | [diff] [blame] | 65 | if (fsl_ddr_get_version(0) == 0x50200) |
| 66 | out_le32(eddrtqcr1, 0x63b30002); |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 67 | #endif |
| 68 | #ifdef CONFIG_SYS_FSL_DCSR_DDR2_ADDR |
| 69 | eddrtqcr1 = (void *)CONFIG_SYS_FSL_DCSR_DDR2_ADDR + 0x800; |
Shengzhou Liu | 7beb0c4 | 2016-08-26 18:30:38 +0800 | [diff] [blame] | 70 | if (fsl_ddr_get_version(0) == 0x50200) |
| 71 | out_le32(eddrtqcr1, 0x63b30002); |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 72 | #endif |
| 73 | #endif |
| 74 | } |
| 75 | |
| 76 | /* |
| 77 | * This erratum requires a register write before being Memory |
| 78 | * controller 3 being enabled. |
| 79 | */ |
| 80 | static void erratum_a008514(void) |
| 81 | { |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 82 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008514 |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 83 | u32 *eddrtqcr1; |
| 84 | |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 85 | #ifdef CONFIG_SYS_FSL_DCSR_DDR3_ADDR |
| 86 | eddrtqcr1 = (void *)CONFIG_SYS_FSL_DCSR_DDR3_ADDR + 0x800; |
| 87 | out_le32(eddrtqcr1, 0x63b20002); |
| 88 | #endif |
| 89 | #endif |
| 90 | } |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 91 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009635 |
| 92 | #define PLATFORM_CYCLE_ENV_VAR "a009635_interval_val" |
| 93 | |
| 94 | static unsigned long get_internval_val_mhz(void) |
| 95 | { |
| 96 | char *interval = getenv(PLATFORM_CYCLE_ENV_VAR); |
| 97 | /* |
| 98 | * interval is the number of platform cycles(MHz) between |
| 99 | * wake up events generated by EPU. |
| 100 | */ |
| 101 | ulong interval_mhz = get_bus_freq(0) / (1000 * 1000); |
| 102 | |
| 103 | if (interval) |
| 104 | interval_mhz = simple_strtoul(interval, NULL, 10); |
| 105 | |
| 106 | return interval_mhz; |
| 107 | } |
| 108 | |
| 109 | void erratum_a009635(void) |
| 110 | { |
| 111 | u32 val; |
| 112 | unsigned long interval_mhz = get_internval_val_mhz(); |
| 113 | |
| 114 | if (!interval_mhz) |
| 115 | return; |
| 116 | |
| 117 | val = in_le32(DCSR_CGACRE5); |
| 118 | writel(val | 0x00000200, DCSR_CGACRE5); |
| 119 | |
| 120 | val = in_le32(EPU_EPCMPR5); |
| 121 | writel(interval_mhz, EPU_EPCMPR5); |
| 122 | val = in_le32(EPU_EPCCR5); |
| 123 | writel(val | 0x82820000, EPU_EPCCR5); |
| 124 | val = in_le32(EPU_EPSMCR5); |
| 125 | writel(val | 0x002f0000, EPU_EPSMCR5); |
| 126 | val = in_le32(EPU_EPECR5); |
| 127 | writel(val | 0x20000000, EPU_EPECR5); |
| 128 | val = in_le32(EPU_EPGCR); |
| 129 | writel(val | 0x80000000, EPU_EPGCR); |
| 130 | } |
| 131 | #endif /* CONFIG_SYS_FSL_ERRATUM_A009635 */ |
| 132 | |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 133 | static void erratum_rcw_src(void) |
| 134 | { |
| 135 | #if defined(CONFIG_SPL) |
| 136 | u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE; |
| 137 | u32 __iomem *dcfg_dcsr = (u32 __iomem *)DCFG_DCSR_BASE; |
| 138 | u32 val; |
| 139 | |
| 140 | val = in_le32(dcfg_ccsr + DCFG_PORSR1 / 4); |
| 141 | val &= ~DCFG_PORSR1_RCW_SRC; |
| 142 | val |= DCFG_PORSR1_RCW_SRC_NOR; |
| 143 | out_le32(dcfg_dcsr + DCFG_DCSR_PORCR1 / 4, val); |
| 144 | #endif |
| 145 | } |
| 146 | |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 147 | #define I2C_DEBUG_REG 0x6 |
| 148 | #define I2C_GLITCH_EN 0x8 |
| 149 | /* |
| 150 | * This erratum requires setting glitch_en bit to enable |
| 151 | * digital glitch filter to improve clock stability. |
| 152 | */ |
| 153 | static void erratum_a009203(void) |
| 154 | { |
| 155 | u8 __iomem *ptr; |
| 156 | #ifdef CONFIG_SYS_I2C |
| 157 | #ifdef I2C1_BASE_ADDR |
| 158 | ptr = (u8 __iomem *)(I2C1_BASE_ADDR + I2C_DEBUG_REG); |
| 159 | |
| 160 | writeb(I2C_GLITCH_EN, ptr); |
| 161 | #endif |
| 162 | #ifdef I2C2_BASE_ADDR |
| 163 | ptr = (u8 __iomem *)(I2C2_BASE_ADDR + I2C_DEBUG_REG); |
| 164 | |
| 165 | writeb(I2C_GLITCH_EN, ptr); |
| 166 | #endif |
| 167 | #ifdef I2C3_BASE_ADDR |
| 168 | ptr = (u8 __iomem *)(I2C3_BASE_ADDR + I2C_DEBUG_REG); |
| 169 | |
| 170 | writeb(I2C_GLITCH_EN, ptr); |
| 171 | #endif |
| 172 | #ifdef I2C4_BASE_ADDR |
| 173 | ptr = (u8 __iomem *)(I2C4_BASE_ADDR + I2C_DEBUG_REG); |
| 174 | |
| 175 | writeb(I2C_GLITCH_EN, ptr); |
| 176 | #endif |
| 177 | #endif |
| 178 | } |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 179 | |
Saksham Jain | 5d8ffe1 | 2016-03-23 16:24:40 +0530 | [diff] [blame] | 180 | void bypass_smmu(void) |
| 181 | { |
| 182 | u32 val; |
| 183 | val = (in_le32(SMMU_SCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK); |
| 184 | out_le32(SMMU_SCR0, val); |
| 185 | val = (in_le32(SMMU_NSCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK); |
| 186 | out_le32(SMMU_NSCR0, val); |
| 187 | } |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 188 | void fsl_lsch3_early_init_f(void) |
| 189 | { |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 190 | erratum_rcw_src(); |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 191 | init_early_memctl_regs(); /* tighten IFC timing */ |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 192 | erratum_a009203(); |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 193 | erratum_a008514(); |
| 194 | erratum_a008336(); |
Saksham Jain | 5d8ffe1 | 2016-03-23 16:24:40 +0530 | [diff] [blame] | 195 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 196 | /* In case of Secure Boot, the IBR configures the SMMU |
| 197 | * to allow only Secure transactions. |
| 198 | * SMMU must be reset in bypass mode. |
| 199 | * Set the ClientPD bit and Clear the USFCFG Bit |
| 200 | */ |
| 201 | if (fsl_check_boot_mode_secure() == 1) |
| 202 | bypass_smmu(); |
| 203 | #endif |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 204 | } |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 205 | |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 206 | #ifdef CONFIG_SCSI_AHCI_PLAT |
| 207 | int sata_init(void) |
| 208 | { |
| 209 | struct ccsr_ahci __iomem *ccsr_ahci; |
| 210 | |
| 211 | ccsr_ahci = (void *)CONFIG_SYS_SATA2; |
| 212 | out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); |
| 213 | out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); |
| 214 | |
| 215 | ccsr_ahci = (void *)CONFIG_SYS_SATA1; |
| 216 | out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); |
| 217 | out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); |
| 218 | |
| 219 | ahci_init((void __iomem *)CONFIG_SYS_SATA1); |
| 220 | scsi_scan(0); |
| 221 | |
| 222 | return 0; |
| 223 | } |
| 224 | #endif |
| 225 | |
Prabhakar Kushwaha | 1966d01 | 2016-06-03 18:41:27 +0530 | [diff] [blame] | 226 | #elif defined(CONFIG_FSL_LSCH2) |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 227 | #ifdef CONFIG_SCSI_AHCI_PLAT |
| 228 | int sata_init(void) |
| 229 | { |
| 230 | struct ccsr_ahci __iomem *ccsr_ahci = (void *)CONFIG_SYS_SATA; |
| 231 | |
York Sun | bad4984 | 2016-09-26 08:09:24 -0700 | [diff] [blame] | 232 | #ifdef CONFIG_ARCH_LS1046A |
Shaohui Xie | ed81e2b | 2016-09-07 17:56:12 +0800 | [diff] [blame] | 233 | /* Disable SATA ECC */ |
| 234 | out_le32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + 0x520, 0x80000000); |
| 235 | #endif |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 236 | out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 237 | out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); |
Tang Yuantian | 2945ae0 | 2016-08-08 15:07:20 +0800 | [diff] [blame] | 238 | out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG); |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 239 | |
| 240 | ahci_init((void __iomem *)CONFIG_SYS_SATA); |
| 241 | scsi_scan(0); |
| 242 | |
| 243 | return 0; |
| 244 | } |
| 245 | #endif |
| 246 | |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 247 | static void erratum_a009929(void) |
| 248 | { |
| 249 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009929 |
| 250 | struct ccsr_gur *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR; |
| 251 | u32 __iomem *dcsr_cop_ccp = (void *)CONFIG_SYS_DCSR_COP_CCP_ADDR; |
| 252 | u32 rstrqmr1 = gur_in32(&gur->rstrqmr1); |
| 253 | |
| 254 | rstrqmr1 |= 0x00000400; |
| 255 | gur_out32(&gur->rstrqmr1, rstrqmr1); |
| 256 | writel(0x01000000, dcsr_cop_ccp); |
| 257 | #endif |
| 258 | } |
| 259 | |
Mingkai Hu | 172081c | 2016-02-02 11:28:03 +0800 | [diff] [blame] | 260 | /* |
| 261 | * This erratum requires setting a value to eddrtqcr1 to optimal |
| 262 | * the DDR performance. The eddrtqcr1 register is in SCFG space |
| 263 | * of LS1043A and the offset is 0x157_020c. |
| 264 | */ |
| 265 | #if defined(CONFIG_SYS_FSL_ERRATUM_A009660) \ |
| 266 | && defined(CONFIG_SYS_FSL_ERRATUM_A008514) |
| 267 | #error A009660 and A008514 can not be both enabled. |
| 268 | #endif |
| 269 | |
| 270 | static void erratum_a009660(void) |
| 271 | { |
| 272 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009660 |
| 273 | u32 *eddrtqcr1 = (void *)CONFIG_SYS_FSL_SCFG_ADDR + 0x20c; |
| 274 | out_be32(eddrtqcr1, 0x63b20042); |
| 275 | #endif |
| 276 | } |
| 277 | |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 278 | static void erratum_a008850_early(void) |
| 279 | { |
| 280 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008850 |
| 281 | /* part 1 of 2 */ |
| 282 | struct ccsr_cci400 __iomem *cci = (void *)CONFIG_SYS_CCI400_ADDR; |
| 283 | struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR; |
| 284 | |
| 285 | /* disables propagation of barrier transactions to DDRC from CCI400 */ |
| 286 | out_le32(&cci->ctrl_ord, CCI400_CTRLORD_TERM_BARRIER); |
| 287 | |
| 288 | /* disable the re-ordering in DDRC */ |
| 289 | ddr_out32(&ddr->eor, DDR_EOR_RD_REOD_DIS | DDR_EOR_WD_REOD_DIS); |
| 290 | #endif |
| 291 | } |
| 292 | |
| 293 | void erratum_a008850_post(void) |
| 294 | { |
| 295 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008850 |
| 296 | /* part 2 of 2 */ |
| 297 | struct ccsr_cci400 __iomem *cci = (void *)CONFIG_SYS_CCI400_ADDR; |
| 298 | struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR; |
| 299 | u32 tmp; |
| 300 | |
| 301 | /* enable propagation of barrier transactions to DDRC from CCI400 */ |
| 302 | out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER); |
| 303 | |
| 304 | /* enable the re-ordering in DDRC */ |
| 305 | tmp = ddr_in32(&ddr->eor); |
| 306 | tmp &= ~(DDR_EOR_RD_REOD_DIS | DDR_EOR_WD_REOD_DIS); |
| 307 | ddr_out32(&ddr->eor, tmp); |
| 308 | #endif |
| 309 | } |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 310 | |
| 311 | #ifdef CONFIG_SYS_FSL_ERRATUM_A010315 |
| 312 | void erratum_a010315(void) |
| 313 | { |
| 314 | int i; |
| 315 | |
| 316 | for (i = PCIE1; i <= PCIE4; i++) |
| 317 | if (!is_serdes_configured(i)) { |
| 318 | debug("PCIe%d: disabled all R/W permission!\n", i); |
| 319 | set_pcie_ns_access(i, 0); |
| 320 | } |
| 321 | } |
| 322 | #endif |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 323 | |
Hou Zhiqiang | c06b30a | 2016-09-29 12:42:44 +0800 | [diff] [blame] | 324 | static void erratum_a010539(void) |
| 325 | { |
| 326 | #if defined(CONFIG_SYS_FSL_ERRATUM_A010539) && defined(CONFIG_QSPI_BOOT) |
| 327 | struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 328 | u32 porsr1; |
| 329 | |
| 330 | porsr1 = in_be32(&gur->porsr1); |
| 331 | porsr1 &= ~FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK; |
| 332 | out_be32((void *)(CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_PORCR1), |
| 333 | porsr1); |
| 334 | #endif |
| 335 | } |
| 336 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 337 | void fsl_lsch2_early_init_f(void) |
| 338 | { |
| 339 | struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR; |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 340 | struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR; |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 341 | |
Hou Zhiqiang | 5ac9a5c | 2016-08-02 19:03:23 +0800 | [diff] [blame] | 342 | #ifdef CONFIG_LAYERSCAPE_NS_ACCESS |
| 343 | enable_layerscape_ns_access(); |
| 344 | #endif |
| 345 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 346 | #ifdef CONFIG_FSL_IFC |
| 347 | init_early_memctl_regs(); /* tighten IFC timing */ |
| 348 | #endif |
| 349 | |
Qianyu Gong | 5ab2d0a | 2016-03-16 18:01:52 +0800 | [diff] [blame] | 350 | #if defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT) |
Gong Qianyu | 760df89 | 2016-01-25 15:16:06 +0800 | [diff] [blame] | 351 | out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL); |
| 352 | #endif |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 353 | /* Make SEC reads and writes snoopable */ |
| 354 | setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP | |
Tang Yuantian | 2945ae0 | 2016-08-08 15:07:20 +0800 | [diff] [blame] | 355 | SCFG_SNPCNFGCR_SECWRSNP | |
| 356 | SCFG_SNPCNFGCR_SATARDSNP | |
| 357 | SCFG_SNPCNFGCR_SATAWRSNP); |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 358 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 359 | /* |
| 360 | * Enable snoop requests and DVM message requests for |
| 361 | * Slave insterface S4 (A53 core cluster) |
| 362 | */ |
| 363 | out_le32(&cci->slave[4].snoop_ctrl, |
| 364 | CCI400_DVM_MESSAGE_REQ_EN | CCI400_SNOOP_REQ_EN); |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 365 | |
| 366 | /* Erratum */ |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 367 | erratum_a008850_early(); /* part 1 of 2 */ |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 368 | erratum_a009929(); |
Mingkai Hu | 172081c | 2016-02-02 11:28:03 +0800 | [diff] [blame] | 369 | erratum_a009660(); |
Hou Zhiqiang | c06b30a | 2016-09-29 12:42:44 +0800 | [diff] [blame] | 370 | erratum_a010539(); |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 371 | } |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 372 | #endif |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 373 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 374 | #ifdef CONFIG_BOARD_LATE_INIT |
| 375 | int board_late_init(void) |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 376 | { |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 377 | #ifdef CONFIG_SCSI_AHCI_PLAT |
| 378 | sata_init(); |
| 379 | #endif |
Aneesh Bansal | 39d5b3b | 2016-01-22 16:37:26 +0530 | [diff] [blame] | 380 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 381 | fsl_setenv_chain_of_trust(); |
| 382 | #endif |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 383 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 384 | return 0; |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 385 | } |
| 386 | #endif |