1 /*********************************************************************
5 * Description: Driver for the VIA VT8231/VT8233 IrDA chipsets
6 * Author: VIA Technologies, inc
9 Copyright (c) 1998-2003 VIA Technologies, Inc.
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free Software
13 Foundation; either version 2, or (at your option) any later version.
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTIES OR REPRESENTATIONS; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc.,
22 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * jul/08/2002 : Rx buffer length should use Rx ring ptr.
26 * Oct/28/2002 : Add SB id for 3147 and 3177.
27 * jul/09/2002 : only implement two kind of dongle currently.
28 * Oct/02/2002 : work on VT8231 and VT8233 .
29 * Aug/06/2003 : change driver format to pci driver .
30 ********************************************************************/
33 #include <linux/time.h>
34 #include <linux/spinlock.h>
36 #include <linux/types.h>
39 #define MAX_TX_WINDOW 7
40 #define MAX_RX_WINDOW 7
42 struct st_fifo_entry
{
48 struct st_fifo_entry entries
[MAX_RX_WINDOW
+ 2];
56 void *start
; /* Start of frame in DMA mem */
57 int len
; /* Length of frame in DMA mem */
61 struct frame_cb queue
[MAX_TX_WINDOW
+ 2]; /* Info about frames in queue */
62 int ptr
; /* Currently being sent */
63 int len
; /* Length of queue */
64 int free
; /* Next free slot */
65 void *tail
; /* Next free start in DMA mem */
69 struct eventflag
// for keeping track of Interrupt Events
72 unsigned char TxFIFOUnderRun
;
73 unsigned char EOMessage
;
74 unsigned char TxFIFOReady
;
75 unsigned char EarlyEOM
;
79 unsigned char RxFIFOOverRun
;
80 unsigned char EOPacket
;
81 unsigned char RxAvail
;
82 unsigned char TooLargePacket
;
85 unsigned char Unknown
;
87 unsigned char TimeOut
;
88 unsigned char RxDMATC
;
89 unsigned char TxDMATC
;
92 /* Private data for each instance */
94 struct st_fifo st_fifo
; /* Info about received frames */
95 struct tx_fifo tx_fifo
; /* Info about frames to be transmitted */
97 struct net_device
*netdev
; /* Yes! we are some kind of netdevice */
99 struct irlap_cb
*irlap
; /* The link layer we are binded to */
100 struct qos_info qos
; /* QoS capabilities for this device */
102 chipio_t io
; /* IrDA controller information */
103 iobuff_t tx_buff
; /* Transmit buffer */
104 iobuff_t rx_buff
; /* Receive buffer */
105 dma_addr_t tx_buff_dma
;
106 dma_addr_t rx_buff_dma
;
108 __u8 ier
; /* Interrupt enable register */
110 struct timeval stamp
;
113 spinlock_t lock
; /* For serializing operations */
115 __u32 flags
; /* Interface flags */
117 int index
; /* Instance index */
119 struct eventflag EventFlag
;
120 unsigned int chip_id
; /* to remember chip id */
121 unsigned int RetryCount
;
122 unsigned int RxDataReady
;
123 unsigned int RxLastCount
;
127 //---------I=Infrared, H=Host, M=Misc, T=Tx, R=Rx, ST=Status,
128 // CF=Config, CT=Control, L=Low, H=High, C=Count
129 #define I_CF_L_0 0x10
130 #define I_CF_H_0 0x11
131 #define I_SIR_BOF 0x12
132 #define I_SIR_EOF 0x13
133 #define I_ST_CT_0 0x15
134 #define I_ST_L_1 0x16
135 #define I_ST_H_1 0x17
136 #define I_CF_L_1 0x18
137 #define I_CF_H_1 0x19
138 #define I_CF_L_2 0x1a
139 #define I_CF_H_2 0x1b
162 //-------------------------------
163 #define StartAddr 0x10 // the first register address
164 #define EndAddr 0x3f // the last register address
165 #define GetBit(val,bit) val = (unsigned char) ((val>>bit) & 0x1)
167 #define SetBit(val,bit) val= (unsigned char ) (val | (0x1 << bit))
169 #define ResetBit(val,bit) val= (unsigned char ) (val & ~(0x1 << bit))
174 #define DMA_TX_MODE 0x08
175 #define DMA_RX_MODE 0x04
179 #define MASK1 DMA1+0x0a
180 #define MASK2 DMA2+0x14
184 #define Rd_Valid 0x08
187 static void DisableDmaChannel(unsigned int channel
)
189 switch (channel
) { // 8 Bit DMA channels DMAC1
191 outb(4, MASK1
); //mask channel 0
194 outb(5, MASK1
); //Mask channel 1
197 outb(6, MASK1
); //Mask channel 2
200 outb(7, MASK1
); //Mask channel 3
203 outb(5, MASK2
); //Mask channel 5
206 outb(6, MASK2
); //Mask channel 6
209 outb(7, MASK2
); //Mask channel 7
216 static unsigned char ReadLPCReg(int iRegNum
)
229 static void WriteLPCReg(int iRegNum
, unsigned char iVal
)
239 static __u8
ReadReg(unsigned int BaseAddr
, int iRegNum
)
241 return (__u8
) inb(BaseAddr
+ iRegNum
);
244 static void WriteReg(unsigned int BaseAddr
, int iRegNum
, unsigned char iVal
)
246 outb(iVal
, BaseAddr
+ iRegNum
);
249 static int WriteRegBit(unsigned int BaseAddr
, unsigned char RegNum
,
250 unsigned char BitPos
, unsigned char value
)
257 if ((RegNum
< StartAddr
) || (RegNum
> EndAddr
))
259 Rtemp
= ReadReg(BaseAddr
, RegNum
);
261 Wtemp
= ResetBit(Rtemp
, BitPos
);
264 Wtemp
= SetBit(Rtemp
, BitPos
);
268 WriteReg(BaseAddr
, RegNum
, Wtemp
);
272 static __u8
CheckRegBit(unsigned int BaseAddr
, unsigned char RegNum
,
273 unsigned char BitPos
)
279 if ((RegNum
< StartAddr
) || (RegNum
> EndAddr
)) {
280 // printf("what is the register %x!\n",RegNum);
282 temp
= ReadReg(BaseAddr
, RegNum
);
283 return GetBit(temp
, BitPos
);
286 static void SetMaxRxPacketSize(__u16 iobase
, __u16 size
)
289 if ((size
& 0xe000) == 0) {
291 high
= (size
& 0x1f00) >> 8;
292 WriteReg(iobase
, I_CF_L_2
, low
);
293 WriteReg(iobase
, I_CF_H_2
, high
);
301 static void SetFIFO(__u16 iobase
, __u16 value
)
305 WriteRegBit(iobase
, 0x11, 0, 0);
306 WriteRegBit(iobase
, 0x11, 7, 1);
309 WriteRegBit(iobase
, 0x11, 0, 0);
310 WriteRegBit(iobase
, 0x11, 7, 0);
313 WriteRegBit(iobase
, 0x11, 0, 1);
314 WriteRegBit(iobase
, 0x11, 7, 0);
317 WriteRegBit(iobase
, 0x11, 0, 0);
318 WriteRegBit(iobase
, 0x11, 7, 0);
323 #define CRC16(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,7,val) //0 for 32 CRC
325 #define SetVFIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,5,val)
326 #define SetFIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,6,val)
327 #define SetMIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,5,val)
328 #define SetSIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,4,val)
330 #define SIRFilter(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,3,val)
331 #define Filter(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,2,val)
332 #define InvertTX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,1,val)
333 #define InvertRX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,0,val)
334 //****************************I_CF_H_0
335 #define EnableTX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,4,val)
336 #define EnableRX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,3,val)
337 #define EnableDMA(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,2,val)
338 #define SIRRecvAny(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,1,val)
339 #define DiableTrans(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,0,val)
340 //***************************I_SIR_BOF,I_SIR_EOF
341 #define SetSIRBOF(BaseAddr,val) WriteReg(BaseAddr,I_SIR_BOF,val)
342 #define SetSIREOF(BaseAddr,val) WriteReg(BaseAddr,I_SIR_EOF,val)
343 #define GetSIRBOF(BaseAddr) ReadReg(BaseAddr,I_SIR_BOF)
344 #define GetSIREOF(BaseAddr) ReadReg(BaseAddr,I_SIR_EOF)
345 //*******************I_ST_CT_0
346 #define EnPhys(BaseAddr,val) WriteRegBit(BaseAddr,I_ST_CT_0,7,val)
347 #define IsModeError(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,6) //RO
348 #define IsVFIROn(BaseAddr) CheckRegBit(BaseAddr,0x14,0) //RO for VT1211 only
349 #define IsFIROn(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,5) //RO
350 #define IsMIROn(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,4) //RO
351 #define IsSIROn(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,3) //RO
352 #define IsEnableTX(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,2) //RO
353 #define IsEnableRX(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,1) //RO
354 #define Is16CRC(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,0) //RO
355 //***************************I_CF_3
356 #define DisableAdjacentPulseWidth(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,5,val) //1 disable
357 #define DisablePulseWidthAdjust(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,4,val) //1 disable
358 #define UseOneRX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,1,val) //0 use two RX
359 #define SlowIRRXLowActive(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,0,val) //0 show RX high=1 in SIR
360 //***************************H_CT
361 #define EnAllInt(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,7,val)
362 #define TXStart(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,6,val)
363 #define RXStart(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,5,val)
364 #define ClearRXInt(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,4,val) // 1 clear
365 //*****************H_ST
366 #define IsRXInt(BaseAddr) CheckRegBit(BaseAddr,H_ST,4)
367 #define GetIntIndentify(BaseAddr) ((ReadReg(BaseAddr,H_ST)&0xf1) >>1)
368 #define IsHostBusy(BaseAddr) CheckRegBit(BaseAddr,H_ST,0)
369 #define GetHostStatus(BaseAddr) ReadReg(BaseAddr,H_ST) //RO
370 //**************************M_CT
371 #define EnTXDMA(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,7,val)
372 #define EnRXDMA(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,6,val)
373 #define SwapDMA(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,5,val)
374 #define EnInternalLoop(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,4,val)
375 #define EnExternalLoop(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,3,val)
376 //**************************TX_CT_1
377 #define EnTXFIFOHalfLevelInt(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_1,4,val) //half empty int (1 half)
378 #define EnTXFIFOUnderrunEOMInt(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_1,5,val)
379 #define EnTXFIFOReadyInt(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_1,6,val) //int when reach it threshold (setting by bit 4)
380 //**************************TX_CT_2
381 #define ForceUnderrun(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,7,val) // force an underrun int
382 #define EnTXCRC(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,6,val) //1 for FIR,MIR...0 (not SIR)
383 #define ForceBADCRC(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,5,val) //force an bad CRC
384 #define SendSIP(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,4,val) //send indication pulse for prevent SIR disturb
385 #define ClearEnTX(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,3,val) // opposite to EnTX
386 //*****************TX_ST
387 #define GetTXStatus(BaseAddr) ReadReg(BaseAddr,TX_ST) //RO
388 //**************************RX_CT
389 #define EnRXSpecInt(BaseAddr,val) WriteRegBit(BaseAddr,RX_CT,0,val)
390 #define EnRXFIFOReadyInt(BaseAddr,val) WriteRegBit(BaseAddr,RX_CT,1,val) //enable int when reach it threshold (setting by bit 7)
391 #define EnRXFIFOHalfLevelInt(BaseAddr,val) WriteRegBit(BaseAddr,RX_CT,7,val) //enable int when (1) half full...or (0) just not full
392 //*****************RX_ST
393 #define GetRXStatus(BaseAddr) ReadReg(BaseAddr,RX_ST) //RO
394 //***********************P_ADDR
395 #define SetPacketAddr(BaseAddr,addr) WriteReg(BaseAddr,P_ADDR,addr)
396 //***********************I_CF_4
397 #define EnGPIOtoRX2(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_4,7,val)
398 #define EnTimerInt(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_4,1,val)
399 #define ClearTimerInt(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_4,0,val)
400 //***********************I_T_C_L
401 #define WriteGIO(BaseAddr,val) WriteRegBit(BaseAddr,I_T_C_L,7,val)
402 #define ReadGIO(BaseAddr) CheckRegBit(BaseAddr,I_T_C_L,7)
403 #define ReadRX(BaseAddr) CheckRegBit(BaseAddr,I_T_C_L,3) //RO
404 #define WriteTX(BaseAddr,val) WriteRegBit(BaseAddr,I_T_C_L,0,val)
405 //***********************I_T_C_H
406 #define EnRX2(BaseAddr,val) WriteRegBit(BaseAddr,I_T_C_H,7,val)
407 #define ReadRX2(BaseAddr) CheckRegBit(BaseAddr,I_T_C_H,7)
408 //**********************Version
409 #define GetFIRVersion(BaseAddr) ReadReg(BaseAddr,VERSION)
412 static void SetTimer(__u16 iobase
, __u8 count
)
414 EnTimerInt(iobase
, OFF
);
415 WriteReg(iobase
, TIMER
, count
);
416 EnTimerInt(iobase
, ON
);
420 static void SetSendByte(__u16 iobase
, __u32 count
)
424 if ((count
& 0xf000) == 0) {
425 low
= count
& 0x00ff;
426 high
= (count
& 0x0f00) >> 8;
427 WriteReg(iobase
, TX_C_L
, low
);
428 WriteReg(iobase
, TX_C_H
, high
);
432 static void ResetChip(__u16 iobase
, __u8 type
)
436 value
= (type
+ 2) << 4;
437 WriteReg(iobase
, RESET
, type
);
440 static int CkRxRecv(__u16 iobase
, struct via_ircc_cb
*self
)
443 __u16 wTmp
= 0, wTmp1
= 0, wTmp_new
= 0;
445 low
= ReadReg(iobase
, RX_C_L
);
446 high
= ReadReg(iobase
, RX_C_H
);
448 wTmp
= (wTmp1
<< 8) | low
;
450 low
= ReadReg(iobase
, RX_C_L
);
451 high
= ReadReg(iobase
, RX_C_H
);
453 wTmp_new
= (wTmp1
<< 8) | low
;
454 if (wTmp_new
!= wTmp
)
461 static __u16
RxCurCount(__u16 iobase
, struct via_ircc_cb
* self
)
464 __u16 wTmp
= 0, wTmp1
= 0;
466 low
= ReadReg(iobase
, RX_P_L
);
467 high
= ReadReg(iobase
, RX_P_H
);
469 wTmp
= (wTmp1
<< 8) | low
;
473 /* This Routine can only use in recevie_complete
474 * for it will update last count.
477 static __u16
GetRecvByte(__u16 iobase
, struct via_ircc_cb
* self
)
480 __u16 wTmp
, wTmp1
, ret
;
482 low
= ReadReg(iobase
, RX_P_L
);
483 high
= ReadReg(iobase
, RX_P_H
);
485 wTmp
= (wTmp1
<< 8) | low
;
488 if (wTmp
>= self
->RxLastCount
)
489 ret
= wTmp
- self
->RxLastCount
;
491 ret
= (0x8000 - self
->RxLastCount
) + wTmp
;
492 self
->RxLastCount
= wTmp
;
494 /* RX_P is more actually the RX_C
495 low=ReadReg(iobase,RX_C_L);
496 high=ReadReg(iobase,RX_C_H);
507 static void Sdelay(__u16 scale
)
512 for (j
= 0; j
< scale
; j
++) {
513 for (i
= 0; i
< 0x20; i
++) {
520 static void Tdelay(__u16 scale
)
525 for (j
= 0; j
< scale
; j
++) {
526 for (i
= 0; i
< 0x50; i
++) {
534 static void ActClk(__u16 iobase
, __u8 value
)
537 bTmp
= ReadReg(iobase
, 0x34);
539 WriteReg(iobase
, 0x34, bTmp
| Clk_bit
);
541 WriteReg(iobase
, 0x34, bTmp
& ~Clk_bit
);
544 static void ClkTx(__u16 iobase
, __u8 Clk
, __u8 Tx
)
548 bTmp
= ReadReg(iobase
, 0x34);
555 WriteReg(iobase
, 0x34, bTmp
);
563 WriteReg(iobase
, 0x34, bTmp
);
566 static void Wr_Byte(__u16 iobase
, __u8 data
)
578 for (i
= 0; i
< 8; i
++) { //LDN
580 if ((bData
>> i
) & 0x01) {
581 ClkTx(iobase
, 0, 1); //bit data = 1;
583 ClkTx(iobase
, 0, 0); //bit data = 1;
587 ActClk(iobase
, 1); //clk hi
592 static __u8
Rd_Indx(__u16 iobase
, __u8 addr
, __u8 index
)
594 __u8 data
= 0, bTmp
, data_bit
;
597 bTmp
= addr
| (index
<< 1) | 0;
602 Wr_Byte(iobase
, bTmp
);
606 for (i
= 0; i
< 10; i
++) {
613 bTmp
= ReadReg(iobase
, 0x34);
614 if (!(bTmp
& Rd_Valid
))
617 if (!(bTmp
& Rd_Valid
)) {
618 for (i
= 0; i
< 8; i
++) {
622 bTmp
= ReadReg(iobase
, 0x34);
631 for (i
= 0; i
< 2; i
++) {
637 bTmp
= ReadReg(iobase
, 0x34);
639 for (i
= 0; i
< 1; i
++) {
647 for (i
= 0; i
< 3; i
++) {
656 static void Wr_Indx(__u16 iobase
, __u8 addr
, __u8 index
, __u8 data
)
665 bTmp
= addr
| (index
<< 1) | 1;
666 Wr_Byte(iobase
, bTmp
);
667 Wr_Byte(iobase
, data
);
668 for (i
= 0; i
< 2; i
++) {
677 static void ResetDongle(__u16 iobase
)
682 for (i
= 0; i
< 30; i
++) {
691 static void SetSITmode(__u16 iobase
)
696 bTmp
= ReadLPCReg(0x28);
697 WriteLPCReg(0x28, bTmp
| 0x10); //select ITMOFF
698 bTmp
= ReadReg(iobase
, 0x35);
699 WriteReg(iobase
, 0x35, bTmp
| 0x40); // Driver ITMOFF
700 WriteReg(iobase
, 0x28, bTmp
| 0x80); // enable All interrupt
703 static void SI_SetMode(__u16 iobase
, int mode
)
708 WriteLPCReg(0x28, 0x70); // S/W Reset
712 Wr_Indx(iobase
, 0x40, 0x0, 0x17); //RX ,APEN enable,Normal power
713 Wr_Indx(iobase
, 0x40, 0x1, mode
); //Set Mode
714 Wr_Indx(iobase
, 0x40, 0x2, 0xff); //Set power to FIR VFIR > 1m
715 bTmp
= Rd_Indx(iobase
, 0x40, 1);
718 static void InitCard(__u16 iobase
)
720 ResetChip(iobase
, 5);
721 WriteReg(iobase
, I_ST_CT_0
, 0x00); // open CHIP on
722 SetSIRBOF(iobase
, 0xc0); // hardware default value
723 SetSIREOF(iobase
, 0xc1);
726 static void CommonInit(__u16 iobase
)
728 // EnTXCRC(iobase,0);
729 SwapDMA(iobase
, OFF
);
730 SetMaxRxPacketSize(iobase
, 0x0fff); //set to max:4095
731 EnRXFIFOReadyInt(iobase
, OFF
);
732 EnRXFIFOHalfLevelInt(iobase
, OFF
);
733 EnTXFIFOHalfLevelInt(iobase
, OFF
);
734 EnTXFIFOUnderrunEOMInt(iobase
, ON
);
735 // EnTXFIFOReadyInt(iobase,ON);
736 InvertTX(iobase
, OFF
);
737 InvertRX(iobase
, OFF
);
738 // WriteLPCReg(0xF0,0); //(if VT1211 then do this)
739 if (IsSIROn(iobase
)) {
740 SIRFilter(iobase
, ON
);
741 SIRRecvAny(iobase
, ON
);
743 SIRFilter(iobase
, OFF
);
744 SIRRecvAny(iobase
, OFF
);
746 EnRXSpecInt(iobase
, ON
);
747 WriteReg(iobase
, I_ST_CT_0
, 0x80);
748 EnableDMA(iobase
, ON
);
751 static void SetBaudRate(__u16 iobase
, __u32 rate
)
753 __u8 value
= 11, temp
;
755 if (IsSIROn(iobase
)) {
757 case (__u32
) (2400L):
760 case (__u32
) (9600L):
763 case (__u32
) (19200L):
766 case (__u32
) (38400L):
769 case (__u32
) (57600L):
772 case (__u32
) (115200L):
778 } else if (IsMIROn(iobase
)) {
779 value
= 0; // will automatically be fixed in 1.152M
780 } else if (IsFIROn(iobase
)) {
781 value
= 0; // will automatically be fixed in 4M
783 temp
= (ReadReg(iobase
, I_CF_H_1
) & 0x03);
785 WriteReg(iobase
, I_CF_H_1
, temp
);
788 static void SetPulseWidth(__u16 iobase
, __u8 width
)
790 __u8 temp
, temp1
, temp2
;
792 temp
= (ReadReg(iobase
, I_CF_L_1
) & 0x1f);
793 temp1
= (ReadReg(iobase
, I_CF_H_1
) & 0xfc);
794 temp2
= (width
& 0x07) << 5;
796 temp2
= (width
& 0x18) >> 3;
798 WriteReg(iobase
, I_CF_L_1
, temp
);
799 WriteReg(iobase
, I_CF_H_1
, temp1
);
802 static void SetSendPreambleCount(__u16 iobase
, __u8 count
)
806 temp
= ReadReg(iobase
, I_CF_L_1
) & 0xe0;
808 WriteReg(iobase
, I_CF_L_1
, temp
);
812 static void SetVFIR(__u16 BaseAddr
, __u8 val
)
816 tmp
= ReadReg(BaseAddr
, I_CF_L_0
);
817 WriteReg(BaseAddr
, I_CF_L_0
, tmp
& 0x8f);
818 WriteRegBit(BaseAddr
, I_CF_H_0
, 5, val
);
821 static void SetFIR(__u16 BaseAddr
, __u8 val
)
825 WriteRegBit(BaseAddr
, I_CF_H_0
, 5, 0);
826 tmp
= ReadReg(BaseAddr
, I_CF_L_0
);
827 WriteReg(BaseAddr
, I_CF_L_0
, tmp
& 0x8f);
828 WriteRegBit(BaseAddr
, I_CF_L_0
, 6, val
);
831 static void SetMIR(__u16 BaseAddr
, __u8 val
)
835 WriteRegBit(BaseAddr
, I_CF_H_0
, 5, 0);
836 tmp
= ReadReg(BaseAddr
, I_CF_L_0
);
837 WriteReg(BaseAddr
, I_CF_L_0
, tmp
& 0x8f);
838 WriteRegBit(BaseAddr
, I_CF_L_0
, 5, val
);
841 static void SetSIR(__u16 BaseAddr
, __u8 val
)
845 WriteRegBit(BaseAddr
, I_CF_H_0
, 5, 0);
846 tmp
= ReadReg(BaseAddr
, I_CF_L_0
);
847 WriteReg(BaseAddr
, I_CF_L_0
, tmp
& 0x8f);
848 WriteRegBit(BaseAddr
, I_CF_L_0
, 4, val
);
851 #endif /* via_IRCC_H */