From patchwork Tue Mar 25 08:19:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26970 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E905920062 for ; Tue, 25 Mar 2014 08:21:01 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf499558oag.8 for ; Tue, 25 Mar 2014 01:21:01 -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=nhvEzulIQi0/hn9qam8fZxZGFnecphx++0Rsszwt854=; b=OYCnGKLL1uBSk2u1XahahvshzRB6TzxOQP8wrPjx53a/mjLk8Zbs8XNgnjGW7iaHsl cECCXuVLzgRLoLEKMVy3qxBlgvmos6x2KBlwVNEgPhiIanS/1x5Zb0bXRKOZHRUemym6 k0zYUrRw9+EKMTpQYNVcObrUHdoRl7iMgIousfdjbWsHdIhJM1KHtrgvYWNGUmpIfCDV 6suOvINx27UgK4grcsmJQG1GhRh4+PLNsk8nZ09Z+m/JrS5wHUAaZJqXS/am7lo1bBhK ThjnGCI6mIm+2lUATrDazWojxlkClB5kk4I/QsSseidLWaluP3m3e+/0gBrs8Au9ky70 WfbA== X-Gm-Message-State: ALoCoQk17UwCvWH6CEJJCf6qwSDb8iMZigMWd7xXMRI1+HM7T6D7RFckMAmblkWCu9QVwqsgmjM3 X-Received: by 10.182.29.196 with SMTP id m4mr14067400obh.26.1395735661535; Tue, 25 Mar 2014 01:21:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.136 with SMTP id v8ls145977qgd.17.gmail; Tue, 25 Mar 2014 01:21:01 -0700 (PDT) X-Received: by 10.52.37.196 with SMTP id a4mr30938vdk.33.1395735661432; Tue, 25 Mar 2014 01:21:01 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id j20si3533481vcx.127.2014.03.25.01.21.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 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.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so127550vcb.34 for ; Tue, 25 Mar 2014 01:21:01 -0700 (PDT) X-Received: by 10.52.144.80 with SMTP id sk16mr29960vdb.34.1395735661347; Tue, 25 Mar 2014 01:21:01 -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 i9csp285269vck; Tue, 25 Mar 2014 01:21:00 -0700 (PDT) X-Received: by 10.68.237.99 with SMTP id vb3mr77100005pbc.76.1395735658576; Tue, 25 Mar 2014 01:20:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si10867939pbq.405.2014.03.25.01.20.57; Tue, 25 Mar 2014 01:20:57 -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 S1752812AbaCYIUt (ORCPT + 26 others); Tue, 25 Mar 2014 04:20:49 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:52060 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbaCYIUi (ORCPT ); Tue, 25 Mar 2014 04:20:38 -0400 Received: by mail-wg0-f43.google.com with SMTP id x13so75603wgg.26 for ; Tue, 25 Mar 2014 01:20:36 -0700 (PDT) X-Received: by 10.181.13.112 with SMTP id ex16mr21410284wid.23.1395735636607; Tue, 25 Mar 2014 01:20:36 -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.20.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:35 -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 10/47] mtd: nand: stm_nand_bch: initialise the Hamming Controller Date: Tue, 25 Mar 2014 08:19:27 +0000 Message-Id: <1395735604-26706-11-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.175 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: , Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 7333ad6..8ab8e7b 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -207,6 +207,41 @@ static struct clk *nandi_clk_setup(struct nandi_controller *nandi, return clk; } +static void nandi_init_hamming(struct nandi_controller *nandi, int emi_bank) +{ + dev_dbg(nandi->dev, "%s\n", __func__); + + emiss_nandi_select(STM_NANDI_HAMMING); + + /* Reset and disable boot-mode controller */ + writel(BOOT_CFG_RESET, nandi->base + NANDHAM_BOOTBANK_CFG); + udelay(1); + writel(0x00000000, nandi->base + NANDHAM_BOOTBANK_CFG); + + /* Reset controller */ + writel(CFG_RESET, nandi->base + NANDHAM_FLEXMODE_CFG); + udelay(1); + writel(0x00000000, nandi->base + NANDHAM_FLEXMODE_CFG); + + /* Set EMI Bank */ + writel(0x1 << emi_bank, nandi->base + NANDHAM_FLEX_MUXCTRL); + + /* Enable FLEX mode */ + writel(CFG_ENABLE_FLEX, nandi->base + NANDHAM_FLEXMODE_CFG); + + /* Configure FLEX_DATA_READ/WRITE for 1-byte access */ + writel(FLEX_DATA_CFG_BEATS_1 | FLEX_DATA_CFG_CSN, + nandi->base + NANDHAM_FLEX_DATAREAD_CONFIG); + writel(FLEX_DATA_CFG_BEATS_1 | FLEX_DATA_CFG_CSN, + nandi->base + NANDHAM_FLEX_DATAREAD_CONFIG); + + /* RBn interrupt on rising edge */ + writel(NAND_EDGE_CFG_RBN_RISING, nandi->base + NANDHAM_INT_EDGE_CFG); + + /* Enable interrupts */ + nandi_enable_interrupts(nandi, NAND_INT_ENABLE); +} + static void nandi_init_bch(struct nandi_controller *nandi, int emi_bank) { dev_dbg(nandi->dev, "%s\n", __func__); @@ -255,6 +290,7 @@ static void nandi_init_controller(struct nandi_controller *nandi, int emi_bank) { nandi_init_bch(nandi, emi_bank); + nandi_init_hamming(nandi, emi_bank); } static int remap_named_resource(struct platform_device *pdev,