U-boot Designware SPI driver issue

Yakov Shmulevich yakovs at ceragon.com
Wed Jun 24 10:37:58 CEST 2020


Hello,

We develop the system that based on MIPS that includes Synopsys SPI with NACRONIX SPI flash connected to it.
For U-boot we are using version 2019.04-rc4.
I want to save environment on SPI flash. For this I enabled the DesignWare SPI driver and MACRONIX SPI flash driver in U-boot .config and add corresponding definitions in our dts file.
Following the .config relevant lines:

CONFIG_CMD_SAVEENV=y

CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_MACRONIX=y

CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_SPI_MEM=y
CONFIG_DESIGNWARE_SPI=y

Following the dts file relevant lines:

                ahb {
                                compatible = "simple-bus";

                                spi0: spi-master at 1FCD0000 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                compatible = "snps,dw-apb-ssi";
                                reg = <0x1FCD0000 0x40>;
                                num-chipselect = <4>;
                                bus-num = <0>;
                                reg-io-width = <4>;
                                reg-shift = <2>;
                                spi-max-frequency = <18000000>; /* input clock */

                                status = "okay";

                                                spi-flash at 0 {
                                                                compatible = "spi-flash";
                                                                spi-max-frequency = <18000000>; /* input clock */
                                                                reg = <0>; /* CS0 */
                                                };
                                };
                };

In the U-boot startup I get the following error:
Loading Environment from SPI Flash...
Invalid bus 0 (err=-19)
*** Warning - spi_flash_probe_bus_cs() failed, using default environment
Also the "sf probe" command gives the similar error:



# sf probe 0:0

                Invalid bus 0 (err=-19)

                Failed to initialize SPI flash at 0:0 (error -19) The error -19 is ENODEV error.



After the problem evaluation I found that both "load environment" and "sf probe" failed in uclass_find_device_by_seq() function (drivers/core/uclass.c).

This function failed to find device for uclass_id= UCLASS_SPI on bus 0  (spi0). In main there are no devices on this bus.



In both cases the flow is started from spi_flash_probe_bus_cs() function (drivers/mtd/spi/sf-uclass.c) for device "spi_flash at 0:0".

In the start of this flow uclass_get() function (drivers/core/uclass.c)) is executed to find UCLASS_SPI driver.

This function returns uclass with driver "spi" and not "dw_spi" as I expected.
Also I found that the DesignWare SPI driver probe (designware_spi.c) doesn't even executed.

Can somebody point me on my problem?
Or maybe there is some example of working Synopsis SPI with flash definitions in U-boot.

Thanks,
Yakov

This email message and any attachments are intended solely for the use of the addressees hereof. 
This message and any attachments may contain information that is confidential, privileged and exempt from disclosure under applicable law.
If you are not the intended recipient of this message, you are prohibited from reading, disclosing, reproducing, distributing, disseminating or otherwise using this transmission.
If you have received this message in error, please promptly notify the sender at Ceragon by reply E-mail and immediately delete this message from your system.


More information about the U-Boot mailing list