1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

dfu: add SF backend

This allows SPI Flash to be programmed using DFU.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
Stephen Warren
2014-06-11 16:03:36 -06:00
committed by Tom Rini
parent cb7bd2e07e
commit 6f12ebf6ea
4 changed files with 165 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
#include <common.h>
#include <linux/list.h>
#include <mmc.h>
#include <spi_flash.h>
#include <linux/usb/composite.h>
enum dfu_device_type {
@@ -21,6 +22,7 @@ enum dfu_device_type {
DFU_DEV_ONENAND,
DFU_DEV_NAND,
DFU_DEV_RAM,
DFU_DEV_SF,
};
enum dfu_layout {
@@ -70,6 +72,14 @@ struct ram_internal_data {
unsigned int size;
};
struct sf_internal_data {
struct spi_flash *dev;
/* RAW programming */
u64 start;
u64 size;
};
#define DFU_NAME_SIZE 32
#define DFU_CMD_BUF_SIZE 128
#ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
@@ -97,6 +107,7 @@ struct dfu_entity {
struct mmc_internal_data mmc;
struct nand_internal_data nand;
struct ram_internal_data ram;
struct sf_internal_data sf;
} data;
long (*get_medium_size)(struct dfu_entity *dfu);
@@ -182,5 +193,16 @@ static inline int dfu_fill_entity_ram(struct dfu_entity *dfu, char *devstr,
}
#endif
#ifdef CONFIG_DFU_SF
extern int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s);
#else
static inline int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr,
char *s)
{
puts("SF support not available!\n");
return -1;
}
#endif
int dfu_add(struct usb_configuration *c);
#endif /* __DFU_ENTITY_H_ */