Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc Add support for eMMC 5.0 HS200 timings.
details: https://anonhg.NetBSD.org/src/rev/f65af7ac740f
branches: trunk
changeset: 339677:f65af7ac740f
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Aug 02 22:47:05 2015 +0000
description:
Add support for eMMC 5.0 HS200 timings.
diffstat:
sys/dev/sdmmc/sdmmc_mem.c | 13 ++++++++++---
sys/dev/sdmmc/sdmmcreg.h | 8 +++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diffs (74 lines):
diff -r 806524c5e73a -r f65af7ac740f sys/dev/sdmmc/sdmmc_mem.c
--- a/sys/dev/sdmmc/sdmmc_mem.c Sun Aug 02 22:09:43 2015 +0000
+++ b/sys/dev/sdmmc/sdmmc_mem.c Sun Aug 02 22:47:05 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc_mem.c,v 1.35 2015/08/02 21:44:36 jmcneill Exp $ */
+/* $NetBSD: sdmmc_mem.c,v 1.36 2015/08/02 22:47:05 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.35 2015/08/02 21:44:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.36 2015/08/02 22:47:05 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -796,6 +796,7 @@
int width, value, hs_timing, bus_clock, error;
char ext_csd[512];
uint32_t sectors = 0;
+ int host_ocr;
/* change bus clock */
bus_clock = min(sc->sc_busclk, sf->csd.tran_speed);
@@ -805,6 +806,8 @@
return error;
}
+ host_ocr = sdmmc_chip_host_ocr(sc->sc_sct, sc->sc_sch);
+
if (sf->csd.mmcver >= MMC_CSD_MMCVER_4_0) {
error = sdmmc_mem_send_cxd_data(sc,
MMC_SEND_EXT_CSD, ext_csd, sizeof(ext_csd));
@@ -821,7 +824,11 @@
return ENOTSUP;
}
- if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_52M) {
+ if (ISSET(host_ocr, MMC_OCR_1_7V_1_8V|MMC_OCR_1_8V_1_9V) &&
+ ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_HS200_1_8V) {
+ sf->csd.tran_speed = 200000; /* 200MHz SDR */
+ hs_timing = 2;
+ } else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_52M) {
sf->csd.tran_speed = 52000; /* 52MHz */
hs_timing = 1;
} else if (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_F_26M) {
diff -r 806524c5e73a -r f65af7ac740f sys/dev/sdmmc/sdmmcreg.h
--- a/sys/dev/sdmmc/sdmmcreg.h Sun Aug 02 22:09:43 2015 +0000
+++ b/sys/dev/sdmmc/sdmmcreg.h Sun Aug 02 22:47:05 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmcreg.h,v 1.16 2015/08/02 21:44:36 jmcneill Exp $ */
+/* $NetBSD: sdmmcreg.h,v 1.17 2015/08/02 22:47:05 jmcneill Exp $ */
/* $OpenBSD: sdmmcreg.h,v 1.4 2009/01/09 10:55:22 jsg Exp $ */
/*
@@ -135,12 +135,14 @@
#define EXT_CSD_STRUCTURE_VER_1_2 2 /* Version 4.1-4.2-4.3 */
/* EXT_CSD_CARD_TYPE */
-/* The only currently valid values for this field are 0x01, 0x03, 0x07,
- * 0x0B and 0x0F. */
#define EXT_CSD_CARD_TYPE_F_26M (1 << 0)
#define EXT_CSD_CARD_TYPE_F_52M (1 << 1)
#define EXT_CSD_CARD_TYPE_F_52M_1_8V (1 << 2)
#define EXT_CSD_CARD_TYPE_F_52M_1_2V (1 << 3)
+#define EXT_CSD_CARD_TYPE_F_HS200_1_8V (1 << 4)
+#define EXT_CSD_CARD_TYPE_F_HS200_1_2V (1 << 5)
+#define EXT_CSD_CARD_TYPE_F_HS400_1_8V (1 << 6)
+#define EXT_CSD_CARD_TYPE_F_HS400_1_2V (1 << 7)
#define EXT_CSD_CARD_TYPE_26M 0x01
#define EXT_CSD_CARD_TYPE_52M 0x03
#define EXT_CSD_CARD_TYPE_52M_V18 0x07
Home |
Main Index |
Thread Index |
Old Index