Add a settype function.

Nuke address windows earlier in power up sequence.
This commit is contained in:
mycroft 2004-08-11 06:56:57 +00:00
parent 3ebcfd93ee
commit a1d101ba64
3 changed files with 48 additions and 44 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcic2.c,v 1.15 2004/06/20 18:09:46 thorpej Exp $ */
/* $NetBSD: tcic2.c,v 1.16 2004/08/11 06:56:57 mycroft Exp $ */
/*
* Copyright (c) 1998, 1999 Christoph Badura. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.15 2004/06/20 18:09:46 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.16 2004/08/11 06:56:57 mycroft Exp $");
#undef TCICDEBUG
@ -1011,15 +1011,13 @@ tcic_chip_mem_unmap(pch, window)
int window;
{
struct tcic_handle *h = (struct tcic_handle *) pch;
int reg, hwwin;
int hwwin;
if (window >= h->memwins)
panic("tcic_chip_mem_unmap: window out of range");
hwwin = (window << 1) + h->sock;
reg = tcic_read_ind_2(h, TCIC_WR_MCTL_N(hwwin));
reg &= ~TCIC_MCTL_ENA;
tcic_write_ind_2(h, TCIC_WR_MCTL_N(hwwin), reg);
tcic_write_ind_2(h, TCIC_WR_MCTL_N(hwwin), 0);
h->memalloc &= ~(1 << window);
}
@ -1228,15 +1226,13 @@ tcic_chip_io_unmap(pch, window)
int window;
{
struct tcic_handle *h = (struct tcic_handle *) pch;
int reg, hwwin;
int hwwin;
if (window >= TCIC_IO_WINS)
panic("tcic_chip_io_unmap: window out of range");
hwwin = (window << 1) + h->sock;
reg = tcic_read_ind_2(h, TCIC_WR_ICTL_N(hwwin));
reg &= ~TCIC_ICTL_ENA;
tcic_write_ind_2(h, TCIC_WR_ICTL_N(hwwin), reg);
tcic_write_ind_2(h, TCIC_WR_ICTL_N(hwwin), 0);
h->ioalloc &= ~(1 << window);
}
@ -1246,7 +1242,7 @@ tcic_chip_socket_enable(pch)
pcmcia_chipset_handle_t pch;
{
struct tcic_handle *h = (struct tcic_handle *) pch;
int cardtype, reg, win;
int reg, win;
tcic_sel_sock(h);
@ -1262,6 +1258,18 @@ tcic_chip_socket_enable(pch)
tcic_write_aux_2(h->sc->iot, h->sc->ioh, TCIC_AR_ILOCK, reg);
tcic_write_1(h, TCIC_R_SCTRL, 0); /* clear TCIC_SCTRL_ENA */
/* zero out the address windows */
tcic_write_ind_2(h, TCIC_IR_SCF1_N(h->sock), 0);
/* writing to WR_MBASE_N disables the window */
for (win = 0; win < h->memwins; win++) {
tcic_write_ind_2(h, TCIC_WR_MBASE_N((win << 1) + h->sock), 0);
}
/* writing to WR_IBASE_N disables the window */
for (win = 0; win < TCIC_IO_WINS; win++) {
tcic_write_ind_2(h, TCIC_WR_IBASE_N((win << 1) + h->sock), 0);
}
/* power up the socket */
/* turn on VCC, turn of VPP */
@ -1294,36 +1302,6 @@ tcic_chip_socket_enable(pch)
tcic_wait_ready(h);
/* WWW */
/* zero out the address windows */
/* writing to WR_MBASE_N disables the window */
for (win = 0; win < h->memwins; win++) {
tcic_write_ind_2(h, TCIC_WR_MBASE_N((win<<1)+h->sock), 0);
}
/* writing to WR_IBASE_N disables the window */
for (win = 0; win < TCIC_IO_WINS; win++) {
tcic_write_ind_2(h, TCIC_WR_IBASE_N((win<<1)+h->sock), 0);
}
/* set the card type */
cardtype = pcmcia_card_gettype(h->pcmcia);
#if 0
reg = tcic_read_ind_2(h, TCIC_IR_SCF1_N(h->sock));
reg &= ~TCIC_SCF1_IRQ_MASK;
#else
reg = 0;
#endif
reg |= ((cardtype == PCMCIA_IFTYPE_IO) ?
TCIC_SCF1_IOSTS : 0);
reg |= tcic_irqmap[h->ih_irq]; /* enable interrupts */
reg &= ~TCIC_SCF1_IRQOD;
tcic_write_ind_2(h, TCIC_IR_SCF1_N(h->sock), reg);
DPRINTF(("%s: tcic_chip_socket_enable %d cardtype %s 0x%02x\n",
h->sc->dev.dv_xname, h->sock,
((cardtype == PCMCIA_IFTYPE_IO) ? "io" : "mem"), reg));
/* reinstall all the memory and io mappings */
@ -1336,6 +1314,30 @@ tcic_chip_socket_enable(pch)
tcic_chip_do_io_map(h, win);
}
void
tcic_chip_socket_settype(pch, type)
pcmcia_chipset_handle_t pch;
int type;
{
struct tcic_handle *h = (struct tcic_handle *) pch;
int reg;
tcic_sel_sock(h);
/* set the card type */
reg = 0;
if (type == PCMCIA_IFTYPE_IO) {
reg |= TCIC_SCF1_IOSTS;
reg |= tcic_irqmap[h->ih_irq]; /* enable interrupts */
}
tcic_write_ind_2(h, TCIC_IR_SCF1_N(h->sock), reg);
DPRINTF(("%s: tcic_chip_socket_enable %d cardtype %s 0x%02x\n",
h->sc->dev.dv_xname, h->sock,
((type == PCMCIA_IFTYPE_IO) ? "io" : "mem"), reg));
}
void
tcic_chip_socket_disable(pch)
pcmcia_chipset_handle_t pch;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcic2var.h,v 1.2 2001/12/15 13:23:22 soren Exp $ */
/* $NetBSD: tcic2var.h,v 1.3 2004/08/11 06:56:57 mycroft Exp $ */
/*
* Copyright (c) 1998, 1999 Christoph Badura. All rights reserved.
@ -181,6 +181,7 @@ void tcic_chip_io_unmap __P((pcmcia_chipset_handle_t, int));
void tcic_chip_socket_enable __P((pcmcia_chipset_handle_t));
void tcic_chip_socket_disable __P((pcmcia_chipset_handle_t));
void tcic_chip_socket_settype __P((pcmcia_chipset_handle_t, int));
static __inline__ int tcic_read_1 __P((struct tcic_handle *, int));
static __inline__ int

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcic2_isa.c,v 1.9 2002/10/02 03:10:50 thorpej Exp $ */
/* $NetBSD: tcic2_isa.c,v 1.10 2004/08/11 06:56:57 mycroft Exp $ */
/*
*
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcic2_isa.c,v 1.9 2002/10/02 03:10:50 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcic2_isa.c,v 1.10 2004/08/11 06:56:57 mycroft Exp $");
#undef TCICISADEBUG
@ -136,6 +136,7 @@ static struct pcmcia_chip_functions tcic_isa_functions = {
tcic_chip_socket_enable,
tcic_chip_socket_disable,
tcic_chip_socket_settype,
};
int