public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit
@ 2012-05-15  5:09 yongd
  2012-05-15  5:11 ` Philip Rakity
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: yongd @ 2012-05-15  5:09 UTC (permalink / raw)
  To: cjb, linux-mmc
  Cc: prakity, ohad, linus.walleij, ulf.hansson, linux-kernel, yongd

  SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
setting as below,
     00b: 1-bit bus
     01b: Reserved
     10b: 4-bit bus
     11b: 8-bit bus(only for embedded SDIO)
  And sdio_enable_wide is for setting data bus width as 4-bit. But
currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
and then write it back.
  As we can see, such way is based on such assumption that the
SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.

Signed-off-by: yongd <yongd@marvell.com>
---
 drivers/mmc/core/sdio.c  |    7 +++++++
 include/linux/mmc/sdio.h |    2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 13d0e95..7b528cf 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -218,6 +218,13 @@ static int sdio_enable_wide(struct mmc_card *card)
 	if (ret)
 		return ret;
 
+	if ((ctrl & SDIO_BUS_WIDTH_MASK)
+				== SDIO_BUS_WIDTH_RESERVED)
+		printk(KERN_WARNING"%s: SDIO_CCCR_IF is invalid: 0x%02X\n",
+					mmc_hostname(card->host), ctrl);
+
+	/* set as 4-bit bus width */
+	ctrl &= ~SDIO_BUS_WIDTH_MASK;
 	ctrl |= SDIO_BUS_WIDTH_4BIT;
 
 	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index c9fe66c..17446d3 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -98,7 +98,9 @@
 
 #define SDIO_CCCR_IF		0x07	/* bus interface controls */
 
+#define  SDIO_BUS_WIDTH_MASK	0x03	/* data bus width setting */
 #define  SDIO_BUS_WIDTH_1BIT	0x00
+#define  SDIO_BUS_WIDTH_RESERVED 0x01
 #define  SDIO_BUS_WIDTH_4BIT	0x02
 #define  SDIO_BUS_ECSI		0x20	/* Enable continuous SPI interrupt */
 #define  SDIO_BUS_SCSI		0x40	/* Support continuous SPI interrupt */
-- 
1.7.9.5


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

* Re: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit
  2012-05-15  5:09 [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit yongd
@ 2012-05-15  5:11 ` Philip Rakity
  2012-05-17 12:37 ` Chris Ball
  2012-06-06 13:23 ` Chris Ball
  2 siblings, 0 replies; 6+ messages in thread
From: Philip Rakity @ 2012-05-15  5:11 UTC (permalink / raw)
  To: Yong Ding
  Cc: cjb@laptop.org, linux-mmc@vger.kernel.org, ohad@wizery.com,
	linus.walleij@linaro.org, ulf.hansson@stericsson.com,
	linux-kernel@vger.kernel.org


ACK

On May 14, 2012, at 10:09 PM, yongd wrote:

>  SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
> setting as below,
>     00b: 1-bit bus
>     01b: Reserved
>     10b: 4-bit bus
>     11b: 8-bit bus(only for embedded SDIO)
>  And sdio_enable_wide is for setting data bus width as 4-bit. But
> currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
> and then write it back.
>  As we can see, such way is based on such assumption that the
> SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.
> 
> Signed-off-by: yongd <yongd@marvell.com>
> ---
> drivers/mmc/core/sdio.c  |    7 +++++++
> include/linux/mmc/sdio.h |    2 ++
> 2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 13d0e95..7b528cf 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -218,6 +218,13 @@ static int sdio_enable_wide(struct mmc_card *card)
> 	if (ret)
> 		return ret;
> 
> +	if ((ctrl & SDIO_BUS_WIDTH_MASK)
> +				== SDIO_BUS_WIDTH_RESERVED)
> +		printk(KERN_WARNING"%s: SDIO_CCCR_IF is invalid: 0x%02X\n",
> +					mmc_hostname(card->host), ctrl);
> +
> +	/* set as 4-bit bus width */
> +	ctrl &= ~SDIO_BUS_WIDTH_MASK;
> 	ctrl |= SDIO_BUS_WIDTH_4BIT;
> 
> 	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
> diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
> index c9fe66c..17446d3 100644
> --- a/include/linux/mmc/sdio.h
> +++ b/include/linux/mmc/sdio.h
> @@ -98,7 +98,9 @@
> 
> #define SDIO_CCCR_IF		0x07	/* bus interface controls */
> 
> +#define  SDIO_BUS_WIDTH_MASK	0x03	/* data bus width setting */
> #define  SDIO_BUS_WIDTH_1BIT	0x00
> +#define  SDIO_BUS_WIDTH_RESERVED 0x01
> #define  SDIO_BUS_WIDTH_4BIT	0x02
> #define  SDIO_BUS_ECSI		0x20	/* Enable continuous SPI interrupt */
> #define  SDIO_BUS_SCSI		0x40	/* Support continuous SPI interrupt */
> -- 
> 1.7.9.5
> 


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

* Re: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit
  2012-05-15  5:09 [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit yongd
  2012-05-15  5:11 ` Philip Rakity
@ 2012-05-17 12:37 ` Chris Ball
  2012-05-18  1:49   ` Yong Ding
  2012-06-06 13:23 ` Chris Ball
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2012-05-17 12:37 UTC (permalink / raw)
  To: yongd; +Cc: linux-mmc, prakity, ohad, linus.walleij, ulf.hansson,
	linux-kernel

Hi,

On Tue, May 15 2012, yongd wrote:
>   SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
> setting as below,
>      00b: 1-bit bus
>      01b: Reserved
>      10b: 4-bit bus
>      11b: 8-bit bus(only for embedded SDIO)
>   And sdio_enable_wide is for setting data bus width as 4-bit. But
> currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
> and then write it back.
>   As we can see, such way is based on such assumption that the
> SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.
>
> Signed-off-by: yongd <yongd@marvell.com>

Thanks.  Can we have your full name, for the copyright record?

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

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

* RE: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit
  2012-05-17 12:37 ` Chris Ball
@ 2012-05-18  1:49   ` Yong Ding
  0 siblings, 0 replies; 6+ messages in thread
From: Yong Ding @ 2012-05-18  1:49 UTC (permalink / raw)
  To: Chris Ball
  Cc: linux-mmc@vger.kernel.org, Philip Rakity, ohad@wizery.com,
	linus.walleij@linaro.org, ulf.hansson@stericsson.com,
	linux-kernel@vger.kernel.org

Chris,
Thanks. And my full name is Yong Ding.

Best Wishes,

Yong Ding
Operating Systems Engineering,
Application Processor Systems Engineering

-----Original Message-----
From: Chris Ball [mailto:cjb@laptop.org] 
Sent: Thursday, May 17, 2012 8:38 PM
To: Yong Ding
Cc: linux-mmc@vger.kernel.org; Philip Rakity; ohad@wizery.com; linus.walleij@linaro.org; ulf.hansson@stericsson.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit

Hi,

On Tue, May 15 2012, yongd wrote:
>   SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
> setting as below,
>      00b: 1-bit bus
>      01b: Reserved
>      10b: 4-bit bus
>      11b: 8-bit bus(only for embedded SDIO)
>   And sdio_enable_wide is for setting data bus width as 4-bit. But
> currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
> and then write it back.
>   As we can see, such way is based on such assumption that the
> SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.
>
> Signed-off-by: yongd <yongd@marvell.com>

Thanks.  Can we have your full name, for the copyright record?

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

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

* Re: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit
  2012-05-15  5:09 [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit yongd
  2012-05-15  5:11 ` Philip Rakity
  2012-05-17 12:37 ` Chris Ball
@ 2012-06-06 13:23 ` Chris Ball
  2012-06-07  1:31   ` Yong Ding
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2012-06-06 13:23 UTC (permalink / raw)
  To: yongd; +Cc: linux-mmc, prakity, ohad, linus.walleij, ulf.hansson,
	linux-kernel

Hi,

On Tue, May 15 2012, yongd wrote:
>   SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
> setting as below,
>      00b: 1-bit bus
>      01b: Reserved
>      10b: 4-bit bus
>      11b: 8-bit bus(only for embedded SDIO)
>   And sdio_enable_wide is for setting data bus width as 4-bit. But
> currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
> and then write it back.
>   As we can see, such way is based on such assumption that the
> SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.
>
> Signed-off-by: yongd <yongd@marvell.com>
> ---
>  drivers/mmc/core/sdio.c  |    7 +++++++
>  include/linux/mmc/sdio.h |    2 ++
>  2 files changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 13d0e95..7b528cf 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -218,6 +218,13 @@ static int sdio_enable_wide(struct mmc_card *card)
>  	if (ret)
>  		return ret;
>  
> +	if ((ctrl & SDIO_BUS_WIDTH_MASK)
> +				== SDIO_BUS_WIDTH_RESERVED)
> +		printk(KERN_WARNING"%s: SDIO_CCCR_IF is invalid: 0x%02X\n",
> +					mmc_hostname(card->host), ctrl);
> +
> +	/* set as 4-bit bus width */
> +	ctrl &= ~SDIO_BUS_WIDTH_MASK;
>  	ctrl |= SDIO_BUS_WIDTH_4BIT;
>  
>  	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
> diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
> index c9fe66c..17446d3 100644
> --- a/include/linux/mmc/sdio.h
> +++ b/include/linux/mmc/sdio.h
> @@ -98,7 +98,9 @@
>  
>  #define SDIO_CCCR_IF		0x07	/* bus interface controls */
>  
> +#define  SDIO_BUS_WIDTH_MASK	0x03	/* data bus width setting */
>  #define  SDIO_BUS_WIDTH_1BIT	0x00
> +#define  SDIO_BUS_WIDTH_RESERVED 0x01
>  #define  SDIO_BUS_WIDTH_4BIT	0x02
>  #define  SDIO_BUS_ECSI		0x20	/* Enable continuous SPI interrupt */
>  #define  SDIO_BUS_SCSI		0x40	/* Support continuous SPI interrupt */

Thanks, pushed to mmc-next for 3.5.

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

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

* RE: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit
  2012-06-06 13:23 ` Chris Ball
@ 2012-06-07  1:31   ` Yong Ding
  0 siblings, 0 replies; 6+ messages in thread
From: Yong Ding @ 2012-06-07  1:31 UTC (permalink / raw)
  To: Chris Ball
  Cc: linux-mmc@vger.kernel.org, Philip Rakity, ohad@wizery.com,
	linus.walleij@linaro.org, ulf.hansson@stericsson.com,
	linux-kernel@vger.kernel.org

Chris,
Thanks, and very glad to hear this:-)

Best Wishes,

Yong Ding
Operating Systems Engineering,
Application Processor Systems Engineering

-----Original Message-----
From: Chris Ball [mailto:cjb@laptop.org] 
Sent: Wednesday, June 06, 2012 9:24 PM
To: Yong Ding
Cc: linux-mmc@vger.kernel.org; Philip Rakity; ohad@wizery.com; linus.walleij@linaro.org; ulf.hansson@stericsson.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit

Hi,

On Tue, May 15 2012, yongd wrote:
>   SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
> setting as below,
>      00b: 1-bit bus
>      01b: Reserved
>      10b: 4-bit bus
>      11b: 8-bit bus(only for embedded SDIO)
>   And sdio_enable_wide is for setting data bus width as 4-bit. But
> currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
> and then write it back.
>   As we can see, such way is based on such assumption that the
> SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.
>
> Signed-off-by: yongd <yongd@marvell.com>
> ---
>  drivers/mmc/core/sdio.c  |    7 +++++++
>  include/linux/mmc/sdio.h |    2 ++
>  2 files changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 13d0e95..7b528cf 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -218,6 +218,13 @@ static int sdio_enable_wide(struct mmc_card *card)
>  	if (ret)
>  		return ret;
>  
> +	if ((ctrl & SDIO_BUS_WIDTH_MASK)
> +				== SDIO_BUS_WIDTH_RESERVED)
> +		printk(KERN_WARNING"%s: SDIO_CCCR_IF is invalid: 0x%02X\n",
> +					mmc_hostname(card->host), ctrl);
> +
> +	/* set as 4-bit bus width */
> +	ctrl &= ~SDIO_BUS_WIDTH_MASK;
>  	ctrl |= SDIO_BUS_WIDTH_4BIT;
>  
>  	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
> diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
> index c9fe66c..17446d3 100644
> --- a/include/linux/mmc/sdio.h
> +++ b/include/linux/mmc/sdio.h
> @@ -98,7 +98,9 @@
>  
>  #define SDIO_CCCR_IF		0x07	/* bus interface controls */
>  
> +#define  SDIO_BUS_WIDTH_MASK	0x03	/* data bus width setting */
>  #define  SDIO_BUS_WIDTH_1BIT	0x00
> +#define  SDIO_BUS_WIDTH_RESERVED 0x01
>  #define  SDIO_BUS_WIDTH_4BIT	0x02
>  #define  SDIO_BUS_ECSI		0x20	/* Enable continuous SPI interrupt */
>  #define  SDIO_BUS_SCSI		0x40	/* Support continuous SPI interrupt */

Thanks, pushed to mmc-next for 3.5.

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

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

end of thread, other threads:[~2012-06-07  1:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15  5:09 [PATCH v2] mmc:sdio:guarantee setting card data bus width as 4-bit yongd
2012-05-15  5:11 ` Philip Rakity
2012-05-17 12:37 ` Chris Ball
2012-05-18  1:49   ` Yong Ding
2012-06-06 13:23 ` Chris Ball
2012-06-07  1:31   ` Yong Ding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox