|
|
|
@ -25,7 +25,7 @@ static int stdio_flash_write(struct flash_dev *dev, uint32_t addr, |
|
|
|
|
const void *data, size_t len); |
|
|
|
|
static int stdio_flash_copy(struct flash_dev *dev, uint32_t dst, uint32_t src, |
|
|
|
|
size_t len); |
|
|
|
|
static int stdio_flash_erase(struct flash_dev *dev, uint32_t addr, size_t block_size); |
|
|
|
|
static int stdio_flash_erase(struct flash_dev *dev, uint32_t addr); |
|
|
|
|
|
|
|
|
|
static struct flash_ops stdio_flash_ops = { |
|
|
|
|
.get_size = stdio_flash_get_size, |
|
|
|
@ -99,17 +99,12 @@ static int stdio_flash_copy(struct flash_dev *dev, uint32_t dst, uint32_t src, |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int stdio_flash_erase(struct flash_dev *dev, uint32_t addr, |
|
|
|
|
size_t block_size) |
|
|
|
|
static int stdio_flash_erase(struct flash_dev *dev, uint32_t addr) |
|
|
|
|
{ |
|
|
|
|
struct stdio_flash_priv *priv = dev->priv; |
|
|
|
|
size_t log2_block_size = ilog2(block_size); |
|
|
|
|
|
|
|
|
|
if (block_size != (UINT32_C(1) << log2_block_size)) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
memset(priv->data + (addr << log2_block_size), 0xff, |
|
|
|
|
(1 << log2_block_size)); |
|
|
|
|
memset(priv->data + (addr << dev->log2_block_size), 0xff, |
|
|
|
|
1 << dev->log2_block_size); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -140,6 +135,8 @@ struct flash_dev *flash_probe(void) |
|
|
|
|
|
|
|
|
|
dev->priv = priv; |
|
|
|
|
dev->ops = &stdio_flash_ops; |
|
|
|
|
dev->log2_page_size = ilog2(1); |
|
|
|
|
dev->log2_block_size = ilog2(4 * KIB); |
|
|
|
|
|
|
|
|
|
return dev; |
|
|
|
|
|
|
|
|
|