Hello
I'm working with Yocto runing on an IMX6 system (MSC Q7iMX6-Plus), and I'm having problems with u-boot-fw-utils not being able to access the u-boot environment variables.
If I type mtdparts in u-boot I see the following output in the console:
U-Boot > mtdparts
device sflash0 <m25p16>, # parts = 4
#: name size offset mask_flags
0: init 0x00020000 0x00000000 0
1: uboot_data 0x00020000 0x00020000 0
2: uboot 0x00080000 0x00040000 0
3: boot_logo 0x00140000 0x000c0000 0
active partition: sflash0,0 - (init) 0x00020000 @ 0x00000000
defaults:
mtdids : none
mtdparts: none
The environment variable for mtdparts in uboot is:
mtdparts=mtdparts=m25p16:0x0000020000@0x0000000000(init),0x0000020000@0x0000020000(uboot_data),0x0000080000@0x0000040000(uboot),0x0000140000@0x00000c0000(boot_logo)
I have confirmed mtdparts is passed in the command line with cat /proc/cmdline
mtdparts=m25p16:0x0000020000@0x0000000000(init),0x0000020000@0x0000020000(uboot_data),0x0000080000@0x0000040000(uboot),0x0000140000@0x00000c0000(boot_logo)
But when I type cat /proc/mtd I see this:
root@msc-q7-imx6plus:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00008000 00008000 "spi0.0"
mtd1: 00008000 00008000 "spi0.1"
mtd2: 00200000 00010000 "spi3.0"
The above output bears no resembalence to the boot parameters or what is shown in u-boot.
After much research into this I'm aware that the mtd partion is setup either in the boot parameters, device tree or in the source itself. I have checked the source code for the device tree for my board, and also the kernel source for the board I'm working with, but cannot find any referenc to mtd partiion table, let alone what is shown by cat /proc/mtd.
So my question is what determines which parameters are used to define the mtd partition table, ie what decides whether it's the command line parameters, device tree, or embedded in the kernel source itself?
Thanks in advance
Andrew
Hi @igorpadykov & @turker@dtsis.com
Thank you for your replies.
I have been away from this for a few days, so I've not had a chance to reply sooner.
I believe that I had stumbled accross 2 red herrings. The issue was in the device tree, and the command line parameters were not being used. When I followed the example for creating MTD partitions here, I had added some code which was unnecessary.
The block of code in the device tree originally read:
&ecspi4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi4_1>;
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 2 0>;
status = "okay"; flash: spi4@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "atmel,m25p16";
spi-max-frequency = <50000000>;
reg = <0>;
};
};
Following the example for creating MTD partitions, I ammended the code so it read:
&ecspi4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi4_1>;
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 2 0>;
status = "okay"; flash: spi4@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "atmel,m25p16";
spi-max-frequency = <50000000>;
reg = <0>;
//******* Added by Andrew Ellis *********************
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>; partition@0 {
label = "init";
reg = <0x0000000 0x020000>;
read-only;
}; partition@20000 {
label = "uboot_data";
reg = <0x020000 0x020000>;
}; partition@40000 {
label = "uboot";
reg = <0x40000 0x80000>;
read-only;
}; partition@c0000 {
label = "boot_logo";
reg = <0xc0000 0x140000>;
}; }; };
//********************************************************************
};
After reading your replies, and ammending the command line as suggested, I still didn't have any success. I decided to take another look at the device tree, thought I would try removing this block to see what would happen
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
};
And found that the partition table was set up correctly.
The entry in the device tree now reads:
&ecspi4 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi4_1>;
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 2 0>;
status = "okay"; flash: spi4@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "atmel,m25p16";
spi-max-frequency = <50000000>;
reg = <0>; partition@0 {
label = "init";
reg = <0x0000000 0x020000>;
read-only;
}; partition@20000 {
label = "uboot_data";
reg = <0x020000 0x020000>;
}; partition@40000 {
label = "uboot";
reg = <0x40000 0x80000>;
read-only;
}; partition@c0000 {
label = "boot_logo";
reg = <0xc0000 0x140000>;
}; };
};
Hopefully this will be some help to anyone else stuggling here.
Best regards
Andrew
Hi Andrew
one can try to debug it in drivers/mtd/cmdlinepart.c
cmdlinepart.c\mtd\drivers - linux-imx - i.MX Linux kernel
Seems command line parameters can override default.
Best regards
igor
You need to enable command line mtd partitioning in kernel config. Also I guess Linux is looking for the name of the chip it assigns inside the kernel parameters. So try replacing m25p80 with spi3.0.
mtdparts=mtdparts=spi3.0:0x0000020000@0x0000000000(init),0x0000020000@0x0000020000(uboot_data),0x0000080000@0x0000040000(uboot),0x0000140000@0x00000c0000(boot_logo)