cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
13,960 Views
Registered: ‎02-06-2015

Linux kernel cannot access QSPI MTD

Hello!

 

I am trying to run PetaLinux kernel on a custom board with two Spansion S25FL128S flash chips (parallel QSPI).  I have tried specifying this chip in my device tree, compatible micron chip, etc.  Nothing seems to work.  linux does not see any MTD partitions.

 

root@zynq_board:~# cat /proc/mtd

dev: size erasesize name
root@zynq_board:~#

 

My configuration is as follows:

 

&qspi {
#address-cells = <1>;
#size-cells = <0>;
flash0: flash@0 {
compatible = "n25q128a11";
reg = <0x0>;
#address-cells = <1>;
#size-cells = <1>;
spi-max-frequency = <50000000>;
partition@0x00000000 {
label = "boot";
reg = <0x00000000 0x00500000>;
};
partition@0x00500000 {
label = "bootenv";
reg = <0x00500000 0x00020000>;
};
partition@0x00520000 {
label = "kernel";
reg = <0x00520000 0x00a80000>;
};
partition@0x00fa0000 {
label = "spare";
reg = <0x00fa0000 0x00000000>;
};
};
};

 

I've tried specifying different chips in the "compatible" option, but nothing works.

 

Am I missing something in the configuration?  I do enable QSPI driver in petalinux-config, but when booting linux does not mention anything related to MTD or QSPI.

 

Thank you in advance.

 

 

Tags (3)
0 Kudos
12 Replies
Highlighted
Xilinx Employee
Xilinx Employee
13,945 Views
Registered: ‎07-01-2010

@gtsasha

 

Compatible string in qspi nodes seems  incorrect.

 

Example:

&qspi {
status = "okay";
flash@0 {
compatible = "n25q512a11";

 

It should be, compatible = "n25q512a"; instead of compatible = "n25q512a11";.

 

QSPI flash partition is not visible with the incorrect compatible string after booting Linux.

 

Can you modify the compatible string and see if that helps?

 

-Achutha

---------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------
0 Kudos
Highlighted
Visitor
Visitor
13,935 Views
Registered: ‎02-06-2015

It did not help unfortunately, /proc/mtd is still empty.  

0 Kudos
Highlighted
Adventurer
Adventurer
13,908 Views
Registered: ‎10-21-2013

Try this devicetree fragment (From ZC706 dtb):

&qspi {
	status = "okay";
	is-dual = <1>;
	num-cs = <1>;
	flash@0 {
		compatible = "n25q128a11";
		reg = <0x0>;
		spi-tx-bus-width = <1>;
		spi-rx-bus-width = <4>;
		spi-max-frequency = <50000000>;
		#address-cells = <1>;
		#size-cells = <1>;

		partition@qspi-user {
				      label = "qspi-user";
				      reg = <0x01D40000 2883584>;
		};
}
0 Kudos
Highlighted
Adventurer
Adventurer
10,473 Views
Registered: ‎04-10-2016

I have the same problem.

0 Kudos
Highlighted
Explorer
Explorer
10,453 Views
Registered: ‎11-22-2015

 

Did you look at the boot log?  This will tell you what the kernel is trying to do.

 

jeff

0 Kudos
Highlighted
Adventurer
Adventurer
10,442 Views
Registered: ‎04-10-2016

First of all, thank you very much for your attention.But I've already seen the boot log,there is no MTD related content.And I found that the /proc/mtd file is empty, while the /dev/flash folder is empty.

0 Kudos
Highlighted
Explorer
Explorer
10,424 Views
Registered: ‎11-22-2015

 

If you don't see it in the boot log you obviously won't see it in /proc.  This is mine:

 

m25p80 spi0.0: Controller not in SPI_TX_QUAD mode, just use extended SPI mode
m25p80 spi0.0: n25q256a (32768 Kbytes)
5 ofpart partitions found on MTD device spi0.0
Creating 5 MTD partitions on "spi0.0":
0x000000000000-0x000001000000 : "qspi-fsbl-uboot"
0x000001000000-0x000001500000 : "qspi-linux"
0x000001500000-0x000001520000 : "qspi-device-tree"
0x000001520000-0x000001540000 : "qspi-raw-data"
0x000001540000-0x000001f40000 : "qspi-rootfs"
CAN device driver interface
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k

 

did you define your partitions in the device tree?

 

jeff

 

0 Kudos
Highlighted
Adventurer
Adventurer
10,415 Views
Registered: ‎04-10-2016

I have defined the partition.(petalinux-config->Subsystem AUTO Hardware Settings->Flash Settings)

 

flash partition.png
0 Kudos
Highlighted
Explorer
Explorer
10,398 Views
Registered: ‎11-22-2015

 

I don't use petalinux but that looks like you are doing something but that doesn't tell me that they are in your devicetree.  Also, I don't even see a message about finding the device in your boot log.   I haven't tried this but I don't see why you would have to have partitions defined to find the device.  So I would check to make sure your kernel config has everything enabled.

 

jeff

0 Kudos
Highlighted
Adventurer
Adventurer
7,639 Views
Registered: ‎04-10-2016

Can I describe it in Chinese, my English is too poor to describe it.

0 Kudos
Highlighted
Observer
Observer
4,785 Views
Registered: ‎03-17-2008

I have run into this same problem, and for the record I'd like to share how I fixed it.


I downloaded the kernel sources from the Xilinx Linux kernel github site. I configured it with "make xilinx_zynq_defconfig" and the kernel compiled from this configuration did not populate any MTD entries for the QSPI.


The problem is this line in the .config file:


# CONFIG_MTD_M25P80 is not set


I changed it to this


CONFIG_MTD_M25P80=y


and the MTD entries show up. Note that you still have to set up the device tree as described in previous posts as well.


Essentially, there was no MTD driver in the kernel that matched the memory. I now get this when the kernel boots (on a PicoZed board and carrier):


m25p80 spi0.0: found s25fl128s, expected n25q128a11
m25p80 spi0.0: s25fl128s (16384 Kbytes)


0 Kudos
Highlighted
Visitor
Visitor
4,497 Views
Registered: ‎07-10-2017

To build on aricblumer's solution... 

 

When using the petalinux-config command to configure the kernel component, CONFIG_MTD_M25P80 is found in the kernel config GUI under Device Drivers --> Memory Technology Device (MTD) Support --> self-contained MTD device drivers --> support most SPI flash chips (...). Mine was enabled by default, but this may not be the case for any given project. Configuring this setting here would be a bit more streamline for a typical petalinux project.

 

Cheers!

0 Kudos