Re: [PATCH v5 1/3] efi_loader: Add SPI I/O protocol support

Simon Glass
2022-12-14T04:39:47Z

Hi Paul,

On Wed, 23 Nov 2022 at 10:50, Paul Barker <paul.barker@sancloud.com> wrote:
>
> This addition allows UEFI applications running under u-boot to access
> peripherals on SPI busses. It is based on the UEFI Platform
> Initialization (PI) Specification, Version 1.7 Errata A (April 2020).
> Only the core functionality required to discover SPI peripherals and
> communicate with them is currently implemented. Other functionality such
> as the legacy SPI controller interface and the ability to update the SPI
> peripheral object associated with a particular SPI I/O protocol object
> is currently unimplemented.
>
> The following protocols are defined:
> * EFI_SPI_CONFIGURATION_PROTOCOL
> * EFI_SPI_IO_PROTOCOL
> * EFI_LEGACY_SPI_CONTROLLER_PROTOCOL
>
> Since there are no open source implementations of these protocols to use
> as an example, educated guesses/hacks have been made in cases where the
> UEFI PI specification is unclear and these are documented in comments.
>
> This implementation has been tested on the SanCloud BBE Lite and allowed
> a UEFI test application to successfully communicate with a Micron
> Authenta flash device connected via the SPI bus.
>
> Signed-off-by: Paul Barker <paul.barker@sancloud.com>
> ---
> MAINTAINERS | 6 +
> configs/am335x_evm_defconfig | 1 +
> include/efi_api.h | 4 +
> include/efi_loader.h | 4 +
> include/efi_spi_protocol.h | 166 +++++++++
> lib/efi_loader/Kconfig | 8 +
> lib/efi_loader/Makefile | 1 +
> lib/efi_loader/efi_setup.c | 6 +
> lib/efi_loader/efi_spi_protocol.c | 576 ++++++++++++++++++++++++++++++
> lib/uuid.c | 4 +
> 10 files changed, 776 insertions(+)
> create mode 100644 include/efi_spi_protocol.h
> create mode 100644 lib/efi_loader/efi_spi_protocol.c

This should have a sandbox test as well. See test/dm/spi.c or sf.c for examples.

Regards,
Simon