immap_ls102xa.h 12 KB

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