All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width
@ 2011-08-30 10:55 Chander Kashyap
  2011-08-31  8:33 ` Jaehoon Chung
  2011-09-01  1:23 ` Andy Fleming
  0 siblings, 2 replies; 6+ messages in thread
From: Chander Kashyap @ 2011-08-30 10:55 UTC (permalink / raw)
  To: u-boot

mmc data transfer width is set as following:
WIDE8[5]:
0 = Depend on WIDE4
1 = 8-bit mode
WIDE4[1]:
1 = 4-bit mode
0 = 1-bit mode

In case of 4-bit mode reset 8-bit mode and
in case of 1-bit mode reset 8-bit mode and 4-bit mode

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
---
 drivers/mmc/s5p_mmc.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/s5p_mmc.c b/drivers/mmc/s5p_mmc.c
index 7786ecf..6e6ad08 100644
--- a/drivers/mmc/s5p_mmc.c
+++ b/drivers/mmc/s5p_mmc.c
@@ -368,12 +368,16 @@ static void mmc_set_ios(struct mmc *mmc)
 	 * 1 = 4-bit mode
 	 * 0 = 1-bit mode
 	 */
-	if (mmc->bus_width == 8)
+	if (mmc->bus_width == 8) {
 		ctrl |= (1 << 5);
-	else if (mmc->bus_width == 4)
+		ctrl &= ~(1 << 1);
+	} else if (mmc->bus_width == 4) {
 		ctrl |= (1 << 1);
-	else
+		ctrl &= ~(1 << 5);
+	} else {
 		ctrl &= ~(1 << 1);
+		ctrl &= ~(1 << 5);
+	}
 
 	/*
 	 * OUTEDGEINV[2]
-- 
1.7.4.1

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

* [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width
  2011-08-30 10:55 [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width Chander Kashyap
@ 2011-08-31  8:33 ` Jaehoon Chung
  2011-09-01  1:23 ` Andy Fleming
  1 sibling, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2011-08-31  8:33 UTC (permalink / raw)
  To: u-boot

Hi Chander.

this patch is correct. 

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Chander Kashyap wrote:

> mmc data transfer width is set as following:
> WIDE8[5]:
> 0 = Depend on WIDE4
> 1 = 8-bit mode
> WIDE4[1]:
> 1 = 4-bit mode
> 0 = 1-bit mode
> 
> In case of 4-bit mode reset 8-bit mode and
> in case of 1-bit mode reset 8-bit mode and 4-bit mode
> 
> Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
> ---
>  drivers/mmc/s5p_mmc.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/s5p_mmc.c b/drivers/mmc/s5p_mmc.c
> index 7786ecf..6e6ad08 100644
> --- a/drivers/mmc/s5p_mmc.c
> +++ b/drivers/mmc/s5p_mmc.c
> @@ -368,12 +368,16 @@ static void mmc_set_ios(struct mmc *mmc)
>  	 * 1 = 4-bit mode
>  	 * 0 = 1-bit mode
>  	 */
> -	if (mmc->bus_width == 8)
> +	if (mmc->bus_width == 8) {
>  		ctrl |= (1 << 5);
> -	else if (mmc->bus_width == 4)
> +		ctrl &= ~(1 << 1);
> +	} else if (mmc->bus_width == 4) {
>  		ctrl |= (1 << 1);
> -	else
> +		ctrl &= ~(1 << 5);
> +	} else {
>  		ctrl &= ~(1 << 1);
> +		ctrl &= ~(1 << 5);
> +	}
>  
>  	/*
>  	 * OUTEDGEINV[2]

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

* [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width
  2011-08-30 10:55 [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width Chander Kashyap
  2011-08-31  8:33 ` Jaehoon Chung
@ 2011-09-01  1:23 ` Andy Fleming
  2011-09-01  2:26   ` Minkyu Kang
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Fleming @ 2011-09-01  1:23 UTC (permalink / raw)
  To: u-boot

On Tue, Aug 30, 2011 at 5:55 AM, Chander Kashyap
<chander.kashyap@linaro.org> wrote:
> mmc data transfer width is set as following:
> WIDE8[5]:
> 0 = Depend on WIDE4
> 1 = 8-bit mode
> WIDE4[1]:
> 1 = 4-bit mode
> 0 = 1-bit mode
>
> In case of 4-bit mode reset 8-bit mode and
> in case of 1-bit mode reset 8-bit mode and 4-bit mode
>
> Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
> ---
> ?drivers/mmc/s5p_mmc.c | ? 10 +++++++---
> ?1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/s5p_mmc.c b/drivers/mmc/s5p_mmc.c
> index 7786ecf..6e6ad08 100644
> --- a/drivers/mmc/s5p_mmc.c
> +++ b/drivers/mmc/s5p_mmc.c
> @@ -368,12 +368,16 @@ static void mmc_set_ios(struct mmc *mmc)
> ? ? ? ? * 1 = 4-bit mode
> ? ? ? ? * 0 = 1-bit mode
> ? ? ? ? */
> - ? ? ? if (mmc->bus_width == 8)
> + ? ? ? if (mmc->bus_width == 8) {
> ? ? ? ? ? ? ? ?ctrl |= (1 << 5);
> - ? ? ? else if (mmc->bus_width == 4)
> + ? ? ? ? ? ? ? ctrl &= ~(1 << 1);


I know these were like this before, but those numbers are awfully
magical. You should really define constants for them.

Also, this seems like a very confusing way to do this? Why not clear
both bits@the start, and then set the one that is needed?

Andy

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

* [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width
  2011-09-01  1:23 ` Andy Fleming
@ 2011-09-01  2:26   ` Minkyu Kang
  2011-09-01  5:51     ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Minkyu Kang @ 2011-09-01  2:26 UTC (permalink / raw)
  To: u-boot

Dear Andy Fleming,

On 1 September 2011 10:23, Andy Fleming <afleming@gmail.com> wrote:
> On Tue, Aug 30, 2011 at 5:55 AM, Chander Kashyap
> <chander.kashyap@linaro.org> wrote:
>> mmc data transfer width is set as following:
>> WIDE8[5]:
>> 0 = Depend on WIDE4
>> 1 = 8-bit mode
>> WIDE4[1]:
>> 1 = 4-bit mode
>> 0 = 1-bit mode
>>
>> In case of 4-bit mode reset 8-bit mode and
>> in case of 1-bit mode reset 8-bit mode and 4-bit mode
>>
>> Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
>> ---
>> ?drivers/mmc/s5p_mmc.c | ? 10 +++++++---
>> ?1 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/mmc/s5p_mmc.c b/drivers/mmc/s5p_mmc.c
>> index 7786ecf..6e6ad08 100644
>> --- a/drivers/mmc/s5p_mmc.c
>> +++ b/drivers/mmc/s5p_mmc.c
>> @@ -368,12 +368,16 @@ static void mmc_set_ios(struct mmc *mmc)
>> ? ? ? ? * 1 = 4-bit mode
>> ? ? ? ? * 0 = 1-bit mode
>> ? ? ? ? */
>> - ? ? ? if (mmc->bus_width == 8)
>> + ? ? ? if (mmc->bus_width == 8) {
>> ? ? ? ? ? ? ? ?ctrl |= (1 << 5);
>> - ? ? ? else if (mmc->bus_width == 4)
>> + ? ? ? ? ? ? ? ctrl &= ~(1 << 1);
>
>
> I know these were like this before, but those numbers are awfully
> magical. You should really define constants for them.

We decided to use comments instead of defines.

>
> Also, this seems like a very confusing way to do this? Why not clear
> both bits at the start, and then set the one that is needed?

Agreed.

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net

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

* [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width
  2011-09-01  2:26   ` Minkyu Kang
@ 2011-09-01  5:51     ` Wolfgang Denk
  2011-09-02  8:09       ` Minkyu Kang
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2011-09-01  5:51 UTC (permalink / raw)
  To: u-boot

Dear Minkyu Kang,

In message <CALrBrZ3H+k8bu-1OwF5C5BNHuphj_J8jXXV2xgu6jPO5gmJELg@mail.gmail.com> you wrote:
> 
> > I know these were like this before, but those numbers are awfully
> > magical. You should really define constants for them.
> 
> We decided to use comments instead of defines.

And now we ask you to fix this, because we don;t want such magic
constants.  So please go on and change this.

Thanks.

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
About the use of language: it is impossible to sharpen a pencil  with
a  blunt  ax.  It is equally vain to try to do it with ten blunt axes
instead.                                           -- Edsger Dijkstra

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

* [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width
  2011-09-01  5:51     ` Wolfgang Denk
@ 2011-09-02  8:09       ` Minkyu Kang
  0 siblings, 0 replies; 6+ messages in thread
From: Minkyu Kang @ 2011-09-02  8:09 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk,

On 1 September 2011 14:51, Wolfgang Denk <wd@denx.de> wrote:
> Dear Minkyu Kang,
>
> In message <CALrBrZ3H+k8bu-1OwF5C5BNHuphj_J8jXXV2xgu6jPO5gmJELg@mail.gmail.com> you wrote:
>>
>> > I know these were like this before, but those numbers are awfully
>> > magical. You should really define constants for them.
>>
>> We decided to use comments instead of defines.
>
> And now we ask you to fix this, because we don;t want such magic
> constants. ?So please go on and change this.
>

OK.

Thanks.
Minkyu Kang
-- 
from. prom.
www.promsoft.net

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

end of thread, other threads:[~2011-09-02  8:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30 10:55 [U-Boot] [PATCH] s5p-mmc: Fix ambiguous setting of data transfer width Chander Kashyap
2011-08-31  8:33 ` Jaehoon Chung
2011-09-01  1:23 ` Andy Fleming
2011-09-01  2:26   ` Minkyu Kang
2011-09-01  5:51     ` Wolfgang Denk
2011-09-02  8:09       ` Minkyu Kang

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.