mpc10x.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * arch/ppc/kernel/mpc10x.h
  3. *
  4. * Common routines for the Motorola SPS MPC106/8240/107 Host bridge/Mem
  5. * ctlr/EPIC/etc.
  6. *
  7. * Author: Mark A. Greer
  8. * mgreer@mvista.com
  9. *
  10. * 2001 (c) MontaVista, Software, Inc. This file is licensed under
  11. * the terms of the GNU General Public License version 2. This program
  12. * is licensed "as is" without any warranty of any kind, whether express
  13. * or implied.
  14. */
  15. #ifndef __PPC_KERNEL_MPC10X_H
  16. #define __PPC_KERNEL_MPC10X_H
  17. #include <linux/pci_ids.h>
  18. #include <asm/pci-bridge.h>
  19. /*
  20. * The values here don't completely map everything but should work in most
  21. * cases.
  22. *
  23. * MAP A (PReP Map)
  24. * Processor: 0x80000000 - 0x807fffff -> PCI I/O: 0x00000000 - 0x007fffff
  25. * Processor: 0xc0000000 - 0xdfffffff -> PCI MEM: 0x00000000 - 0x1fffffff
  26. * PCI MEM: 0x80000000 -> Processor System Memory: 0x00000000
  27. * EUMB mapped to: ioremap_base - 0x00100000 (ioremap_base - 1 MB)
  28. *
  29. * MAP B (CHRP Map)
  30. * Processor: 0xfe000000 - 0xfebfffff -> PCI I/O: 0x00000000 - 0x00bfffff
  31. * Processor: 0x80000000 - 0xbfffffff -> PCI MEM: 0x80000000 - 0xbfffffff
  32. * PCI MEM: 0x00000000 -> Processor System Memory: 0x00000000
  33. * EUMB mapped to: ioremap_base - 0x00100000 (ioremap_base - 1 MB)
  34. */
  35. /*
  36. * Define the vendor/device IDs for the various bridges--should be added to
  37. * <linux/pci_ids.h>
  38. */
  39. #define MPC10X_BRIDGE_106 ((PCI_DEVICE_ID_MOTOROLA_MPC106 << 16) | \
  40. PCI_VENDOR_ID_MOTOROLA)
  41. #define MPC10X_BRIDGE_8240 ((0x0003 << 16) | PCI_VENDOR_ID_MOTOROLA)
  42. #define MPC10X_BRIDGE_107 ((0x0004 << 16) | PCI_VENDOR_ID_MOTOROLA)
  43. #define MPC10X_BRIDGE_8245 ((0x0006 << 16) | PCI_VENDOR_ID_MOTOROLA)
  44. /* Define the type of map to use */
  45. #define MPC10X_MEM_MAP_A 1
  46. #define MPC10X_MEM_MAP_B 2
  47. /* Map A (PReP Map) Defines */
  48. #define MPC10X_MAPA_CNFG_ADDR 0x80000cf8
  49. #define MPC10X_MAPA_CNFG_DATA 0x80000cfc
  50. #define MPC10X_MAPA_ISA_IO_BASE 0x80000000
  51. #define MPC10X_MAPA_ISA_MEM_BASE 0xc0000000
  52. #define MPC10X_MAPA_DRAM_OFFSET 0x80000000
  53. #define MPC10X_MAPA_PCI_INTACK_ADDR 0xbffffff0
  54. #define MPC10X_MAPA_PCI_IO_START 0x00000000
  55. #define MPC10X_MAPA_PCI_IO_END (0x00800000 - 1)
  56. #define MPC10X_MAPA_PCI_MEM_START 0x00000000
  57. #define MPC10X_MAPA_PCI_MEM_END (0x20000000 - 1)
  58. #define MPC10X_MAPA_PCI_MEM_OFFSET (MPC10X_MAPA_ISA_MEM_BASE - \
  59. MPC10X_MAPA_PCI_MEM_START)
  60. /* Map B (CHRP Map) Defines */
  61. #define MPC10X_MAPB_CNFG_ADDR 0xfec00000
  62. #define MPC10X_MAPB_CNFG_DATA 0xfee00000
  63. #define MPC10X_MAPB_ISA_IO_BASE 0xfe000000
  64. #define MPC10X_MAPB_ISA_MEM_BASE 0x80000000
  65. #define MPC10X_MAPB_DRAM_OFFSET 0x00000000
  66. #define MPC10X_MAPB_PCI_INTACK_ADDR 0xfef00000
  67. #define MPC10X_MAPB_PCI_IO_START 0x00000000
  68. #define MPC10X_MAPB_PCI_IO_END (0x00c00000 - 1)
  69. #define MPC10X_MAPB_PCI_MEM_START 0x80000000
  70. #define MPC10X_MAPB_PCI_MEM_END (0xc0000000 - 1)
  71. #define MPC10X_MAPB_PCI_MEM_OFFSET (MPC10X_MAPB_ISA_MEM_BASE - \
  72. MPC10X_MAPB_PCI_MEM_START)
  73. /* Set hose members to values appropriate for the mem map used */
  74. #define MPC10X_SETUP_HOSE(hose, map) { \
  75. (hose)->pci_mem_offset = MPC10X_MAP##map##_PCI_MEM_OFFSET; \
  76. (hose)->io_space.start = MPC10X_MAP##map##_PCI_IO_START; \
  77. (hose)->io_space.end = MPC10X_MAP##map##_PCI_IO_END; \
  78. (hose)->mem_space.start = MPC10X_MAP##map##_PCI_MEM_START; \
  79. (hose)->mem_space.end = MPC10X_MAP##map##_PCI_MEM_END; \
  80. (hose)->io_base_virt = (void *)MPC10X_MAP##map##_ISA_IO_BASE; \
  81. }
  82. /* Miscellaneous Configuration register offsets */
  83. #define MPC10X_CFG_PIR_REG 0x09
  84. #define MPC10X_CFG_PIR_HOST_BRIDGE 0x00
  85. #define MPC10X_CFG_PIR_AGENT 0x01
  86. #define MPC10X_CFG_EUMBBAR 0x78
  87. #define MPC10X_CFG_PICR1_REG 0xa8
  88. #define MPC10X_CFG_PICR1_ADDR_MAP_MASK 0x00010000
  89. #define MPC10X_CFG_PICR1_ADDR_MAP_A 0x00010000
  90. #define MPC10X_CFG_PICR1_ADDR_MAP_B 0x00000000
  91. #define MPC10X_CFG_PICR1_SPEC_PCI_RD 0x00000004
  92. #define MPC10X_CFG_PICR1_ST_GATH_EN 0x00000040
  93. #define MPC10X_CFG_PICR2_REG 0xac
  94. #define MPC10X_CFG_PICR2_COPYBACK_OPT 0x00000001
  95. #define MPC10X_CFG_MAPB_OPTIONS_REG 0xe0
  96. #define MPC10X_CFG_MAPB_OPTIONS_CFAE 0x80 /* CPU_FD_ALIAS_EN */
  97. #define MPC10X_CFG_MAPB_OPTIONS_PFAE 0x40 /* PCI_FD_ALIAS_EN */
  98. #define MPC10X_CFG_MAPB_OPTIONS_DR 0x20 /* DLL_RESET */
  99. #define MPC10X_CFG_MAPB_OPTIONS_PCICH 0x08 /* PCI_COMPATIBILITY_HOLE */
  100. #define MPC10X_CFG_MAPB_OPTIONS_PROCCH 0x04 /* PROC_COMPATIBILITY_HOLE */
  101. /* Define offsets for the memory controller registers in the config space */
  102. #define MPC10X_MCTLR_MEM_START_1 0x80 /* Banks 0-3 */
  103. #define MPC10X_MCTLR_MEM_START_2 0x84 /* Banks 4-7 */
  104. #define MPC10X_MCTLR_EXT_MEM_START_1 0x88 /* Banks 0-3 */
  105. #define MPC10X_MCTLR_EXT_MEM_START_2 0x8c /* Banks 4-7 */
  106. #define MPC10X_MCTLR_MEM_END_1 0x90 /* Banks 0-3 */
  107. #define MPC10X_MCTLR_MEM_END_2 0x94 /* Banks 4-7 */
  108. #define MPC10X_MCTLR_EXT_MEM_END_1 0x98 /* Banks 0-3 */
  109. #define MPC10X_MCTLR_EXT_MEM_END_2 0x9c /* Banks 4-7 */
  110. #define MPC10X_MCTLR_MEM_BANK_ENABLES 0xa0
  111. /* Define some offset in the EUMB */
  112. #define MPC10X_EUMB_SIZE 0x00100000 /* Total EUMB size (1MB) */
  113. #define MPC10X_EUMB_MU_OFFSET 0x00000000 /* Msg Unit reg offset */
  114. #define MPC10X_EUMB_MU_SIZE 0x00001000 /* Msg Unit reg size */
  115. #define MPC10X_EUMB_DMA_OFFSET 0x00001000 /* DMA Unit reg offset */
  116. #define MPC10X_EUMB_DMA_SIZE 0x00001000 /* DMA Unit reg size */
  117. #define MPC10X_EUMB_ATU_OFFSET 0x00002000 /* Addr xlate reg offset */
  118. #define MPC10X_EUMB_ATU_SIZE 0x00001000 /* Addr xlate reg size */
  119. #define MPC10X_EUMB_I2C_OFFSET 0x00003000 /* I2C Unit reg offset */
  120. #define MPC10X_EUMB_I2C_SIZE 0x00001000 /* I2C Unit reg size */
  121. #define MPC10X_EUMB_DUART_OFFSET 0x00004000 /* DUART Unit reg offset (8245) */
  122. #define MPC10X_EUMB_DUART_SIZE 0x00001000 /* DUART Unit reg size (8245) */
  123. #define MPC10X_EUMB_EPIC_OFFSET 0x00040000 /* EPIC offset in EUMB */
  124. #define MPC10X_EUMB_EPIC_SIZE 0x00030000 /* EPIC size */
  125. #define MPC10X_EUMB_PM_OFFSET 0x000fe000 /* Performance Monitor reg offset (8245) */
  126. #define MPC10X_EUMB_PM_SIZE 0x00001000 /* Performance Monitor reg size (8245) */
  127. #define MPC10X_EUMB_WP_OFFSET 0x000ff000 /* Data path diagnostic, watchpoint reg offset */
  128. #define MPC10X_EUMB_WP_SIZE 0x00001000 /* Data path diagnostic, watchpoint reg size */
  129. /*
  130. * Define some recommended places to put the EUMB regs.
  131. * For both maps, recommend putting the EUMB from 0xeff00000 to 0xefffffff.
  132. */
  133. extern unsigned long ioremap_base;
  134. #define MPC10X_MAPA_EUMB_BASE (ioremap_base - MPC10X_EUMB_SIZE)
  135. #define MPC10X_MAPB_EUMB_BASE MPC10X_MAPA_EUMB_BASE
  136. enum ppc_sys_devices {
  137. MPC10X_IIC1,
  138. MPC10X_DMA0,
  139. MPC10X_DMA1,
  140. MPC10X_UART0,
  141. MPC10X_UART1,
  142. };
  143. int mpc10x_bridge_init(struct pci_controller *hose,
  144. uint current_map,
  145. uint new_map,
  146. uint phys_eumb_base);
  147. unsigned long mpc10x_get_mem_size(uint mem_map);
  148. int mpc10x_enable_store_gathering(struct pci_controller *hose);
  149. int mpc10x_disable_store_gathering(struct pci_controller *hose);
  150. /* For MPC107 boards that use the built-in openpic */
  151. void mpc10x_set_openpic(void);
  152. #endif /* __PPC_KERNEL_MPC10X_H */