From patchwork Thu May 1 09:56:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29472 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EFD6F203F3 for ; Thu, 1 May 2014 09:58:09 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp4sf15345718obc.0 for ; Thu, 01 May 2014 02:58:09 -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=GcjBZCGDfh5TNP/T4PoAmHNtWPeUtZGINXHysJthM2Y=; b=dyRoc/0GW3w1PldoQSxR/7D9JTbpXDNZaKHfiLkv49Hqvie7N+B1BmqsF3/456Dosg Moxg8DkKdtr5jJ6qNj/GOA4tmyQHFEHFZux+urKk4eUXN+YhWr+Zy8zx0BcdCiI0jvon ABGR69/cnHOyn2uAJdlOtrL3BCTvYvTaM2SwvwRoMlHJXQdh/f1qxU5J2GAt+Tt136Q6 rLV9MSXNj+WFNiUTj1kojJYHmH3qhkzntY0yMNSpwO2gKt7E4AtZnDA25yAq0Zsyc/Gm /yLxyF20VBGFC79GXbv/b96zdF9M8HZ9h1aGKzP2tf1hPy6rVa0TwigejE11/fww5oK2 9/5A== X-Gm-Message-State: ALoCoQkLlrj4CLrnTqJ8Bxw6x53+Ou/BCLLH4UqtSmZRxn1rky/JIoM6OwTLufQ/gqMm+42LRSER X-Received: by 10.42.87.140 with SMTP id y12mr4245598icl.31.1398938289479; Thu, 01 May 2014 02:58:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.35 with SMTP id d32ls970832qga.87.gmail; Thu, 01 May 2014 02:58:09 -0700 (PDT) X-Received: by 10.220.105.4 with SMTP id r4mr967060vco.27.1398938289352; Thu, 01 May 2014 02:58:09 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id up2si5965470vec.104.2014.05.01.02.58.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:09 -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.179; Received: by mail-vc0-f179.google.com with SMTP id ij19so3632461vcb.24 for ; Thu, 01 May 2014 02:58:09 -0700 (PDT) X-Received: by 10.220.59.65 with SMTP id k1mr8109965vch.22.1398938289292; Thu, 01 May 2014 02:58:09 -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 ib8csp12951vcb; Thu, 1 May 2014 02:58:08 -0700 (PDT) X-Received: by 10.180.188.134 with SMTP id ga6mr1493175wic.58.1398938288403; Thu, 01 May 2014 02:58:08 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by mx.google.com with ESMTPS id pm7si10553010wjc.59.2014.05.01.02.58.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:08 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.169; Received: by mail-wi0-f169.google.com with SMTP id hi5so448705wib.4 for ; Thu, 01 May 2014 02:58:07 -0700 (PDT) X-Received: by 10.180.96.39 with SMTP id dp7mr1581961wib.12.1398938287772; Thu, 01 May 2014 02:58:07 -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.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:07 -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 29/47] mtd: nand: stm_nand_bch: populate IBBT BCH Header Date: Thu, 1 May 2014 10:56:36 +0100 Message-Id: <1398938214-17847-30-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: , The STM NAND BCH Controller driver has extended the IBBT header with some extra convenience properties. This function populates both those and the standard header specified by 'struct nand_ibbt_header'. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 27a87a3..bf8669b 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "stm_nand_regs.h" #include "stm_nand_dt.h" @@ -741,6 +742,22 @@ static int bbt_is_block_bad(uint8_t *bbt, uint32_t block) return bbt_get_block_mark(bbt, block) == BBT_MARK_GOOD ? 0 : 1; } +/* Populate IBBT BCH Header */ +static void bch_fill_ibbt_header(struct nandi_controller *nandi, + struct nand_ibbt_bch_header *ibbt_header, + int bak, uint8_t vers) +{ + const char author[] = "STLinux " UTS_RELEASE " (stm-nand-bch)"; + + memcpy(ibbt_header->base.signature, ibbt_sigs[bak], NAND_IBBT_SIGLEN); + ibbt_header->base.version = vers; + memset(ibbt_header->base.schema, NAND_IBBT_SCHEMA, 4); + + memset(ibbt_header->schema, NAND_IBBT_SCHEMA, 4); + memset(ibbt_header->ecc_size, bch_ecc_sizes[nandi->bch_ecc_mode], 4); + memcpy(ibbt_header->author, author, sizeof(author)); +} + /* Scan block for IBBT signature */ static int bch_find_ibbt_sig(struct nandi_controller *nandi, uint32_t block, int *bak, uint8_t *vers,