summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-03-04 22:14:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-03-04 22:14:37 +0000
commit45a51bf1a8090ea9d71ba0e7da1ece4b95e2adce (patch)
treebb0f5ed2f166a24fe0d9999f4ca63b8dcf4a9ac6
parent687727d0c70f8afbda9700317af86dce9c5216a8 (diff)
simplify cs4232 handling; apollo@slcnet.net
-rw-r--r--sys/dev/isa/cs4232.c179
-rw-r--r--sys/dev/isa/cs4232.h5
-rw-r--r--sys/dev/isa/files.isapnp3
-rw-r--r--sys/dev/isa/isapnp.c41
-rw-r--r--sys/dev/isa/wss_isapnp.c23
5 files changed, 12 insertions, 239 deletions
diff --git a/sys/dev/isa/cs4232.c b/sys/dev/isa/cs4232.c
deleted file mode 100644
index b1419747888..00000000000
--- a/sys/dev/isa/cs4232.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * ISA PnP bus autoconfiguration.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <machine/bus.h>
-
-
-#include <dev/isa/isavar.h>
-#include <dev/isa/isadmavar.h>
-
-#include "cs4232.h"
-
-#ifdef CONFIG_CS4232
-int probe_cs4232 __P((void));
-
-/* a note about the CS4232 stuff. its really pretty bad. if you dont have a
- * CS4232 or compatible then you should really (really) turn off CONFIG_CS4232.
- * i dont THINK that this will do any damage, but who knows? its really a
- * bad fix. (also note, in order for it to work it assumes that you have a
- * io port 534-537 clear as well as irq 5 and dma 0,1 all free.
- * this is all really lousy also. if it crashes your machine, sorry.
- */
-
-/*
- * sound/cs4232.c
- *
- * The low level driver for Crystal CS4232 based cards. The CS4232 is a PnP
- * compatible chip which contains a CS4231A codec, SB emulation, a MPU401
- * compatible MIDI port, joystick and synthesizer and IDE CD-ROM interfaces.
- * This is just a temporary driver until full PnP support gets inplemented.
- * Just the WSS codec, FM synth and the MIDI ports are supported. Other
- * interfaces are left uninitialized.
- *
- * Copyright by Hannu Savolainen 1995
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer. 2.
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-
-
-#define KEY_PORT 0x279 /* Same as LPT1 status port */
-#define CSN_NUM 0x01 /* Just a random number */
-
-#define CS_OUT(a) outb( KEY_PORT, a)
-#define CS_OUT2(a, b) {CS_OUT(a);CS_OUT(b);}
-#define CS_OUT3(a, b, c) {CS_OUT(a);CS_OUT(b);CS_OUT(c);}
-
-
-
-static unsigned char crystal_key[] = /* A 32 byte magic key sequence */
-{
- 0x96, 0x35, 0x9a, 0xcd, 0xe6, 0xf3, 0x79, 0xbc,
- 0x5e, 0xaf, 0x57, 0x2b, 0x15, 0x8a, 0xc5, 0xe2,
- 0xf1, 0xf8, 0x7c, 0x3e, 0x9f, 0x4f, 0x27, 0x13,
- 0x09, 0x84, 0x42, 0xa1, 0xd0, 0x68, 0x34, 0x1a
-};
-
-int
-probe_cs4232(void)
-{
- int i;
-
- /*
- * Verify that the I/O port range is free.
- */
-
- if (0) {
- printf("cs4232.c: I/O port 0x534 not free\n");
- return 0;
- }
- /*
- * This version of the driver doesn't use the PnP method when
- * configuring the card but a simplified method defined by Crystal.
- * This means that just one CS4232 compatible device can exist on the
- * system. Also this method conflicts with possible PnP support in
- * the OS. For this reason driver is just a temporary kludge.
- */
-
- /*
- * Wake up the card by sending a 32 byte Crystal key to the key port.
- */
- for (i = 0; i < 32; i++)
- CS_OUT(crystal_key[i]);
-
- /*
- * Now set the CSN (Card Select Number).
- */
-
-/* CS_OUT2(0x06, 0x01); */
-
- /*
- * Ensure that there is no other codec using the same address.
- */
-
- CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */
-
- /*
- * Then set some config bytes. First logical device 0
- */
-
- CS_OUT3(0x47, 0x05, 0x34); /* WSSbase */
-
- if (0) /* Not free */
- CS_OUT3(0x48, 0x03, 0x88) /* FMbase off */
- else
- CS_OUT3(0x48, 0x03, 0x88); /* FMbase 0x388 */
-
- CS_OUT3(0x42, 0x02, 0x20); /* SBbase off */
- CS_OUT2(0x22, 0x05); /* SB+WSS IRQ */
- CS_OUT2(0x2a, 0x01); /* SB+WSS DMA */
-
- if (0)
- CS_OUT2(0x25, 0x00) /* WSS DMA2 */
- else
- CS_OUT2(0x25, 0x00); /* No WSS DMA2 */
-
- CS_OUT2(0x33, 0x01); /* Activate logical dev 0 */
-
-/*
- * init logical device 2...
- *
- */
- CS_OUT2(0x15,0x02);
- CS_OUT3(0x47,0x01,0x20);
- CS_OUT2(0x33,0x01);
-
-
-/*
-* Initialize logical device 3 (MPU)
-*/
-
-#if (defined(CONFIG_MPU401) || defined(CONFIG_MPU_EMU)) && defined(CONFIG_MIDI)
- if (mpu_base != 0 && mpu_irq != 0) {
- CS_OUT2(0x15, 0x03); /* Select logical device 3 (MPU) */
- CS_OUT3(0x47, (mpu_base >> 8) & 0xff, mpu_base & 0xff); /* MPUbase */
- CS_OUT2(0x22, mpu_irq); /* MPU IRQ */
- CS_OUT2(0x33, 0x01); /* Activate logical dev 3 */
-}
-#endif
-
-/*
-* Finally activate the chip
-*/
- CS_OUT(0x79);
-
-/*
-* Then try to detect the codec part of the chip
-*/
- delay(15000);
-
- outb(0x534,0x40); /* this seems to be needed... */
- return 1;
-}
-
-#endif
diff --git a/sys/dev/isa/cs4232.h b/sys/dev/isa/cs4232.h
deleted file mode 100644
index 8180eef23c9..00000000000
--- a/sys/dev/isa/cs4232.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: cs4232.h,v 1.1 1999/03/04 08:57:34 deraadt Exp $ */
-
-#ifdef CONFIG_CS4232
-int probe_cs4232 __P((void));
-#endif
diff --git a/sys/dev/isa/files.isapnp b/sys/dev/isa/files.isapnp
index 5da8da7a42e..034f0cc571c 100644
--- a/sys/dev/isa/files.isapnp
+++ b/sys/dev/isa/files.isapnp
@@ -1,4 +1,4 @@
-# $OpenBSD: files.isapnp,v 1.13 1999/03/04 08:57:34 deraadt Exp $
+# $OpenBSD: files.isapnp,v 1.14 1999/03/04 22:14:35 deraadt Exp $
# $NetBSD: files.isapnp,v 1.7 1997/10/16 17:16:36 matt Exp $
#
# Config file and device description for machine-independent ISAPnP code.
@@ -28,7 +28,6 @@ file dev/isa/sb_isapnp.c sb & (sb_isa | sb_isapnp) needs-flag
attach wss at isapnp with wss_isapnp
file dev/isa/wss_isapnp.c wss & (wss_isa | wss_isapnp) needs-flag
-file dev/isa/cs4232.c wss_isapnp
attach le at isapnp with le_isapnp
file dev/isa/if_le_isapnp.c le_isapnp
diff --git a/sys/dev/isa/isapnp.c b/sys/dev/isa/isapnp.c
index 79bc15688a7..20737138efe 100644
--- a/sys/dev/isa/isapnp.c
+++ b/sys/dev/isa/isapnp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isapnp.c,v 1.24 1999/03/04 08:57:34 deraadt Exp $ */
+/* $OpenBSD: isapnp.c,v 1.25 1999/03/04 22:14:35 deraadt Exp $ */
/* $NetBSD: isapnp.c,v 1.9.4.3 1997/10/29 00:40:43 thorpej Exp $ */
/*
@@ -48,10 +48,6 @@
#include <dev/isa/pnpdevs.h>
-#ifdef CONFIG_CS4232
-#include <dev/isa/cs4232.h>
-#endif
-
void isapnp_init __P((struct isapnp_softc *));
static __inline u_char isapnp_shift_bit __P((struct isapnp_softc *));
int isapnp_findcard __P((struct isapnp_softc *));
@@ -817,38 +813,6 @@ isapnp_isa_attach_hook(isa_sc)
if (isapnp_map(&sc))
return;
-#ifdef CONFIG_CS4232
- /*
- * XXX XXX
- * This a totally disgusting hack, but I can't figure out another way.
- * It seems that many CS audio chips have a bug (as far as I can
- * understand). The reset below does not really reset the chip, it
- * remains in a catatonic state and will not respond when probed.
- * The chip can be used both as a WSS and as a SB device, and a
- * single read at the WSS address (0x534) takes it out of this
- * non-responsive state.
- * The read has to happen at this point in time (or earlier) so
- * it cannot be moved to the wss_isapnp.c driver.
- * (BTW, We're not alone in having problems with these chips:
- * Windoze 98 couldn't detect the sound chip on a Dell when I tried.)
- *
- * Lennart Augustsson <augustss@netbsd.org>
- *
- * (Implementation from John Kohl <jtk@kolvir.arlington.ma.us>)
- */
- {
- bus_space_handle_t ioh;
- int rv;
-
- if ((rv = bus_space_map(sc.sc_iot, 0x534, 1, 0, &ioh)) == 0) {
- DPRINTF(("wss probe kludge\n"));
- (void)bus_space_read_1(sc.sc_iot, ioh, 0);
- bus_space_unmap(sc.sc_iot, ioh, 1);
- } else {
- DPRINTF(("wss probe kludge failed to map: %d\n", rv));
- }
- }
-#endif
isapnp_init(&sc);
isapnp_write_reg(&sc, ISAPNP_CONFIG_CONTROL, ISAPNP_CC_RESET_DRV);
@@ -874,9 +838,6 @@ isapnp_match(parent, match, aux)
sc.sc_ncards = 0;
(void) strcpy(sc.sc_dev.dv_xname, "(isapnp probe)");
-#ifdef CONFIG_CS4232
- probe_cs4232();
-#endif
if (isapnp_map(&sc))
return 0;
diff --git a/sys/dev/isa/wss_isapnp.c b/sys/dev/isa/wss_isapnp.c
index df93f413526..d688901d9d8 100644
--- a/sys/dev/isa/wss_isapnp.c
+++ b/sys/dev/isa/wss_isapnp.c
@@ -84,8 +84,6 @@ wss_isapnp_match(parent, match, aux)
return 1;
}
-
-
/*
* Attach hardware to driver, attach hardware driver to audio
* pseudo-device driver.
@@ -95,15 +93,20 @@ wss_isapnp_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
+ struct isapnp_softc *pnp = (struct isapnp_softc *)parent;
struct wss_softc *sc = (struct wss_softc *)self;
struct ad1848_softc *ac = &sc->sc_ad1848;
struct isa_attach_args *ipa = aux;
printf("\n");
+ /* probably broken */
+ if (bus_space_read_1(ipa->ia_iot, ipa->ipa_io[0].h, 0x0) == 0x01)
+ isapnp_write_reg(pnp, ISAPNP_CONFIG_CONTROL, 0x02);
+
sc->sc_iot = ipa->ia_iot;
- sc->sc_ioh = ipa->ipa_io[0].h;
- sc->mad_chip_type = MAD_NONE;
+ sc->sc_ioh = ipa->ipa_io[0].h;
+ sc->mad_chip_type = MAD_NONE;
/* Set up AD1848 I/O handle. */
ac->sc_iot = sc->sc_iot;
@@ -112,25 +115,19 @@ wss_isapnp_attach(parent, self, aux)
ac->mode = 2;
ac->sc_iooffs = 0;
-
sc->sc_ic = ipa->ia_ic;
sc->wss_irq = ipa->ipa_irq[0].num;
sc->wss_drq = ipa->ipa_drq[0].num; /* I DONT NEED TO DO THIS */
sc->wss_recdrq = ipa->ipa_drq[1].num;
- /*
- ipa->ipa_ndrq > 1 ? ipa->ipa_drq[1].num : ipa->ipa_drq[0].num;
- */
-
+ /* ipa->ipa_ndrq > 1 ? ipa->ipa_drq[1].num : ipa->ipa_drq[0].num; */
- if(ad1848_probe(&sc->sc_ad1848)==0)
- {
+ if(ad1848_probe(&sc->sc_ad1848)==0) {
printf("%s: probe failed\n",ac->sc_dev.dv_xname);
return;
-
}
printf("%s: %s %s", ac->sc_dev.dv_xname, ipa->ipa_devident,
- ipa->ipa_devclass);
+ ipa->ipa_devclass);
wssattach(sc);
}