Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 1 | /* |
Priyanka Jain | 2b36178 | 2017-04-27 15:08:06 +0530 | [diff] [blame] | 2 | * Copyright 2017 NXP |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 3 | * Copyright 2015 Freescale Semiconductor |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #ifndef _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ |
| 9 | #define _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ |
| 10 | |
Simon Glass | 89e0a3a | 2017-05-17 08:23:10 -0600 | [diff] [blame] | 11 | #ifndef __ASSEMBLY__ |
| 12 | #include <linux/types.h> |
| 13 | #ifdef CONFIG_FSL_LSCH2 |
| 14 | #include <asm/arch/immap_lsch2.h> |
| 15 | #endif |
| 16 | #ifdef CONFIG_FSL_LSCH3 |
| 17 | #include <asm/arch/immap_lsch3.h> |
| 18 | #endif |
| 19 | #endif |
| 20 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 21 | #ifdef CONFIG_SYS_FSL_CCSR_GUR_LE |
| 22 | #define gur_in32(a) in_le32(a) |
| 23 | #define gur_out32(a, v) out_le32(a, v) |
| 24 | #elif defined(CONFIG_SYS_FSL_CCSR_GUR_BE) |
| 25 | #define gur_in32(a) in_be32(a) |
| 26 | #define gur_out32(a, v) out_be32(a, v) |
| 27 | #endif |
| 28 | |
| 29 | #ifdef CONFIG_SYS_FSL_CCSR_SCFG_LE |
| 30 | #define scfg_in32(a) in_le32(a) |
| 31 | #define scfg_out32(a, v) out_le32(a, v) |
Ran Wang | 250d9d0 | 2017-09-04 18:46:47 +0800 | [diff] [blame] | 32 | #define scfg_clrbits32(addr, clear) clrbits_le32(addr, clear) |
| 33 | #define scfg_clrsetbits32(addr, clear, set) clrsetbits_le32(addr, clear, set) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 34 | #elif defined(CONFIG_SYS_FSL_CCSR_SCFG_BE) |
| 35 | #define scfg_in32(a) in_be32(a) |
| 36 | #define scfg_out32(a, v) out_be32(a, v) |
Ran Wang | 250d9d0 | 2017-09-04 18:46:47 +0800 | [diff] [blame] | 37 | #define scfg_clrbits32(addr, clear) clrbits_be32(addr, clear) |
| 38 | #define scfg_clrsetbits32(addr, clear, set) clrsetbits_be32(addr, clear, set) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 39 | #endif |
| 40 | |
Mingkai Hu | 1921899 | 2015-11-11 17:58:34 +0800 | [diff] [blame] | 41 | #ifdef CONFIG_SYS_FSL_PEX_LUT_LE |
| 42 | #define pex_lut_in32(a) in_le32(a) |
| 43 | #define pex_lut_out32(a, v) out_le32(a, v) |
| 44 | #elif defined(CONFIG_SYS_FSL_PEX_LUT_BE) |
| 45 | #define pex_lut_in32(a) in_be32(a) |
| 46 | #define pex_lut_out32(a, v) out_be32(a, v) |
| 47 | #endif |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 48 | #ifndef __ASSEMBLY__ |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 49 | struct cpu_type { |
| 50 | char name[15]; |
| 51 | u32 soc_ver; |
| 52 | u32 num_cores; |
| 53 | }; |
| 54 | |
| 55 | #define CPU_TYPE_ENTRY(n, v, nc) \ |
| 56 | { .name = #n, .soc_ver = SVR_##v, .num_cores = (nc)} |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 57 | #endif |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 58 | #define SVR_WO_E 0xFFFFFE |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 59 | #define SVR_LS1012A 0x870400 |
| 60 | #define SVR_LS1043A 0x879200 |
| 61 | #define SVR_LS1023A 0x879208 |
Mingkai Hu | cd54c0f | 2016-07-05 16:01:55 +0800 | [diff] [blame] | 62 | #define SVR_LS1046A 0x870700 |
| 63 | #define SVR_LS1026A 0x870708 |
Ashish Kumar | b25faa2 | 2017-08-31 16:12:53 +0530 | [diff] [blame] | 64 | #define SVR_LS1048A 0x870320 |
| 65 | #define SVR_LS1084A 0x870302 |
| 66 | #define SVR_LS1088A 0x870300 |
| 67 | #define SVR_LS1044A 0x870322 |
Prabhakar Kushwaha | ac7f242 | 2016-06-24 13:48:13 +0530 | [diff] [blame] | 68 | #define SVR_LS2045A 0x870120 |
| 69 | #define SVR_LS2080A 0x870110 |
| 70 | #define SVR_LS2085A 0x870100 |
| 71 | #define SVR_LS2040A 0x870130 |
Priyanka Jain | 4a6f173 | 2016-11-17 12:29:55 +0530 | [diff] [blame] | 72 | #define SVR_LS2088A 0x870900 |
| 73 | #define SVR_LS2084A 0x870910 |
| 74 | #define SVR_LS2048A 0x870920 |
| 75 | #define SVR_LS2044A 0x870930 |
Santan Kumar | ccb56a8 | 2017-06-09 11:48:08 +0530 | [diff] [blame] | 76 | #define SVR_LS2081A 0x870918 |
| 77 | #define SVR_LS2041A 0x870914 |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 78 | |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 79 | #define SVR_DEV_LS2080A 0x8701 |
| 80 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 81 | #define SVR_MAJ(svr) (((svr) >> 4) & 0xf) |
| 82 | #define SVR_MIN(svr) (((svr) >> 0) & 0xf) |
Wenbin Song | a8f57a9 | 2017-01-17 18:31:15 +0800 | [diff] [blame] | 83 | #define SVR_REV(svr) (((svr) >> 0) & 0xff) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 84 | #define SVR_SOC_VER(svr) (((svr) >> 8) & SVR_WO_E) |
| 85 | #define IS_E_PROCESSOR(svr) (!((svr >> 8) & 0x1)) |
Sriram Dash | 9282d26 | 2016-06-13 09:58:32 +0530 | [diff] [blame] | 86 | #define IS_SVR_REV(svr, maj, min) \ |
| 87 | ((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min))) |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 88 | |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 89 | /* ahci port register default value */ |
| 90 | #define AHCI_PORT_PHY_1_CFG 0xa003fffe |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 91 | #define AHCI_PORT_TRANS_CFG 0x08000029 |
Tang Yuantian | 2945ae0 | 2016-08-08 15:07:20 +0800 | [diff] [blame] | 92 | #define AHCI_PORT_AXICC_CFG 0x3fffffff |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 93 | |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 94 | #ifndef __ASSEMBLY__ |
Tang Yuantian | 57894be | 2015-12-09 15:32:18 +0800 | [diff] [blame] | 95 | /* AHCI (sata) register map */ |
| 96 | struct ccsr_ahci { |
| 97 | u32 res1[0xa4/4]; /* 0x0 - 0xa4 */ |
| 98 | u32 pcfg; /* port config */ |
| 99 | u32 ppcfg; /* port phy1 config */ |
| 100 | u32 pp2c; /* port phy2 config */ |
| 101 | u32 pp3c; /* port phy3 config */ |
| 102 | u32 pp4c; /* port phy4 config */ |
| 103 | u32 pp5c; /* port phy5 config */ |
| 104 | u32 axicc; /* AXI cache control */ |
| 105 | u32 paxic; /* port AXI config */ |
| 106 | u32 axipc; /* AXI PROT control */ |
| 107 | u32 ptc; /* port Trans Config */ |
| 108 | u32 pts; /* port Trans Status */ |
| 109 | u32 plc; /* port link config */ |
| 110 | u32 plc1; /* port link config1 */ |
| 111 | u32 plc2; /* port link config2 */ |
| 112 | u32 pls; /* port link status */ |
| 113 | u32 pls1; /* port link status1 */ |
| 114 | u32 pcmdc; /* port CMD config */ |
| 115 | u32 ppcs; /* port phy control status */ |
| 116 | u32 pberr; /* port 0/1 BIST error */ |
| 117 | u32 cmds; /* port 0/1 CMD status error */ |
| 118 | }; |
| 119 | |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 120 | #ifdef CONFIG_FSL_LSCH3 |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 121 | void fsl_lsch3_early_init_f(void); |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 122 | #elif defined(CONFIG_FSL_LSCH2) |
| 123 | void fsl_lsch2_early_init_f(void); |
Hou Zhiqiang | 4ad5999 | 2016-12-09 16:09:00 +0800 | [diff] [blame] | 124 | int setup_chip_volt(void); |
| 125 | /* Setup core vdd in unit mV */ |
| 126 | int board_setup_core_volt(u32 vdd); |
Mingkai Hu | e4e93ea | 2015-10-26 19:47:51 +0800 | [diff] [blame] | 127 | #endif |
| 128 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 129 | void cpu_name(char *name); |
Prabhakar Kushwaha | 22cfe96 | 2015-11-05 12:00:14 +0530 | [diff] [blame] | 130 | #ifdef CONFIG_SYS_FSL_ERRATUM_A009635 |
| 131 | void erratum_a009635(void); |
| 132 | #endif |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 133 | |
Hou Zhiqiang | 4b23ca8 | 2016-08-02 19:03:27 +0800 | [diff] [blame] | 134 | #ifdef CONFIG_SYS_FSL_ERRATUM_A010315 |
| 135 | void erratum_a010315(void); |
| 136 | #endif |
| 137 | |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 138 | bool soc_has_dp_ddr(void); |
| 139 | bool soc_has_aiop(void); |
Priyanka Jain | 3d31ec7 | 2016-11-17 12:29:52 +0530 | [diff] [blame] | 140 | #endif |
Simon Glass | 89e0a3a | 2017-05-17 08:23:10 -0600 | [diff] [blame] | 141 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 142 | #endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */ |