From: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
To: <dwmw2@infradead.org>, <computersforpeace@gmail.com>,
<zajec5@gmail.com>, <shijie.huang@intel.com>,
<juhosg@openwrt.org>, <marex@denx.de>,
<mika.westerberg@linux.intel.com>, <beanhuo@micron.com>,
<furquan@google.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<michals@xilinx.com>, <harinik@xilinx.com>, <punnaia@xilinx.com>,
<anirudh@xilinx.com>, <svemula@xilinx.com>,
Anurag Kumar Vulisha <anuragku@xilinx.com>
Subject: [PATCH] mtd: spi-nor: Add Global Block-Protection Unlock support for SST flash parts
Date: Fri, 13 Nov 2015 18:02:38 +0530 [thread overview]
Message-ID: <1447417958-20896-1-git-send-email-anuragku@xilinx.com> (raw)
This patch adds Global block protection unlock support for SST flash parts
Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.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
reply other threads:[~2015-11-13 12:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447417958-20896-1-git-send-email-anuragku@xilinx.com \
--to=anurag.kumar.vulisha@xilinx.com \
--cc=anirudh@xilinx.com \
--cc=anuragku@xilinx.com \
--cc=beanhuo@micron.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=furquan@google.com \
--cc=harinik@xilinx.com \
--cc=juhosg@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marex@denx.de \
--cc=michals@xilinx.com \
--cc=mika.westerberg@linux.intel.com \
--cc=punnaia@xilinx.com \
--cc=shijie.huang@intel.com \
--cc=svemula@xilinx.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®