From e669eb2d6fee31b23452f64ede6e2bcffb540a21 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Wed, 11 Oct 1995 02:41:13 +0000 Subject: [PATCH] Fix probe to work properly with the Cyclades cyclom-16Ye. --- sys/dev/cy/cy.c | 22 +++++++++++++--------- sys/dev/cy/cy_isa.c | 22 +++++++++++++--------- sys/i386/isa/cy.c | 22 +++++++++++++--------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 7852317cf456..ac0a16fb678a 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.13 1995/07/29 08:33:06 bde Exp $ + * $Id: cy.c,v 1.14 1995/07/31 18:29:48 bde Exp $ */ #include "cy.h" @@ -453,6 +453,7 @@ sioprobe(dev) cy_addr iobase; int unit; + iobase = (cy_addr)dev->id_maddr; unit = dev->id_unit; if ((u_int)unit >= NCY) return (0); @@ -460,16 +461,19 @@ sioprobe(dev) sioregisterdev(dev); /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ - cy_inb((cy_addr)dev->id_maddr, CY16_RESET); /* XXX? */ - + cy_inb(iobase, CY16_RESET); /* XXX? */ DELAY(500); /* wait for the board to get its act together */ - for (cyu = 0, iobase = (cy_addr)dev->id_maddr; cyu < CY_MAX_CD1400s; - ++cyu, iobase += CY_CD1400_MEMSIZE) { + /* this is needed to get the board out of reset */ + cy_outb(iobase, CY_CLEAR_INTR, 0); + DELAY(500); + + for (cyu = 0; cyu < CY_MAX_CD1400s; + ++cyu, iobase += CY_CD1400_MEMSIZE) { int i; /* wait for chip to become ready for new command */ - for (i = 0; i < 100; i += 50) { + for (i = 0; i < 10; i++) { DELAY(50); if (!cd_inb(iobase, CD1400_CCR)) break; @@ -483,12 +487,12 @@ sioprobe(dev) CD1400_CCR_CMDRESET | CD1400_CCR_FULLRESET); /* wait for the CD1400 to initialize itself */ - for (i = 0; i < 1000; i += 50) { + for (i = 0; i < 200; i++) { DELAY(50); /* retrieve firmware version */ firmware_version = cd_inb(iobase, CD1400_GFRCR); - if (firmware_version != 0) + if ((firmware_version & 0xf0) == 0x40) break; } @@ -497,7 +501,7 @@ sioprobe(dev) * If one CD1400 is bad then we don't support higher * numbered good ones on this board. */ - if ((firmware_version & 0xF0) != 0x40) + if ((firmware_version & 0xf0) != 0x40) break; ++cy_nr_cd1400s[unit]; } diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 7852317cf456..ac0a16fb678a 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.13 1995/07/29 08:33:06 bde Exp $ + * $Id: cy.c,v 1.14 1995/07/31 18:29:48 bde Exp $ */ #include "cy.h" @@ -453,6 +453,7 @@ sioprobe(dev) cy_addr iobase; int unit; + iobase = (cy_addr)dev->id_maddr; unit = dev->id_unit; if ((u_int)unit >= NCY) return (0); @@ -460,16 +461,19 @@ sioprobe(dev) sioregisterdev(dev); /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ - cy_inb((cy_addr)dev->id_maddr, CY16_RESET); /* XXX? */ - + cy_inb(iobase, CY16_RESET); /* XXX? */ DELAY(500); /* wait for the board to get its act together */ - for (cyu = 0, iobase = (cy_addr)dev->id_maddr; cyu < CY_MAX_CD1400s; - ++cyu, iobase += CY_CD1400_MEMSIZE) { + /* this is needed to get the board out of reset */ + cy_outb(iobase, CY_CLEAR_INTR, 0); + DELAY(500); + + for (cyu = 0; cyu < CY_MAX_CD1400s; + ++cyu, iobase += CY_CD1400_MEMSIZE) { int i; /* wait for chip to become ready for new command */ - for (i = 0; i < 100; i += 50) { + for (i = 0; i < 10; i++) { DELAY(50); if (!cd_inb(iobase, CD1400_CCR)) break; @@ -483,12 +487,12 @@ sioprobe(dev) CD1400_CCR_CMDRESET | CD1400_CCR_FULLRESET); /* wait for the CD1400 to initialize itself */ - for (i = 0; i < 1000; i += 50) { + for (i = 0; i < 200; i++) { DELAY(50); /* retrieve firmware version */ firmware_version = cd_inb(iobase, CD1400_GFRCR); - if (firmware_version != 0) + if ((firmware_version & 0xf0) == 0x40) break; } @@ -497,7 +501,7 @@ sioprobe(dev) * If one CD1400 is bad then we don't support higher * numbered good ones on this board. */ - if ((firmware_version & 0xF0) != 0x40) + if ((firmware_version & 0xf0) != 0x40) break; ++cy_nr_cd1400s[unit]; } diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 7852317cf456..ac0a16fb678a 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.13 1995/07/29 08:33:06 bde Exp $ + * $Id: cy.c,v 1.14 1995/07/31 18:29:48 bde Exp $ */ #include "cy.h" @@ -453,6 +453,7 @@ sioprobe(dev) cy_addr iobase; int unit; + iobase = (cy_addr)dev->id_maddr; unit = dev->id_unit; if ((u_int)unit >= NCY) return (0); @@ -460,16 +461,19 @@ sioprobe(dev) sioregisterdev(dev); /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ - cy_inb((cy_addr)dev->id_maddr, CY16_RESET); /* XXX? */ - + cy_inb(iobase, CY16_RESET); /* XXX? */ DELAY(500); /* wait for the board to get its act together */ - for (cyu = 0, iobase = (cy_addr)dev->id_maddr; cyu < CY_MAX_CD1400s; - ++cyu, iobase += CY_CD1400_MEMSIZE) { + /* this is needed to get the board out of reset */ + cy_outb(iobase, CY_CLEAR_INTR, 0); + DELAY(500); + + for (cyu = 0; cyu < CY_MAX_CD1400s; + ++cyu, iobase += CY_CD1400_MEMSIZE) { int i; /* wait for chip to become ready for new command */ - for (i = 0; i < 100; i += 50) { + for (i = 0; i < 10; i++) { DELAY(50); if (!cd_inb(iobase, CD1400_CCR)) break; @@ -483,12 +487,12 @@ sioprobe(dev) CD1400_CCR_CMDRESET | CD1400_CCR_FULLRESET); /* wait for the CD1400 to initialize itself */ - for (i = 0; i < 1000; i += 50) { + for (i = 0; i < 200; i++) { DELAY(50); /* retrieve firmware version */ firmware_version = cd_inb(iobase, CD1400_GFRCR); - if (firmware_version != 0) + if ((firmware_version & 0xf0) == 0x40) break; } @@ -497,7 +501,7 @@ sioprobe(dev) * If one CD1400 is bad then we don't support higher * numbered good ones on this board. */ - if ((firmware_version & 0xF0) != 0x40) + if ((firmware_version & 0xf0) != 0x40) break; ++cy_nr_cd1400s[unit]; }