From patchwork Tue Mar 25 08:19:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7FBF020062 for ; Tue, 25 Mar 2014 08:22:01 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq10sf1816842igb.1 for ; Tue, 25 Mar 2014 01:22:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=6wzwnpUvyPdrzqnor2XxH/5PQOtKmfEwWoNZY1IDUcA=; b=TJGl1nj5tFTSBficAaBM+/BnYUTWSwLMMj/a492MorUICWd8/NZSdboonb4KA40UOU V7oBirsKh23hB3MW1n8hEGuOHdGhglMkAz6JSwugRLjMhozTCZW+LKc5QLEh9qSTQoN/ YJfeQ2/bznlusn9RRRC7H542IL7jD4HZ5V0wrk8vzqZ5brgCVaCRT7PvMJtOM2DDyn8/ KVkxNiwaBwjYJDe6fJS2xGLeVrLcpCG56PSFSmVLmJT4+VITVOAOnPxDQiIDCncABQ44 8mRfGg3uFdf4o2yzUN5uQUT0sLif3AXmTZCkxHtNvn7VYqmF4RDx7P2TFZ1+FTWZCjNr +bNw== X-Gm-Message-State: ALoCoQku22/3bs1gvO2C/mJs+g59lUPhEW5ymuUZgA6dvAhGvZK5KK2vtGFsyNfU+BjKSrONRJrm X-Received: by 10.42.240.19 with SMTP id ky19mr24837506icb.4.1395735720955; Tue, 25 Mar 2014 01:22:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.12 with SMTP id t12ls143922qge.1.gmail; Tue, 25 Mar 2014 01:22:00 -0700 (PDT) X-Received: by 10.220.131.210 with SMTP id y18mr55068163vcs.12.1395735720828; Tue, 25 Mar 2014 01:22:00 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id fv9si3535522vcb.128.2014.03.25.01.22.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:22:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so129810vcb.16 for ; Tue, 25 Mar 2014 01:22:00 -0700 (PDT) X-Received: by 10.52.173.165 with SMTP id bl5mr37191388vdc.13.1395735720758; Tue, 25 Mar 2014 01:22:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp285337vck; Tue, 25 Mar 2014 01:21:59 -0700 (PDT) X-Received: by 10.66.11.66 with SMTP id o2mr9206055pab.142.1395735719203; Tue, 25 Mar 2014 01:21:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si10889653pbq.233.2014.03.25.01.21.58; Tue, 25 Mar 2014 01:21:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753250AbaCYIVe (ORCPT + 26 others); Tue, 25 Mar 2014 04:21:34 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:54209 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753132AbaCYIVb (ORCPT ); Tue, 25 Mar 2014 04:21:31 -0400 Received: by mail-wi0-f180.google.com with SMTP id hr14so344549wib.1 for ; Tue, 25 Mar 2014 01:21:30 -0700 (PDT) X-Received: by 10.180.108.199 with SMTP id hm7mr21517351wib.1.1395735690760; Tue, 25 Mar 2014 01:21:30 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id k4sm5567676wib.19.2014.03.25.01.21.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:29 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, computersforpeace@gmail.com, linux-mtd@lists.infradead.org, dwmw2@infradead.org, angus.clark@st.com, pekon@ti.com Subject: [RFC 38/47] mtd: nand: stm_nand_bch: check WP (FLEX) Date: Tue, 25 Mar 2014 08:19:55 +0000 Message-Id: <1395735604-26706-39-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> References: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Return status of the Write Protect bit for the NAND device. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 3853e7a..18601e5 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -543,6 +543,22 @@ static void flex_addr(struct nandi_controller *nandi, writel(addr, nandi->base + NANDHAM_FLEX_ADD); } +/* + * Hamming-FLEX operations (optimised replacements for nand_base.c versions) + */ +static int flex_check_wp(struct nandi_controller *nandi) +{ + uint8_t status; + + emiss_nandi_select(STM_NANDI_HAMMING); + + flex_cmd(nandi, NAND_CMD_STATUS); + + status = (uint8_t)(readl(nandi->base + NANDHAM_FLEX_DATA) & 0xff); + + return status & NAND_STATUS_WP ? 0 : 1; +} + static int flex_read_raw(struct nandi_controller *nandi, uint32_t page_addr, uint32_t col_addr,