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.

am335x移植 mtd无显示



在移植根文件系统到nandflash时,遇到以下报错

UBI error: cannot open mtd NAND.file-system, error -2
[ 1.631751] input: gpio_buttons@0 as /devices/platform/gpio_buttons@0/input/input0
[ 1.640997] hctosys: unable to open rtc device (rtc0)
[ 1.647613] ALSA device list:
[ 1.650692] No soundcards found.
[ 1.655114] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19
[ 1.663474] Please append a correct "root=" boot option; here are the available partitions:
[ 1.672148] 0100 65536 ram0
[ 1.672154] (driver?)
[ 1.678359] 0101 65536 ram1
[ 1.678363] (driver?)
[ 1.684591] 0102 65536 ram2
[ 1.684594] (driver?)
[ 1.690778] 0103 65536 ram3
[ 1.690781] (driver?)
[ 1.696999] 0104 65536 ram4
[ 1.697002] (driver?)
[ 1.703213] 0105 65536 ram5
[ 1.703216] (driver?)
[ 1.709412] 0106 65536 ram6
[ 1.709415] (driver?)
[ 1.715627] 0107 65536 ram7
[ 1.715631] (driver?)
[ 1.721761] 0108 65536 ram8
[ 1.721763] (driver?)
[ 1.727914] 0109 65536 ram9
[ 1.727917] (driver?)
[ 1.734065] 010a 65536 ram10
[ 1.734068] (driver?)
[ 1.740282] 010b 65536 ram11
[ 1.740284] (driver?)
[ 1.746544] 010c 65536 ram12
[ 1.746547] (driver?)
[ 1.752780] 010d 65536 ram13
[ 1.752783] (driver?)
[ 1.758997] 010e 65536 ram14
[ 1.759000] (driver?)
[ 1.765232] 010f 65536 ram15
[ 1.765235] (driver?)
[ 1.771457] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.779768] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

网上搜索后找到以下链接的方法:

processors.wiki.ti.com/.../UBIFS_Support

但在使用sd卡启动是发现mtd无显示,信息·如下

root@am335x-evm:/dev# cat /proc/mtd

dev: size erasesize name

请问这是什么情况

  • 检查一下有没有配置MTD。
    e2e.ti.com/.../763606
  • 你好,里面提到的deconfig文件是指linux中的配置文件吗?

    目前,我使用的是tisdk-rootfs-image-am335x-evm.tar.gz中自带的内核与根文件系统

  • 我查看了一下tisdk-am335x-evm.deconfig(我现在所使用的的)内容如下,里面mtd相关的都开了,但是cat /proc/mtd并无显示。

    #
    # Bus devices
    #
    # CONFIG_BRCMSTB_GISB_ARB is not set
    # CONFIG_OMAP_INTERCONNECT is not set
    CONFIG_OMAP_OCP2SCP=y
    CONFIG_SIMPLE_PM_BUS=y
    CONFIG_TI_SYSC=y
    # CONFIG_VEXPRESS_CONFIG is not set
    # CONFIG_CONNECTOR is not set
    # CONFIG_GNSS is not set
    CONFIG_MTD=y
    CONFIG_MTD_TESTS=m
    # CONFIG_MTD_REDBOOT_PARTS is not set
    CONFIG_MTD_CMDLINE_PARTS=y
    # CONFIG_MTD_AFS_PARTS is not set
    CONFIG_MTD_OF_PARTS=y
    # CONFIG_MTD_AR7_PARTS is not set

    #
    # Partition parsers
    #

    #
    # User Modules And Translation Layers
    #

    CONFIG_MTD_CHAR=y
    CONFIG_MTD_BLKDEVS=y
    CONFIG_MTD_BLOCK=y
    # CONFIG_FTL is not set
    # CONFIG_NFTL is not set
    # CONFIG_INFTL is not set
    # CONFIG_RFD_FTL is not set
    # CONFIG_SSFDC is not set
    # CONFIG_SM_FTL is not set
    # CONFIG_MTD_OOPS is not set
    # CONFIG_MTD_SWAP is not set
    # CONFIG_MTD_PARTITIONED_MASTER is not set

    #
    # RAM/ROM/Flash chip drivers
    #
    CONFIG_MTD_CFI=y
    # CONFIG_MTD_JEDECPROBE is not set
    CONFIG_MTD_GEN_PROBE=y
    # CONFIG_MTD_CFI_ADV_OPTIONS is not set
    CONFIG_MTD_MAP_BANK_WIDTH_1=y

  • 前面我贴出来的内核部分配置了吗?
    对照以下帖子再检查一下。
    e2e.ti.com/.../856854
  • 我检查了一下在log没有发现NAND,mtd分区的信息。请问这是怎么一回事

    仅有以下这一段是相关的:


    [ 1.389966] omap-gpmc 50000000.gpmc: GPMC revision 6.0
    [ 1.395366] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
    [ 1.402350] omap-gpmc 50000000.gpmc: Incompatible NAND node: missing compatible
    [ 1.409711] omap-gpmc 50000000.gpmc: failed to probe DT child 'nand': -22

    在dts文件我的配置为:

    nandflash_pins_s0: nandflash_pins_s0 {
    pinctrl-single,pins = <
    AM33XX_IOPAD(0x800, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
    AM33XX_IOPAD(0x804, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
    AM33XX_IOPAD(0x808, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
    AM33XX_IOPAD(0x80c, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
    AM33XX_IOPAD(0x810, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
    AM33XX_IOPAD(0x814, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
    AM33XX_IOPAD(0x818, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
    AM33XX_IOPAD(0x81c, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
    AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
    AM33XX_IOPAD(0x874, PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wpn.gpmc_wpn */
    AM33XX_IOPAD(0x87c, PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
    AM33XX_IOPAD(0x890, PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
    AM33XX_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
    AM33XX_IOPAD(0x898, PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
    AM33XX_IOPAD(0x89c, PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */
    >;
    };

    &elm {
    status= "okay";
    };

    &gpmc {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&nandflash_pins_s0>;
    ranges = <0 0 0x08000000 0x1000000>; /* CS0: 16MB for NAND */
    nand@0,0 {
    reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
    ti,nand-ecc-opt = "bch8";
    ti,elm-id = <&elm>;
    ti,hwmods="gpmc";
    nand-bus-width = <8>;
    gpmc,device-nand = "true";
    gpmc,device-width = <1>;
    gpmc,sync-clk-ps = <0>;
    gpmc,cs-on-ns = <0>;
    gpmc,cs-rd-off-ns = <44>;
    gpmc,cs-wr-off-ns = <44>;
    gpmc,adv-on-ns = <6>;
    gpmc,adv-rd-off-ns = <34>;
    gpmc,adv-wr-off-ns = <44>;
    gpmc,we-on-ns = <0>;
    gpmc,we-off-ns = <40>;
    gpmc,oe-on-ns = <0>;
    gpmc,oe-off-ns = <54>;
    gpmc,access-ns = <64>;
    gpmc,rd-cycle-ns = <82>;
    gpmc,wr-cycle-ns = <82>;
    gpmc,wait-on-read = "true";
    gpmc,wait-on-write = "true";
    gpmc,bus-turnaround-ns = <0>;
    gpmc,cycle2cycle-delay-ns = <0>;
    gpmc,clk-activation-ns = <0>;
    gpmc,wait-monitoring-ns = <0>;
    gpmc,wr-access-ns = <40>;
    gpmc,wr-data-mux-bus-ns = <0>;
    #address-cells = <1>;
    #size-cells = <1>;
    partition@0 {
    label = "NAND.SPL";
    reg = <0x00000000 0x000040000>;
    };
    partition@1 {
    label = "NAND.SPL.backup1";
    reg = <0x00040000 0x00040000>;
    };
    partition@2 {
    label = "NAND.SPL.backup2";
    reg = <0x00080000 0x00040000>;
    };
    partition@3 {
    label = "NAND.SPL.backup3";
    reg = <0x000C0000 0x00040000>;
    };
    partition@4 {
    label = "NAND.u-boot-spl-os";
    reg = <0x00100000 0x00040000>;
    };
    partition@5 {
    label = "NAND.u-boot";
    reg = <0x00140000 0x00200000>;
    };
    partition@6 {
    label = "NAND.u-boot-env";
    reg = <0x00340000 0x00040000>;
    };
    partition@7 {
    label = "NAND.u-boot-env.backup1";
    reg = <0x00380000 0x00040000>;
    };
    partition@8 {
    label = "NAND.driver-tree";
    reg = <0x003C0000 0x00080000>;
    };
    partition@9 {
    label = "NAND.kernel";
    reg = <0x00440000 0x00800000>;
    };
    partition@10 {
    label = "NAND.file-system";
    reg = <0x00C40000 0x3F3C0000>;
    };
    };
    };

    关于linux内核的配置为:

    root@am335x-evm:~# gunzip -c /proc/config.gz | grep -E '^CO.*(MTD|GPMC)'
    CONFIG_MTD=y
    CONFIG_MTD_PARTITIONS=y
    CONFIG_MTD_CMDLINE_PARTS=y
    CONFIG_MTD_OF_PARTS=y
    CONFIG_MTD_BLKDEVS=y
    CONFIG_MTD_BLOCK=y
    CONFIG_MTD_CHAR=y
    CONFIG_MTD_CFI=y
    CONFIG_MTD_GEN_PROBE=y
    CONFIG_MTD_MAP_BANK_WIDTH_1=y
    CONFIG_MTD_MAP_BANK_WIDTH_2=y
    CONFIG_MTD_MAP_BANK_WIDTH_4=y
    CONFIG_MTD_CFI_I1=y
    CONFIG_MTD_CFI_I2=y
    CONFIG_MTD_CFI_AMDSTD=y
    CONFIG_MTD_CFI_UTIL=y
    CONFIG_MTD_COMPLEX_MAPPINGS=y
    CONFIG_MTD_PHYSMAP=y
    CONFIG_MTD_PHYSMAP_OF=y
    CONFIG_MTD_M25P80=y
    CONFIG_MTD_ONENAND=y
    CONFIG_MTD_NAND_ECC=y
    CONFIG_MTD_NAND=y
    CONFIG_MTD_NAND_DENALI=y
    CONFIG_MTD_NAND_DENALI_DT=y
    CONFIG_MTD_NAND_OMAP2=y
    CONFIG_MTD_NAND_OMAP_BCH=y
    CONFIG_MTD_NAND_OMAP_BCH_BUILD=y
    CONFIG_MTD_NAND_BRCMNAND=y
    CONFIG_MTD_SPI_NOR=y
    CONFIG_MTD_UBI=y
    CONFIG_MTD_UBI_WL_THRESHOLD=4096
    CONFIG_MTD_UBI_BEB_LIMIT=20
    CONFIG_MTD_HYPERBUS=y
    CONFIG_OMAP_GPMC=y

    另外可查询到dtb文件配置导入了系统

    .

    root@am335x-evm:~# ls -al /proc/device-tree/ocp/gpmc@50000000/nand@0\,0/
    -r--r--r-- 1 root root 4 Apr 19 02:20 #address-cells
    -r--r--r-- 1 root root 4 Apr 19 02:20 #size-cells
    drwxr-xr-x 13 root root 0 Apr 19 02:20 .
    drwxr-xr-x 3 root root 0 Apr 19 02:20 ..
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,access-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,adv-on-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,adv-rd-off-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,adv-wr-off-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,bus-turnaround-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,clk-activation-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,cs-on-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,cs-rd-off-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,cs-wr-off-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,cycle2cycle-delay-ns
    -r--r--r-- 1 root root 5 Apr 19 02:20 gpmc,device-nand
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,device-width
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,oe-off-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,oe-on-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,rd-cycle-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,sync-clk-ps
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,wait-monitoring-ns
    -r--r--r-- 1 root root 5 Apr 19 02:20 gpmc,wait-on-read
    -r--r--r-- 1 root root 5 Apr 19 02:20 gpmc,wait-on-write
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,we-off-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,we-on-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,wr-access-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,wr-cycle-ns
    -r--r--r-- 1 root root 4 Apr 19 02:20 gpmc,wr-data-mux-bus-ns
    -r--r--r-- 1 root root 5 Apr 19 02:20 name
    -r--r--r-- 1 root root 4 Apr 19 02:20 nand-bus-width
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@0
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@1
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@10
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@2
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@3
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@4
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@5
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@6
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@7
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@8
    drwxr-xr-x 2 root root 0 Apr 19 02:20 partition@9
    -r--r--r-- 1 root root 12 Apr 19 02:20 reg
    -r--r--r-- 1 root root 4 Apr 19 02:20 ti,elm-id
    -r--r--r-- 1 root root 5 Apr 19 02:20 ti,nand-ecc-opt

  • omap-gpmc 50000000.gpmc: Incompatible NAND node: missing compatible
    这里提示DTS文件中有一个报错。
    是不是没有添加 compatible: "ti,omap2-nand" ?
    另外GPMC nand这部分有根据自制板做过改动吗?如果自制板中有改动的话,可能需要结合原理图配置正确的引脚以及配置的时序需要满足相应的nand芯片。
  • 是的,之前里面没有添加 compatible: "ti,omap2-nand"

    现在添加后串口输出信息为:

    [ 1.144763] omap2-nand 50000000.gpmc: ti,nand-ecc-opt not found

    [ 1.150958] omap2-nand: probe of 50000000.gpmc failed with error -22

    我前面的dts中是有写: ti,nand-ecc-opt = "bch8";

    请问这该如何处理?

  • 问题解决了,我将compatible: "ti,omap2-nand" 将在nand0{}内,可识别mtd了。

    不过为什么像am335x-evm、dts这些并未将这个语句呢?

  • 建议看一下processor-sdk-linux\Documentation\devicetree\bindings\mtd\gpmc-nand.txt中的说明。是不是配置的不对。
  • ZB_LAJI 说:

    问题解决了,我将compatible: "ti,omap2-nand" 将在nand0{}内,可识别mtd了。

    什么意思?

    没有将compatible = "ti,omap2-nand";放在nand@0,0 {}内?

    gpmc-nand.txt中都有示例。

    nand@0,0 {
    compatible = "ti,omap2-nand";
    reg = <0 0 4>; /* CS0, offset 0, NAND I/O window 4 */
    interrupt-parent = <&gpmc>;
    interrupts = <0 IRQ_TYPE_NONE>, <1 IRQ_TYPE NONE>;
    nand-bus-width = <16>;
    ti,nand-ecc-opt = "bch8";
    ti,nand-xfer-type = "polled";
    rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */

  • 我之前是直接复制am335x-evm、dts里面关于nand的代码,里面是没有compatible = "ti,omap2-nand";