aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2011-04-05 10:50:14 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 20:59:52 -0400
commiteab4068795d670b065164096805cbf15a19e9690 (patch)
tree5fb62e0a18163fe2c46044cb23c276a9dad64477
parent6b93d01fe5971951911a070f51f412d50e9536dc (diff)
mmc: add MMC_QUIRK_NONSTD_FUNC_IF
Introduce MMC_QUIRK_NONSTD_FUNC_IF to ignore the "SDIO Standard Function interface code" as indicated by the card's FBR, and instead treat all functions as non-standard interfaces. This is required to prevent standard drivers from facing errors when trying to communicate with SDIO cards that erroneously indicate standard function interface codes. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/core/sdio.c6
-rw-r--r--include/linux/mmc/card.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 4221670bf82e..c3c2bd0874e8 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -16,6 +16,7 @@
16#include <linux/mmc/card.h> 16#include <linux/mmc/card.h>
17#include <linux/mmc/sdio.h> 17#include <linux/mmc/sdio.h>
18#include <linux/mmc/sdio_func.h> 18#include <linux/mmc/sdio_func.h>
19#include <linux/mmc/sdio_ids.h>
19 20
20#include "core.h" 21#include "core.h"
21#include "bus.h" 22#include "bus.h"
@@ -31,6 +32,11 @@ static int sdio_read_fbr(struct sdio_func *func)
31 int ret; 32 int ret;
32 unsigned char data; 33 unsigned char data;
33 34
35 if (mmc_card_nonstd_func_interface(func->card)) {
36 func->class = SDIO_CLASS_NONE;
37 return 0;
38 }
39
34 ret = mmc_io_rw_direct(func->card, 0, 0, 40 ret = mmc_io_rw_direct(func->card, 0, 0,
35 SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data); 41 SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data);
36 if (ret) 42 if (ret)
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index c4e96fa5fb2b..317a0029e7d7 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -128,6 +128,7 @@ struct mmc_card {
128#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ 128#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
129 /* (missing CIA registers) */ 129 /* (missing CIA registers) */
130#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */ 130#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */
131#define MMC_QUIRK_NONSTD_FUNC_IF (1<<4) /* SDIO card has nonstd function interfaces */
131 132
132 unsigned int erase_size; /* erase size in sectors */ 133 unsigned int erase_size; /* erase size in sectors */
133 unsigned int erase_shift; /* if erase unit is power 2 */ 134 unsigned int erase_shift; /* if erase unit is power 2 */
@@ -183,6 +184,11 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
183 return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; 184 return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
184} 185}
185 186
187static inline int mmc_card_nonstd_func_interface(const struct mmc_card *c)
188{
189 return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF;
190}
191
186#define mmc_card_name(c) ((c)->cid.prod_name) 192#define mmc_card_name(c) ((c)->cid.prod_name)
187#define mmc_card_id(c) (dev_name(&(c)->dev)) 193#define mmc_card_id(c) (dev_name(&(c)->dev))
188 194