All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF
@ 2011-04-05 14:50 Ohad Ben-Cohen
  2011-04-05 14:50 ` [PATCH 2/2] mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
  2011-04-05 15:25 ` [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF Chris Ball
  0 siblings, 2 replies; 4+ messages in thread
From: Ohad Ben-Cohen @ 2011-04-05 14:50 UTC (permalink / raw)
  To: linux-mmc; +Cc: Chris Ball, Ohad Ben-Cohen

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>
---
Chris, I've posted this one before. Sending it again, this time with a follow-up patch that uses the new mmc quirks facility. thanks!

 drivers/mmc/core/sdio.c  |    6 ++++++
 include/linux/mmc/card.h |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 4221670..c3c2bd0 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -16,6 +16,7 @@
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/sdio_func.h>
+#include <linux/mmc/sdio_ids.h>
 
 #include "core.h"
 #include "bus.h"
@@ -31,6 +32,11 @@ static int sdio_read_fbr(struct sdio_func *func)
 	int ret;
 	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,
 		SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data);
 	if (ret)
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index adb4888..c7f1532 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -125,6 +125,7 @@ struct mmc_card {
 #define MMC_QUIRK_NONSTD_SDIO	(1<<2)		/* non-standard SDIO card attached */
 						/* (missing CIA registers) */
 #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_shift;	/* if erase unit is power 2 */
@@ -180,6 +181,11 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
 	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_id(c)		(dev_name(&(c)->dev))
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IF
  2011-04-05 14:50 [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
@ 2011-04-05 14:50 ` Ohad Ben-Cohen
  2011-04-05 15:26   ` Chris Ball
  2011-04-05 15:25 ` [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF Chris Ball
  1 sibling, 1 reply; 4+ messages in thread
From: Ohad Ben-Cohen @ 2011-04-05 14:50 UTC (permalink / raw)
  To: linux-mmc; +Cc: Chris Ball, Ohad Ben-Cohen

Tell SDIO core to ignore the standard SDIO function interface
codes indicated by the wl1271. This is required because the
wl1271 erroneously indicates its first function as a standard
Bluetooth SDIO interface, and that drives btsdio mad.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
 drivers/mmc/core/quirks.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c
index 11118b7..1957398 100644
--- a/drivers/mmc/core/quirks.c
+++ b/drivers/mmc/core/quirks.c
@@ -64,6 +64,8 @@ static const struct mmc_fixup mmc_fixup_methods[] = {
 		add_quirk_for_sdio_devices, MMC_QUIRK_BROKEN_CLK_GATING },
 	{ SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
 		remove_quirk, MMC_QUIRK_BROKEN_CLK_GATING },
+	{ SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
+		add_quirk, MMC_QUIRK_NONSTD_FUNC_IF },
 	{ 0 }
 };
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF
  2011-04-05 14:50 [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
  2011-04-05 14:50 ` [PATCH 2/2] mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
@ 2011-04-05 15:25 ` Chris Ball
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2011-04-05 15:25 UTC (permalink / raw)
  To: Ohad Ben-Cohen; +Cc: linux-mmc

Hi,

On Tue, Apr 05 2011, Ohad Ben-Cohen wrote:
> 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>
> ---
> Chris, I've posted this one before. Sending it again, this time with a follow-up patch that uses the new mmc quirks facility. thanks!
>
>  drivers/mmc/core/sdio.c  |    6 ++++++
>  include/linux/mmc/card.h |    6 ++++++
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 4221670..c3c2bd0 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -16,6 +16,7 @@
>  #include <linux/mmc/card.h>
>  #include <linux/mmc/sdio.h>
>  #include <linux/mmc/sdio_func.h>
> +#include <linux/mmc/sdio_ids.h>
>  
>  #include "core.h"
>  #include "bus.h"
> @@ -31,6 +32,11 @@ static int sdio_read_fbr(struct sdio_func *func)
>  	int ret;
>  	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,
>  		SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data);
>  	if (ret)
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index adb4888..c7f1532 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -125,6 +125,7 @@ struct mmc_card {
>  #define MMC_QUIRK_NONSTD_SDIO	(1<<2)		/* non-standard SDIO card attached */
>  						/* (missing CIA registers) */
>  #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_shift;	/* if erase unit is power 2 */
> @@ -180,6 +181,11 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
>  	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_id(c)		(dev_name(&(c)->dev))

Thanks, pushed to mmc-next for .40.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IF
  2011-04-05 14:50 ` [PATCH 2/2] mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
@ 2011-04-05 15:26   ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2011-04-05 15:26 UTC (permalink / raw)
  To: Ohad Ben-Cohen; +Cc: linux-mmc

Hi,

On Tue, Apr 05 2011, Ohad Ben-Cohen wrote:
> Tell SDIO core to ignore the standard SDIO function interface
> codes indicated by the wl1271. This is required because the
> wl1271 erroneously indicates its first function as a standard
> Bluetooth SDIO interface, and that drives btsdio mad.
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> ---
>  drivers/mmc/core/quirks.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c
> index 11118b7..1957398 100644
> --- a/drivers/mmc/core/quirks.c
> +++ b/drivers/mmc/core/quirks.c
> @@ -64,6 +64,8 @@ static const struct mmc_fixup mmc_fixup_methods[] = {
>  		add_quirk_for_sdio_devices, MMC_QUIRK_BROKEN_CLK_GATING },
>  	{ SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
>  		remove_quirk, MMC_QUIRK_BROKEN_CLK_GATING },
> +	{ SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271,
> +		add_quirk, MMC_QUIRK_NONSTD_FUNC_IF },
>  	{ 0 }
>  };

Thanks, pushed to mmc-next for .40.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-05 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 14:50 [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
2011-04-05 14:50 ` [PATCH 2/2] mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IF Ohad Ben-Cohen
2011-04-05 15:26   ` Chris Ball
2011-04-05 15:25 ` [PATCH 1/2] mmc: add MMC_QUIRK_NONSTD_FUNC_IF Chris Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.