1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2025 Collabora Ltd.
4  */
5 
6 #ifndef _FB_SPI_FLASH_H_
7 #define _FB_SPI_FLASH_H_
8 
9 #include <part.h>
10 
11 /**
12  * fastboot_spi_flash_get_part_info() - Lookup SPI flash partition by name
13  *
14  * @part_name: Named device to lookup
15  * @part_info: Pointer to returned struct disk_partition
16  * @response: Pointer to fastboot response buffer
17  * Return: 0 if OK, -ENOENT if no partition name was given, -ENODEV on invalid
18  * raw partition descriptor
19  */
20 int fastboot_spi_flash_get_part_info(const char *part_name,
21 				     struct disk_partition *part_info,
22 				     char *response);
23 
24 /**
25  * fastboot_spi_flash_write() - Write image to SPI flash for fastboot
26  *
27  * @cmd: Named device to write image to
28  * @download_buffer: Pointer to image data
29  * @download_bytes: Size of image data
30  * @response: Pointer to fastboot response buffer
31  */
32 void fastboot_spi_flash_write(const char *cmd, void *download_buffer,
33 			      u32 download_bytes, char *response);
34 
35 /**
36  * fastboot_spi_flash_erase() - Erase SPI flash for fastboot
37  *
38  * @cmd: Named device to erase
39  * @response: Pointer to fastboot response buffer
40  */
41 void fastboot_spi_flash_erase(const char *cmd, char *response);
42 #endif
43