From dcb8d8d3e1f929e155cc262d9fbe060f94c02e35 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Thu, 8 Oct 2015 12:10:53 +0100 Subject: [PATCH] greybus: sdio: convert greybus ocr values to mmc ones It was missing the translation between the ocr vdd values of greybus to mmc_core values. This would make the detection of range voltage fail. mmc: host doesn't support card's voltages Signed-off-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/sdio.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index e5e3b77..21a7b67 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -87,12 +87,35 @@ static void _gb_sdio_set_host_caps(struct gb_sdio_host *host, u32 r) host->card_present = true; } +static u32 _gb_sdio_get_host_ocr(u32 ocr) +{ + return (((ocr & GB_SDIO_VDD_165_195) ? MMC_VDD_165_195 : 0) | + ((ocr & GB_SDIO_VDD_20_21) ? MMC_VDD_20_21 : 0) | + ((ocr & GB_SDIO_VDD_21_22) ? MMC_VDD_21_22 : 0) | + ((ocr & GB_SDIO_VDD_22_23) ? MMC_VDD_22_23 : 0) | + ((ocr & GB_SDIO_VDD_23_24) ? MMC_VDD_23_24 : 0) | + ((ocr & GB_SDIO_VDD_24_25) ? MMC_VDD_24_25 : 0) | + ((ocr & GB_SDIO_VDD_25_26) ? MMC_VDD_25_26 : 0) | + ((ocr & GB_SDIO_VDD_26_27) ? MMC_VDD_26_27 : 0) | + ((ocr & GB_SDIO_VDD_27_28) ? MMC_VDD_27_28 : 0) | + ((ocr & GB_SDIO_VDD_28_29) ? MMC_VDD_28_29 : 0) | + ((ocr & GB_SDIO_VDD_29_30) ? MMC_VDD_29_30 : 0) | + ((ocr & GB_SDIO_VDD_30_31) ? MMC_VDD_30_31 : 0) | + ((ocr & GB_SDIO_VDD_31_32) ? MMC_VDD_31_32 : 0) | + ((ocr & GB_SDIO_VDD_32_33) ? MMC_VDD_32_33 : 0) | + ((ocr & GB_SDIO_VDD_33_34) ? MMC_VDD_33_34 : 0) | + ((ocr & GB_SDIO_VDD_34_35) ? MMC_VDD_34_35 : 0) | + ((ocr & GB_SDIO_VDD_35_36) ? MMC_VDD_35_36 : 0) + ); +} + static int gb_sdio_get_caps(struct gb_sdio_host *host) { struct gb_sdio_get_caps_response response; struct mmc_host *mmc = host->mmc; u16 data_max; u32 blksz; + u32 ocr; u32 r; int ret; @@ -117,7 +140,8 @@ static int gb_sdio_get_caps(struct gb_sdio_host *host) host->data_max = data_max; /* get ocr supported values */ - mmc->ocr_avail = le32_to_cpu(response.ocr); + ocr = _gb_sdio_get_host_ocr(le32_to_cpu(response.ocr)); + mmc->ocr_avail = ocr; mmc->ocr_avail_sdio = mmc->ocr_avail; mmc->ocr_avail_sd = mmc->ocr_avail; mmc->ocr_avail_mmc = mmc->ocr_avail; -- 2.7.4