All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/2] mmc: stm32_sdmmc2: Use mmc_of_parse() to read host capabilities
Date: Fri, 2 Oct 2020 09:32:38 +0000	[thread overview]
Message-ID: <bf8168de-fa8c-8bf1-73b3-c31a34fab3f5@st.com> (raw)
In-Reply-To: <20200915195147.2659607-2-mr.nuke.me@gmail.com>

Hi Alexandru

On 9/15/20 9:51 PM, Alexandru Gagniuc wrote:
> mmc_of_parse() can populate the 'f_max' and 'host_caps' fields of
> struct mmc_config from devicetree.
> The same logic is duplicated in stm32_sdmmc2_probe(). Use
> mmc_of_parse(), which is more generic.
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
> Changes from v1:
>  - Check the return value of mmc_of_parse().
>  - The call to mmc_of_parse() is moved further up. This means we can just
>    'return err' on error instead of exiting via goto.
>
>  drivers/mmc/stm32_sdmmc2.c | 24 ++++++------------------
>  1 file changed, 6 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
> index 6d50356217..a29657429c 100644
> --- a/drivers/mmc/stm32_sdmmc2.c
> +++ b/drivers/mmc/stm32_sdmmc2.c
> @@ -653,6 +653,12 @@ static int stm32_sdmmc2_probe(struct udevice *dev)
>  	if (priv->base == FDT_ADDR_T_NONE)
>  		return -EINVAL;
>  
> +	cfg->host_caps = 0;
> +	cfg->f_max = 52000000;
> +	ret = mmc_of_parse(dev, cfg);
> +	if (ret < 0)
> +		return ret;
> +
>  	if (dev_read_bool(dev, "st,neg-edge"))
>  		priv->clk_reg_msk |= SDMMC_CLKCR_NEGEDGE;
>  	if (dev_read_bool(dev, "st,sig-dir"))
> @@ -676,28 +682,10 @@ static int stm32_sdmmc2_probe(struct udevice *dev)
>  			     GPIOD_IS_IN);
>  
>  	cfg->f_min = 400000;
> -	cfg->f_max = dev_read_u32_default(dev, "max-frequency", 52000000);
>  	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
>  	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
>  	cfg->name = "STM32 SD/MMC";
>  
> -	cfg->host_caps = 0;
> -	if (cfg->f_max > 25000000)
> -		cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
> -
> -	switch (dev_read_u32_default(dev, "bus-width", 1)) {
> -	case 8:
> -		cfg->host_caps |= MMC_MODE_8BIT;
> -		/* fall through */
> -	case 4:
> -		cfg->host_caps |= MMC_MODE_4BIT;
> -		break;
> -	case 1:
> -		break;
> -	default:
> -		pr_err("invalid \"bus-width\" property, force to 1\n");
> -	}
> -
>  	upriv->mmc = &plat->mmc;
>  
>  	/* SDMMC init */

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

Thanks

  parent reply	other threads:[~2020-10-02  9:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200910005435epcas1p20d2f97d097717214bd2836fafdd140d9@epcas1p2.samsung.com>
2020-09-09 21:54 ` [PATCH] mmc: stm32_sdmmc2: Use mmc_of_parse() to read host capabilities Alexandru Gagniuc
2020-09-10  7:52   ` Patrice CHOTARD
2020-09-10 16:04   ` Patrick DELAUNAY
2020-09-10 20:10     ` Alex G.
2020-09-11  9:00       ` Patrick DELAUNAY
2020-09-11  7:49   ` Jaehoon Chung
2020-09-11 11:46     ` Patrick DELAUNAY
2020-09-16  1:50       ` Jaehoon Chung
2020-09-15 19:51   ` [PATCH 1/2] mmc: mmc_of_parse: Enable 52 MHz support with "cap-mmc-highspeed" Alexandru Gagniuc
2020-10-02  9:16     ` Patrick DELAUNAY
2020-10-02 12:54       ` Patrick DELAUNAY
2020-10-22  2:11         ` Peng Fan
2020-10-02  9:33     ` Patrice CHOTARD
2020-10-21  7:59     ` Patrick DELAUNAY
2020-09-15 19:51   ` [PATCH v2 2/2] mmc: stm32_sdmmc2: Use mmc_of_parse() to read host capabilities Alexandru Gagniuc
2020-10-02  9:20     ` Patrick DELAUNAY
2020-10-02  9:32     ` Patrice CHOTARD [this message]
2020-10-21  9:06     ` Patrick DELAUNAY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf8168de-fa8c-8bf1-73b3-c31a34fab3f5@st.com \
    --to=patrice.chotard@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.