S25HS512 not functional with u-boot 2021.10.rc3

I have a custom board using imx6ul and Spansion S25HS512T Flash. On the current version of u-boot (2021.10.rc3) and I am guessing even previous ones the Spansion flash is not functioning
=> sf probe drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'spi@21e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2bf60, cs=0 drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'spi@21e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2bf60, cs=0 drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'iomuxc@20e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() jedec_spi_nor s25hs512t@0: set_state_simple op missing drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[9f] lutval[0:1c00049f 1:0 2:0 3:0] drivers/spi/spi-uclass.c:438- spi_get_bus_and_cs() spi_get_bus_and_cs: Error path, created=0, device 's25hs512t@0' Failed to initialize SPI flash at 0:0 (error -524)
Result is the same with different modes and frequencies, bus and CS are correct
My DTSI is
&qspi { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_qspi>; status = "okay";
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>; m25p,fast-read; status = "okay"; /* some partition information*/ }; };
Defconfig has
CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_QSPI=y CONFIG_MTD=y CONFIG_DM_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_SPI_FLASH_SPANSION=y
DM Tree
=> 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 serial 0 [ + ] serial_mxc | | | `-- serial@2020000 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 | | |-- ledsgrp pinconfig 4 [ + ] pinconfig | | |-- uart1grp pinconfig 5 [ + ] pinconfig | | |-- usdhc2grp pinconfig 6 [ ] pinconfig | | `-- wdoggrp simple_bus 5 [ + ] simple_bus | `-- aips-bus@2100000 usb 0 [ ] ehci_mx6 | |-- usb@2184000 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 led 0 [ ] gpio_led `-- leds led 1 [ ] gpio_led |-- green led 2 [ ] gpio_led |-- red led 3 [ ] gpio_led `— amber
I am unable to identify source of error returning -524 or why SPI Flash initialisation fails

Hi Harkirat,
On Tue, 14 Sept 2021 at 19:50, Harkirat Virk harkiratsvirk@gmail.com wrote:
I have a custom board using imx6ul and Spansion S25HS512T Flash. On the current version of u-boot (2021.10.rc3) and I am guessing even previous ones the Spansion flash is not functioning
=> sf probe drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'spi@21e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2bf60, cs=0 drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'spi@21e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2bf60, cs=0 drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'iomuxc@20e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() jedec_spi_nor s25hs512t@0: set_state_simple op missing drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[9f] lutval[0:1c00049f 1:0 2:0 3:0] drivers/spi/spi-uclass.c:438- spi_get_bus_and_cs() spi_get_bus_and_cs: Error path, created=0, device 's25hs512t@0' Failed to initialize SPI flash at 0:0 (error -524)
Result is the same with different modes and frequencies, bus and CS are correct
My DTSI is
&qspi { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_qspi>; status = "okay";
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>; m25p,fast-read; status = "okay"; /* some partition information*/ };
};
Defconfig has
CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_QSPI=y CONFIG_MTD=y CONFIG_DM_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_SPI_FLASH_SPANSION=y
DM Tree
=> 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 serial 0 [ + ] serial_mxc | | | `-- serial@2020000 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 | | |-- ledsgrp pinconfig 4 [ + ] pinconfig | | |-- uart1grp pinconfig 5 [ + ] pinconfig | | |-- usdhc2grp pinconfig 6 [ ] pinconfig | | `-- wdoggrp simple_bus 5 [ + ] simple_bus | `-- aips-bus@2100000 usb 0 [ ] ehci_mx6 | |-- usb@2184000 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 led 0 [ ] gpio_led `-- leds led 1 [ ] gpio_led |-- green led 2 [ ] gpio_led |-- red led 3 [ ] gpio_led `— amber
I am unable to identify source of error returning -524 or why SPI Flash initialisation fails
I'm not sure. Is that the full DT node or are you relying on a .dtis file? Can you look in spi_get_bus_and_cs() and see where it fails?
There is a pattern we use to find the call stack of an error without a debugger:
ret = do_something(...); if (ret) return log_msg_ret("what", ret);
then enable CONFIG_LOG_ERROR_RETURN
-ENOTSUP is used by pinctrl so perhaps pinctrl_qspi is failing?
Regards, SImon

Hi Harkirat,
-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Harkirat Virk Sent: Wednesday, September 15, 2021 12:21 AM To: u-boot@lists.denx.de Subject: [EXT] S25HS512 not functional with u-boot 2021.10.rc3
Caution: EXT Email
I have a custom board using imx6ul and Spansion S25HS512T Flash. On the current version of u-boot (2021.10.rc3) and I am guessing even previous ones the Spansion flash is not functioning
=> sf probe drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'spi@21e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2bf60, cs=0 drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'spi@21e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/spi/spi-uclass.c:282-spi_find_chip_select() fsl_qspi spi@21e0000: spi_find_chip_select: plat=9ef2bf60, cs=0 drivers/core/uclass.c:325-uclass_find_device_by_seq() 0 drivers/core/uclass.c:333-uclass_find_device_by_seq() - 0 'iomuxc@20e0000' drivers/core/uclass.c:336-uclass_find_device_by_seq() - found drivers/pinctrl/pinctrl-uclass.c:300-pinctrl_select_state_simple() jedec_spi_nor s25hs512t@0: set_state_simple op missing drivers/spi/fsl_qspi.c:464-fsl_qspi_prepare_lut() fsl_qspi spi@21e0000: CMD[9f] lutval[0:1c00049f 1:0 2:0 3:0]
Did you try enabling debug logs in spi-nor framework(spi-nor-core.c) and see what jedec id's were return after issuing the command? And does it match with the one's present in spi-nor-ids.c?
drivers/spi/spi-uclass.c:438- spi_get_bus_and_cs() spi_get_bus_and_cs: Error path, created=0, device 's25hs512t@0' Failed to initialize SPI flash at 0:0 (error -524)
Result is the same with different modes and frequencies, bus and CS are correct
My DTSI is
&qspi { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_qspi>; status = "okay";
flash0: s25hs512t@0 { #address-cells = <1>; #size-cells = <1>; compatible = "spansion,s25hs512t", "jedec,spi-nor";
Please use compatible as "jedec,spi-nor" as it is sufficient to detect the flash automatically.
spi-max-frequency = <40000000>; spi-rx-bus-width = <4>; spi-tx-bus-width = <4>;
Since flash cannot be probed, I would recommend using <rx,tx> bus-width as <1,1>. Using <4,4> bus-width will require SPI_FLASH_SFDP to be enabled in defconfig.
Regards Kuldeep
reg = <0>; spi-mode = <0>; m25p,fast-read; status = "okay"; /* some partition information*/ };
};
Defconfig has
CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_FSL_QSPI=y CONFIG_MTD=y CONFIG_DM_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=40000000 CONFIG_SPI_FLASH_SPANSION=y
DM Tree
=> 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 serial 0 [ + ] serial_mxc | | | `-- serial@2020000 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 | | |-- ledsgrp pinconfig 4 [ + ] pinconfig | | |-- uart1grp pinconfig 5 [ + ] pinconfig | | |-- usdhc2grp pinconfig 6 [ ] pinconfig | | `-- wdoggrp simple_bus 5 [ + ] simple_bus | `-- aips-bus@2100000 usb 0 [ ] ehci_mx6 | |-- usb@2184000 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 led 0 [ ] gpio_led `-- leds led 1 [ ] gpio_led |-- green led 2 [ ] gpio_led |-- red led 3 [ ] gpio_led `— amber
I am unable to identify source of error returning -524 or why SPI Flash initialisation fails
participants (3)
-
Harkirat Virk
-
Kuldeep Singh
-
Simon Glass