[U-Boot] Using sspi for hardware detection?

Romain Naour romain.naour at smile.fr
Wed Nov 27 10:58:47 UTC 2019


Hello,

I'm working on a modular socfpga based system with several optional boards.
Each optional board contain a board ID that can be read through a SPI bus.

Since we want just read the board ID, we used manually the sspi command,
something like:

=> sspi 1:1.0 8 0
42

But it seems that the sspi command can't be used in a uboot script. sspi seems
only used to manually test spi drivers.


If we compare with i2c command, we have a i2c read to memory:

i2c read chip address[.0, .1, .2] length memaddress - read to memory

Why there is no such feature for spi ?
Is there an interest to evolve the sspi command to add a read to memory?

sspi <bus id>: <chip select>.<mode> <bit length> <data> <memaddress>


By looking at existing code, it seems that hardware detection in uboot is
handled by architecture/board specific code to set custom environment variable
like "fpgatype" [1] or "unit_ident" "unit_serial" [2] (misc_init_r).

What do you recommend?
Implement a custom misc_init_r() for hardware detection?

[1]
https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arm/mach-socfpga/misc_gen5.c#L139
[2]
https://gitlab.denx.de/u-boot/u-boot/blob/master/board/softing/vining_fpga/socfpga.c#L48

Best regards,
Romain


More information about the U-Boot mailing list