ep93xx.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. * Cirrus Logic EP93xx register definitions.
  3. *
  4. * Copyright (C) 2009
  5. * Matthias Kaehlcke <matthias@kaehlcke.net>
  6. *
  7. * Copyright (C) 2006
  8. * Dominic Rath <Dominic.Rath@gmx.de>
  9. *
  10. * Copyright (C) 2004, 2005
  11. * Cory T. Tusar, Videon Central, Inc., <ctusar@videon-central.com>
  12. *
  13. * Based in large part on linux/include/asm-arm/arch-ep93xx/regmap.h, which is
  14. *
  15. * Copyright (C) 2004 Ray Lehtiniemi
  16. * Copyright (C) 2003 Cirrus Logic, Inc
  17. * Copyright (C) 1999 ARM Limited.
  18. *
  19. * See file CREDITS for list of people who contributed to this project.
  20. *
  21. * This program is free software; you can redistribute it and/or modify
  22. * it under the terms of the GNU General Public License as published by
  23. * the Free Software Foundation; either version 2 of the License, or
  24. * (at your option) any later version.
  25. *
  26. * This program is distributed in the hope that it will be useful, but
  27. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  28. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  29. * for more details.
  30. *
  31. * You should have received a copy of the GNU General Public License along
  32. * with this program; if not, write to the Free Software Foundation, Inc.,
  33. * 675 Mass Ave, Cambridge, MA 02139, USA.
  34. */
  35. #define EP93XX_AHB_BASE 0x80000000
  36. #define EP93XX_APB_BASE 0x80800000
  37. /*
  38. * 0x80000000 - 0x8000FFFF: DMA
  39. */
  40. #define DMA_OFFSET 0x000000
  41. #define DMA_BASE (EP93XX_AHB_BASE | DMA_OFFSET)
  42. #ifndef __ASSEMBLY__
  43. struct dma_channel {
  44. uint32_t control;
  45. uint32_t interrupt;
  46. uint32_t ppalloc;
  47. uint32_t status;
  48. uint32_t reserved0;
  49. uint32_t remain;
  50. uint32_t reserved1[2];
  51. uint32_t maxcnt0;
  52. uint32_t base0;
  53. uint32_t current0;
  54. uint32_t reserved2;
  55. uint32_t maxcnt1;
  56. uint32_t base1;
  57. uint32_t current1;
  58. uint32_t reserved3;
  59. };
  60. struct dma_regs {
  61. struct dma_channel m2p_channel_0;
  62. struct dma_channel m2p_channel_1;
  63. struct dma_channel m2p_channel_2;
  64. struct dma_channel m2p_channel_3;
  65. struct dma_channel m2m_channel_0;
  66. struct dma_channel m2m_channel_1;
  67. struct dma_channel reserved0[2];
  68. struct dma_channel m2p_channel_5;
  69. struct dma_channel m2p_channel_4;
  70. struct dma_channel m2p_channel_7;
  71. struct dma_channel m2p_channel_6;
  72. struct dma_channel m2p_channel_9;
  73. struct dma_channel m2p_channel_8;
  74. uint32_t channel_arbitration;
  75. uint32_t reserved[15];
  76. uint32_t global_interrupt;
  77. };
  78. #endif
  79. /*
  80. * 0x80010000 - 0x8001FFFF: Ethernet MAC
  81. */
  82. #define MAC_OFFSET 0x010000
  83. #define MAC_BASE (EP93XX_AHB_BASE | MAC_OFFSET)
  84. #ifndef __ASSEMBLY__
  85. struct mac_queue {
  86. uint32_t badd;
  87. union { /* deal with half-word aligned registers */
  88. uint32_t blen;
  89. union {
  90. uint16_t filler;
  91. uint16_t curlen;
  92. };
  93. };
  94. uint32_t curadd;
  95. };
  96. struct mac_regs {
  97. uint32_t rxctl;
  98. uint32_t txctl;
  99. uint32_t testctl;
  100. uint32_t reserved0;
  101. uint32_t miicmd;
  102. uint32_t miidata;
  103. uint32_t miists;
  104. uint32_t reserved1;
  105. uint32_t selfctl;
  106. uint32_t inten;
  107. uint32_t intstsp;
  108. uint32_t intstsc;
  109. uint32_t reserved2[2];
  110. uint32_t diagad;
  111. uint32_t diagdata;
  112. uint32_t gt;
  113. uint32_t fct;
  114. uint32_t fcf;
  115. uint32_t afp;
  116. union {
  117. struct {
  118. uint32_t indad;
  119. uint32_t indad_upper;
  120. };
  121. uint32_t hashtbl;
  122. };
  123. uint32_t reserved3[2];
  124. uint32_t giintsts;
  125. uint32_t giintmsk;
  126. uint32_t giintrosts;
  127. uint32_t giintfrc;
  128. uint32_t txcollcnt;
  129. uint32_t rxmissnct;
  130. uint32_t rxruntcnt;
  131. uint32_t reserved4;
  132. uint32_t bmctl;
  133. uint32_t bmsts;
  134. uint32_t rxbca;
  135. uint32_t reserved5;
  136. struct mac_queue rxdq;
  137. uint32_t rxdqenq;
  138. struct mac_queue rxstsq;
  139. uint32_t rxstsqenq;
  140. struct mac_queue txdq;
  141. uint32_t txdqenq;
  142. struct mac_queue txstsq;
  143. uint32_t reserved6;
  144. uint32_t rxbufthrshld;
  145. uint32_t txbufthrshld;
  146. uint32_t rxststhrshld;
  147. uint32_t txststhrshld;
  148. uint32_t rxdthrshld;
  149. uint32_t txdthrshld;
  150. uint32_t maxfrmlen;
  151. uint32_t maxhdrlen;
  152. };
  153. #endif
  154. #define SELFCTL_RWP (1 << 7)
  155. #define SELFCTL_GPO0 (1 << 5)
  156. #define SELFCTL_PUWE (1 << 4)
  157. #define SELFCTL_PDWE (1 << 3)
  158. #define SELFCTL_MIIL (1 << 2)
  159. #define SELFCTL_RESET (1 << 0)
  160. #define INTSTS_RWI (1 << 30)
  161. #define INTSTS_RXMI (1 << 29)
  162. #define INTSTS_RXBI (1 << 28)
  163. #define INTSTS_RXSQI (1 << 27)
  164. #define INTSTS_TXLEI (1 << 26)
  165. #define INTSTS_ECIE (1 << 25)
  166. #define INTSTS_TXUHI (1 << 24)
  167. #define INTSTS_MOI (1 << 18)
  168. #define INTSTS_TXCOI (1 << 17)
  169. #define INTSTS_RXROI (1 << 16)
  170. #define INTSTS_MIII (1 << 12)
  171. #define INTSTS_PHYI (1 << 11)
  172. #define INTSTS_TI (1 << 10)
  173. #define INTSTS_AHBE (1 << 8)
  174. #define INTSTS_OTHER (1 << 4)
  175. #define INTSTS_TXSQ (1 << 3)
  176. #define INTSTS_RXSQ (1 << 2)
  177. #define BMCTL_MT (1 << 13)
  178. #define BMCTL_TT (1 << 12)
  179. #define BMCTL_UNH (1 << 11)
  180. #define BMCTL_TXCHR (1 << 10)
  181. #define BMCTL_TXDIS (1 << 9)
  182. #define BMCTL_TXEN (1 << 8)
  183. #define BMCTL_EH2 (1 << 6)
  184. #define BMCTL_EH1 (1 << 5)
  185. #define BMCTL_EEOB (1 << 4)
  186. #define BMCTL_RXCHR (1 << 2)
  187. #define BMCTL_RXDIS (1 << 1)
  188. #define BMCTL_RXEN (1 << 0)
  189. #define BMSTS_TXACT (1 << 7)
  190. #define BMSTS_TP (1 << 4)
  191. #define BMSTS_RXACT (1 << 3)
  192. #define BMSTS_QID_MASK 0x07
  193. #define BMSTS_QID_RXDATA 0x00
  194. #define BMSTS_QID_TXDATA 0x01
  195. #define BMSTS_QID_RXSTS 0x02
  196. #define BMSTS_QID_TXSTS 0x03
  197. #define BMSTS_QID_RXDESC 0x04
  198. #define BMSTS_QID_TXDESC 0x05
  199. #define AFP_MASK 0x07
  200. #define AFP_IAPRIMARY 0x00
  201. #define AFP_IASECONDARY1 0x01
  202. #define AFP_IASECONDARY2 0x02
  203. #define AFP_IASECONDARY3 0x03
  204. #define AFP_TX 0x06
  205. #define AFP_HASH 0x07
  206. #define RXCTL_PAUSEA (1 << 20)
  207. #define RXCTL_RXFCE1 (1 << 19)
  208. #define RXCTL_RXFCE0 (1 << 18)
  209. #define RXCTL_BCRC (1 << 17)
  210. #define RXCTL_SRXON (1 << 16)
  211. #define RXCTL_RCRCA (1 << 13)
  212. #define RXCTL_RA (1 << 12)
  213. #define RXCTL_PA (1 << 11)
  214. #define RXCTL_BA (1 << 10)
  215. #define RXCTL_MA (1 << 9)
  216. #define RXCTL_IAHA (1 << 8)
  217. #define RXCTL_IA3 (1 << 3)
  218. #define RXCTL_IA2 (1 << 2)
  219. #define RXCTL_IA1 (1 << 1)
  220. #define RXCTL_IA0 (1 << 0)
  221. #define TXCTL_DEFDIS (1 << 7)
  222. #define TXCTL_MBE (1 << 6)
  223. #define TXCTL_ICRC (1 << 5)
  224. #define TXCTL_TPD (1 << 4)
  225. #define TXCTL_OCOLL (1 << 3)
  226. #define TXCTL_SP (1 << 2)
  227. #define TXCTL_PB (1 << 1)
  228. #define TXCTL_STXON (1 << 0)
  229. #define MIICMD_REGAD_MASK (0x001F)
  230. #define MIICMD_PHYAD_MASK (0x03E0)
  231. #define MIICMD_OPCODE_MASK (0xC000)
  232. #define MIICMD_PHYAD_8950 (0x0000)
  233. #define MIICMD_OPCODE_READ (0x8000)
  234. #define MIICMD_OPCODE_WRITE (0x4000)
  235. #define MIISTS_BUSY (1 << 0)
  236. /*
  237. * 0x80020000 - 0x8002FFFF: USB OHCI
  238. */
  239. #define USB_OFFSET 0x020000
  240. #define USB_BASE (EP93XX_AHB_BASE | USB_OFFSET)
  241. /*
  242. * 0x80030000 - 0x8003FFFF: Raster engine
  243. */
  244. #if (defined(CONFIG_EP9307) || defined(CONFIG_EP9312) || defined(CONFIG_EP9315))
  245. #define RASTER_OFFSET 0x030000
  246. #define RASTER_BASE (EP93XX_AHB_BASE | RASTER_OFFSET)
  247. #endif
  248. /*
  249. * 0x80040000 - 0x8004FFFF: Graphics accelerator
  250. */
  251. #if defined(CONFIG_EP9315)
  252. #define GFX_OFFSET 0x040000
  253. #define GFX_BASE (EP93XX_AHB_BASE | GFX_OFFSET)
  254. #endif
  255. /*
  256. * 0x80050000 - 0x8005FFFF: Reserved
  257. */
  258. /*
  259. * 0x80060000 - 0x8006FFFF: SDRAM controller
  260. */
  261. #define SDRAM_OFFSET 0x060000
  262. #define SDRAM_BASE (EP93XX_AHB_BASE | SDRAM_OFFSET)
  263. #ifndef __ASSEMBLY__
  264. struct sdram_regs {
  265. uint32_t reserved;
  266. uint32_t glconfig;
  267. uint32_t refrshtimr;
  268. uint32_t bootsts;
  269. uint32_t devcfg0;
  270. uint32_t devcfg1;
  271. uint32_t devcfg2;
  272. uint32_t devcfg3;
  273. };
  274. #endif
  275. #define SDRAM_DEVCFG_EXTBUSWIDTH (1 << 2)
  276. #define SDRAM_DEVCFG_BANKCOUNT (1 << 3)
  277. #define SDRAM_DEVCFG_SROMLL (1 << 5)
  278. #define SDRAM_DEVCFG_CASLAT_2 0x00010000
  279. #define SDRAM_DEVCFG_RASTOCAS_2 0x00200000
  280. #define GLCONFIG_INIT (1 << 0)
  281. #define GLCONFIG_MRS (1 << 1)
  282. #define GLCONFIG_SMEMBUSY (1 << 5)
  283. #define GLCONFIG_LCR (1 << 6)
  284. #define GLCONFIG_REARBEN (1 << 7)
  285. #define GLCONFIG_CLKSHUTDOWN (1 << 30)
  286. #define GLCONFIG_CKE (1 << 31)
  287. /*
  288. * 0x80070000 - 0x8007FFFF: Reserved
  289. */
  290. /*
  291. * 0x80080000 - 0x8008FFFF: SRAM controller & PCMCIA
  292. */
  293. #define SMC_OFFSET 0x080000
  294. #define SMC_BASE (EP93XX_AHB_BASE | SMC_OFFSET)
  295. #ifndef __ASSEMBLY__
  296. struct smc_regs {
  297. uint32_t bcr0;
  298. uint32_t bcr1;
  299. uint32_t bcr2;
  300. uint32_t bcr3;
  301. uint32_t reserved0[2];
  302. uint32_t bcr6;
  303. uint32_t bcr7;
  304. #if defined(CONFIG_EP9315)
  305. uint32_t pcattribute;
  306. uint32_t pccommon;
  307. uint32_t pcio;
  308. uint32_t reserved1[5];
  309. uint32_t pcmciactrl;
  310. #endif
  311. };
  312. #endif
  313. #define SMC_BCR_IDCY_SHIFT 0
  314. #define SMC_BCR_WST1_SHIFT 5
  315. #define SMC_BCR_BLE (1 << 10)
  316. #define SMC_BCR_WST2_SHIFT 11
  317. #define SMC_BCR_MW_SHIFT 28
  318. /*
  319. * 0x80090000 - 0x8009FFFF: Boot ROM
  320. */
  321. /*
  322. * 0x800A0000 - 0x800AFFFF: IDE interface
  323. */
  324. /*
  325. * 0x800B0000 - 0x800BFFFF: VIC1
  326. */
  327. /*
  328. * 0x800C0000 - 0x800CFFFF: VIC2
  329. */
  330. /*
  331. * 0x800D0000 - 0x800FFFFF: Reserved
  332. */
  333. /*
  334. * 0x80800000 - 0x8080FFFF: Reserved
  335. */
  336. /*
  337. * 0x80810000 - 0x8081FFFF: Timers
  338. */
  339. #define TIMER_OFFSET 0x010000
  340. #define TIMER_BASE (EP93XX_APB_BASE | TIMER_OFFSET)
  341. #ifndef __ASSEMBLY__
  342. struct timer {
  343. uint32_t load;
  344. uint32_t value;
  345. uint32_t control;
  346. uint32_t clear;
  347. };
  348. struct timer4 {
  349. uint32_t value_low;
  350. uint32_t value_high;
  351. };
  352. struct timer_regs {
  353. struct timer timer1;
  354. uint32_t reserved0[4];
  355. struct timer timer2;
  356. uint32_t reserved1[12];
  357. struct timer4 timer4;
  358. uint32_t reserved2[6];
  359. struct timer timer3;
  360. };
  361. #endif
  362. /*
  363. * 0x80820000 - 0x8082FFFF: I2S
  364. */
  365. #define I2S_OFFSET 0x020000
  366. #define I2S_BASE (EP93XX_APB_BASE | I2S_OFFSET)
  367. /*
  368. * 0x80830000 - 0x8083FFFF: Security
  369. */
  370. #define SECURITY_OFFSET 0x030000
  371. #define SECURITY_BASE (EP93XX_APB_BASE | SECURITY_OFFSET)
  372. #define EXTENSIONID (SECURITY_BASE + 0x2714)
  373. /*
  374. * 0x80840000 - 0x8084FFFF: GPIO
  375. */
  376. #define GPIO_OFFSET 0x040000
  377. #define GPIO_BASE (EP93XX_APB_BASE | GPIO_OFFSET)
  378. #ifndef __ASSEMBLY__
  379. struct gpio_int {
  380. uint32_t inttype1;
  381. uint32_t inttype2;
  382. uint32_t eoi;
  383. uint32_t inten;
  384. uint32_t intsts;
  385. uint32_t rawintsts;
  386. uint32_t db;
  387. };
  388. struct gpio_regs {
  389. uint32_t padr;
  390. uint32_t pbdr;
  391. uint32_t pcdr;
  392. uint32_t pddr;
  393. uint32_t paddr;
  394. uint32_t pbddr;
  395. uint32_t pcddr;
  396. uint32_t pdddr;
  397. uint32_t pedr;
  398. uint32_t peddr;
  399. uint32_t reserved0[2];
  400. uint32_t pfdr;
  401. uint32_t pfddr;
  402. uint32_t pgdr;
  403. uint32_t pgddr;
  404. uint32_t phdr;
  405. uint32_t phddr;
  406. uint32_t reserved1;
  407. uint32_t finttype1;
  408. uint32_t finttype2;
  409. uint32_t reserved2;
  410. struct gpio_int pfint;
  411. uint32_t reserved3[10];
  412. struct gpio_int paint;
  413. struct gpio_int pbint;
  414. uint32_t eedrive;
  415. };
  416. #endif
  417. /*
  418. * 0x80850000 - 0x8087FFFF: Reserved
  419. */
  420. /*
  421. * 0x80880000 - 0x8088FFFF: AAC
  422. */
  423. #define AAC_OFFSET 0x080000
  424. #define AAC_BASE (EP93XX_APB_BASE | AAC_OFFSET)
  425. /*
  426. * 0x80890000 - 0x8089FFFF: Reserved
  427. */
  428. /*
  429. * 0x808A0000 - 0x808AFFFF: SPI
  430. */
  431. #define SPI_OFFSET 0x0A0000
  432. #define SPI_BASE (EP93XX_APB_BASE | SPI_OFFSET)
  433. /*
  434. * 0x808B0000 - 0x808BFFFF: IrDA
  435. */
  436. #define IRDA_OFFSET 0x0B0000
  437. #define IRDA_BASE (EP93XX_APB_BASE | IRDA_OFFSET)
  438. /*
  439. * 0x808C0000 - 0x808CFFFF: UART1
  440. */
  441. #define UART1_OFFSET 0x0C0000
  442. #define UART1_BASE (EP93XX_APB_BASE | UART1_OFFSET)
  443. /*
  444. * 0x808D0000 - 0x808DFFFF: UART2
  445. */
  446. #define UART2_OFFSET 0x0D0000
  447. #define UART2_BASE (EP93XX_APB_BASE | UART2_OFFSET)
  448. /*
  449. * 0x808E0000 - 0x808EFFFF: UART3
  450. */
  451. #define UART3_OFFSET 0x0E0000
  452. #define UART3_BASE (EP93XX_APB_BASE | UART3_OFFSET)
  453. /*
  454. * 0x808F0000 - 0x808FFFFF: Key Matrix
  455. */
  456. #define KEY_OFFSET 0x0F0000
  457. #define KEY_BASE (EP93XX_APB_BASE | KEY_OFFSET)
  458. /*
  459. * 0x80900000 - 0x8090FFFF: Touchscreen
  460. */
  461. #define TOUCH_OFFSET 0x900000
  462. #define TOUCH_BASE (EP93XX_APB_BASE | TOUCH_OFFSET)
  463. /*
  464. * 0x80910000 - 0x8091FFFF: Pulse Width Modulation
  465. */
  466. #define PWM_OFFSET 0x910000
  467. #define PWM_BASE (EP93XX_APB_BASE | PWM_OFFSET)
  468. /*
  469. * 0x80920000 - 0x8092FFFF: Real time clock
  470. */
  471. #define RTC_OFFSET 0x920000
  472. #define RTC_BASE (EP93XX_APB_BASE | RTC_OFFSET)
  473. /*
  474. * 0x80930000 - 0x8093FFFF: Syscon
  475. */
  476. #define SYSCON_OFFSET 0x930000
  477. #define SYSCON_BASE (EP93XX_APB_BASE | SYSCON_OFFSET)
  478. #ifndef __ASSEMBLY__
  479. struct syscon_regs {
  480. uint32_t pwrsts;
  481. uint32_t pwrcnt;
  482. uint32_t halt;
  483. uint32_t stby;
  484. uint32_t reserved0[2];
  485. uint32_t teoi;
  486. uint32_t stfclr;
  487. uint32_t clkset1;
  488. uint32_t clkset2;
  489. uint32_t reserved1[6];
  490. uint32_t scratch0;
  491. uint32_t scratch1;
  492. uint32_t reserved2[2];
  493. uint32_t apbwait;
  494. uint32_t bustmstrarb;
  495. uint32_t bootmodeclr;
  496. uint32_t reserved3[9];
  497. uint32_t devicecfg;
  498. uint32_t vidclkdiv;
  499. uint32_t mirclkdiv;
  500. uint32_t i2sclkdiv;
  501. uint32_t keytchclkdiv;
  502. uint32_t chipid;
  503. uint32_t reserved4;
  504. uint32_t syscfg;
  505. uint32_t reserved5[8];
  506. uint32_t sysswlock;
  507. };
  508. #else
  509. #define SYSCON_SCRATCH0 (SYSCON_BASE + 0x0040)
  510. #endif
  511. #define SYSCON_PWRCNT_UART_BAUD (1 << 29)
  512. #define SYSCON_CLKSET_PLL_X2IPD_SHIFT 0
  513. #define SYSCON_CLKSET_PLL_X2FBD2_SHIFT 5
  514. #define SYSCON_CLKSET_PLL_X1FBD1_SHIFT 11
  515. #define SYSCON_CLKSET_PLL_PS_SHIFT 16
  516. #define SYSCON_CLKSET1_PCLK_DIV_SHIFT 18
  517. #define SYSCON_CLKSET1_HCLK_DIV_SHIFT 20
  518. #define SYSCON_CLKSET1_NBYP1 (1 << 23)
  519. #define SYSCON_CLKSET1_FCLK_DIV_SHIFT 25
  520. #define SYSCON_CLKSET2_PLL2_EN (1 << 18)
  521. #define SYSCON_CLKSET2_NBYP2 (1 << 19)
  522. #define SYSCON_CLKSET2_USB_DIV_SHIFT 28
  523. #define SYSCON_CHIPID_REV_MASK 0xF0000000
  524. #define SYSCON_DEVICECFG_SWRST (1 << 31)
  525. /*
  526. * 0x80930000 - 0x8093FFFF: Watchdog Timer
  527. */
  528. #define WATCHDOG_OFFSET 0x940000
  529. #define WATCHDOG_BASE (EP93XX_APB_BASE | WATCHDOG_OFFSET)
  530. /*
  531. * 0x80950000 - 0x9000FFFF: Reserved
  532. */