| @@ -1,39 +1,39 @@ | | | @@ -1,39 +1,39 @@ |
1 | /* $NetBSD: sdhc.c,v 1.2 2009/05/17 14:36:46 cegger Exp $ */ | | 1 | /* $NetBSD: sdhc.c,v 1.3 2009/10/02 04:33:58 uebayasi Exp $ */ |
2 | /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ | | 2 | /* $OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> | | 5 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> |
6 | * | | 6 | * |
7 | * Permission to use, copy, modify, and distribute this software for any | | 7 | * Permission to use, copy, modify, and distribute this software for any |
8 | * purpose with or without fee is hereby granted, provided that the above | | 8 | * purpose with or without fee is hereby granted, provided that the above |
9 | * copyright notice and this permission notice appear in all copies. | | 9 | * copyright notice and this permission notice appear in all copies. |
10 | * | | 10 | * |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
18 | */ | | 18 | */ |
19 | | | 19 | |
20 | /* | | 20 | /* |
21 | * SD Host Controller driver based on the SD Host Controller Standard | | 21 | * SD Host Controller driver based on the SD Host Controller Standard |
22 | * Simplified Specification Version 1.00 (www.sdcard.com). | | 22 | * Simplified Specification Version 1.00 (www.sdcard.com). |
23 | */ | | 23 | */ |
24 | | | 24 | |
25 | #include <sys/cdefs.h> | | 25 | #include <sys/cdefs.h> |
26 | __KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.2 2009/05/17 14:36:46 cegger Exp $"); | | 26 | __KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.3 2009/10/02 04:33:58 uebayasi Exp $"); |
27 | | | 27 | |
28 | #include <sys/param.h> | | 28 | #include <sys/param.h> |
29 | #include <sys/device.h> | | 29 | #include <sys/device.h> |
30 | #include <sys/kernel.h> | | 30 | #include <sys/kernel.h> |
31 | #include <sys/kthread.h> | | 31 | #include <sys/kthread.h> |
32 | #include <sys/malloc.h> | | 32 | #include <sys/malloc.h> |
33 | #include <sys/systm.h> | | 33 | #include <sys/systm.h> |
34 | #include <sys/mutex.h> | | 34 | #include <sys/mutex.h> |
35 | #include <sys/condvar.h> | | 35 | #include <sys/condvar.h> |
36 | | | 36 | |
37 | #include <dev/sdmmc/sdhcreg.h> | | 37 | #include <dev/sdmmc/sdhcreg.h> |
38 | #include <dev/sdmmc/sdhcvar.h> | | 38 | #include <dev/sdmmc/sdhcvar.h> |
39 | #include <dev/sdmmc/sdmmcchip.h> | | 39 | #include <dev/sdmmc/sdmmcchip.h> |
| @@ -189,27 +189,27 @@ sdhc_host_found(struct sdhc_softc *sc, b | | | @@ -189,27 +189,27 @@ sdhc_host_found(struct sdhc_softc *sc, b |
189 | sc->sc_host[sc->sc_nhosts++] = hp; | | 189 | sc->sc_host[sc->sc_nhosts++] = hp; |
190 | | | 190 | |
191 | /* Fill in the new host structure. */ | | 191 | /* Fill in the new host structure. */ |
192 | hp->sc = sc; | | 192 | hp->sc = sc; |
193 | hp->iot = iot; | | 193 | hp->iot = iot; |
194 | hp->ioh = ioh; | | 194 | hp->ioh = ioh; |
195 | hp->dmat = sc->sc_dmat; | | 195 | hp->dmat = sc->sc_dmat; |
196 | | | 196 | |
197 | mutex_init(&hp->host_mtx, MUTEX_DEFAULT, IPL_SDMMC); | | 197 | mutex_init(&hp->host_mtx, MUTEX_DEFAULT, IPL_SDMMC); |
198 | mutex_init(&hp->intr_mtx, MUTEX_DEFAULT, IPL_SDMMC); | | 198 | mutex_init(&hp->intr_mtx, MUTEX_DEFAULT, IPL_SDMMC); |
199 | cv_init(&hp->intr_cv, "sdhcintr"); | | 199 | cv_init(&hp->intr_cv, "sdhcintr"); |
200 | | | 200 | |
201 | /* | | 201 | /* |
202 | * eset the host controller and enable interrupts. | | 202 | * Reset the host controller and enable interrupts. |
203 | */ | | 203 | */ |
204 | (void)sdhc_host_reset(hp); | | 204 | (void)sdhc_host_reset(hp); |
205 | | | 205 | |
206 | /* Determine host capabilities. */ | | 206 | /* Determine host capabilities. */ |
207 | mutex_enter(&hp->host_mtx); | | 207 | mutex_enter(&hp->host_mtx); |
208 | caps = HREAD4(hp, SDHC_CAPABILITIES); | | 208 | caps = HREAD4(hp, SDHC_CAPABILITIES); |
209 | mutex_exit(&hp->host_mtx); | | 209 | mutex_exit(&hp->host_mtx); |
210 | | | 210 | |
211 | #if notyet | | 211 | #if notyet |
212 | /* Use DMA if the host system and the controller support it. */ | | 212 | /* Use DMA if the host system and the controller support it. */ |
213 | if (ISSET(sc->sc_flags, SDHC_FLAG_FORCE_DMA) | | 213 | if (ISSET(sc->sc_flags, SDHC_FLAG_FORCE_DMA) |
214 | || ((ISSET(sc->sc_flags, SDHC_FLAG_USE_DMA) | | 214 | || ((ISSET(sc->sc_flags, SDHC_FLAG_USE_DMA) |
215 | && ISSET(caps, SDHC_DMA_SUPPORT)))) { | | 215 | && ISSET(caps, SDHC_DMA_SUPPORT)))) { |