From patchwork Thu May 1 09:56:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29466 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F094203F3 for ; Thu, 1 May 2014 09:57:58 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id l13sf1007036iga.7 for ; Thu, 01 May 2014 02:57:58 -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=ZsVER1tgkbrFA6LsQ0HAoRzfTAsx8/LtllelsckmWxY=; b=lp38+bhn91iHfjEzGNvqOI9fD3kkX0WdqtZaECsmo0dfgcOBfO9bjzeFNX2vCii8s0 TBZUTRwfMrKzVYfTy5s6HIWqyrxfF6UEyTLGxMu0wPzYeM3ZWKvMpx7asABbxW+ybRQG ha0QVgJS4KPW9xNbxI3pgVzIXE/YQHyXOPyYlvrdwEdpBEU4MLWrjpKrDZmgSzmap8o/ Kdbch5BC8IAiKzw4zMJWbKMBUb+U9N7bDKmts9LtzoUL8O5QnZFaz/4f5M+EfeiCzmnm WATeOIuYxVu1XH6P1azYSrNWMlE8uDFSWd3h2aIdJ12bz1br7jEXR0C274V4/eIhAQrj Jvkg== X-Gm-Message-State: ALoCoQn8BSg5paHzj5QDKqKVYxClDhD96fNpCaX/gvR9kqj/Q72rc65w0xSKyS/+kfAj3FkZtD+l X-Received: by 10.182.227.131 with SMTP id sa3mr5269214obc.38.1398938278052; Thu, 01 May 2014 02:57:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.200 with SMTP id l66ls975201qgf.33.gmail; Thu, 01 May 2014 02:57:57 -0700 (PDT) X-Received: by 10.221.55.133 with SMTP id vy5mr8115469vcb.17.1398938277960; Thu, 01 May 2014 02:57:57 -0700 (PDT) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id y7si5966173veb.36.2014.05.01.02.57.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:57 -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.128.176; Received: by mail-ve0-f176.google.com with SMTP id jz11so21521veb.35 for ; Thu, 01 May 2014 02:57:57 -0700 (PDT) X-Received: by 10.52.249.105 with SMTP id yt9mr584948vdc.34.1398938277902; Thu, 01 May 2014 02:57:57 -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 ib8csp12938vcb; Thu, 1 May 2014 02:57:57 -0700 (PDT) X-Received: by 10.180.221.8 with SMTP id qa8mr1454309wic.39.1398938277055; Thu, 01 May 2014 02:57:57 -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 pl6si10544565wjc.86.2014.05.01.02.57.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:57 -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 d1so410499wiv.1 for ; Thu, 01 May 2014 02:57:55 -0700 (PDT) X-Received: by 10.194.122.6 with SMTP id lo6mr8193528wjb.38.1398938275311; Thu, 01 May 2014 02:57:55 -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.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:53 -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 23/47] mtd: nand: stm_nand_bch: erase one block (BCH) Date: Thu, 1 May 2014 10:56:30 +0100 Message-Id: <1398938214-17847-24-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: , Adding a function which simply erases a single flash block. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 40767b8..6d7ab79 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -458,6 +458,33 @@ static void bch_wait_seq(struct nandi_controller *nandi) dev_err(nandi->dev, "BCH Seq timeout\n"); } +static uint8_t bch_erase_block(struct nandi_controller *nandi, + loff_t offs) +{ + struct bch_prog *prog = &bch_prog_erase_block; + uint8_t status; + + dev_dbg(nandi->dev, "%s: offs = 0x%012llx\n", __func__, offs); + + prog->extra = (uint32_t)(offs >> nandi->page_shift); + + emiss_nandi_select(STM_NANDI_BCH); + + nandi_enable_interrupts(nandi, NANDBCH_INT_SEQNODESOVER); + reinit_completion(&nandi->seq_completed); + + bch_load_prog_cpu(nandi, prog); + + bch_wait_seq(nandi); + + nandi_disable_interrupts(nandi, NANDBCH_INT_SEQNODESOVER); + + status = (uint8_t)(readl(nandi->base + + NANDBCH_CHECK_STATUS_REG_A) & 0xff); + + return status; +} + /* * Initialisation */