tx4938.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /*
  2. * Definitions for TX4937/TX4938
  3. * Copyright (C) 2000-2001 Toshiba Corporation
  4. *
  5. * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
  6. * terms of the GNU General Public License version 2. This program is
  7. * licensed "as is" without any warranty of any kind, whether express
  8. * or implied.
  9. *
  10. * Support for TX4938 in 2.6 - Manish Lachwani ([email protected])
  11. */
  12. #ifndef __ASM_TXX9_TX4938_H
  13. #define __ASM_TXX9_TX4938_H
  14. /* some controllers are compatible with 4927 */
  15. #include <asm/txx9/tx4927.h>
  16. #ifdef CONFIG_64BIT
  17. #define TX4938_REG_BASE 0xffffffffff1f0000UL /* == TX4937_REG_BASE */
  18. #else
  19. #define TX4938_REG_BASE 0xff1f0000UL /* == TX4937_REG_BASE */
  20. #endif
  21. #define TX4938_REG_SIZE 0x00010000 /* == TX4937_REG_SIZE */
  22. /* NDFMC, SRAMC, PCIC1, SPIC: TX4938 only */
  23. #define TX4938_NDFMC_REG (TX4938_REG_BASE + 0x5000)
  24. #define TX4938_SRAMC_REG (TX4938_REG_BASE + 0x6000)
  25. #define TX4938_PCIC1_REG (TX4938_REG_BASE + 0x7000)
  26. #define TX4938_SDRAMC_REG (TX4938_REG_BASE + 0x8000)
  27. #define TX4938_EBUSC_REG (TX4938_REG_BASE + 0x9000)
  28. #define TX4938_DMA_REG(ch) (TX4938_REG_BASE + 0xb000 + (ch) * 0x800)
  29. #define TX4938_PCIC_REG (TX4938_REG_BASE + 0xd000)
  30. #define TX4938_CCFG_REG (TX4938_REG_BASE + 0xe000)
  31. #define TX4938_NR_TMR 3
  32. #define TX4938_TMR_REG(ch) ((TX4938_REG_BASE + 0xf000) + (ch) * 0x100)
  33. #define TX4938_NR_SIO 2
  34. #define TX4938_SIO_REG(ch) ((TX4938_REG_BASE + 0xf300) + (ch) * 0x100)
  35. #define TX4938_PIO_REG (TX4938_REG_BASE + 0xf500)
  36. #define TX4938_IRC_REG (TX4938_REG_BASE + 0xf600)
  37. #define TX4938_ACLC_REG (TX4938_REG_BASE + 0xf700)
  38. #define TX4938_SPI_REG (TX4938_REG_BASE + 0xf800)
  39. struct tx4938_sramc_reg {
  40. u64 cr;
  41. };
  42. struct tx4938_ccfg_reg {
  43. u64 ccfg;
  44. u64 crir;
  45. u64 pcfg;
  46. u64 toea;
  47. u64 clkctr;
  48. u64 unused0;
  49. u64 garbc;
  50. u64 unused1;
  51. u64 unused2;
  52. u64 ramp;
  53. u64 unused3;
  54. u64 jmpadr;
  55. };
  56. /*
  57. * IRC
  58. */
  59. #define TX4938_IR_ECCERR 0
  60. #define TX4938_IR_WTOERR 1
  61. #define TX4938_NUM_IR_INT 6
  62. #define TX4938_IR_INT(n) (2 + (n))
  63. #define TX4938_NUM_IR_SIO 2
  64. #define TX4938_IR_SIO(n) (8 + (n))
  65. #define TX4938_NUM_IR_DMA 4
  66. #define TX4938_IR_DMA(ch, n) ((ch ? 27 : 10) + (n)) /* 10-13, 27-30 */
  67. #define TX4938_IR_PIO 14
  68. #define TX4938_IR_PDMAC 15
  69. #define TX4938_IR_PCIC 16
  70. #define TX4938_NUM_IR_TMR 3
  71. #define TX4938_IR_TMR(n) (17 + (n))
  72. #define TX4938_IR_NDFMC 21
  73. #define TX4938_IR_PCIERR 22
  74. #define TX4938_IR_PCIPME 23
  75. #define TX4938_IR_ACLC 24
  76. #define TX4938_IR_ACLCPME 25
  77. #define TX4938_IR_PCIC1 26
  78. #define TX4938_IR_SPI 31
  79. #define TX4938_NUM_IR 32
  80. /* multiplex */
  81. #define TX4938_IR_ETH0 TX4938_IR_INT(4)
  82. #define TX4938_IR_ETH1 TX4938_IR_INT(3)
  83. #define TX4938_IRC_INT 2 /* IP[2] in Status register */
  84. #define TX4938_NUM_PIO 16
  85. /*
  86. * CCFG
  87. */
  88. /* CCFG : Chip Configuration */
  89. #define TX4938_CCFG_WDRST 0x0000020000000000ULL
  90. #define TX4938_CCFG_WDREXEN 0x0000010000000000ULL
  91. #define TX4938_CCFG_BCFG_MASK 0x000000ff00000000ULL
  92. #define TX4938_CCFG_TINTDIS 0x01000000
  93. #define TX4938_CCFG_PCI66 0x00800000
  94. #define TX4938_CCFG_PCIMODE 0x00400000
  95. #define TX4938_CCFG_PCI1_66 0x00200000
  96. #define TX4938_CCFG_DIVMODE_MASK 0x001e0000
  97. #define TX4938_CCFG_DIVMODE_2 (0x4 << 17)
  98. #define TX4938_CCFG_DIVMODE_2_5 (0xf << 17)
  99. #define TX4938_CCFG_DIVMODE_3 (0x5 << 17)
  100. #define TX4938_CCFG_DIVMODE_4 (0x6 << 17)
  101. #define TX4938_CCFG_DIVMODE_4_5 (0xd << 17)
  102. #define TX4938_CCFG_DIVMODE_8 (0x0 << 17)
  103. #define TX4938_CCFG_DIVMODE_10 (0xb << 17)
  104. #define TX4938_CCFG_DIVMODE_12 (0x1 << 17)
  105. #define TX4938_CCFG_DIVMODE_16 (0x2 << 17)
  106. #define TX4938_CCFG_DIVMODE_18 (0x9 << 17)
  107. #define TX4938_CCFG_BEOW 0x00010000
  108. #define TX4938_CCFG_WR 0x00008000
  109. #define TX4938_CCFG_TOE 0x00004000
  110. #define TX4938_CCFG_PCIARB 0x00002000
  111. #define TX4938_CCFG_PCIDIVMODE_MASK 0x00001c00
  112. #define TX4938_CCFG_PCIDIVMODE_4 (0x1 << 10)
  113. #define TX4938_CCFG_PCIDIVMODE_4_5 (0x3 << 10)
  114. #define TX4938_CCFG_PCIDIVMODE_5 (0x5 << 10)
  115. #define TX4938_CCFG_PCIDIVMODE_5_5 (0x7 << 10)
  116. #define TX4938_CCFG_PCIDIVMODE_8 (0x0 << 10)
  117. #define TX4938_CCFG_PCIDIVMODE_9 (0x2 << 10)
  118. #define TX4938_CCFG_PCIDIVMODE_10 (0x4 << 10)
  119. #define TX4938_CCFG_PCIDIVMODE_11 (0x6 << 10)
  120. #define TX4938_CCFG_PCI1DMD 0x00000100
  121. #define TX4938_CCFG_SYSSP_MASK 0x000000c0
  122. #define TX4938_CCFG_ENDIAN 0x00000004
  123. #define TX4938_CCFG_HALT 0x00000002
  124. #define TX4938_CCFG_ACEHOLD 0x00000001
  125. /* PCFG : Pin Configuration */
  126. #define TX4938_PCFG_ETH0_SEL 0x8000000000000000ULL
  127. #define TX4938_PCFG_ETH1_SEL 0x4000000000000000ULL
  128. #define TX4938_PCFG_ATA_SEL 0x2000000000000000ULL
  129. #define TX4938_PCFG_ISA_SEL 0x1000000000000000ULL
  130. #define TX4938_PCFG_SPI_SEL 0x0800000000000000ULL
  131. #define TX4938_PCFG_NDF_SEL 0x0400000000000000ULL
  132. #define TX4938_PCFG_SDCLKDLY_MASK 0x30000000
  133. #define TX4938_PCFG_SDCLKDLY(d) ((d)<<28)
  134. #define TX4938_PCFG_SYSCLKEN 0x08000000
  135. #define TX4938_PCFG_SDCLKEN_ALL 0x07800000
  136. #define TX4938_PCFG_SDCLKEN(ch) (0x00800000<<(ch))
  137. #define TX4938_PCFG_PCICLKEN_ALL 0x003f0000
  138. #define TX4938_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
  139. #define TX4938_PCFG_SEL2 0x00000200
  140. #define TX4938_PCFG_SEL1 0x00000100
  141. #define TX4938_PCFG_DMASEL_ALL 0x0000000f
  142. #define TX4938_PCFG_DMASEL0_DRQ0 0x00000000
  143. #define TX4938_PCFG_DMASEL0_SIO1 0x00000001
  144. #define TX4938_PCFG_DMASEL1_DRQ1 0x00000000
  145. #define TX4938_PCFG_DMASEL1_SIO1 0x00000002
  146. #define TX4938_PCFG_DMASEL2_DRQ2 0x00000000
  147. #define TX4938_PCFG_DMASEL2_SIO0 0x00000004
  148. #define TX4938_PCFG_DMASEL3_DRQ3 0x00000000
  149. #define TX4938_PCFG_DMASEL3_SIO0 0x00000008
  150. /* CLKCTR : Clock Control */
  151. #define TX4938_CLKCTR_NDFCKD 0x0001000000000000ULL
  152. #define TX4938_CLKCTR_NDFRST 0x0000000100000000ULL
  153. #define TX4938_CLKCTR_ETH1CKD 0x80000000
  154. #define TX4938_CLKCTR_ETH0CKD 0x40000000
  155. #define TX4938_CLKCTR_SPICKD 0x20000000
  156. #define TX4938_CLKCTR_SRAMCKD 0x10000000
  157. #define TX4938_CLKCTR_PCIC1CKD 0x08000000
  158. #define TX4938_CLKCTR_DMA1CKD 0x04000000
  159. #define TX4938_CLKCTR_ACLCKD 0x02000000
  160. #define TX4938_CLKCTR_PIOCKD 0x01000000
  161. #define TX4938_CLKCTR_DMACKD 0x00800000
  162. #define TX4938_CLKCTR_PCICKD 0x00400000
  163. #define TX4938_CLKCTR_TM0CKD 0x00100000
  164. #define TX4938_CLKCTR_TM1CKD 0x00080000
  165. #define TX4938_CLKCTR_TM2CKD 0x00040000
  166. #define TX4938_CLKCTR_SIO0CKD 0x00020000
  167. #define TX4938_CLKCTR_SIO1CKD 0x00010000
  168. #define TX4938_CLKCTR_ETH1RST 0x00008000
  169. #define TX4938_CLKCTR_ETH0RST 0x00004000
  170. #define TX4938_CLKCTR_SPIRST 0x00002000
  171. #define TX4938_CLKCTR_SRAMRST 0x00001000
  172. #define TX4938_CLKCTR_PCIC1RST 0x00000800
  173. #define TX4938_CLKCTR_DMA1RST 0x00000400
  174. #define TX4938_CLKCTR_ACLRST 0x00000200
  175. #define TX4938_CLKCTR_PIORST 0x00000100
  176. #define TX4938_CLKCTR_DMARST 0x00000080
  177. #define TX4938_CLKCTR_PCIRST 0x00000040
  178. #define TX4938_CLKCTR_TM0RST 0x00000010
  179. #define TX4938_CLKCTR_TM1RST 0x00000008
  180. #define TX4938_CLKCTR_TM2RST 0x00000004
  181. #define TX4938_CLKCTR_SIO0RST 0x00000002
  182. #define TX4938_CLKCTR_SIO1RST 0x00000001
  183. /*
  184. * DMA
  185. */
  186. /* bits for MCR */
  187. #define TX4938_DMA_MCR_EIS(ch) (0x10000000<<(ch))
  188. #define TX4938_DMA_MCR_DIS(ch) (0x01000000<<(ch))
  189. #define TX4938_DMA_MCR_RSFIF 0x00000080
  190. #define TX4938_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
  191. #define TX4938_DMA_MCR_RPRT 0x00000002
  192. #define TX4938_DMA_MCR_MSTEN 0x00000001
  193. /* bits for CCRn */
  194. #define TX4938_DMA_CCR_IMMCHN 0x20000000
  195. #define TX4938_DMA_CCR_USEXFSZ 0x10000000
  196. #define TX4938_DMA_CCR_LE 0x08000000
  197. #define TX4938_DMA_CCR_DBINH 0x04000000
  198. #define TX4938_DMA_CCR_SBINH 0x02000000
  199. #define TX4938_DMA_CCR_CHRST 0x01000000
  200. #define TX4938_DMA_CCR_RVBYTE 0x00800000
  201. #define TX4938_DMA_CCR_ACKPOL 0x00400000
  202. #define TX4938_DMA_CCR_REQPL 0x00200000
  203. #define TX4938_DMA_CCR_EGREQ 0x00100000
  204. #define TX4938_DMA_CCR_CHDN 0x00080000
  205. #define TX4938_DMA_CCR_DNCTL 0x00060000
  206. #define TX4938_DMA_CCR_EXTRQ 0x00010000
  207. #define TX4938_DMA_CCR_INTRQD 0x0000e000
  208. #define TX4938_DMA_CCR_INTENE 0x00001000
  209. #define TX4938_DMA_CCR_INTENC 0x00000800
  210. #define TX4938_DMA_CCR_INTENT 0x00000400
  211. #define TX4938_DMA_CCR_CHNEN 0x00000200
  212. #define TX4938_DMA_CCR_XFACT 0x00000100
  213. #define TX4938_DMA_CCR_SMPCHN 0x00000020
  214. #define TX4938_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
  215. #define TX4938_DMA_CCR_XFSZ_1W TX4938_DMA_CCR_XFSZ(2)
  216. #define TX4938_DMA_CCR_XFSZ_2W TX4938_DMA_CCR_XFSZ(3)
  217. #define TX4938_DMA_CCR_XFSZ_4W TX4938_DMA_CCR_XFSZ(4)
  218. #define TX4938_DMA_CCR_XFSZ_8W TX4938_DMA_CCR_XFSZ(5)
  219. #define TX4938_DMA_CCR_XFSZ_16W TX4938_DMA_CCR_XFSZ(6)
  220. #define TX4938_DMA_CCR_XFSZ_32W TX4938_DMA_CCR_XFSZ(7)
  221. #define TX4938_DMA_CCR_MEMIO 0x00000002
  222. #define TX4938_DMA_CCR_SNGAD 0x00000001
  223. /* bits for CSRn */
  224. #define TX4938_DMA_CSR_CHNEN 0x00000400
  225. #define TX4938_DMA_CSR_STLXFER 0x00000200
  226. #define TX4938_DMA_CSR_CHNACT 0x00000100
  227. #define TX4938_DMA_CSR_ABCHC 0x00000080
  228. #define TX4938_DMA_CSR_NCHNC 0x00000040
  229. #define TX4938_DMA_CSR_NTRNFC 0x00000020
  230. #define TX4938_DMA_CSR_EXTDN 0x00000010
  231. #define TX4938_DMA_CSR_CFERR 0x00000008
  232. #define TX4938_DMA_CSR_CHERR 0x00000004
  233. #define TX4938_DMA_CSR_DESERR 0x00000002
  234. #define TX4938_DMA_CSR_SORERR 0x00000001
  235. #define tx4938_sdramcptr tx4927_sdramcptr
  236. #define tx4938_ebuscptr tx4927_ebuscptr
  237. #define tx4938_pcicptr tx4927_pcicptr
  238. #define tx4938_pcic1ptr \
  239. ((struct tx4927_pcic_reg __iomem *)TX4938_PCIC1_REG)
  240. #define tx4938_ccfgptr \
  241. ((struct tx4938_ccfg_reg __iomem *)TX4938_CCFG_REG)
  242. #define tx4938_pioptr ((struct txx9_pio_reg __iomem *)TX4938_PIO_REG)
  243. #define tx4938_sramcptr \
  244. ((struct tx4938_sramc_reg __iomem *)TX4938_SRAMC_REG)
  245. #define TX4938_REV_PCODE() \
  246. ((__u32)__raw_readq(&tx4938_ccfgptr->crir) >> 16)
  247. #define tx4938_ccfg_clear(bits) tx4927_ccfg_clear(bits)
  248. #define tx4938_ccfg_set(bits) tx4927_ccfg_set(bits)
  249. #define tx4938_ccfg_change(change, new) tx4927_ccfg_change(change, new)
  250. #define TX4938_SDRAMC_CR(ch) TX4927_SDRAMC_CR(ch)
  251. #define TX4938_SDRAMC_BA(ch) TX4927_SDRAMC_BA(ch)
  252. #define TX4938_SDRAMC_SIZE(ch) TX4927_SDRAMC_SIZE(ch)
  253. #define TX4938_EBUSC_CR(ch) TX4927_EBUSC_CR(ch)
  254. #define TX4938_EBUSC_BA(ch) TX4927_EBUSC_BA(ch)
  255. #define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
  256. #define TX4938_EBUSC_WIDTH(ch) TX4927_EBUSC_WIDTH(ch)
  257. #define tx4938_get_mem_size() tx4927_get_mem_size()
  258. void tx4938_wdt_init(void);
  259. void tx4938_setup(void);
  260. void tx4938_time_init(unsigned int tmrnr);
  261. void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
  262. void tx4938_spi_init(int busid);
  263. void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
  264. int tx4938_report_pciclk(void);
  265. void tx4938_report_pci1clk(void);
  266. int tx4938_pciclk66_setup(void);
  267. struct pci_dev;
  268. int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
  269. void tx4938_setup_pcierr_irq(void);
  270. void tx4938_irq_init(void);
  271. void tx4938_mtd_init(int ch);
  272. void tx4938_ndfmc_init(unsigned int hold, unsigned int spw);
  273. struct tx4938ide_platform_info {
  274. /*
  275. * I/O port shift, for platforms with ports that are
  276. * constantly spaced and need larger than the 1-byte
  277. * spacing used by ata_std_ports().
  278. */
  279. unsigned int ioport_shift;
  280. unsigned int gbus_clock; /* 0 means no PIO mode tuning. */
  281. unsigned int ebus_ch;
  282. };
  283. void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune);
  284. void tx4938_dmac_init(int memcpy_chan0, int memcpy_chan1);
  285. void tx4938_aclc_init(void);
  286. void tx4938_sramc_init(void);
  287. #endif