drivers/flash: removed write protection API implementations

flash_write_protection_set() API was deprecated so driver
implementation interface is left behind as well.

This patch removes all implementation pointed by the interface
'struct flash_driver_api.write_protection'.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2021-03-12 18:04:22 +01:00 committed by Anas Nashif
commit 7d53e0118b
17 changed files with 0 additions and 165 deletions

View file

@ -560,11 +560,6 @@ out:
return rc; return rc;
} }
static int flash_esp32_write_protection(const struct device *dev, bool enable)
{
return 0;
}
#if CONFIG_FLASH_PAGE_LAYOUT #if CONFIG_FLASH_PAGE_LAYOUT
static const struct flash_pages_layout flash_esp32_pages_layout = { static const struct flash_pages_layout flash_esp32_pages_layout = {
.pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) / FLASH_ERASE_BLK_SZ, .pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) / FLASH_ERASE_BLK_SZ,
@ -601,7 +596,6 @@ static const struct flash_driver_api flash_esp32_driver_api = {
.read = flash_esp32_read, .read = flash_esp32_read,
.write = flash_esp32_write, .write = flash_esp32_write,
.erase = flash_esp32_erase, .erase = flash_esp32_erase,
.write_protection = flash_esp32_write_protection,
.get_parameters = flash_esp32_get_parameters, .get_parameters = flash_esp32_get_parameters,
#ifdef CONFIG_FLASH_PAGE_LAYOUT #ifdef CONFIG_FLASH_PAGE_LAYOUT
.page_layout = flash_esp32_page_layout, .page_layout = flash_esp32_page_layout,

View file

@ -122,15 +122,6 @@ static int flash_gecko_erase(const struct device *dev, off_t offset,
return ret; return ret;
} }
static int flash_gecko_write_protection_nop(const struct device *dev,
bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
static void flash_gecko_write_protection(bool enable) static void flash_gecko_write_protection(bool enable)
{ {
if (enable) { if (enable) {
@ -224,7 +215,6 @@ static const struct flash_driver_api flash_gecko_driver_api = {
.read = flash_gecko_read, .read = flash_gecko_read,
.write = flash_gecko_write, .write = flash_gecko_write,
.erase = flash_gecko_erase, .erase = flash_gecko_erase,
.write_protection = flash_gecko_write_protection_nop,
.get_parameters = flash_gecko_get_parameters, .get_parameters = flash_gecko_get_parameters,
#ifdef CONFIG_FLASH_PAGE_LAYOUT #ifdef CONFIG_FLASH_PAGE_LAYOUT
.page_layout = flash_gecko_page_layout, .page_layout = flash_gecko_page_layout,

View file

@ -366,12 +366,6 @@ static int flash_flexspi_nor_erase(const struct device *dev, off_t offset,
return 0; return 0;
} }
static int flash_flexspi_nor_write_protection(const struct device *dev,
bool enable)
{
return 0;
}
static const struct flash_parameters *flash_flexspi_nor_get_parameters( static const struct flash_parameters *flash_flexspi_nor_get_parameters(
const struct device *dev) const struct device *dev)
{ {
@ -433,7 +427,6 @@ static int flash_flexspi_nor_init(const struct device *dev)
} }
static const struct flash_driver_api flash_flexspi_nor_api = { static const struct flash_driver_api flash_flexspi_nor_api = {
.write_protection = flash_flexspi_nor_write_protection,
.erase = flash_flexspi_nor_erase, .erase = flash_flexspi_nor_erase,
.write = flash_flexspi_nor_write, .write = flash_flexspi_nor_write,
.read = flash_flexspi_nor_read, .read = flash_flexspi_nor_read,

View file

@ -310,14 +310,6 @@ static int flash_sam_erase(const struct device *dev, off_t offset, size_t len)
return rc; return rc;
} }
static int flash_sam_write_protection_nop(const struct device *dev, bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
/* Enable or disable the write protection */ /* Enable or disable the write protection */
static int flash_sam_write_protection(const struct device *dev, bool enable) static int flash_sam_write_protection(const struct device *dev, bool enable)
{ {
@ -375,7 +367,6 @@ static int flash_sam_init(const struct device *dev)
} }
static const struct flash_driver_api flash_sam_api = { static const struct flash_driver_api flash_sam_api = {
.write_protection = flash_sam_write_protection_nop,
.erase = flash_sam_erase, .erase = flash_sam_erase,
.write = flash_sam_write, .write = flash_sam_write,
.read = flash_sam_read, .read = flash_sam_read,

View file

@ -379,15 +379,6 @@ static int flash_sam0_erase(const struct device *dev, off_t offset,
return err; return err;
} }
static int flash_sam0_write_protection_nop(const struct device *dev,
bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
static int flash_sam0_write_protection(const struct device *dev, bool enable) static int flash_sam0_write_protection(const struct device *dev, bool enable)
{ {
off_t offset; off_t offset;
@ -464,7 +455,6 @@ static int flash_sam0_init(const struct device *dev)
} }
static const struct flash_driver_api flash_sam0_api = { static const struct flash_driver_api flash_sam0_api = {
.write_protection = flash_sam0_write_protection_nop,
.erase = flash_sam0_erase, .erase = flash_sam0_erase,
.write = flash_sam0_write, .write = flash_sam0_write,
.read = flash_sam0_read, .read = flash_sam0_read,

View file

@ -156,14 +156,6 @@ static int flash_range_is_valid(const struct device *dev, off_t offset,
return 1; return 1;
} }
static int flash_wp_set(const struct device *dev, bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
static int flash_sim_read(const struct device *dev, const off_t offset, static int flash_sim_read(const struct device *dev, const off_t offset,
void *data, void *data,
const size_t len) const size_t len)
@ -346,7 +338,6 @@ static const struct flash_driver_api flash_sim_api = {
.read = flash_sim_read, .read = flash_sim_read,
.write = flash_sim_write, .write = flash_sim_write,
.erase = flash_sim_erase, .erase = flash_sim_erase,
.write_protection = flash_wp_set,
.get_parameters = flash_sim_get_parameters, .get_parameters = flash_sim_get_parameters,
#ifdef CONFIG_FLASH_PAGE_LAYOUT #ifdef CONFIG_FLASH_PAGE_LAYOUT
.page_layout = flash_sim_page_layout, .page_layout = flash_sim_page_layout,

View file

@ -287,15 +287,6 @@ static int flash_stm32_write(const struct device *dev, off_t offset,
return rc; return rc;
} }
static int flash_stm32_write_protection_nop(const struct device *dev,
bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
static int flash_stm32_write_protection(const struct device *dev, bool enable) static int flash_stm32_write_protection(const struct device *dev, bool enable)
{ {
FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); FLASH_TypeDef *regs = FLASH_STM32_REGS(dev);
@ -369,7 +360,6 @@ static struct flash_stm32_priv flash_data = {
}; };
static const struct flash_driver_api flash_stm32_api = { static const struct flash_driver_api flash_stm32_api = {
.write_protection = flash_stm32_write_protection_nop,
.erase = flash_stm32_erase, .erase = flash_stm32_erase,
.write = flash_stm32_write, .write = flash_stm32_write,
.read = flash_stm32_read, .read = flash_stm32_read,

View file

@ -422,15 +422,6 @@ static int flash_stm32_qspi_erase(const struct device *dev, off_t addr,
return ret; return ret;
} }
static int flash_stm32_qspi_write_protection_set(const struct device *dev,
bool write_protect)
{
ARG_UNUSED(dev);
ARG_UNUSED(write_protect);
return 0;
}
static const struct flash_parameters flash_stm32_qspi_parameters = { static const struct flash_parameters flash_stm32_qspi_parameters = {
.write_block_size = 1, .write_block_size = 1,
.erase_value = 0xff .erase_value = 0xff
@ -562,7 +553,6 @@ static const struct flash_driver_api flash_stm32_qspi_driver_api = {
.read = flash_stm32_qspi_read, .read = flash_stm32_qspi_read,
.write = flash_stm32_qspi_write, .write = flash_stm32_qspi_write,
.erase = flash_stm32_qspi_erase, .erase = flash_stm32_qspi_erase,
.write_protection = flash_stm32_qspi_write_protection_set,
.get_parameters = flash_stm32_qspi_get_parameters, .get_parameters = flash_stm32_qspi_get_parameters,
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
.page_layout = flash_stm32_qspi_pages_layout, .page_layout = flash_stm32_qspi_pages_layout,

View file

@ -377,15 +377,6 @@ int flash_stm32_write_range(const struct device *dev, unsigned int offset,
return rc; return rc;
} }
static int flash_stm32h7_write_protection_nop(const struct device *dev,
bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
static int flash_stm32h7_write_protection(const struct device *dev, bool enable) static int flash_stm32h7_write_protection(const struct device *dev, bool enable)
{ {
FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); FLASH_TypeDef *regs = FLASH_STM32_REGS(dev);
@ -619,7 +610,6 @@ static struct flash_stm32_priv flash_data = {
}; };
static const struct flash_driver_api flash_stm32h7_api = { static const struct flash_driver_api flash_stm32h7_api = {
.write_protection = flash_stm32h7_write_protection_nop,
.erase = flash_stm32h7_erase, .erase = flash_stm32h7_erase,
.write = flash_stm32h7_write, .write = flash_stm32h7_write,
.read = flash_stm32h7_read, .read = flash_stm32h7_read,

View file

@ -106,8 +106,6 @@ struct qspi_nor_data {
#endif /* CONFIG_MULTITHREADING */ #endif /* CONFIG_MULTITHREADING */
}; };
static int qspi_nor_write_protection_nop(const struct device *dev,
bool write_protect);
static int qspi_nor_write_protection_set(const struct device *dev, static int qspi_nor_write_protection_set(const struct device *dev,
bool write_protect); bool write_protect);
@ -953,15 +951,6 @@ static int qspi_nor_erase(const struct device *dev, off_t addr, size_t size)
return ret; return ret;
} }
static int qspi_nor_write_protection_nop(const struct device *dev,
bool write_protect)
{
ARG_UNUSED(dev);
ARG_UNUSED(write_protect);
return 0;
}
static int qspi_nor_write_protection_set(const struct device *dev, static int qspi_nor_write_protection_set(const struct device *dev,
bool write_protect) bool write_protect)
{ {
@ -1061,7 +1050,6 @@ static const struct flash_driver_api qspi_nor_api = {
.read = qspi_nor_read, .read = qspi_nor_read,
.write = qspi_nor_write, .write = qspi_nor_write,
.erase = qspi_nor_erase, .erase = qspi_nor_erase,
.write_protection = qspi_nor_write_protection_nop,
.get_parameters = qspi_flash_get_parameters, .get_parameters = qspi_flash_get_parameters,
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
.page_layout = qspi_nor_pages_layout, .page_layout = qspi_nor_pages_layout,

View file

@ -117,14 +117,6 @@ static int flash_lpc_write(const struct device *dev, off_t offset,
return (rc == kStatus_FLASHIAP_Success) ? 0 : -EINVAL; return (rc == kStatus_FLASHIAP_Success) ? 0 : -EINVAL;
} }
static int flash_lpc_write_protection(const struct device *dev, bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
static const struct flash_pages_layout dev_layout = { static const struct flash_pages_layout dev_layout = {
.pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) / .pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) /
@ -152,7 +144,6 @@ flash_lpc_get_parameters(const struct device *dev)
static struct flash_priv flash_data; static struct flash_priv flash_data;
static const struct flash_driver_api flash_lpc_api = { static const struct flash_driver_api flash_lpc_api = {
.write_protection = flash_lpc_write_protection,
.erase = flash_lpc_erase, .erase = flash_lpc_erase,
.write = flash_lpc_write, .write = flash_lpc_write,
.read = flash_lpc_read, .read = flash_lpc_read,

View file

@ -224,14 +224,6 @@ static int flash_mcux_write(const struct device *dev, off_t offset,
return (rc == kStatus_Success) ? 0 : -EINVAL; return (rc == kStatus_Success) ? 0 : -EINVAL;
} }
static int flash_mcux_write_protection(const struct device *dev, bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
static const struct flash_pages_layout dev_layout = { static const struct flash_pages_layout dev_layout = {
.pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) / .pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) /
@ -259,7 +251,6 @@ flash_mcux_get_parameters(const struct device *dev)
static struct flash_priv flash_data; static struct flash_priv flash_data;
static const struct flash_driver_api flash_mcux_api = { static const struct flash_driver_api flash_mcux_api = {
.write_protection = flash_mcux_write_protection,
.erase = flash_mcux_erase, .erase = flash_mcux_erase,
.write = flash_mcux_write, .write = flash_mcux_write,
.read = flash_mcux_read, .read = flash_mcux_read,

View file

@ -418,15 +418,6 @@ static int flash_nios2_qspi_read(const struct device *dev, off_t offset,
return rc; return rc;
} }
static int flash_nios2_qspi_write_protection_nop(const struct device *dev,
bool write_protect)
{
ARG_UNUSED(dev);
ARG_UNUSED(write_protect);
return 0;
}
static int flash_nios2_qspi_write_protection(const struct device *dev, static int flash_nios2_qspi_write_protection(const struct device *dev,
bool enable) bool enable)
{ {
@ -498,7 +489,6 @@ flash_nios2_qspi_get_parameters(const struct device *dev)
} }
static const struct flash_driver_api flash_nios2_qspi_api = { static const struct flash_driver_api flash_nios2_qspi_api = {
.write_protection = flash_nios2_qspi_write_protection_nop,
.erase = flash_nios2_qspi_erase, .erase = flash_nios2_qspi_erase,
.write = flash_nios2_qspi_write, .write = flash_nios2_qspi_write,
.read = flash_nios2_qspi_read, .read = flash_nios2_qspi_read,

View file

@ -241,11 +241,6 @@ static int flash_nrf_erase(const struct device *dev, off_t addr, size_t size)
return ret; return ret;
} }
static int flash_nrf_write_protection(const struct device *dev, bool enable)
{
return 0;
}
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
static struct flash_pages_layout dev_layout; static struct flash_pages_layout dev_layout;
@ -270,7 +265,6 @@ static const struct flash_driver_api flash_nrf_api = {
.read = flash_nrf_read, .read = flash_nrf_read,
.write = flash_nrf_write, .write = flash_nrf_write,
.erase = flash_nrf_erase, .erase = flash_nrf_erase,
.write_protection = flash_nrf_write_protection,
.get_parameters = flash_nrf_get_parameters, .get_parameters = flash_nrf_get_parameters,
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
.page_layout = flash_nrf_pages_layout, .page_layout = flash_nrf_pages_layout,

View file

@ -106,14 +106,6 @@ static int flash_mcux_write(const struct device *dev, off_t offset,
return (rc == kStatus_Success) ? 0 : -EINVAL; return (rc == kStatus_Success) ? 0 : -EINVAL;
} }
static int flash_mcux_write_protection(const struct device *dev, bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
static const struct flash_pages_layout dev_layout = { static const struct flash_pages_layout dev_layout = {
.pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) / .pages_count = DT_REG_SIZE(SOC_NV_FLASH_NODE) /
@ -141,7 +133,6 @@ flash_mcux_get_parameters(const struct device *dev)
static struct flash_priv flash_data; static struct flash_priv flash_data;
static const struct flash_driver_api flash_mcux_api = { static const struct flash_driver_api flash_mcux_api = {
.write_protection = flash_mcux_write_protection,
.erase = flash_mcux_erase, .erase = flash_mcux_erase,
.write = flash_mcux_write, .write = flash_mcux_write,
.read = flash_mcux_read, .read = flash_mcux_read,

View file

@ -486,24 +486,6 @@ static int spi_flash_at45_erase(const struct device *dev, off_t offset,
return err; return err;
} }
static int spi_flash_at45_write_protection(const struct device *dev,
bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
/* The Sector Protection mechanism that is available in AT45 family
* chips is more complex than what is exposed by the the flash API
* (particular sectors need to be earlier configured in a write to
* the nonvolatile Sector Protection Register), so it is not feasible
* to try to use it here. Since the protection is not automatically
* enabled after the device is power cycled, there is nothing needed
* to be done in this function.
*/
return 0;
}
#if IS_ENABLED(CONFIG_FLASH_PAGE_LAYOUT) #if IS_ENABLED(CONFIG_FLASH_PAGE_LAYOUT)
static void spi_flash_at45_pages_layout(const struct device *dev, static void spi_flash_at45_pages_layout(const struct device *dev,
const struct flash_pages_layout **layout, const struct flash_pages_layout **layout,
@ -648,7 +630,6 @@ static const struct flash_driver_api spi_flash_at45_api = {
.read = spi_flash_at45_read, .read = spi_flash_at45_read,
.write = spi_flash_at45_write, .write = spi_flash_at45_write,
.erase = spi_flash_at45_erase, .erase = spi_flash_at45_erase,
.write_protection = spi_flash_at45_write_protection,
.get_parameters = flash_at45_get_parameters, .get_parameters = flash_at45_get_parameters,
#if IS_ENABLED(CONFIG_FLASH_PAGE_LAYOUT) #if IS_ENABLED(CONFIG_FLASH_PAGE_LAYOUT)
.page_layout = spi_flash_at45_pages_layout, .page_layout = spi_flash_at45_pages_layout,

View file

@ -595,15 +595,6 @@ static int spi_nor_erase(const struct device *dev, off_t addr, size_t size)
return ret; return ret;
} }
static int spi_nor_write_protection_nop(const struct device *dev,
bool write_protect)
{
ARG_UNUSED(dev);
ARG_UNUSED(write_protect);
return 0;
}
static int spi_nor_write_protection_set(const struct device *dev, static int spi_nor_write_protection_set(const struct device *dev,
bool write_protect) bool write_protect)
{ {
@ -985,7 +976,6 @@ static const struct flash_driver_api spi_nor_api = {
.read = spi_nor_read, .read = spi_nor_read,
.write = spi_nor_write, .write = spi_nor_write,
.erase = spi_nor_erase, .erase = spi_nor_erase,
.write_protection = spi_nor_write_protection_nop,
.get_parameters = flash_nor_get_parameters, .get_parameters = flash_nor_get_parameters,
#if defined(CONFIG_FLASH_PAGE_LAYOUT) #if defined(CONFIG_FLASH_PAGE_LAYOUT)
.page_layout = spi_nor_pages_layout, .page_layout = spi_nor_pages_layout,