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: 3886461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 56A0FBF540 for ; Tue, 25 Mar 2014 09:53:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AEFB202DD for ; Tue, 25 Mar 2014 09:53:13 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17A16202B4 for ; Tue, 25 Mar 2014 09:53:12 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMya-0003Pw-1Q; Tue, 25 Mar 2014 08:44:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMxl-0003qt-LJ; Tue, 25 Mar 2014 08:44:01 +0000 Received: from bombadil.infradead.org ([2001:1868:205::9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMs1-0003B8-OS for linux-arm-kernel@merlin.infradead.org; Tue, 25 Mar 2014 08:38:05 +0000 Received: from mail-wg0-f44.google.com ([74.125.82.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMcK-0002Dc-H5 for linux-arm-kernel@lists.infradead.org; Tue, 25 Mar 2014 08:21:52 +0000 Received: by mail-wg0-f44.google.com with SMTP id m15so77310wgh.15 for ; Tue, 25 Mar 2014 01:21:30 -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=AqmZhGk+s6yipObfYUIjvyPRwmiZRkRboHhwZcknYXA=; b=VZFV23YDf0EtziVhnNKc1+n6VvFlGSHlVNB0mzViTYuY5cm79ENB4TpWKKwVgMzf5W Ebadsn+efXVI0dAGq5is7JJ3TrPNl2l4zqTJd2XSHNI6N5sDToZVCzxCGx3P+7Ft9Uoe X4ZxqRK4kuVJbI7vmnyeZSGEhopgsQ9r3Qe3540JGHOYCQ+pSFr9EwGIFH/Mq7Um3dna h5ddHUfzaSDwuL8YbAZycKMnK5RxghNEXSQiaq4+VxrllPThw9S7VAIVhHmGFA8mysAH ewYTjbshMZf7zULc2vs+ZyyE8to//nk4DRmFza7VIzxpidBS4WbrlA8rMAJQCLqBqPFK irkw== X-Gm-Message-State: ALoCoQnb9YLZ5VMyWeW0TBEFbxfY2or31NfL19xIe2DAdMSCpLgOstSWU2prafbWTFhRyDisBLD0 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140325_012152_728285_4C617A3B X-CRM114-Status: UNSURE ( 8.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: angus.clark@st.com, kernel@stlinux.com, lee.jones@linaro.org, linux-mtd@lists.infradead.org, pekon@ti.com, computersforpeace@gmail.com, dwmw2@infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,