always in tree dts spi flasch on mdt0, v4.14.11, how to change to last

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

PowerPenguin
Posts: 5
Joined: Mon Feb 19, 2018 12:41 pm

always in tree dts spi flasch on mdt0, v4.14.11, how to change to last

Thu Feb 22, 2018 7:49 pm

Hi community,

on Kernel v3.16.45 in tree module adds spi flash always as last mtd behind NAND mtd partitions.

With Kernel 4.14.11 it changed to mtd0. This is bad for high level update scripts !
The order of SPI atmel driver is now before nand :-(

Anyone an idea how to change by device tree to last partition.

We do not made test with 4.4 or 4.9 so far may some one can give feddback how in tree driver m25p80.ko add the stuff here ?

One solution is to add it as module.. boot with NAND and then load m25p80 later !

Maybe some one knows a better in in tree kernel solution fix by device tree for 4.14.11 ? ! :roll:

Best regrards,
PP
blue_z
Location: USA
Posts: 1641
Joined: Thu Apr 19, 2007 10:15 pm

Re: always in tree dts spi flasch on mdt0, v4.14.11, how to change to last

Fri Feb 23, 2018 2:15 am

PowerPenguin wrote:on Kernel v3.16.45 in tree module ...
...how in tree driver m25p80.ko...
... in tree kernel solution fix ...
What is this "in tree" that you keep on using?

PowerPenguin wrote:We do not made test with 4.4 or 4.9 so far may some one can give feddback how in tree driver m25p80.ko add the stuff here ?
Linux kernel version 4.9.52, i.e. Linux4SAM 5.7, orders the NAND partitions before the Dataflash.


Regards
PowerPenguin
Posts: 5
Joined: Mon Feb 19, 2018 12:41 pm

Re: always in tree dts spi flasch on mdt0, v4.14.11, how to change to last

Fri Feb 23, 2018 1:34 pm

blue_z wrote:
Fri Feb 23, 2018 2:15 am
PowerPenguin wrote:on Kernel v3.16.45 in tree module ...
...how in tree driver m25p80.ko...
... in tree kernel solution fix ...
What is this "in tree" that you keep on using?

PowerPenguin wrote:We do not made test with 4.4 or 4.9 so far may some one can give feddback how in tree driver m25p80.ko add the stuff here ?
Linux kernel version 4.9.52, i.e. Linux4SAM 5.7, orders the NAND partitions before the Dataflash.


Regards
menuconfig
[m] m25p80.ko you have to load the module; than ist behind last nand mtx; mtdx+1
[*] its in (kernel source) tree; no load module required; or part of kernel; then its at mtd0 4.14

Code: Select all

	/* always mtd0 at v4.14 */
			spi0: spi@fffc8000 {
				status = "okay";
				cs-gpios = <&pioA 3 GPIO_ACTIVE_HIGH>;

				m25p40-nonjedec@0 {
					compatible = "st,m25p40-nonjedec";
					reg = <0>;
					spi-max-frequency = <10000000>;
				};
			};
			
			nand@3 {
				reg = <0x3 0x0 0x800000>;
				rb-gpios = <&pioC 13 GPIO_ACTIVE_HIGH>;
				cs-gpios = <&pioC 14 GPIO_ACTIVE_HIGH>;
				nand-bus-width = <8>;
				nand-ecc-mode = "soft";
				label = "atmel_nand";


			partitions {
				compatible = "fixed-partitions";
				#address-cells = <1>;
				#size-cells = <1>;
				/* 128KB */
				partition@0 {
					label = "primary loader";
					reg = <0x0 0x20000>;
				};
				/* 896KB */
				partition@1 {
					reg = <0x20000 0xE0000>;
					label = "secondary loader";
				};
				/* 512KB */
				partition@2 {
					reg = <0x100000 0x80000>;
					label = "environment 1";
				};
				/* 512KB */
				partition@3 {
					reg = <0x180000 0x80000>;
					label = "environment 2";
				};
				/* 4MB */
				partition@4 {
					reg = <0x200000 0x400000>;
					label = "kernel a";
				};
				/* 50MB */
				partition@5 {
				reg = <0x600000 0x3200000>;
				label = "rootfs a";
				};
				/* 4MB */
				partition@6 {
					reg = <0x3800000 0x400000>;
					label = "kernel b";
				};
				/* 50MB */
				partition@7 {
					reg = <0x3c00000 0x3200000>;
					label = "rootfs b";
				};
				/* 20MB */
				partition@8 {
					reg = <0x6e00000 0x1400000>;
					label = "netlog";
				};
				/* 120MB */
				partition@9 {
					reg = <0x8200000 0x7800000>;
					label = "audiolib";
				};
				/* 6MB */
				partition@10 {
					reg = <0xfa00000 0x600000>;
					label = "mtdoops";
            	};
			};
		};

Code: Select all

root@fs20-vcc:~# cat /proc/partitions
major minor  #blocks  name

   1        0       8192 ram0
   1        1       8192 ram1
   1        2       8192 ram2
   1        3       8192 ram3
  31        0        512 mtdblock0      <= 4 mbit SPI Flash
  31        1        128 mtdblock1	<= primary loader; nand start
  31        2        896 mtdblock2
  31        3        512 mtdblock3
  31        4        512 mtdblock4
  31        5       4096 mtdblock5
  31        6      51200 mtdblock6
  31        7       4096 mtdblock7
  31        8      51200 mtdblock8
  31        9      20480 mtdblock9
  31       10     122880 mtdblock10
  31       11       6144 mtdblock11  <= mtdoops
root@fs20-vcc:~# 

fixed partition only works inside the mtd device, you could not attach spi flash behind nand by adding a fixed partition to spi flash dts that starts with offset 0x10000000

maybe its the same problem you have with USB sticks, they are always /dev/sda at power up. Without UUID in fstab your x86 wont boot your sata disk :-(

On 4.14 kernel spi driver starts before NAND

Code: Select all

m25p80 spi0.0: m25p40-nonjedec (512 Kbytes)
atmel_spi fffc8000.spi: Atmel SPI Controller version 0x199 at 0xfffc8000 (irq 29)
...
(later)
...
11 ofpart partitions found on MTD device atmel_nand
Creating 11 MTD partitions on "atmel_nand":
0x000000000000-0x000000020000 : "primary loader"
0x000000020000-0x000000100000 : "secondary loader"
0x000000100000-0x000000180000 : "environment 1"
0x000000180000-0x000000200000 : "environment 2"
0x000000200000-0x000000600000 : "kernel a"
0x000000600000-0x000003800000 : "rootfs a"
0x000003800000-0x000003c00000 : "kernel b"
0x000003c00000-0x000006e00000 : "rootfs b"
0x000006e00000-0x000008200000 : "netlog"
0x000008200000-0x00000fa00000 : "audiolib"
0x00000fa00000-0x000010000000 : "mtdoops"

ok different board but same G20 module. With 3.16 spi sriver starts behind nand :-(

Code: Select all

Scanning device for bad blocks
8 ofpart partitions found on MTD device atmel_nand
Creating 8 MTD partitions on "atmel_nand":
0x000000000000-0x000000020000 : "primary loader"
0x000000020000-0x000000060000 : "secondary loader"
0x000000060000-0x000000200000 : "environment"
0x000000200000-0x000000600000 : "kernel a"
0x000000600000-0x000004000000 : "rootfs a"
0x000004000000-0x00000c000000 : "data"
0x00000c000000-0x00000c400000 : "kernel b"
0x00000c400000-0x000010000000 : "rootfs b"
atmel_spi fffc8000.spi: version: 0x199
atmel_spi fffc8000.spi: Atmel SPI Controller at 0xfffc8000 (irq 35)
m25p80 spi32766.0: m25p10-nonjedec (128 Kbytes)
libphy: MACB_mii_bus: probed

and when the driver starts it will check dts. So (in-tree) kernel driver starting order was changed on the way to 4.14
looks like [m] m25p80.ko is the only way to keep the old partition layout

any hints are welcome how to change mtd order for different devices (not size inside device) by dts if possible ?

best regrads
PP
blue_z
Location: USA
Posts: 1641
Joined: Thu Apr 19, 2007 10:15 pm

Re: always in tree dts spi flasch on mdt0, v4.14.11, how to change to last

Wed Feb 28, 2018 11:49 pm

You seem to write English better than can read/comprehend it.
Except for your mystery "in tree" phrase, I can understand what you wrote.
I responded with a simple question and a reply to your request.
Your response, which seems to be a rehash/elaboration of your original content, indicates no comprehension of my post.

Apparently "in tree" is your made-up term for a built-in module (aka statically-linked module), while you also persist in referring to loadable modules with the menuconfig notation of "[m]" for specifying a loadable module.

The Device Tree does not affect the order of driver probes.

Regards

Return to “LINUX”

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 2 guests