Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 2 | /* |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 3 | * Copyright 2014-2015 Freescale Semiconductor |
Pankit Garg | d6bd678 | 2019-05-30 12:04:15 +0000 | [diff] [blame] | 4 | * Copyright 2019 NXP |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 85d6531 | 2019-12-28 10:44:58 -0700 | [diff] [blame] | 8 | #include <clock_legacy.h> |
Hou Zhiqiang | 031bb87 | 2020-04-28 10:19:32 +0800 | [diff] [blame] | 9 | #include <cpu_func.h> |
Simon Glass | 5e6201b | 2019-08-01 09:46:51 -0600 | [diff] [blame] | 10 | #include <env.h> |
Ashish Kumar | 1123406 | 2017-08-11 11:09:14 +0530 | [diff] [blame] | 11 | #include <fsl_immap.h> |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 12 | #include <fsl_ifc.h> |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 13 | #include <init.h> |
Hou Zhiqiang | 031bb87 | 2020-04-28 10:19:32 +0800 | [diff] [blame] | 14 | #include <linux/sizes.h> |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 15 | #include <asm/arch/fsl_serdes.h> |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 16 | #include <asm/arch/soc.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame^] | 17 | #include <asm/cache.h> |
Scott Wood | ae1df32 | 2015-03-20 19:28:13 -0700 | [diff] [blame] | 18 | #include <asm/io.h> |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 19 | #include <asm/global_data.h> |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 20 | #include <asm/arch-fsl-layerscape/config.h> |
Ran Wang | 4e7cdcf | 2018-08-10 15:00:00 +0800 | [diff] [blame] | 21 | #include <asm/arch-fsl-layerscape/ns_access.h> |
Laurentiu Tudor | 512d13e | 2018-08-09 15:19:46 +0300 | [diff] [blame] | 22 | #include <asm/arch-fsl-layerscape/fsl_icid.h> |
Hou Zhiqiang | 031bb87 | 2020-04-28 10:19:32 +0800 | [diff] [blame] | 23 | #include <asm/gic-v3.h> |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 24 | #ifdef CONFIG_LAYERSCAPE_NS_ACCESS |
Hou Zhiqiang | 5ac9a5c | 2016-08-02 19:03:23 +0800 | [diff] [blame] | 25 | #include <fsl_csu.h> |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 26 | #endif |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 27 | #ifdef CONFIG_SYS_FSL_DDR |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 28 | #include <fsl_ddr_sdram.h> |
| 29 | #include <fsl_ddr.h> |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 30 | #endif |
Aneesh Bansal | 39d5b3b | 2016-01-22 16:37:26 +0530 | [diff] [blame] | 31 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 32 | #include <fsl_validate.h> |
| 33 | #endif |
Ashish Kumar | b25faa2 | 2017-08-31 16:12:53 +0530 | [diff] [blame] | 34 | #include <fsl_immap.h> |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 35 | #ifdef CONFIG_TFABOOT |
Simon Glass | 9d1f619 | 2019-08-02 09:44:25 -0600 | [diff] [blame] | 36 | #include <env_internal.h> |
Hou Zhiqiang | 031bb87 | 2020-04-28 10:19:32 +0800 | [diff] [blame] | 37 | #endif |
| 38 | #if defined(CONFIG_TFABOOT) || defined(CONFIG_GIC_V3_ITS) |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 39 | DECLARE_GLOBAL_DATA_PTR; |
| 40 | #endif |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 41 | |
Hou Zhiqiang | 031bb87 | 2020-04-28 10:19:32 +0800 | [diff] [blame] | 42 | #ifdef CONFIG_GIC_V3_ITS |
| 43 | #define PENDTABLE_MAX_SZ ALIGN(BIT(ITS_MAX_LPI_NRBITS), SZ_64K) |
| 44 | #define PROPTABLE_MAX_SZ ALIGN(BIT(ITS_MAX_LPI_NRBITS) / 8, SZ_64K) |
| 45 | #define GIC_LPI_SIZE ALIGN(cpu_numcores() * PENDTABLE_MAX_SZ + \ |
| 46 | PROPTABLE_MAX_SZ, SZ_1M) |
| 47 | static int fdt_add_resv_mem_gic_rd_tables(void *blob, u64 base, size_t size) |
| 48 | { |
| 49 | u32 phandle; |
| 50 | int err; |
| 51 | struct fdt_memory gic_rd_tables; |
| 52 | |
| 53 | gic_rd_tables.start = base; |
| 54 | gic_rd_tables.end = base + size - 1; |
| 55 | err = fdtdec_add_reserved_memory(blob, "gic-rd-tables", &gic_rd_tables, |
| 56 | &phandle); |
| 57 | if (err < 0) |
| 58 | debug("%s: failed to add reserved memory: %d\n", __func__, err); |
| 59 | |
| 60 | return err; |
| 61 | } |
| 62 | |
| 63 | int ls_gic_rd_tables_init(void *blob) |
| 64 | { |
| 65 | u64 gic_lpi_base; |
| 66 | int ret; |
| 67 | |
| 68 | gic_lpi_base = ALIGN(gd->arch.resv_ram - GIC_LPI_SIZE, SZ_64K); |
| 69 | ret = fdt_add_resv_mem_gic_rd_tables(blob, gic_lpi_base, GIC_LPI_SIZE); |
| 70 | if (ret) |
| 71 | return ret; |
| 72 | |
| 73 | ret = gic_lpi_tables_init(gic_lpi_base, cpu_numcores()); |
| 74 | if (ret) |
| 75 | debug("%s: failed to init gic-lpi-tables\n", __func__); |
| 76 | |
| 77 | return ret; |
| 78 | } |
| 79 | #endif |
| 80 | |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 81 | bool soc_has_dp_ddr(void) |
| 82 | { |
| 83 | struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 84 | u32 svr = gur_in32(&gur->svr); |
| 85 | |
Priyanka Jain | 4a6f173 | 2016-11-17 12:29:55 +0530 | [diff] [blame] | 86 | /* LS2085A, LS2088A, LS2048A has DP_DDR */ |
| 87 | if ((SVR_SOC_VER(svr) == SVR_LS2085A) || |
| 88 | (SVR_SOC_VER(svr) == SVR_LS2088A) || |
| 89 | (SVR_SOC_VER(svr) == SVR_LS2048A)) |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 90 | return true; |
| 91 | |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | bool soc_has_aiop(void) |
| 96 | { |
| 97 | struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 98 | u32 svr = gur_in32(&gur->svr); |
| 99 | |
| 100 | /* LS2085A has AIOP */ |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 101 | if (SVR_SOC_VER(svr) == SVR_LS2085A) |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 102 | return true; |
| 103 | |
| 104 | return false; |
| 105 | } |
| 106 | |
Ran Wang | b358b7b | 2017-09-04 18:46:48 +0800 | [diff] [blame] | 107 | static inline void set_usb_txvreftune(u32 __iomem *scfg, u32 offset) |
| 108 | { |
| 109 | scfg_clrsetbits32(scfg + offset / 4, |
| 110 | 0xF << 6, |
| 111 | SCFG_USB_TXVREFTUNE << 6); |
| 112 | } |
| 113 | |
| 114 | static void erratum_a009008(void) |
| 115 | { |
| 116 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009008 |
| 117 | u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE; |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 118 | |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 119 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) || \ |
| 120 | defined(CONFIG_ARCH_LS1012A) |
Ran Wang | b358b7b | 2017-09-04 18:46:48 +0800 | [diff] [blame] | 121 | set_usb_txvreftune(scfg, SCFG_USB3PRM1CR_USB1); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 122 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) |
Ran Wang | b358b7b | 2017-09-04 18:46:48 +0800 | [diff] [blame] | 123 | set_usb_txvreftune(scfg, SCFG_USB3PRM1CR_USB2); |
| 124 | set_usb_txvreftune(scfg, SCFG_USB3PRM1CR_USB3); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 125 | #endif |
Ran Wang | b358b7b | 2017-09-04 18:46:48 +0800 | [diff] [blame] | 126 | #elif defined(CONFIG_ARCH_LS2080A) |
| 127 | set_usb_txvreftune(scfg, SCFG_USB3PRM1CR); |
| 128 | #endif |
| 129 | #endif /* CONFIG_SYS_FSL_ERRATUM_A009008 */ |
| 130 | } |
| 131 | |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 132 | static inline void set_usb_sqrxtune(u32 __iomem *scfg, u32 offset) |
| 133 | { |
| 134 | scfg_clrbits32(scfg + offset / 4, |
| 135 | SCFG_USB_SQRXTUNE_MASK << 23); |
| 136 | } |
| 137 | |
| 138 | static void erratum_a009798(void) |
| 139 | { |
| 140 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009798 |
| 141 | u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE; |
| 142 | |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 143 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) || \ |
| 144 | defined(CONFIG_ARCH_LS1012A) |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 145 | set_usb_sqrxtune(scfg, SCFG_USB3PRM1CR_USB1); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 146 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 147 | set_usb_sqrxtune(scfg, SCFG_USB3PRM1CR_USB2); |
| 148 | set_usb_sqrxtune(scfg, SCFG_USB3PRM1CR_USB3); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 149 | #endif |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 150 | #elif defined(CONFIG_ARCH_LS2080A) |
| 151 | set_usb_sqrxtune(scfg, SCFG_USB3PRM1CR); |
| 152 | #endif |
| 153 | #endif /* CONFIG_SYS_FSL_ERRATUM_A009798 */ |
| 154 | } |
| 155 | |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 156 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) || \ |
| 157 | defined(CONFIG_ARCH_LS1012A) |
Ran Wang | e64f747 | 2017-09-04 18:46:50 +0800 | [diff] [blame] | 158 | static inline void set_usb_pcstxswingfull(u32 __iomem *scfg, u32 offset) |
| 159 | { |
| 160 | scfg_clrsetbits32(scfg + offset / 4, |
| 161 | 0x7F << 9, |
| 162 | SCFG_USB_PCSTXSWINGFULL << 9); |
| 163 | } |
| 164 | #endif |
| 165 | |
| 166 | static void erratum_a008997(void) |
| 167 | { |
| 168 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008997 |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 169 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) || \ |
| 170 | defined(CONFIG_ARCH_LS1012A) |
Ran Wang | e64f747 | 2017-09-04 18:46:50 +0800 | [diff] [blame] | 171 | u32 __iomem *scfg = (u32 __iomem *)SCFG_BASE; |
| 172 | |
| 173 | set_usb_pcstxswingfull(scfg, SCFG_USB3PRM2CR_USB1); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 174 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) |
Ran Wang | e64f747 | 2017-09-04 18:46:50 +0800 | [diff] [blame] | 175 | set_usb_pcstxswingfull(scfg, SCFG_USB3PRM2CR_USB2); |
| 176 | set_usb_pcstxswingfull(scfg, SCFG_USB3PRM2CR_USB3); |
| 177 | #endif |
Ran Wang | e118acb | 2019-05-14 17:34:56 +0800 | [diff] [blame] | 178 | #elif defined(CONFIG_ARCH_LS1028A) |
| 179 | clrsetbits_le32(DCSR_BASE + DCSR_USB_IOCR1, |
| 180 | 0x7F << 11, |
| 181 | DCSR_USB_PCSTXSWINGFULL << 11); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 182 | #endif |
Ran Wang | e64f747 | 2017-09-04 18:46:50 +0800 | [diff] [blame] | 183 | #endif /* CONFIG_SYS_FSL_ERRATUM_A008997 */ |
| 184 | } |
| 185 | |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 186 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) || \ |
| 187 | defined(CONFIG_ARCH_LS1012A) |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 188 | |
| 189 | #define PROGRAM_USB_PHY_RX_OVRD_IN_HI(phy) \ |
| 190 | out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_1); \ |
| 191 | out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_2); \ |
| 192 | out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_3); \ |
| 193 | out_be16((phy) + SCFG_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_4) |
| 194 | |
Yinbo Zhu | 5c3767e | 2019-05-14 17:34:57 +0800 | [diff] [blame] | 195 | #elif defined(CONFIG_ARCH_LS2080A) || defined(CONFIG_ARCH_LS1088A) || \ |
Ran Wang | d0270dc | 2019-11-26 11:40:40 +0800 | [diff] [blame] | 196 | defined(CONFIG_ARCH_LS1028A) || defined(CONFIG_ARCH_LX2160A) |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 197 | |
| 198 | #define PROGRAM_USB_PHY_RX_OVRD_IN_HI(phy) \ |
| 199 | out_le16((phy) + DCSR_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_1); \ |
| 200 | out_le16((phy) + DCSR_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_2); \ |
| 201 | out_le16((phy) + DCSR_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_3); \ |
| 202 | out_le16((phy) + DCSR_USB_PHY_RX_OVRD_IN_HI, USB_PHY_RX_EQ_VAL_4) |
| 203 | |
| 204 | #endif |
| 205 | |
| 206 | static void erratum_a009007(void) |
| 207 | { |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 208 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) || \ |
| 209 | defined(CONFIG_ARCH_LS1012A) |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 210 | void __iomem *usb_phy = (void __iomem *)SCFG_USB_PHY1; |
| 211 | |
| 212 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(usb_phy); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 213 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 214 | usb_phy = (void __iomem *)SCFG_USB_PHY2; |
| 215 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(usb_phy); |
| 216 | |
| 217 | usb_phy = (void __iomem *)SCFG_USB_PHY3; |
| 218 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(usb_phy); |
Ran Wang | 02dc77b | 2017-11-13 16:14:48 +0800 | [diff] [blame] | 219 | #endif |
Yinbo Zhu | 5c3767e | 2019-05-14 17:34:57 +0800 | [diff] [blame] | 220 | #elif defined(CONFIG_ARCH_LS2080A) || defined(CONFIG_ARCH_LS1088A) || \ |
| 221 | defined(CONFIG_ARCH_LS1028A) |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 222 | void __iomem *dcsr = (void __iomem *)DCSR_BASE; |
| 223 | |
| 224 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(dcsr + DCSR_USB_PHY1); |
| 225 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(dcsr + DCSR_USB_PHY2); |
| 226 | #endif /* CONFIG_SYS_FSL_ERRATUM_A009007 */ |
| 227 | } |
| 228 | |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 229 | #if defined(CONFIG_FSL_LSCH3) |
Ran Wang | d0270dc | 2019-11-26 11:40:40 +0800 | [diff] [blame] | 230 | static void erratum_a050106(void) |
| 231 | { |
| 232 | #if defined(CONFIG_ARCH_LX2160A) |
| 233 | void __iomem *dcsr = (void __iomem *)DCSR_BASE; |
| 234 | |
| 235 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(dcsr + DCSR_USB_PHY1); |
| 236 | PROGRAM_USB_PHY_RX_OVRD_IN_HI(dcsr + DCSR_USB_PHY2); |
| 237 | #endif |
| 238 | } |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 239 | /* |
| 240 | * This erratum requires setting a value to eddrtqcr1 to |
| 241 | * optimal the DDR performance. |
| 242 | */ |
| 243 | static void erratum_a008336(void) |
| 244 | { |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 245 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008336 |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 246 | u32 *eddrtqcr1; |
| 247 | |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 248 | #ifdef CONFIG_SYS_FSL_DCSR_DDR_ADDR |
| 249 | eddrtqcr1 = (void *)CONFIG_SYS_FSL_DCSR_DDR_ADDR + 0x800; |
Shengzhou Liu | 7beb0c4 | 2016-08-26 18:30:38 +0800 | [diff] [blame] | 250 | if (fsl_ddr_get_version(0) == 0x50200) |
| 251 | out_le32(eddrtqcr1, 0x63b30002); |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 252 | #endif |
| 253 | #ifdef CONFIG_SYS_FSL_DCSR_DDR2_ADDR |
| 254 | eddrtqcr1 = (void *)CONFIG_SYS_FSL_DCSR_DDR2_ADDR + 0x800; |
Shengzhou Liu | 7beb0c4 | 2016-08-26 18:30:38 +0800 | [diff] [blame] | 255 | if (fsl_ddr_get_version(0) == 0x50200) |
| 256 | out_le32(eddrtqcr1, 0x63b30002); |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 257 | #endif |
| 258 | #endif |
| 259 | } |
| 260 | |
| 261 | /* |
| 262 | * This erratum requires a register write before being Memory |
| 263 | * controller 3 being enabled. |
| 264 | */ |
| 265 | static void erratum_a008514(void) |
| 266 | { |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 267 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008514 |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 268 | u32 *eddrtqcr1; |
| 269 | |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 270 | #ifdef CONFIG_SYS_FSL_DCSR_DDR3_ADDR |
| 271 | eddrtqcr1 = (void *)CONFIG_SYS_FSL_DCSR_DDR3_ADDR + 0x800; |
| 272 | out_le32(eddrtqcr1, 0x63b20002); |
| 273 | #endif |
| 274 | #endif |
| 275 | } |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 276 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009635 |
| 277 | #define PLATFORM_CYCLE_ENV_VAR "a009635_interval_val" |
| 278 | |
| 279 | static unsigned long get_internval_val_mhz(void) |
| 280 | { |
Simon Glass | 64b723f | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 281 | char *interval = env_get(PLATFORM_CYCLE_ENV_VAR); |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 282 | /* |
| 283 | * interval is the number of platform cycles(MHz) between |
| 284 | * wake up events generated by EPU. |
| 285 | */ |
| 286 | ulong interval_mhz = get_bus_freq(0) / (1000 * 1000); |
| 287 | |
| 288 | if (interval) |
| 289 | interval_mhz = simple_strtoul(interval, NULL, 10); |
| 290 | |
| 291 | return interval_mhz; |
| 292 | } |
| 293 | |
| 294 | void erratum_a009635(void) |
| 295 | { |
| 296 | u32 val; |
| 297 | unsigned long interval_mhz = get_internval_val_mhz(); |
| 298 | |
| 299 | if (!interval_mhz) |
| 300 | return; |
| 301 | |
| 302 | val = in_le32(DCSR_CGACRE5); |
| 303 | writel(val | 0x00000200, DCSR_CGACRE5); |
| 304 | |
| 305 | val = in_le32(EPU_EPCMPR5); |
| 306 | writel(interval_mhz, EPU_EPCMPR5); |
| 307 | val = in_le32(EPU_EPCCR5); |
| 308 | writel(val | 0x82820000, EPU_EPCCR5); |
| 309 | val = in_le32(EPU_EPSMCR5); |
| 310 | writel(val | 0x002f0000, EPU_EPSMCR5); |
| 311 | val = in_le32(EPU_EPECR5); |
| 312 | writel(val | 0x20000000, EPU_EPECR5); |
| 313 | val = in_le32(EPU_EPGCR); |
| 314 | writel(val | 0x80000000, EPU_EPGCR); |
| 315 | } |
| 316 | #endif /* CONFIG_SYS_FSL_ERRATUM_A009635 */ |
| 317 | |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 318 | static void erratum_rcw_src(void) |
| 319 | { |
Santan Kumar | 9913648 | 2017-05-05 15:42:28 +0530 | [diff] [blame] | 320 | #if defined(CONFIG_SPL) && defined(CONFIG_NAND_BOOT) |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 321 | u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE; |
| 322 | u32 __iomem *dcfg_dcsr = (u32 __iomem *)DCFG_DCSR_BASE; |
| 323 | u32 val; |
| 324 | |
| 325 | val = in_le32(dcfg_ccsr + DCFG_PORSR1 / 4); |
| 326 | val &= ~DCFG_PORSR1_RCW_SRC; |
| 327 | val |= DCFG_PORSR1_RCW_SRC_NOR; |
| 328 | out_le32(dcfg_dcsr + DCFG_DCSR_PORCR1 / 4, val); |
| 329 | #endif |
| 330 | } |
| 331 | |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 332 | #define I2C_DEBUG_REG 0x6 |
| 333 | #define I2C_GLITCH_EN 0x8 |
| 334 | /* |
| 335 | * This erratum requires setting glitch_en bit to enable |
| 336 | * digital glitch filter to improve clock stability. |
| 337 | */ |
Ashish kumar | 3b52a23 | 2017-02-23 16:03:57 +0530 | [diff] [blame] | 338 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009203 |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 339 | static void erratum_a009203(void) |
| 340 | { |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 341 | #ifdef CONFIG_SYS_I2C |
Sriram Dash | afa125b | 2017-09-04 15:45:02 +0530 | [diff] [blame] | 342 | u8 __iomem *ptr; |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 343 | #ifdef I2C1_BASE_ADDR |
| 344 | ptr = (u8 __iomem *)(I2C1_BASE_ADDR + I2C_DEBUG_REG); |
| 345 | |
| 346 | writeb(I2C_GLITCH_EN, ptr); |
| 347 | #endif |
| 348 | #ifdef I2C2_BASE_ADDR |
| 349 | ptr = (u8 __iomem *)(I2C2_BASE_ADDR + I2C_DEBUG_REG); |
| 350 | |
| 351 | writeb(I2C_GLITCH_EN, ptr); |
| 352 | #endif |
| 353 | #ifdef I2C3_BASE_ADDR |
| 354 | ptr = (u8 __iomem *)(I2C3_BASE_ADDR + I2C_DEBUG_REG); |
| 355 | |
| 356 | writeb(I2C_GLITCH_EN, ptr); |
| 357 | #endif |
| 358 | #ifdef I2C4_BASE_ADDR |
| 359 | ptr = (u8 __iomem *)(I2C4_BASE_ADDR + I2C_DEBUG_REG); |
| 360 | |
| 361 | writeb(I2C_GLITCH_EN, ptr); |
| 362 | #endif |
| 363 | #endif |
| 364 | } |
Ashish kumar | 3b52a23 | 2017-02-23 16:03:57 +0530 | [diff] [blame] | 365 | #endif |
Shengzhou Liu | a3117ee | 2016-11-11 18:11:05 +0800 | [diff] [blame] | 366 | |
Saksham Jain | 5d8ffe1 | 2016-03-23 16:24:40 +0530 | [diff] [blame] | 367 | void bypass_smmu(void) |
| 368 | { |
| 369 | u32 val; |
| 370 | val = (in_le32(SMMU_SCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK); |
| 371 | out_le32(SMMU_SCR0, val); |
| 372 | val = (in_le32(SMMU_NSCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK); |
| 373 | out_le32(SMMU_NSCR0, val); |
| 374 | } |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 375 | void fsl_lsch3_early_init_f(void) |
| 376 | { |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 377 | erratum_rcw_src(); |
Sriram Dash | 36a4a34 | 2017-09-04 15:44:05 +0530 | [diff] [blame] | 378 | #ifdef CONFIG_FSL_IFC |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 379 | init_early_memctl_regs(); /* tighten IFC timing */ |
Sriram Dash | 36a4a34 | 2017-09-04 15:44:05 +0530 | [diff] [blame] | 380 | #endif |
Ashish kumar | 3b52a23 | 2017-02-23 16:03:57 +0530 | [diff] [blame] | 381 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009203 |
York Sun | 0404a39 | 2015-03-23 10:41:35 -0700 | [diff] [blame] | 382 | erratum_a009203(); |
Ashish kumar | 3b52a23 | 2017-02-23 16:03:57 +0530 | [diff] [blame] | 383 | #endif |
Yao Yuan | fae8805 | 2015-12-05 14:59:14 +0800 | [diff] [blame] | 384 | erratum_a008514(); |
| 385 | erratum_a008336(); |
Ran Wang | b358b7b | 2017-09-04 18:46:48 +0800 | [diff] [blame] | 386 | erratum_a009008(); |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 387 | erratum_a009798(); |
Ran Wang | e64f747 | 2017-09-04 18:46:50 +0800 | [diff] [blame] | 388 | erratum_a008997(); |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 389 | erratum_a009007(); |
Ran Wang | d0270dc | 2019-11-26 11:40:40 +0800 | [diff] [blame] | 390 | erratum_a050106(); |
Saksham Jain | 5d8ffe1 | 2016-03-23 16:24:40 +0530 | [diff] [blame] | 391 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 392 | /* In case of Secure Boot, the IBR configures the SMMU |
| 393 | * to allow only Secure transactions. |
| 394 | * SMMU must be reset in bypass mode. |
| 395 | * Set the ClientPD bit and Clear the USFCFG Bit |
| 396 | */ |
| 397 | if (fsl_check_boot_mode_secure() == 1) |
| 398 | bypass_smmu(); |
| 399 | #endif |
Laurentiu Tudor | 7690ea7 | 2019-07-30 17:29:58 +0300 | [diff] [blame] | 400 | |
Laurentiu Tudor | 4adff39 | 2019-10-18 09:01:54 +0000 | [diff] [blame] | 401 | #if defined(CONFIG_ARCH_LS1088A) || defined(CONFIG_ARCH_LS1028A) || \ |
Laurentiu Tudor | 7085d07 | 2019-10-18 09:01:55 +0000 | [diff] [blame] | 402 | defined(CONFIG_ARCH_LS2080A) || defined(CONFIG_ARCH_LX2160A) |
Laurentiu Tudor | 7690ea7 | 2019-07-30 17:29:58 +0300 | [diff] [blame] | 403 | set_icids(); |
| 404 | #endif |
Scott Wood | f64c98c | 2015-03-20 19:28:12 -0700 | [diff] [blame] | 405 | } |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 406 | |
Rajesh Bhagat | 814e077 | 2018-01-17 16:13:00 +0530 | [diff] [blame] | 407 | /* Get VDD in the unit mV from voltage ID */ |
| 408 | int get_core_volt_from_fuse(void) |
| 409 | { |
| 410 | struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 411 | int vdd; |
| 412 | u32 fusesr; |
| 413 | u8 vid; |
| 414 | |
| 415 | /* get the voltage ID from fuse status register */ |
| 416 | fusesr = in_le32(&gur->dcfg_fusesr); |
| 417 | debug("%s: fusesr = 0x%x\n", __func__, fusesr); |
| 418 | vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT) & |
| 419 | FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK; |
| 420 | if ((vid == 0) || (vid == FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK)) { |
| 421 | vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT) & |
| 422 | FSL_CHASSIS3_DCFG_FUSESR_VID_MASK; |
| 423 | } |
| 424 | debug("%s: VID = 0x%x\n", __func__, vid); |
| 425 | switch (vid) { |
| 426 | case 0x00: /* VID isn't supported */ |
| 427 | vdd = -EINVAL; |
| 428 | debug("%s: The VID feature is not supported\n", __func__); |
| 429 | break; |
| 430 | case 0x08: /* 0.9V silicon */ |
| 431 | vdd = 900; |
| 432 | break; |
| 433 | case 0x10: /* 1.0V silicon */ |
| 434 | vdd = 1000; |
| 435 | break; |
| 436 | default: /* Other core voltage */ |
| 437 | vdd = -EINVAL; |
| 438 | debug("%s: The VID(%x) isn't supported\n", __func__, vid); |
| 439 | break; |
| 440 | } |
| 441 | debug("%s: The required minimum volt of CORE is %dmV\n", __func__, vdd); |
| 442 | |
| 443 | return vdd; |
| 444 | } |
| 445 | |
Prabhakar Kushwaha | 1966d01 | 2016-06-03 18:41:27 +0530 | [diff] [blame] | 446 | #elif defined(CONFIG_FSL_LSCH2) |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 447 | |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 448 | static void erratum_a009929(void) |
| 449 | { |
| 450 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009929 |
| 451 | struct ccsr_gur *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR; |
| 452 | u32 __iomem *dcsr_cop_ccp = (void *)CONFIG_SYS_DCSR_COP_CCP_ADDR; |
| 453 | u32 rstrqmr1 = gur_in32(&gur->rstrqmr1); |
| 454 | |
| 455 | rstrqmr1 |= 0x00000400; |
| 456 | gur_out32(&gur->rstrqmr1, rstrqmr1); |
| 457 | writel(0x01000000, dcsr_cop_ccp); |
| 458 | #endif |
| 459 | } |
| 460 | |
Mingkai Hu | 172081c | 2016-02-02 11:28:03 +0800 | [diff] [blame] | 461 | /* |
| 462 | * This erratum requires setting a value to eddrtqcr1 to optimal |
| 463 | * the DDR performance. The eddrtqcr1 register is in SCFG space |
| 464 | * of LS1043A and the offset is 0x157_020c. |
| 465 | */ |
| 466 | #if defined(CONFIG_SYS_FSL_ERRATUM_A009660) \ |
| 467 | && defined(CONFIG_SYS_FSL_ERRATUM_A008514) |
| 468 | #error A009660 and A008514 can not be both enabled. |
| 469 | #endif |
| 470 | |
| 471 | static void erratum_a009660(void) |
| 472 | { |
| 473 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009660 |
| 474 | u32 *eddrtqcr1 = (void *)CONFIG_SYS_FSL_SCFG_ADDR + 0x20c; |
| 475 | out_be32(eddrtqcr1, 0x63b20042); |
| 476 | #endif |
| 477 | } |
| 478 | |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 479 | static void erratum_a008850_early(void) |
| 480 | { |
| 481 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008850 |
| 482 | /* part 1 of 2 */ |
Ashish Kumar | 1123406 | 2017-08-11 11:09:14 +0530 | [diff] [blame] | 483 | struct ccsr_cci400 __iomem *cci = (void *)(CONFIG_SYS_IMMR + |
| 484 | CONFIG_SYS_CCI400_OFFSET); |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 485 | struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR; |
| 486 | |
York Sun | e6b871e | 2017-05-15 08:51:59 -0700 | [diff] [blame] | 487 | /* Skip if running at lower exception level */ |
| 488 | if (current_el() < 3) |
| 489 | return; |
| 490 | |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 491 | /* disables propagation of barrier transactions to DDRC from CCI400 */ |
| 492 | out_le32(&cci->ctrl_ord, CCI400_CTRLORD_TERM_BARRIER); |
| 493 | |
| 494 | /* disable the re-ordering in DDRC */ |
| 495 | ddr_out32(&ddr->eor, DDR_EOR_RD_REOD_DIS | DDR_EOR_WD_REOD_DIS); |
| 496 | #endif |
| 497 | } |
| 498 | |
| 499 | void erratum_a008850_post(void) |
| 500 | { |
| 501 | #ifdef CONFIG_SYS_FSL_ERRATUM_A008850 |
| 502 | /* part 2 of 2 */ |
Ashish Kumar | 1123406 | 2017-08-11 11:09:14 +0530 | [diff] [blame] | 503 | struct ccsr_cci400 __iomem *cci = (void *)(CONFIG_SYS_IMMR + |
| 504 | CONFIG_SYS_CCI400_OFFSET); |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 505 | struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR; |
| 506 | u32 tmp; |
| 507 | |
York Sun | e6b871e | 2017-05-15 08:51:59 -0700 | [diff] [blame] | 508 | /* Skip if running at lower exception level */ |
| 509 | if (current_el() < 3) |
| 510 | return; |
| 511 | |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 512 | /* enable propagation of barrier transactions to DDRC from CCI400 */ |
| 513 | out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER); |
| 514 | |
| 515 | /* enable the re-ordering in DDRC */ |
| 516 | tmp = ddr_in32(&ddr->eor); |
| 517 | tmp &= ~(DDR_EOR_RD_REOD_DIS | DDR_EOR_WD_REOD_DIS); |
| 518 | ddr_out32(&ddr->eor, tmp); |
| 519 | #endif |
| 520 | } |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 521 | |
| 522 | #ifdef CONFIG_SYS_FSL_ERRATUM_A010315 |
| 523 | void erratum_a010315(void) |
| 524 | { |
| 525 | int i; |
| 526 | |
| 527 | for (i = PCIE1; i <= PCIE4; i++) |
| 528 | if (!is_serdes_configured(i)) { |
| 529 | debug("PCIe%d: disabled all R/W permission!\n", i); |
| 530 | set_pcie_ns_access(i, 0); |
| 531 | } |
| 532 | } |
| 533 | #endif |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 534 | |
Hou Zhiqiang | c06b30a | 2016-09-29 12:42:44 +0800 | [diff] [blame] | 535 | static void erratum_a010539(void) |
| 536 | { |
| 537 | #if defined(CONFIG_SYS_FSL_ERRATUM_A010539) && defined(CONFIG_QSPI_BOOT) |
| 538 | struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 539 | u32 porsr1; |
| 540 | |
| 541 | porsr1 = in_be32(&gur->porsr1); |
| 542 | porsr1 &= ~FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK; |
| 543 | out_be32((void *)(CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_PORCR1), |
| 544 | porsr1); |
Hou Zhiqiang | 653793a | 2018-04-25 14:25:42 +0800 | [diff] [blame] | 545 | out_be32((void *)(CONFIG_SYS_FSL_SCFG_ADDR + 0x1a8), 0xffffffff); |
Hou Zhiqiang | c06b30a | 2016-09-29 12:42:44 +0800 | [diff] [blame] | 546 | #endif |
| 547 | } |
| 548 | |
Hou Zhiqiang | 4ad5999 | 2016-12-09 16:09:00 +0800 | [diff] [blame] | 549 | /* Get VDD in the unit mV from voltage ID */ |
| 550 | int get_core_volt_from_fuse(void) |
| 551 | { |
| 552 | struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); |
| 553 | int vdd; |
| 554 | u32 fusesr; |
| 555 | u8 vid; |
| 556 | |
| 557 | fusesr = in_be32(&gur->dcfg_fusesr); |
| 558 | debug("%s: fusesr = 0x%x\n", __func__, fusesr); |
| 559 | vid = (fusesr >> FSL_CHASSIS2_DCFG_FUSESR_ALTVID_SHIFT) & |
| 560 | FSL_CHASSIS2_DCFG_FUSESR_ALTVID_MASK; |
| 561 | if ((vid == 0) || (vid == FSL_CHASSIS2_DCFG_FUSESR_ALTVID_MASK)) { |
| 562 | vid = (fusesr >> FSL_CHASSIS2_DCFG_FUSESR_VID_SHIFT) & |
| 563 | FSL_CHASSIS2_DCFG_FUSESR_VID_MASK; |
| 564 | } |
| 565 | debug("%s: VID = 0x%x\n", __func__, vid); |
| 566 | switch (vid) { |
| 567 | case 0x00: /* VID isn't supported */ |
| 568 | vdd = -EINVAL; |
| 569 | debug("%s: The VID feature is not supported\n", __func__); |
| 570 | break; |
| 571 | case 0x08: /* 0.9V silicon */ |
| 572 | vdd = 900; |
| 573 | break; |
| 574 | case 0x10: /* 1.0V silicon */ |
| 575 | vdd = 1000; |
| 576 | break; |
| 577 | default: /* Other core voltage */ |
| 578 | vdd = -EINVAL; |
| 579 | printf("%s: The VID(%x) isn't supported\n", __func__, vid); |
| 580 | break; |
| 581 | } |
| 582 | debug("%s: The required minimum volt of CORE is %dmV\n", __func__, vdd); |
| 583 | |
| 584 | return vdd; |
| 585 | } |
| 586 | |
| 587 | __weak int board_switch_core_volt(u32 vdd) |
| 588 | { |
| 589 | return 0; |
| 590 | } |
| 591 | |
| 592 | static int setup_core_volt(u32 vdd) |
| 593 | { |
| 594 | return board_setup_core_volt(vdd); |
| 595 | } |
| 596 | |
| 597 | #ifdef CONFIG_SYS_FSL_DDR |
| 598 | static void ddr_enable_0v9_volt(bool en) |
| 599 | { |
| 600 | struct ccsr_ddr __iomem *ddr = (void *)CONFIG_SYS_FSL_DDR_ADDR; |
| 601 | u32 tmp; |
| 602 | |
| 603 | tmp = ddr_in32(&ddr->ddr_cdr1); |
| 604 | |
| 605 | if (en) |
| 606 | tmp |= DDR_CDR1_V0PT9_EN; |
| 607 | else |
| 608 | tmp &= ~DDR_CDR1_V0PT9_EN; |
| 609 | |
| 610 | ddr_out32(&ddr->ddr_cdr1, tmp); |
| 611 | } |
| 612 | #endif |
| 613 | |
| 614 | int setup_chip_volt(void) |
| 615 | { |
| 616 | int vdd; |
| 617 | |
| 618 | vdd = get_core_volt_from_fuse(); |
| 619 | /* Nothing to do for silicons doesn't support VID */ |
| 620 | if (vdd < 0) |
| 621 | return vdd; |
| 622 | |
| 623 | if (setup_core_volt(vdd)) |
| 624 | printf("%s: Switch core VDD to %dmV failed\n", __func__, vdd); |
| 625 | #ifdef CONFIG_SYS_HAS_SERDES |
| 626 | if (setup_serdes_volt(vdd)) |
| 627 | printf("%s: Switch SVDD to %dmV failed\n", __func__, vdd); |
| 628 | #endif |
| 629 | |
| 630 | #ifdef CONFIG_SYS_FSL_DDR |
| 631 | if (vdd == 900) |
| 632 | ddr_enable_0v9_volt(true); |
| 633 | #endif |
| 634 | |
| 635 | return 0; |
| 636 | } |
| 637 | |
Calvin Johnson | 6d6ef01 | 2018-03-08 15:30:33 +0530 | [diff] [blame] | 638 | #ifdef CONFIG_FSL_PFE |
| 639 | void init_pfe_scfg_dcfg_regs(void) |
| 640 | { |
| 641 | struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR; |
| 642 | u32 ecccr2; |
| 643 | |
| 644 | out_be32(&scfg->pfeasbcr, |
| 645 | in_be32(&scfg->pfeasbcr) | SCFG_PFEASBCR_AWCACHE0); |
| 646 | out_be32(&scfg->pfebsbcr, |
| 647 | in_be32(&scfg->pfebsbcr) | SCFG_PFEASBCR_AWCACHE0); |
| 648 | |
| 649 | /* CCI-400 QoS settings for PFE */ |
| 650 | out_be32(&scfg->wr_qos1, (unsigned int)(SCFG_WR_QOS1_PFE1_QOS |
| 651 | | SCFG_WR_QOS1_PFE2_QOS)); |
| 652 | out_be32(&scfg->rd_qos1, (unsigned int)(SCFG_RD_QOS1_PFE1_QOS |
| 653 | | SCFG_RD_QOS1_PFE2_QOS)); |
| 654 | |
| 655 | ecccr2 = in_be32(CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_ECCCR2); |
| 656 | out_be32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + DCFG_DCSR_ECCCR2, |
| 657 | ecccr2 | (unsigned int)DISABLE_PFE_ECC); |
| 658 | } |
| 659 | #endif |
| 660 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 661 | void fsl_lsch2_early_init_f(void) |
| 662 | { |
Ashish Kumar | 1123406 | 2017-08-11 11:09:14 +0530 | [diff] [blame] | 663 | struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR + |
| 664 | CONFIG_SYS_CCI400_OFFSET); |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 665 | struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR; |
Pankit Garg | 41bde72 | 2019-05-29 12:12:36 +0000 | [diff] [blame] | 666 | #if defined(CONFIG_FSL_QSPI) && defined(CONFIG_TFABOOT) |
| 667 | enum boot_src src; |
| 668 | #endif |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 669 | |
Hou Zhiqiang | 5ac9a5c | 2016-08-02 19:03:23 +0800 | [diff] [blame] | 670 | #ifdef CONFIG_LAYERSCAPE_NS_ACCESS |
| 671 | enable_layerscape_ns_access(); |
| 672 | #endif |
| 673 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 674 | #ifdef CONFIG_FSL_IFC |
| 675 | init_early_memctl_regs(); /* tighten IFC timing */ |
| 676 | #endif |
| 677 | |
Pankit Garg | 41bde72 | 2019-05-29 12:12:36 +0000 | [diff] [blame] | 678 | #if defined(CONFIG_FSL_QSPI) && defined(CONFIG_TFABOOT) |
| 679 | src = get_boot_src(); |
| 680 | if (src != BOOT_SOURCE_QSPI_NOR) |
| 681 | out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL); |
| 682 | #else |
Qianyu Gong | 5ab2d0a | 2016-03-16 18:01:52 +0800 | [diff] [blame] | 683 | #if defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT) |
Gong Qianyu | 760df89 | 2016-01-25 15:16:06 +0800 | [diff] [blame] | 684 | out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL); |
| 685 | #endif |
Pankit Garg | 41bde72 | 2019-05-29 12:12:36 +0000 | [diff] [blame] | 686 | #endif |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 687 | /* Make SEC reads and writes snoopable */ |
Ran Wang | c75026e | 2019-09-20 17:34:29 +0800 | [diff] [blame] | 688 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) |
| 689 | setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP | |
| 690 | SCFG_SNPCNFGCR_SECWRSNP | SCFG_SNPCNFGCR_USB1RDSNP | |
| 691 | SCFG_SNPCNFGCR_USB1WRSNP | SCFG_SNPCNFGCR_USB2RDSNP | |
| 692 | SCFG_SNPCNFGCR_USB2WRSNP | SCFG_SNPCNFGCR_USB3RDSNP | |
| 693 | SCFG_SNPCNFGCR_USB3WRSNP | SCFG_SNPCNFGCR_SATARDSNP | |
| 694 | SCFG_SNPCNFGCR_SATAWRSNP); |
Ran Wang | a757669 | 2019-12-26 18:11:17 +0800 | [diff] [blame] | 695 | #elif defined(CONFIG_ARCH_LS1012A) |
| 696 | setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP | |
| 697 | SCFG_SNPCNFGCR_SECWRSNP | SCFG_SNPCNFGCR_USB1RDSNP | |
| 698 | SCFG_SNPCNFGCR_USB1WRSNP | SCFG_SNPCNFGCR_SATARDSNP | |
| 699 | SCFG_SNPCNFGCR_SATAWRSNP); |
Ran Wang | c75026e | 2019-09-20 17:34:29 +0800 | [diff] [blame] | 700 | #else |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 701 | setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP | |
Tang Yuantian | 2945ae0 | 2016-08-08 15:07:20 +0800 | [diff] [blame] | 702 | SCFG_SNPCNFGCR_SECWRSNP | |
| 703 | SCFG_SNPCNFGCR_SATARDSNP | |
| 704 | SCFG_SNPCNFGCR_SATAWRSNP); |
Ran Wang | c75026e | 2019-09-20 17:34:29 +0800 | [diff] [blame] | 705 | #endif |
Aneesh Bansal | 13d984d | 2015-12-08 13:54:27 +0530 | [diff] [blame] | 706 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 707 | /* |
| 708 | * Enable snoop requests and DVM message requests for |
| 709 | * Slave insterface S4 (A53 core cluster) |
| 710 | */ |
York Sun | e6b871e | 2017-05-15 08:51:59 -0700 | [diff] [blame] | 711 | if (current_el() == 3) { |
| 712 | out_le32(&cci->slave[4].snoop_ctrl, |
| 713 | CCI400_DVM_MESSAGE_REQ_EN | CCI400_SNOOP_REQ_EN); |
| 714 | } |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 715 | |
Ran Wang | 4e7cdcf | 2018-08-10 15:00:00 +0800 | [diff] [blame] | 716 | /* |
| 717 | * Program Central Security Unit (CSU) to grant access |
| 718 | * permission for USB 2.0 controller |
| 719 | */ |
| 720 | #if defined(CONFIG_ARCH_LS1012A) && defined(CONFIG_USB_EHCI_FSL) |
| 721 | if (current_el() == 3) |
| 722 | set_devices_ns_access(CSU_CSLX_USB_2, CSU_ALL_RW); |
| 723 | #endif |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 724 | /* Erratum */ |
Shengzhou Liu | ddf060b | 2016-04-07 16:22:21 +0800 | [diff] [blame] | 725 | erratum_a008850_early(); /* part 1 of 2 */ |
Mingkai Hu | 8beb075 | 2015-12-07 16:58:54 +0800 | [diff] [blame] | 726 | erratum_a009929(); |
Mingkai Hu | 172081c | 2016-02-02 11:28:03 +0800 | [diff] [blame] | 727 | erratum_a009660(); |
Hou Zhiqiang | c06b30a | 2016-09-29 12:42:44 +0800 | [diff] [blame] | 728 | erratum_a010539(); |
Ran Wang | b358b7b | 2017-09-04 18:46:48 +0800 | [diff] [blame] | 729 | erratum_a009008(); |
Ran Wang | 9e8fabc | 2017-09-04 18:46:49 +0800 | [diff] [blame] | 730 | erratum_a009798(); |
Ran Wang | e64f747 | 2017-09-04 18:46:50 +0800 | [diff] [blame] | 731 | erratum_a008997(); |
Ran Wang | 3ba6948 | 2017-09-04 18:46:51 +0800 | [diff] [blame] | 732 | erratum_a009007(); |
Laurentiu Tudor | 512d13e | 2018-08-09 15:19:46 +0300 | [diff] [blame] | 733 | |
Laurentiu Tudor | 22012d5 | 2018-08-27 17:33:59 +0300 | [diff] [blame] | 734 | #if defined(CONFIG_ARCH_LS1043A) || defined(CONFIG_ARCH_LS1046A) |
Laurentiu Tudor | 512d13e | 2018-08-09 15:19:46 +0300 | [diff] [blame] | 735 | set_icids(); |
| 736 | #endif |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 737 | } |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 738 | #endif |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 739 | |
Kuldeep Singh | 34aafb0 | 2019-11-21 17:15:17 +0530 | [diff] [blame] | 740 | #ifdef CONFIG_FSPI_AHB_EN_4BYTE |
| 741 | int fspi_ahb_init(void) |
| 742 | { |
| 743 | /* Enable 4bytes address support and fast read */ |
| 744 | u32 *fspi_lut, lut_key, *fspi_key; |
| 745 | |
| 746 | fspi_key = (void *)SYS_NXP_FSPI_ADDR + SYS_NXP_FSPI_LUTKEY_BASE_ADDR; |
| 747 | fspi_lut = (void *)SYS_NXP_FSPI_ADDR + SYS_NXP_FSPI_LUT_BASE_ADDR; |
| 748 | |
| 749 | lut_key = in_be32(fspi_key); |
| 750 | |
| 751 | if (lut_key == SYS_NXP_FSPI_LUTKEY) { |
| 752 | /* That means the register is BE */ |
| 753 | out_be32(fspi_key, SYS_NXP_FSPI_LUTKEY); |
| 754 | /* Unlock the lut table */ |
| 755 | out_be32(fspi_key + 1, SYS_NXP_FSPI_LUTCR_UNLOCK); |
| 756 | /* Create READ LUT */ |
| 757 | out_be32(fspi_lut, 0x0820040c); |
| 758 | out_be32(fspi_lut + 1, 0x24003008); |
| 759 | out_be32(fspi_lut + 2, 0x00000000); |
| 760 | /* Lock the lut table */ |
| 761 | out_be32(fspi_key, SYS_NXP_FSPI_LUTKEY); |
| 762 | out_be32(fspi_key + 1, SYS_NXP_FSPI_LUTCR_LOCK); |
| 763 | } else { |
| 764 | /* That means the register is LE */ |
| 765 | out_le32(fspi_key, SYS_NXP_FSPI_LUTKEY); |
| 766 | /* Unlock the lut table */ |
| 767 | out_le32(fspi_key + 1, SYS_NXP_FSPI_LUTCR_UNLOCK); |
| 768 | /* Create READ LUT */ |
| 769 | out_le32(fspi_lut, 0x0820040c); |
| 770 | out_le32(fspi_lut + 1, 0x24003008); |
| 771 | out_le32(fspi_lut + 2, 0x00000000); |
| 772 | /* Lock the lut table */ |
| 773 | out_le32(fspi_key, SYS_NXP_FSPI_LUTKEY); |
| 774 | out_le32(fspi_key + 1, SYS_NXP_FSPI_LUTCR_LOCK); |
| 775 | } |
| 776 | |
| 777 | return 0; |
| 778 | } |
| 779 | #endif |
| 780 | |
Yuan Yao | 52ae4fd | 2016-12-01 10:13:52 +0800 | [diff] [blame] | 781 | #ifdef CONFIG_QSPI_AHB_INIT |
| 782 | /* Enable 4bytes address support and fast read */ |
| 783 | int qspi_ahb_init(void) |
| 784 | { |
| 785 | u32 *qspi_lut, lut_key, *qspi_key; |
| 786 | |
| 787 | qspi_key = (void *)SYS_FSL_QSPI_ADDR + 0x300; |
| 788 | qspi_lut = (void *)SYS_FSL_QSPI_ADDR + 0x310; |
| 789 | |
| 790 | lut_key = in_be32(qspi_key); |
| 791 | |
| 792 | if (lut_key == 0x5af05af0) { |
| 793 | /* That means the register is BE */ |
| 794 | out_be32(qspi_key, 0x5af05af0); |
| 795 | /* Unlock the lut table */ |
| 796 | out_be32(qspi_key + 1, 0x00000002); |
| 797 | out_be32(qspi_lut, 0x0820040c); |
| 798 | out_be32(qspi_lut + 1, 0x1c080c08); |
| 799 | out_be32(qspi_lut + 2, 0x00002400); |
| 800 | /* Lock the lut table */ |
| 801 | out_be32(qspi_key, 0x5af05af0); |
| 802 | out_be32(qspi_key + 1, 0x00000001); |
| 803 | } else { |
| 804 | /* That means the register is LE */ |
| 805 | out_le32(qspi_key, 0x5af05af0); |
| 806 | /* Unlock the lut table */ |
| 807 | out_le32(qspi_key + 1, 0x00000002); |
| 808 | out_le32(qspi_lut, 0x0820040c); |
| 809 | out_le32(qspi_lut + 1, 0x1c080c08); |
| 810 | out_le32(qspi_lut + 2, 0x00002400); |
| 811 | /* Lock the lut table */ |
| 812 | out_le32(qspi_key, 0x5af05af0); |
| 813 | out_le32(qspi_key + 1, 0x00000001); |
| 814 | } |
| 815 | |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 816 | return 0; |
| 817 | } |
| 818 | #endif |
| 819 | |
| 820 | #ifdef CONFIG_TFABOOT |
Rajesh Bhagat | 5b73c90 | 2018-12-27 04:37:49 +0000 | [diff] [blame] | 821 | #define MAX_BOOTCMD_SIZE 512 |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 822 | |
| 823 | int fsl_setenv_bootcmd(void) |
| 824 | { |
| 825 | int ret; |
| 826 | enum boot_src src = get_boot_src(); |
| 827 | char bootcmd_str[MAX_BOOTCMD_SIZE]; |
| 828 | |
| 829 | switch (src) { |
| 830 | #ifdef IFC_NOR_BOOTCOMMAND |
| 831 | case BOOT_SOURCE_IFC_NOR: |
| 832 | sprintf(bootcmd_str, IFC_NOR_BOOTCOMMAND); |
| 833 | break; |
| 834 | #endif |
| 835 | #ifdef QSPI_NOR_BOOTCOMMAND |
| 836 | case BOOT_SOURCE_QSPI_NOR: |
| 837 | sprintf(bootcmd_str, QSPI_NOR_BOOTCOMMAND); |
| 838 | break; |
| 839 | #endif |
| 840 | #ifdef XSPI_NOR_BOOTCOMMAND |
| 841 | case BOOT_SOURCE_XSPI_NOR: |
| 842 | sprintf(bootcmd_str, XSPI_NOR_BOOTCOMMAND); |
| 843 | break; |
| 844 | #endif |
| 845 | #ifdef IFC_NAND_BOOTCOMMAND |
| 846 | case BOOT_SOURCE_IFC_NAND: |
| 847 | sprintf(bootcmd_str, IFC_NAND_BOOTCOMMAND); |
| 848 | break; |
| 849 | #endif |
| 850 | #ifdef QSPI_NAND_BOOTCOMMAND |
| 851 | case BOOT_SOURCE_QSPI_NAND: |
| 852 | sprintf(bootcmd_str, QSPI_NAND_BOOTCOMMAND); |
| 853 | break; |
| 854 | #endif |
| 855 | #ifdef XSPI_NAND_BOOTCOMMAND |
| 856 | case BOOT_SOURCE_XSPI_NAND: |
| 857 | sprintf(bootcmd_str, XSPI_NAND_BOOTCOMMAND); |
| 858 | break; |
| 859 | #endif |
| 860 | #ifdef SD_BOOTCOMMAND |
| 861 | case BOOT_SOURCE_SD_MMC: |
| 862 | sprintf(bootcmd_str, SD_BOOTCOMMAND); |
| 863 | break; |
| 864 | #endif |
| 865 | #ifdef SD2_BOOTCOMMAND |
| 866 | case BOOT_SOURCE_SD_MMC2: |
| 867 | sprintf(bootcmd_str, SD2_BOOTCOMMAND); |
| 868 | break; |
| 869 | #endif |
| 870 | default: |
| 871 | #ifdef QSPI_NOR_BOOTCOMMAND |
| 872 | sprintf(bootcmd_str, QSPI_NOR_BOOTCOMMAND); |
| 873 | #endif |
| 874 | break; |
| 875 | } |
| 876 | |
| 877 | ret = env_set("bootcmd", bootcmd_str); |
| 878 | if (ret) { |
| 879 | printf("Failed to set bootcmd: ret = %d\n", ret); |
| 880 | return ret; |
| 881 | } |
Yuan Yao | 52ae4fd | 2016-12-01 10:13:52 +0800 | [diff] [blame] | 882 | return 0; |
| 883 | } |
Pankit Garg | 82fcc46 | 2018-11-05 18:02:31 +0000 | [diff] [blame] | 884 | |
| 885 | int fsl_setenv_mcinitcmd(void) |
| 886 | { |
| 887 | int ret = 0; |
| 888 | enum boot_src src = get_boot_src(); |
| 889 | |
| 890 | switch (src) { |
| 891 | #ifdef IFC_MC_INIT_CMD |
| 892 | case BOOT_SOURCE_IFC_NAND: |
| 893 | case BOOT_SOURCE_IFC_NOR: |
| 894 | ret = env_set("mcinitcmd", IFC_MC_INIT_CMD); |
| 895 | break; |
| 896 | #endif |
| 897 | #ifdef QSPI_MC_INIT_CMD |
| 898 | case BOOT_SOURCE_QSPI_NAND: |
| 899 | case BOOT_SOURCE_QSPI_NOR: |
| 900 | ret = env_set("mcinitcmd", QSPI_MC_INIT_CMD); |
| 901 | break; |
| 902 | #endif |
| 903 | #ifdef XSPI_MC_INIT_CMD |
| 904 | case BOOT_SOURCE_XSPI_NAND: |
| 905 | case BOOT_SOURCE_XSPI_NOR: |
| 906 | ret = env_set("mcinitcmd", XSPI_MC_INIT_CMD); |
| 907 | break; |
| 908 | #endif |
| 909 | #ifdef SD_MC_INIT_CMD |
| 910 | case BOOT_SOURCE_SD_MMC: |
| 911 | ret = env_set("mcinitcmd", SD_MC_INIT_CMD); |
| 912 | break; |
| 913 | #endif |
| 914 | #ifdef SD2_MC_INIT_CMD |
| 915 | case BOOT_SOURCE_SD_MMC2: |
| 916 | ret = env_set("mcinitcmd", SD2_MC_INIT_CMD); |
| 917 | break; |
| 918 | #endif |
| 919 | default: |
| 920 | #ifdef QSPI_MC_INIT_CMD |
| 921 | ret = env_set("mcinitcmd", QSPI_MC_INIT_CMD); |
| 922 | #endif |
| 923 | break; |
| 924 | } |
| 925 | |
| 926 | if (ret) { |
| 927 | printf("Failed to set mcinitcmd: ret = %d\n", ret); |
| 928 | return ret; |
| 929 | } |
| 930 | return 0; |
| 931 | } |
Yuan Yao | 52ae4fd | 2016-12-01 10:13:52 +0800 | [diff] [blame] | 932 | #endif |
| 933 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 934 | #ifdef CONFIG_BOARD_LATE_INIT |
Michael Walle | fc667ea | 2019-10-21 22:37:45 +0200 | [diff] [blame] | 935 | __weak int fsl_board_late_init(void) |
| 936 | { |
| 937 | return 0; |
| 938 | } |
| 939 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 940 | int board_late_init(void) |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 941 | { |
Aneesh Bansal | 39d5b3b | 2016-01-22 16:37:26 +0530 | [diff] [blame] | 942 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 943 | fsl_setenv_chain_of_trust(); |
| 944 | #endif |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 945 | #ifdef CONFIG_TFABOOT |
| 946 | /* |
| 947 | * check if gd->env_addr is default_environment; then setenv bootcmd |
Pankit Garg | 82fcc46 | 2018-11-05 18:02:31 +0000 | [diff] [blame] | 948 | * and mcinitcmd. |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 949 | */ |
Tom Rini | 5cd7ece | 2019-11-18 20:02:10 -0500 | [diff] [blame] | 950 | #ifdef CONFIG_SYS_RELOC_GD_ENV_ADDR |
Pankit Garg | d6bd678 | 2019-05-30 12:04:15 +0000 | [diff] [blame] | 951 | if (gd->env_addr == (ulong)&default_environment[0]) { |
| 952 | #else |
Pankit Garg | 82fcc46 | 2018-11-05 18:02:31 +0000 | [diff] [blame] | 953 | if (gd->env_addr + gd->reloc_off == (ulong)&default_environment[0]) { |
Pankit Garg | d6bd678 | 2019-05-30 12:04:15 +0000 | [diff] [blame] | 954 | #endif |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 955 | fsl_setenv_bootcmd(); |
Pankit Garg | 82fcc46 | 2018-11-05 18:02:31 +0000 | [diff] [blame] | 956 | fsl_setenv_mcinitcmd(); |
| 957 | } |
Rajesh Bhagat | 5b73c90 | 2018-12-27 04:37:49 +0000 | [diff] [blame] | 958 | |
| 959 | /* |
| 960 | * If the boot mode is secure, default environment is not present then |
| 961 | * setenv command needs to be run by default |
| 962 | */ |
| 963 | #ifdef CONFIG_CHAIN_OF_TRUST |
| 964 | if ((fsl_check_boot_mode_secure() == 1)) { |
| 965 | fsl_setenv_bootcmd(); |
| 966 | fsl_setenv_mcinitcmd(); |
| 967 | } |
| 968 | #endif |
Pankit Garg | bdbf84f | 2018-11-05 18:01:52 +0000 | [diff] [blame] | 969 | #endif |
Yuan Yao | 52ae4fd | 2016-12-01 10:13:52 +0800 | [diff] [blame] | 970 | #ifdef CONFIG_QSPI_AHB_INIT |
| 971 | qspi_ahb_init(); |
| 972 | #endif |
Kuldeep Singh | 34aafb0 | 2019-11-21 17:15:17 +0530 | [diff] [blame] | 973 | #ifdef CONFIG_FSPI_AHB_EN_4BYTE |
| 974 | fspi_ahb_init(); |
| 975 | #endif |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 976 | |
Michael Walle | fc667ea | 2019-10-21 22:37:45 +0200 | [diff] [blame] | 977 | return fsl_board_late_init(); |
Scott Wood | 8e728cd | 2015-03-24 13:25:02 -0700 | [diff] [blame] | 978 | } |
| 979 | #endif |