All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] mtd: spi-nor: intel-spi: fix forced writable option
@ 2020-05-18 17:59 ` Daniel Walker
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Walker @ 2020-05-18 17:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Jinhua Wu, xe-linux-external, Tudor Ambarus, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel

This option currently doesn't work as expected. If the BIOS has this
flash as read-only there is no way to change this thru the driver.
There is a parameter which allows the flash to become writable with the
"writable" option to the module, but it does nothing if the BIOS has it
set to read-only.

I would expect this option would make the flash writable regardless of
the BIOS settings. This patch changes this option so the BIOS setting
doesn't stop the writable option from enabling read write on the flash.

Original patch by Jinhua Wu <jinhwu@cisco.com>

Cc: Jinhua Wu <jinhwu@cisco.com>
Cc: xe-linux-external@cisco.com
Signed-off-by: Daniel Walker <danielwa@cisco.com>
---
 drivers/mtd/spi-nor/controllers/intel-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
index e5a3d51a2e4d..68a5877bfc0b 100644
--- a/drivers/mtd/spi-nor/controllers/intel-spi.c
+++ b/drivers/mtd/spi-nor/controllers/intel-spi.c
@@ -954,7 +954,7 @@ struct intel_spi *intel_spi_probe(struct device *dev,
 	intel_spi_fill_partition(ispi, &part);
 
 	/* Prevent writes if not explicitly enabled */
-	if (!ispi->writeable || !writeable)
+	if (!ispi->writeable && !writeable)
 		ispi->nor.mtd.flags &= ~MTD_WRITEABLE;
 
 	ret = mtd_device_register(&ispi->nor.mtd, &part, 1);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-02 16:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 17:59 [PATCH 2/2] mtd: spi-nor: intel-spi: fix forced writable option Daniel Walker
2020-05-18 17:59 ` Daniel Walker
2020-05-28 11:01 ` Vignesh Raghavendra
2020-05-28 11:01   ` Vignesh Raghavendra
2020-05-28 15:55   ` Jinhua Wu (jinhwu)
2020-05-28 15:55     ` Jinhua Wu (jinhwu)
2020-06-02 16:36     ` Daniel Walker (danielwa)
2020-06-02 16:36       ` Daniel Walker (danielwa)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.