io.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * Definitions for IO devices. Used only in C.
  3. */
  4. enum
  5. {
  6. /* hardware counter frequency */
  7. ClockFreq= 3686400,
  8. };
  9. /*
  10. * IRQ's defined by SA1100
  11. */
  12. enum
  13. {
  14. IRQgpio0= 0,
  15. IRQgpio1= 1,
  16. IRQgpio2= 2,
  17. IRQgpio3= 3,
  18. IRQgpio4= 4,
  19. IRQgpio5= 5,
  20. IRQgpio6= 6,
  21. IRQgpio7= 7,
  22. IRQgpio8= 8,
  23. IRQgpio9= 9,
  24. IRQgpio10= 10,
  25. IRQgpiohi= 11,
  26. IRQlcd= 12,
  27. IRQudc= 13,
  28. IRQuart1b= 15,
  29. IRQuart2= 16,
  30. IRQuart3= 17,
  31. IRQmcp= 18,
  32. IRQssp= 19,
  33. IRQdma0= 20,
  34. IRQdma1= 21,
  35. IRQdma2= 22,
  36. IRQdma3= 23,
  37. IRQdma4= 24,
  38. IRQdma5= 25,
  39. IRQtimer0= 26,
  40. IRQtimer1= 27,
  41. IRQtimer2= 28,
  42. IRQtimer3= 29,
  43. IRQsecond= 30,
  44. IRQrtc= 31,
  45. };
  46. /*
  47. * GPIO lines (signal names from compaq document). _i indicates input
  48. * and _o output.
  49. */
  50. enum
  51. {
  52. GPIO_PWR_ON_i= 1<<0, /* power button */
  53. GPIO_UP_IRQ_i= 1<<1, /* microcontroller interrupts */
  54. GPIO_LDD8_o= 1<<2, /* LCD data 8-15 */
  55. GPIO_LDD9_o= 1<<3,
  56. GPIO_LDD10_o= 1<<4,
  57. GPIO_LDD11_o= 1<<5,
  58. GPIO_LDD12_o= 1<<6,
  59. GPIO_LDD13_o= 1<<7,
  60. GPIO_LDD14_o= 1<<8,
  61. GPIO_LDD15_o= 1<<9,
  62. GPIO_CARD_IND1_i= 1<<10, /* card inserted in PCMCIA socket 1 */
  63. GPIO_CARD_IRQ1_i= 1<<11, /* PCMCIA socket 1 interrupt */
  64. GPIO_CLK_SET0_o= 1<<12, /* clock selects for audio codec */
  65. GPIO_CLK_SET1_o= 1<<13,
  66. GPIO_L3_SDA_io= 1<<14, /* UDA1341 interface */
  67. GPIO_L3_MODE_o= 1<<15,
  68. GPIO_L3_SCLK_o= 1<<16,
  69. GPIO_CARD_IND0_i= 1<<17, /* card inserted in PCMCIA socket 0 */
  70. GPIO_KEY_ACT_i= 1<<18, /* hot key from cradle */
  71. GPIO_SYS_CLK_i= 1<<19, /* clock from codec */
  72. GPIO_BAT_FAULT_i= 1<<20, /* battery fault */
  73. GPIO_CARD_IRQ0_i= 1<<21, /* PCMCIA socket 0 interrupt */
  74. GPIO_LOCK_i= 1<<22, /* expansion pack lock/unlock */
  75. GPIO_COM_DCD_i= 1<<23, /* DCD from UART3 */
  76. GPIO_OPT_IRQ_i= 1<<24, /* expansion pack IRQ */
  77. GPIO_COM_CTS_i= 1<<25, /* CTS from UART3 */
  78. GPIO_COM_RTS_o= 1<<26, /* RTS to UART3 */
  79. GPIO_OPT_IND_i= 1<<27, /* expansion pack inserted */
  80. /* Peripheral Unit GPIO pin assignments: alternate functions */
  81. GPIO_SSP_TXD_o= 1<<10, /* SSP Transmit Data */
  82. GPIO_SSP_RXD_i= 1<<11, /* SSP Receive Data */
  83. GPIO_SSP_SCLK_o= 1<<12, /* SSP Sample CLocK */
  84. GPIO_SSP_SFRM_o= 1<<13, /* SSP Sample FRaMe */
  85. /* ser. port 1: */
  86. GPIO_UART_TXD_o= 1<<14, /* UART Transmit Data */
  87. GPIO_UART_RXD_i= 1<<15, /* UART Receive Data */
  88. GPIO_SDLC_SCLK_io= 1<<16, /* SDLC Sample CLocK (I/O) */
  89. GPIO_SDLC_AAF_o= 1<<17, /* SDLC Abort After Frame */
  90. GPIO_UART_SCLK1_i= 1<<18, /* UART Sample CLocK 1 */
  91. /* ser. port 4: */
  92. GPIO_SSP_CLK_i= 1<<19, /* SSP external CLocK */
  93. /* ser. port 3: */
  94. GPIO_UART_SCLK3_i= 1<<20, /* UART Sample CLocK 3 */
  95. /* ser. port 4: */
  96. GPIO_MCP_CLK_i= 1<<21, /* MCP CLocK */
  97. /* test controller: */
  98. GPIO_TIC_ACK_o= 1<<21, /* TIC ACKnowledge */
  99. GPIO_MBGNT_o= 1<<21, /* Memory Bus GraNT */
  100. GPIO_TREQA_i= 1<<22, /* TIC REQuest A */
  101. GPIO_MBREQ_i= 1<<22, /* Memory Bus REQuest */
  102. GPIO_TREQB_i= 1<<23, /* TIC REQuest B */
  103. GPIO_1Hz_o= 1<<25, /* 1 Hz clock */
  104. GPIO_RCLK_o= 1<<26, /* internal (R) CLocK (O, fcpu/2) */
  105. GPIO_32_768kHz_o= 1<<27, /* 32.768 kHz clock (O, RTC) */
  106. };
  107. /*
  108. * types of interrupts
  109. */
  110. enum
  111. {
  112. GPIOrising,
  113. GPIOfalling,
  114. GPIOboth,
  115. IRQ,
  116. };
  117. /* hardware registers */
  118. typedef struct Uartregs Uartregs;
  119. struct Uartregs
  120. {
  121. ulong ctl[4];
  122. ulong dummya;
  123. ulong data;
  124. ulong dummyb;
  125. ulong status[2];
  126. };
  127. Uartregs *uart3regs;
  128. /* general purpose I/O lines control registers */
  129. typedef struct GPIOregs GPIOregs;
  130. struct GPIOregs
  131. {
  132. ulong level; /* 1 == high */
  133. ulong direction; /* 1 == output */
  134. ulong set; /* a 1 sets the bit, 0 leaves it alone */
  135. ulong clear; /* a 1 clears the bit, 0 leaves it alone */
  136. ulong rising; /* rising edge detect enable */
  137. ulong falling; /* falling edge detect enable */
  138. ulong edgestatus; /* writing a 1 bit clears */
  139. ulong altfunc; /* turn on alternate function for any set bits */
  140. };
  141. extern GPIOregs *gpioregs;
  142. /* extra general purpose I/O bits, output only */
  143. enum
  144. {
  145. EGPIO_prog_flash= 1<<0,
  146. EGPIO_pcmcia_reset= 1<<1,
  147. EGPIO_exppack_reset= 1<<2,
  148. EGPIO_codec_reset= 1<<3,
  149. EGPIO_exp_nvram_power= 1<<4,
  150. EGPIO_exp_full_power= 1<<5,
  151. EGPIO_lcd_3v= 1<<6,
  152. EGPIO_rs232_power= 1<<7,
  153. EGPIO_lcd_ic_power= 1<<8,
  154. EGPIO_ir_power= 1<<9,
  155. EGPIO_audio_power= 1<<10,
  156. EGPIO_audio_ic_power= 1<<11,
  157. EGPIO_audio_mute= 1<<12,
  158. EGPIO_fir= 1<<13, /* not set is sir */
  159. EGPIO_lcd_5v= 1<<14,
  160. EGPIO_lcd_9v= 1<<15,
  161. };
  162. extern ulong *egpioreg;
  163. /* Peripheral pin controller registers */
  164. typedef struct PPCregs PPCregs;
  165. struct PPCregs {
  166. ulong direction;
  167. ulong state;
  168. ulong assignment;
  169. ulong sleepdir;
  170. ulong flags;
  171. };
  172. extern PPCregs *ppcregs;
  173. /* Synchronous Serial Port controller registers */
  174. typedef struct SSPregs SSPregs;
  175. struct SSPregs {
  176. ulong control0;
  177. ulong control1;
  178. ulong dummy0;
  179. ulong data;
  180. ulong dummy1;
  181. ulong status;
  182. };
  183. extern SSPregs *sspregs;
  184. /* Multimedia Communications Port controller registers */
  185. typedef struct MCPregs MCPregs;
  186. struct MCPregs {
  187. ulong control0;
  188. ulong reserved0;
  189. ulong data0;
  190. ulong data1;
  191. ulong data2;
  192. ulong reserved1;
  193. ulong status;
  194. ulong reserved[11];
  195. ulong control1;
  196. };
  197. extern MCPregs *mcpregs;
  198. /*
  199. * memory configuration
  200. */
  201. enum
  202. {
  203. /* bit shifts for pcmcia access time counters */
  204. MECR_io0= 0,
  205. MECR_attr0= 5,
  206. MECR_mem0= 10,
  207. MECR_fast0= 11,
  208. MECR_io1= MECR_io0+16,
  209. MECR_attr1= MECR_attr0+16,
  210. MECR_mem1= MECR_mem0+16,
  211. MECR_fast1= MECR_fast0+16,
  212. };
  213. typedef struct MemConfRegs MemConfRegs;
  214. struct MemConfRegs
  215. {
  216. ulong mdcnfg; /* dram */
  217. ulong mdcas00; /* dram banks 0/1 */
  218. ulong mdcas01;
  219. ulong mdcas02;
  220. ulong msc0; /* static */
  221. ulong msc1;
  222. ulong mecr; /* pcmcia */
  223. ulong mdrefr; /* dram refresh */
  224. ulong mdcas20; /* dram banks 2/3 */
  225. ulong mdcas21;
  226. ulong mdcas22;
  227. ulong msc2; /* static */
  228. ulong smcnfg; /* SMROM config */
  229. };
  230. extern MemConfRegs *memconfregs;
  231. /*
  232. * power management
  233. */
  234. typedef struct PowerRegs PowerRegs;
  235. struct PowerRegs
  236. {
  237. ulong pmcr; /* Power manager control register */
  238. ulong pssr; /* Power manager sleep status register */
  239. ulong pspr; /* Power manager scratch pad register */
  240. ulong pwer; /* Power manager wakeup enable register */
  241. ulong pcfr; /* Power manager general configuration register */
  242. ulong ppcr; /* Power manager PPL configuration register */
  243. ulong pgsr; /* Power manager GPIO sleep state register */
  244. ulong posr; /* Power manager oscillator status register */
  245. };
  246. extern PowerRegs *powerregs;