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; /* Lenght 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; /* Lenght 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 */
98 struct net_device_stats stats;
100 struct irlap_cb *irlap; /* The link layer we are binded to */
101 struct qos_info qos; /* QoS capabilities for this device */
103 chipio_t io; /* IrDA controller information */
104 iobuff_t tx_buff; /* Transmit buffer */
105 iobuff_t rx_buff; /* Receive buffer */
106 dma_addr_t tx_buff_dma;
107 dma_addr_t rx_buff_dma;
109 __u8 ier; /* Interrupt enable register */
111 struct timeval stamp;
114 spinlock_t lock; /* For serializing operations */
116 __u32 flags; /* Interface flags */
118 int index; /* Instance index */
120 struct eventflag EventFlag;
122 unsigned int chip_id; /* to remember chip id */
123 unsigned int RetryCount;
124 unsigned int RxDataReady;
125 unsigned int RxLastCount;
129 //---------I=Infrared, H=Host, M=Misc, T=Tx, R=Rx, ST=Status,
130 // CF=Config, CT=Control, L=Low, H=High, C=Count
131 #define I_CF_L_0 0x10
132 #define I_CF_H_0 0x11
133 #define I_SIR_BOF 0x12
134 #define I_SIR_EOF 0x13
135 #define I_ST_CT_0 0x15
136 #define I_ST_L_1 0x16
137 #define I_ST_H_1 0x17
138 #define I_CF_L_1 0x18
139 #define I_CF_H_1 0x19
140 #define I_CF_L_2 0x1a
141 #define I_CF_H_2 0x1b
164 //-------------------------------
165 #define StartAddr 0x10 // the first register address
166 #define EndAddr 0x3f // the last register address
167 #define GetBit(val,bit) val = (unsigned char) ((val>>bit) & 0x1)
169 #define SetBit(val,bit) val= (unsigned char ) (val | (0x1 << bit))
171 #define ResetBit(val,bit) val= (unsigned char ) (val & ~(0x1 << bit))
176 #define DMA_TX_MODE 0x08
177 #define DMA_RX_MODE 0x04
181 #define MASK1 DMA1+0x0a
182 #define MASK2 DMA2+0x14
186 #define Rd_Valid 0x08
189 static void DisableDmaChannel(unsigned int channel)
191 switch (channel) { // 8 Bit DMA channels DMAC1
193 outb(4, MASK1); //mask channel 0
196 outb(5, MASK1); //Mask channel 1
199 outb(6, MASK1); //Mask channel 2
202 outb(7, MASK1); //Mask channel 3
205 outb(5, MASK2); //Mask channel 5
208 outb(6, MASK2); //Mask channel 6
211 outb(7, MASK2); //Mask channel 7
218 static unsigned char ReadLPCReg(int iRegNum)
231 static void WriteLPCReg(int iRegNum, unsigned char iVal)
241 static __u8 ReadReg(unsigned int BaseAddr, int iRegNum)
243 return ((__u8) inb(BaseAddr + iRegNum));
246 static void WriteReg(unsigned int BaseAddr, int iRegNum, unsigned char iVal)
248 outb(iVal, BaseAddr + iRegNum);
251 static int WriteRegBit(unsigned int BaseAddr, unsigned char RegNum,
252 unsigned char BitPos, unsigned char value)
259 if ((RegNum < StartAddr) || (RegNum > EndAddr))
261 Rtemp = ReadReg(BaseAddr, RegNum);
263 Wtemp = ResetBit(Rtemp, BitPos);
266 Wtemp = SetBit(Rtemp, BitPos);
270 WriteReg(BaseAddr, RegNum, Wtemp);
274 static __u8 CheckRegBit(unsigned int BaseAddr, unsigned char RegNum,
275 unsigned char BitPos)
281 if ((RegNum < StartAddr) || (RegNum > EndAddr)) {
282 // printf("what is the register %x!\n",RegNum);
284 temp = ReadReg(BaseAddr, RegNum);
285 return GetBit(temp, BitPos);
288 static void SetMaxRxPacketSize(__u16 iobase, __u16 size)
291 if ((size & 0xe000) == 0) {
293 high = (size & 0x1f00) >> 8;
294 WriteReg(iobase, I_CF_L_2, low);
295 WriteReg(iobase, I_CF_H_2, high);
303 static void SetFIFO(__u16 iobase, __u16 value)
307 WriteRegBit(iobase, 0x11, 0, 0);
308 WriteRegBit(iobase, 0x11, 7, 1);
311 WriteRegBit(iobase, 0x11, 0, 0);
312 WriteRegBit(iobase, 0x11, 7, 0);
315 WriteRegBit(iobase, 0x11, 0, 1);
316 WriteRegBit(iobase, 0x11, 7, 0);
319 WriteRegBit(iobase, 0x11, 0, 0);
320 WriteRegBit(iobase, 0x11, 7, 0);
325 #define CRC16(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,7,val) //0 for 32 CRC
327 #define SetVFIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,5,val)
328 #define SetFIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,6,val)
329 #define SetMIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,5,val)
330 #define SetSIR(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,4,val)
332 #define SIRFilter(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,3,val)
333 #define Filter(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,2,val)
334 #define InvertTX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,1,val)
335 #define InvertRX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_L_0,0,val)
336 //****************************I_CF_H_0
337 #define EnableTX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,4,val)
338 #define EnableRX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,3,val)
339 #define EnableDMA(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,2,val)
340 #define SIRRecvAny(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,1,val)
341 #define DiableTrans(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_H_0,0,val)
342 //***************************I_SIR_BOF,I_SIR_EOF
343 #define SetSIRBOF(BaseAddr,val) WriteReg(BaseAddr,I_SIR_BOF,val)
344 #define SetSIREOF(BaseAddr,val) WriteReg(BaseAddr,I_SIR_EOF,val)
345 #define GetSIRBOF(BaseAddr) ReadReg(BaseAddr,I_SIR_BOF)
346 #define GetSIREOF(BaseAddr) ReadReg(BaseAddr,I_SIR_EOF)
347 //*******************I_ST_CT_0
348 #define EnPhys(BaseAddr,val) WriteRegBit(BaseAddr,I_ST_CT_0,7,val)
349 #define IsModeError(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,6) //RO
350 #define IsVFIROn(BaseAddr) CheckRegBit(BaseAddr,0x14,0) //RO for VT1211 only
351 #define IsFIROn(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,5) //RO
352 #define IsMIROn(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,4) //RO
353 #define IsSIROn(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,3) //RO
354 #define IsEnableTX(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,2) //RO
355 #define IsEnableRX(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,1) //RO
356 #define Is16CRC(BaseAddr) CheckRegBit(BaseAddr,I_ST_CT_0,0) //RO
357 //***************************I_CF_3
358 #define DisableAdjacentPulseWidth(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,5,val) //1 disable
359 #define DisablePulseWidthAdjust(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,4,val) //1 disable
360 #define UseOneRX(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,1,val) //0 use two RX
361 #define SlowIRRXLowActive(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_3,0,val) //0 show RX high=1 in SIR
362 //***************************H_CT
363 #define EnAllInt(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,7,val)
364 #define TXStart(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,6,val)
365 #define RXStart(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,5,val)
366 #define ClearRXInt(BaseAddr,val) WriteRegBit(BaseAddr,H_CT,4,val) // 1 clear
367 //*****************H_ST
368 #define IsRXInt(BaseAddr) CheckRegBit(BaseAddr,H_ST,4)
369 #define GetIntIndentify(BaseAddr) ((ReadReg(BaseAddr,H_ST)&0xf1) >>1)
370 #define IsHostBusy(BaseAddr) CheckRegBit(BaseAddr,H_ST,0)
371 #define GetHostStatus(BaseAddr) ReadReg(BaseAddr,H_ST) //RO
372 //**************************M_CT
373 #define EnTXDMA(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,7,val)
374 #define EnRXDMA(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,6,val)
375 #define SwapDMA(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,5,val)
376 #define EnInternalLoop(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,4,val)
377 #define EnExternalLoop(BaseAddr,val) WriteRegBit(BaseAddr,M_CT,3,val)
378 //**************************TX_CT_1
379 #define EnTXFIFOHalfLevelInt(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_1,4,val) //half empty int (1 half)
380 #define EnTXFIFOUnderrunEOMInt(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_1,5,val)
381 #define EnTXFIFOReadyInt(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_1,6,val) //int when reach it threshold (setting by bit 4)
382 //**************************TX_CT_2
383 #define ForceUnderrun(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,7,val) // force an underrun int
384 #define EnTXCRC(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,6,val) //1 for FIR,MIR...0 (not SIR)
385 #define ForceBADCRC(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,5,val) //force an bad CRC
386 #define SendSIP(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,4,val) //send indication pulse for prevent SIR disturb
387 #define ClearEnTX(BaseAddr,val) WriteRegBit(BaseAddr,TX_CT_2,3,val) // opposite to EnTX
388 //*****************TX_ST
389 #define GetTXStatus(BaseAddr) ReadReg(BaseAddr,TX_ST) //RO
390 //**************************RX_CT
391 #define EnRXSpecInt(BaseAddr,val) WriteRegBit(BaseAddr,RX_CT,0,val)
392 #define EnRXFIFOReadyInt(BaseAddr,val) WriteRegBit(BaseAddr,RX_CT,1,val) //enable int when reach it threshold (setting by bit 7)
393 #define EnRXFIFOHalfLevelInt(BaseAddr,val) WriteRegBit(BaseAddr,RX_CT,7,val) //enable int when (1) half full...or (0) just not full
394 //*****************RX_ST
395 #define GetRXStatus(BaseAddr) ReadReg(BaseAddr,RX_ST) //RO
396 //***********************P_ADDR
397 #define SetPacketAddr(BaseAddr,addr) WriteReg(BaseAddr,P_ADDR,addr)
398 //***********************I_CF_4
399 #define EnGPIOtoRX2(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_4,7,val)
400 #define EnTimerInt(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_4,1,val)
401 #define ClearTimerInt(BaseAddr,val) WriteRegBit(BaseAddr,I_CF_4,0,val)
402 //***********************I_T_C_L
403 #define WriteGIO(BaseAddr,val) WriteRegBit(BaseAddr,I_T_C_L,7,val)
404 #define ReadGIO(BaseAddr) CheckRegBit(BaseAddr,I_T_C_L,7)
405 #define ReadRX(BaseAddr) CheckRegBit(BaseAddr,I_T_C_L,3) //RO
406 #define WriteTX(BaseAddr,val) WriteRegBit(BaseAddr,I_T_C_L,0,val)
407 //***********************I_T_C_H
408 #define EnRX2(BaseAddr,val) WriteRegBit(BaseAddr,I_T_C_H,7,val)
409 #define ReadRX2(BaseAddr) CheckRegBit(BaseAddr,I_T_C_H,7)
410 //**********************Version
411 #define GetFIRVersion(BaseAddr) ReadReg(BaseAddr,VERSION)
414 static void SetTimer(__u16 iobase, __u8 count)
416 EnTimerInt(iobase, OFF);
417 WriteReg(iobase, TIMER, count);
418 EnTimerInt(iobase, ON);
422 static void SetSendByte(__u16 iobase, __u32 count)
426 if ((count & 0xf000) == 0) {
427 low = count & 0x00ff;
428 high = (count & 0x0f00) >> 8;
429 WriteReg(iobase, TX_C_L, low);
430 WriteReg(iobase, TX_C_H, high);
434 static void ResetChip(__u16 iobase, __u8 type)
438 value = (type + 2) << 4;
439 WriteReg(iobase, RESET, type);
442 static int CkRxRecv(__u16 iobase, struct via_ircc_cb *self)
445 __u16 wTmp = 0, wTmp1 = 0, wTmp_new = 0;
447 low = ReadReg(iobase, RX_C_L);
448 high = ReadReg(iobase, RX_C_H);
450 wTmp = (wTmp1 << 8) | low;
452 low = ReadReg(iobase, RX_C_L);
453 high = ReadReg(iobase, RX_C_H);
455 wTmp_new = (wTmp1 << 8) | low;
456 if (wTmp_new != wTmp)
463 static __u16 RxCurCount(__u16 iobase, struct via_ircc_cb * self)
466 __u16 wTmp = 0, wTmp1 = 0;
468 low = ReadReg(iobase, RX_P_L);
469 high = ReadReg(iobase, RX_P_H);
471 wTmp = (wTmp1 << 8) | low;
475 /* This Routine can only use in recevie_complete
476 * for it will update last count.
479 static __u16 GetRecvByte(__u16 iobase, struct via_ircc_cb * self)
482 __u16 wTmp, wTmp1, ret;
484 low = ReadReg(iobase, RX_P_L);
485 high = ReadReg(iobase, RX_P_H);
487 wTmp = (wTmp1 << 8) | low;
490 if (wTmp >= self->RxLastCount)
491 ret = wTmp - self->RxLastCount;
493 ret = (0x8000 - self->RxLastCount) + wTmp;
494 self->RxLastCount = wTmp;
496 /* RX_P is more actually the RX_C
497 low=ReadReg(iobase,RX_C_L);
498 high=ReadReg(iobase,RX_C_H);
509 static void Sdelay(__u16 scale)
514 for (j = 0; j < scale; j++) {
515 for (i = 0; i < 0x20; i++) {
522 static void Tdelay(__u16 scale)
527 for (j = 0; j < scale; j++) {
528 for (i = 0; i < 0x50; i++) {
536 static void ActClk(__u16 iobase, __u8 value)
539 bTmp = ReadReg(iobase, 0x34);
541 WriteReg(iobase, 0x34, bTmp | Clk_bit);
543 WriteReg(iobase, 0x34, bTmp & ~Clk_bit);
546 static void ClkTx(__u16 iobase, __u8 Clk, __u8 Tx)
550 bTmp = ReadReg(iobase, 0x34);
557 WriteReg(iobase, 0x34, bTmp);
565 WriteReg(iobase, 0x34, bTmp);
568 static void Wr_Byte(__u16 iobase, __u8 data)
580 for (i = 0; i < 8; i++) { //LDN
582 if ((bData >> i) & 0x01) {
583 ClkTx(iobase, 0, 1); //bit data = 1;
585 ClkTx(iobase, 0, 0); //bit data = 1;
589 ActClk(iobase, 1); //clk hi
594 static __u8 Rd_Indx(__u16 iobase, __u8 addr, __u8 index)
596 __u8 data = 0, bTmp, data_bit;
599 bTmp = addr | (index << 1) | 0;
604 Wr_Byte(iobase, bTmp);
608 for (i = 0; i < 10; i++) {
615 bTmp = ReadReg(iobase, 0x34);
616 if (!(bTmp & Rd_Valid))
619 if (!(bTmp & Rd_Valid)) {
620 for (i = 0; i < 8; i++) {
624 bTmp = ReadReg(iobase, 0x34);
633 for (i = 0; i < 2; i++) {
639 bTmp = ReadReg(iobase, 0x34);
641 for (i = 0; i < 1; i++) {
649 for (i = 0; i < 3; i++) {
658 static void Wr_Indx(__u16 iobase, __u8 addr, __u8 index, __u8 data)
667 bTmp = addr | (index << 1) | 1;
668 Wr_Byte(iobase, bTmp);
669 Wr_Byte(iobase, data);
670 for (i = 0; i < 2; i++) {
679 static void ResetDongle(__u16 iobase)
684 for (i = 0; i < 30; i++) {
693 static void SetSITmode(__u16 iobase)
698 bTmp = ReadLPCReg(0x28);
699 WriteLPCReg(0x28, bTmp | 0x10); //select ITMOFF
700 bTmp = ReadReg(iobase, 0x35);
701 WriteReg(iobase, 0x35, bTmp | 0x40); // Driver ITMOFF
702 WriteReg(iobase, 0x28, bTmp | 0x80); // enable All interrupt
705 static void SI_SetMode(__u16 iobase, int mode)
710 WriteLPCReg(0x28, 0x70); // S/W Reset
714 Wr_Indx(iobase, 0x40, 0x0, 0x17); //RX ,APEN enable,Normal power
715 Wr_Indx(iobase, 0x40, 0x1, mode); //Set Mode
716 Wr_Indx(iobase, 0x40, 0x2, 0xff); //Set power to FIR VFIR > 1m
717 bTmp = Rd_Indx(iobase, 0x40, 1);
720 static void InitCard(__u16 iobase)
722 ResetChip(iobase, 5);
723 WriteReg(iobase, I_ST_CT_0, 0x00); // open CHIP on
724 SetSIRBOF(iobase, 0xc0); // hardware default value
725 SetSIREOF(iobase, 0xc1);
728 static void CommonInit(__u16 iobase)
730 // EnTXCRC(iobase,0);
731 SwapDMA(iobase, OFF);
732 SetMaxRxPacketSize(iobase, 0x0fff); //set to max:4095
733 EnRXFIFOReadyInt(iobase, OFF);
734 EnRXFIFOHalfLevelInt(iobase, OFF);
735 EnTXFIFOHalfLevelInt(iobase, OFF);
736 EnTXFIFOUnderrunEOMInt(iobase, ON);
737 // EnTXFIFOReadyInt(iobase,ON);
738 InvertTX(iobase, OFF);
739 InvertRX(iobase, OFF);
740 // WriteLPCReg(0xF0,0); //(if VT1211 then do this)
741 if (IsSIROn(iobase)) {
742 SIRFilter(iobase, ON);
743 SIRRecvAny(iobase, ON);
745 SIRFilter(iobase, OFF);
746 SIRRecvAny(iobase, OFF);
748 EnRXSpecInt(iobase, ON);
749 WriteReg(iobase, I_ST_CT_0, 0x80);
750 EnableDMA(iobase, ON);
753 static void SetBaudRate(__u16 iobase, __u32 rate)
755 __u8 value = 11, temp;
757 if (IsSIROn(iobase)) {
759 case (__u32) (2400L):
762 case (__u32) (9600L):
765 case (__u32) (19200L):
768 case (__u32) (38400L):
771 case (__u32) (57600L):
774 case (__u32) (115200L):
780 } else if (IsMIROn(iobase)) {
781 value = 0; // will automatically be fixed in 1.152M
782 } else if (IsFIROn(iobase)) {
783 value = 0; // will automatically be fixed in 4M
785 temp = (ReadReg(iobase, I_CF_H_1) & 0x03);
787 WriteReg(iobase, I_CF_H_1, temp);
790 static void SetPulseWidth(__u16 iobase, __u8 width)
792 __u8 temp, temp1, temp2;
794 temp = (ReadReg(iobase, I_CF_L_1) & 0x1f);
795 temp1 = (ReadReg(iobase, I_CF_H_1) & 0xfc);
796 temp2 = (width & 0x07) << 5;
798 temp2 = (width & 0x18) >> 3;
800 WriteReg(iobase, I_CF_L_1, temp);
801 WriteReg(iobase, I_CF_H_1, temp1);
804 static void SetSendPreambleCount(__u16 iobase, __u8 count)
808 temp = ReadReg(iobase, I_CF_L_1) & 0xe0;
810 WriteReg(iobase, I_CF_L_1, temp);
814 static void SetVFIR(__u16 BaseAddr, __u8 val)
818 tmp = ReadReg(BaseAddr, I_CF_L_0);
819 WriteReg(BaseAddr, I_CF_L_0, tmp & 0x8f);
820 WriteRegBit(BaseAddr, I_CF_H_0, 5, val);
823 static void SetFIR(__u16 BaseAddr, __u8 val)
827 WriteRegBit(BaseAddr, I_CF_H_0, 5, 0);
828 tmp = ReadReg(BaseAddr, I_CF_L_0);
829 WriteReg(BaseAddr, I_CF_L_0, tmp & 0x8f);
830 WriteRegBit(BaseAddr, I_CF_L_0, 6, val);
833 static void SetMIR(__u16 BaseAddr, __u8 val)
837 WriteRegBit(BaseAddr, I_CF_H_0, 5, 0);
838 tmp = ReadReg(BaseAddr, I_CF_L_0);
839 WriteReg(BaseAddr, I_CF_L_0, tmp & 0x8f);
840 WriteRegBit(BaseAddr, I_CF_L_0, 5, val);
843 static void SetSIR(__u16 BaseAddr, __u8 val)
847 WriteRegBit(BaseAddr, I_CF_H_0, 5, 0);
848 tmp = ReadReg(BaseAddr, I_CF_L_0);
849 WriteReg(BaseAddr, I_CF_L_0, tmp & 0x8f);
850 WriteRegBit(BaseAddr, I_CF_L_0, 4, val);
853 #endif /* via_IRCC_H */