aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/greybus/sdio.c
diff options
context:
space:
mode:
authorRui Miguel Silva <rui.silva@linaro.org>2015-10-08 12:10:53 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-10-09 14:02:06 -0700
commitdcb8d8d3e1f929e155cc262d9fbe060f94c02e35 (patch)
tree68d6df0e153756ed2983367d10a49a69c5828379 /drivers/staging/greybus/sdio.c
parentgreybus: sdio: fix card removable detection (diff)
downloadwireguard-linux-dcb8d8d3e1f929e155cc262d9fbe060f94c02e35.tar.xz
wireguard-linux-dcb8d8d3e1f929e155cc262d9fbe060f94c02e35.zip
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 <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/sdio.c')
-rw-r--r--drivers/staging/greybus/sdio.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c
index e5e3b77a2d15..21a7b67e1417 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;