All of lore.kernel.org
 help / color / mirror / Atom feed
From: George McCollister <george.mccollister@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] sf: Use stm_lock/unlock for Spansion and Winbond
Date: Mon, 10 Oct 2016 13:57:59 -0500	[thread overview]
Message-ID: <20161010185801.27991-4-george.mccollister@gmail.com> (raw)
In-Reply-To: <20161010185801.27991-1-george.mccollister@gmail.com>

Spansion parts such as S25FL128S and Winbond parts such as W25Q64FV
support the block protection mechanism implemented as
stm_lock() and stm_unlock(). Use stm_lock() and stm_unlock() for
Spansion and Winbond devices.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
---
 drivers/mtd/spi/spi_flash.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 0e33901..392146b 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -664,7 +664,8 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
 }
 #endif
 
-#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
+#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST) || \
+	defined(CONFIG_SPI_FLASH_SPANSION) || defined(CONFIG_SPI_FLASH_WINBOND)
 static void stm_get_locked_range(struct spi_flash *flash, u8 sr, loff_t *ofs,
 				 u64 *len)
 {
@@ -1160,8 +1161,16 @@ int spi_flash_scan(struct spi_flash *flash)
 		flash->flash_unlock = stm_unlock;
 		flash->flash_is_locked = stm_is_locked;
 		flash->sr_protect = stm_sr_protect;
+		break;
 #endif
+#if defined(CONFIG_SPI_FLASH_SPANSION) || defined(CONFIG_SPI_FLASH_WINBOND)
+	case SPI_FLASH_CFI_MFR_SPANSION:
+	case SPI_FLASH_CFI_MFR_WINBOND:
+		flash->flash_lock = stm_lock;
+		flash->flash_unlock = stm_unlock;
+		flash->flash_is_locked = stm_is_locked;
 		break;
+#endif
 	default:
 		debug("SF: Lock ops not supported for %02x flash\n", idcode[0]);
 	}
-- 
2.9.3

  parent reply	other threads:[~2016-10-10 18:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10 18:57 [U-Boot] [PATCH 0/5] sf: Add support for status register protect George McCollister
2016-10-10 18:57 ` [U-Boot] [PATCH 1/5] sf: Add status register protection mechanism George McCollister
2016-10-11  2:05   ` Bin Meng
2016-10-10 18:57 ` [U-Boot] [PATCH 2/5] sf: Add status register protect for STMICRO, SST George McCollister
2016-10-11  2:05   ` Bin Meng
2016-10-10 18:57 ` George McCollister [this message]
2016-10-11  2:05   ` [U-Boot] [PATCH 3/5] sf: Use stm_lock/unlock for Spansion and Winbond Bin Meng
2016-10-10 18:58 ` [U-Boot] [PATCH 4/5] sf: Add status register protect for Winbond George McCollister
2016-10-11  2:05   ` Bin Meng
2016-10-10 18:58 ` [U-Boot] [PATCH 5/5] sf: Add sr-protect sub-command George McCollister
2016-10-11  2:05   ` Bin Meng
2016-10-28 17:06 ` [U-Boot] [PATCH 0/5] sf: Add support for status register protect George McCollister
2016-10-28 17:24   ` Jagan Teki

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=20161010185801.27991-4-george.mccollister@gmail.com \
    --to=george.mccollister@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 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.