From patchwork Thu May 1 09:56:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29484 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D5E5A203F3 for ; Thu, 1 May 2014 09:58:31 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf14186773pab.7 for ; Thu, 01 May 2014 02:58: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=cQTW1ymYG7ki8dSMuEntz/rvVLxq8OCOrjTW/yYyCwQ=; b=OnbYEJcRJntEKh4eUGu9dqJ10J7Ejcz2D6fYh7BSydCO1vbGGG1F0RtzXhMKahs6s3 tGJDSiFp22coTP53k7eFIGmdPM8qC+GkDh/4LYXCA7IAq7yF3KaY203AAg28WMUa80vt qEnexguUwmkYZUYgcLuizPI4sKuON4BxNRJmYHobAlqYAp6xl4j0BOtTOxA4eUZLsJ4G DTIRt/7qZuLylIxTIIWOtVoUzLUTVZx1kaQGd3tBl+29s+Y18HwEE8LigLNUu1CKeE6i yqW1raFUYhixrFA6W9eqi+M9gjU57bSfC7giJv5KnfL3XvY9tm/hvOebxpw5PFHtF1TR 4u1g== X-Gm-Message-State: ALoCoQmWjbeH2ULVp+vqT47x+fnEkefj3NEWaTiU1uQpjzJdSAtJxtitfkW61CQvC5q3MzcstDW0 X-Received: by 10.66.156.66 with SMTP id wc2mr5734507pab.23.1398938310911; Thu, 01 May 2014 02:58:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.203 with SMTP id h69ls1034645qgh.56.gmail; Thu, 01 May 2014 02:58:30 -0700 (PDT) X-Received: by 10.58.219.233 with SMTP id pr9mr8440707vec.10.1398938310756; Thu, 01 May 2014 02:58:30 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id od9si5969408vcb.65.2014.05.01.02.58.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58: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.170; Received: by mail-vc0-f170.google.com with SMTP id hr9so3735068vcb.29 for ; Thu, 01 May 2014 02:58:30 -0700 (PDT) X-Received: by 10.220.162.6 with SMTP id t6mr8302824vcx.12.1398938310695; Thu, 01 May 2014 02:58: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 ib8csp12977vcb; Thu, 1 May 2014 02:58:30 -0700 (PDT) X-Received: by 10.194.103.36 with SMTP id ft4mr193563wjb.66.1398938309406; Thu, 01 May 2014 02:58:29 -0700 (PDT) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx.google.com with ESMTPS id t9si565389wif.117.2014.05.01.02.58.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:29 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=74.125.82.182; Received: by mail-we0-f182.google.com with SMTP id u57so2833112wes.41 for ; Thu, 01 May 2014 02:58:28 -0700 (PDT) X-Received: by 10.180.90.79 with SMTP id bu15mr1558917wib.38.1398938308898; Thu, 01 May 2014 02:58: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.58.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:28 -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 41/47] mtd: nand: stm_nand_bch: MTD erase (BCH) Date: Thu, 1 May 2014 10:56:48 +0100 Message-Id: <1398938214-17847-42-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: , Carry out the normal checks, then attempt to erase a given block. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index e742655..11735ee 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -529,6 +529,16 @@ static uint8_t bch_erase_block(struct nandi_controller *nandi, return status; } +static int bch_erase(struct mtd_info *mtd, int page) +{ + struct nand_chip *chip = mtd->priv; + struct nandi_controller *nandi = chip->priv; + uint32_t page_size = mtd->writesize; + loff_t offs = page * page_size; + + return bch_erase_block(nandi, offs); +} + /* * Detect an erased page, tolerating and correcting up to a specified number of * bits at '0'. (For many devices, it is now deemed within spec for an erased @@ -1370,6 +1380,7 @@ static void nandi_set_mtd_defaults(struct nandi_controller *nandi, chip->ecc.read_page = bch_read; chip->write_page = bch_write; + chip->erase = bch_erase; chip->scan_bbt = bch_scan_bbt; }