linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es
@ 2018-07-11  3:00 Hongjie Fang
  2018-07-16  8:23 ` Fang Hongjie(方洪杰)
  2018-07-16 10:11 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Hongjie Fang @ 2018-07-11  3:00 UTC (permalink / raw)
  To: ulf.hansson
  Cc: adrian.hunter, shawn.lin, linus.walleij, wsa+renesas, bst,
	jinqian, chanho.min, kyle.roeschley, linux-mmc, linux-kernel,
	Hongjie Fang

mmc_select_hs400es() calls mmc_select_bus_width() which will continue
to set 4bit transfer mode if fail to set 8bit mode. The bus width
should not be set to 4bit in HS400es.

When fail to set 8bit mode, need return error directly for HS400es.

Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
---
 drivers/mmc/core/mmc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 4466f5d..4bd6c09 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1021,8 +1021,11 @@ static int mmc_select_bus_width(struct mmc_card *card)
 				 EXT_CSD_BUS_WIDTH,
 				 ext_csd_bits[idx],
 				 card->ext_csd.generic_cmd6_time);
-		if (err)
+		if (err) {
+			if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
+				return err;
 			continue;
+		}
 
 		bus_width = bus_widths[idx];
 		mmc_set_bus_width(host, bus_width);
-- 
1.9.1


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

* RE: [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es
  2018-07-11  3:00 [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es Hongjie Fang
@ 2018-07-16  8:23 ` Fang Hongjie(方洪杰)
  2018-07-16 10:11 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Fang Hongjie(方洪杰) @ 2018-07-16  8:23 UTC (permalink / raw)
  To: ulf.hansson
  Cc: adrian.hunter, shawn.lin, linus.walleij, wsa+renesas, bst,
	jinqian, chanho.min, kyle.roeschley, linux-mmc, linux-kernel


> mmc_select_hs400es() calls mmc_select_bus_width() which will continue
> to set 4bit transfer mode if fail to set 8bit mode. The bus width
> should not be set to 4bit in HS400es.
> 
> When fail to set 8bit mode, need return error directly for HS400es.
> 
> Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
> ---
>  drivers/mmc/core/mmc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 4466f5d..4bd6c09 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1021,8 +1021,11 @@ static int mmc_select_bus_width(struct mmc_card *card)
>  				 EXT_CSD_BUS_WIDTH,
>  				 ext_csd_bits[idx],
>  				 card->ext_csd.generic_cmd6_time);
> -		if (err)
> +		if (err) {
> +			if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
> +				return err;
>  			continue;
> +		}
> 
>  		bus_width = bus_widths[idx];
>  		mmc_set_bus_width(host, bus_width);
> --
> 1.9.1

Ping.
Any suggestion for this patch ?


B&R
Hongjie

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

* Re: [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es
  2018-07-11  3:00 [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es Hongjie Fang
  2018-07-16  8:23 ` Fang Hongjie(方洪杰)
@ 2018-07-16 10:11 ` Ulf Hansson
  2018-07-16 11:01   ` Fang Hongjie(方洪杰)
  1 sibling, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2018-07-16 10:11 UTC (permalink / raw)
  To: Hongjie Fang
  Cc: Adrian Hunter, Shawn Lin, Linus Walleij, Wolfram Sang,
	Bastian Stender, Jin Qian, Chanho Min, Kyle Roeschley, linux-mmc,
	Linux Kernel Mailing List

On 11 July 2018 at 05:00, Hongjie Fang <hongjiefang@asrmicro.com> wrote:
> mmc_select_hs400es() calls mmc_select_bus_width() which will continue
> to set 4bit transfer mode if fail to set 8bit mode. The bus width
> should not be set to 4bit in HS400es.
>
> When fail to set 8bit mode, need return error directly for HS400es.
>
> Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
> ---
>  drivers/mmc/core/mmc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 4466f5d..4bd6c09 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1021,8 +1021,11 @@ static int mmc_select_bus_width(struct mmc_card *card)
>                                  EXT_CSD_BUS_WIDTH,
>                                  ext_csd_bits[idx],
>                                  card->ext_csd.generic_cmd6_time);
> -               if (err)
> +               if (err) {
> +                       if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
> +                               return err;
>                         continue;
> +               }

I would rather let mmc_select_hs400es() check the return code from
mmc_select_bus_width().

So, if the return code isn't MMC_BUS_WIDTH_8, mmc_select_hs400es()
should bail out.

[...]

Kind regards
Uffe

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

* RE: [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es
  2018-07-16 10:11 ` Ulf Hansson
@ 2018-07-16 11:01   ` Fang Hongjie(方洪杰)
  0 siblings, 0 replies; 4+ messages in thread
From: Fang Hongjie(方洪杰) @ 2018-07-16 11:01 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Shawn Lin, Linus Walleij, Wolfram Sang,
	Bastian Stender, Jin Qian, Chanho Min, Kyle Roeschley, linux-mmc,
	Linux Kernel Mailing List

> On 11 July 2018 at 05:00, Hongjie Fang <hongjiefang@asrmicro.com> wrote:
> > mmc_select_hs400es() calls mmc_select_bus_width() which will continue
> > to set 4bit transfer mode if fail to set 8bit mode. The bus width
> > should not be set to 4bit in HS400es.
> >
> > When fail to set 8bit mode, need return error directly for HS400es.
> >
> > Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
> > ---
> >  drivers/mmc/core/mmc.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> > index 4466f5d..4bd6c09 100644
> > --- a/drivers/mmc/core/mmc.c
> > +++ b/drivers/mmc/core/mmc.c
> > @@ -1021,8 +1021,11 @@ static int mmc_select_bus_width(struct mmc_card *card)
> >                                  EXT_CSD_BUS_WIDTH,
> >                                  ext_csd_bits[idx],
> >                                  card->ext_csd.generic_cmd6_time);
> > -               if (err)
> > +               if (err) {
> > +                       if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
> > +                               return err;
> >                         continue;
> > +               }
> 
> I would rather let mmc_select_hs400es() check the return code from
> mmc_select_bus_width().
> 
> So, if the return code isn't MMC_BUS_WIDTH_8, mmc_select_hs400es()
> should bail out.

Yeah, it is better that let mmc_select_hs400es() check the return value.
I will update the patch.

> 
> [...]
> 
> Kind regards
> Uffe


B&R
Hongjie

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

end of thread, other threads:[~2018-07-16 11:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11  3:00 [PATCH V2] mmc: core: improve reasonableness of bus width setting for HS400es Hongjie Fang
2018-07-16  8:23 ` Fang Hongjie(方洪杰)
2018-07-16 10:11 ` Ulf Hansson
2018-07-16 11:01   ` Fang Hongjie(方洪杰)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).