[PATCH v2] drivers: fastboot: Add support for SPI flash memory
Ariel D'Alessandro
ariel.dalessandro at collabora.com
Thu Jul 17 15:56:27 CEST 2025
Hi Mattijs,
On 7/17/25 3:30 AM, Mattijs Korpershoek wrote:
> Hi Ariel,
>
> Thank you for the patch.
>
> On Tue, Jul 15, 2025 at 16:11, Ariel D'Alessandro <ariel.dalessandro at collabora.com> wrote:
>
>> Fastboot currently supports MMC and NAND flash devices. Similarly,
>> extend the support to SPI flash memories.
>>
>> Note that in this initial implementation, partitions on the device are
>> not supported yet, but raw partitions can be set in u-boot environment.
>
> nitpick: u-boot -> U-Boot
Ack.
>
>>
>> To define a raw partition descriptor, add an environment variable
>> similar to the MMC case:
>>
>> ```
>> fastboot_raw_partition_<raw partition name>=<offset> <size>
>> ```
>>
>> for example:
>>
>> ```
>> fastboot_raw_partition_boot=0x0 0x1000000
>> ```
>>
>> Signed-off-by: Ariel D'Alessandro <ariel.dalessandro at collabora.com>
>> ---
>> drivers/fastboot/Kconfig | 6 +-
>> drivers/fastboot/Makefile | 1 +
>> drivers/fastboot/fb_command.c | 8 +
>> drivers/fastboot/fb_getvar.c | 6 +
>> drivers/fastboot/fb_spi_flash.c | 249 ++++++++++++++++++++++++++++++++
>> include/fb_spi_flash.h | 40 +++++
>
> Can we also include a doc change to doc/android/fastboot.rst ?
> The current doc mentions:
> "Support for both eMMC and NAND devices is included."
>
> We should add SPI flash to that sentence.
Sure.
>
> Maybe also mention in the "Raw partition descriptors" that this is
> supported for SPI flash as well.
Will do.
>
>> 6 files changed, 309 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/fastboot/fb_spi_flash.c
>> create mode 100644 include/fb_spi_flash.h
>>
>
> [...]
>
>> +
>> +/**
>> + * fastboot_spi_flash_get_part_info() - Lookup SPI flash partition by name
>> + *
>> + * @part_name: Named device to lookup
>> + * @part_info: Pointer to returned struct disk_partition
>> + * @response: Pointer to fastboot response buffer
>
> Can we add a Return: line to document the return code?
Sure, will add it to both source and header files.
>
>> + */
>> +int fastboot_spi_flash_get_part_info(const char *part_name,
>> + struct disk_partition *part_info,
>> + char *response);
>> +
>> +/**
>> + * fastboot_spi_flash_write() - Write image to SPI flash for fastboot
>> + *
>> + * @cmd: Named device to write image to
>> + * @download_buffer: Pointer to image data
>> + * @download_bytes: Size of image data
>> + * @response: Pointer to fastboot response buffer
>> + */
>> +void fastboot_spi_flash_write(const char *cmd, void *download_buffer,
>> + u32 download_bytes, char *response);
>> +
>> +/**
>> + * fastboot_spi_flash_erase() - Erase SPI flash for fastboot
>> + *
>> + * @cmd: Named device to erase
>> + * @response: Pointer to fastboot response buffer
>> + */
>> +void fastboot_spi_flash_erase(const char *cmd, char *response);
>> +#endif
Thanks a lot for the feedback!
--
Ariel D'Alessandro
Software Engineer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
More information about the U-Boot
mailing list