sf: Simplify lock ops detection code
Simplify the flash_lock ops detection code and added meaningful comment. Cc: Bin Meng <bmeng.cn@gmail.com> Cc: York Sun <york.sun@nxp.com> Cc: Vignesh R <vigneshr@ti.com> Cc: Mugunthan V N <mugunthanvnm@ti.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Jagan Teki <jagan@openedev.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jagan@openedev.com> Tested-by: Jagan Teki <jagan@openedev.com>
This commit is contained in:
		
							parent
							
								
									f790ca7c7d
								
							
						
					
					
						commit
						dda06a4328
					
				| 
						 | 
					@ -1118,19 +1118,15 @@ int spi_flash_scan(struct spi_flash *flash)
 | 
				
			||||||
	flash->read = spi_flash_cmd_read_ops;
 | 
						flash->read = spi_flash_cmd_read_ops;
 | 
				
			||||||
#endif
 | 
					#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)
 | 
					#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
 | 
				
			||||||
	case SPI_FLASH_CFI_MFR_STMICRO:
 | 
						/* NOR protection support for STmicro/Micron chips and similar */
 | 
				
			||||||
	case SPI_FLASH_CFI_MFR_SST:
 | 
						if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_STMICRO ||
 | 
				
			||||||
 | 
						    JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST) {
 | 
				
			||||||
		flash->flash_lock = stm_lock;
 | 
							flash->flash_lock = stm_lock;
 | 
				
			||||||
		flash->flash_unlock = stm_unlock;
 | 
							flash->flash_unlock = stm_unlock;
 | 
				
			||||||
		flash->flash_is_locked = stm_is_locked;
 | 
							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 */
 | 
						/* Compute the flash size */
 | 
				
			||||||
	flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
 | 
						flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue