From patchwork Mon Apr 16 07:41:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xiaolei li X-Patchwork-Id: 10342319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1483D601C2 for ; Mon, 16 Apr 2018 07:42:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0356C27F82 for ; Mon, 16 Apr 2018 07:42:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBB5B284E4; Mon, 16 Apr 2018 07:42:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F43427F82 for ; Mon, 16 Apr 2018 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UbfR977ZzY7aTAKbG669a1Edw76Ucc4XQ0OGpb4+zOc=; b=uFCH1Iw2QyUBPS YplnkG29pmn+pAVIFK8eYrlli/JjUEMsNuZojaKyBliFXW5PWdgdxyr0uUU6/3+smbjyg8n2glqpb 2lzVwRelBEW2qfAm06my64Lfta+inVQ0Yvdmp8nVpbuxvdOxGv5VIp7FJvzSY1dLwcsWBEUXYAGwu bm3glal6fHpcoPaqmDX1q4XIluAz0wNcKX3YWUgn938wG4HodQ37hNfkAhqDrzzKVqqh2C4uWmRR3 /h2adz0gZJCpork/HyJPLICdviBF06YQfx4Je4fvlLl9YyUu8sE1irc+PDhJE8EnCYvdJ316KbTHW PKGCr4opycJOaai8HAfQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f7ymT-0002X0-Cw; Mon, 16 Apr 2018 07:42:29 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f7ylT-0001qU-PT; Mon, 16 Apr 2018 07:41:31 +0000 X-UUID: 955b0cdc70ee439dbf0f39488826a7fb-20180416 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 222289603; Mon, 16 Apr 2018 15:41:10 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 16 Apr 2018 15:41:09 +0800 Received: from mtkslt306.mediatek.inc (10.21.14.136) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 16 Apr 2018 15:41:09 +0800 From: Xiaolei Li To: , Subject: [PATCH v2 4/4] mtd: rawnand: mtk: Add new nfc capability maximize_fdm_ecc Date: Mon, 16 Apr 2018 15:41:04 +0800 Message-ID: <1523864464-41059-5-git-send-email-xiaolei.li@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523864464-41059-1-git-send-email-xiaolei.li@mediatek.com> References: <1523864464-41059-1-git-send-email-xiaolei.li@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180416_004127_971985_76F8234C X-CRM114-Status: GOOD ( 10.11 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mediatek@lists.infradead.org, xiaolei.li@mediatek.com, linux-mtd@lists.infradead.org, srv_heupstream@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP For some MTK NAND chips, BootROM will access more than one byte ECC protected FDM data, but now we fix ECC protected FDM byte as 1. This will make some chips be failed to boot up. This patch adds one new nfc capability maximize_fdm_ecc to maximize ECC protected FDM bytes if it is true. Signed-off-by: Xiaolei Li --- drivers/mtd/nand/raw/mtk_nand.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 drivers/mtd/nand/raw/mtk_nand.c diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c old mode 100644 new mode 100755 index 03a4df2..7025132 --- a/drivers/mtd/nand/raw/mtk_nand.c +++ b/drivers/mtd/nand/raw/mtk_nand.c @@ -111,6 +111,7 @@ struct mtk_nfc_caps { u8 pageformat_spare_shift; u8 nfi_clk_div; u8 max_sector; + bool maximize_fdm_ecc; }; struct mtk_nfc_bad_mark_ctl { @@ -1151,8 +1152,8 @@ static void mtk_nfc_set_fdm(struct mtk_nfc_fdm *fdm, struct mtd_info *mtd) if (fdm->reg_size > NFI_FDM_MAX_SIZE) fdm->reg_size = NFI_FDM_MAX_SIZE; - /* bad block mark storage */ - fdm->ecc_size = 1; + /* Reserve at least one byte for bad mark */ + fdm->ecc_size = nfc->caps->maximize_fdm_ecc ? fdm->reg_size : 1; } static void mtk_nfc_set_bad_mark_ctl(struct mtk_nfc_bad_mark_ctl *bm_ctl, @@ -1413,6 +1414,7 @@ static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc) .pageformat_spare_shift = 4, .nfi_clk_div = 1, .max_sector = 16, + .maximize_fdm_ecc = false, }; static const struct mtk_nfc_caps mtk_nfc_caps_mt2712 = { @@ -1423,6 +1425,7 @@ static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc) .pageformat_spare_shift = 16, .nfi_clk_div = 2, .max_sector = 16, + .maximize_fdm_ecc = false, }; static const struct mtk_nfc_caps mtk_nfc_caps_mt7622 = { @@ -1433,6 +1436,7 @@ static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc) .pageformat_spare_shift = 4, .nfi_clk_div = 1, .max_sector = 8, + .maximize_fdm_ecc = false, }; static const struct of_device_id mtk_nfc_id_table[] = {