public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: u-boot@lists.denx.de
Cc: Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Martin Rowe <martin.p.rowe@gmail.com>
Subject: Re: A38x BootROM MMC_CMD_SEND_STATUS timeouts
Date: Sat, 1 Apr 2023 18:43:45 +0200	[thread overview]
Message-ID: <20230401164345.iwfu7nd5jgbjtpzl@pali> (raw)
In-Reply-To: <20230325122506.yoopsks4voy6wiv5@pali>

Can anybody help with this?

On Saturday 25 March 2023 13:25:06 Pali Rohár wrote:
> CCing MMC maintainers (Peng Fan & Jaehoon Chung). Could you help us with
> this issue? Expected usage is following: BootROM reads and execute SPL
> from eMMC (BootROM has its own code for reading eMMC), SPL initialize
> mmc driver and after SPL finish its work it returns control back to
> BootROM and BootROM reads and execute proper U-Boot from eMMC. And issue
> is that after SPL returns control back to BootROM it looks like that
> BootROM is sending MMC_CMD_SEND_STATUS command to eMMC but it timeouts
> (timeout takes 5 minutes!) and after it correctly reads proper U-Boot
> from eMMC and continues booting proper U-Boot. I guess that there is an
> issue that SPL's mmc driver changes eMMC state into something which
> BootROM does not expect.
> 
> On Friday 24 March 2023 02:55:55 Martin Rowe wrote:
> > On Thu, 23 Mar 2023 at 19:01, Pali Rohár <pali@kernel.org> wrote:
> > > There is issue with that 5 minutes delay. But I think it should be fixed
> > > by the patch which I sent earlier, which restore partition config based
> > > on mmc->part_config in board_return_to_bootrom(). Could you test it?
> > > https://lore.kernel.org/u-boot/20230305160416.xc7wlzmkaociwcf7@pali/
> > > Now when mmc->part_config is correctly initialized it should restore
> > > configuration and BootROM does not have to get that "Timeout waiting
> > > card ready" error.
> > 
> > Still takes about 5 minutes. The output is below with MMC tracing. I
> > confirmed the value of mmc->part_config used for
> > restore_emmc_boot_part_config is the same as what is initially
> > detected early in SPL (both are 10 with mmc partconf 0 0 1 1 and
> > zeroed boot0).
> > 
> > ERROR: Invalid kwbimage v1
> > mmc_load_image_raw_sector: mmc block read error
> > spl: mmc: wrong boot mode
> > Trying to boot from BOOTROM
> > CMD_SEND:6
> >         ARG             0x03b30a00
> >         MMC_RSP_R1b         0x00000900
> > CMD_SEND:13
> >         ARG             0x00010000
> >         MMC_RSP_R1,5,6,7      0x00000900
> > CURR STATE:4
> > Returning to BootROM (return address 0xffff05c4)...
> 
> I looked at the BootROM disassembled code and error message
> "Timeout waiting card ready" is printed when following mmc command
> cmdidx=0xd, resptype=0x15, cmdarg=(something)<<0x10 timeouts.
> 
> 0xd is in U-Boot MMC_CMD_SEND_STATUS
> 
> 0x15 is in U-Boot MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY
> which looks like U-Boot's MMC_RSP_R2 with BUSY bit set
> 
> It looks like U-Boot function mmc_send_status() where that "something"
> in cmdarg is mmc->rca.
> 
> If command does not timeout then BootROM next checks if response has
> BIT(8) set and if response mask 0x1e00 matches value 0xe00. If both are
> truth then BootROM mark call as successful.
> 
> If response ANDed with mask 0xfdf94080 is non-zero then BootROM prints
> "Status Error: " with hex response value and mark call as unsuccessful.
> 
> I'm looking at the U-Boot code and this BootROM logic looks very similar
> to U-Boot function mmc_poll_for_busy(), just without first call
> mmc_wait_dat0().
> 
> BIT(8) is MMC_STATUS_RDY_FOR_DATA
> 0x1e00 is MMC_STATUS_CURR_STATE
> 0xe00 is MMC_STATE_PRG
> 0xfdf94080 is MMC_STATUS_MASK
> 
> I'm not mmc expert, but this looks like MMC_CMD_SEND_STATUS is failing
> in BootROM after U-Boot returns control back to the BootROM.

  reply	other threads:[~2023-04-01 16:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 10:38 [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot Pali Rohár
2023-03-04 10:38 ` [PATCH RFC u-boot-mvebu 1/2] tools: kwboot: Fix MMC HW boot partitions info Pali Rohár
2023-03-04 10:38 ` [PATCH RFC u-boot-mvebu 2/2] arm: mvebu: spl: Load proper U-Boot from eMMC Boot 0 partition Pali Rohár
2023-03-05  2:24 ` [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot Martin Rowe
2023-03-05 11:46   ` Pali Rohár
2023-03-05 16:04     ` Pali Rohár
2023-03-06 11:15       ` Martin Rowe
2023-03-06 11:53         ` Pali Rohár
2023-03-10 17:53           ` Pali Rohár
2023-03-19  0:32           ` Martin Rowe
2023-03-19 16:22             ` Pali Rohár
2023-03-20 11:48               ` Martin Rowe
2023-03-20 17:33                 ` Pali Rohár
2023-03-21  8:01                   ` Martin Rowe
2023-03-21  8:07                     ` Pali Rohár
2023-03-22 12:38                       ` Martin Rowe
2023-03-22 13:45                         ` Martin Rowe
2023-03-22 17:59                           ` Pali Rohár
2023-03-22 19:09                             ` Pali Rohár
2023-03-23 12:24                               ` Martin Rowe
2023-03-23 19:00                                 ` Pali Rohár
2023-03-24  2:55                                   ` Martin Rowe
2023-03-25 12:25                                     ` A38x BootROM MMC_CMD_SEND_STATUS timeouts (Was: Re: [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot) Pali Rohár
2023-04-01 16:43                                       ` Pali Rohár [this message]
2023-04-26 23:45                                         ` A38x BootROM MMC_CMD_SEND_STATUS timeouts Pali Rohár
2023-04-28  7:39                                         ` Peng Fan
2023-04-28  8:30                                           ` Pali Rohár
2023-06-11 22:46                                             ` Pali Rohár
2023-03-06 18:40         ` [PATCH RFC u-boot-mvebu 0/2] arm: mvebu: Fix eMMC boot Pali Rohár
2023-03-19  2:30           ` Martin Rowe
2023-03-19 16:41             ` Pali Rohár

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=20230401164345.iwfu7nd5jgbjtpzl@pali \
    --to=pali@kernel.org \
    --cc=jh80.chung@samsung.com \
    --cc=martin.p.rowe@gmail.com \
    --cc=peng.fan@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox