public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported
@ 2015-11-11 15:21 Fabio Estevam
  2015-11-11 15:21 ` [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash Fabio Estevam
  2015-11-17 18:20 ` [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported Jagan Teki
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2015-11-11 15:21 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

In the case of lock operations not being supported, we should better let
the user know instead of failing silently.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 include/spi_flash.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/spi_flash.h b/include/spi_flash.h
index 0ae0062..ff51c50 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -237,8 +237,10 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
 static inline int spi_flash_protect(struct spi_flash *flash, u32 ofs, u32 len,
 					bool prot)
 {
-	if (!flash->flash_lock)
+	if (!flash->flash_lock) {
+		printf("Protect operation not supported for this flash\n");
 		return -EOPNOTSUPP;
+	}
 
 	if (prot)
 		return flash->flash_lock(flash, ofs, len);
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash
  2015-11-11 15:21 [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported Fabio Estevam
@ 2015-11-11 15:21 ` Fabio Estevam
  2015-11-17 11:21   ` Fabio Estevam
  2015-11-17 18:22   ` Jagan Teki
  2015-11-17 18:20 ` [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported Jagan Teki
  1 sibling, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2015-11-11 15:21 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

SST SPI NOR flash has the same locking programming bits as ST Micro.

Add support for it.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mtd/spi/sf_internal.h | 1 +
 drivers/mtd/spi/sf_probe.c    | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 8793f18..85c8a89 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -64,6 +64,7 @@ enum spi_nor_option_flags {
 #define SPI_FLASH_CFI_MFR_SPANSION	0x01
 #define SPI_FLASH_CFI_MFR_STMICRO	0x20
 #define SPI_FLASH_CFI_MFR_MACRONIX	0xc2
+#define SPI_FLASH_CFI_MFR_SST		0xbf
 #define SPI_FLASH_CFI_MFR_WINBOND	0xef
 
 /* Erase commands */
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index bc05d30..fea6c24 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -184,8 +184,9 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
 
 	/* lock hooks are flash specific - assign them based on idcode0 */
 	switch (idcode[0]) {
-#ifdef CONFIG_SPI_FLASH_STMICRO
+#if defined CONFIG_SPI_FLASH_STMICRO || defined CONFIG_SPI_FLASH_SST
 	case SPI_FLASH_CFI_MFR_STMICRO:
+	case SPI_FLASH_CFI_MFR_SST:
 		flash->flash_lock = stm_lock;
 		flash->flash_unlock = stm_unlock;
 		flash->flash_is_locked = stm_is_locked;
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash
  2015-11-11 15:21 ` [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash Fabio Estevam
@ 2015-11-17 11:21   ` Fabio Estevam
  2015-11-17 18:22   ` Jagan Teki
  1 sibling, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2015-11-17 11:21 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On Wed, Nov 11, 2015 at 1:21 PM, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> SST SPI NOR flash has the same locking programming bits as ST Micro.
>
> Add support for it.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Any comments on this series, please?

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

* [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported
  2015-11-11 15:21 [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported Fabio Estevam
  2015-11-11 15:21 ` [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash Fabio Estevam
@ 2015-11-17 18:20 ` Jagan Teki
  1 sibling, 0 replies; 5+ messages in thread
From: Jagan Teki @ 2015-11-17 18:20 UTC (permalink / raw)
  To: u-boot

On 11 November 2015 at 20:51, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> In the case of lock operations not being supported, we should better let
> the user know instead of failing silently.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  include/spi_flash.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/spi_flash.h b/include/spi_flash.h
> index 0ae0062..ff51c50 100644
> --- a/include/spi_flash.h
> +++ b/include/spi_flash.h
> @@ -237,8 +237,10 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
>  static inline int spi_flash_protect(struct spi_flash *flash, u32 ofs, u32 len,
>                                         bool prot)
>  {
> -       if (!flash->flash_lock)
> +       if (!flash->flash_lock) {
> +               printf("Protect operation not supported for this flash\n");
>                 return -EOPNOTSUPP;
> +       }

Here it's not required, it's better to print the protected area in
cmd_sf itself similar way as mtd_utils flash_lock

thanks!
-- 
Jagan | openedev.

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

* [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash
  2015-11-11 15:21 ` [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash Fabio Estevam
  2015-11-17 11:21   ` Fabio Estevam
@ 2015-11-17 18:22   ` Jagan Teki
  1 sibling, 0 replies; 5+ messages in thread
From: Jagan Teki @ 2015-11-17 18:22 UTC (permalink / raw)
  To: u-boot

On 11 November 2015 at 20:51, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> SST SPI NOR flash has the same locking programming bits as ST Micro.
>
> Add support for it.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/mtd/spi/sf_internal.h | 1 +
>  drivers/mtd/spi/sf_probe.c    | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> index 8793f18..85c8a89 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -64,6 +64,7 @@ enum spi_nor_option_flags {
>  #define SPI_FLASH_CFI_MFR_SPANSION     0x01
>  #define SPI_FLASH_CFI_MFR_STMICRO      0x20
>  #define SPI_FLASH_CFI_MFR_MACRONIX     0xc2
> +#define SPI_FLASH_CFI_MFR_SST          0xbf
>  #define SPI_FLASH_CFI_MFR_WINBOND      0xef
>
>  /* Erase commands */
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index bc05d30..fea6c24 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -184,8 +184,9 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode,
>
>         /* lock hooks are flash specific - assign them based on idcode0 */
>         switch (idcode[0]) {
> -#ifdef CONFIG_SPI_FLASH_STMICRO
> +#if defined CONFIG_SPI_FLASH_STMICRO || defined CONFIG_SPI_FLASH_SST
>         case SPI_FLASH_CFI_MFR_STMICRO:
> +       case SPI_FLASH_CFI_MFR_SST:
>                 flash->flash_lock = stm_lock;
>                 flash->flash_unlock = stm_unlock;
>                 flash->flash_is_locked = stm_is_locked;
> --

Please add SST #ifdef on lock definitions as well.

thanks!
-- 
Jagan | openedev.

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

end of thread, other threads:[~2015-11-17 18:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 15:21 [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported Fabio Estevam
2015-11-11 15:21 ` [U-Boot] [PATCH 2/2] sf_probe: Add lock ops for SST SPI NOR flash Fabio Estevam
2015-11-17 11:21   ` Fabio Estevam
2015-11-17 18:22   ` Jagan Teki
2015-11-17 18:20 ` [U-Boot] [PATCH 1/2] spi_flash: Add error message when lock operations are not supported Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox