smc37c93x.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #ifndef __ASM_SH_SMC37C93X_H
  2. #define __ASM_SH_SMC37C93X_H
  3. /*
  4. * linux/include/asm-sh/smc37c93x.h
  5. *
  6. * Copyright (C) 2000 Kazumoto Kojima
  7. *
  8. * SMSC 37C93x Super IO Chip support
  9. */
  10. /* Default base I/O address */
  11. #define FDC_PRIMARY_BASE 0x3f0
  12. #define IDE1_PRIMARY_BASE 0x1f0
  13. #define IDE1_SECONDARY_BASE 0x170
  14. #define PARPORT_PRIMARY_BASE 0x378
  15. #define COM1_PRIMARY_BASE 0x2f8
  16. #define COM2_PRIMARY_BASE 0x3f8
  17. #define RTC_PRIMARY_BASE 0x070
  18. #define KBC_PRIMARY_BASE 0x060
  19. #define AUXIO_PRIMARY_BASE 0x000 /* XXX */
  20. /* Logical device number */
  21. #define LDN_FDC 0
  22. #define LDN_IDE1 1
  23. #define LDN_IDE2 2
  24. #define LDN_PARPORT 3
  25. #define LDN_COM1 4
  26. #define LDN_COM2 5
  27. #define LDN_RTC 6
  28. #define LDN_KBC 7
  29. #define LDN_AUXIO 8
  30. /* Configuration port and key */
  31. #define CONFIG_PORT 0x3f0
  32. #define INDEX_PORT CONFIG_PORT
  33. #define DATA_PORT 0x3f1
  34. #define CONFIG_ENTER 0x55
  35. #define CONFIG_EXIT 0xaa
  36. /* Configuration index */
  37. #define CURRENT_LDN_INDEX 0x07
  38. #define POWER_CONTROL_INDEX 0x22
  39. #define ACTIVATE_INDEX 0x30
  40. #define IO_BASE_HI_INDEX 0x60
  41. #define IO_BASE_LO_INDEX 0x61
  42. #define IRQ_SELECT_INDEX 0x70
  43. #define DMA_SELECT_INDEX 0x74
  44. #define GPIO46_INDEX 0xc6
  45. #define GPIO47_INDEX 0xc7
  46. /* UART stuff. Only for debugging. */
  47. /* UART Register */
  48. #define UART_RBR 0x0 /* Receiver Buffer Register (Read Only) */
  49. #define UART_THR 0x0 /* Transmitter Holding Register (Write Only) */
  50. #define UART_IER 0x2 /* Interrupt Enable Register */
  51. #define UART_IIR 0x4 /* Interrupt Ident Register (Read Only) */
  52. #define UART_FCR 0x4 /* FIFO Control Register (Write Only) */
  53. #define UART_LCR 0x6 /* Line Control Register */
  54. #define UART_MCR 0x8 /* MODEM Control Register */
  55. #define UART_LSR 0xa /* Line Status Register */
  56. #define UART_MSR 0xc /* MODEM Status Register */
  57. #define UART_SCR 0xe /* Scratch Register */
  58. #define UART_DLL 0x0 /* Divisor Latch (LS) */
  59. #define UART_DLM 0x2 /* Divisor Latch (MS) */
  60. #ifndef __ASSEMBLY__
  61. typedef struct uart_reg {
  62. volatile __u16 rbr;
  63. volatile __u16 ier;
  64. volatile __u16 iir;
  65. volatile __u16 lcr;
  66. volatile __u16 mcr;
  67. volatile __u16 lsr;
  68. volatile __u16 msr;
  69. volatile __u16 scr;
  70. } uart_reg;
  71. #endif /* ! __ASSEMBLY__ */
  72. /* Alias for Write Only Register */
  73. #define thr rbr
  74. #define tcr iir
  75. /* Alias for Divisor Latch Register */
  76. #define dll rbr
  77. #define dlm ier
  78. #define fcr iir
  79. /* Interrupt Enable Register */
  80. #define IER_ERDAI 0x0100 /* Enable Received Data Available Interrupt */
  81. #define IER_ETHREI 0x0200 /* Enable Transmitter Holding Register Empty Interrupt */
  82. #define IER_ELSI 0x0400 /* Enable Receiver Line Status Interrupt */
  83. #define IER_EMSI 0x0800 /* Enable MODEM Status Interrupt */
  84. /* Interrupt Ident Register */
  85. #define IIR_IP 0x0100 /* "0" if Interrupt Pending */
  86. #define IIR_IIB0 0x0200 /* Interrupt ID Bit 0 */
  87. #define IIR_IIB1 0x0400 /* Interrupt ID Bit 1 */
  88. #define IIR_IIB2 0x0800 /* Interrupt ID Bit 2 */
  89. #define IIR_FIFO 0xc000 /* FIFOs enabled */
  90. /* FIFO Control Register */
  91. #define FCR_FEN 0x0100 /* FIFO enable */
  92. #define FCR_RFRES 0x0200 /* Receiver FIFO reset */
  93. #define FCR_TFRES 0x0400 /* Transmitter FIFO reset */
  94. #define FCR_DMA 0x0800 /* DMA mode select */
  95. #define FCR_RTL 0x4000 /* Receiver triger (LSB) */
  96. #define FCR_RTM 0x8000 /* Receiver triger (MSB) */
  97. /* Line Control Register */
  98. #define LCR_WLS0 0x0100 /* Word Length Select Bit 0 */
  99. #define LCR_WLS1 0x0200 /* Word Length Select Bit 1 */
  100. #define LCR_STB 0x0400 /* Number of Stop Bits */
  101. #define LCR_PEN 0x0800 /* Parity Enable */
  102. #define LCR_EPS 0x1000 /* Even Parity Select */
  103. #define LCR_SP 0x2000 /* Stick Parity */
  104. #define LCR_SB 0x4000 /* Set Break */
  105. #define LCR_DLAB 0x8000 /* Divisor Latch Access Bit */
  106. /* MODEM Control Register */
  107. #define MCR_DTR 0x0100 /* Data Terminal Ready */
  108. #define MCR_RTS 0x0200 /* Request to Send */
  109. #define MCR_OUT1 0x0400 /* Out 1 */
  110. #define MCR_IRQEN 0x0800 /* IRQ Enable */
  111. #define MCR_LOOP 0x1000 /* Loop */
  112. /* Line Status Register */
  113. #define LSR_DR 0x0100 /* Data Ready */
  114. #define LSR_OE 0x0200 /* Overrun Error */
  115. #define LSR_PE 0x0400 /* Parity Error */
  116. #define LSR_FE 0x0800 /* Framing Error */
  117. #define LSR_BI 0x1000 /* Break Interrupt */
  118. #define LSR_THRE 0x2000 /* Transmitter Holding Register Empty */
  119. #define LSR_TEMT 0x4000 /* Transmitter Empty */
  120. #define LSR_FIFOE 0x8000 /* Receiver FIFO error */
  121. /* MODEM Status Register */
  122. #define MSR_DCTS 0x0100 /* Delta Clear to Send */
  123. #define MSR_DDSR 0x0200 /* Delta Data Set Ready */
  124. #define MSR_TERI 0x0400 /* Trailing Edge Ring Indicator */
  125. #define MSR_DDCD 0x0800 /* Delta Data Carrier Detect */
  126. #define MSR_CTS 0x1000 /* Clear to Send */
  127. #define MSR_DSR 0x2000 /* Data Set Ready */
  128. #define MSR_RI 0x4000 /* Ring Indicator */
  129. #define MSR_DCD 0x8000 /* Data Carrier Detect */
  130. /* Baud Rate Divisor */
  131. #define UART_CLK (1843200) /* 1.8432 MHz */
  132. #define UART_BAUD(x) (UART_CLK / (16 * (x)))
  133. /* RTC register definition */
  134. #define RTC_SECONDS 0
  135. #define RTC_SECONDS_ALARM 1
  136. #define RTC_MINUTES 2
  137. #define RTC_MINUTES_ALARM 3
  138. #define RTC_HOURS 4
  139. #define RTC_HOURS_ALARM 5
  140. #define RTC_DAY_OF_WEEK 6
  141. #define RTC_DAY_OF_MONTH 7
  142. #define RTC_MONTH 8
  143. #define RTC_YEAR 9
  144. #define RTC_FREQ_SELECT 10
  145. # define RTC_UIP 0x80
  146. # define RTC_DIV_CTL 0x70
  147. /* This RTC can work under 32.768KHz clock only. */
  148. # define RTC_OSC_ENABLE 0x20
  149. # define RTC_OSC_DISABLE 0x00
  150. #define RTC_CONTROL 11
  151. # define RTC_SET 0x80
  152. # define RTC_PIE 0x40
  153. # define RTC_AIE 0x20
  154. # define RTC_UIE 0x10
  155. # define RTC_SQWE 0x08
  156. # define RTC_DM_BINARY 0x04
  157. # define RTC_24H 0x02
  158. # define RTC_DST_EN 0x01
  159. #endif /* __ASM_SH_SMC37C93X_H */