diff options
author | nsouch <nsouch@FreeBSD.org> | 2004-05-31 14:24:21 +0000 |
---|---|---|
committer | nsouch <nsouch@FreeBSD.org> | 2004-05-31 14:24:21 +0000 |
commit | a1d2a459f7092cac4925c251d6076dad3739ff46 (patch) | |
tree | bfc72f48fbab1de5e4e41238d5e97e94b471f79e /sys/dev/pcf/pcf.c | |
parent | 05190926d838f507937e7a17da545dba1fb2747c (diff) | |
download | FreeBSD-src-a1d2a459f7092cac4925c251d6076dad3739ff46.zip FreeBSD-src-a1d2a459f7092cac4925c251d6076dad3739ff46.tar.gz |
Necessary modifications do get pcf working again for ISA. Tested with
my Elektor card. Note that the hints are necessary to specify the
IO base of the pcf chip. This enables to check the IO base when the
probe routine is called during ISA enumeration.
The interrupt driven code is mixed with polled mode, which is wrong
and produces supposed spurious interrupts at each access. I still have
to work on it.
Diffstat (limited to 'sys/dev/pcf/pcf.c')
-rw-r--r-- | sys/dev/pcf/pcf.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/pcf/pcf.c b/sys/dev/pcf/pcf.c index 08b088f..0320958 100644 --- a/sys/dev/pcf/pcf.c +++ b/sys/dev/pcf/pcf.c @@ -64,6 +64,10 @@ pcf_wait_byte(struct pcf_softc *sc) return (0); } +#ifdef PCFDEBUG + printf("pcf: timeout!\n"); +#endif + return (IIC_ETIMEOUT); } @@ -132,6 +136,9 @@ pcf_repeated_start(device_t dev, u_char slave, int timeout) /* check for ack */ if (pcf_noack(sc, timeout)) { error = IIC_ENOACK; +#ifdef PCFDEBUG + printf("pcf: no ack on repeated_start!\n"); +#endif goto error; } @@ -151,8 +158,12 @@ pcf_start(device_t dev, u_char slave, int timeout) #ifdef PCFDEBUG device_printf(dev, " >> start for slave %#x\n", (unsigned)slave); #endif - if ((pcf_get_S1(sc) & nBB) == 0) + if ((pcf_get_S1(sc) & nBB) == 0) { +#ifdef PCFDEBUG + printf("pcf: busy!\n"); +#endif return (IIC_EBUSBSY); + } /* set slave address to PCF. Last bit (LSB) must be set correctly * according to transfer direction */ @@ -170,6 +181,9 @@ pcf_start(device_t dev, u_char slave, int timeout) /* check for ACK */ if (pcf_noack(sc, timeout)) { error = IIC_ENOACK; +#ifdef PCFDEBUG + printf("pcf: no ack on start!\n"); +#endif goto error; } @@ -183,23 +197,21 @@ error: void pcf_intr(void *arg) { - device_t dev = (device_t)arg; - struct pcf_softc *sc = DEVTOSOFTC(dev); - + struct pcf_softc *sc = arg; char data, status, addr; char error = 0; status = pcf_get_S1(sc); if (status & PIN) { - device_printf(dev, "spurious interrupt, status=0x%x\n", - status & 0xff); + printf("pcf: spurious interrupt, status=0x%x\n", + status & 0xff); goto error; } if (status & LAB) - device_printf(dev, "bus arbitration lost!\n"); + printf("pcf: bus arbitration lost!\n"); if (status & BER) { error = IIC_EBUSERR; |