Spansion S25HS512T NOR 闪存无法在 linux 或 u-boot 上工作

Spansion S25HS512T NOR Flash not working on linux or u-boot

我有一块带有 Spansion Flash 25HS512TFANHI010 的定制板 (NXP iMX6UL),但我似乎无法正常工作。

我的dtsi有以下

...
pinctrl_qspi: qspigrp {
                fsl,pins = <
                        MX6UL_PAD_NAND_WP_B__QSPI_A_SCLK        0x70a1
                        MX6UL_PAD_NAND_READY_B__QSPI_A_DATA00   0x70a1
                        MX6UL_PAD_NAND_CE0_B__QSPI_A_DATA01     0x70a1
                        MX6UL_PAD_NAND_CE1_B__QSPI_A_DATA02     0x70a1
                        MX6UL_PAD_NAND_CLE__QSPI_A_DATA03       0x70a1
                        MX6UL_PAD_NAND_DQS__QSPI_A_SS0_B        0x70a1
                >;
        };
...
&qspi {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_qspi>;
        status = "okay";
        //cs-gpios = <&gpio4 16 0>;

        flash0: s25hs512t@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "spansion,s25hs512t", "jedec,spi-nor";
                spi-max-frequency = <40000000>;
                spi-rx-bus-width = <4>;
                spi-tx-bus-width = <4>;
                reg = <0>;
                spi-mode = <0>;
                spi-cpha;
                spi-cpol;
                m25p,fast-read;
                //wp-gpios = <&gpio4 14 0>;
                //hold-gpios = <&gpio4 15 0>;
                status = "okay";
         };
};

对于 u-boot,我的 defconfig 具有以下内容

CONFIG_DM=y
CONFIG_SPI=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_DM_SPI=y
CONFIG_DM_SPI_FLASH=y
CONFIG_FSL_QSPI=y
CONFIG_SF_DEFAULT_MODE=0

对于 linux 我的 defconfig 基本上(还有很多其他东西)

CONFIG_SPI_FSL_QUADSPI=y

所以 u-boot 和 Linux 似乎都不能正常工作

u-boot错误

U-Boot 2021.10-rc2-00044-g4865db0716-dirty (Aug 24 2021 - 23:15:49 +0530)
...
=> sf probe
fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef61e10, cs=0
fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef61e10, cs=0
jedec_spi_nor s25hs512t@0: set_state_simple op missing
fsl_qspi spi@21e0000: CMD[9f] lutval[0:1c00049f          1:0     2:0     3:0]
Failed to initialize SPI flash at 0:0 (error -524)

DM 树

=> dm tree 
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 thermal       0  [   ]   imx_thermal           |-- imx_thermal
 simple_bus    0  [ + ]   simple_bus            |-- soc
 simple_bus    1  [ + ]   simple_bus            |   |-- aips-bus@2000000
 simple_bus    2  [   ]   simple_bus            |   |   |-- spba-bus@2000000
 gpio          0  [   ]   gpio_mxc              |   |   |-- gpio@209c000
 gpio          1  [   ]   gpio_mxc              |   |   |-- gpio@20a0000
 gpio          2  [   ]   gpio_mxc              |   |   |-- gpio@20a4000
 gpio          3  [   ]   gpio_mxc              |   |   |-- gpio@20a8000
 gpio          4  [   ]   gpio_mxc              |   |   |-- gpio@20ac000
 simple_bus    3  [   ]   simple_bus            |   |   |-- anatop@20c8000
 simple_bus    4  [   ]   simple_bus            |   |   |-- snvs@20cc000
 pinctrl       0  [ + ]   fsl_imx6q_iomuxc      |   |   `-- iomuxc@20e0000
 pinconfig     0  [   ]   pinconfig             |   |       |-- i2c1grp
 pinconfig     1  [   ]   pinconfig             |   |       |-- i2c2grp
 pinconfig     2  [ + ]   pinconfig             |   |       |-- qspigrp
 pinconfig     3  [   ]   pinconfig             |   |       |-- tscgrp
 pinconfig     4  [   ]   pinconfig             |   |       |-- uart1grp
 pinconfig     5  [ + ]   pinconfig             |   |       |-- usdhc2grp
 pinconfig     6  [   ]   pinconfig             |   |       `-- wdoggrp
 simple_bus    5  [ + ]   simple_bus            |   `-- aips-bus@2100000
 mmc           0  [ + ]   fsl_esdhc             |       |-- usdhc@2194000
 blk           0  [   ]   mmc_blk               |       |   `-- usdhc@2194000.blk
 i2c           0  [   ]   i2c_mxc               |       |-- i2c@21a0000
 i2c           1  [   ]   i2c_mxc               |       |-- i2c@21a4000
 spi           0  [ + ]   fsl_qspi              |       `-- spi@21e0000
 spi_flash     0  [   ]   jedec_spi_nor         |           `-- s25hs512t@0
 regulator     0  [   ]   regulator_fixed       `-- regulator-sd2-vmmc

Linux错误

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.14.0-rc7-413454-gd5ae8d7f85b7 (harkirat@harkirat-devsys) (arm-linux-gnueabihf-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #3 SMP Tue Aug 24 22:47:19 IST 2021
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
...
[    2.639396] spi spi0.0: setup: unsupported mode bits 3
[    2.645215] fsl-quadspi 21e0000.spi: can't setup spi0.0, status -22
[    2.651590] spi_master spi0: spi_device register error /soc/bus@2100000/spi@21e0000/s25hs512t@0
[    2.660817] spi_master spi0: Failed to create SPI device for /soc/bus@2100000/spi@21e0000/s25hs512t@0
...

我已经尝试了几乎所有可能的迭代,但我似乎可以解决问题。我有一种感觉,它与 dtsi 有关。任何帮助将不胜感激,我无能为力。

PS:尝试了赛普拉斯论坛,但他们的反应非常迟钝。他们有一个 2018.01 的 u-boot 补丁,因此与 2021.10

不兼容

已在 u-boot 2021.10-rc3 中添加对 S25HL/S25HS 系列的支持。

确保:

CONFIG_SPI_FLASH_SFDP_SUPPORT is set and
CONFIG_SPI_FLASH_BAR is not set

感谢英飞凌桑野先生的支持

PS: 未在 Linux 上测试。尚未在 Barebox 上工作(被检测但未写入)。