tx4939.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. /*
  2. * Definitions for TX4939
  3. *
  4. * Copyright (C) 2000-2001,2005-2006 Toshiba Corporation
  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. #ifndef __ASM_TXX9_TX4939_H
  11. #define __ASM_TXX9_TX4939_H
  12. /* some controllers are compatible with 4927/4938 */
  13. #include <asm/txx9/tx4938.h>
  14. #ifdef CONFIG_64BIT
  15. #define TX4939_REG_BASE 0xffffffffff1f0000UL /* == TX4938_REG_BASE */
  16. #else
  17. #define TX4939_REG_BASE 0xff1f0000UL /* == TX4938_REG_BASE */
  18. #endif
  19. #define TX4939_REG_SIZE 0x00010000 /* == TX4938_REG_SIZE */
  20. #define TX4939_ATA_REG(ch) (TX4939_REG_BASE + 0x3000 + (ch) * 0x1000)
  21. #define TX4939_NDFMC_REG (TX4939_REG_BASE + 0x5000)
  22. #define TX4939_SRAMC_REG (TX4939_REG_BASE + 0x6000)
  23. #define TX4939_CRYPTO_REG (TX4939_REG_BASE + 0x6800)
  24. #define TX4939_PCIC1_REG (TX4939_REG_BASE + 0x7000)
  25. #define TX4939_DDRC_REG (TX4939_REG_BASE + 0x8000)
  26. #define TX4939_EBUSC_REG (TX4939_REG_BASE + 0x9000)
  27. #define TX4939_VPC_REG (TX4939_REG_BASE + 0xa000)
  28. #define TX4939_DMA_REG(ch) (TX4939_REG_BASE + 0xb000 + (ch) * 0x800)
  29. #define TX4939_PCIC_REG (TX4939_REG_BASE + 0xd000)
  30. #define TX4939_CCFG_REG (TX4939_REG_BASE + 0xe000)
  31. #define TX4939_IRC_REG (TX4939_REG_BASE + 0xe800)
  32. #define TX4939_NR_TMR 6 /* 0xf000,0xf100,0xf200,0xfd00,0xfe00,0xff00 */
  33. #define TX4939_TMR_REG(ch) \
  34. (TX4939_REG_BASE + 0xf000 + ((ch) + ((ch) >= 3) * 10) * 0x100)
  35. #define TX4939_NR_SIO 4 /* 0xf300, 0xf400, 0xf380, 0xf480 */
  36. #define TX4939_SIO_REG(ch) \
  37. (TX4939_REG_BASE + 0xf300 + (((ch) & 1) << 8) + (((ch) & 2) << 6))
  38. #define TX4939_ACLC_REG (TX4939_REG_BASE + 0xf700)
  39. #define TX4939_SPI_REG (TX4939_REG_BASE + 0xf800)
  40. #define TX4939_I2C_REG (TX4939_REG_BASE + 0xf900)
  41. #define TX4939_I2S_REG (TX4939_REG_BASE + 0xfa00)
  42. #define TX4939_RTC_REG (TX4939_REG_BASE + 0xfb00)
  43. #define TX4939_CIR_REG (TX4939_REG_BASE + 0xfc00)
  44. #define TX4939_RNG_REG (TX4939_CRYPTO_REG + 0xb0)
  45. struct tx4939_le_reg {
  46. __u32 r;
  47. __u32 unused;
  48. };
  49. struct tx4939_ddrc_reg {
  50. struct tx4939_le_reg ctl[47];
  51. __u64 unused0[17];
  52. __u64 winen;
  53. __u64 win[4];
  54. };
  55. struct tx4939_ccfg_reg {
  56. __u64 ccfg;
  57. __u64 crir;
  58. __u64 pcfg;
  59. __u64 toea;
  60. __u64 clkctr;
  61. __u64 unused0;
  62. __u64 garbc;
  63. __u64 unused1[2];
  64. __u64 ramp;
  65. __u64 unused2[2];
  66. __u64 dskwctrl;
  67. __u64 mclkosc;
  68. __u64 mclkctl;
  69. __u64 unused3[17];
  70. struct {
  71. __u64 mr;
  72. __u64 dr;
  73. } gpio[2];
  74. };
  75. struct tx4939_irc_reg {
  76. struct tx4939_le_reg den;
  77. struct tx4939_le_reg scipb;
  78. struct tx4939_le_reg dm[2];
  79. struct tx4939_le_reg lvl[16];
  80. struct tx4939_le_reg msk;
  81. struct tx4939_le_reg edc;
  82. struct tx4939_le_reg pnd0;
  83. struct tx4939_le_reg cs;
  84. struct tx4939_le_reg pnd1;
  85. struct tx4939_le_reg dm2[2];
  86. struct tx4939_le_reg dbr[2];
  87. struct tx4939_le_reg dben;
  88. struct tx4939_le_reg unused0[2];
  89. struct tx4939_le_reg flag[2];
  90. struct tx4939_le_reg pol;
  91. struct tx4939_le_reg cnt;
  92. struct tx4939_le_reg maskint;
  93. struct tx4939_le_reg maskext;
  94. };
  95. struct tx4939_rtc_reg {
  96. __u32 ctl;
  97. __u32 adr;
  98. __u32 dat;
  99. __u32 tbc;
  100. };
  101. struct tx4939_crypto_reg {
  102. struct tx4939_le_reg csr;
  103. struct tx4939_le_reg idesptr;
  104. struct tx4939_le_reg cdesptr;
  105. struct tx4939_le_reg buserr;
  106. struct tx4939_le_reg cip_tout;
  107. struct tx4939_le_reg cir;
  108. union {
  109. struct {
  110. struct tx4939_le_reg data[8];
  111. struct tx4939_le_reg ctrl;
  112. } gen;
  113. struct {
  114. struct {
  115. struct tx4939_le_reg l;
  116. struct tx4939_le_reg u;
  117. } key[3], ini;
  118. struct tx4939_le_reg ctrl;
  119. } des;
  120. struct {
  121. struct tx4939_le_reg key[4];
  122. struct tx4939_le_reg ini[4];
  123. struct tx4939_le_reg ctrl;
  124. } aes;
  125. struct {
  126. struct {
  127. struct tx4939_le_reg l;
  128. struct tx4939_le_reg u;
  129. } cnt;
  130. struct tx4939_le_reg ini[5];
  131. struct tx4939_le_reg unused;
  132. struct tx4939_le_reg ctrl;
  133. } hash;
  134. } cdr;
  135. struct tx4939_le_reg unused0[7];
  136. struct tx4939_le_reg rcsr;
  137. struct tx4939_le_reg rpr;
  138. __u64 rdr;
  139. __u64 ror[3];
  140. struct tx4939_le_reg unused1[2];
  141. struct tx4939_le_reg xorslr;
  142. struct tx4939_le_reg xorsur;
  143. };
  144. struct tx4939_crypto_desc {
  145. __u32 src;
  146. __u32 dst;
  147. __u32 next;
  148. __u32 ctrl;
  149. __u32 index;
  150. __u32 xor;
  151. };
  152. struct tx4939_vpc_reg {
  153. struct tx4939_le_reg csr;
  154. struct {
  155. struct tx4939_le_reg ctrlA;
  156. struct tx4939_le_reg ctrlB;
  157. struct tx4939_le_reg idesptr;
  158. struct tx4939_le_reg cdesptr;
  159. } port[3];
  160. struct tx4939_le_reg buserr;
  161. };
  162. struct tx4939_vpc_desc {
  163. __u32 src;
  164. __u32 next;
  165. __u32 ctrl1;
  166. __u32 ctrl2;
  167. };
  168. /*
  169. * IRC
  170. */
  171. #define TX4939_IR_NONE 0
  172. #define TX4939_IR_DDR 1
  173. #define TX4939_IR_WTOERR 2
  174. #define TX4939_NUM_IR_INT 3
  175. #define TX4939_IR_INT(n) (3 + (n))
  176. #define TX4939_NUM_IR_ETH 2
  177. #define TX4939_IR_ETH(n) ((n) ? 43 : 6)
  178. #define TX4939_IR_VIDEO 7
  179. #define TX4939_IR_CIR 8
  180. #define TX4939_NUM_IR_SIO 4
  181. #define TX4939_IR_SIO(n) ((n) ? 43 + (n) : 9) /* 9,44-46 */
  182. #define TX4939_NUM_IR_DMA 4
  183. #define TX4939_IR_DMA(ch, n) (((ch) ? 22 : 10) + (n)) /* 10-13,22-25 */
  184. #define TX4939_IR_IRC 14
  185. #define TX4939_IR_PDMAC 15
  186. #define TX4939_NUM_IR_TMR 6
  187. #define TX4939_IR_TMR(n) (((n) >= 3 ? 45 : 16) + (n)) /* 16-18,48-50 */
  188. #define TX4939_NUM_IR_ATA 2
  189. #define TX4939_IR_ATA(n) (19 + (n))
  190. #define TX4939_IR_ACLC 21
  191. #define TX4939_IR_CIPHER 26
  192. #define TX4939_IR_INTA 27
  193. #define TX4939_IR_INTB 28
  194. #define TX4939_IR_INTC 29
  195. #define TX4939_IR_INTD 30
  196. #define TX4939_IR_I2C 33
  197. #define TX4939_IR_SPI 34
  198. #define TX4939_IR_PCIC 35
  199. #define TX4939_IR_PCIC1 36
  200. #define TX4939_IR_PCIERR 37
  201. #define TX4939_IR_PCIPME 38
  202. #define TX4939_IR_NDFMC 39
  203. #define TX4939_IR_ACLCPME 40
  204. #define TX4939_IR_RTC 41
  205. #define TX4939_IR_RND 42
  206. #define TX4939_IR_I2S 47
  207. #define TX4939_NUM_IR 64
  208. #define TX4939_IRC_INT 2 /* IP[2] in Status register */
  209. /*
  210. * CCFG
  211. */
  212. /* CCFG : Chip Configuration */
  213. #define TX4939_CCFG_PCIBOOT 0x0000040000000000ULL
  214. #define TX4939_CCFG_WDRST 0x0000020000000000ULL
  215. #define TX4939_CCFG_WDREXEN 0x0000010000000000ULL
  216. #define TX4939_CCFG_BCFG_MASK 0x000000ff00000000ULL
  217. #define TX4939_CCFG_GTOT_MASK 0x06000000
  218. #define TX4939_CCFG_GTOT_4096 0x06000000
  219. #define TX4939_CCFG_GTOT_2048 0x04000000
  220. #define TX4939_CCFG_GTOT_1024 0x02000000
  221. #define TX4939_CCFG_GTOT_512 0x00000000
  222. #define TX4939_CCFG_TINTDIS 0x01000000
  223. #define TX4939_CCFG_PCI66 0x00800000
  224. #define TX4939_CCFG_PCIMODE 0x00400000
  225. #define TX4939_CCFG_SSCG 0x00100000
  226. #define TX4939_CCFG_MULCLK_MASK 0x000e0000
  227. #define TX4939_CCFG_MULCLK_8 (0x7 << 17)
  228. #define TX4939_CCFG_MULCLK_9 (0x0 << 17)
  229. #define TX4939_CCFG_MULCLK_10 (0x1 << 17)
  230. #define TX4939_CCFG_MULCLK_11 (0x2 << 17)
  231. #define TX4939_CCFG_MULCLK_12 (0x3 << 17)
  232. #define TX4939_CCFG_MULCLK_13 (0x4 << 17)
  233. #define TX4939_CCFG_MULCLK_14 (0x5 << 17)
  234. #define TX4939_CCFG_MULCLK_15 (0x6 << 17)
  235. #define TX4939_CCFG_BEOW 0x00010000
  236. #define TX4939_CCFG_WR 0x00008000
  237. #define TX4939_CCFG_TOE 0x00004000
  238. #define TX4939_CCFG_PCIARB 0x00002000
  239. #define TX4939_CCFG_YDIVMODE_MASK 0x00001c00
  240. #define TX4939_CCFG_YDIVMODE_2 (0x0 << 10)
  241. #define TX4939_CCFG_YDIVMODE_3 (0x1 << 10)
  242. #define TX4939_CCFG_YDIVMODE_5 (0x6 << 10)
  243. #define TX4939_CCFG_YDIVMODE_6 (0x7 << 10)
  244. #define TX4939_CCFG_PTSEL 0x00000200
  245. #define TX4939_CCFG_BESEL 0x00000100
  246. #define TX4939_CCFG_SYSSP_MASK 0x000000c0
  247. #define TX4939_CCFG_ACKSEL 0x00000020
  248. #define TX4939_CCFG_ROMW 0x00000010
  249. #define TX4939_CCFG_ENDIAN 0x00000004
  250. #define TX4939_CCFG_ARMODE 0x00000002
  251. #define TX4939_CCFG_ACEHOLD 0x00000001
  252. /* PCFG : Pin Configuration */
  253. #define TX4939_PCFG_SIO2MODE_MASK 0xc000000000000000ULL
  254. #define TX4939_PCFG_SIO2MODE_GPIO 0x8000000000000000ULL
  255. #define TX4939_PCFG_SIO2MODE_SIO2 0x4000000000000000ULL
  256. #define TX4939_PCFG_SIO2MODE_SIO0 0x0000000000000000ULL
  257. #define TX4939_PCFG_SPIMODE 0x2000000000000000ULL
  258. #define TX4939_PCFG_I2CMODE 0x1000000000000000ULL
  259. #define TX4939_PCFG_I2SMODE_MASK 0x0c00000000000000ULL
  260. #define TX4939_PCFG_I2SMODE_GPIO 0x0c00000000000000ULL
  261. #define TX4939_PCFG_I2SMODE_I2S 0x0800000000000000ULL
  262. #define TX4939_PCFG_I2SMODE_I2S_ALT 0x0400000000000000ULL
  263. #define TX4939_PCFG_I2SMODE_ACLC 0x0000000000000000ULL
  264. #define TX4939_PCFG_SIO3MODE 0x0200000000000000ULL
  265. #define TX4939_PCFG_DMASEL3 0x0004000000000000ULL
  266. #define TX4939_PCFG_DMASEL3_SIO0 0x0004000000000000ULL
  267. #define TX4939_PCFG_DMASEL3_NDFC 0x0000000000000000ULL
  268. #define TX4939_PCFG_VSSMODE 0x0000200000000000ULL
  269. #define TX4939_PCFG_VPSMODE 0x0000100000000000ULL
  270. #define TX4939_PCFG_ET1MODE 0x0000080000000000ULL
  271. #define TX4939_PCFG_ET0MODE 0x0000040000000000ULL
  272. #define TX4939_PCFG_ATA1MODE 0x0000020000000000ULL
  273. #define TX4939_PCFG_ATA0MODE 0x0000010000000000ULL
  274. #define TX4939_PCFG_BP_PLL 0x0000000100000000ULL
  275. #define TX4939_PCFG_SYSCLKEN 0x08000000
  276. #define TX4939_PCFG_PCICLKEN_ALL 0x000f0000
  277. #define TX4939_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
  278. #define TX4939_PCFG_SPEED1 0x00002000
  279. #define TX4939_PCFG_SPEED0 0x00001000
  280. #define TX4939_PCFG_ITMODE 0x00000300
  281. #define TX4939_PCFG_DMASEL_ALL (0x00000007 | TX4939_PCFG_DMASEL3)
  282. #define TX4939_PCFG_DMASEL2 0x00000004
  283. #define TX4939_PCFG_DMASEL2_DRQ2 0x00000000
  284. #define TX4939_PCFG_DMASEL2_SIO0 0x00000004
  285. #define TX4939_PCFG_DMASEL1 0x00000002
  286. #define TX4939_PCFG_DMASEL1_DRQ1 0x00000000
  287. #define TX4939_PCFG_DMASEL0 0x00000001
  288. #define TX4939_PCFG_DMASEL0_DRQ0 0x00000000
  289. /* CLKCTR : Clock Control */
  290. #define TX4939_CLKCTR_IOSCKD 0x8000000000000000ULL
  291. #define TX4939_CLKCTR_SYSCKD 0x4000000000000000ULL
  292. #define TX4939_CLKCTR_TM5CKD 0x2000000000000000ULL
  293. #define TX4939_CLKCTR_TM4CKD 0x1000000000000000ULL
  294. #define TX4939_CLKCTR_TM3CKD 0x0800000000000000ULL
  295. #define TX4939_CLKCTR_CIRCKD 0x0400000000000000ULL
  296. #define TX4939_CLKCTR_SIO3CKD 0x0200000000000000ULL
  297. #define TX4939_CLKCTR_SIO2CKD 0x0100000000000000ULL
  298. #define TX4939_CLKCTR_SIO1CKD 0x0080000000000000ULL
  299. #define TX4939_CLKCTR_VPCCKD 0x0040000000000000ULL
  300. #define TX4939_CLKCTR_EPCICKD 0x0020000000000000ULL
  301. #define TX4939_CLKCTR_ETH1CKD 0x0008000000000000ULL
  302. #define TX4939_CLKCTR_ATA1CKD 0x0004000000000000ULL
  303. #define TX4939_CLKCTR_BROMCKD 0x0002000000000000ULL
  304. #define TX4939_CLKCTR_NDCCKD 0x0001000000000000ULL
  305. #define TX4939_CLKCTR_I2CCKD 0x0000800000000000ULL
  306. #define TX4939_CLKCTR_ETH0CKD 0x0000400000000000ULL
  307. #define TX4939_CLKCTR_SPICKD 0x0000200000000000ULL
  308. #define TX4939_CLKCTR_SRAMCKD 0x0000100000000000ULL
  309. #define TX4939_CLKCTR_PCI1CKD 0x0000080000000000ULL
  310. #define TX4939_CLKCTR_DMA1CKD 0x0000040000000000ULL
  311. #define TX4939_CLKCTR_ACLCKD 0x0000020000000000ULL
  312. #define TX4939_CLKCTR_ATA0CKD 0x0000010000000000ULL
  313. #define TX4939_CLKCTR_DMA0CKD 0x0000008000000000ULL
  314. #define TX4939_CLKCTR_PCICCKD 0x0000004000000000ULL
  315. #define TX4939_CLKCTR_I2SCKD 0x0000002000000000ULL
  316. #define TX4939_CLKCTR_TM0CKD 0x0000001000000000ULL
  317. #define TX4939_CLKCTR_TM1CKD 0x0000000800000000ULL
  318. #define TX4939_CLKCTR_TM2CKD 0x0000000400000000ULL
  319. #define TX4939_CLKCTR_SIO0CKD 0x0000000200000000ULL
  320. #define TX4939_CLKCTR_CYPCKD 0x0000000100000000ULL
  321. #define TX4939_CLKCTR_IOSRST 0x80000000
  322. #define TX4939_CLKCTR_SYSRST 0x40000000
  323. #define TX4939_CLKCTR_TM5RST 0x20000000
  324. #define TX4939_CLKCTR_TM4RST 0x10000000
  325. #define TX4939_CLKCTR_TM3RST 0x08000000
  326. #define TX4939_CLKCTR_CIRRST 0x04000000
  327. #define TX4939_CLKCTR_SIO3RST 0x02000000
  328. #define TX4939_CLKCTR_SIO2RST 0x01000000
  329. #define TX4939_CLKCTR_SIO1RST 0x00800000
  330. #define TX4939_CLKCTR_VPCRST 0x00400000
  331. #define TX4939_CLKCTR_EPCIRST 0x00200000
  332. #define TX4939_CLKCTR_ETH1RST 0x00080000
  333. #define TX4939_CLKCTR_ATA1RST 0x00040000
  334. #define TX4939_CLKCTR_BROMRST 0x00020000
  335. #define TX4939_CLKCTR_NDCRST 0x00010000
  336. #define TX4939_CLKCTR_I2CRST 0x00008000
  337. #define TX4939_CLKCTR_ETH0RST 0x00004000
  338. #define TX4939_CLKCTR_SPIRST 0x00002000
  339. #define TX4939_CLKCTR_SRAMRST 0x00001000
  340. #define TX4939_CLKCTR_PCI1RST 0x00000800
  341. #define TX4939_CLKCTR_DMA1RST 0x00000400
  342. #define TX4939_CLKCTR_ACLRST 0x00000200
  343. #define TX4939_CLKCTR_ATA0RST 0x00000100
  344. #define TX4939_CLKCTR_DMA0RST 0x00000080
  345. #define TX4939_CLKCTR_PCICRST 0x00000040
  346. #define TX4939_CLKCTR_I2SRST 0x00000020
  347. #define TX4939_CLKCTR_TM0RST 0x00000010
  348. #define TX4939_CLKCTR_TM1RST 0x00000008
  349. #define TX4939_CLKCTR_TM2RST 0x00000004
  350. #define TX4939_CLKCTR_SIO0RST 0x00000002
  351. #define TX4939_CLKCTR_CYPRST 0x00000001
  352. /*
  353. * RTC
  354. */
  355. #define TX4939_RTCCTL_ALME 0x00000080
  356. #define TX4939_RTCCTL_ALMD 0x00000040
  357. #define TX4939_RTCCTL_BUSY 0x00000020
  358. #define TX4939_RTCCTL_COMMAND 0x00000007
  359. #define TX4939_RTCCTL_COMMAND_NOP 0x00000000
  360. #define TX4939_RTCCTL_COMMAND_GETTIME 0x00000001
  361. #define TX4939_RTCCTL_COMMAND_SETTIME 0x00000002
  362. #define TX4939_RTCCTL_COMMAND_GETALARM 0x00000003
  363. #define TX4939_RTCCTL_COMMAND_SETALARM 0x00000004
  364. #define TX4939_RTCTBC_PM 0x00000080
  365. #define TX4939_RTCTBC_COMP 0x0000007f
  366. #define TX4939_RTC_REG_RAMSIZE 0x00000100
  367. #define TX4939_RTC_REG_RWBSIZE 0x00000006
  368. /*
  369. * CRYPTO
  370. */
  371. #define TX4939_CRYPTO_CSR_SAESO 0x08000000
  372. #define TX4939_CRYPTO_CSR_SAESI 0x04000000
  373. #define TX4939_CRYPTO_CSR_SDESO 0x02000000
  374. #define TX4939_CRYPTO_CSR_SDESI 0x01000000
  375. #define TX4939_CRYPTO_CSR_INDXBST_MASK 0x00700000
  376. #define TX4939_CRYPTO_CSR_INDXBST(n) ((n) << 20)
  377. #define TX4939_CRYPTO_CSR_TOINT 0x00080000
  378. #define TX4939_CRYPTO_CSR_DCINT 0x00040000
  379. #define TX4939_CRYPTO_CSR_GBINT 0x00010000
  380. #define TX4939_CRYPTO_CSR_INDXAST_MASK 0x0000e000
  381. #define TX4939_CRYPTO_CSR_INDXAST(n) ((n) << 13)
  382. #define TX4939_CRYPTO_CSR_CSWAP_MASK 0x00001800
  383. #define TX4939_CRYPTO_CSR_CSWAP_NONE 0x00000000
  384. #define TX4939_CRYPTO_CSR_CSWAP_IN 0x00000800
  385. #define TX4939_CRYPTO_CSR_CSWAP_OUT 0x00001000
  386. #define TX4939_CRYPTO_CSR_CSWAP_BOTH 0x00001800
  387. #define TX4939_CRYPTO_CSR_CDIV_MASK 0x00000600
  388. #define TX4939_CRYPTO_CSR_CDIV_DIV2 0x00000000
  389. #define TX4939_CRYPTO_CSR_CDIV_DIV1 0x00000200
  390. #define TX4939_CRYPTO_CSR_CDIV_DIV2ALT 0x00000400
  391. #define TX4939_CRYPTO_CSR_CDIV_DIV1ALT 0x00000600
  392. #define TX4939_CRYPTO_CSR_PDINT_MASK 0x000000c0
  393. #define TX4939_CRYPTO_CSR_PDINT_ALL 0x00000000
  394. #define TX4939_CRYPTO_CSR_PDINT_END 0x00000040
  395. #define TX4939_CRYPTO_CSR_PDINT_NEXT 0x00000080
  396. #define TX4939_CRYPTO_CSR_PDINT_NONE 0x000000c0
  397. #define TX4939_CRYPTO_CSR_GINTE 0x00000008
  398. #define TX4939_CRYPTO_CSR_RSTD 0x00000004
  399. #define TX4939_CRYPTO_CSR_RSTC 0x00000002
  400. #define TX4939_CRYPTO_CSR_ENCR 0x00000001
  401. /* bits for tx4939_crypto_reg.cdr.gen.ctrl */
  402. #define TX4939_CRYPTO_CTX_ENGINE_MASK 0x00000003
  403. #define TX4939_CRYPTO_CTX_ENGINE_DES 0x00000000
  404. #define TX4939_CRYPTO_CTX_ENGINE_AES 0x00000001
  405. #define TX4939_CRYPTO_CTX_ENGINE_MD5 0x00000002
  406. #define TX4939_CRYPTO_CTX_ENGINE_SHA1 0x00000003
  407. #define TX4939_CRYPTO_CTX_TDMS 0x00000010
  408. #define TX4939_CRYPTO_CTX_CMS 0x00000020
  409. #define TX4939_CRYPTO_CTX_DMS 0x00000040
  410. #define TX4939_CRYPTO_CTX_UPDATE 0x00000080
  411. /* bits for tx4939_crypto_desc.ctrl */
  412. #define TX4939_CRYPTO_DESC_OB_CNT_MASK 0xffe00000
  413. #define TX4939_CRYPTO_DESC_OB_CNT(cnt) ((cnt) << 21)
  414. #define TX4939_CRYPTO_DESC_IB_CNT_MASK 0x001ffc00
  415. #define TX4939_CRYPTO_DESC_IB_CNT(cnt) ((cnt) << 10)
  416. #define TX4939_CRYPTO_DESC_START 0x00000200
  417. #define TX4939_CRYPTO_DESC_END 0x00000100
  418. #define TX4939_CRYPTO_DESC_XOR 0x00000010
  419. #define TX4939_CRYPTO_DESC_LAST 0x00000008
  420. #define TX4939_CRYPTO_DESC_ERR_MASK 0x00000006
  421. #define TX4939_CRYPTO_DESC_ERR_NONE 0x00000000
  422. #define TX4939_CRYPTO_DESC_ERR_TOUT 0x00000002
  423. #define TX4939_CRYPTO_DESC_ERR_DIGEST 0x00000004
  424. #define TX4939_CRYPTO_DESC_OWN 0x00000001
  425. /* bits for tx4939_crypto_desc.index */
  426. #define TX4939_CRYPTO_DESC_HASH_IDX_MASK 0x00000070
  427. #define TX4939_CRYPTO_DESC_HASH_IDX(idx) ((idx) << 4)
  428. #define TX4939_CRYPTO_DESC_ENCRYPT_IDX_MASK 0x00000007
  429. #define TX4939_CRYPTO_DESC_ENCRYPT_IDX(idx) ((idx) << 0)
  430. #define TX4939_CRYPTO_NR_SET 6
  431. #define TX4939_CRYPTO_RCSR_INTE 0x00000008
  432. #define TX4939_CRYPTO_RCSR_RST 0x00000004
  433. #define TX4939_CRYPTO_RCSR_FIN 0x00000002
  434. #define TX4939_CRYPTO_RCSR_ST 0x00000001
  435. /*
  436. * VPC
  437. */
  438. #define TX4939_VPC_CSR_GBINT 0x00010000
  439. #define TX4939_VPC_CSR_SWAPO 0x00000020
  440. #define TX4939_VPC_CSR_SWAPI 0x00000010
  441. #define TX4939_VPC_CSR_GINTE 0x00000008
  442. #define TX4939_VPC_CSR_RSTD 0x00000004
  443. #define TX4939_VPC_CSR_RSTVPC 0x00000002
  444. #define TX4939_VPC_CTRLA_VDPSN 0x00000200
  445. #define TX4939_VPC_CTRLA_PBUSY 0x00000100
  446. #define TX4939_VPC_CTRLA_DCINT 0x00000080
  447. #define TX4939_VPC_CTRLA_UOINT 0x00000040
  448. #define TX4939_VPC_CTRLA_PDINT_MASK 0x00000030
  449. #define TX4939_VPC_CTRLA_PDINT_ALL 0x00000000
  450. #define TX4939_VPC_CTRLA_PDINT_NEXT 0x00000010
  451. #define TX4939_VPC_CTRLA_PDINT_NONE 0x00000030
  452. #define TX4939_VPC_CTRLA_VDVLDP 0x00000008
  453. #define TX4939_VPC_CTRLA_VDMODE 0x00000004
  454. #define TX4939_VPC_CTRLA_VDFOR 0x00000002
  455. #define TX4939_VPC_CTRLA_ENVPC 0x00000001
  456. /* bits for tx4939_vpc_desc.ctrl1 */
  457. #define TX4939_VPC_DESC_CTRL1_ERR_MASK 0x00000006
  458. #define TX4939_VPC_DESC_CTRL1_OWN 0x00000001
  459. #define tx4939_ddrcptr ((struct tx4939_ddrc_reg __iomem *)TX4939_DDRC_REG)
  460. #define tx4939_ebuscptr tx4938_ebuscptr
  461. #define tx4939_ircptr \
  462. ((struct tx4939_irc_reg __iomem *)TX4939_IRC_REG)
  463. #define tx4939_pcicptr tx4938_pcicptr
  464. #define tx4939_pcic1ptr tx4938_pcic1ptr
  465. #define tx4939_ccfgptr \
  466. ((struct tx4939_ccfg_reg __iomem *)TX4939_CCFG_REG)
  467. #define tx4939_sramcptr tx4938_sramcptr
  468. #define tx4939_rtcptr \
  469. ((struct tx4939_rtc_reg __iomem *)TX4939_RTC_REG)
  470. #define tx4939_cryptoptr \
  471. ((struct tx4939_crypto_reg __iomem *)TX4939_CRYPTO_REG)
  472. #define tx4939_vpcptr ((struct tx4939_vpc_reg __iomem *)TX4939_VPC_REG)
  473. #define TX4939_REV_MAJ_MIN() \
  474. ((__u32)__raw_readq(&tx4939_ccfgptr->crir) & 0x00ff)
  475. #define TX4939_REV_PCODE() \
  476. ((__u32)__raw_readq(&tx4939_ccfgptr->crir) >> 16)
  477. #define TX4939_CCFG_BCFG() \
  478. ((__u32)((__raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_BCFG_MASK) \
  479. >> 32))
  480. #define tx4939_ccfg_clear(bits) tx4938_ccfg_clear(bits)
  481. #define tx4939_ccfg_set(bits) tx4938_ccfg_set(bits)
  482. #define tx4939_ccfg_change(change, new) tx4938_ccfg_change(change, new)
  483. #define TX4939_EBUSC_CR(ch) TX4927_EBUSC_CR(ch)
  484. #define TX4939_EBUSC_BA(ch) TX4927_EBUSC_BA(ch)
  485. #define TX4939_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
  486. #define TX4939_EBUSC_WIDTH(ch) \
  487. (16 >> ((__u32)(TX4939_EBUSC_CR(ch) >> 20) & 0x1))
  488. /* SCLK0 = MSTCLK * 429/19 * 16/245 / 2 (14.745MHz for MST 20MHz) */
  489. #define TX4939_SCLK0(mst) \
  490. ((((mst) + 245/2) / 245UL * 429 * 16 + 19) / 19 / 2)
  491. void tx4939_wdt_init(void);
  492. void tx4939_add_memory_regions(void);
  493. void tx4939_setup(void);
  494. void tx4939_time_init(unsigned int tmrnr);
  495. void tx4939_sio_init(unsigned int sclk, unsigned int cts_mask);
  496. void tx4939_spi_init(int busid);
  497. void tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
  498. int tx4939_report_pciclk(void);
  499. void tx4939_report_pci1clk(void);
  500. struct pci_dev;
  501. int tx4939_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
  502. int tx4939_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
  503. void tx4939_setup_pcierr_irq(void);
  504. void tx4939_irq_init(void);
  505. int tx4939_irq(void);
  506. void tx4939_mtd_init(int ch);
  507. void tx4939_ata_init(void);
  508. void tx4939_rtc_init(void);
  509. void tx4939_ndfmc_init(unsigned int hold, unsigned int spw,
  510. unsigned char ch_mask, unsigned char wide_mask);
  511. void tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1);
  512. void tx4939_aclc_init(void);
  513. void tx4939_sramc_init(void);
  514. void tx4939_rng_init(void);
  515. #endif /* __ASM_TXX9_TX4939_H */