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