UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor hbaumann
Visitor
616 Views
Registered: ‎01-31-2018

Can't access QSPI from linux

Hi everyone !

We have a Zynq-7000 on a customboard and have trouble to access the QSPI from linux.

The QSPI we are using is the ISSI IS25LP128F (http://www.issi.com/WW/pdf/25LP-WP128F.pdf).

FSBL and u-boot are launching fine from QSPI. Output from u-boot:

Loading Environment from SPI Flash... SF: Detected is25lp128 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
OK

 

dmesg shows the following:

root@devicex:/sysroot/home/root# dmesg | grep spi
[    0.142211] of_get_named_gpiod_flags: can't parse 'cs-gpios' property of node '/amba/spi@e0007000[0]'
[    0.142396] cdns-spi e0007000.spi: registered master spi1
[    0.142542] spi spi1.0: setup mode 0, 8 bits/w, 15000000 Hz max --> 0
[    0.142710] cdns-spi e0007000.spi: registered child spi1.0
[    0.143047] zynq-qspi e000d000.spi: couldn't determine configuration info
[    0.143055] zynq-qspi e000d000.spi: about dual memories. defaulting to single memory
[    0.143304] zynq-qspi e000d000.spi: registered master spi0
[    0.143445] spi spi0.0: setup mode 0, 8 bits/w, 50000000 Hz max --> 0
[    0.143608] zynq-qspi e000d000.spi: registered child spi0.0

Which looks not so bad i would say, but under linux we don't see any partitions:

root@devicex:/dev# cat /proc/mtd
dev:    size   erasesize  name

 

Our DTS-entry looks like this:

qspi: spi@e000d000 {
        clock-names = "ref_clk", "pclk";
        clocks = <&clkc 10>, <&clkc 43>;
        compatible = "xlnx,zynq-qspi-1.0";
        status = "okay";
        interrupt-parent = <&intc>;
        interrupts = <0 19 4>;
        reg = <0xe000d000 0x1000>;
        #address-cells = <1>;
        #size-cells = <0>;
        u-boot,dm-pre-reloc;
        flash@0{
              compatible = "is25lp128";
              reg = <0x0>;
              spi-tx-bus-width = <1>;
              spi-rx-bus-width = <4>;
              spi-max-frequency = <50000000>;
              #address-cells = <1>;
              #size-cells = <1>;
              partition@qspi-raw {
                        label = "qspi-raw";
                        reg = <0x0 0x1000000>;
              };

	};
    };

We have the following configs enabled:

CONFIG_SPI_ZYNQ_QSPI=y
CONFIG_SPI_MEM=y
CONFIG_SPI_DEBUG=y
CONFIG_MTD=y
CONFIG_MTD_M25P80=y

We are running mainline linux 4.14.106 and had to patch the "spi-zynq-qspi"-driver into it because it was missing. We took it from here https://github.com/Xilinx/linux-xlnx/blob/master/drivers/spi/spi-zynq-qspi.c .

Edit: And also we needed to patch the /drivers/mtd/spi-nor.c to update some definitions:

 

 	/* ISSI */
-	{ "is25cd512", INFO(0x7f9d20, 0, 32 * 1024,   2, SECT_4K) },
-	{ "is25wp032", INFO(0x9d7016, 0, 64 * 1024,  64,
+	{ "is25lp080d", INFO(0x9d6014, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp080d", INFO(0x9d7014, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25lp016d", INFO(0x9d6015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp016d", INFO(0x9d7015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25lp032d", INFO(0x9d6016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp032d", INFO(0x9d7016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25lp064a", INFO(0x9d6017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp064a", INFO(0x9d7017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25lp128f", INFO(0x9d6018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp128f", INFO(0x9d7018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25lp256d", INFO(0x9d6019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp256d", INFO(0x9d7019, 0, 64 * 1024, 512,
+			SECT_4K | SPI_NOR_DUAL_READ |
+			SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK |
+			SPI_NOR_4B_OPCODES) },
+	{ "is25lp512m", INFO(0x9d601a, 0, 64 * 1024, 1024,
+			SECT_4K | SPI_NOR_DUAL_READ |
+			SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK) },
+	{ "is25wp512m", INFO(0x9d701a, 0, 64 * 1024, 1024,
+			SECT_4K | SPI_NOR_DUAL_READ |
+			SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK |
+			SPI_NOR_4B_OPCODES) },
+	{ "is25cd512",  INFO(0x7f9d20, 0, 32 * 1024,   2, SECT_4K) },
+	{ "is25lq040b", INFO(0x9d4013, 0, 64 * 1024,   8,
 			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-	{ "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128,
+	{ "is25lp080d", INFO(0x9d6014, 0, 64 * 1024,  16,
 			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-	{ "is25wp128", INFO(0x9d7018, 0, 64 * 1024, 256,
+	{ "is25lp128",  INFO(0x9d6018, 0, 64 * 1024, 256,
+			SECT_4K | SPI_NOR_DUAL_READ) },
+	{ "is25lp256",  INFO(0x9d6019, 0, 64 * 1024, 512,
+			SECT_4K | SPI_NOR_DUAL_READ) },
+	{ "is25wp032",  INFO(0x9d7016, 0, 64 * 1024,  64,
+			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+	{ "is25wp064",  INFO(0x9d7017, 0, 64 * 1024, 128,
+			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+	{ "is25wp128",  INFO(0x9d7018, 0, 64 * 1024, 256,
 			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },

 

 

 

Can someone give us a hint what we are missing, why dont we see any partitions in  "/proc/mtd" ?

If any additional information is needed please let us know.

Thanks

 

0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
605 Views
Registered: ‎01-21-2008

Re: Can't access QSPI from linux

Hi @hbaumann,

 

Please try our Wiki page and you will figureout what is the issue with your DT node is. https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842262/Zynq+QSPI+Driver

 

0 Kudos
Visitor hbaumann
Visitor
596 Views
Registered: ‎01-31-2018

Re: Can't access QSPI from linux

Hi @jadhavs !

Thanks for your reply.

I followed the link and took a look on the example of the DT node.

I saw that the following entrys were different/missing:

is-dual = <0>;
num-cs = <1>;
xlnx,fb-clk = <0x1>;
xlnx,qspi-mode = <0x0>;

So I added them to our DT, which now looks like this:

qspi: spi@e000d000 {
        clock-names = "ref_clk", "pclk";
        clocks = <&clkc 10>, <&clkc 43>;
        compatible = "xlnx,zynq-qspi-1.0";
        status = "okay";
        interrupt-parent = <&intc>;
        interrupts = <0 19 4>;
        is-dual = <0>;
        num-cs = <1>;
        reg = <0xe000d000 0x1000>;
        xlnx,fb-clk = <0x1>;
        xlnx,qspi-mode = <0x0>;
        #address-cells = <1>;
        #size-cells = <0>;
        u-boot,dm-pre-reloc;
        flash@0{
              compatible = "is25lp128";
              reg = <0x0>;
              spi-tx-bus-width = <1>;
              spi-rx-bus-width = <4>;
              spi-max-frequency = <50000000>;
              #address-cells = <1>;
              #size-cells = <1>;
              partition@qspi-raw {
                        label = "qspi-raw";
                        reg = <0x0 0x1000000>;
              };

          };
    };

But sadly nothing changed. 

cat /proc/mtd 
dev:    size   erasesize  name

Can you help me identify the problem of the DT node in more detail, because i dont really see it.

Thanks

0 Kudos