cpu.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * (C) Copyright 2009
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef _MVEBU_CPU_H
  9. #define _MVEBU_CPU_H
  10. #include <asm/system.h>
  11. #ifndef __ASSEMBLY__
  12. #define MVEBU_REG_PCIE_DEVID (MVEBU_REG_PCIE_BASE + 0x00)
  13. #define MVEBU_REG_PCIE_REVID (MVEBU_REG_PCIE_BASE + 0x08)
  14. enum memory_bank {
  15. BANK0,
  16. BANK1,
  17. BANK2,
  18. BANK3
  19. };
  20. enum cpu_winen {
  21. CPU_WIN_DISABLE,
  22. CPU_WIN_ENABLE
  23. };
  24. enum cpu_target {
  25. CPU_TARGET_DRAM = 0x0,
  26. CPU_TARGET_DEVICEBUS_BOOTROM_SPI = 0x1,
  27. CPU_TARGET_ETH23 = 0x3,
  28. CPU_TARGET_PCIE02 = 0x4,
  29. CPU_TARGET_ETH01 = 0x7,
  30. CPU_TARGET_PCIE13 = 0x8,
  31. CPU_TARGET_SASRAM = 0x9,
  32. CPU_TARGET_NAND = 0xd,
  33. };
  34. enum cpu_attrib {
  35. CPU_ATTR_SASRAM = 0x01,
  36. CPU_ATTR_DRAM_CS0 = 0x0e,
  37. CPU_ATTR_DRAM_CS1 = 0x0d,
  38. CPU_ATTR_DRAM_CS2 = 0x0b,
  39. CPU_ATTR_DRAM_CS3 = 0x07,
  40. CPU_ATTR_NANDFLASH = 0x2f,
  41. CPU_ATTR_SPIFLASH = 0x1e,
  42. CPU_ATTR_BOOTROM = 0x1d,
  43. CPU_ATTR_PCIE_IO = 0xe0,
  44. CPU_ATTR_PCIE_MEM = 0xe8,
  45. CPU_ATTR_DEV_CS0 = 0x3e,
  46. CPU_ATTR_DEV_CS1 = 0x3d,
  47. CPU_ATTR_DEV_CS2 = 0x3b,
  48. CPU_ATTR_DEV_CS3 = 0x37,
  49. };
  50. enum {
  51. MVEBU_SOC_AXP,
  52. MVEBU_SOC_A38X,
  53. MVEBU_SOC_UNKNOWN,
  54. };
  55. /*
  56. * Default Device Address MAP BAR values
  57. */
  58. #define DEFADR_PCI_MEM 0x90000000
  59. #define DEFADR_PCI_IO 0xC0000000
  60. #define DEFADR_SPIF 0xF4000000
  61. #define DEFADR_BOOTROM 0xF8000000
  62. struct mbus_win {
  63. u32 base;
  64. u32 size;
  65. u8 target;
  66. u8 attr;
  67. };
  68. /*
  69. * System registers
  70. * Ref: Datasheet sec:A.28
  71. */
  72. struct mvebu_system_registers {
  73. u8 pad1[0x60];
  74. u32 rstoutn_mask; /* 0x60 */
  75. u32 sys_soft_rst; /* 0x64 */
  76. };
  77. /*
  78. * GPIO Registers
  79. * Ref: Datasheet sec:A.19
  80. */
  81. struct kwgpio_registers {
  82. u32 dout;
  83. u32 oe;
  84. u32 blink_en;
  85. u32 din_pol;
  86. u32 din;
  87. u32 irq_cause;
  88. u32 irq_mask;
  89. u32 irq_level;
  90. };
  91. /* Needed for dynamic (board-specific) mbus configuration */
  92. extern struct mvebu_mbus_state mbus_state;
  93. /*
  94. * functions
  95. */
  96. unsigned int mvebu_sdram_bar(enum memory_bank bank);
  97. unsigned int mvebu_sdram_bs(enum memory_bank bank);
  98. void mvebu_sdram_size_adjust(enum memory_bank bank);
  99. int mvebu_mbus_probe(struct mbus_win windows[], int count);
  100. int mvebu_soc_family(void);
  101. int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks);
  102. /*
  103. * Highspeed SERDES PHY config init, ported from bin_hdr
  104. * to mainline U-Boot
  105. */
  106. int serdes_phy_config(void);
  107. /*
  108. * DDR3 init / training code ported from Marvell bin_hdr. Now
  109. * available in mainline U-Boot in:
  110. * drivers/ddr/mvebu/
  111. */
  112. int ddr3_init(void);
  113. #endif /* __ASSEMBLY__ */
  114. #endif /* _MVEBU_CPU_H */