This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM3354:AM3354 U-Boot 无法从 NAND 引导并找到解决方案

Guru**** 2537330 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1560773/am3354-am3354-u-boot-failed-to-boot-from-nand-and-solution-found

器件型号:AM3354


工具/软件:

“spl_nand.c"中“中的“spl_nand_read"函“函数使用 nand_page_size () 来获取 NAND 页面大小,但它不会在 SPL 中初始化。

https://git.ti.com/cgit/ti-u-boot/ti-u-boot/tree/common/spl/spl_nand.c#n62

static ulong spl_nand_read(struct spl_load_info *load, ulong offs, ulong size,
			   void *dst)
{
	int err;
	ulong sector;

	debug("%s: offs %lx, size %lx, dst %p\n",
	      __func__, offs, size, dst);

	sector = *(int *)load->priv;
	offs = sector + nand_spl_adjust_offset(sector, offs - sector);
	err = nand_spl_load_image(offs, size, dst);
	spl_set_bl_len(load, nand_page_size());
	if (err)
		return 0;

	return size;
}

该修复程序在 drivers/mtd/nand/raw/am335x_spl_bch.c 中设置为 config_SYS_NAND_PAGE_SIZE (以 nand_init () 表示) 、

使 nand_page_size() API 在 SPL 中工作。

diff --git a/drivers/mtd/nand/raw/am335x_spl_bch.c b/drivers/mtd/nand/raw/am335x_spl_bch.c
index 4b50f351d35..cb10fb9ac49 100644
--- a/drivers/mtd/nand/raw/am335x_spl_bch.c
+++ b/drivers/mtd/nand/raw/am335x_spl_bch.c
@@ -209,6 +209,9 @@ void nand_init(void)
                (void  __iomem *)CFG_SYS_NAND_BASE;
        board_nand_init(&nand_chip);
 
+       // Ensure SPL knows the page size, so nand_page_size() works in SPL.
+       mtd->writesize = CONFIG_SYS_NAND_PAGE_SIZE;
+
        if (nand_chip.select_chip)
                nand_chip.select_chip(mtd, 0);
 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我将使用  ti-u-boot-2025.01 分支中的最新提交 c5737097b4859362aa22260c5a1f2becd62af65c、

    任何上游的人都能确认这个错误,包括在下一个版本中的修复,谢谢.

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Ted:
    感谢您报告此问题并提供潜在的修复。
    1/。 您是否使用 AM335x Linux SDK 9.3.5.2 进行了测试
    https://www.ti.com/tool/download/AM335X/09.03.05.02 PROCESSOR-SDK-LINUX
    2/。 您的测试是在 TI 电路板还是客户电路板上完成的?
    此致、
    - Hong

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Hong Hong:

    我将为定制板构建 Yocto 映像、并将 u-boot 从 ti-u-boot-2021.01 更新 为 ti-u-boot-2025.01 

    我的测试在我们的定制板上完成、没有要测试的 TI 板。

     

    了解 了 AM335x Linux SDK 9.3.5.2、CI 表示它可以针对 AM335x-EVM 正确引导、

    不确定 TI CI 测试是从 SD 卡还是 NAND 引导?

    https://software-dl.ti.com/cicd-report/linux/index.html?section=snapshot&platform=am335x&snapshot=cicd.scarthgap.202508281316

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Ted:
    GPMC-n 和引导与 AM335x Linux SDK 9.3.5.2 配合使用。
    我附加了 GPMC-n 和刷写/引导日志以供您参考。
    此致、
    - Hong

    e2e.ti.com/.../am3_5F00_9.3.5.2_5F00_nand_5F00_flash.log

    e2e.ti.com/.../am3_5F00_9.3.5.2_5F00_nand_5F00_boot.log

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

     Hong Hong:

    感谢您分享日志、

    看起来两个日志都从 MMC 引导、因为 这两个日志都显示了 从 mmc0:1 加载环境变量

    Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...

    由于我要报告的问题仅影响 NAND SPL 引导阶段、

    因此、从 MMC 引导时、闪存 NAND 和显示 NAND 信息对我来说也是可行的。

    仅当尝试从 NAND 引导时、它才会失败、并按以下方式打印日志:

    U-Boot SPL 2025.01-00573-ga578b20f0017 (Sep 01 2025 - 16:07:08 +1200)
    Detected NAND width: 8
    SysBoot: 0x400b, Control Status: 0x0040030b
    XTAL: 24MHz
    Boot Mode: USB0, NAND, SPI0, MMC0
    Boot Device: NAND(5)
    PMIC INT status: 0x16
    Reset Cookie BCK1: 0x00, BCK2: 0x00, BCK3: 0x00
    Wakeup Source: Power Key
    Fuel Gauge flags(MSB): 0x02
    Trying to boot from NAND
    SPL: failed to boot from all boot devices

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Ted:
    我在 AM335x EVM 上使用 AM335x Linux SDK 9.3.5.2 捕获了两个日志、其中
    -“AM3_9.3.5.2_nand_flash.log"是“是 GPMC-n 和刷写@u-boot、它从 SD 引导、如日志中所述

    Trying to boot from MMC1
    ...
    => md.l 0x44e10040 1
    44e10040: 00400397

    -“AM3_9.3.5.2_nand_boot.log"是“是从 GPMC-n 和刷写后的 MOL/u-boot 引导、如日志中所述

    Trying to boot from NAND
    ...
    => md.l 0x44e10040 1
    44e10040: 00400394

    此致、
    - Hong

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    好的、感谢 Hong 确认与非引导是否适用于  AM335x EVM、

    我会把这个问题标记为“现在已解决“、欢呼。