cpu.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 MBUS_PCI_MEM_BASE 0xE8000000
  59. #define MBUS_PCI_MEM_SIZE (128 << 20)
  60. #define MBUS_PCI_IO_BASE 0xF1100000
  61. #define MBUS_PCI_IO_SIZE (64 << 10)
  62. #define MBUS_SPI_BASE 0xF4000000
  63. #define MBUS_SPI_SIZE (8 << 20)
  64. #define MBUS_BOOTROM_BASE 0xF8000000
  65. #define MBUS_BOOTROM_SIZE (8 << 20)
  66. struct mbus_win {
  67. u32 base;
  68. u32 size;
  69. u8 target;
  70. u8 attr;
  71. };
  72. /*
  73. * System registers
  74. * Ref: Datasheet sec:A.28
  75. */
  76. struct mvebu_system_registers {
  77. u8 pad1[0x60];
  78. u32 rstoutn_mask; /* 0x60 */
  79. u32 sys_soft_rst; /* 0x64 */
  80. };
  81. /*
  82. * GPIO Registers
  83. * Ref: Datasheet sec:A.19
  84. */
  85. struct kwgpio_registers {
  86. u32 dout;
  87. u32 oe;
  88. u32 blink_en;
  89. u32 din_pol;
  90. u32 din;
  91. u32 irq_cause;
  92. u32 irq_mask;
  93. u32 irq_level;
  94. };
  95. /* Needed for dynamic (board-specific) mbus configuration */
  96. extern struct mvebu_mbus_state mbus_state;
  97. /*
  98. * functions
  99. */
  100. unsigned int mvebu_sdram_bar(enum memory_bank bank);
  101. unsigned int mvebu_sdram_bs(enum memory_bank bank);
  102. void mvebu_sdram_size_adjust(enum memory_bank bank);
  103. int mvebu_mbus_probe(struct mbus_win windows[], int count);
  104. int mvebu_soc_family(void);
  105. u32 mvebu_get_nand_clock(void);
  106. void return_to_bootrom(void);
  107. int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks);
  108. /*
  109. * Highspeed SERDES PHY config init, ported from bin_hdr
  110. * to mainline U-Boot
  111. */
  112. int serdes_phy_config(void);
  113. /*
  114. * DDR3 init / training code ported from Marvell bin_hdr. Now
  115. * available in mainline U-Boot in:
  116. * drivers/ddr/marvell
  117. */
  118. int ddr3_init(void);
  119. #endif /* __ASSEMBLY__ */
  120. #endif /* _MVEBU_CPU_H */