Commit eab40687 authored by Ohad Ben-Cohen's avatar Ohad Ben-Cohen Committed by Chris Ball

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: default avatarOhad Ben-Cohen <ohad@wizery.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 6b93d01f
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/mmc/sdio.h> #include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h> #include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include "core.h" #include "core.h"
#include "bus.h" #include "bus.h"
...@@ -31,6 +32,11 @@ static int sdio_read_fbr(struct sdio_func *func) ...@@ -31,6 +32,11 @@ static int sdio_read_fbr(struct sdio_func *func)
int ret; int ret;
unsigned char data; unsigned char data;
if (mmc_card_nonstd_func_interface(func->card)) {
func->class = SDIO_CLASS_NONE;
return 0;
}
ret = mmc_io_rw_direct(func->card, 0, 0, ret = mmc_io_rw_direct(func->card, 0, 0,
SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data); SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data);
if (ret) if (ret)
......
...@@ -128,6 +128,7 @@ struct mmc_card { ...@@ -128,6 +128,7 @@ struct mmc_card {
#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ #define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
/* (missing CIA registers) */ /* (missing CIA registers) */
#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */ #define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */
#define MMC_QUIRK_NONSTD_FUNC_IF (1<<4) /* SDIO card has nonstd function interfaces */
unsigned int erase_size; /* erase size in sectors */ unsigned int erase_size; /* erase size in sectors */
unsigned int erase_shift; /* if erase unit is power 2 */ 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,6 +184,11 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
} }
static inline int mmc_card_nonstd_func_interface(const struct mmc_card *c)
{
return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF;
}
#define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_name(c) ((c)->cid.prod_name)
#define mmc_card_id(c) (dev_name(&(c)->dev)) #define mmc_card_id(c) (dev_name(&(c)->dev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment