All of lore.kernel.org
 help / color / mirror / Atom feed
* U-boot Designware SPI driver issue
@ 2020-06-24  8:37 Yakov Shmulevich
  2020-07-06 15:59 ` Johannes Krottmayer
  2020-07-08  4:59 ` Sean Anderson
  0 siblings, 2 replies; 4+ messages in thread
From: Yakov Shmulevich @ 2020-06-24  8:37 UTC (permalink / raw)
  To: u-boot

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* U-boot Designware SPI driver issue
  2020-06-24  8:37 U-boot Designware SPI driver issue Yakov Shmulevich
@ 2020-07-06 15:59 ` Johannes Krottmayer
  2020-07-07  4:54   ` Yakov Shmulevich
  2020-07-08  4:59 ` Sean Anderson
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Krottmayer @ 2020-07-06 15:59 UTC (permalink / raw)
  To: u-boot

Hi Yakov,

have you fixed the issue?

I'm not a real developer from the U-Boot project, but I had a similar
issue on a PINE64 Rock64 board. The error code -19 was a missing alias
in the Device-Tree files on my used board.

Fixed this issue with the correct alias. Maybe it's the same issue
on your board. After that I got the error code -2, but fixed it too
(missing SPI support in the clock driver from the SoC).

Kind regards,

Johannes K.

On 24.06.20 at 10:37,  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 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.
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* U-boot Designware SPI driver issue
  2020-07-06 15:59 ` Johannes Krottmayer
@ 2020-07-07  4:54   ` Yakov Shmulevich
  0 siblings, 0 replies; 4+ messages in thread
From: Yakov Shmulevich @ 2020-07-07  4:54 UTC (permalink / raw)
  To: u-boot

Hi Johannes,

My problem was in U-boot relocation mechanism.
In our current environment we have not relocation  (U-boot is already in DDR).
So, after relocation the DT was absent and SPI and flash driver are not loaded.

Thanks,
Yakov


-----Original Message-----
From: Johannes Krottmayer <krjdev@gmail.com> 
Sent: Monday, 6 July 2020 18:59
To: Yakov Shmulevich <yakovs@ceragon.com>; u-boot at lists.denx.de
Cc: Lioz Nadler <liozn@ceragon.com>
Subject: [!EXT!] Re: U-boot Designware SPI driver issue

Hi Yakov,

have you fixed the issue?

I'm not a real developer from the U-Boot project, but I had a similar issue on a PINE64 Rock64 board. The error code -19 was a missing alias in the Device-Tree files on my used board.

Fixed this issue with the correct alias. Maybe it's the same issue on your board. After that I got the error code -2, but fixed it too (missing SPI support in the clock driver from the SoC).

Kind regards,

Johannes K.

On 24.06.20 at 10:37,  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 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.
> 
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* U-boot Designware SPI driver issue
  2020-06-24  8:37 U-boot Designware SPI driver issue Yakov Shmulevich
  2020-07-06 15:59 ` Johannes Krottmayer
@ 2020-07-08  4:59 ` Sean Anderson
  1 sibling, 0 replies; 4+ messages in thread
From: Sean Anderson @ 2020-07-08  4:59 UTC (permalink / raw)
  To: u-boot

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

You are missing the "clocks" property.

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-08  4:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  8:37 U-boot Designware SPI driver issue Yakov Shmulevich
2020-07-06 15:59 ` Johannes Krottmayer
2020-07-07  4:54   ` Yakov Shmulevich
2020-07-08  4:59 ` Sean Anderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.