mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>,
	barebox@lists.infradead.org
Cc: Marco Felsch <m.felsch@pengutronix.de>
Subject: Re: [PATCH] mci: core: add write_reliable device parameter
Date: Wed, 9 Oct 2024 07:40:07 +0200	[thread overview]
Message-ID: <97bbc7a6-5014-43ed-a253-792faf7570a8@pengutronix.de> (raw)
In-Reply-To: <20241008231228.2106435-1-m.grzeschik@pengutronix.de>

Hello Michael,

On 09.10.24 01:12, Michael Grzeschik wrote:
> Add mmcX.write_reliable parameter so it can be queried by
> scripts and board code.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/mci/mci-core.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 48a3df9ec9..1b7526abfa 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -2680,6 +2680,22 @@ static int mci_get_partition_setting_completed(struct mci *mci)
>  	return ret;
>  }
>  
> +static int mci_get_write_reliable(struct mci *mci)
> +{
> +	u8 *ext_csd;
> +	int ret;
> +
> +	ext_csd = mci_get_ext_csd(mci);
> +	if (IS_ERR(ext_csd))
> +		return PTR_ERR(ext_csd);
> +
> +	ret = ext_csd[EXT_CSD_WR_REL_SET] & 0x1f;
> +
> +	dma_free(ext_csd);

I know that this is copied off mci_get_partition_setting_completed(),
but why does it need to call mci_get_ext_csd()? Can't we just access
prepopulated mci->ext_csd?

> +
> +	return ret;
> +}> +
>  /**
>   * Probe an MCI card at the given host interface
>   * @param mci MCI device instance
> @@ -2796,6 +2812,13 @@ static int mci_card_probe(struct mci *mci)
>  				"Failed to determine EXT_CSD_PARTITION_SETTING_COMPLETED\n");
>  		else
>  			dev_add_param_bool_fixed(&mci->dev, "partitioning_completed", ret);
> +
> +		ret = mci_get_write_reliable(mci);
> +		if (ret < 0)
> +			dev_dbg(&mci->dev,
> +				"Failed to determine EXT_CSD_WR_REL_SET\n");
> +		else
> +			dev_add_param_bool_fixed(&mci->dev, "write_reliable", ret);

Wouldn't it be confusing for the write reliability setting to remain constant?

For example a script may want to check that the value is not set before running,
but if it's set at runtime, we want the script to notice that on the second run
without having to reset.

I know this would apply to partitioning_completed too.

What do you think?

Cheers,
Ahmad

>  	}
>  
>  	mci_parse_cid(mci);


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2024-10-09  5:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 23:12 Michael Grzeschik
2024-10-09  5:40 ` Ahmad Fatoum [this message]

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=97bbc7a6-5014-43ed-a253-792faf7570a8@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    --cc=m.grzeschik@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox