soc.h 4.2 KB

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