mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, lst@pengutronix.de,
	ukl@pengutronix.de, rcz@pengutronix.de
Subject: Re: [PATCH v2 2/3] mci: imx-esdhc-pbl: support eMMC boot partitions on i.MX8MP
Date: Mon, 4 Oct 2021 12:56:05 +0200	[thread overview]
Message-ID: <20211004105605.GU28453@pengutronix.de> (raw)
In-Reply-To: <20210830115156.21907-2-a.fatoum@pengutronix.de>

On Mon, Aug 30, 2021 at 01:51:55PM +0200, Ahmad Fatoum wrote:
> The i.MX header for SD/MMC starts at an offset to allow for a partition
> table at offset 0. i.MX8MN/P bootrom did away with the offset for eMMC
> boot partitions, which usually lack on-disk partition tables, but kept a
> 32-byte offset for SD and eMMC user partitions.
> 
> The i.MX8MN/P also introduced a ROM API that allows chainloading from
> boot medium by calling back into ROM. This likely handles that
> difference for us, but as we don't support it yet and we already have
> the PBL eSDHC driver, teach it to detect whether boot is from eMMC boot
> partition or not and use the appropriate offset.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> v1 -> v2:
>   - new patch. Without, barebox can be written, but not booted.
>     Tested on i.MX8MN.
> ---
>  drivers/mci/imx-esdhc-pbl.c | 39 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
> index e649eb8bbafb..66df4f6dfc74 100644
> --- a/drivers/mci/imx-esdhc-pbl.c
> +++ b/drivers/mci/imx-esdhc-pbl.c
> @@ -25,6 +25,40 @@
>  
>  #define esdhc_send_cmd	__esdhc_send_cmd
>  
> +static u8 ext_csd[512] __aligned(64);
> +
> +static int esdhc_send_ext_csd(struct fsl_esdhc_host *host)
> +{
> +	struct mci_cmd cmd;
> +	struct mci_data data;
> +
> +	cmd.cmdidx = MMC_CMD_SEND_EXT_CSD;
> +	cmd.cmdarg = 0;
> +	cmd.resp_type = MMC_RSP_R1;
> +
> +	data.dest = ext_csd;
> +	data.blocks = 1;
> +	data.blocksize = sizeof(ext_csd);
> +	data.flags = MMC_DATA_READ;
> +
> +	return esdhc_send_cmd(host, &cmd, &data);
> +}

Is this operation valid for SD cards as well? If not we would first have
to know if we have a SD or eMMC card.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2021-10-04 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 11:51 [PATCH v2 1/3] ARM: i.MX8MP: bbu: fix wrong flash header offset for eMMC boot partition Ahmad Fatoum
2021-08-30 11:51 ` [PATCH v2 2/3] mci: imx-esdhc-pbl: support eMMC boot partitions on i.MX8MP Ahmad Fatoum
2021-10-04 10:56   ` Sascha Hauer [this message]
2021-10-04 11:00     ` Ahmad Fatoum
2021-10-04 11:41       ` Sascha Hauer
2021-08-30 11:51 ` [PATCH v2 3/3] ARM: i.MX8MP: EVK: change bbu handler from eMMC user to boot partition Ahmad Fatoum
2021-08-31  9:42 ` [PATCH v2 1/3] ARM: i.MX8MP: bbu: fix wrong flash header offset for eMMC " Rouven Czerwinski

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=20211004105605.GU28453@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lst@pengutronix.de \
    --cc=rcz@pengutronix.de \
    --cc=ukl@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