
Hi Adam,
(Adding MMC and i.MX maintainers to Cc)
On Fri, Sep 27 2019, Adam Ford wrote:
On Fri, Sep 27, 2019 at 4:38 AM Jonathan Gray <jsg at jsg.id.au> wrote:
On Thu, Sep 26, 2019 at 05:07:21PM -0300, Fabio Estevam wrote:
Hi Vagrant,
On Thu, Sep 26, 2019 at 4:16 PM Vagrant Cascadian <vagrant at debian.org> wrote:
I just tested mx6cuboxi with 2019.10-rc4, and it fails to load u-boot.img from MMC:
1 2019-09-26_17:31:27.63089 U-Boot SPL 2019.10-rc4+dfsg-1 (Sep 24 2019 - 08:03:23 +0000) 2 2019-09-26_17:31:27.63092 Trying to boot from MMC2 3 2019-09-26_17:31:27.63095 MMC Device 1 not found 4 2019-09-26_17:31:27.63097 spl: could not find mmc device 1. error: -19 5 2019-09-26_17:31:27.63099 SPL: failed to boot from all boot devices 6 2019-09-26_17:31:27.63101 ### ERROR ### Please RESET the board ###
Thanks for reporting this issue.
Unfortunately, I don't have access to my Cuboxi, so I am adding Jon and Baruch on Cc.
Works after reverting the following commit.
I am going to argue that making the board comply with DM_MMC is why I needed to make the patch, because when booting from MMC2, the function was returning MMC1 which was clearly not the boot source.
If the boards that fail accept MMC2 as a response when booting from MMC2, that seems like a bug on the indvidual boards. Instead they should setup their boot sequence to configure MMC2 when MMC2 is the boot source. Instead, it seems like some boards are configuring MMC1 with MMC2 info which only prolongs the conversion to DM_MMC.
If we revert the patch, then boards like imx6_logic who rely solely on device tree and DM_MMC for booting will have to manually override the MMC driver in order to boot from MMC2, and that seems like a step backwards. I would argue that this board should migrate to DM_MMC and use the device tree to boot, and the problem should go away.
I started working on migration to DM_MMC as you suggested. Unfortunately I can't see how this solves the problem for Cubox-i/Hummingboard, nor in the general case.
The imx6_logic board happens to use only usdhc1 and usdhc2 for boot, and both are always enabled. This matches perfectly to BOOT_DEVICE_MMC{1,2}, and their corresponding DT representation.
However, the 'index' parameter in uclass_get_device() that is set according to BOOT_DEVICE_MMC{1,2} selection has nothing to do with the usdhcX sequence number. It simply returns the Nth probed SD/eMMC device (see uclass_find_device()). In the case of Cubox-i/Hummingboard, usdhc1 is never used for boot, usdhc2 is always an SD card, and usdhc3 is an optional eMMC. When booting from SD card, uclass_get_device(), returns -ENODEV when eMMC is not available, or the eMMC device when it is available. In both cases, boot fails.
In addition, your patch returns BOOT_DEVICE_MMC2 only for usdhc2 boot. All others return BOOT_DEVICE_MMC1. What about usdhc{3,4}?
How is all that intended to work?
Aren't other i.MX boards impacted by this commit?
Thanks, baruch
14d319b1856b86e593e01abd0a1e3c2d63b52a8a is the first bad commit commit 14d319b1856b86e593e01abd0a1e3c2d63b52a8a Author: Adam Ford <aford173 at gmail.com> Date: Thu May 23 14:11:30 2019 -0500
spl: imx6: Let spl_boot_device return USDHC1 or USDHC2 Currently, when the spl_boot_device checks the boot device, it will only return MMC1 when it's either sd or eMMC regardless of whether or not it's MMC1 or MMC2. This is a problem when booting from MMC2 if MMC isn't being manually configured like in the DM_SPL case with SPL_OF_CONTROL. This patch will check the register and return either MMC1 or MMC2. Signed-off-by: Adam Ford <aford173 at gmail.com>
arch/arm/mach-imx/spl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
-- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -