From patchwork Tue Mar 25 08:19:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 27009 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8601320062 for ; Tue, 25 Mar 2014 08:45:38 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf346697veb.3 for ; Tue, 25 Mar 2014 01:45:38 -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=M7+WyjZPJ1bd8ybLCiduiqmXuvGdI6J8sVkeKLZZpPs=; b=cwZKDe0ti1SHZphw6v+d/MxoryZJtJBX/2osuqloZjMKS/jdB24uPXhQBqtcuShz3F a0IIQEym0mP599tXuSXFDzA9PuATc8JO7faYBbQjQIFqH6gMaQYJ9MDWHbUsztzAgmO3 msKDfP2HXclXl0cOMDJzrWEQndttZJgSD61z/THOVVuwXm73Zn7uyxSnmowrEST5r2uy SQx3D6fs1wqWoJY2DZYdEdiOmPR1oGAqiz6NvaJfojV5VOINfAnCIBRi0HtHvfzHjYVF TcE/x4k0ZGgYLcSs8sMqsOamVdFKZSit95TWaDjXMY9QI70bI+oizi5bg4/zoHUsK91K esHQ== X-Gm-Message-State: ALoCoQm7AQzp0uBy28j4IE93w8itPicY0f8XqHMpcWEhPtxRoMgZWnqGdTu/OG1+cVzF4lvccq0F X-Received: by 10.236.144.136 with SMTP id n8mr5597494yhj.22.1395737138280; Tue, 25 Mar 2014 01:45:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.16 with SMTP id g16ls151434qgd.25.gmail; Tue, 25 Mar 2014 01:45:38 -0700 (PDT) X-Received: by 10.220.159.4 with SMTP id h4mr43658499vcx.1.1395737138189; Tue, 25 Mar 2014 01:45:38 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id p4si3594798vem.138.2014.03.25.01.45.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:45:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so159404veb.10 for ; Tue, 25 Mar 2014 01:45:38 -0700 (PDT) X-Received: by 10.52.166.103 with SMTP id zf7mr499591vdb.30.1395737138114; Tue, 25 Mar 2014 01:45:38 -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 i9csp286630vck; Tue, 25 Mar 2014 01:45:37 -0700 (PDT) X-Received: by 10.68.196.137 with SMTP id im9mr75709598pbc.105.1395737137085; Tue, 25 Mar 2014 01:45:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ob6si3198895pbb.173.2014.03.25.01.45.36; Tue, 25 Mar 2014 01:45:36 -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 S1753063AbaCYIVO (ORCPT + 26 others); Tue, 25 Mar 2014 04:21:14 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:40060 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753015AbaCYIVI (ORCPT ); Tue, 25 Mar 2014 04:21:08 -0400 Received: by mail-wi0-f172.google.com with SMTP id hi5so3186127wib.11 for ; Tue, 25 Mar 2014 01:21:07 -0700 (PDT) X-Received: by 10.180.8.130 with SMTP id r2mr21740958wia.14.1395735667677; Tue, 25 Mar 2014 01:21:07 -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.21.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:21:06 -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 26/47] mtd: nand: stm_nand_bch: populate IBBT BCH Header Date: Tue, 25 Mar 2014 08:19:43 +0000 Message-Id: <1395735604-26706-27-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.128.179 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: , 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 e1c71be..2d03113 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" @@ -524,6 +525,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,