From patchwork Fri May 17 18:09:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13667293 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2049.outbound.protection.outlook.com [40.107.20.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F56713E889 for ; Fri, 17 May 2024 18:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715969439; cv=fail; b=ssNMyzALyuPH4t/euJyu3R8Gq+7jP7uMpjRVP9hPcPkgGMKWfu10CSSST1AhhV+737a/L4MjdKkcDQLHRHL1uWTETV5vA/eaGfg6t0E6fGnAdxTAhUiLI9A2mcHZrmRRcO+84CinNOaxGjvLH64Fz6sQdGoRryVkvCKrqoeS5Ok= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715969439; c=relaxed/simple; bh=mS55mB0B81i2jzK8aFUR+tBesadsu4zXCQs8Ez1y5Uc=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Ox0flWgOV1Wv+OaL5ac+oS5TW+qd4HAtSHWaOTM7F6tQWC/Xn+iEQ3NZ2uiAiVzVeqebu3VfJb8qr1BEIemW9Ex+BanQ8k1X15fgK9/qVFUUhe6ZED5sMeUAOC8fB2EvJsO69uLherwBWeqC89jE0Y+f5G4WFs++wZSptlS/E2Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=IV5ZbHFg; arc=fail smtp.client-ip=40.107.20.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="IV5ZbHFg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mUQwLQL+BitKkw1BBiT82uucblRz/simhhVilBCEAasLLbmM/WSgcGmRAsMHyiiZxTBPpeQvZIt+H0m9IvOCSJC99MUmupfRqtPkCviUD6tuWRpmXizeKRWOAdOm1iRveXyypfj5l6bCqpho8dG+YmEehUNgEZcPhUzyCvTAV3srFtahGmQi8JcQA/BYkfkye8b1YjqwPOmRjRwKBSNWRI0ZAeZOwRID0Kms8q/aN/9ZCRmiE4Rw35w+CPBmo7taXFt2fwdFErd7SookHPRl5LRytlimbnoNUvrADeZHG2yp7gpuvAf3rtgfNImy/mHxRaUSGTDHC5LWUJS7AOJDDw== 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=l4quWV2qkIm5xWoBSTGQnQ1nY52gQwn77fcAR/3/rUM=; b=fbX3gT71Zh4Yn6Prlz2/MZBWoyldRt+jFJFJ5Vxq/TLoxqH+53JjjxJffOrQEosVxxAgwXcnUMgJEwrxyoZiwI+MbESkh8hqh+83WlijUwuY75Zgz7BH4ixHa18bfz0bQqWc1g735bZM0RhIO613XeNxZJqKEkDyV693zS234rVhWZlf7ulOiTln/iyldYsKvwRx0D4dRTNR5aCYUvXS9dgjltFymGb2aZCjQJm2BMN0VWty8m7wQ+Y5wBEoToACV5XczoFFMawMOTZcS8zEqAK1wmoHJqYYlHtYUrhNBZ8PcZuQTu/o0Ej36nMR+sY8s27iTWSNv7QC6Kkz3WvGmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l4quWV2qkIm5xWoBSTGQnQ1nY52gQwn77fcAR/3/rUM=; b=IV5ZbHFgDHSituuWhEbrig6CHeQdB+JNDYjyhmM154pzII6ygS6WPCbjNtAcTYqwQY2lmPQVuPl1V8tNX41vKTYLfswR0a1Z6vodwV6hJPMLb03uUisLCUGSVVyB3lVO0DJktygdRd5T09nmt+BCcEMCpnt/9OOkXbl5kCNduIg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM9PR04MB8955.eurprd04.prod.outlook.com (2603:10a6:20b:40a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Fri, 17 May 2024 18:10:35 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::1e67:dfc9:d0c1:fe58%7]) with mapi id 15.20.7587.026; Fri, 17 May 2024 18:10:35 +0000 From: Frank Li Date: Fri, 17 May 2024 14:09:50 -0400 Subject: [PATCH 3/5] mtd: rawnand: gpmi: add iMX8QXP support. Message-Id: <20240517-gpmi_nand-v1-3-73bb8d2cd441@nxp.com> References: <20240517-gpmi_nand-v1-0-73bb8d2cd441@nxp.com> In-Reply-To: <20240517-gpmi_nand-v1-0-73bb8d2cd441@nxp.com> To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Han Xu , Vinod Koul , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Marek Vasut Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1715969417; l=3753; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=CT8TVOogkiD1sCNEuMtwYfAYmoevJdAWdpfcK3/H/Go=; b=0ySFvdr7+0aWxJEZ8rt/BXV/2UsIkccjO7gGQYlX6wnGAI/cAu2n7sJLRvpDKSkzTx1n5PrPc 1iqLQON1vZLA1K1Qw6bHM2vFRzGXJ/E0+kJGB/TqwQml7VpCU7pdWp9 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR07CA0068.namprd07.prod.outlook.com (2603:10b6:a03:60::45) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8955:EE_ X-MS-Office365-Filtering-Correlation-Id: c57aea81-fcfe-4282-aa6d-08dc769ca5f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|52116005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tV7KCyK8ajiCxL88BLtqjuZM6fL+QM6?= =?utf-8?q?vhT6LyjV7GT4iigcQilP6TzMjfnAf+mDW/eBc4H8vVc0QOk6qTM5MpisP27qQAhL7?= =?ut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?q?H16MmVwJ8aPEHhr8JdZLSYuIrZOTwpamU8IP/4+HIeWGHlB1ju6K0KeMxv7wyoSZ3?= =?utf-8?q?7NjSrBhkjv5f7oUtRdDUSdbMcUd8kHp2cumPWaPbw+ay4p3iYzzb3kGP8ftS76eRE?= =?utf-8?q?qanaYrsj7fwLjmNRZ6dAOy2WqL0uNzLdxKp8NTJGzEPSYcXTBQRxDa69igsdLr4ca?= =?utf-8?q?Rb1RNyGLTjdOrZt+KU8dFBqTcfJf0Ayp19uuntRZvtOgjxtpnY/jSV7/99vFKiJGy?= =?utf-8?q?fxzinDEGiqPZMRxL//q7bHjnJnUfbVrV9wX2nwBqoV7BDUNNj8TSpXUxVKbYdAVxp?= =?utf-8?q?Bf1U5CFqih5mWZxtF44VlEuG96hWPCDnj/WiDhxX4CYX7aCe9GNcuVKc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(376005)(52116005)(1800799015)(366007)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gYuEGSiOPqh+EHlQ/9sEBWbRAFvI?= =?utf-8?q?BWmHKYCkuj534C1NdibK3Ce+8nkfpMQprRjjIs24gPv4imh2YqzB3BREUIoQ8mfBk?= =?utf-8?q?CynMoyt7fvFpNJXTG/5kH7K2bHT6cWAweIsE7NV5yNHJ5ODVZnB4J5Xh0bSnUBmxk?= =?utf-8?q?AL/Ldd2LxzTI1rHxI3ZsTskTmTkxRjWmfh+Ut0KD3LQ38DFbEAZYLFHbqRHX5FQFI?= =?utf-8?q?EbuAU4caIpvp9tISj2NBYhs6npPjqlKeG4WGcewtgjcO81JuggJgxJpjkBgfKwL+v?= =?utf-8?q?V24O3sF2q9tmPVvTP9pAUZzd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urwiz9IAT0TSkXJom/4da/mBbVJ+qXeJ37oEWIu?= =?utf-8?q?m03eOoUoFWu6C+P/boSTniKdqkO+yfrJErrfWcNc12RAFa87Tguk71L6NPm58s4VO?= =?utf-8?q?446IFwFDDd9gzC8LJKM6gj+1X+qZ4mr+kSDWwaBnc8vTSrQ98kQy0scv57RQ32Nms?= =?utf-8?q?2Ohmws6QnDLc8sn0gnoBHN2SH9w+6tn5Fk7makLz+orhu8wMGNOyTf6IvVrq8P9ky?= =?utf-8?q?y32wvQigQTOx/uzj4egFaLsl+Zk3497G8gj7uM51anMLUsBDQkxkZ6S/YHRh4hijy?= =?utf-8?q?9zCENbXPLXBobAwQvkc5VVw9phvHT9aVixkqmQq/ZxsQqsuNwqRxtntltz44QdLNK?= =?utf-8?q?n6Et7dm1Z4ok?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c57aea81-fcfe-4282-aa6d-08dc769ca5f7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2024 18:10:35.2184 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j+hpbiHWBVMw9wdJu5cFAEZvPIu2f4mxBGQy0LJodcyLAUPlrGMnbcNBW7OUycUHHg8NBvtXWp56HXfiwCrVdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8955 From: Han Xu Add "fsl,imx8qxp-gpmi-nand" compatible string. iMX8QXP gpmi nand is similar with iMX7D. But it using 4 clock: "gpmi_io", "gpmi_apb", "gpmi_bch" and "gpmi_bch_apb". Signed-off-by: Han Xu Signed-off-by: Frank Li --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 20 +++++++++++++++++--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c index e71ad2fcec232..f90c5207bacb6 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -983,7 +983,8 @@ static int gpmi_setup_interface(struct nand_chip *chip, int chipnr, return PTR_ERR(sdr); /* Only MX28/MX6 GPMI controller can reach EDO timings */ - if (sdr->tRC_min <= 25000 && !GPMI_IS_MX28(this) && !GPMI_IS_MX6(this)) + if (sdr->tRC_min <= 25000 && !GPMI_IS_MX28(this) && + !(GPMI_IS_MX6(this) || GPMI_IS_MX8(this))) return -ENOTSUPP; /* Stop here if this call was just a check */ @@ -1178,6 +1179,18 @@ static const struct gpmi_devdata gpmi_devdata_imx7d = { .clks_count = ARRAY_SIZE(gpmi_clks_for_mx7d), }; +static const char *gpmi_clks_for_mx8qxp[GPMI_CLK_MAX] = { + "gpmi_io", "gpmi_apb", "gpmi_bch", "gpmi_bch_apb", +}; + +static const struct gpmi_devdata gpmi_devdata_imx8qxp = { + .type = IS_MX8QXP, + .bch_max_ecc_strength = 62, + .max_chain_delay = 12000, + .clks = gpmi_clks_for_mx8qxp, + .clks_count = ARRAY_SIZE(gpmi_clks_for_mx8qxp), +}; + static int acquire_register_block(struct gpmi_nand_data *this, const char *res_name) { @@ -2281,7 +2294,7 @@ static int gpmi_init_last(struct gpmi_nand_data *this) * (1) the chip is imx6, and * (2) the size of the ECC parity is byte aligned. */ - if (GPMI_IS_MX6(this) && + if ((GPMI_IS_MX6(this) || GPMI_IS_MX8(this)) && ((bch_geo->gf_len * bch_geo->ecc_strength) % 8) == 0) { ecc->read_subpage = gpmi_ecc_read_subpage; chip->options |= NAND_SUBPAGE_READ; @@ -2692,7 +2705,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) this->base.ops = &gpmi_nand_controller_ops; chip->controller = &this->base; - ret = nand_scan(chip, GPMI_IS_MX6(this) ? 2 : 1); + ret = nand_scan(chip, (GPMI_IS_MX6(this) || GPMI_IS_MX8(this)) ? 2 : 1); if (ret) goto err_out; @@ -2721,6 +2734,7 @@ static const struct of_device_id gpmi_nand_id_table[] = { { .compatible = "fsl,imx6q-gpmi-nand", .data = &gpmi_devdata_imx6q, }, { .compatible = "fsl,imx6sx-gpmi-nand", .data = &gpmi_devdata_imx6sx, }, { .compatible = "fsl,imx7d-gpmi-nand", .data = &gpmi_devdata_imx7d,}, + { .compatible = "fsl,imx8qxp-gpmi-nand", .data = &gpmi_devdata_imx8qxp, }, {} }; MODULE_DEVICE_TABLE(of, gpmi_nand_id_table); diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h index c3ff56ac62a7e..502f01a8338c3 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h @@ -78,6 +78,7 @@ enum gpmi_type { IS_MX6Q, IS_MX6SX, IS_MX7D, + IS_MX8QXP, }; struct gpmi_devdata { @@ -172,8 +173,11 @@ struct gpmi_nand_data { #define GPMI_IS_MX6Q(x) ((x)->devdata->type == IS_MX6Q) #define GPMI_IS_MX6SX(x) ((x)->devdata->type == IS_MX6SX) #define GPMI_IS_MX7D(x) ((x)->devdata->type == IS_MX7D) +#define GPMI_IS_MX8QXP(x) ((x)->devdata->type == IS_MX8QXP) #define GPMI_IS_MX6(x) (GPMI_IS_MX6Q(x) || GPMI_IS_MX6SX(x) || \ GPMI_IS_MX7D(x)) + +#define GPMI_IS_MX8(x) (GPMI_IS_MX8QXP(x)) #define GPMI_IS_MXS(x) (GPMI_IS_MX23(x) || GPMI_IS_MX28(x)) #endif