From patchwork Thu May 1 09:56:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29454 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B62BC203F3 for ; Thu, 1 May 2014 09:57:30 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf15355284obb.6 for ; Thu, 01 May 2014 02:57: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:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=8AiP4dN71c+raWjtIxY1Khs8dwUpudAs0/QF5hI973w=; b=nMUNV4hQfe1owqZzY5fwf2nizpWB642o05HVt7VMn+051w+AytXpd/pGzV69A4y6ib U96ENgfT/GmqenkUgtlMJOyC2npfytk/XBkc5076FlNQTw7A/MXyIVkXqz69SkPGusaa PsedK1MXEU20uEExB4dp7k3TrjCYX076Hf/iPfRwRv14y2UzcIqFxIgUy+7fS6Aq9RZc rUdUfdhKOoxC2UtvBDWTzgys3JNhUXWlYdeHtlAzzD/Cbj4WAdW3cEy0CLgEx9xmnJZf 6ae0Vje789TYgSJjw1uBjhF/JHqbaVJ+w3TzUWLgcuCEB32/8W5i+oSfChVi5MUoB6KZ CX7w== X-Gm-Message-State: ALoCoQl68WJRLrxr8rThAPoyvt5e1o9u8VE15uLx3Db1RdrEtK0qsZylCE3PQdyBjYmxmFJtCBQz X-Received: by 10.43.141.196 with SMTP id jf4mr4805840icc.9.1398938250251; Thu, 01 May 2014 02:57:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.180 with SMTP id w49ls985420qge.3.gmail; Thu, 01 May 2014 02:57:30 -0700 (PDT) X-Received: by 10.52.175.69 with SMTP id by5mr330782vdc.16.1398938250147; Thu, 01 May 2014 02:57:30 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id t4si5966959vcz.58.2014.05.01.02.57.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:30 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id im17so3748603vcb.0 for ; Thu, 01 May 2014 02:57:30 -0700 (PDT) X-Received: by 10.52.228.134 with SMTP id si6mr2097197vdc.5.1398938250074; Thu, 01 May 2014 02:57:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp12900vcb; Thu, 1 May 2014 02:57:29 -0700 (PDT) X-Received: by 10.194.202.166 with SMTP id kj6mr1422300wjc.48.1398938249246; Thu, 01 May 2014 02:57:29 -0700 (PDT) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx.google.com with ESMTPS id y20si10548587wjq.23.2014.05.01.02.57.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:29 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.174; Received: by mail-wi0-f174.google.com with SMTP id d1so408992wiv.7 for ; Thu, 01 May 2014 02:57:28 -0700 (PDT) X-Received: by 10.194.202.166 with SMTP id kj6mr1422275wjc.48.1398938248806; Thu, 01 May 2014 02:57:28 -0700 (PDT) Received: from lee--X1.home (host109-148-238-223.range109-148.btcentralplus.com. [109.148.238.223]) by mx.google.com with ESMTPSA id bj5sm2696494wib.3.2014.05.01.02.57.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:27 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com, Lee Jones Subject: [PATCH 11/47] mtd: nand: stm_nand_bch: initialise the Hamming Controller Date: Thu, 1 May 2014 10:56:18 +0100 Message-Id: <1398938214-17847-12-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> References: <1398938214-17847-1-git-send-email-lee.jones@linaro.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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: 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 19d090c..0c6aad2 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -365,6 +365,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__); @@ -413,6 +448,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,