cpu.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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_SPI0_CS0 = 0x1e,
  43. CPU_ATTR_SPI0_CS1 = 0x5e,
  44. CPU_ATTR_SPI1_CS2 = 0x9a,
  45. CPU_ATTR_BOOTROM = 0x1d,
  46. CPU_ATTR_PCIE_IO = 0xe0,
  47. CPU_ATTR_PCIE_MEM = 0xe8,
  48. CPU_ATTR_DEV_CS0 = 0x3e,
  49. CPU_ATTR_DEV_CS1 = 0x3d,
  50. CPU_ATTR_DEV_CS2 = 0x3b,
  51. CPU_ATTR_DEV_CS3 = 0x37,
  52. };
  53. enum {
  54. MVEBU_SOC_AXP,
  55. MVEBU_SOC_A38X,
  56. MVEBU_SOC_UNKNOWN,
  57. };
  58. /*
  59. * Default Device Address MAP BAR values
  60. */
  61. #define MBUS_PCI_MEM_BASE 0xE8000000
  62. #define MBUS_PCI_MEM_SIZE (128 << 20)
  63. #define MBUS_PCI_IO_BASE 0xF1100000
  64. #define MBUS_PCI_IO_SIZE (64 << 10)
  65. #define MBUS_SPI_BASE 0xF4000000
  66. #define MBUS_SPI_SIZE (8 << 20)
  67. #define MBUS_BOOTROM_BASE 0xF8000000
  68. #define MBUS_BOOTROM_SIZE (8 << 20)
  69. struct mbus_win {
  70. u32 base;
  71. u32 size;
  72. u8 target;
  73. u8 attr;
  74. };
  75. /*
  76. * System registers
  77. * Ref: Datasheet sec:A.28
  78. */
  79. struct mvebu_system_registers {
  80. u8 pad1[0x60];
  81. u32 rstoutn_mask; /* 0x60 */
  82. u32 sys_soft_rst; /* 0x64 */
  83. };
  84. /*
  85. * GPIO Registers
  86. * Ref: Datasheet sec:A.19
  87. */
  88. struct kwgpio_registers {
  89. u32 dout;
  90. u32 oe;
  91. u32 blink_en;
  92. u32 din_pol;
  93. u32 din;
  94. u32 irq_cause;
  95. u32 irq_mask;
  96. u32 irq_level;
  97. };
  98. struct sar_freq_modes {
  99. u8 val;
  100. u8 ffc; /* Fabric Frequency Configuration */
  101. u32 p_clk;
  102. u32 nb_clk;
  103. u32 d_clk;
  104. };
  105. /* Needed for dynamic (board-specific) mbus configuration */
  106. extern struct mvebu_mbus_state mbus_state;
  107. /*
  108. * functions
  109. */
  110. unsigned int mvebu_sdram_bar(enum memory_bank bank);
  111. unsigned int mvebu_sdram_bs(enum memory_bank bank);
  112. void mvebu_sdram_size_adjust(enum memory_bank bank);
  113. int mvebu_mbus_probe(struct mbus_win windows[], int count);
  114. int mvebu_soc_family(void);
  115. u32 mvebu_get_nand_clock(void);
  116. void return_to_bootrom(void);
  117. int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks);
  118. void get_sar_freq(struct sar_freq_modes *sar_freq);
  119. /*
  120. * Highspeed SERDES PHY config init, ported from bin_hdr
  121. * to mainline U-Boot
  122. */
  123. int serdes_phy_config(void);
  124. /*
  125. * DDR3 init / training code ported from Marvell bin_hdr. Now
  126. * available in mainline U-Boot in:
  127. * drivers/ddr/marvell
  128. */
  129. int ddr3_init(void);
  130. struct mvebu_lcd_info {
  131. u32 fb_base;
  132. int x_res;
  133. int y_res;
  134. int x_fp; /* frontporch */
  135. int y_fp;
  136. int x_bp; /* backporch */
  137. int y_bp;
  138. };
  139. int mvebu_lcd_register_init(struct mvebu_lcd_info *lcd_info);
  140. #endif /* __ASSEMBLY__ */
  141. #endif /* _MVEBU_CPU_H */