On 6/24/20 4:37 AM, Yakov Shmulevich wrote:
> 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@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";

You are missing the "clocks" property.

> 
>                                                 spi-flash@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@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.

I don't know about this part. Try enabling debug logging.

> 
> 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
> 

--Sean

Reply via email to