]> Git Repo - J-u-boot.git/commitdiff
sf: Simplify lock ops detection code
authorJagan Teki <[email protected]>
Sun, 30 Oct 2016 17:46:11 +0000 (23:16 +0530)
committerJagan Teki <[email protected]>
Fri, 18 Nov 2016 07:34:52 +0000 (13:04 +0530)
Simplify the flash_lock ops detection code and added
meaningful comment.

Cc: Bin Meng <[email protected]>
Cc: York Sun <[email protected]>
Cc: Vignesh R <[email protected]>
Cc: Mugunthan V N <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Siva Durga Prasad Paladugu <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
Tested-by: Jagan Teki <[email protected]>
drivers/mtd/spi/spi_flash.c

index 95ee5ac62831965acd5d517ce2e2d32bb40b5a11..220c9616076ea83f717a17c270ee50ef451273c3 100644 (file)
@@ -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
 
        /* Compute the flash size */
        flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
This page took 0.037898 seconds and 4 git commands to generate.