| @@ -1,39 +1,39 @@ | | | @@ -1,39 +1,39 @@ |
1 | /* $NetBSD: sdhc.c,v 1.4 2010/01/08 19:53:10 dyoung Exp $ */ | | 1 | /* $NetBSD: sdhc.c,v 1.5 2010/01/12 08:41:16 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.4 2010/01/08 19:53:10 dyoung Exp $"); | | 26 | __KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.5 2010/01/12 08:41:16 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> |
| @@ -625,31 +625,31 @@ sdhc_bus_width(sdmmc_chipset_handle_t sc | | | @@ -625,31 +625,31 @@ sdhc_bus_width(sdmmc_chipset_handle_t sc |
625 | | | 625 | |
626 | switch (width) { | | 626 | switch (width) { |
627 | case 1: | | 627 | case 1: |
628 | case 4: | | 628 | case 4: |
629 | break; | | 629 | break; |
630 | | | 630 | |
631 | default: | | 631 | default: |
632 | DPRINTF(0,("%s: unsupported bus width (%d)\n", | | 632 | DPRINTF(0,("%s: unsupported bus width (%d)\n", |
633 | HDEVNAME(hp), width)); | | 633 | HDEVNAME(hp), width)); |
634 | return 1; | | 634 | return 1; |
635 | } | | 635 | } |
636 | | | 636 | |
637 | mutex_enter(&hp->host_mtx); | | 637 | mutex_enter(&hp->host_mtx); |
638 | reg = HREAD1(hp, SDHC_POWER_CTL); | | 638 | reg = HREAD1(hp, SDHC_HOST_CTL); |
639 | reg &= ~SDHC_4BIT_MODE; | | 639 | reg &= ~SDHC_4BIT_MODE; |
640 | if (width == 4) | | 640 | if (width == 4) |
641 | reg |= SDHC_4BIT_MODE; | | 641 | reg |= SDHC_4BIT_MODE; |
642 | HWRITE1(hp, SDHC_POWER_CTL, reg); | | 642 | HWRITE1(hp, SDHC_HOST_CTL, reg); |
643 | mutex_exit(&hp->host_mtx); | | 643 | mutex_exit(&hp->host_mtx); |
644 | | | 644 | |
645 | return 0; | | 645 | return 0; |
646 | } | | 646 | } |
647 | | | 647 | |
648 | static void | | 648 | static void |
649 | sdhc_card_enable_intr(sdmmc_chipset_handle_t sch, int enable) | | 649 | sdhc_card_enable_intr(sdmmc_chipset_handle_t sch, int enable) |
650 | { | | 650 | { |
651 | struct sdhc_host *hp = (struct sdhc_host *)sch; | | 651 | struct sdhc_host *hp = (struct sdhc_host *)sch; |
652 | | | 652 | |
653 | mutex_enter(&hp->host_mtx); | | 653 | mutex_enter(&hp->host_mtx); |
654 | if (enable) { | | 654 | if (enable) { |
655 | HSET2(hp, SDHC_NINTR_STATUS_EN, SDHC_CARD_INTERRUPT); | | 655 | HSET2(hp, SDHC_NINTR_STATUS_EN, SDHC_CARD_INTERRUPT); |