We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b403fde commit d731338Copy full SHA for d731338
drivers/flash/spi_nor.c
@@ -848,8 +848,8 @@ static int spi_nor_write_protection_set(const struct device *dev,
848
int ret;
849
850
#if ANY_INST_HAS_WP_GPIOS
851
- if (DEV_CFG(dev)->wp) {
852
- gpio_pin_set_dt(DEV_CFG(dev)->wp, write_protect);
+ if (DEV_CFG(dev)->wp && write_protect == false) {
+ gpio_pin_set_dt(DEV_CFG(dev)->wp, 0);
853
}
854
#endif
855
@@ -862,6 +862,12 @@ static int spi_nor_write_protection_set(const struct device *dev,
862
ret = spi_nor_cmd_write(dev, SPI_NOR_CMD_ULBPR);
863
864
865
+#if ANY_INST_HAS_WP_GPIOS
866
+ if (DEV_CFG(dev)->wp && write_protect == true) {
867
+ gpio_pin_set_dt(DEV_CFG(dev)->wp, 1);
868
+ }
869
+#endif
870
+
871
return ret;
872
873
0 commit comments