From patchwork Sun Oct 30 17:46:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 688986 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3t6Q1b5T3Lz9s2G for ; Mon, 31 Oct 2016 04:47:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4237A7558; Sun, 30 Oct 2016 18:47:25 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c9mRCSqFwMYq; Sun, 30 Oct 2016 18:47:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C41E4BA81; Sun, 30 Oct 2016 18:47:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 63F91A7535 for ; Sun, 30 Oct 2016 18:47:11 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uOXYsdM3h53m for ; Sun, 30 Oct 2016 18:47:11 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by theia.denx.de (Postfix) with ESMTPS id 77F694BA16 for ; Sun, 30 Oct 2016 18:47:05 +0100 (CET) Received: by mail-pf0-f193.google.com with SMTP id n85so6593819pfi.3 for ; Sun, 30 Oct 2016 10:47:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VCIUeFHsa5n8kTzNd2b+8t1q4cYxV2EqYCGcVvkOXGo=; b=FgDWIWC4ioKuO+rwn2oo/rAL+Poubh47u4BYgLvHnY1D3mMPF3mF2QtPrygGQ+Gna4 TwY2PWcos5qi+k9gPUVO1vibLeA6YRadE9I+WOt/z4uy+cNxLgXXxmtg7yU28Cwf+ops +rm3kaDk8zZYGH4ZuqNhJV+T+G4PTBOFRiTjkHXAQWchk+PfMG4kvH5LdK5YSHyuRcG9 EEQElKiP6meT5WVjt0GFfpDCwsz+qljeoKxk1mB2upgjU5r2R1AL+NyTWu5ZarUMrQVS MhTYS60yWeI1XZ/h6n81ZldwqHdAKQ4+QyvAWh93P3FlUA4PzMHRTFM+XjgjRoca+hTd vxUg== X-Gm-Message-State: ABUngvcuKVA2ttbPfrfzoxOlIxOxzn5pyJvDPbGVRI0cLsMdo8lr4PuQShVvBuI5keBToQ== X-Received: by 10.99.125.14 with SMTP id y14mr35690799pgc.163.1477849624575; Sun, 30 Oct 2016 10:47:04 -0700 (PDT) Received: from Mr.J ([49.204.230.134]) by smtp.gmail.com with ESMTPSA id s7sm4138882pfg.32.2016.10.30.10.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Oct 2016 10:47:03 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Date: Sun, 30 Oct 2016 23:16:11 +0530 Message-Id: <1477849590-11954-3-git-send-email-jagan@openedev.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477849590-11954-1-git-send-email-jagan@openedev.com> References: <1477849590-11954-1-git-send-email-jagan@openedev.com> Cc: Michal Simek , Siva Durga Prasad Paladugu , Jagan Teki Subject: [U-Boot] [PATCH v5 02/21] sf: Simplify lock ops detection code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Simplify the flash_lock ops detection code and added meaningful comment. Cc: Simon Glass Cc: Bin Meng Cc: York Sun Cc: Vignesh R Cc: Mugunthan V N Cc: Michal Simek Cc: Siva Durga Prasad Paladugu Signed-off-by: Jagan Teki Reviewed-by: Simon Glass --- 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 daa9014..b92b0bf 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -1117,19 +1117,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;