diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-03-09 22:00:24 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-03-09 22:00:24 +0000 |
commit | 45d7286b090edadda61c53323f37ec089440f75d (patch) | |
tree | b0d8970fb22e77da1f7510498c5943ea9b1a66b7 | |
parent | d914b7f1a2893e2d2a87c3d9d9a374ab3e04d625 (diff) |
Wait for card to become ready after reset; ok drahn@
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_pcic.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_pcic.c b/sys/arch/arm/xscale/pxa2x0_pcic.c index a5600f6bd8f..7bb06b0661a 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.9 2005/03/08 23:07:17 uwe Exp $ */ +/* $OpenBSD: pxa2x0_pcic.c,v 1.10 2005/03/09 22:00:23 uwe Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -55,6 +55,7 @@ void *pxapcic_intr_establish(pcmcia_chipset_handle_t, struct pcmcia_function *, int, int (*)(void *), void *, char *); void pxapcic_intr_disestablish(pcmcia_chipset_handle_t, void *); const char *pxapcic_intr_string(pcmcia_chipset_handle_t, void *); +void pxapcic_wait_ready(struct pxapcic_socket *); void pxapcic_socket_enable(pcmcia_chipset_handle_t); void pxapcic_socket_disable(pcmcia_chipset_handle_t); @@ -274,6 +275,30 @@ pxapcic_intr_string(pch, ih) } void +pxapcic_wait_ready(so) + struct pxapcic_socket *so; +{ + bus_space_tag_t iot = so->sc->sc_iot; + int i; + + for (i = 0; i < 10000; i++) { + if (bus_space_read_2(iot, so->scooph, SCOOP_REG_CSR) & + SCP_CSR_READY) + return; + delay(500); +#ifdef PCICDEBUG + if ((i>5000) && (i%100 == 99)) + printf("."); +#endif + } + +#ifdef DIAGNOSTIC + printf("pxapcic_wait_ready: ready never happened, status = %02x\n", + bus_space_read_2(iot, so->scooph, SCOOP_REG_CSR)); +#endif +} + +void pxapcic_socket_enable(pch) pcmcia_chipset_handle_t pch; { @@ -281,6 +306,10 @@ pxapcic_socket_enable(pch) bus_space_tag_t iot = so->sc->sc_iot; u_int16_t reg; +#ifdef PCICDEBUG + printf("pxapcic_socket_enable: socket %d\n", so->socket); +#endif + /* XXX fix scoop1 base address before trying that. */ if (so->socket == 1) return; @@ -294,7 +323,6 @@ pxapcic_socket_enable(pch) reg = bus_space_read_2(iot, so->scooph, SCOOP_REG_GPWR); bus_space_write_2(iot, so->scooph, SCOOP_REG_GPWR, reg | (1<<6)); /* SCOOP0_CF_POWER_C3000 */ - delay(1000); } /* XXX */ @@ -330,6 +358,8 @@ pxapcic_socket_enable(pch) delay(20000); + pxapcic_wait_ready(so); + #if 0 printf("cardtype %d\n", h->pcmcia); #endif @@ -343,6 +373,10 @@ pxapcic_socket_disable(pch) bus_space_tag_t iot = so->sc->sc_iot; u_int16_t reg; +#ifdef PCICDEBUG + printf("pxapcic_socket_disable: socket %d\n", so->socket); +#endif + /* XXX fix scoop1 base address before trying that. */ if (so->socket == 1) return; @@ -357,7 +391,6 @@ pxapcic_socket_disable(pch) reg = bus_space_read_2(iot, so->scooph, SCOOP_REG_GPWR); bus_space_write_2(iot, so->scooph, SCOOP_REG_GPWR, reg & ~(1<<6)); /* SCOOP0_CF_POWER_C3000 */ - delay(1000); /* XXX needed? */ } } |