U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zixian Zeng <sycamoremoon376@gmail.com>
To: Dave Klotz <DaveWK225@protonmail.com>,
	Yixun Lan <dlan@kernel.org>, Eric Chung <eric.chung@riscstar.com>,
	Peng Fan <peng.fan@nxp.com>
Cc: u-boot@lists.u-boot-project.org,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
	Tom Rini <trini@konsulko.com>,
	u-boot-spacemit@groups.io
Subject: Re: [PATCH v2 2/3] mmc: k1: let the SPL read SD cards more than one block at a time
Date: Sat, 10 Oct 2026 14:17:07 +0800	[thread overview]
Message-ID: <a57e47d3-fe8c-44dc-8afe-2c256ed49d71@gmail.com> (raw)
In-Reply-To: <20261005T135733-0400.mmc-v2-0002.DaveWK225@protonmail.com>

Hi, Dave:

On 2026/10/6 02:01, Dave Klotz wrote:
> spacemit_sdhci_get_b_max() limits every SD read in the SPL to a single
> block, so loading a ~1 MiB u-boot.itb from a card takes about 2000
> separate commands. The controller handles multi-block PIO reads in the
> SPL: the OrangePi RV2 has loaded U-Boot from microSD with them through
> the v2026.07 and v2026.10 trees.
>
> Drop the limit and use the host's b_max.
>
> The merged v13 cover retains the v9 changelog entry choosing single-
> block SD reads in SPL. This reverses that deliberate policy for the
> recorded RV2 SPL boot use case; no general multi-card reliability claim
> is made. K1 does not advertise MMC_CAP_CMD23, so the MMC core sends
> CMD12 after a multi-block read rather than requiring CMD23. Additional
> card models, cold boots and transfer-error recovery remain required.
>
> Signed-off-by: Dave Klotz <DaveWK225@protonmail.com>
> Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
> ---
> Validation: unchanged executable change from v1; exact-base source
> replay and checkpatch pass. The corrected combined integration, with
> separate clock/MMC and DDR relocation fixes, passed SD SPL/FIT and
> automatic NVMe EFI boot on the 4 GiB RV2 in a warm-boot trial. This is
> an integration result, not an isolated test of this patch.
>
>   drivers/mmc/spacemit_sdhci.c | 11 -----------
>   1 file changed, 0 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c
> index 6488ae0fdb..4284553177 100644
> --- a/drivers/mmc/spacemit_sdhci.c
> +++ b/drivers/mmc/spacemit_sdhci.c
> @@ -324,16 +324,6 @@
>   	return 0;
>   }
>   
> -static int spacemit_sdhci_get_b_max(struct udevice *dev, void *dst,
> -				    lbaint_t blkcnt)
> -{
> -	struct mmc *mmc = mmc_get_mmc_dev(dev);
> -
> -	if (IS_ENABLED(CONFIG_SPL_BUILD) && mmc && IS_SD(mmc))
> -		return 1;
> -	return mmc->cfg->b_max;
> -}
> -
>   static void spacemit_sdhci_set_control_reg(struct sdhci_host *host)
>   {
>   	struct mmc *mmc = host->mmc;
> @@ -574,7 +564,6 @@
>   
>   	spacemit_mmc_ops = sdhci_ops;
>   	spacemit_mmc_ops.wait_dat0 = spacemit_sdhci_wait_dat0;
> -	spacemit_mmc_ops.get_b_max = spacemit_sdhci_get_b_max;
>   
>   	ret = clk_get_bulk(dev, &plat->clks);
>   	if (ret) {
Using the current version of the next branch u-boot (ed869863c7),
with your MMC patch series applied.
Since the SPI controller is not enabled by default on the BananaPi-F3,
I also applied another patch series:
Link: 
https://lore.kernel.org/u-boot/cover.1790976767.git.DaveWK225@protonmail.com/ 


I tested u-boot SPL with three SD cards on a BananaPi-F3 and found
a reproducible issue, the specific error I encountered is spl: partition 
error (Error: -38)
At the meantime, when i was revert the commit:
mmc: k1: let the SPL read SD cards more than one block at a time
the error has gone. Same SD card, same operation steps.
Maybe BananaPi-F3 do not support read SD cards more than one block at a 
time?

The issue logs are as follows:

⋊> hack@morise ⋊> ~/k/u-boot on k1-dave-mmc ↑ git log --oneline 
origin/next..HEAD
6b4af8b1dd8 (HEAD -> k1-dave-mmc) mmc: k1: do not release the shared AXI 
clock and reset on probe failure
4114764d716 mmc: k1: let the SPL read SD cards more than one block at a 
time
6676ce89521 mmc: k1: handle a missing max-frequency and clk_set_rate()'s 
return value
6427189ef33 spacemit: k1: fall back to the other boot devices in SPL
b58a31797d7 spacemit: k1: do not require a PMIC or an SPI controller in SPL
⋊> hack@morise ⋊> ~/k/u-boot on k1-dave-mmc ↑ export 
CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv
                                               export 
DDR=/home/hack/k1/spacemit-firmware/k1/v0.2/ddr_fw.bin
                                               export 
SBI=/home/hack/k1/opensbi/build/platform/generic/firmware/fw_dynamic.bin
⋊> hack@morise ⋊> ~/k/u-boot on k1-dave-mmc ↑ make O=build-fix 
spacemit_k1_defconfig
                                               make O=build-fix 
DDR_FW_FILE=$DDR OPENSBI=$SBI DEVICE_TREE=spacemit/k1-bananapi-f3 
-j"$(nproc)"
   GEN     Makefile
#
# configuration written to .config
#
   GEN     Makefile
scripts/kconfig/conf  --syncconfig Kconfig
   CFG     u-boot.cfg
   GEN     include/autoconf.mk.dep
   CFG     spl/u-boot.cfg
   GEN     include/autoconf.mk
   GEN     spl/include/autoconf.mk
   GEN     Makefile
   UPD     include/generated/timestamp_autogenerated.h
   ENVC    include/generated/env.txt
   Using .. as source for U-Boot
   ENVP    include/generated/env.in
   ENVT    include/generated/environment.h
   PYMOD   rebuild
   LDS     u-boot.lds
   CC      common/version.o
   AR      common/built-in.a
   CC      env/common.o
   AR      env/built-in.a
   LD      u-boot
   OBJCOPY u-boot.srec
   OBJCOPY u-boot-nodtb.bin
   SYM     u-boot.sym
   MKIMAGE fit-dtb.blob
   MKIMAGE u-boot.img
   CC      spl/common/spl/spl.o
   MKIMAGE u-boot-dtb.img
   CAT     u-boot-fit-dtb.bin
   COPY    u-boot.bin
   AR      spl/common/spl/built-in.a
   LD      spl/u-boot-spl
   OBJCOPY spl/u-boot-spl-nodtb.bin
   SYM     spl/u-boot-spl.sym
   CAT     spl/u-boot-spl-dtb.bin
   COPY    spl/u-boot-spl.bin
   BINMAN  .binman_stamp
   OFCHK   .config
⋊> hack@morise ⋊> ~/k/u-boot on k1-dave-mmc ↑ cd ~/k1/uboot-2022.10/
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ cat mainline-fsbl.sh
SPL=$1
FSBL=$2
cd /home/hack/k1/uboot-2022.10
cp "$SPL" board/spacemit/k1-x/
python3 tools/build_binary_file.py \
     -c board/spacemit/k1-x/configs/fsbl_ddr.json \
     -o "$FSBL"
rm -f board/spacemit/k1-x/u-boot-spl-ddr.bin
echo "Mainline SPL is included in $FSBL"
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ bash 
mainline-fsbl.sh /home/hack/k1/u-boot/build-fix/u-boot-spl-ddr.bin 
/home/hack/k1/uboot-2022.10/mainline-spl/FSBL-dave.bin
(2026-10-09 21:37:10,279) arch : RISCV64
(2026-10-09 21:37:10,279) description : spacemit k1x fsbl image
writing RSA key
writing RSA key
Mainline SPL is included in 
/home/hack/k1/uboot-2022.10/mainline-spl/FSBL-dave.bin
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ lsblk /dev/mmcblk0
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk0     179:0    0 29.7G  0 disk
├─mmcblk0p1 179:1    0  256K  0 part
├─mmcblk0p2 179:2    0   64K  0 part
├─mmcblk0p3 179:3    0    1M  0 part
├─mmcblk0p4 179:4    0    2M  0 part
├─mmcblk0p5 179:5    0  256M  0 part
└─mmcblk0p6 179:6    0 29.5G  0 part
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ sudo dd 
if=/home/hack/k1/flash-dir/factory/bootinfo_sd.bin of=/dev/mmcblk0 
bs=512 seek=0 count=1 conv=notrunc status=progress
0+1 records in
0+1 records out
80 bytes copied, 0.685238 s, 0.1 kB/s
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ sudo dd 
if=/home/hack/k1/uboot-2022.10/mainline-spl/FSBL-dave.bin 
of=/dev/mmcblk0 bs=512 seek=256 conv=notrunc status=progress
304+1 records in
304+1 records out
156128 bytes (156 kB, 152 KiB) copied, 0.72263 s, 216 kB/s
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ sudo dd 
if=/home/hack/k1/u-boot/build-fix/u-boot.itb of=/dev/mmcblk0 bs=512 
seek=4096 conv=notrunc status=progress
1953+1 records in
1953+1 records out
1000145 bytes (1.0 MB, 977 KiB) copied, 0.818001 s, 1.2 MB/s
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ sync
⋊> hack@morise ⋊> ~/k/uboot-2022.10 on k1-bl-v2.2.y ◦ picocom -b 115200 
/dev/ttyUSB1
picocom v3.1

port is        : /dev/ttyUSB1
flowcontrol    : none
baudrate is    : 115200
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        :
omap is        :
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready
sys: 0x0
try sd...
bm:3
j...

<debug_uart>

U-Boot SPL 2026.10-rc5-00639-g6b4af8b1dd89 (Oct 09 2026 - 21:36:48 +0800)
Fail to detect board:-2
vdd_core, value:900000
vdd_1v8, value:1800000
vdd_1v8_mmc, value:1800000
DDR firmware: [0xc081d340]:0xf0227179, size:0x8d98
DDR is ready
No SPI controller (-19)
Trying to boot from MMC2
spl: partition error
Error: -38
SPL: Unsupported Boot Device!
Trying to boot from MMC1
alloc space exhausted ptr 104380 limit 100000
Aligned buffer alloc failed
spl: could not find mmc device 0. error: -19
Error: -19
SPL: Unsupported Boot Device!
Trying to boot from SPI
Invalid bus 0 (err=-19)
SPI probe failed.
Error: -19
SPL: Unsupported Boot Device!
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices

### ERROR ### Please RESET the board ###

Reported-by: Zixian Zeng <sycamoremoon376@gmail.com>

  reply	other threads:[~2026-10-10 13:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 21:29 [PATCH 0/3] mmc: k1: fixes for the SpacemiT K1 SDHCI driver Dave Klotz
2026-10-02 21:29 ` [PATCH 1/3] mmc: k1: handle a missing max-frequency and clk_set_rate()'s return value Dave Klotz
2026-10-04  9:14   ` Kathpalia, Tanmay
2026-10-04  9:30   ` Kathpalia, Tanmay
2026-10-05 17:46     ` Dave Klotz
2026-10-02 21:29 ` [PATCH 2/3] mmc: k1: let the SPL read SD cards more than one block at a time Dave Klotz
2026-10-04  9:28   ` Kathpalia, Tanmay
2026-10-02 21:29 ` [PATCH 3/3] mmc: k1: do not release the shared AXI clock and reset on probe failure Dave Klotz
2026-10-04  9:28   ` Kathpalia, Tanmay
2026-10-02 22:06 ` [PATCH 0/3] mmc: k1: fixes for the SpacemiT K1 SDHCI driver Dave Klotz
2026-10-05 17:50 ` [PATCH v2 " Dave Klotz
2026-10-05 17:55   ` [PATCH v2 1/3] mmc: k1: handle a missing max-frequency and clk_set_rate()'s return value Dave Klotz
2026-10-06  5:40     ` Kathpalia, Tanmay
2026-10-10  8:45     ` Yixun Lan
2026-10-05 18:01   ` [PATCH v2 2/3] mmc: k1: let the SPL read SD cards more than one block at a time Dave Klotz
2026-10-10  6:17     ` Zixian Zeng [this message]
2026-10-10 19:02       ` Kathpalia, Tanmay
2026-10-10 19:16         ` Kathpalia, Tanmay
2026-10-11  3:38           ` Zixian Zeng
2026-10-11 14:31             ` Kathpalia, Tanmay
2026-10-11 15:33               ` Anand Moon
2026-10-11 19:41                 ` Kathpalia, Tanmay
2026-10-12 13:15               ` Zixian Zeng
2026-10-12 14:00                 ` Kathpalia, Tanmay
2026-10-12 14:30                   ` Yixun Lan
2026-10-12 14:50                     ` Kathpalia, Tanmay
2026-10-12 15:22                       ` Yixun Lan
2026-10-14 19:59                   ` Dave Klotz
2026-10-14 20:34                     ` Kathpalia, Tanmay
2026-10-14 21:31                       ` Yixun Lan
2026-10-18 21:33                         ` Kathpalia, Tanmay
2026-10-18 23:30                           ` Hung-Chun Tseng
2026-10-18 23:33                             ` Hung-Chun Tseng
2026-10-14 21:28                     ` Yixun Lan
2026-10-16 16:40                       ` Hung-Chun Tseng
2026-10-12 16:07                 ` Anand Moon
2026-10-13  0:15                   ` Yixun Lan
2026-10-13  3:44                     ` Anand Moon
2026-10-05 18:11   ` [PATCH v2 3/3] mmc: k1: do not release the shared AXI clock and reset on probe failure Dave Klotz
2026-10-10  7:14     ` Yixun Lan
2026-10-10 19:27       ` Kathpalia, Tanmay

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=a57e47d3-fe8c-44dc-8afe-2c256ed49d71@gmail.com \
    --to=sycamoremoon376@gmail.com \
    --cc=DaveWK225@protonmail.com \
    --cc=dlan@kernel.org \
    --cc=eric.chung@riscstar.com \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=tanmay.kathpalia@altera.com \
    --cc=trini@konsulko.com \
    --cc=u-boot-spacemit@groups.io \
    --cc=u-boot@lists.u-boot-project.org \
    /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