All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: "Pali Rohár" <pali@kernel.org>, "Peng Fan" <peng.fan@nxp.com>,
	"Jaehoon Chung" <jh80.chung@samsung.com>,
	"Priyanka Jain" <priyanka.jain@nxp.com>,
	"Sinan Akman" <sinan@writeme.com>
Cc: "u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Re: [PATCH 1/3] mmc: fsl_esdhc_spl: Add support for loading proper U-Boot from unaligned location
Date: Mon, 20 Jun 2022 14:00:27 +0800	[thread overview]
Message-ID: <129747c1-2218-f319-9e30-528fb9adbb31@oss.nxp.com> (raw)
In-Reply-To: <20220511183332.1362-1-pali@kernel.org>



在 2022/5/12 2:33, Pali Rohár 写道:
> This allows to concatenate SPL and proper U-Boot without extra alignment.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>   drivers/mmc/fsl_esdhc_spl.c | 25 ++++++++++++++++++++++---
>   1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c
> index 760f13d24018..e3175de16bab 100644
> --- a/drivers/mmc/fsl_esdhc_spl.c
> +++ b/drivers/mmc/fsl_esdhc_spl.c
> @@ -155,10 +155,21 @@ again:
>   	* Load U-Boot image from mmc into RAM
>   	*/
>   	code_len = CONFIG_SYS_MMC_U_BOOT_SIZE;
> -	blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len;
> -	blk_cnt = ALIGN(code_len, mmc->read_bl_len) / mmc->read_bl_len;
> +	blk_start = offset / mmc->read_bl_len;
> +	blk_off = offset % mmc->read_bl_len;

Build fail because of blk_off not defined.

Regards,
Peng.
> +	blk_cnt = ALIGN(code_len, mmc->read_bl_len) / mmc->read_bl_len + 1;
> +	if (blk_off) {
> +		err = mmc->block_dev.block_read(&mmc->block_dev,
> +						blk_start, 1, tmp_buf);
> +		if (err != 1) {
> +			puts("spl: mmc read failed!!\n");
> +			hang();
> +		}
> +		blk_start++;
> +	}
>   	err = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt,
> -					(uchar *)CONFIG_SYS_MMC_U_BOOT_DST);
> +					(uchar *)CONFIG_SYS_MMC_U_BOOT_DST +
> +					(blk_off ? (mmc->read_bl_len - blk_off) : 0));
>   	if (err != blk_cnt) {
>   		puts("spl: mmc read failed!!\n");
>   #ifndef CONFIG_FSL_CORENET
> @@ -166,6 +177,14 @@ again:
>   #endif
>   		hang();
>   	}
> +	/*
> +	 * SDHC DMA may erase bytes at dst + bl_len - blk_off - 8
> +	 * due to unaligned access. So copy leading bytes from tmp_buf
> +	 * after SDHC DMA transfer.
> +	 */
> +	if (blk_off)
> +		memcpy((uchar *)CONFIG_SYS_MMC_U_BOOT_DST,
> +		       tmp_buf + blk_off, mmc->read_bl_len - blk_off);
>   
>   	/*
>   	* Clean d-cache and invalidate i-cache, to


  parent reply	other threads:[~2022-06-20  6:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 18:33 [PATCH 1/3] mmc: fsl_esdhc_spl: Add support for loading proper U-Boot from unaligned location Pali Rohár
2022-05-11 18:33 ` [PATCH 2/3] mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFS Pali Rohár
2022-05-11 18:33 ` [PATCH 3/3] powerpc: mpc85xx: Fix loading U-Boot proper from SD card in SPL Pali Rohár
2022-06-20  6:00 ` Peng Fan (OSS) [this message]
2022-06-20 10:54   ` [PATCH v2] mmc: fsl_esdhc_spl: Add support for loading proper U-Boot from unaligned location Pali Rohár
2022-06-23 13:31     ` Pali Rohár
2022-06-28 18:14       ` Pali Rohár
2022-07-13 23:50         ` Pali Rohár
2022-07-23  9:42           ` Pali Rohár
     [not found]     ` <CGME20220726082955epcas1p2be5900d205e7ebadaf673b91df633725@epcas1p2.samsung.com>
2022-07-26  8:29       ` Jaehoon Chung
2022-08-05 20:09 ` [PATCH v3 1/3] " Pali Rohár
2022-08-05 20:09   ` [PATCH v3 2/3] powerpc: mpc85xx: Fix loading U-Boot proper from SD card in SPL Pali Rohár
2022-08-05 20:09   ` [PATCH v3 3/3] mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFS Pali Rohár
2022-08-11  5:48     ` jh80.chung

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=129747c1-2218-f319-9e30-528fb9adbb31@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=jh80.chung@samsung.com \
    --cc=pali@kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=priyanka.jain@nxp.com \
    --cc=sinan@writeme.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.