Access SPI connected device from u-boot for Tx2i

Dear Nvidia team,

Is it possible to access spi connected device from u-boot for Tx2i?
Our customized board has a nvram connected to spi for Tx2i. There is no problem to operate this spi connected nvram from kernel space. However, I am unable to access the same nvram from u-boot using either “sf probe” or “sspi”, and the following is the reported error:

Invalid bus 0 (err=-19)
Failed to initialize SPI flash at 0:0 (error -19)

Any suggestion or pointers how to access the nvram from u-boot would be appreciated.


Have a check if below can help.


Is there any spi driver currently available at u-boot space for TX2i without the need to port?
If not, I have couple more questions:

  1. For porting a spi driver to driver model per spi-howto.txt , which driver should be based on? u-boot source has tegra114_spi and tegra210_qspi. Are these the right driver to base on? If not, what driver should be used for porting?

  2. Is there a need to update the device tree to enable the access? If yes, can you provide information how to modify it like which file, and how does the entry looks like?

  3. Is there a need to configure the pins? If yes, can you provide information how to configure it?



The tegra114_spi driver in U-Boot should be applicable to TX1, TX2, Nano, etc., . It’s not currently in the build for p2771 (aka TX2), so you need to add it to the defconfig for TX2 (p2771-0000-500_defconfig) as CONFIG_TEGRA114_SPI=y and rebuild U-Boot.

For the pin configure you may need to modify the cfg file.


There is a compilation error after adding CONFIG_TEGRA114_SPI, and the error is below:

drivers/spi/tegra114_spi.c:12:10: fatal error: asm/arch/clock.h: No such file or directory
| #include <asm/arch/clock.h>
| ^~~~~~~~~~~~~~~~~~

Can you advise how to resolve the error? Thanks.


Walter, please update when you get a chance, I know thru our email conversations that you’ve made significant progress getting the tegra114_spi.c driver to work on TX2, and it might help others to see your changes here.



Enabling spi device access involves:

  1. Patching tegra186.dtsi and tegra186-p2771-0000.dtsi by adding the device entry.
  2. There is a need to patch tegra114_spi driver in U-Boot to use tegra186 clock which is using driver model besides adding CONFIG_TEGRA114_SPI.
  3. The compilation problem can be resolved by copying clock.h and clock-tables.h from 210 to 186 with update accordingly.