immap_ls102xa.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. /*
  2. * Copyright 2014 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __ASM_ARCH_LS102XA_IMMAP_H_
  7. #define __ASM_ARCH_LS102XA_IMMAP_H_
  8. #include <fsl_immap.h>
  9. #define SVR_MAJ(svr) (((svr) >> 4) & 0xf)
  10. #define SVR_MIN(svr) (((svr) >> 0) & 0xf)
  11. #define SVR_SOC_VER(svr) (((svr) >> 8) & 0x7ff)
  12. #define IS_E_PROCESSOR(svr) (svr & 0x80000)
  13. #define IS_SVR_REV(svr, maj, min) \
  14. ((SVR_MAJ(svr) == maj) && (SVR_MIN(svr) == min))
  15. #define SOC_VER_SLS1020 0x00
  16. #define SOC_VER_LS1020 0x10
  17. #define SOC_VER_LS1021 0x11
  18. #define SOC_VER_LS1022 0x12
  19. #define SOC_MAJOR_VER_1_0 0x1
  20. #define SOC_MAJOR_VER_2_0 0x2
  21. #define CCSR_BRR_OFFSET 0xe4
  22. #define CCSR_SCRATCHRW1_OFFSET 0x200
  23. #define RCWSR0_SYS_PLL_RAT_SHIFT 25
  24. #define RCWSR0_SYS_PLL_RAT_MASK 0x1f
  25. #define RCWSR0_MEM_PLL_RAT_SHIFT 16
  26. #define RCWSR0_MEM_PLL_RAT_MASK 0x3f
  27. #define RCWSR4_SRDS1_PRTCL_SHIFT 24
  28. #define RCWSR4_SRDS1_PRTCL_MASK 0xff000000
  29. #define TIMER_COMP_VAL 0xffffffffffffffffull
  30. #define ARCH_TIMER_CTRL_ENABLE (1 << 0)
  31. #define SYS_COUNTER_CTRL_ENABLE (1 << 24)
  32. #define DCFG_CCSR_PORSR1_RCW_MASK 0xff800000
  33. #define DCFG_CCSR_PORSR1_RCW_SRC_I2C 0x24800000
  34. #define DCFG_DCSR_PORCR1 0
  35. /*
  36. * Define default values for some CCSR macros to make header files cleaner
  37. *
  38. * To completely disable CCSR relocation in a board header file, define
  39. * CONFIG_SYS_CCSR_DO_NOT_RELOCATE. This will force CONFIG_SYS_CCSRBAR_PHYS
  40. * to a value that is the same as CONFIG_SYS_CCSRBAR.
  41. */
  42. #ifdef CONFIG_SYS_CCSRBAR_PHYS
  43. #error "Do not define CONFIG_SYS_CCSRBAR_PHYS directly."
  44. #endif
  45. #ifdef CONFIG_SYS_CCSR_DO_NOT_RELOCATE
  46. #undef CONFIG_SYS_CCSRBAR_PHYS_HIGH
  47. #undef CONFIG_SYS_CCSRBAR_PHYS_LOW
  48. #define CONFIG_SYS_CCSRBAR_PHYS_HIGH 0
  49. #endif
  50. #ifndef CONFIG_SYS_CCSRBAR
  51. #define CONFIG_SYS_CCSRBAR CONFIG_SYS_IMMR
  52. #endif
  53. #ifndef CONFIG_SYS_CCSRBAR_PHYS_HIGH
  54. #ifdef CONFIG_PHYS_64BIT
  55. #define CONFIG_SYS_CCSRBAR_PHYS_HIGH 0xf
  56. #else
  57. #define CONFIG_SYS_CCSRBAR_PHYS_HIGH 0
  58. #endif
  59. #endif
  60. #ifndef CONFIG_SYS_CCSRBAR_PHYS_LOW
  61. #define CONFIG_SYS_CCSRBAR_PHYS_LOW CONFIG_SYS_IMMR
  62. #endif
  63. #define CONFIG_SYS_CCSRBAR_PHYS ((CONFIG_SYS_CCSRBAR_PHYS_HIGH * 1ull) << 32 | \
  64. CONFIG_SYS_CCSRBAR_PHYS_LOW)
  65. struct sys_info {
  66. unsigned long freq_processor[CONFIG_MAX_CPUS];
  67. unsigned long freq_systembus;
  68. unsigned long freq_ddrbus;
  69. unsigned long freq_localbus;
  70. };
  71. /* Device Configuration and Pin Control */
  72. struct ccsr_gur {
  73. u32 porsr1; /* POR status 1 */
  74. u32 porsr2; /* POR status 2 */
  75. u8 res_008[0x20-0x8];
  76. u32 gpporcr1; /* General-purpose POR configuration */
  77. u32 gpporcr2;
  78. u32 dcfg_fusesr; /* Fuse status register */
  79. u8 res_02c[0x70-0x2c];
  80. u32 devdisr; /* Device disable control */
  81. u32 devdisr2; /* Device disable control 2 */
  82. u32 devdisr3; /* Device disable control 3 */
  83. u32 devdisr4; /* Device disable control 4 */
  84. u32 devdisr5; /* Device disable control 5 */
  85. u8 res_084[0x94-0x84];
  86. u32 coredisru; /* uppper portion for support of 64 cores */
  87. u32 coredisrl; /* lower portion for support of 64 cores */
  88. u8 res_09c[0xa4-0x9c];
  89. u32 svr; /* System version */
  90. u8 res_0a8[0xb0-0xa8];
  91. u32 rstcr; /* Reset control */
  92. u32 rstrqpblsr; /* Reset request preboot loader status */
  93. u8 res_0b8[0xc0-0xb8];
  94. u32 rstrqmr1; /* Reset request mask */
  95. u8 res_0c4[0xc8-0xc4];
  96. u32 rstrqsr1; /* Reset request status */
  97. u8 res_0cc[0xd4-0xcc];
  98. u32 rstrqwdtmrl; /* Reset request WDT mask */
  99. u8 res_0d8[0xdc-0xd8];
  100. u32 rstrqwdtsrl; /* Reset request WDT status */
  101. u8 res_0e0[0xe4-0xe0];
  102. u32 brrl; /* Boot release */
  103. u8 res_0e8[0x100-0xe8];
  104. u32 rcwsr[16]; /* Reset control word status */
  105. #define RCW_SB_EN_REG_INDEX 7
  106. #define RCW_SB_EN_MASK 0x00200000
  107. u8 res_140[0x200-0x140];
  108. u32 scratchrw[4]; /* Scratch Read/Write */
  109. u8 res_210[0x300-0x210];
  110. u32 scratchw1r[4]; /* Scratch Read (Write once) */
  111. u8 res_310[0x400-0x310];
  112. u32 crstsr;
  113. u8 res_404[0x550-0x404];
  114. u32 sataliodnr;
  115. u8 res_554[0x604-0x554];
  116. u32 pamubypenr;
  117. u32 dmacr1;
  118. u8 res_60c[0x740-0x60c]; /* add more registers when needed */
  119. u32 tp_ityp[64]; /* Topology Initiator Type Register */
  120. struct {
  121. u32 upper;
  122. u32 lower;
  123. } tp_cluster[1]; /* Core Cluster n Topology Register */
  124. u8 res_848[0xe60-0x848];
  125. u32 ddrclkdr;
  126. u8 res_e60[0xe68-0xe64];
  127. u32 ifcclkdr;
  128. u8 res_e68[0xe80-0xe6c];
  129. u32 sdhcpcr;
  130. };
  131. #define SCFG_ETSECDMAMCR_LE_BD_FR 0x00000c00
  132. #define SCFG_SNPCNFGCR_SEC_RD_WR 0xc0000000
  133. #define SCFG_ETSECCMCR_GE2_CLK125 0x04000000
  134. #define SCFG_ETSECCMCR_GE0_CLK125 0x00000000
  135. #define SCFG_ETSECCMCR_GE1_CLK125 0x08000000
  136. #define SCFG_PIXCLKCR_PXCKEN 0x80000000
  137. #define SCFG_QSPI_CLKSEL 0xc0100000
  138. #define SCFG_SNPCNFGCR_SEC_RD_WR 0xc0000000
  139. #define SCFG_SNPCNFGCR_DCU_RD_WR 0x03000000
  140. #define SCFG_SNPCNFGCR_SATA_RD_WR 0x00c00000
  141. #define SCFG_SNPCNFGCR_USB3_RD_WR 0x00300000
  142. #define SCFG_SNPCNFGCR_DBG_RD_WR 0x000c0000
  143. #define SCFG_SNPCNFGCR_EDMA_SNP 0x00020000
  144. #define SCFG_ENDIANCR_LE 0x80000000
  145. #define SCFG_DPSLPCR_WDRR_EN 0x00000001
  146. #define SCFG_PMCINTECR_LPUART 0x40000000
  147. #define SCFG_PMCINTECR_FTM 0x20000000
  148. #define SCFG_PMCINTECR_GPIO 0x10000000
  149. #define SCFG_PMCINTECR_IRQ0 0x08000000
  150. #define SCFG_PMCINTECR_IRQ1 0x04000000
  151. #define SCFG_PMCINTECR_ETSECRXG0 0x00800000
  152. #define SCFG_PMCINTECR_ETSECRXG1 0x00400000
  153. #define SCFG_PMCINTECR_ETSECERRG0 0x00080000
  154. #define SCFG_PMCINTECR_ETSECERRG1 0x00040000
  155. #define SCFG_CLUSTERPMCR_WFIL2EN 0x80000000
  156. #define SCFG_BASE 0x01570000
  157. #define SCFG_USB3PRM1CR 0x070
  158. #define SCFG_USB_TXVREFTUNE 0x9
  159. #define SCFG_USB_SQRXTUNE_MASK 0x7
  160. /* Supplemental Configuration Unit */
  161. struct ccsr_scfg {
  162. u32 dpslpcr;
  163. u32 resv0[2];
  164. u32 etsecclkdpslpcr;
  165. u32 resv1[5];
  166. u32 fuseovrdcr;
  167. u32 pixclkcr;
  168. u32 resv2[5];
  169. u32 spimsicr;
  170. u32 resv3[6];
  171. u32 pex1pmwrcr;
  172. u32 pex1pmrdsr;
  173. u32 resv4[3];
  174. u32 usb3prm1cr;
  175. u32 usb4prm2cr;
  176. u32 pex1rdmsgpldlsbsr;
  177. u32 pex1rdmsgpldmsbsr;
  178. u32 pex2rdmsgpldlsbsr;
  179. u32 pex2rdmsgpldmsbsr;
  180. u32 pex1rdmmsgrqsr;
  181. u32 pex2rdmmsgrqsr;
  182. u32 spimsiclrcr;
  183. u32 pexmscportsr[2];
  184. u32 pex2pmwrcr;
  185. u32 resv5[24];
  186. u32 mac1_streamid;
  187. u32 mac2_streamid;
  188. u32 mac3_streamid;
  189. u32 pex1_streamid;
  190. u32 pex2_streamid;
  191. u32 dma_streamid;
  192. u32 sata_streamid;
  193. u32 usb3_streamid;
  194. u32 qe_streamid;
  195. u32 sdhc_streamid;
  196. u32 adma_streamid;
  197. u32 letechsftrstcr;
  198. u32 core0_sft_rst;
  199. u32 core1_sft_rst;
  200. u32 resv6[1];
  201. u32 usb_hi_addr;
  202. u32 etsecclkadjcr;
  203. u32 sai_clk;
  204. u32 resv7[1];
  205. u32 dcu_streamid;
  206. u32 usb2_streamid;
  207. u32 ftm_reset;
  208. u32 altcbar;
  209. u32 qspi_cfg;
  210. u32 pmcintecr;
  211. u32 pmcintlecr;
  212. u32 pmcintsr;
  213. u32 qos1;
  214. u32 qos2;
  215. u32 qos3;
  216. u32 cci_cfg;
  217. u32 endiancr;
  218. u32 etsecdmamcr;
  219. u32 usb3prm3cr;
  220. u32 resv9[1];
  221. u32 debug_streamid;
  222. u32 resv10[5];
  223. u32 snpcnfgcr;
  224. u32 hrstcr;
  225. u32 intpcr;
  226. u32 resv12[20];
  227. u32 scfgrevcr;
  228. u32 coresrencr;
  229. u32 pex2pmrdsr;
  230. u32 eddrtqcfg;
  231. u32 ddrc2cr;
  232. u32 ddrc3cr;
  233. u32 ddrc4cr;
  234. u32 ddrgcr;
  235. u32 resv13[120];
  236. u32 qeioclkcr;
  237. u32 etsecmcr;
  238. u32 sdhciovserlcr;
  239. u32 resv14[61];
  240. u32 sparecr[8];
  241. u32 resv15[248];
  242. u32 core0sftrstsr;
  243. u32 clusterpmcr;
  244. };
  245. /* Clocking */
  246. struct ccsr_clk {
  247. struct {
  248. u32 clkcncsr; /* core cluster n clock control status */
  249. u8 res_004[0x1c];
  250. } clkcsr[2];
  251. u8 res_040[0x7c0]; /* 0x100 */
  252. struct {
  253. u32 pllcngsr;
  254. u8 res_804[0x1c];
  255. } pllcgsr[2];
  256. u8 res_840[0x1c0];
  257. u32 clkpcsr; /* 0xa00 Platform clock domain control/status */
  258. u8 res_a04[0x1fc];
  259. u32 pllpgsr; /* 0xc00 Platform PLL General Status */
  260. u8 res_c04[0x1c];
  261. u32 plldgsr; /* 0xc20 DDR PLL General Status */
  262. u8 res_c24[0x3dc];
  263. };
  264. /* System Counter */
  265. struct sctr_regs {
  266. u32 cntcr;
  267. u32 cntsr;
  268. u32 cntcv1;
  269. u32 cntcv2;
  270. u32 resv1[4];
  271. u32 cntfid0;
  272. u32 cntfid1;
  273. u32 resv2[1002];
  274. u32 counterid[12];
  275. };
  276. #define MAX_SERDES 1
  277. #define SRDS_MAX_LANES 4
  278. #define SRDS_MAX_BANK 2
  279. #define SRDS_RSTCTL_RST 0x80000000
  280. #define SRDS_RSTCTL_RSTDONE 0x40000000
  281. #define SRDS_RSTCTL_RSTERR 0x20000000
  282. #define SRDS_RSTCTL_SWRST 0x10000000
  283. #define SRDS_RSTCTL_SDEN 0x00000020
  284. #define SRDS_RSTCTL_SDRST_B 0x00000040
  285. #define SRDS_RSTCTL_PLLRST_B 0x00000080
  286. #define SRDS_PLLCR0_POFF 0x80000000
  287. #define SRDS_PLLCR0_RFCK_SEL_MASK 0x70000000
  288. #define SRDS_PLLCR0_RFCK_SEL_100 0x00000000
  289. #define SRDS_PLLCR0_RFCK_SEL_125 0x10000000
  290. #define SRDS_PLLCR0_RFCK_SEL_156_25 0x20000000
  291. #define SRDS_PLLCR0_RFCK_SEL_150 0x30000000
  292. #define SRDS_PLLCR0_RFCK_SEL_161_13 0x40000000
  293. #define SRDS_PLLCR0_RFCK_SEL_122_88 0x50000000
  294. #define SRDS_PLLCR0_PLL_LCK 0x00800000
  295. #define SRDS_PLLCR0_FRATE_SEL_MASK 0x000f0000
  296. #define SRDS_PLLCR0_FRATE_SEL_5 0x00000000
  297. #define SRDS_PLLCR0_FRATE_SEL_3_75 0x00050000
  298. #define SRDS_PLLCR0_FRATE_SEL_5_15 0x00060000
  299. #define SRDS_PLLCR0_FRATE_SEL_4 0x00070000
  300. #define SRDS_PLLCR0_FRATE_SEL_3_12 0x00090000
  301. #define SRDS_PLLCR0_FRATE_SEL_3 0x000a0000
  302. #define SRDS_PLLCR1_PLL_BWSEL 0x08000000
  303. struct ccsr_serdes {
  304. struct {
  305. u32 rstctl; /* Reset Control Register */
  306. u32 pllcr0; /* PLL Control Register 0 */
  307. u32 pllcr1; /* PLL Control Register 1 */
  308. u32 res_0c; /* 0x00c */
  309. u32 pllcr3;
  310. u32 pllcr4;
  311. u8 res_18[0x20-0x18];
  312. } bank[2];
  313. u8 res_40[0x90-0x40];
  314. u32 srdstcalcr; /* 0x90 TX Calibration Control */
  315. u8 res_94[0xa0-0x94];
  316. u32 srdsrcalcr; /* 0xa0 RX Calibration Control */
  317. u8 res_a4[0xb0-0xa4];
  318. u32 srdsgr0; /* 0xb0 General Register 0 */
  319. u8 res_b4[0xe0-0xb4];
  320. u32 srdspccr0; /* 0xe0 Protocol Converter Config 0 */
  321. u32 srdspccr1; /* 0xe4 Protocol Converter Config 1 */
  322. u32 srdspccr2; /* 0xe8 Protocol Converter Config 2 */
  323. u32 srdspccr3; /* 0xec Protocol Converter Config 3 */
  324. u32 srdspccr4; /* 0xf0 Protocol Converter Config 4 */
  325. u8 res_f4[0x100-0xf4];
  326. struct {
  327. u32 lnpssr; /* 0x100, 0x120, ..., 0x1e0 */
  328. u8 res_104[0x120-0x104];
  329. } srdslnpssr[4];
  330. u8 res_180[0x300-0x180];
  331. u32 srdspexeqcr;
  332. u32 srdspexeqpcr[11];
  333. u8 res_330[0x400-0x330];
  334. u32 srdspexapcr;
  335. u8 res_404[0x440-0x404];
  336. u32 srdspexbpcr;
  337. u8 res_444[0x800-0x444];
  338. struct {
  339. u32 gcr0; /* 0x800 General Control Register 0 */
  340. u32 gcr1; /* 0x804 General Control Register 1 */
  341. u32 gcr2; /* 0x808 General Control Register 2 */
  342. u32 sscr0;
  343. u32 recr0; /* 0x810 Receive Equalization Control */
  344. u32 recr1;
  345. u32 tecr0; /* 0x818 Transmit Equalization Control */
  346. u32 sscr1;
  347. u32 ttlcr0; /* 0x820 Transition Tracking Loop Ctrl 0 */
  348. u8 res_824[0x83c-0x824];
  349. u32 tcsr3;
  350. } lane[4]; /* Lane A, B, C, D, E, F, G, H */
  351. u8 res_a00[0x1000-0xa00]; /* from 0xa00 to 0xfff */
  352. };
  353. /* AHCI (sata) register map */
  354. struct ccsr_ahci {
  355. u32 res1[0xa4/4]; /* 0x0 - 0xa4 */
  356. u32 pcfg; /* port config */
  357. u32 ppcfg; /* port phy1 config */
  358. u32 pp2c; /* port phy2 config */
  359. u32 pp3c; /* port phy3 config */
  360. u32 pp4c; /* port phy4 config */
  361. u32 pp5c; /* port phy5 config */
  362. u32 paxic; /* port AXI config */
  363. u32 axicc; /* AXI cache control */
  364. u32 axipc; /* AXI PROT control */
  365. u32 ptc; /* port Trans Config */
  366. u32 pts; /* port Trans Status */
  367. u32 plc; /* port link config */
  368. u32 plc1; /* port link config1 */
  369. u32 plc2; /* port link config2 */
  370. u32 pls; /* port link status */
  371. u32 pls1; /* port link status1 */
  372. u32 pcmdc; /* port CMD config */
  373. u32 ppcs; /* port phy control status */
  374. u32 pberr; /* port 0/1 BIST error */
  375. u32 cmds; /* port 0/1 CMD status error */
  376. };
  377. #define RCPM_POWMGTCSR 0x130
  378. #define RCPM_POWMGTCSR_SERDES_PW 0x80000000
  379. #define RCPM_POWMGTCSR_LPM20_REQ 0x00100000
  380. #define RCPM_POWMGTCSR_LPM20_ST 0x00000200
  381. #define RCPM_POWMGTCSR_P_LPM20_ST 0x00000100
  382. #define RCPM_IPPDEXPCR0 0x140
  383. #define RCPM_IPPDEXPCR0_ETSEC 0x80000000
  384. #define RCPM_IPPDEXPCR0_GPIO 0x00000040
  385. #define RCPM_IPPDEXPCR1 0x144
  386. #define RCPM_IPPDEXPCR1_LPUART 0x40000000
  387. #define RCPM_IPPDEXPCR1_FLEXTIMER 0x20000000
  388. #define RCPM_IPPDEXPCR1_OCRAM1 0x10000000
  389. #define RCPM_NFIQOUTR 0x15c
  390. #define RCPM_NIRQOUTR 0x16c
  391. #define RCPM_DSIMSKR 0x18c
  392. #define RCPM_CLPCL10SETR 0x1c4
  393. #define RCPM_CLPCL10SETR_C0 0x00000001
  394. struct ccsr_rcpm {
  395. u8 rev1[0x4c];
  396. u32 twaitsr;
  397. u8 rev2[0xe0];
  398. u32 powmgtcsr;
  399. u8 rev3[0xc];
  400. u32 ippdexpcr0;
  401. u32 ippdexpcr1;
  402. u8 rev4[0x14];
  403. u32 nfiqoutr;
  404. u8 rev5[0xc];
  405. u32 nirqoutr;
  406. u8 rev6[0x1c];
  407. u32 dsimskr;
  408. u8 rev7[0x34];
  409. u32 clpcl10setr;
  410. };
  411. uint get_svr(void);
  412. #endif /* __ASM_ARCH_LS102XA_IMMAP_H_ */