pb1000.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*
  2. * Alchemy Semi PB1000 Referrence Board
  3. *
  4. * Copyright 2001 MontaVista Software Inc.
  5. * Author: MontaVista Software, Inc.
  6. * ppopov@mvista.com or source@mvista.com
  7. *
  8. * ########################################################################
  9. *
  10. * This program is free software; you can distribute it and/or modify it
  11. * under the terms of the GNU General Public License (Version 2) as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  17. * for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * ########################################################################
  24. *
  25. *
  26. */
  27. #ifndef __ASM_PB1000_H
  28. #define __ASM_PB1000_H
  29. /* PCMCIA PB1000 specific defines */
  30. #define PCMCIA_MAX_SOCK 1
  31. #define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
  32. #define PB1000_PCR 0xBE000000
  33. #define PCR_SLOT_0_VPP0 (1<<0)
  34. #define PCR_SLOT_0_VPP1 (1<<1)
  35. #define PCR_SLOT_0_VCC0 (1<<2)
  36. #define PCR_SLOT_0_VCC1 (1<<3)
  37. #define PCR_SLOT_0_RST (1<<4)
  38. #define PCR_SLOT_1_VPP0 (1<<8)
  39. #define PCR_SLOT_1_VPP1 (1<<9)
  40. #define PCR_SLOT_1_VCC0 (1<<10)
  41. #define PCR_SLOT_1_VCC1 (1<<11)
  42. #define PCR_SLOT_1_RST (1<<12)
  43. #define PB1000_MDR 0xBE000004
  44. #define MDR_PI (1<<5) /* pcmcia int latch */
  45. #define MDR_EPI (1<<14) /* enable pcmcia int */
  46. #define MDR_CPI (1<<15) /* clear pcmcia int */
  47. #define PB1000_ACR1 0xBE000008
  48. #define ACR1_SLOT_0_CD1 (1<<0) /* card detect 1 */
  49. #define ACR1_SLOT_0_CD2 (1<<1) /* card detect 2 */
  50. #define ACR1_SLOT_0_READY (1<<2) /* ready */
  51. #define ACR1_SLOT_0_STATUS (1<<3) /* status change */
  52. #define ACR1_SLOT_0_VS1 (1<<4) /* voltage sense 1 */
  53. #define ACR1_SLOT_0_VS2 (1<<5) /* voltage sense 2 */
  54. #define ACR1_SLOT_0_INPACK (1<<6) /* inpack pin status */
  55. #define ACR1_SLOT_1_CD1 (1<<8) /* card detect 1 */
  56. #define ACR1_SLOT_1_CD2 (1<<9) /* card detect 2 */
  57. #define ACR1_SLOT_1_READY (1<<10) /* ready */
  58. #define ACR1_SLOT_1_STATUS (1<<11) /* status change */
  59. #define ACR1_SLOT_1_VS1 (1<<12) /* voltage sense 1 */
  60. #define ACR1_SLOT_1_VS2 (1<<13) /* voltage sense 2 */
  61. #define ACR1_SLOT_1_INPACK (1<<14) /* inpack pin status */
  62. #define CPLD_AUX0 0xBE00000C
  63. #define CPLD_AUX1 0xBE000010
  64. #define CPLD_AUX2 0xBE000014
  65. /* Voltage levels */
  66. /* VPPEN1 - VPPEN0 */
  67. #define VPP_GND ((0<<1) | (0<<0))
  68. #define VPP_5V ((1<<1) | (0<<0))
  69. #define VPP_3V ((0<<1) | (1<<0))
  70. #define VPP_12V ((0<<1) | (1<<0))
  71. #define VPP_HIZ ((1<<1) | (1<<0))
  72. /* VCCEN1 - VCCEN0 */
  73. #define VCC_3V ((0<<1) | (1<<0))
  74. #define VCC_5V ((1<<1) | (0<<0))
  75. #define VCC_HIZ ((0<<1) | (0<<0))
  76. /* VPP/VCC */
  77. #define SET_VCC_VPP(VCC, VPP, SLOT)\
  78. ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
  79. /* PCI PB1000 specific defines */
  80. /* The reason these defines are here instead of au1000.h is because
  81. * the Au1000 does not have a PCI bus controller so the PCI implementation
  82. * on the some of the older Pb1000 boards was very board specific.
  83. */
  84. #define PCI_CONFIG_BASE 0xBA020000 /* the only external slot */
  85. #define SDRAM_DEVID 0xBA010000
  86. #define SDRAM_CMD 0xBA010004
  87. #define SDRAM_CLASS 0xBA010008
  88. #define SDRAM_MISC 0xBA01000C
  89. #define SDRAM_MBAR 0xBA010010
  90. #define PCI_IO_DATA_PORT 0xBA800000
  91. #define PCI_IO_ADDR 0xBE00001C
  92. #define PCI_INT_ACK 0xBBC00000
  93. #define PCI_IO_READ 0xBBC00020
  94. #define PCI_IO_WRITE 0xBBC00030
  95. #define PCI_BRIDGE_CONFIG 0xBE000018
  96. #define PCI_IO_START 0x10000000
  97. #define PCI_IO_END 0x1000ffff
  98. #define PCI_MEM_START 0x18000000
  99. #define PCI_MEM_END 0x18ffffff
  100. #define PCI_FIRST_DEVFN 0
  101. #define PCI_LAST_DEVFN 1
  102. static inline u8 au_pci_io_readb(u32 addr)
  103. {
  104. writel(addr, PCI_IO_ADDR);
  105. writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
  106. return (readl(PCI_IO_DATA_PORT) & 0xff);
  107. }
  108. static inline u16 au_pci_io_readw(u32 addr)
  109. {
  110. writel(addr, PCI_IO_ADDR);
  111. writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
  112. return (readl(PCI_IO_DATA_PORT) & 0xffff);
  113. }
  114. static inline u32 au_pci_io_readl(u32 addr)
  115. {
  116. writel(addr, PCI_IO_ADDR);
  117. writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff), PCI_BRIDGE_CONFIG);
  118. return readl(PCI_IO_DATA_PORT);
  119. }
  120. static inline void au_pci_io_writeb(u8 val, u32 addr)
  121. {
  122. writel(addr, PCI_IO_ADDR);
  123. writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<12), PCI_BRIDGE_CONFIG);
  124. writel(val, PCI_IO_DATA_PORT);
  125. }
  126. static inline void au_pci_io_writew(u16 val, u32 addr)
  127. {
  128. writel(addr, PCI_IO_ADDR);
  129. writel((readl(PCI_BRIDGE_CONFIG) & 0xffffcfff) | (1<<13), PCI_BRIDGE_CONFIG);
  130. writel(val, PCI_IO_DATA_PORT);
  131. }
  132. static inline void au_pci_io_writel(u32 val, u32 addr)
  133. {
  134. writel(addr, PCI_IO_ADDR);
  135. writel(readl(PCI_BRIDGE_CONFIG) & 0xffffcfff, PCI_BRIDGE_CONFIG);
  136. writel(val, PCI_IO_DATA_PORT);
  137. }
  138. static inline void set_sdram_extbyte(void)
  139. {
  140. writel(readl(PCI_BRIDGE_CONFIG) & 0xffffff00, PCI_BRIDGE_CONFIG);
  141. }
  142. static inline void set_slot_extbyte(void)
  143. {
  144. writel((readl(PCI_BRIDGE_CONFIG) & 0xffffbf00) | 0x18, PCI_BRIDGE_CONFIG);
  145. }
  146. #endif /* __ASM_PB1000_H */