Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2974167pxp; Tue, 8 Mar 2022 05:37:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/7cbMrW/hZJe9NgQHssZ1XM/tEi7pmCNfdpIC3RuoC/dY5Evzbz4hWvxQapi+Yps9wQpC X-Received: by 2002:a05:6830:b96:b0:59a:9186:920b with SMTP id a22-20020a0568300b9600b0059a9186920bmr8353163otv.372.1646746651971; Tue, 08 Mar 2022 05:37:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646746651; cv=pass; d=google.com; s=arc-20160816; b=FSiZC8K6K6oSFX0oXqwacdl9LSxeMRANYUzg5SLv73QWYXz/TRxNsPP/Pfl/4mEa+X tXEqmF/FA4l6F95+eIsObeAbBCyEY1t0EqEXDBiUZOQ4js8aC6HV5EBd2yKMaDt02Vrt 2xtjpE3ihbCfetWl3vkJXvycbjqTCItiqX1IvE/ZxS7M6yEqBbxC2zem7qDgq4VLDTf+ ob22kVnE5/13xSdbQ6K8if7IuSp/AL58IKeEiSVUC0ALjNU6T1Gq3kkIyRAmjfig+5Ks ykEs0oNCagrSoQ3KwwmYgPNCXTw2HSKq2A4GabJtwvoFgczCwrpuiEdEcopeWB3c1b2E YGRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=diTjgBGPncoJwBHe+9NDm/od+MBbyK06HlZStJU1uIM=; b=jSj62ULYIu4OzBZ2WfDAjkgQn6sOV1Ezpul11sOwxlQYop4S5sFLrw7ko1Na5BF8Te A5K0692nXLNMcm4vTPylynwIni169Y33EgPhFHgeRgE0vRXIZ+4izEyLmyzaXR0nl7gT cwSDC6gGNqxJc+SJzXgaBM/QJGi6EuKreHgj3tbMhYOBTzrC691RmvVefE+jPpvIobih abzJLQHxutx6HtN2A3HlK887nbvO7g3JMrrTOA1y3n5vek/31xC7gTwVrDraGEiGOyRA 7N7ADRSDNFtopvbizljGd1CuWL/o86YTCp8nuLf2EL2qHEpjk3rcFZUXS3Z4JSQiaoLI sEyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@variscite.com header.s=selector2 header.b="GeL0OVm/"; arc=pass (i=1 spf=pass spfdomain=variscite.com dkim=pass dkdomain=variscite.com dmarc=pass fromdomain=variscite.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=variscite.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a05687012cc00b000da3db4ba1asi4600858oam.110.2022.03.08.05.37.16; Tue, 08 Mar 2022 05:37:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@variscite.com header.s=selector2 header.b="GeL0OVm/"; arc=pass (i=1 spf=pass spfdomain=variscite.com dkim=pass dkdomain=variscite.com dmarc=pass fromdomain=variscite.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=variscite.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243218AbiCGOdX (ORCPT + 99 others); Mon, 7 Mar 2022 09:33:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239640AbiCGOdV (ORCPT ); Mon, 7 Mar 2022 09:33:21 -0500 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2058.outbound.protection.outlook.com [40.107.22.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FEB931360 for ; Mon, 7 Mar 2022 06:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHv6XbBT10V6ys7QcNyw4SndyVlcesZduWmQTzxu1SaiAI9/noLWPDqSvoinSUUzhX5nuHguV6VPfZD+gksyVvu5aJsuLDxs5Xrqi3DYoDwPvY89HQYpmwUKT3Sh7IzosyHfekdcd4zRbeO2hOeB5A8toqeaTviR2dP/KJQmFxj5qLKs3U2FalcghytQL9YwSREh618UCwJTymIPw4MwiwVQGpe/IGLmSKmxLC2I6GuG/GPjS/VYH7OnwtTgl+gDS6FFySVp/L+ScCsjIuPixFSvBgfB48LLFTpbgwNl74+ltRX5Z6SoTADOd3huw/qPfowtoDhLKQBY3M45r/+5XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=diTjgBGPncoJwBHe+9NDm/od+MBbyK06HlZStJU1uIM=; b=ZouipMtVm3Pdxe5gvO61LDVlngv3qwVX+UcEYcNG8yx0Afz9NLL5dxnegFX2Q2Wqn6upIwv2nKUhoJJp5bOTibPZ8SMK6ur+xT0nANiU3cRREZsSQH7+ai9kNAI5I8D0N74cUeMIsgtweYpvCPXF2MzUQADRiiV6sRGL7u3+tRlaUQdwYrC71UEF7pv/24XhC5ZfyzPgxb8g4cv2fiMWXALiTheGairqdJg2opXQ3BRbo6DPGa7nn7a/wO8MnRYRAa0tLPBdRZrOTvpppjFQcLEJF85o5U8o6QvssNwlupCSoPRgmmfjuRtdXT4kGueG9Yn7XfqPJc3iwiYrRiSrsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=variscite.com; dmarc=pass action=none header.from=variscite.com; dkim=pass header.d=variscite.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=variscite.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=diTjgBGPncoJwBHe+9NDm/od+MBbyK06HlZStJU1uIM=; b=GeL0OVm/KAFVRi6yXnYkUtvRq9tCGZj7dw1GD9t/A5onzB2fXS5PcefvpZXXHnIYP8xO0HfKvLTzj19XS6bwQ1n7nywTdik2DZLyKXt9TTtF1rTb5qWe7N4HORsmoUzEZb+SFmM8sCrHsgnILe8HYYkG0UNHtRI/lWF4z1B8npYti/XCPFsDsE9eVqJrYmOWGNATWDJDipWb1drJ4glv8lcnlnn+sy+DTQ40NdTnvH8bBScEPErdfDlPO5S4xUPmDwJiqrC4sOm5PYyDTblIVt9nn+ytS8pI3o9DBaJ2h6W15eIW1/6c0V8FuEiMQT69P8YXtYJd5lor8wmC0TgIxw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=variscite.com; Received: from AM9PR08MB6999.eurprd08.prod.outlook.com (2603:10a6:20b:41a::7) by HE1PR08MB2922.eurprd08.prod.outlook.com (2603:10a6:7:2e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.21; Mon, 7 Mar 2022 14:32:22 +0000 Received: from AM9PR08MB6999.eurprd08.prod.outlook.com ([fe80::784c:5631:d38f:9a63]) by AM9PR08MB6999.eurprd08.prod.outlook.com ([fe80::784c:5631:d38f:9a63%6]) with mapi id 15.20.5038.027; Mon, 7 Mar 2022 14:32:22 +0000 From: Alifer Moraes To: linux-kernel@vger.kernel.org Cc: eran.m@variscite.com, han.xu@nxp.com, linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, pierluigi.p@variscite.com, richard@nod.at, vigneshr@ti.com, Alifer Moraes Subject: [PATCH] mtd: rawnand: gpmi: add support for legacy-bch-geometry Date: Mon, 7 Mar 2022 11:32:02 -0300 Message-Id: <20220307143202.28474-1-alifer.m@variscite.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CP2P215CA0044.LAMP215.PROD.OUTLOOK.COM (2603:10d6:102:2::30) To AM9PR08MB6999.eurprd08.prod.outlook.com (2603:10a6:20b:41a::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5296dcdc-8036-42bf-17b7-08da00474a86 X-MS-TrafficTypeDiagnostic: HE1PR08MB2922:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: konwxPuLM6KI3RbZ2p1eUZ2NtqJVNkPdkD9CRxkVPpDs9QUIRVE0C+VSVE7/YJGdY2f3+7AvXw5rSPmy7Ma1csuXiyaBRqm2RqVlp3Vu4Ek46AhKtoOjaoGfECFm5Kmb+15ng1hI1b+BU9KVCPbFbwl6cbAOTKiXx5aDi+19ZUeUDWDyDU5dHOX2d6prAo2c1zn20Y30J0ih2+lJp401VwbCI5m1pqZm4kkaeatVF+Y11+mW8hKNqusJCPark7C0RFPUnHkRbBAHP+qayctjKrQ6a5s5O3UorfOvxCYFA90Q5ZTzy9gWC3HeCeRetXFbzPzX2I4aio6PBsXTbF+FNlu0+x4bfIi4PIyVhJsbsxot6k5RKknXdsJ1tYr93PPMA3U23ViqGgogEIKQJDlp2pHNBkYfEVTxL1MpAHbLtMdS+AydqwE875QE6n5ZZfB5sO/IithvehqeWMbsfcIhn7lZMNsTSaCRIlK4wISss+2FDtrCE2TO+2defR9Uv7plvy/WjRPBN8rmMz5aHWXQqCQZ1AvKsqk+8NW8KpYPAeaA2c4ojSy/6SiRzvjYFDdIfRywnhC8E2bcjfN3M5clm6dLILrRc8gCI9VMZ0TaIWp2fC6h4x2rS2l7vc9AvdNqdYsyr/PKKXwbC2mUQfsUqrMz2406R7ykpda/UETnwQKMaEdLdjoxRTK+jzBDDnhqkgovct06dbCNzFcv+xbaHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR08MB6999.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(136003)(346002)(39840400004)(366004)(376002)(396003)(107886003)(6666004)(186003)(26005)(2906002)(1076003)(2616005)(52116002)(66476007)(86362001)(8936002)(6506007)(38100700002)(38350700002)(8676002)(66946007)(6916009)(66556008)(4326008)(6486002)(316002)(83380400001)(508600001)(36756003)(6512007)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?j+6e/QB8dds8kk3e6UogiwBgjVrsCCuAqBMwbo9UOkXgNwLieZU7nfUxFNeD?= =?us-ascii?Q?aejgb2e+smyxxX99nS85AVxC3TAwrTkybB5hjeSRZDDejEe1u/VpgO0xqh7Z?= =?us-ascii?Q?K/6e9D9iFxFkGgMgLVj2lM/wjIkmzbHDGUSU3O4EiVuNX9YeYHJ0i+fdvCyZ?= =?us-ascii?Q?tMNpl68TnB8iJD4Zo1Vd0D4Gn4UcH1xKC3h3CtVDci49bKsZQFetio577rHa?= =?us-ascii?Q?DQil/ugCGnvVGMCZAYxZ5HNOHToyW2AsbWOmeO21YgvgSr6jIbGCEVJomt7H?= =?us-ascii?Q?8OqJQYMoLnE8j6yDdXbz1zm7jlQ910jmoBDLtXfTVwEOvK6+6JB5Yoj9UXgJ?= =?us-ascii?Q?wiTcia/vAmJjnQQOI2PcLmAZncqjfuEbtwyQ1OJB7PC28qtBsVluiRGLRiE2?= =?us-ascii?Q?5ZLM8Rb1ojGKM2fndpN5cvZGJ+b6JXHVFHOYlPzyuYX3QQDKrWb00hf5fey2?= =?us-ascii?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J72pGByUa/fpvPnys6OfM+?= =?us-ascii?Q?OO+Bsh/cqigOZihbAT/yIE/Tq7eWAsY2JiMPYmYKC+RebLqfTfjU4WlUgpNf?= =?us-ascii?Q?49lTn7nlhpkqPi1l1EVFdke4Hqe4pbhZrvKkxcVnjsxzDFShm8REDCoN56gm?= =?us-ascii?Q?bD+o5qZ9woJU9kTgrPgdpgNfga0hEzLWDJQOORVRxOlFR3WqNPW6V5nvDSIf?= =?us-ascii?Q?UE46kk4tW9WxrJ4NhohUol1WICYlqD04UdCuBVG/RQShxLWEbrWSheay8gAw?= =?us-ascii?Q?/FkPJfWVa/CnmNaHeB0CLjk=3D?= X-OriginatorOrg: variscite.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5296dcdc-8036-42bf-17b7-08da00474a86 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6999.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 14:32:22.0576 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 399ae6ac-38f4-4ef0-94a8-440b0ad581de X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QkyNNIcKljkIqge0tPpDl55iC/7EFORKWBfLQ1L/gES+0SRCe4iQyeu1qOEDRqoSLzqbLsOoR2Rsia5k0B3LLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2922 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierluigi Passaro For backward compatibility, allow supporting legacy-bch-geometry as in original NXP releases. Signed-off-by: Pierluigi Passaro Signed-off-by: Alifer Moraes --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 9 +++++++++ drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c index 1b64c5a5140d..ae375115ef0a 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -517,6 +517,11 @@ static int common_nfc_set_geometry(struct gpmi_nand_data *this) const struct nand_ecc_props *requirements = nanddev_get_ecc_requirements(&chip->base); + if (this->legacy_bch_geometry) { + dev_warn(this->dev, "use legacy bch geometry\n"); + return legacy_set_geometry(this); + } + if (chip->ecc.strength > 0 && chip->ecc.size > 0) return set_geometry_by_ecc_info(this, chip->ecc.strength, chip->ecc.size); @@ -2072,6 +2077,10 @@ static int gpmi_nand_attach_chip(struct nand_chip *chip) dev_dbg(this->dev, "Blockmark swapping %sabled\n", this->swap_block_mark ? "en" : "dis"); + if (of_property_read_bool(this->dev->of_node, + "fsl,legacy-bch-geometry")) + this->legacy_bch_geometry = true; + ret = gpmi_init_last(this); if (ret) return ret; diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h index 5e1c3ddae5f8..d9926cf3d5e0 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h @@ -151,6 +151,9 @@ struct gpmi_nand_data { void *raw_buffer; + /* legacy bch geometry flag */ + bool legacy_bch_geometry; + /* DMA channels */ #define DMA_CHANS 8 struct dma_chan *dma_chans[DMA_CHANS]; -- 2.25.1