Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 2 | /* |
Wasim Khan | fc9fa1d | 2019-10-15 08:54:11 +0000 | [diff] [blame] | 3 | * Copyright 2017-2019 NXP |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 4 | * Copyright 2015 Freescale Semiconductor |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ |
| 8 | #define _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ |
| 9 | |
Simon Glass | 89e0a3a | 2017-05-17 08:23:10 -0600 | [diff] [blame] | 10 | #ifndef __ASSEMBLY__ |
| 11 | #include <linux/types.h> |
| 12 | #ifdef CONFIG_FSL_LSCH2 |
| 13 | #include <asm/arch/immap_lsch2.h> |
| 14 | #endif |
| 15 | #ifdef CONFIG_FSL_LSCH3 |
| 16 | #include <asm/arch/immap_lsch3.h> |
| 17 | #endif |
| 18 | #endif |
| 19 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 20 | #ifdef CONFIG_SYS_FSL_CCSR_GUR_LE |
| 21 | #define gur_in32(a) in_le32(a) |
| 22 | #define gur_out32(a, v) out_le32(a, v) |
| 23 | #elif defined(CONFIG_SYS_FSL_CCSR_GUR_BE) |
| 24 | #define gur_in32(a) in_be32(a) |
| 25 | #define gur_out32(a, v) out_be32(a, v) |
| 26 | #endif |
| 27 | |
| 28 | #ifdef CONFIG_SYS_FSL_CCSR_SCFG_LE |
| 29 | #define scfg_in32(a) in_le32(a) |
| 30 | #define scfg_out32(a, v) out_le32(a, v) |
Ran Wang | 250d9d0 | 2017-09-04 18:46:47 +0800 | [diff] [blame] | 31 | #define scfg_clrbits32(addr, clear) clrbits_le32(addr, clear) |
| 32 | #define scfg_clrsetbits32(addr, clear, set) clrsetbits_le32(addr, clear, set) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 33 | #elif defined(CONFIG_SYS_FSL_CCSR_SCFG_BE) |
| 34 | #define scfg_in32(a) in_be32(a) |
| 35 | #define scfg_out32(a, v) out_be32(a, v) |
Ran Wang | 250d9d0 | 2017-09-04 18:46:47 +0800 | [diff] [blame] | 36 | #define scfg_clrbits32(addr, clear) clrbits_be32(addr, clear) |
| 37 | #define scfg_clrsetbits32(addr, clear, set) clrsetbits_be32(addr, clear, set) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 38 | #endif |
| 39 | |
Mingkai Hu | 1921899 | 2015-11-11 17:58:34 +0800 | [diff] [blame] | 40 | #ifdef CONFIG_SYS_FSL_PEX_LUT_LE |
| 41 | #define pex_lut_in32(a) in_le32(a) |
| 42 | #define pex_lut_out32(a, v) out_le32(a, v) |
| 43 | #elif defined(CONFIG_SYS_FSL_PEX_LUT_BE) |
| 44 | #define pex_lut_in32(a) in_be32(a) |
| 45 | #define pex_lut_out32(a, v) out_be32(a, v) |
| 46 | #endif |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 47 | #ifndef __ASSEMBLY__ |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 48 | struct cpu_type { |
| 49 | char name[15]; |
| 50 | u32 soc_ver; |
| 51 | u32 num_cores; |
| 52 | }; |
| 53 | |
| 54 | #define CPU_TYPE_ENTRY(n, v, nc) \ |
| 55 | { .name = #n, .soc_ver = SVR_##v, .num_cores = (nc)} |
Rajesh Bhagat | 583da8b | 2018-11-05 18:01:42 +0000 | [diff] [blame] | 56 | |
| 57 | #ifdef CONFIG_TFABOOT |
Rajesh Bhagat | 1dde2d2 | 2018-11-05 18:01:58 +0000 | [diff] [blame] | 58 | #define SMC_DRAM_BANK_INFO (0xC200FF12) |
York Sun | 8f3f4ef | 2018-11-05 18:02:09 +0000 | [diff] [blame] | 59 | #define SIP_SVC_RCW 0xC200FF18 |
Rajesh Bhagat | 1dde2d2 | 2018-11-05 18:01:58 +0000 | [diff] [blame] | 60 | |
| 61 | phys_size_t tfa_get_dram_size(void); |
| 62 | |
Rajesh Bhagat | 583da8b | 2018-11-05 18:01:42 +0000 | [diff] [blame] | 63 | enum boot_src { |
| 64 | BOOT_SOURCE_RESERVED = 0, |
| 65 | BOOT_SOURCE_IFC_NOR, |
| 66 | BOOT_SOURCE_IFC_NAND, |
| 67 | BOOT_SOURCE_QSPI_NOR, |
| 68 | BOOT_SOURCE_QSPI_NAND, |
| 69 | BOOT_SOURCE_XSPI_NOR, |
| 70 | BOOT_SOURCE_XSPI_NAND, |
| 71 | BOOT_SOURCE_SD_MMC, |
| 72 | BOOT_SOURCE_SD_MMC2, |
| 73 | BOOT_SOURCE_I2C1_EXTENDED, |
| 74 | }; |
| 75 | |
| 76 | enum boot_src get_boot_src(void); |
| 77 | #endif |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 78 | #endif |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 79 | #define SVR_WO_E 0xFFFFFE |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 80 | #define SVR_LS1012A 0x870400 |
| 81 | #define SVR_LS1043A 0x879200 |
| 82 | #define SVR_LS1023A 0x879208 |
Hou Zhiqiang | b9aedf9 | 2018-12-20 06:31:17 +0000 | [diff] [blame] | 83 | /* LS1043A/LS1023A 23x23 package silicon has different value of VAR_PER */ |
| 84 | #define SVR_LS1043A_P23 0x879202 |
| 85 | #define SVR_LS1023A_P23 0x87920A |
Yuantian Tang | f463d75 | 2019-09-18 16:50:52 +0800 | [diff] [blame] | 86 | #define SVR_LS1017A 0x870B24 |
| 87 | #define SVR_LS1018A 0x870B20 |
| 88 | #define SVR_LS1027A 0x870B04 |
Yuantian Tang | 4aefa16 | 2019-04-10 16:43:33 +0800 | [diff] [blame] | 89 | #define SVR_LS1028A 0x870B00 |
Mingkai Hu | cd54c0f | 2016-07-05 16:01:55 +0800 | [diff] [blame] | 90 | #define SVR_LS1046A 0x870700 |
| 91 | #define SVR_LS1026A 0x870708 |
Ashish Kumar | b25faa2 | 2017-08-31 16:12:53 +0530 | [diff] [blame] | 92 | #define SVR_LS1048A 0x870320 |
| 93 | #define SVR_LS1084A 0x870302 |
| 94 | #define SVR_LS1088A 0x870300 |
| 95 | #define SVR_LS1044A 0x870322 |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 96 | #define SVR_LS2045A 0x870120 |
| 97 | #define SVR_LS2080A 0x870110 |
| 98 | #define SVR_LS2085A 0x870100 |
| 99 | #define SVR_LS2040A 0x870130 |
Priyanka Jain | 4a6f173 | 2016-11-17 12:29:55 +0530 | [diff] [blame] | 100 | #define SVR_LS2088A 0x870900 |
| 101 | #define SVR_LS2084A 0x870910 |
| 102 | #define SVR_LS2048A 0x870920 |
| 103 | #define SVR_LS2044A 0x870930 |
Santan Kumar | ccb56a8 | 2017-06-09 11:48:08 +0530 | [diff] [blame] | 104 | #define SVR_LS2081A 0x870918 |
| 105 | #define SVR_LS2041A 0x870914 |
Wasim Khan | fc9fa1d | 2019-10-15 08:54:11 +0000 | [diff] [blame] | 106 | #define SVR_LX2160A 0x873600 |
| 107 | #define SVR_LX2120A 0x873620 |
| 108 | #define SVR_LX2080A 0x873602 |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 109 | |
| 110 | #define SVR_MAJ(svr) (((svr) >> 4) & 0xf) |
| 111 | #define SVR_MIN(svr) (((svr) >> 0) & 0xf) |
Wenbin Song | a8f57a9 | 2017-01-17 18:31:15 +0800 | [diff] [blame] | 112 | #define SVR_REV(svr) (((svr) >> 0) & 0xff) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 113 | #define SVR_SOC_VER(svr) (((svr) >> 8) & SVR_WO_E) |
| 114 | #define IS_E_PROCESSOR(svr) (!((svr >> 8) & 0x1)) |
Priyanka Jain | ef76b2e | 2018-10-29 09:17:09 +0000 | [diff] [blame] | 115 | #ifdef CONFIG_ARCH_LX2160A |
| 116 | #define IS_C_PROCESSOR(svr) (!((svr >> 12) & 0x1)) |
| 117 | #endif |
Yuantian Tang | 044719b | 2019-10-10 17:19:37 +0800 | [diff] [blame] | 118 | #ifdef CONFIG_ARCH_LS1028A |
| 119 | #define IS_MULTIMEDIA_EN(svr) (!((svr >> 10) & 0x1)) |
| 120 | #endif |
Sriram Dash | 9282d26 | 2016-06-13 09:58:32 +0530 | [diff] [blame] | 121 | #define IS_SVR_REV(svr, maj, min) \ |
| 122 | ((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min))) |
Wenbin song | 5d8a61c | 2017-12-04 12:18:28 +0800 | [diff] [blame] | 123 | #define SVR_DEV(svr) ((svr) >> 8) |
| 124 | #define IS_SVR_DEV(svr, dev) (((svr) >> 16) == (dev)) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 125 | |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 126 | #ifndef __ASSEMBLY__ |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 127 | #ifdef CONFIG_FSL_LSCH3 |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 128 | void fsl_lsch3_early_init_f(void); |
Rajesh Bhagat | 814e077 | 2018-01-17 16:13:00 +0530 | [diff] [blame] | 129 | int get_core_volt_from_fuse(void); |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 130 | #elif defined(CONFIG_FSL_LSCH2) |
| 131 | void fsl_lsch2_early_init_f(void); |
Hou Zhiqiang | 4ad5999 | 2016-12-09 16:09:00 +0800 | [diff] [blame] | 132 | int setup_chip_volt(void); |
| 133 | /* Setup core vdd in unit mV */ |
| 134 | int board_setup_core_volt(u32 vdd); |
Calvin Johnson | 6d6ef01 | 2018-03-08 15:30:33 +0530 | [diff] [blame] | 135 | #ifdef CONFIG_FSL_PFE |
| 136 | void init_pfe_scfg_dcfg_regs(void); |
| 137 | #endif |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 138 | #endif |
York Sun | bb7d342 | 2018-06-26 14:48:28 -0700 | [diff] [blame] | 139 | #ifdef CONFIG_QSPI_AHB_INIT |
| 140 | int qspi_ahb_init(void); |
| 141 | #endif |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 142 | |
Kuldeep Singh | 34aafb0 | 2019-11-21 17:15:17 +0530 | [diff] [blame] | 143 | #ifdef CONFIG_FSPI_AHB_EN_4BYTE |
| 144 | #define SYS_NXP_FSPI_LUTCR_LOCK 0x00000001 |
| 145 | #define SYS_NXP_FSPI_LUTCR_UNLOCK 0x00000002 |
| 146 | #define SYS_NXP_FSPI_LUTKEY 0x5AF05AF0 |
| 147 | int fspi_ahb_init(void); |
| 148 | #endif |
| 149 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 150 | void cpu_name(char *name); |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 151 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009635 |
| 152 | void erratum_a009635(void); |
| 153 | #endif |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 154 | |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 155 | #ifdef CONFIG_SYS_FSL_ERRATUM_A010315 |
| 156 | void erratum_a010315(void); |
| 157 | #endif |
| 158 | |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 159 | bool soc_has_dp_ddr(void); |
| 160 | bool soc_has_aiop(void); |
Hou Zhiqiang | 031bb87 | 2020-04-28 10:19:32 +0800 | [diff] [blame] | 161 | |
| 162 | #ifdef CONFIG_GIC_V3_ITS |
| 163 | int ls_gic_rd_tables_init(void *blob); |
| 164 | #endif |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 165 | #endif |
Simon Glass | 89e0a3a | 2017-05-17 08:23:10 -0600 | [diff] [blame] | 166 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 167 | #endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */ |