blob: 9a219a6a1d55ad5ff30f51e0ede51a7dc6a00161 [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/*
Priyanka Jain2b361782017-04-27 15:08:06 +05303 * Copyright 2017 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
19
Mingkai Hu0e58b512015-10-26 19:47:50 +080020#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 Wang250d9d02017-09-04 18:46:47 +080031#define scfg_clrbits32(addr, clear) clrbits_le32(addr, clear)
32#define scfg_clrsetbits32(addr, clear, set) clrsetbits_le32(addr, clear, set)
Mingkai Hu0e58b512015-10-26 19:47:50 +080033#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 Wang250d9d02017-09-04 18:46:47 +080036#define scfg_clrbits32(addr, clear) clrbits_be32(addr, clear)
37#define scfg_clrsetbits32(addr, clear, set) clrsetbits_be32(addr, clear, set)
Mingkai Hu0e58b512015-10-26 19:47:50 +080038#endif
39
Mingkai Hu19218992015-11-11 17:58:34 +080040#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 Jain3d31ec72016-11-17 12:29:52 +053047#ifndef __ASSEMBLY__
Mingkai Hu0e58b512015-10-26 19:47:50 +080048struct 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)}
Priyanka Jain3d31ec72016-11-17 12:29:52 +053056#endif
Mingkai Hu0e58b512015-10-26 19:47:50 +080057#define SVR_WO_E 0xFFFFFE
Prabhakar Kushwahaac7f2422016-06-24 13:48:13 +053058#define SVR_LS1012A 0x870400
59#define SVR_LS1043A 0x879200
60#define SVR_LS1023A 0x879208
Mingkai Hucd54c0f2016-07-05 16:01:55 +080061#define SVR_LS1046A 0x870700
62#define SVR_LS1026A 0x870708
Ashish Kumarb25faa22017-08-31 16:12:53 +053063#define SVR_LS1048A 0x870320
64#define SVR_LS1084A 0x870302
65#define SVR_LS1088A 0x870300
66#define SVR_LS1044A 0x870322
Prabhakar Kushwahaac7f2422016-06-24 13:48:13 +053067#define SVR_LS2045A 0x870120
68#define SVR_LS2080A 0x870110
69#define SVR_LS2085A 0x870100
70#define SVR_LS2040A 0x870130
Priyanka Jain4a6f1732016-11-17 12:29:55 +053071#define SVR_LS2088A 0x870900
72#define SVR_LS2084A 0x870910
73#define SVR_LS2048A 0x870920
74#define SVR_LS2044A 0x870930
Santan Kumarccb56a82017-06-09 11:48:08 +053075#define SVR_LS2081A 0x870918
76#define SVR_LS2041A 0x870914
Mingkai Hu0e58b512015-10-26 19:47:50 +080077
78#define SVR_MAJ(svr) (((svr) >> 4) & 0xf)
79#define SVR_MIN(svr) (((svr) >> 0) & 0xf)
Wenbin Songa8f57a92017-01-17 18:31:15 +080080#define SVR_REV(svr) (((svr) >> 0) & 0xff)
Mingkai Hu0e58b512015-10-26 19:47:50 +080081#define SVR_SOC_VER(svr) (((svr) >> 8) & SVR_WO_E)
82#define IS_E_PROCESSOR(svr) (!((svr >> 8) & 0x1))
Sriram Dash9282d262016-06-13 09:58:32 +053083#define IS_SVR_REV(svr, maj, min) \
84 ((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min)))
Wenbin song5d8a61c2017-12-04 12:18:28 +080085#define SVR_DEV(svr) ((svr) >> 8)
86#define IS_SVR_DEV(svr, dev) (((svr) >> 16) == (dev))
Mingkai Hu0e58b512015-10-26 19:47:50 +080087
Tang Yuantian57894be2015-12-09 15:32:18 +080088/* ahci port register default value */
89#define AHCI_PORT_PHY_1_CFG 0xa003fffe
Yuantian Tang28859cb2017-12-11 13:12:09 +080090#define AHCI_PORT_PHY2_CFG 0x28184d1f
91#define AHCI_PORT_PHY3_CFG 0x0e081509
Tang Yuantian57894be2015-12-09 15:32:18 +080092#define AHCI_PORT_TRANS_CFG 0x08000029
Tang Yuantian2945ae02016-08-08 15:07:20 +080093#define AHCI_PORT_AXICC_CFG 0x3fffffff
Tang Yuantian57894be2015-12-09 15:32:18 +080094
Priyanka Jain3d31ec72016-11-17 12:29:52 +053095#ifndef __ASSEMBLY__
Tang Yuantian57894be2015-12-09 15:32:18 +080096/* AHCI (sata) register map */
97struct ccsr_ahci {
98 u32 res1[0xa4/4]; /* 0x0 - 0xa4 */
99 u32 pcfg; /* port config */
100 u32 ppcfg; /* port phy1 config */
101 u32 pp2c; /* port phy2 config */
102 u32 pp3c; /* port phy3 config */
103 u32 pp4c; /* port phy4 config */
104 u32 pp5c; /* port phy5 config */
105 u32 axicc; /* AXI cache control */
106 u32 paxic; /* port AXI config */
107 u32 axipc; /* AXI PROT control */
108 u32 ptc; /* port Trans Config */
109 u32 pts; /* port Trans Status */
110 u32 plc; /* port link config */
111 u32 plc1; /* port link config1 */
112 u32 plc2; /* port link config2 */
113 u32 pls; /* port link status */
114 u32 pls1; /* port link status1 */
115 u32 pcmdc; /* port CMD config */
116 u32 ppcs; /* port phy control status */
117 u32 pberr; /* port 0/1 BIST error */
118 u32 cmds; /* port 0/1 CMD status error */
119};
120
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800121#ifdef CONFIG_FSL_LSCH3
Mingkai Hu0e58b512015-10-26 19:47:50 +0800122void fsl_lsch3_early_init_f(void);
Rajesh Bhagat814e0772018-01-17 16:13:00 +0530123int get_core_volt_from_fuse(void);
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800124#elif defined(CONFIG_FSL_LSCH2)
125void fsl_lsch2_early_init_f(void);
Hou Zhiqiang4ad59992016-12-09 16:09:00 +0800126int setup_chip_volt(void);
127/* Setup core vdd in unit mV */
128int board_setup_core_volt(u32 vdd);
Calvin Johnson6d6ef012018-03-08 15:30:33 +0530129#ifdef CONFIG_FSL_PFE
130void init_pfe_scfg_dcfg_regs(void);
131#endif
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800132#endif
133
Mingkai Hu0e58b512015-10-26 19:47:50 +0800134void cpu_name(char *name);
Prabhakar Kushwaha22cfe962015-11-05 12:00:14 +0530135#ifdef CONFIG_SYS_FSL_ERRATUM_A009635
136void erratum_a009635(void);
137#endif
York Suncbe8e1c2016-04-04 11:41:26 -0700138
Hou Zhiqiang4b23ca82016-08-02 19:03:27 +0800139#ifdef CONFIG_SYS_FSL_ERRATUM_A010315
140void erratum_a010315(void);
141#endif
142
York Suncbe8e1c2016-04-04 11:41:26 -0700143bool soc_has_dp_ddr(void);
144bool soc_has_aiop(void);
Priyanka Jain3d31ec72016-11-17 12:29:52 +0530145#endif
Simon Glass89e0a3a2017-05-17 08:23:10 -0600146
Mingkai Hu0e58b512015-10-26 19:47:50 +0800147#endif /* _ASM_ARMV8_FSL_LAYERSCAPE_SOC_H_ */