All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sd: fix the maximum au_size for SD3.0
@ 2013-07-18  4:34 Jaehoon Chung
  2013-08-25  3:08 ` Chris Ball
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2013-07-18  4:34 UTC (permalink / raw)
  To: linux-mmc
  Cc: 'Chris Ball',
	Kyungmin Park, Ulf Hansson, Philip Rakity, Johan Rudholm,
	Aaron Lu

Since SD Physical Layer specification V3.0, AU_SIZE is supported up to 0xf.
So If SD-card is supported v3.0, then max_au should be 0xf.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/core/sd.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 176d125..aa5013f 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -215,7 +215,7 @@ static int mmc_decode_scr(struct mmc_card *card)
 static int mmc_read_ssr(struct mmc_card *card)
 {
 	unsigned int au, es, et, eo;
-	int err, i;
+	int err, i, max_au;
 	u32 *ssr;
 
 	if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
@@ -239,12 +239,18 @@ static int mmc_read_ssr(struct mmc_card *card)
 	for (i = 0; i < 16; i++)
 		ssr[i] = be32_to_cpu(ssr[i]);
 
+	/* The value of maximum au_size is supported 0xF since SD3.0 */
+	if (card->scr.sda_spec3)
+		max_au = 0xf;
+	else
+		max_au = 9;
+
 	/*
 	 * UNSTUFF_BITS only works with four u32s so we have to offset the
 	 * bitfield positions accordingly.
 	 */
 	au = UNSTUFF_BITS(ssr, 428 - 384, 4);
-	if (au > 0 && au <= 9) {
+	if (au > 0 && au <= max_au) {
 		card->ssr.au = 1 << (au + 4);
 		es = UNSTUFF_BITS(ssr, 408 - 384, 16);
 		et = UNSTUFF_BITS(ssr, 402 - 384, 6);
-- 
1.7.9.5

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

* Re: [PATCH] mmc: sd: fix the maximum au_size for SD3.0
  2013-07-18  4:34 [PATCH] mmc: sd: fix the maximum au_size for SD3.0 Jaehoon Chung
@ 2013-08-25  3:08 ` Chris Ball
  2013-08-26  1:25   ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Ball @ 2013-08-25  3:08 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc, Kyungmin Park, Ulf Hansson, Philip Rakity,
	Johan Rudholm, Aaron Lu

Hi Jaehoon,

Pushed to mmc-next for 3.12 with the following minor change, let me
know if you disagree:

On Thu, Jul 18 2013, Jaehoon Chung wrote:
> Since SD Physical Layer specification V3.0, AU_SIZE is supported up to 0xf.
> So If SD-card is supported v3.0, then max_au should be 0xf.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mmc/core/sd.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 176d125..aa5013f 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -215,7 +215,7 @@ static int mmc_decode_scr(struct mmc_card *card)
>  static int mmc_read_ssr(struct mmc_card *card)
>  {
>  	unsigned int au, es, et, eo;
> -	int err, i;
> +	int err, i, max_au;
>  	u32 *ssr;
>  
>  	if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
> @@ -239,12 +239,18 @@ static int mmc_read_ssr(struct mmc_card *card)
>  	for (i = 0; i < 16; i++)
>  		ssr[i] = be32_to_cpu(ssr[i]);
>  
> +	/* The value of maximum au_size is supported 0xF since SD3.0 */
> +	if (card->scr.sda_spec3)
> +		max_au = 0xf;
> +	else
> +		max_au = 9;
> +

/* SD3.0 increases max AU size to 64MB (0xF) from 4MB (0x9) */
max_au = card->scr.sda_spec3 ? 0xF : 0x9;

>  	/*
>  	 * UNSTUFF_BITS only works with four u32s so we have to offset the
>  	 * bitfield positions accordingly.
>  	 */
>  	au = UNSTUFF_BITS(ssr, 428 - 384, 4);
> -	if (au > 0 && au <= 9) {
> +	if (au > 0 && au <= max_au) {
>  		card->ssr.au = 1 << (au + 4);
>  		es = UNSTUFF_BITS(ssr, 408 - 384, 16);
>  		et = UNSTUFF_BITS(ssr, 402 - 384, 6);

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

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

* Re: [PATCH] mmc: sd: fix the maximum au_size for SD3.0
  2013-08-25  3:08 ` Chris Ball
@ 2013-08-26  1:25   ` Jaehoon Chung
  0 siblings, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2013-08-26  1:25 UTC (permalink / raw)
  To: Chris Ball
  Cc: linux-mmc, Kyungmin Park, Ulf Hansson, Philip Rakity,
	Johan Rudholm, Aaron Lu

Hi Chris,

Thanks a lot.

Do you have any comment or plan for merging?

https://patchwork.kernel.org/patch/2837942/
https://patchwork.kernel.org/patch/2837943/
https://patchwork.kernel.org/patch/2837944/
https://patchwork.kernel.org/patch/2837945/

Best Regards,
Jaehoon Chung

On 08/25/2013 12:08 PM, Chris Ball wrote:
> Hi Jaehoon,
> 
> Pushed to mmc-next for 3.12 with the following minor change, let me
> know if you disagree:
> 
> On Thu, Jul 18 2013, Jaehoon Chung wrote:
>> Since SD Physical Layer specification V3.0, AU_SIZE is supported up to 0xf.
>> So If SD-card is supported v3.0, then max_au should be 0xf.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  drivers/mmc/core/sd.c |   10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
>> index 176d125..aa5013f 100644
>> --- a/drivers/mmc/core/sd.c
>> +++ b/drivers/mmc/core/sd.c
>> @@ -215,7 +215,7 @@ static int mmc_decode_scr(struct mmc_card *card)
>>  static int mmc_read_ssr(struct mmc_card *card)
>>  {
>>  	unsigned int au, es, et, eo;
>> -	int err, i;
>> +	int err, i, max_au;
>>  	u32 *ssr;
>>  
>>  	if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
>> @@ -239,12 +239,18 @@ static int mmc_read_ssr(struct mmc_card *card)
>>  	for (i = 0; i < 16; i++)
>>  		ssr[i] = be32_to_cpu(ssr[i]);
>>  
>> +	/* The value of maximum au_size is supported 0xF since SD3.0 */
>> +	if (card->scr.sda_spec3)
>> +		max_au = 0xf;
>> +	else
>> +		max_au = 9;
>> +
> 
> /* SD3.0 increases max AU size to 64MB (0xF) from 4MB (0x9) */
> max_au = card->scr.sda_spec3 ? 0xF : 0x9;
> 
>>  	/*
>>  	 * UNSTUFF_BITS only works with four u32s so we have to offset the
>>  	 * bitfield positions accordingly.
>>  	 */
>>  	au = UNSTUFF_BITS(ssr, 428 - 384, 4);
>> -	if (au > 0 && au <= 9) {
>> +	if (au > 0 && au <= max_au) {
>>  		card->ssr.au = 1 << (au + 4);
>>  		es = UNSTUFF_BITS(ssr, 408 - 384, 16);
>>  		et = UNSTUFF_BITS(ssr, 402 - 384, 6);
> 
> Thanks,
> 
> - Chris.
> 


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

end of thread, other threads:[~2013-08-26  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-18  4:34 [PATCH] mmc: sd: fix the maximum au_size for SD3.0 Jaehoon Chung
2013-08-25  3:08 ` Chris Ball
2013-08-26  1:25   ` Jaehoon Chung

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.