[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1447417958-20896-1-git-send-email-anuragku@xilinx.com>
Date: Fri, 13 Nov 2015 18:02:38 +0530
From: Anurag Kumar Vulisha <anurag.kumar.vulisha@...inx.com>
To: <dwmw2@...radead.org>, <computersforpeace@...il.com>,
<zajec5@...il.com>, <shijie.huang@...el.com>, <juhosg@...nwrt.org>,
<marex@...x.de>, <mika.westerberg@...ux.intel.com>,
<beanhuo@...ron.com>, <furquan@...gle.com>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<michals@...inx.com>, <harinik@...inx.com>, <punnaia@...inx.com>,
<anirudh@...inx.com>, <svemula@...inx.com>,
Anurag Kumar Vulisha <anuragku@...inx.com>
Subject: [PATCH] mtd: spi-nor: Add Global Block-Protection Unlock support for SST flash parts
This patch adds Global block protection unlock support for SST flash parts
Signed-off-by: Anurag Kumar Vulisha <anuragku@...inx.com>
---
drivers/mtd/spi-nor/spi-nor.c | 8 ++++++++
include/linux/mtd/spi-nor.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 4988390..787ab95 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -68,6 +68,8 @@ struct flash_info {
#define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */
#define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */
#define USE_FSR 0x80 /* use flag status register */
+/* Unlock the Global protection for sst flashes */
+#define SST_GLOBAL_PROT_UNLK 0x100
};
#define JEDEC_MFR(info) ((info)->id[0])
@@ -1204,6 +1206,12 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
JEDEC_MFR(info) == SNOR_MFR_WINBOND) {
write_enable(nor);
write_sr(nor, 0);
+
+ if (info->flags & SST_GLOBAL_PROT_UNLK) {
+ write_enable(nor);
+ /* Unlock global write protection bits */
+ nor->write_reg(nor, GLOBAL_BLKPROT_UNLK, NULL, 0);
+ }
}
if (!mtd->name)
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index c8723b6..37e1abf 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -65,6 +65,7 @@
#define SPINOR_OP_BP 0x02 /* Byte program */
#define SPINOR_OP_WRDI 0x04 /* Write disable */
#define SPINOR_OP_AAI_WP 0xad /* Auto address increment word program */
+#define GLOBAL_BLKPROT_UNLK 0x98 /* Clear global write protection bits */
/* Used for Macronix and Winbond flashes. */
#define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */
--
2.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists