Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc eMMC fixes
details: https://anonhg.NetBSD.org/src/rev/3e795218d9bc
branches: trunk
changeset: 339749:3e795218d9bc
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Aug 08 10:50:55 2015 +0000
description:
eMMC fixes
diffstat:
sys/dev/sdmmc/sdmmc_mem.c | 33 ++++++++++++++++-----------------
sys/dev/sdmmc/sdmmcreg.h | 7 +++++--
2 files changed, 21 insertions(+), 19 deletions(-)
diffs (104 lines):
diff -r f4414aea15bc -r 3e795218d9bc sys/dev/sdmmc/sdmmc_mem.c
--- a/sys/dev/sdmmc/sdmmc_mem.c Sat Aug 08 10:38:35 2015 +0000
+++ b/sys/dev/sdmmc/sdmmc_mem.c Sat Aug 08 10:50:55 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc_mem.c,v 1.45 2015/08/05 10:29:37 jmcneill Exp $ */
+/* $NetBSD: sdmmc_mem.c,v 1.46 2015/08/08 10:50:55 jmcneill Exp $ */
/* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */
/*
@@ -45,7 +45,7 @@
/* Routines for SD/MMC memory cards. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.45 2015/08/05 10:29:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.46 2015/08/08 10:50:55 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -204,13 +204,17 @@
host_ocr &= card_ocr; /* only allow the common voltages */
if (!ISSET(sc->sc_caps, SMC_CAPS_SPI_MODE)) {
- /* Check SD Ver.2 */
- error = sdmmc_mem_send_if_cond(sc, 0x1aa, &card_ocr);
- if (error == 0 && card_ocr == 0x1aa)
- SET(ocr, MMC_OCR_HCS);
+ if (ISSET(sc->sc_flags, SMF_SD_MODE)) {
+ /* Check SD Ver.2 */
+ error = sdmmc_mem_send_if_cond(sc, 0x1aa, &card_ocr);
+ if (error == 0 && card_ocr == 0x1aa)
+ SET(ocr, MMC_OCR_HCS);
- if (sdmmc_chip_host_ocr(sc->sc_sct, sc->sc_sch) & MMC_OCR_S18A)
- SET(ocr, MMC_OCR_S18A);
+ if (sdmmc_chip_host_ocr(sc->sc_sct, sc->sc_sch) & MMC_OCR_S18A)
+ SET(ocr, MMC_OCR_S18A);
+ } else {
+ SET(ocr, MMC_OCR_ACCESS_MODE_SECTOR);
+ }
}
host_ocr |= ocr;
@@ -221,7 +225,7 @@
goto out;
}
- if (ISSET(new_ocr, MMC_OCR_S18A) && sc->sc_sct->signal_voltage) {
+ if (ISSET(sc->sc_flags, SMF_SD_MODE) && ISSET(new_ocr, MMC_OCR_S18A)) {
/*
* Card and host support low voltage mode, begin switch
* sequence.
@@ -946,13 +950,6 @@
return ENOTSUP;
}
- if (hs_timing == 2) {
- error = sdmmc_chip_signal_voltage(sc->sc_sct,
- sc->sc_sch, SDMMC_SIGNAL_VOLTAGE_180);
- if (error)
- hs_timing = 1;
- }
-
if (ISSET(sc->sc_caps, SMC_CAPS_8BIT_MODE)) {
width = 8;
value = EXT_CSD_BUS_WIDTH_8;
@@ -977,6 +974,7 @@
}
/* XXXX: need bus test? (using by CMD14 & CMD19) */
+ delay(10000);
}
sf->width = width;
@@ -989,7 +987,8 @@
EXT_CSD_HS_TIMING, hs_timing);
if (error) {
aprint_error_dev(sc->sc_dev,
- "can't change high speed\n");
+ "can't change high speed %d, error %d\n",
+ hs_timing, error);
return error;
}
}
diff -r f4414aea15bc -r 3e795218d9bc sys/dev/sdmmc/sdmmcreg.h
--- a/sys/dev/sdmmc/sdmmcreg.h Sat Aug 08 10:38:35 2015 +0000
+++ b/sys/dev/sdmmc/sdmmcreg.h Sat Aug 08 10:50:55 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmcreg.h,v 1.19 2015/08/05 10:29:37 jmcneill Exp $ */
+/* $NetBSD: sdmmcreg.h,v 1.20 2015/08/08 10:50:55 jmcneill Exp $ */
/* $OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $ */
/*
@@ -70,7 +70,10 @@
/* OCR bits */
#define MMC_OCR_MEM_READY (1U<<31)/* memory power-up status bit */
-#define MMC_OCR_HCS (1<<30)
+#define MMC_OCR_HCS (1<<30) /* SD only */
+#define MMC_OCR_ACCESS_MODE_MASK (3<<29) /* MMC only */
+#define MMC_OCR_ACCESS_MODE_BYTE (0<<29) /* MMC only */
+#define MMC_OCR_ACCESS_MODE_SECTOR (2<<29) /* MMC only */
#define MMC_OCR_S18A (1<<24)
#define MMC_OCR_3_5V_3_6V (1<<23)
#define MMC_OCR_3_4V_3_5V (1<<22)
Home |
Main Index |
Thread Index |
Old Index