1
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.7 2002/01/25 21:55:55 tsi Exp $ */
8
WaitForFifo(ApmPtr pApm, int slots)
10
if (!pApm->UsePCIRetry) {
12
#define MAXLOOP 1000000
14
for(i = 0; i < MAXLOOP; i++) {
15
if ((STATUS_IOP() & STATUS_FIFO) >= slots)
19
unsigned int status = STATUS_IOP();
22
FatalError("Hung in WaitForFifo() (Status = 0x%08X)\n", status);
28
ApmI2CPutBits(I2CBusPtr b, int clock, int data)
32
ApmPtr pApm = ((ApmPtr)b->DriverPrivate.ptr);
34
lock = rdinx(pApm->xport, 0x10);
35
wrinx(pApm->xport, 0x10, 0x12);
37
reg = (RDXB_IOP(0xD0) & 0x07) | 0x60;
38
if(clock) reg |= 0x08;
42
wrinx(pApm->xport, 0x10, 0);
46
ApmI2CGetBits(I2CBusPtr b, int *clock, int *data)
50
ApmPtr pApm = ((ApmPtr)b->DriverPrivate.ptr);
53
lock = rdinx(pApm->xport, 0x10);
54
wrinx(pApm->xport, 0x10, 0x12);
57
WRXB_IOP(0xD0, tmp & 0x07);
59
*clock = (reg & STATUS_SCL) != 0;
60
*data = (reg & STATUS_SDA) != 0;
62
wrinx(pApm->xport, 0x10, 0);
66
ApmI2CInit(ScrnInfoPtr pScrn)
71
I2CPtr = xf86CreateI2CBusRec();
72
if(!I2CPtr) return FALSE;
74
pApm->I2CPtr = I2CPtr;
76
I2CPtr->BusName = "Alliance bus";
77
I2CPtr->scrnIndex = pScrn->scrnIndex;
78
I2CPtr->I2CPutBits = ApmI2CPutBits;
79
I2CPtr->I2CGetBits = ApmI2CGetBits;
80
I2CPtr->DriverPrivate.ptr = pApm;
82
if(!xf86I2CBusInit(I2CPtr))