Author Topic: TE0820: QSPI write access under Linux  (Read 655 times)

uli

  • Active Member
  • *
  • Posts: 2
TE0820: QSPI write access under Linux
« on: January 05, 2023, 10:02:04 AM »
Hi,

I'm trying to access the QSPI flash on my TE0820 under Linux. It's marked RW193, so it should be a Micron MT25QU512ABB8E12-0SIT.
However, the Linux kernel (Xilinix 5.10) does not recognize it:
...
[    2.608219] spi-nor spi0.0: unrecognized JEDEC id bytes: 10 5d 90 08 22 00
[    2.608244] spi-nor: probe of spi0.0 failed with error -2
...
According to https://wiki.trenz-electronic.de/display/PD/PCN-20190110a+TE0820-03-*+SPI+Flash+and+eMMC+Change
there was a BOM change:
#1 Change SPI Flash from N25Q512A11G1240E to MT25QU512ABB8E12-0SIT

Type: BOM change

Reason: N25Q512A11G1240E became obsolete.

Impact:  None. Both have same JEDEC ID BB20h and manufacturer ID 20h.

So, I'm puzzled why I'm getting a totally different JEDEC ID. Is that a known problem?
When copying the chip definition for BB20h in the kernel to the ID above the kernel can probe the QSPI chip:
...
[    2.605194] spi-nor spi0.0: trying to lock already unlocked area
[    2.605200] spi-nor spi0.0: mt25qu512b (131072 Kbytes)
...
And /dev/mtd0 is available:
root@zynqmp-zu2cg-1i:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 08000000 00020000 "spi0.0"

But erasing it with ubiformat fails with:
root@zynqmp-zu2cg-1i:~# ubiformat /dev/mtd0
ubiformat: mtd0 (nor), size 134217728 bytes (128.0 MiB), 1024 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 1 bytes
libscan: scanning eraseblock 0 --  0 % complete  libmtd: error!: cannot read 64 bytes from mtd0 (eraseblock 0, offset 0)
        error 110 (Connection timed out)
ubiformat: error!: failed to scan mtd0 (/dev/mtd0)

I can't understand why the JEDEC ID is so completely different, nor why the erase fails. Anybody got a clue?

Thanks in advance,
Uli

uli

  • Active Member
  • *
  • Posts: 2
Re: TE0820: QSPI write access under Linux
« Reply #1 on: January 05, 2023, 12:42:04 PM »
Hi,

well, I found it out in the meantime, my device tree was missing some vital statements, it seems. It works with these settings:

&qspi {
   status = "okay";
   is-dual = <0>;
   num-cs = <1>;
   flash@0 {
      compatible = "jedec,spi-nor";
      reg = <0x0>;
      spi-tx-bus-width = <1>;
      spi-rx-bus-width = <4>;
      spi-max-frequency = <10000000>;
      #address-cells = <1>;
      #size-cells = <1>;
      partition@qspi-fsbl-uboot {
         label = "qspi-fsbl-uboot";
         reg = <0x0 0x100000>;
      };
   };
};

I was missing the bus-width and frequency settings, as well as is-dual and num-cs.

Sorry for the noise,
Uli