smc37c93x.h 5.6 KB

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