diff mbox series

[1/2] mmc: mmc_of_parse: Enable 52 MHz support with "cap-mmc-highspeed"

Message ID 20200915195147.2659607-1-mr.nuke.me@gmail.com
State Accepted
Commit f80b8ac69bbbd38636562e8d8f4123d2633aa448
Delegated to: Patrick Delaunay
Headers show
Series [1/2] mmc: mmc_of_parse: Enable 52 MHz support with "cap-mmc-highspeed" | expand

Commit Message

Alex G. Sept. 15, 2020, 7:51 p.m. UTC
"cap-mmc-highspeed" enables support for 26 MHz MMC, but there is no
additional flag to enable 52 MHz MMC. In Linux. "cap-mmc-highspeed"
is used for MMC HS at both 26MHz and 52MHz.

Use the same approach and enable MMC_CAP(MMC_HS_52) host capability
when "cap-mmc-highspeed" is found in the devicetree. In the event an
MMC card doesn't support 52 MHz, it will be clocked at a speed based
on its EXT CSD, even on 52 MHz host controllers

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
 drivers/mmc/mmc-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Patrick DELAUNAY Oct. 2, 2020, 9:16 a.m. UTC | #1
Hi,

> From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> Sent: mardi 15 septembre 2020 21:52
> 
> "cap-mmc-highspeed" enables support for 26 MHz MMC, but there is no additional
> flag to enable 52 MHz MMC. In Linux. "cap-mmc-highspeed"
> is used for MMC HS at both 26MHz and 52MHz.
> 
> Use the same approach and enable MMC_CAP(MMC_HS_52) host capability
> when "cap-mmc-highspeed" is found in the devicetree. In the event an MMC card
> doesn't support 52 MHz, it will be clocked at a speed based on its EXT CSD, even
> on 52 MHz host controllers
> 
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
>  drivers/mmc/mmc-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index
> 90690c8d1e..6d2310eff3 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -198,7 +198,7 @@ int mmc_of_parse(struct udevice *dev, struct
> mmc_config *cfg)
>  	if (dev_read_bool(dev, "cap-sd-highspeed"))
>  		cfg->host_caps |= MMC_CAP(SD_HS);
>  	if (dev_read_bool(dev, "cap-mmc-highspeed"))
> -		cfg->host_caps |= MMC_CAP(MMC_HS);
> +		cfg->host_caps |= MMC_CAP(MMC_HS) |
> MMC_CAP(MMC_HS_52);
>  	if (dev_read_bool(dev, "sd-uhs-sdr12"))
>  		cfg->host_caps |= MMC_CAP(UHS_SDR12);
>  	if (dev_read_bool(dev, "sd-uhs-sdr25"))
> --
> 2.25.4

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>

Tested on STM32MP157C-EV1, for mmc 1 = emmc with patch [1]

	Mode: MMC High Speed (52MHz)

[1]: mmc: stm32_sdmmc2: Use mmc_of_parse() to read host capabilities
     http://patchwork.ozlabs.org/project/uboot/patch/20200909215402.366561-1-mr.nuke.me@gmail.com/


Thanks

Patrick
Patrice CHOTARD Oct. 2, 2020, 9:33 a.m. UTC | #2
Hi Alexndru

On 9/15/20 9:51 PM, Alexandru Gagniuc wrote:
> "cap-mmc-highspeed" enables support for 26 MHz MMC, but there is no
> additional flag to enable 52 MHz MMC. In Linux. "cap-mmc-highspeed"
> is used for MMC HS at both 26MHz and 52MHz.
>
> Use the same approach and enable MMC_CAP(MMC_HS_52) host capability
> when "cap-mmc-highspeed" is found in the devicetree. In the event an
> MMC card doesn't support 52 MHz, it will be clocked at a speed based
> on its EXT CSD, even on 52 MHz host controllers
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
>  drivers/mmc/mmc-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 90690c8d1e..6d2310eff3 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -198,7 +198,7 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
>  	if (dev_read_bool(dev, "cap-sd-highspeed"))
>  		cfg->host_caps |= MMC_CAP(SD_HS);
>  	if (dev_read_bool(dev, "cap-mmc-highspeed"))
> -		cfg->host_caps |= MMC_CAP(MMC_HS);
> +		cfg->host_caps |= MMC_CAP(MMC_HS) | MMC_CAP(MMC_HS_52);
>  	if (dev_read_bool(dev, "sd-uhs-sdr12"))
>  		cfg->host_caps |= MMC_CAP(UHS_SDR12);
>  	if (dev_read_bool(dev, "sd-uhs-sdr25"))

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>

Thanks
Patrick DELAUNAY Oct. 2, 2020, 12:54 p.m. UTC | #3
Hi Peng,

> From: Uboot-stm32 <uboot-stm32-bounces@st-md-mailman.stormreply.com> On
> Behalf Of Patrick DELAUNAY
> 
> Hi,
> 
> > From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> > Sent: mardi 15 septembre 2020 21:52
> >
> > "cap-mmc-highspeed" enables support for 26 MHz MMC, but there is no
> > additional flag to enable 52 MHz MMC. In Linux. "cap-mmc-highspeed"
> > is used for MMC HS at both 26MHz and 52MHz.
> >
> > Use the same approach and enable MMC_CAP(MMC_HS_52) host capability
> > when "cap-mmc-highspeed" is found in the devicetree. In the event an
> > MMC card doesn't support 52 MHz, it will be clocked at a speed based
> > on its EXT CSD, even on 52 MHz host controllers
> >
> > Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> > ---
> >  drivers/mmc/mmc-uclass.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
> Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
> 
> Tested on STM32MP157C-EV1, for mmc 1 = emmc with patch [1]
> 
> 	Mode: MMC High Speed (52MHz)
> 
> [1]: mmc: stm32_sdmmc2: Use mmc_of_parse() to read host capabilities
>      http://patchwork.ozlabs.org/project/uboot/patch/20200909215402.366561-1-
> mr.nuke.me@gmail.com/

Today this patch is delegate to me in patchwork even it is a mmc core patch:

http://patchwork.ozlabs.org/project/uboot/list/?series=201912

You are OK if I integrate this patch in my stm32 pull request for v2020.01-rc1 or
I delegate to you ?

> 
> Thanks
> 
> Patrick
> _______________________________________________
> Uboot-stm32 mailing list
> Uboot-stm32@st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32
Patrick DELAUNAY Oct. 21, 2020, 7:59 a.m. UTC | #4
Hi Alexandru,

> From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> Sent: mardi 15 septembre 2020 21:52
> To: uboot-stm32@st-md-mailman.stormreply.com; peng.fan@nxp.com
> Cc: Alexandru Gagniuc <mr.nuke.me@gmail.com>; Patrick DELAUNAY
> <patrick.delaunay@st.com>; Patrice CHOTARD <patrice.chotard@st.com>; u-
> boot@lists.denx.de
> Subject: [PATCH 1/2] mmc: mmc_of_parse: Enable 52 MHz support with "cap-
> mmc-highspeed"
> Importance: High
> 
> "cap-mmc-highspeed" enables support for 26 MHz MMC, but there is no additional
> flag to enable 52 MHz MMC. In Linux. "cap-mmc-highspeed"
> is used for MMC HS at both 26MHz and 52MHz.
> 
> Use the same approach and enable MMC_CAP(MMC_HS_52) host capability
> when "cap-mmc-highspeed" is found in the devicetree. In the event an MMC card
> doesn't support 52 MHz, it will be clocked at a speed based on its EXT CSD, even
> on 52 MHz host controllers
> 
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
>  drivers/mmc/mmc-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Applied to u-boot-stm/master, thanks!

Regards

Patrick
Peng Fan Oct. 22, 2020, 2:11 a.m. UTC | #5
> Subject: RE: [PATCH 1/2] mmc: mmc_of_parse: Enable 52 MHz support with
> "cap-mmc-highspeed"
> 
> Hi Peng,
> 
> > From: Uboot-stm32
> <uboot-stm32-bounces@st-md-mailman.stormreply.com>
> > On Behalf Of Patrick DELAUNAY
> >
> > Hi,
> >
> > > From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> > > Sent: mardi 15 septembre 2020 21:52
> > >
> > > "cap-mmc-highspeed" enables support for 26 MHz MMC, but there is no
> > > additional flag to enable 52 MHz MMC. In Linux. "cap-mmc-highspeed"
> > > is used for MMC HS at both 26MHz and 52MHz.
> > >
> > > Use the same approach and enable MMC_CAP(MMC_HS_52) host
> capability
> > > when "cap-mmc-highspeed" is found in the devicetree. In the event an
> > > MMC card doesn't support 52 MHz, it will be clocked at a speed based
> > > on its EXT CSD, even on 52 MHz host controllers
> > >
> > > Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> > > ---
> > >  drivers/mmc/mmc-uclass.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> >
> > Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
> > Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
> >
> > Tested on STM32MP157C-EV1, for mmc 1 = emmc with patch [1]
> >
> > 	Mode: MMC High Speed (52MHz)
> >
> > [1]: mmc: stm32_sdmmc2: Use mmc_of_parse() to read host capabilities
> >
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch
> >
> work.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20200909215402.366561-
> 1-&a
> >
> mp;data=02%7C01%7Cpeng.fan%40nxp.com%7C2242885f15fb4bc5a38508d
> 866d261c
> >
> e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63737240105383
> 8309&amp;
> >
> sdata=NJ1fDTquBTBOQVMdxYf3gTExxkNEHeZ9mnazXAKY0GQ%3D&amp;rese
> rved=0
> > mr.nuke.me@gmail.com/
> 
> Today this patch is delegate to me in patchwork even it is a mmc core patch:
> 
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchw
> ork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D201912&amp;da
> ta=02%7C01%7Cpeng.fan%40nxp.com%7C2242885f15fb4bc5a38508d866d2
> 61ce%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63737240105
> 3848304&amp;sdata=J4b9Dy%2FnujRrpiYtaQbIq68w%2F2FfKlKoMheH8Mtae
> P8%3D&amp;reserved=0
> 
> You are OK if I integrate this patch in my stm32 pull request for v2020.01-rc1
> or I delegate to you ?

You could take that first. My PR will be later.

Thanks,
Peng.

> 
> >
> > Thanks
> >
> > Patrick
> > _______________________________________________
> > Uboot-stm32 mailing list
> > Uboot-stm32@st-md-mailman.stormreply.com
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fst-m
> >
> d-mailman.stormreply.com%2Fmailman%2Flistinfo%2Fuboot-stm32&amp;dat
> a=0
> >
> 2%7C01%7Cpeng.fan%40nxp.com%7C2242885f15fb4bc5a38508d866d261ce
> %7C686ea
> >
> 1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637372401053848304&amp;
> sdata=DDw
> >
> sEwf%2F%2B3JOeITkO2pnUjJFu4hpru5DqY5FUGNnXdM%3D&amp;reserved=
> 0
diff mbox series

Patch

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 90690c8d1e..6d2310eff3 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -198,7 +198,7 @@  int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
 	if (dev_read_bool(dev, "cap-sd-highspeed"))
 		cfg->host_caps |= MMC_CAP(SD_HS);
 	if (dev_read_bool(dev, "cap-mmc-highspeed"))
-		cfg->host_caps |= MMC_CAP(MMC_HS);
+		cfg->host_caps |= MMC_CAP(MMC_HS) | MMC_CAP(MMC_HS_52);
 	if (dev_read_bool(dev, "sd-uhs-sdr12"))
 		cfg->host_caps |= MMC_CAP(UHS_SDR12);
 	if (dev_read_bool(dev, "sd-uhs-sdr25"))