pci-sh7780.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Low-Level PCI Support for SH7780 targets
  3. *
  4. * Dustin McIntire (dustin@sensoria.com) (c) 2001
  5. * Paul Mundt (lethal@linux-sh.org) (c) 2003
  6. *
  7. * May be copied or modified under the terms of the GNU General Public
  8. * License. See linux/COPYING for more information.
  9. *
  10. */
  11. #ifndef _PCI_SH7780_H_
  12. #define _PCI_SH7780_H_
  13. #include <linux/pci.h>
  14. /* set debug level 4=verbose...1=terse */
  15. //#define DEBUG_PCI 3
  16. #undef DEBUG_PCI
  17. #ifdef DEBUG_PCI
  18. #define PCIDBG(n, x...) { if(DEBUG_PCI>=n) printk(x); }
  19. #else
  20. #define PCIDBG(n, x...)
  21. #endif
  22. /* startup values */
  23. #define PCI_PROBE_BIOS 1
  24. #define PCI_PROBE_CONF1 2
  25. #define PCI_PROBE_CONF2 4
  26. #define PCI_NO_SORT 0x100
  27. #define PCI_BIOS_SORT 0x200
  28. #define PCI_NO_CHECKS 0x400
  29. #define PCI_ASSIGN_ROMS 0x1000
  30. #define PCI_BIOS_IRQ_SCAN 0x2000
  31. /* Platform Specific Values */
  32. #define SH7780_VENDOR_ID 0x1912
  33. #define SH7780_DEVICE_ID 0x0002
  34. #define SH7781_DEVICE_ID 0x0001
  35. /* SH7780 Control Registers */
  36. #define SH7780_PCI_VCR0 0xFE000000
  37. #define SH7780_PCI_VCR1 0xFE000004
  38. #define SH7780_PCI_VCR2 0xFE000008
  39. /* SH7780 Specific Values */
  40. #define SH7780_PCI_CONFIG_BASE 0xFD000000 /* Config space base addr */
  41. #define SH7780_PCI_CONFIG_SIZE 0x01000000 /* Config space size */
  42. #define SH7780_PCI_MEMORY_BASE 0xFD000000 /* Memory space base addr */
  43. #define SH7780_PCI_MEM_SIZE 0x01000000 /* Size of Memory window */
  44. #if 1
  45. #define SH7780_PCI_IO_BASE 0xFE400000 /* IO space base address */
  46. #define SH7780_PCI_IO_SIZE 0x00400000 /* Size of IO window */
  47. #else
  48. #define SH7780_PCI_IO_BASE 0xFE200000 /* IO space base address */
  49. #define SH7780_PCI_IO_SIZE 0x00200000 /* Size of IO window */
  50. #endif
  51. #define SH7780_PCIREG_BASE 0xFE040000 /* PCI regs base address */
  52. #define PCI_REG(n) (SH7780_PCIREG_BASE+n)
  53. /* SH7780 PCI Config Registers */
  54. #define SH7780_PCIVID 0x000 /* Vendor ID */
  55. #define SH7780_PCIDID 0x002 /* Device ID */
  56. #define SH7780_PCICMD 0x004 /* Command */
  57. #define SH7780_PCISTATUS 0x006 /* Status */
  58. #define SH7780_PCIRID 0x008 /* Revision ID */
  59. #define SH7780_PCIPIF 0x009 /* Program Interface */
  60. #define SH7780_PCISUB 0x00a /* Sub class code */
  61. #define SH7780_PCIBCC 0x00b /* Base class code */
  62. #define SH7780_PCICLS 0x00c /* Cache line size */
  63. #define SH7780_PCILTM 0x00d /* latency timer */
  64. #define SH7780_PCIHDR 0x00e /* Header type */
  65. #define SH7780_PCIBIST 0x00f /* BIST */
  66. #define SH7780_PCIIBAR 0x010 /* IO Base address */
  67. #define SH7780_PCIMBAR0 0x014 /* Memory base address0 */
  68. #define SH7780_PCIMBAR1 0x018 /* Memory base address1 */
  69. #define SH7780_PCISVID 0x02c /* Sub system vendor ID */
  70. #define SH7780_PCISID 0x02e /* Sub system ID */
  71. #define SH7780_PCICP 0x034
  72. #define SH7780_PCIINTLINE 0x03c /* Interrupt line */
  73. #define SH7780_PCIINTPIN 0x03d /* Interrupt pin */
  74. #define SH7780_PCIMINGNT 0x03e /* Minumum grand */
  75. #define SH7780_PCIMAXLAT 0x03f /* Maxmum latency */
  76. #define SH7780_PCICID 0x040
  77. #define SH7780_PCINIP 0x041
  78. #define SH7780_PCIPMC 0x042
  79. #define SH7780_PCIPMCSR 0x044
  80. #define SH7780_PCIPMCSR_BSE 0x046
  81. #define SH7780_PCICDD 0x047
  82. /* SH7780 PCI Local Registers */
  83. #define SH7780_PCICR 0x100 /* PCI Control Register */
  84. #define SH7780_PCICR_PREFIX 0xA5000000 /* CR prefix for write */
  85. #define SH7780_PCICR_PFCS 0x00000800 /* TRDY/IRDY Enable */
  86. #define SH7780_PCICR_FTO 0x00000400 /* TRDY/IRDY Enable */
  87. #define SH7780_PCICR_PFE 0x00000200 /* Target Read Single */
  88. #define SH7780_PCICR_TBS 0x00000100 /* Target Byte Swap */
  89. #define SH7780_PCICR_ARBM 0x00000040 /* PCI Arbitration Mode */
  90. #define SH7780_PCICR_IOCS 0x00000004 /* INTA output assert */
  91. #define SH7780_PCICR_PRST 0x00000002 /* PCI Reset Assert */
  92. #define SH7780_PCICR_CFIN 0x00000001 /* Central Fun. Init Done */
  93. #define SH7780_PCILSR0 0x104 /* PCI Local Space Register0 */
  94. #define SH7780_PCILSR1 0x108 /* PCI Local Space Register1 */
  95. #define SH7780_PCILAR0 0x10C /* PCI Local Address Register1 */
  96. #define SH7780_PCILAR1 0x110 /* PCI Local Address Register1 */
  97. #define SH7780_PCIIR 0x114 /* PCI Interrupt Register */
  98. #define SH7780_PCIIMR 0x118 /* PCI Interrupt Mask Register */
  99. #define SH7780_PCIAIR 0x11C /* Error Address Register */
  100. #define SH7780_PCICIR 0x120 /* Error Command/Data Register */
  101. #define SH7780_PCIAINT 0x130 /* Arbiter Interrupt Register */
  102. #define SH7780_PCIAINTM 0x134 /* Arbiter Int. Mask Register */
  103. #define SH7780_PCIBMIR 0x138 /* Error Bus Master Register */
  104. #define SH7780_PCIPAR 0x1C0 /* PIO Address Register */
  105. #define SH7780_PCIPINT 0x1CC /* Power Management Int. Register */
  106. #define SH7780_PCIPINTM 0x1D0 /* Power Management Mask Register */
  107. #define SH7780_PCIMBR0 0x1E0 /* Memory Bank0 Register */
  108. #define SH7780_PCIMBMR0 0x1E4 /* Memory Bank0 Mask Register */
  109. #define SH7780_PCIMBR1 0x1E8 /* Memory Bank1 Register */
  110. #define SH7780_PCIMBMR1 0x1EC /* Memory Bank1 Mask Register */
  111. #define SH7780_PCIMBR2 0x1F0 /* Memory Bank2 Register */
  112. #define SH7780_PCIMBMR2 0x1F4 /* Memory Bank2 Mask Register */
  113. #define SH7780_PCIIOBR 0x1F8 /* Bank Register */
  114. #define SH7780_PCIIOBMR 0x1FC /* Bank Mask Register */
  115. #define SH7780_PCICSCR0 0x210 /* Cache Snoop1 Cnt. Register */
  116. #define SH7780_PCICSCR1 0x214 /* Cache Snoop2 Cnt. Register */
  117. #define SH7780_PCICSAR0 0x218 /* Cache Snoop1 Addr. Register */
  118. #define SH7780_PCICSAR1 0x21C /* Cache Snoop2 Addr. Register */
  119. #define SH7780_PCIPDR 0x220 /* Port IO Data Register */
  120. /* General Memory Config Addresses */
  121. #define SH7780_CS0_BASE_ADDR 0x0
  122. #define SH7780_MEM_REGION_SIZE 0x04000000
  123. #define SH7780_CS1_BASE_ADDR (SH7780_CS0_BASE_ADDR + SH7780_MEM_REGION_SIZE)
  124. #define SH7780_CS2_BASE_ADDR (SH7780_CS1_BASE_ADDR + SH7780_MEM_REGION_SIZE)
  125. #define SH7780_CS3_BASE_ADDR (SH7780_CS2_BASE_ADDR + SH7780_MEM_REGION_SIZE)
  126. #define SH7780_CS4_BASE_ADDR (SH7780_CS3_BASE_ADDR + SH7780_MEM_REGION_SIZE)
  127. #define SH7780_CS5_BASE_ADDR (SH7780_CS4_BASE_ADDR + SH7780_MEM_REGION_SIZE)
  128. #define SH7780_CS6_BASE_ADDR (SH7780_CS5_BASE_ADDR + SH7780_MEM_REGION_SIZE)
  129. /* General PCI values */
  130. #define SH7780_PCI_HOST_BRIDGE 0x6
  131. /* Flags */
  132. #define SH7780_PCIC_NO_RESET 0x0001
  133. /* External functions defined per platform i.e. Big Sur, SE... (these could be routed
  134. * through the machine vectors... */
  135. extern int pcibios_init_platform(void);
  136. extern int pcibios_map_platform_irq(u8 slot, u8 pin);
  137. struct sh7780_pci_address_space {
  138. unsigned long base;
  139. unsigned long size;
  140. };
  141. struct sh7780_pci_address_map {
  142. struct sh7780_pci_address_space window0;
  143. struct sh7780_pci_address_space window1;
  144. unsigned long flags;
  145. };
  146. /* arch/sh/drivers/pci/pci-sh7780.c */
  147. extern int sh7780_pcic_init(struct sh7780_pci_address_map *map);
  148. #endif /* _PCI_SH7780_H_ */