w83977af_ir.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*********************************************************************
  2. *
  3. * Filename: w83977af_ir.h
  4. * Version:
  5. * Description:
  6. * Status: Experimental.
  7. * Author: Paul VanderSpek
  8. * Created at: Thu Nov 19 13:55:34 1998
  9. * Modified at: Tue Jan 11 13:08:19 2000
  10. * Modified by: Dag Brattli <dagb@cs.uit.no>
  11. *
  12. * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * Neither Dag Brattli nor University of Tromsø admit liability nor
  20. * provide warranty for any of this software. This material is
  21. * provided "AS-IS" and at no charge.
  22. *
  23. ********************************************************************/
  24. #ifndef W83977AF_IR_H
  25. #define W83977AF_IR_H
  26. #include <asm/io.h>
  27. #include <linux/types.h>
  28. /* Flags for configuration register CRF0 */
  29. #define ENBNKSEL 0x01
  30. #define APEDCRC 0x02
  31. #define TXW4C 0x04
  32. #define RXW4C 0x08
  33. /* Bank 0 */
  34. #define RBR 0x00 /* Receiver buffer register */
  35. #define TBR 0x00 /* Transmitter buffer register */
  36. #define ICR 0x01 /* Interrupt configuration register */
  37. #define ICR_ERBRI 0x01 /* Receiver buffer register interrupt */
  38. #define ICR_ETBREI 0x02 /* Transeiver empty interrupt */
  39. #define ICR_EUSRI 0x04//* IR status interrupt */
  40. #define ICR_EHSRI 0x04
  41. #define ICR_ETXURI 0x04 /* Tx underrun */
  42. #define ICR_EDMAI 0x10 /* DMA interrupt */
  43. #define ICR_ETXTHI 0x20 /* Transmitter threshold interrupt */
  44. #define ICR_EFSFI 0x40 /* Frame status FIFO interrupt */
  45. #define ICR_ETMRI 0x80 /* Timer interrupt */
  46. #define UFR 0x02 /* FIFO control register */
  47. #define UFR_EN_FIFO 0x01 /* Enable FIFO's */
  48. #define UFR_RXF_RST 0x02 /* Reset Rx FIFO */
  49. #define UFR_TXF_RST 0x04 /* Reset Tx FIFO */
  50. #define UFR_RXTL 0x80 /* Rx FIFO threshold (set to 16) */
  51. #define UFR_TXTL 0x20 /* Tx FIFO threshold (set to 17) */
  52. #define ISR 0x02 /* Interrupt status register */
  53. #define ISR_RXTH_I 0x01 /* Receive threshold interrupt */
  54. #define ISR_TXEMP_I 0x02 /* Transmitter empty interrupt */
  55. #define ISR_FEND_I 0x04
  56. #define ISR_DMA_I 0x10
  57. #define ISR_TXTH_I 0x20 /* Transmitter threshold interrupt */
  58. #define ISR_FSF_I 0x40
  59. #define ISR_TMR_I 0x80 /* Timer interrupt */
  60. #define UCR 0x03 /* Uart control register */
  61. #define UCR_DLS8 0x03 /* 8N1 */
  62. #define SSR 0x03 /* Sets select register */
  63. #define SET0 UCR_DLS8 /* Make sure we keep 8N1 */
  64. #define SET1 (0x80|UCR_DLS8) /* Make sure we keep 8N1 */
  65. #define SET2 0xE0
  66. #define SET3 0xE4
  67. #define SET4 0xE8
  68. #define SET5 0xEC
  69. #define SET6 0xF0
  70. #define SET7 0xF4
  71. #define HCR 0x04
  72. #define HCR_MODE_MASK ~(0xD0)
  73. #define HCR_SIR 0x60
  74. #define HCR_MIR_576 0x20
  75. #define HCR_MIR_1152 0x80
  76. #define HCR_FIR 0xA0
  77. #define HCR_EN_DMA 0x04
  78. #define HCR_EN_IRQ 0x08
  79. #define HCR_TX_WT 0x08
  80. #define USR 0x05 /* IR status register */
  81. #define USR_RDR 0x01 /* Receive data ready */
  82. #define USR_TSRE 0x40 /* Transmitter empty? */
  83. #define AUDR 0x07
  84. #define AUDR_SFEND 0x08 /* Set a frame end */
  85. #define AUDR_RXBSY 0x20 /* Rx busy */
  86. #define AUDR_UNDR 0x40 /* Transeiver underrun */
  87. /* Set 2 */
  88. #define ABLL 0x00 /* Advanced baud rate divisor latch (low byte) */
  89. #define ABHL 0x01 /* Advanced baud rate divisor latch (high byte) */
  90. #define ADCR1 0x02
  91. #define ADCR1_ADV_SL 0x01
  92. #define ADCR1_D_CHSW 0x08 /* the specs are wrong. its bit 3, not 4 */
  93. #define ADCR1_DMA_F 0x02
  94. #define ADCR2 0x04
  95. #define ADCR2_TXFS32 0x01
  96. #define ADCR2_RXFS32 0x04
  97. #define RXFDTH 0x07
  98. /* Set 3 */
  99. #define AUID 0x00
  100. /* Set 4 */
  101. #define TMRL 0x00 /* Timer value register (low byte) */
  102. #define TMRH 0x01 /* Timer value register (high byte) */
  103. #define IR_MSL 0x02 /* Infrared mode select */
  104. #define IR_MSL_EN_TMR 0x01 /* Enable timer */
  105. #define TFRLL 0x04 /* Transmitter frame length (low byte) */
  106. #define TFRLH 0x05 /* Transmitter frame length (high byte) */
  107. #define RFRLL 0x06 /* Receiver frame length (low byte) */
  108. #define RFRLH 0x07 /* Receiver frame length (high byte) */
  109. /* Set 5 */
  110. #define FS_FO 0x05 /* Frame status FIFO */
  111. #define FS_FO_FSFDR 0x80 /* Frame status FIFO data ready */
  112. #define FS_FO_LST_FR 0x40 /* Frame lost */
  113. #define FS_FO_MX_LEX 0x10 /* Max frame len exceeded */
  114. #define FS_FO_PHY_ERR 0x08 /* Physical layer error */
  115. #define FS_FO_CRC_ERR 0x04
  116. #define FS_FO_RX_OV 0x02 /* Receive overrun */
  117. #define FS_FO_FSF_OV 0x01 /* Frame status FIFO overrun */
  118. #define FS_FO_ERR_MSK 0x5f /* Error mask */
  119. #define RFLFL 0x06
  120. #define RFLFH 0x07
  121. /* Set 6 */
  122. #define IR_CFG2 0x00
  123. #define IR_CFG2_DIS_CRC 0x02
  124. /* Set 7 */
  125. #define IRM_CR 0x07 /* Infrared module control register */
  126. #define IRM_CR_IRX_MSL 0x40
  127. #define IRM_CR_AF_MNT 0x80 /* Automatic format */
  128. /* For storing entries in the status FIFO */
  129. struct st_fifo_entry {
  130. int status;
  131. int len;
  132. };
  133. struct st_fifo {
  134. struct st_fifo_entry entries[10];
  135. int head;
  136. int tail;
  137. int len;
  138. };
  139. /* Private data for each instance */
  140. struct w83977af_ir {
  141. struct st_fifo st_fifo;
  142. int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */
  143. int tx_len; /* Number of frames in tx_buff */
  144. struct net_device *netdev; /* Yes! we are some kind of netdevice */
  145. struct irlap_cb *irlap; /* The link layer we are binded to */
  146. struct qos_info qos; /* QoS capabilities for this device */
  147. chipio_t io; /* IrDA controller information */
  148. iobuff_t tx_buff; /* Transmit buffer */
  149. iobuff_t rx_buff; /* Receive buffer */
  150. dma_addr_t tx_buff_dma;
  151. dma_addr_t rx_buff_dma;
  152. /* Note : currently locking is *very* incomplete, but this
  153. * will get you started. Check in nsc-ircc.c for a proper
  154. * locking strategy. - Jean II */
  155. spinlock_t lock; /* For serializing operations */
  156. __u32 new_speed;
  157. };
  158. static inline void switch_bank( int iobase, int set)
  159. {
  160. outb(set, iobase+SSR);
  161. }
  162. #endif