mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Johannes Schneider <johannes.schneider@leica-geosystems.com>
To: barebox@lists.infradead.org, Sascha Hauer <s.hauer@pengutronix.de>
Cc: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Subject: Re: [RFC] mci: imx-esdhc-pbl: enable ADMA2 for i.MX8M BL33 loads
Date: Tue, 23 Jun 2026 13:01:53 +0000	[thread overview]
Message-ID: <20260623130155.3534907-1-johannes.schneider@leica-geosystems.com> (raw)
In-Reply-To: <E1wbYoc-00000005eGZ-2Q1s@pty.whiteo.stw.pengutronix.de>

Hoi Sascha,

On Mon, Jun 22, 2026 at 09:11:30 +0200, Sascha Hauer wrote:
> > 
> > Motivation
> > ----------
> > Current PBL i.MX8M BL33 load is SDMA-based with the SDHCI boundary-restart
> > loop in sdhci_transfer_data_dma(). For a 32 KiB BL33 transfer at the default
> > 4 KiB SDMA boundary that's eight kicks-and-restarts. Measured on a custom
> > i.MX8MM board:
> > 
> >  Boot timeline (from power-on):
> > 	 BootROM:          1 ms
> > 	 PBL-init:         3 ms
> > 	 DDR-training:   262 ms
> > 	 PBL-load:       819 ms
> > 		 PBL-pre-load:    168 ms
> > 		 load_bl33:       645 ms   <--  (SDMA, ~5 MiB/s effective)
> > 		 PBL-post-load:     5 ms
> > 		 BL31-early:      114 ms
> > 		 BL31-platform:    15 ms
> > 		 BL31-runtime:     98 ms
> > 			 thru-OPTEE:       98 ms
> > 			 post-OPTEE:        0 ms
> > 	 barebox:       5654 ms
> > 	 kernel-init:    111 ms
> > 
> > barebox's own runtime imx-esdhc.c driver uses ADMA2 for the same controller
> > and gets the FIT image off the same eMMC at expected speed. ADMA2 in PBL
> > should match.
> 
> You lost me here. ADMA(2) usage is gated behind the SDHCI_USE_ADMA which
> is set in sdhci_setup_adma(). Only the Rockchip driver calls this
> currently, so imx-esdhc should use SDMA also in barebox proper.

You're right, and my cover letter was wrong :-S
To be precise about who uses what:

  Linux sdhci-esdhc-imx : ADMA2 + HS400ES @ 200 MHz
  barebox-proper        : SDMA  (sdhci_transfer_data_dma(), SDHCI_USE_ADMA unset)
  barebox PBL           : PIO   (esdhc_use_pio_mode() is true in PBL)

I wrote that *barebox*-proper uses ADMA2 - that was the mistake; it is
*Linux* that does. barebox-proper uses SDMA, and nothing on i.MX uses
ADMA2.

> So you have patches in your tree I haven't seen yet?

No, nothing unpublished. The ADMA2 reference I was comparing against is
Linux's sdhci-esdhc-imx, not anything in barebox. Linux drives ADMA2 +
HS400ES at 200 MHz on the exact board this RFC targets (USDHC3 -> eMMC):

  # dmesg | grep mmc2
  mmc2: SDHCI controller on 30b60000.mmc using ADMA
  mmc2: new HS400 Enhanced strobe MMC card at address 0001
  mmcblk2: mmc2:0001 IM032G 9.70 GiB

  # cat /sys/kernel/debug/mmc2/ios
  clock:          200000000 Hz
  bus width:      3 (8 bits)
  timing spec:    10 (mmc HS400 enhanced strobe)
  signal voltage: 1 (1.80 V)

so it is a PBL bring-up gap, not a silicon limit.
On our i.MX8MM board, PBL load_bl33 takes ~640 ms in PIO - and this is
what i'm trying to lower ... somehow.

One step up would be SDMA, but that has the problem of the SDMA
boundary field colliding with the 13-bit BLKSIZE, so the boundary
cannot be raised far enough and the engine would end up restarting
every 4K (~340 stops for a 1.5 MB read, which makes SDMA ~= PIO ?).

Therefore i directly "aimed high" at ADMA2, to avoid round-trips and
load everthing in one go - but there it hangs in ST_TFR (RFC body)
-> what might i be missing or have overlooked?


Gruß,
Johannes



  reply	other threads:[~2026-06-23 13:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 16:09 [RFC] mci: imx-esdhc-pbl: enable ADMA2 for i.MX8M BL33 loads -- help needed: ADMA stalls in ST_TFR despite every visible register matching the Linux runtime driver Johannes Schneider
2026-06-22  7:11 ` Sascha Hauer
2026-06-23 13:01   ` Johannes Schneider [this message]
2026-06-22  7:33 ` Ahmad Fatoum
2026-06-23 13:02   ` [RFC] mci: imx-esdhc-pbl: enable ADMA2 for i.MX8M BL33 loads Johannes Schneider

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=20260623130155.3534907-1-johannes.schneider@leica-geosystems.com \
    --to=johannes.schneider@leica-geosystems.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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