From patchwork Thu Dec 6 13:57:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 1008809 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.b="k62xzQxX"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 439cbz2pQ4z9s3C for ; Fri, 7 Dec 2018 00:57:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 19DE1C225D6; Thu, 6 Dec 2018 13:57:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 01AF6C22573; Thu, 6 Dec 2018 13:57:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7C933C22573; Thu, 6 Dec 2018 13:57:11 +0000 (UTC) Received: from mail.kmu-office.ch (mail.kmu-office.ch [178.209.48.109]) by lists.denx.de (Postfix) with ESMTPS id 3B710C2231D for ; Thu, 6 Dec 2018 13:57:11 +0000 (UTC) Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id CEAAB5C145A; Thu, 6 Dec 2018 14:57:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1544104630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=XIky9zLi/9VaeThfWG+2aIorhf7Ul6MIu8xySso+XCQ=; b=k62xzQxXrYLUaGBQ0cKcr7bru5noyDJTNtyYiIBB9Q1MhUchBz8yRMDlQko56et0tza7tK IETPvgKJYiw8QxOLkJupZ047XU+EArs2BuT+CFBBopoEaUyATV/oHJl6GUxxVr9OWXQmKg boexCOO+dqFZJfC2fUA5h8Lgqr5AOcw= From: Stefan Agner To: u-boot@lists.denx.de, lukma@denx.de, trini@konsulko.com Date: Thu, 6 Dec 2018 14:57:09 +0100 Message-Id: <20181206135709.8518-1-stefan@agner.ch> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Cc: Marcel Ziswiler , Stefan Agner , Max Krummenacher , miquel.raynal@bootlin.com Subject: [U-Boot] [PATCH v1] mtd: nand: raw: allow to disable unneeded ECC layouts X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Stefan Agner Each ECC layout consumes about 2984 bytes in the .data section. Allow to disable the default ECC layouts if a driver is known to provide its own ECC layout. Signed-off-by: Stefan Agner Reviewed-by: Lukasz Majewski Reviewed-by: Miquel Raynal --- drivers/mtd/nand/raw/Kconfig | 7 +++++++ drivers/mtd/nand/raw/nand_base.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 008f7b4b4b..b06c45788a 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -9,6 +9,12 @@ config SYS_NAND_SELF_INIT This option, if enabled, provides more flexible and linux-like NAND initialization process. +config SYS_NAND_DRIVER_ECC_LAYOUT + bool + help + Omit standard ECC layouts to safe space. Select this if your driver + is known to provide its own ECC layout. + config NAND_ATMEL bool "Support Atmel NAND controller" imply SYS_NAND_USE_FLASH_BBT @@ -81,6 +87,7 @@ config NAND_OMAP_ELM config NAND_VF610_NFC bool "Support for Freescale NFC for VF610" select SYS_NAND_SELF_INIT + select SYS_NAND_DRIVER_ECC_LAYOUT imply CMD_NAND help Enables support for NAND Flash Controller on some Freescale diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 92daebe120..6d2ff58d86 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -47,6 +47,7 @@ #include /* Define default oob placement schemes for large and small page devices */ +#ifdef CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT static struct nand_ecclayout nand_oob_8 = { .eccbytes = 3, .eccpos = {0, 1, 2}, @@ -89,6 +90,7 @@ static struct nand_ecclayout nand_oob_128 = { {.offset = 2, .length = 78} } }; +#endif static int nand_get_device(struct mtd_info *mtd, int new_state); @@ -4339,6 +4341,7 @@ int nand_scan_tail(struct mtd_info *mtd) */ if (!ecc->layout && (ecc->mode != NAND_ECC_SOFT_BCH)) { switch (mtd->oobsize) { +#ifdef CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT case 8: ecc->layout = &nand_oob_8; break; @@ -4351,6 +4354,7 @@ int nand_scan_tail(struct mtd_info *mtd) case 128: ecc->layout = &nand_oob_128; break; +#endif default: pr_warn("No oob scheme defined for oobsize %d\n", mtd->oobsize);