From 6f12ebf6ea7bcae1b6d9ff090b5c1e7452be90e9 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 11 Jun 2014 16:03:36 -0600 Subject: dfu: add SF backend This allows SPI Flash to be programmed using DFU. Signed-off-by: Stephen Warren --- include/dfu.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include') diff --git a/include/dfu.h b/include/dfu.h index 43814b3..7e0a999 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -14,6 +14,7 @@ #include #include #include +#include #include 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_ */ -- cgit v1.1