summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-12-14 15:08:52 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-12-14 15:08:52 +0000
commit67f15be4ae25a9aa1f52d27a6c03ef773396c351 (patch)
tree1addc744be194b1df1982fc9ee1406b594248d75 /sys/arch
parentc55625c771a03b32a875e58db3f35aa88cab2fec (diff)
Don't hard-code card present and number of socket bits in the PCMCIA bus
configuration register, but control these bits from PCMCIA code. ok drahn@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/arm/xscale/pxa2x0_pcic.c32
-rw-r--r--sys/arch/arm/xscale/pxapcicvar.h3
-rw-r--r--sys/arch/zaurus/zaurus/zaurus_machdep.c14
3 files changed, 34 insertions, 15 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_pcic.c b/sys/arch/arm/xscale/pxa2x0_pcic.c
index a1a35b14082..1fa35cecec7 100644
--- a/sys/arch/arm/xscale/pxa2x0_pcic.c
+++ b/sys/arch/arm/xscale/pxa2x0_pcic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_pcic.c,v 1.16 2005/12/13 05:35:54 uwe Exp $ */
+/* $OpenBSD: pxa2x0_pcic.c,v 1.17 2005/12/14 15:08:51 uwe Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
@@ -334,6 +334,16 @@ pxapcic_attach(struct pxapcic_softc *sc,
printf(": %d slot%s\n", sc->sc_nslots, sc->sc_nslots==1 ? "" : "s");
+ if (bus_space_map(sc->sc_iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE,
+ 0, &sc->sc_memctl_ioh)) {
+ printf("%s: failed to map MEMCTL\n", sc->sc_dev.dv_xname);
+ return;
+ }
+
+ /* Clear CIT (card present) and set NOS correctly. */
+ bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR,
+ sc->sc_nslots == 2 ? MECR_NOS : 0);
+
/* zaurus: configure slot 1 first to make internal drive be wd0. */
for (i = sc->sc_nslots-1; i >= 0; i--) {
so = &sc->sc_socket[i];
@@ -463,9 +473,17 @@ pxapcic_event_process(struct pxapcic_socket *sock)
void
pxapcic_attach_card(struct pxapcic_socket *h)
{
+ struct pxapcic_softc *sc = h->sc;
+ u_int32_t rv;
+
if (h->flags & PXAPCIC_FLAG_CARDP)
panic("pcic_attach_card: already attached");
h->flags |= PXAPCIC_FLAG_CARDP;
+
+ /* Set CIT if any card is present. */
+ rv = bus_space_read_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR);
+ bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR,
+ rv | MECR_CIT);
/* call the MI attach function */
pcmcia_card_attach(h->pcmcia);
@@ -474,10 +492,22 @@ pxapcic_attach_card(struct pxapcic_socket *h)
void
pxapcic_detach_card(struct pxapcic_socket *h, int flags)
{
+ struct pxapcic_softc *sc = h->sc;
+ u_int32_t rv;
+ int i;
+
if (h->flags & PXAPCIC_FLAG_CARDP) {
h->flags &= ~PXAPCIC_FLAG_CARDP;
/* call the MI detach function */
pcmcia_card_detach(h->pcmcia, flags);
}
+
+ /* Clear CIT if no other card is present. */
+ for (i = 0; i < sc->sc_nslots; i++)
+ if (sc->sc_socket[i].flags & PXAPCIC_FLAG_CARDP)
+ return;
+ rv = bus_space_read_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR);
+ bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR,
+ rv & ~MECR_CIT);
}
diff --git a/sys/arch/arm/xscale/pxapcicvar.h b/sys/arch/arm/xscale/pxapcicvar.h
index fc7e9a78591..a1bbe29dff5 100644
--- a/sys/arch/arm/xscale/pxapcicvar.h
+++ b/sys/arch/arm/xscale/pxapcicvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxapcicvar.h,v 1.6 2005/07/01 23:51:55 uwe Exp $ */
+/* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
@@ -67,6 +67,7 @@ struct pxapcic_softc {
struct pxapcic_socket sc_socket[2];
bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_memctl_ioh;
void *sc_irq;
int sc_shutdown;
diff --git a/sys/arch/zaurus/zaurus/zaurus_machdep.c b/sys/arch/zaurus/zaurus/zaurus_machdep.c
index 92136bf252d..160df277b6b 100644
--- a/sys/arch/zaurus/zaurus/zaurus_machdep.c
+++ b/sys/arch/zaurus/zaurus/zaurus_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_machdep.c,v 1.20 2005/12/14 14:39:38 uwe Exp $ */
+/* $OpenBSD: zaurus_machdep.c,v 1.21 2005/12/14 15:08:51 uwe Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -720,18 +720,6 @@ initarm(void *arg)
/* Talk to the user */
printf("\nOpenBSD/zaurus booting ...\n");
- /* Initialize for PCMCIA/CF sockets */
- {
- /* Activate two sockets.
- XXX: This code segment should be moved to
- pcmcia MD attach routine.
- XXX: These bits should be toggled based on
- existene of PCMCIA/CF cards
- */
- ioreg_write(PXA2X0_MEMCTL_BASE+MEMCTL_MECR,
- MECR_NOS|MECR_CIT);
- }
-
{
/* XXX - all Zaurus have this for now, fix memory sizing */
memstart = 0xa0000000;