blob: bd41df1be4416ab9c9fa1a569211dc872bd1cf61 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Mingkai Hu0e58b512015-10-26 19:47:50 +08002/*
Wasim Khan2caa3882021-01-13 12:01:23 +01003 * Copyright 2017-2021 NXP
Mingkai Hu0e58b512015-10-26 19:47:50 +08004 * Copyright 2015 Freescale Semiconductor
Mingkai Hu0e58b512015-10-26 19:47:50 +08005 */
6
7#ifndef _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
8#define _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_
9
Simon Glass89e0a3a2017-05-17 08:23:10 -060010#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
Hou Zhiqiang337644c2021-01-29 12:47:05 +080019#include <asm/arch/svr.h>
Simon Glass89e0a3a2017-05-17 08:23:10 -060020
Mingkai Hu0e58b512015-10-26 19:47:50 +080021#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 Wang250d9d02017-09-04 18:46:47 +080032#define scfg_clrbits32(addr, clear) clrbits_le32(addr, clear)
33#define scfg_clrsetbits32(addr, clear, set) clrsetbits_le32(addr, clear, set)
Mingkai Hu0e58b512015-10-26 19:47:50 +080034#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 Wang250d9d02017-09-04 18:46:47 +080037#define scfg_clrbits32(addr, clear) clrbits_be32(addr, clear)
38#define scfg_clrsetbits32(addr, clear, set) clrsetbits_be32(addr, clear, set)
Mingkai Hu0e58b512015-10-26 19:47:50 +080039#endif
40
Mingkai Hu19218992015-11-11 17:58:34 +080041#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 Jain3d31ec72016-11-17 12:29:52 +053048#ifndef __ASSEMBLY__
Mingkai Hu0e58b512015-10-26 19:47:50 +080049struct 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)}
Rajesh Bhagat583da8b2018-11-05 18:01:42 +000057
58#ifdef CONFIG_TFABOOT
Rajesh Bhagat1dde2d22018-11-05 18:01:58 +000059#define SMC_DRAM_BANK_INFO (0xC200FF12)
York Sun8f3f4ef2018-11-05 18:02:09 +000060#define SIP_SVC_RCW 0xC200FF18
Rajesh Bhagat1dde2d22018-11-05 18:01:58 +000061
62phys_size_t tfa_get_dram_size(void);
63
Rajesh Bhagat583da8b2018-11-05 18:01:42 +000064enum boot_src {
65 BOOT_SOURCE_RESERVED = 0,
66 BOOT_SOURCE_IFC_NOR,
67 BOOT_SOURCE_IFC_NAND,
68 BOOT_SOURCE_QSPI_NOR,
69 BOOT_SOURCE_QSPI_NAND,
70 BOOT_SOURCE_XSPI_NOR,
71 BOOT_SOURCE_XSPI_NAND,
72 BOOT_SOURCE_SD_MMC,
73 BOOT_SOURCE_SD_MMC2,
74 BOOT_SOURCE_I2C1_EXTENDED,
75};
76
77enum boot_src get_boot_src(void);
78#endif
Priyanka Jain3d31ec72016-11-17 12:29:52 +053079#endif
Mingkai Hu0e58b512015-10-26 19:47:50 +080080#define SVR_WO_E 0xFFFFFE
Mingkai Hu0e58b512015-10-26 19:47:50 +080081
82#define SVR_MAJ(svr) (((svr) >> 4) & 0xf)
83#define SVR_MIN(svr) (((svr) >> 0) & 0xf)
Wenbin Songa8f57a92017-01-17 18:31:15 +080084#define SVR_REV(svr) (((svr) >> 0) & 0xff)
Mingkai Hu0e58b512015-10-26 19:47:50 +080085#define IS_E_PROCESSOR(svr) (!((svr >> 8) & 0x1))
Meenakshi Aggarwalccb5d5d2020-10-29 19:16:16 +053086#if defined(CONFIG_ARCH_LX2160A) || defined(CONFIG_ARCH_LX2162A)
Priyanka Jainef76b2e2018-10-29 09:17:09 +000087#define IS_C_PROCESSOR(svr) (!((svr >> 12) & 0x1))
Wasim Khan2caa3882021-01-13 12:01:23 +010088#define SVR_WO_CE 0xFFFFEE
89#define SVR_SOC_VER(svr) (((svr) >> 8) & SVR_WO_CE)
90#else
91#define SVR_SOC_VER(svr) (((svr) >> 8) & SVR_WO_E)
Priyanka Jainef76b2e2018-10-29 09:17:09 +000092#endif
Yuantian Tang044719b2019-10-10 17:19:37 +080093#ifdef CONFIG_ARCH_LS1028A
94#define IS_MULTIMEDIA_EN(svr) (!((svr >> 10) & 0x1))
95#endif
Sriram Dash9282d262016-06-13 09:58:32 +053096#define IS_SVR_REV(svr, maj, min) \
97 ((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min)))
Wenbin song5d8a61c2017-12-04 12:18:28 +080098#define SVR_DEV(svr) ((svr) >> 8)
99#define IS_SVR_DEV(svr, dev) (((svr) >> 16) == (dev))
Mingkai Hu0e58b512015-10-26 19:47:50 +0800100
Priyanka Jain3d31ec72016-11-17 12:29:52 +0530101#ifndef __ASSEMBLY__
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800102#ifdef CONFIG_FSL_LSCH3
Mingkai Hu0e58b512015-10-26 19:47:50 +0800103void fsl_lsch3_early_init_f(void);
Rajesh Bhagat814e0772018-01-17 16:13:00 +0530104int get_core_volt_from_fuse(void);
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800105#elif defined(CONFIG_FSL_LSCH2)
106void fsl_lsch2_early_init_f(void);
Hou Zhiqiang4ad59992016-12-09 16:09:00 +0800107int setup_chip_volt(void);
108/* Setup core vdd in unit mV */
109int board_setup_core_volt(u32 vdd);
Calvin Johnson6d6ef012018-03-08 15:30:33 +0530110#ifdef CONFIG_FSL_PFE
111void init_pfe_scfg_dcfg_regs(void);
112#endif
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800113#endif
York Sunbb7d3422018-06-26 14:48:28 -0700114#ifdef CONFIG_QSPI_AHB_INIT
115int qspi_ahb_init(void);
116#endif
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800117
Kuldeep Singh34aafb02019-11-21 17:15:17 +0530118#ifdef CONFIG_FSPI_AHB_EN_4BYTE
119#define SYS_NXP_FSPI_LUTCR_LOCK 0x00000001
120#define SYS_NXP_FSPI_LUTCR_UNLOCK 0x00000002
121#define SYS_NXP_FSPI_LUTKEY 0x5AF05AF0
122int fspi_ahb_init(void);
123#endif
124
Mingkai Hu0e58b512015-10-26 19:47:50 +0800125void cpu_name(char *name);
Prabhakar Kushwaha22cfe962015-11-05 12:00:14 +0530126#ifdef CONFIG_SYS_FSL_ERRATUM_A009635
127void erratum_a009635(void);
128#endif
York Suncbe8e1c2016-04-04 11:41:26 -0700129
Hou Zhiqiang4b23ca82016-08-02 19:03:27 +0800130#ifdef CONFIG_SYS_FSL_ERRATUM_A010315
131void erratum_a010315(void);
132#endif
133
York Suncbe8e1c2016-04-04 11:41:26 -0700134bool soc_has_dp_ddr(void);
135bool soc_has_aiop(void);
Hou Zhiqiang031bb872020-04-28 10:19:32 +0800136
137#ifdef CONFIG_GIC_V3_ITS
138int ls_gic_rd_tables_init(void *blob);
139#endif
Priyanka Jain3d31ec72016-11-17 12:29:52 +0530140#endif
Simon Glass89e0a3a2017-05-17 08:23:10 -0600141
Mingkai Hu0e58b512015-10-26 19:47:50 +0800142#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */