Lines Matching refs:dfu

14 static int dfu_get_medium_size_sf(struct dfu_entity *dfu, u64 *size)  in dfu_get_medium_size_sf()  argument
16 *size = dfu->data.sf.size; in dfu_get_medium_size_sf()
21 static int dfu_read_medium_sf(struct dfu_entity *dfu, u64 offset, void *buf, in dfu_read_medium_sf() argument
24 return spi_flash_read(dfu->data.sf.dev, dfu->data.sf.start + offset, in dfu_read_medium_sf()
28 static u64 find_sector(struct dfu_entity *dfu, u64 start, u64 offset) in find_sector() argument
30 return (lldiv((start + offset), dfu->data.sf.dev->sector_size)) * in find_sector()
31 dfu->data.sf.dev->sector_size; in find_sector()
34 static int dfu_write_medium_sf(struct dfu_entity *dfu, in dfu_write_medium_sf() argument
39 ret = spi_flash_erase(dfu->data.sf.dev, in dfu_write_medium_sf()
40 find_sector(dfu, dfu->data.sf.start, offset), in dfu_write_medium_sf()
41 dfu->data.sf.dev->sector_size); in dfu_write_medium_sf()
45 ret = spi_flash_write(dfu->data.sf.dev, dfu->data.sf.start + offset, in dfu_write_medium_sf()
53 static int dfu_flush_medium_sf(struct dfu_entity *dfu) in dfu_flush_medium_sf() argument
58 static unsigned int dfu_polltimeout_sf(struct dfu_entity *dfu) in dfu_polltimeout_sf() argument
63 static void dfu_free_entity_sf(struct dfu_entity *dfu) in dfu_free_entity_sf() argument
65 spi_flash_free(dfu->data.sf.dev); in dfu_free_entity_sf()
117 int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s) in dfu_fill_entity_sf() argument
122 dfu->data.sf.dev = parse_dev(devstr_bkup); in dfu_fill_entity_sf()
124 if (!dfu->data.sf.dev) in dfu_fill_entity_sf()
127 dfu->dev_type = DFU_DEV_SF; in dfu_fill_entity_sf()
128 dfu->max_buf_size = dfu->data.sf.dev->sector_size; in dfu_fill_entity_sf()
132 dfu->layout = DFU_RAW_ADDR; in dfu_fill_entity_sf()
133 dfu->data.sf.start = simple_strtoul(s, &s, 16); in dfu_fill_entity_sf()
135 dfu->data.sf.size = simple_strtoul(s, &s, 16); in dfu_fill_entity_sf()
138 spi_flash_free(dfu->data.sf.dev); in dfu_fill_entity_sf()
142 dfu->get_medium_size = dfu_get_medium_size_sf; in dfu_fill_entity_sf()
143 dfu->read_medium = dfu_read_medium_sf; in dfu_fill_entity_sf()
144 dfu->write_medium = dfu_write_medium_sf; in dfu_fill_entity_sf()
145 dfu->flush_medium = dfu_flush_medium_sf; in dfu_fill_entity_sf()
146 dfu->poll_timeout = dfu_polltimeout_sf; in dfu_fill_entity_sf()
147 dfu->free_entity = dfu_free_entity_sf; in dfu_fill_entity_sf()
150 dfu->inited = 0; in dfu_fill_entity_sf()