[U-Boot] [PATCH v6 02/21] sf: Simplify lock ops detection code

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Wed Nov 16 06:38:21 CET 2016


Hi,

> -----Original Message-----
> From: Jagan Teki [mailto:jagan at openedev.com]
> Sent: Wednesday, November 16, 2016 9:33 AM
> To: u-boot at lists.denx.de
> Cc: Jagan Teki <jagan at openedev.com>; Bin Meng <bmeng.cn at gmail.com>;
> York Sun <york.sun at nxp.com>; Vignesh R <vigneshr at ti.com>; Mugunthan V
> N <mugunthanvnm at ti.com>; Michal Simek <michal.simek at xilinx.com>; Siva
> Durga Prasad Paladugu <sivadur at xilinx.com>
> Subject: [PATCH v6 02/21] sf: Simplify lock ops detection code
> 
> Simplify the flash_lock ops detection code and added meaningful comment.
> 
> Cc: Bin Meng <bmeng.cn at gmail.com>
> Cc: York Sun <york.sun at nxp.com>
> Cc: Vignesh R <vigneshr at ti.com>
> Cc: Mugunthan V N <mugunthanvnm at ti.com>
> Cc: Michal Simek <michal.simek at xilinx.com>
> Cc: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
> Signed-off-by: Jagan Teki <jagan at openedev.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Jagan Teki <jagan at openedev.com>
Reviewed-by:  Siva Durga Prasad Paladugu <sivadur at xilinx.com>

> Tested-by: Jagan Teki <jagan at openedev.com>
> ---
>  drivers/mtd/spi/spi_flash.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index
> 95ee5ac..220c961 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -1118,19 +1118,15 @@ int spi_flash_scan(struct spi_flash *flash)
>  	flash->read = spi_flash_cmd_read_ops;
>  #endif
> 
> -	/* lock hooks are flash specific - assign them based on idcode0 */
> -	switch (JEDEC_MFR(info)) {
>  #if defined(CONFIG_SPI_FLASH_STMICRO) ||
> defined(CONFIG_SPI_FLASH_SST)
> -	case SPI_FLASH_CFI_MFR_STMICRO:
> -	case SPI_FLASH_CFI_MFR_SST:
> +	/* NOR protection support for STmicro/Micron chips and similar */
> +	if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_STMICRO ||
> +	    JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST) {
>  		flash->flash_lock = stm_lock;
>  		flash->flash_unlock = stm_unlock;
>  		flash->flash_is_locked = stm_is_locked; -#endif
> -		break;
> -	default:
> -		debug("SF: Lock ops not supported for %02x flash\n",
> JEDEC_MFR(info));
>  	}
> +#endif
I feel switch case is better but no issues here as it is single if. Hence, reviewed-by.

Thanks,
Siva

> 
>  	/* Compute the flash size */
>  	flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
> --
> 1.9.1



More information about the U-Boot mailing list