0

我有一个使用 s25hs512t 和 imx6ul 的定制板。目前我正在使用支持 Spansion S25HS 系列的 u-boot 2021.10-rc3。

我的dtsi有

&qspi {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_qspi>;
        status = "okay";

        flash: s25hs512t@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "spansion,s25hs512t", "jedec,spi-nor";
                spi-max-frequency = <40000000>;
                spi-rx-bus-width = <4>;
                spi-tx-bus-width = <4>;
                reg = <0>;
                spi-mode = <0>;
                m25p,fast-read;
                status = "okay";

                partition@uboot {
                        label = "uboot";
                        reg = <0x00000000 0x00100000>;
                };
                partition@uboot-env {
                        label = "uboot-env";
                        reg = <0x00100000 0x00040000>;
                };
                partition@kernel-dtb {
                        label = "kernel-dtb";
                        reg = <0x00140000 0x00040000>;
                };
                partition@kernel {
                        label = "kernel";
                        reg = <0x00180000 0x00800000>;
                };
                partition@root {
                        label = "root";
                        reg = <0x00980000 0x03640000>;
                };

        };
};

u-boot 检测正常

=> sf probe                                                                                        
drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
drivers/core/uclass.c:333-uclass_find_device_by_seq()    - 0 'spi@21e0000'
drivers/core/uclass.c:336-uclass_find_device_by_seq()    - found
drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2af60, cs=0
drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
drivers/core/uclass.c:333-uclass_find_device_by_seq()    - 0 'spi@21e0000'
drivers/core/uclass.c:336-uclass_find_device_by_seq()    - found
drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2af60, cs=0
drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
drivers/core/uclass.c:333-uclass_find_device_by_seq()    - 0 'iomuxc@20e0000'
drivers/core/uclass.c:336-uclass_find_device_by_seq()    - found
drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() jedec_spi_nor m25p80@0: set_state_simple op missing
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[9f] lutval[0:1c00049f        1:0     2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[5a] lutval[0:818045a         1:1c000c08      2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[5a] lutval[0:818045a         1:1c000c08      2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[5a] lutval[0:818045a         1:1c000c08      2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[b7] lutval[0:4b7     1:0     2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[65] lutval[0:8200465         1:1c00          2:0     3:0]
drivers/mtd/spi/spi-nor-core.c:2531-  spi_nor_parse_sfdp() jedec_spi_nor m25p80@0: non-uniform erase sector maps are not supported yet.
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[65] lutval[0:8200465         1:1c00          2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[65] lutval[0:8200465         1:1c00          2:0     3:0]
SF: Detected s25hs512t with page size 256 Bytes, erase size 256 KiB, total 64 MiB
drivers/mtd/mtdcore.c:494-      add_mtd_device() mtd: Giving out device 0 to s25hs512t <=== That works
drivers/spi/spi-uclass.c:431-  spi_get_bus_and_cs() spi_get_bus_and_cs: bus=9ef2ae80, slave=9ef2d248

设置 mtdparts 工作正常

=> env set mtdparts 's25hs512t:1024k(uboot),256k(uboot-env),256k(kernel-dtb),6656k(kernel),-(root)'

=> mtd list                                                                                        
drivers/mtd/mtdcore.c:494-      add_mtd_device() mtd: Giving out device 1 to uboot
drivers/mtd/mtdcore.c:494-      add_mtd_device() mtd: Giving out device 2 to uboot-env
drivers/mtd/mtdcore.c:494-      add_mtd_device() mtd: Giving out device 3 to kernel-dtb
drivers/mtd/mtdcore.c:494-      add_mtd_device() mtd: Giving out device 4 to kernel
drivers/mtd/mtdcore.c:494-      add_mtd_device() mtd: Giving out device 5 to root
List of MTD devices:
* s25hs512t
  - device: m25p80@0
  - parent: spi@21e0000
  - driver: jedec_spi_nor
  - path: /soc/aips-bus@2100000/spi@21e0000/m25p80@0
  - type: NOR flash
  - block size: 0x40000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "s25hs512t"
          - 0x000000000000-0x000000100000 : "uboot"
          - 0x000000100000-0x000000140000 : "uboot-env"
          - 0x000000140000-0x000000180000 : "kernel-dtb"
          - 0x000000180000-0x000000800000 : "kernel"
          - 0x000000800000-0x000004000000 : “root"

问题是在设置 mtdids 时

=> setenv mtdids 'nor0=s25hs512t'    
=> mtdparts 
Device nor0 not found!

问题

  1. 我在设置 mtdids 时做错了什么?什么应该是正确的
  2. 要设置的正确 dfu_alt_info 是什么。我试过但没有奏效的是
env set dfu_alt_info 'mtd nor0=uboot part 1;uboot-env part 2;kernel-dtb part 3;kernel part 4;root partubi 5;'
4

1 回答 1

0

因此,最近 u-boot 2021.10-rc3 上包含 Serial Flash Discoverable Parameters 的补丁似乎从参数本身中提取了名称。

在驱动程序/mtd/spi/spi-nor-core.c

int spi_nor_scan(struct spi_nor *nor)
{
        ...
        if (!mtd->name)
                mtd->name = info->name;
        mtd->dev = nor->dev;
        ...
}

虽然这是一个好主意,但它在 u-boot 上破坏了 mtdparts 和 dfu(可能是其他人,不确定),因为它需要旧的命名约定 - nor、nand 等后缀为 dev 数字

如果我将名称静态编码为

        if (!mtd->name)
                mtd->name = "nor0";

我已经成功了

=> sf probe
drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
drivers/core/uclass.c:333-uclass_find_device_by_seq()    - 0 'spi@21e0000'
drivers/core/uclass.c:336-uclass_find_device_by_seq()    - found
drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2af60, cs=0
drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
drivers/core/uclass.c:333-uclass_find_device_by_seq()    - 0 'spi@21e0000'
drivers/core/uclass.c:336-uclass_find_device_by_seq()    - found
drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2af60, cs=0
drivers/core/uclass.c:325-uclass_find_device_by_seq() 0
drivers/core/uclass.c:333-uclass_find_device_by_seq()    - 0 'iomuxc@20e0000'
drivers/core/uclass.c:336-uclass_find_device_by_seq()    - found
drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() jedec_spi_nor m25p80@0: set_state_simple op missing
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[9f] lutval[0:1c00049f        1:0     2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[5a] lutval[0:818045a         1:1c000c08      2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[5a] lutval[0:818045a         1:1c000c08      2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[5a] lutval[0:818045a         1:1c000c08      2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[b7] lutval[0:4b7     1:0     2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[65] lutval[0:8200465         1:1c00          2:0     3:0]
drivers/mtd/spi/spi-nor-core.c:2531-  spi_nor_parse_sfdp() jedec_spi_nor m25p80@0: non-uniform erase sector maps are not supported yet.
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[65] lutval[0:8200465         1:1c00          2:0     3:0]
drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[65] lutval[0:8200465         1:1c00          2:0     3:0]
SF: Detected nor0 with page size 256 Bytes, erase size 256 KiB, total 64 MiB
drivers/spi/spi-uclass.c:431-  spi_get_bus_and_cs() spi_get_bus_and_cs: bus=9ef2ae80, slave=9ef2b9c8

=> env set mtdparts 'nor0:1024k(uboot),256k(uboot-env),256k(kernel-dtb),6656k(kernel),-(root)'

=> setenv mtdids 'nor0=nor0'         

=> mtdparts                 

device nor0 <nor0>, # parts = 5
 #: name                size            offset          mask_flags
 0: uboot               0x00100000      0x00000000      0
 1: uboot-env           0x00040000      0x00100000      0
 2: kernel-dtb          0x00040000      0x00140000      0
 3: kernel              0x00680000      0x00180000      0
 4: root                0x03800000      0x00800000      0

active partition: nor0,0 - (uboot) 0x00100000 @ 0x00000000

defaults:
mtdids  : 
mtdparts: 

=> env set dfu_alt_info 'mtd nor0=uboot part 1;uboot-env part 2;kernel-dtb part 3;kernel part 4;root partubi 5' 

=> dfu 0 list  
using id 'nor0,0'
using id 'nor0,1'
using id 'nor0,2'
using id 'nor0,3'                                                                                                
using id 'nor0,4'
DFU alt settings list:
dev: MTD alt: 0 name: uboot layout: RAW_ADDR
dev: MTD alt: 1 name: uboot-env layout: RAW_ADDR
dev: MTD alt: 2 name: kernel-dtb layout: RAW_ADDR
dev: MTD alt: 3 name: kernel layout: RAW_ADDR
dev: MTD alt: 4 name: root layout: RAW_ADDR

该解决方案不适合生产,但至少在 u-boot 人员修复它之前不会破坏您的开发

于 2021-09-18T20:45:11.787 回答