From 53b3d1af7889436d9c874391b826ec81d0b5d98a Mon Sep 17 00:00:00 2001 From: Vincent Dupont Date: Mon, 14 May 2018 15:04:48 +0200 Subject: [PATCH] mtd_spi_nor: add 4-byte address flash support --- drivers/include/mtd_spi_nor.h | 7 +++++++ drivers/mtd_spi_nor/mtd_spi_nor_configs.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/include/mtd_spi_nor.h b/drivers/include/mtd_spi_nor.h index c6347ec00c..6363fabf9c 100644 --- a/drivers/include/mtd_spi_nor.h +++ b/drivers/include/mtd_spi_nor.h @@ -140,6 +140,13 @@ extern const mtd_desc_t mtd_spi_nor_driver; * sensible for default values. */ extern const mtd_spi_nor_opcode_t mtd_spi_nor_opcode_default; +/** + * @brief Default 4-byte addresses opcodes + * + * Commands for 4-byte addresses chips (above 128Mb) + */ +extern const mtd_spi_nor_opcode_t mtd_spi_nor_opcode_default_4bytes; + #ifdef __cplusplus } #endif diff --git a/drivers/mtd_spi_nor/mtd_spi_nor_configs.c b/drivers/mtd_spi_nor/mtd_spi_nor_configs.c index 9d31ff9510..46eb9e9a1e 100644 --- a/drivers/mtd_spi_nor/mtd_spi_nor_configs.c +++ b/drivers/mtd_spi_nor/mtd_spi_nor_configs.c @@ -42,4 +42,20 @@ const mtd_spi_nor_opcode_t mtd_spi_nor_opcode_default = { .wake = 0xab, }; +const mtd_spi_nor_opcode_t mtd_spi_nor_opcode_default_4bytes = { + .rdid = 0x9f, + .wren = 0x06, + .rdsr = 0x05, + .wrsr = 0x01, + .read = 0x13, + .read_fast = 0x0c, + .page_program = 0x12, + .sector_erase = 0x21, + .block_erase_32k = 0x5c, + .block_erase = 0xdc, + .chip_erase = 0xc7, + .sleep = 0xb9, + .wake = 0xab, +}; + /** @} */