From patchwork Fri Nov 1 11:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 13859259 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2131.outbound.protection.outlook.com [40.107.22.131]) (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 7490919CC28; Fri, 1 Nov 2024 11:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.131 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461355; cv=fail; b=qpVyTk5fJ/lEmapJYoy1ywvfaQM8MOk2lWcKEeBv4t/G9Dy6/eHApCJD827xqvTfZ4rtZAZiV42uAPLuN1lXFHIamJEL94c3zKSbTqQSzPYVhu0WxCkSvhRSZGpy1gI8PVbeRmRnJ4hxUznLsLnJtjt0MbZ8k/AR5O79yl+sPfI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461355; c=relaxed/simple; bh=zO9QyWg1HxuSZS9GnPm683YlvKYH/nq9G0g9teQTtrM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=rMYxdkDkmfrIzAk61kZWhWp6a/Id5uo9dy6mHonD5AI81S10TXS3qVZfqoZ5iyMZT/a7VtPIScbHfjKtPZUupnz+T7A122HMsMH1GI7/5pvV/fKl+FePINc+prEDZbfOrPCPlWwjOMaC9/bJBzExTnEe7qjb3aeEDhkxe4LcGBU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=solid-run.com; spf=pass smtp.mailfrom=solid-run.com; dkim=pass (1024-bit key) header.d=solidrn.onmicrosoft.com header.i=@solidrn.onmicrosoft.com header.b=VfAr6WXS; arc=fail smtp.client-ip=40.107.22.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=solid-run.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=solid-run.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=solidrn.onmicrosoft.com header.i=@solidrn.onmicrosoft.com header.b="VfAr6WXS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lrZfXUXvIJEwvkf0iQiGKqkXmWBHKnOjFx2AwQhAUIzlvKKR9wvh1raMhuRfvSkhnYvC1MqYLM24OkS26N54/NjYQeRcRLIn/mfIxJ0/5dlTtP9bLpXQhK6UTBss/ikaWN0PNtXbZmVUfQcWnEWEwzenyHW9kWnL/7NeAMSyeZkOL+YbGhjFnB/fQ8MyNJUs02yPb9KrqypbzNyDZ56ZAwQ5bxr00vyBVq7zEtyb6wlBQ3smx8ZzYjbZ/uooxuP1d9uKP5oU84ML4okraFBu9A5vnAkB0/wAMqi2whR+2dwB0n9ZQ1ky1H5Bgjs73M909Xd6gLQDxbwBap2qPD8CtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Ssu+82ASPw6IayQqExCdYLnky9EubC2EVJ6pOZJqtFw=; b=jEKXHsNeq1dMMwkUrDT6zTFTb+IvFOK1e6x1CoDLXge+q19PPjZEuUkPjPiCM37KnFCnyDeECK8ZDzsXyP8odexkToJzENeAWYBhd08dLnApmZ6Pk8QcAzOPO10LczP1jmIoP12yLxqZY+85uNrTOJHr1xrQXqmkOIW1zBTbF9KDV7ZNwt66c0IgIAQeT0Hkt6GXRRXDY8/tgRZqOTPWaXSteQG1pxHhIEuVbIRds6TG5xUTfXkiCWeOUYlnF+oF9S/p58nQD0PeU/IxFC/CUlW3pMypsBLLbKHUqIGC5i4zuueRcS12LsYSBAH0OigmL2nthNM3klC+DN56YzRI4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=solid-run.com; dmarc=pass action=none header.from=solid-run.com; dkim=pass header.d=solid-run.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solidrn.onmicrosoft.com; s=selector1-solidrn-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ssu+82ASPw6IayQqExCdYLnky9EubC2EVJ6pOZJqtFw=; b=VfAr6WXSms+wanyp12OEN3qUDRrjKOTKZGrVU3w8+dCyc3xubvxt60wk6NMctwdTi/PpNDzVUhSo7cyBQZb4eAPhU6webfJxkroyAkxQdddhA+dkJPemuD5Nm1ChkiRXoIjVqE/YVaSawegcj9hMbEV/A2FBYpm1Scz09CcFPko= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=solid-run.com; Received: from AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) by GVXPR04MB10519.eurprd04.prod.outlook.com (2603:10a6:150:1dc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Fri, 1 Nov 2024 11:42:29 +0000 Received: from AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529]) by AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:42:29 +0000 From: Josua Mayer Date: Fri, 01 Nov 2024 12:42:25 +0100 Subject: [PATCH v3 1/2] mmc: host: sdhci-esdhc-imx: implement emmc hardware reset Message-Id: <20241101-imx-emmc-reset-v3-1-184965eed476@solid-run.com> References: <20241101-imx-emmc-reset-v3-0-184965eed476@solid-run.com> In-Reply-To: <20241101-imx-emmc-reset-v3-0-184965eed476@solid-run.com> To: Adrian Hunter , Haibo Chen , Ulf Hansson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: Mikhail Anikin , Jon Nettleton , Yazan Shhady , Rabeeh Khoury , imx@lists.linux.dev, linux-mmc@vger.kernel.org, s32@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Josua Mayer X-Mailer: b4 0.14.2 X-ClientProxiedBy: FR0P281CA0198.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ad::8) To AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB7586:EE_|GVXPR04MB10519:EE_ X-MS-Office365-Filtering-Correlation-Id: 7771ca19-1c55-4594-60a6-08dcfa6a43bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?urqZ/ntBFTZykIhNN0QkqKm1prFW6oc?= =?utf-8?q?GlTz3Z/D9lLlxq23xKm1J1isjlzCCYNA+YqbzfIt6MPitu52hKCQfamqIkkxwf7Ia?= =?utf-8?q?yxXZZqNtobzHL5ip4d2lmUlQOUzoPHlRm1h8HmNOTRarHYfuc4y+ne9x8SlCuubFb?= =?utf-8?q?9lN2Qvnpi8/A21MG9Ig6NE0M9KUSGUhcbkWlWzt+LgSNSj59NgAoQwJzu+nmXY4CW?= =?utf-8?q?f9wmuLe5NeXwQ18kuKGODKdKtMc6Ejs298GiwyB9dhlpOCdSZEUoiJRDhdzSLdxtU?= =?utf-8?q?VODCzBz4E4JOt1IfGlisfJ4dslCh/ks7tZlpu6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qk21rboPu2ehjmHbTB+acXJkAFOtwCjtSn?= =?utf-8?q?eeMPWdjw4C7jcD1YcUZ8s0GIuBS3eGqDDiv3ZuTZnvCucPst6gdy9hPb9ZPA1bHee?= =?utf-8?q?FGxLeCgIkfcHpg8/NteD80txqtts6ngCs7J7TQOq6NWObz5ilSRy0hNI=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB7586.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?02XzAezHSQ3hLCJW0Akp4ZWSYJ12?= =?utf-8?q?AVpMalwWz33TBouUKSIROphsPhHctVVW0Kl2tRYiaTreM7LJZD8XBvACCQZTmmv/p?= =?utf-8?q?pc3E7PwDOHKXCbgg1+NVkzyJpcOJ8zLsH2Piw/qe7DO09Jl0F0WZie+N4zVeZ0qAu?= =?utf-8?q?lp1uxnXnk/PPaAGM96PhlQMl6fMUUusVyTNjKMdgDHvUFTBg5wyOM6UqkJLrMM6O9?= =?utf-8?q?wu9TD8lTtDdjCbfkMdzaYsfw+TNheRzLJAwkcOpCcZumea0ul3QpHVCqHLYqb6roU?= =?utf-8?q?vxz6SoRneceKDe4ucXgmwlRrlD/3eqz9vqf7esfTtDjmlm/79NCq7kTI15Pmm8BJJ?= =?utf-8?q?bJWvlSD7BexziArakk/E8QeC1Vbpr8ZzxbL43RhmXEdHhkxJL1ai2rD7/dWb1ulId?= =?utf-8?q?wQ+ruTLjNRgRXqbYF3YKJPqI5Ml/OEHp2VC6/qovv7amjBlxUMTDB/v69kUzFsUqJ?= =?utf-8?q?LgfJPddk9fIcW7ifTI9h/UoKtAwEk9QI3yqQi6nKzj4ft0YjbqBrS9veNbP6rpxoA?= =?utf-8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qV6IW1ppy0gFeUs8Iwy2jhHMgMmBxFRkp1EqD4quWPA8yAszI580?= =?utf-8?q?bu/yj9WZmFEX7F2uk7UEKqli+svS3Wz4sfzb+yydQNEtQxXS2A206KL0Jd+weaCtl?= =?utf-8?q?ziymRanb5Eqo?= X-OriginatorOrg: solid-run.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7771ca19-1c55-4594-60a6-08dcfa6a43bd X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB7586.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:42:29.0868 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a4a8aaf3-fd27-4e27-add2-604707ce5b82 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: h/iSfmaj0yCVt3JDmODgswWZipX98QWa/lrXkDsJNgXDj3F3MANTaW57nL1OxENNNm+wDUCWuuLyd7Kca1Jzmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10519 NXP ESDHC supports control of native emmc reset signal when pinmux is set accordingly, using uSDHCx_SYS_CTRL register IPP_RST_N bit. Documentation is available in NXP i.MX6Q Reference Manual. Implement the hw_reset function in sdhci_ops asserting reset for at least 1us and waiting at least 200us after deassertion. Lower bounds are based on: JEDEC Standard No. 84-B51, 6.15.10 H/W Reset Operation, page 159. Upper bounds are chosen allowing flexibility to the scheduler. Tested on SolidRun i.MX8DXL SoM with a scope, and confirmed that eMMC is still accessible after boot: - eMMC extcsd has RST_N_FUNCTION=0x01 - sdhc node has cap-mmc-hw-reset - pinmux set for EMMC0_RESET_B - Linux v5.15 Signed-off-by: Josua Mayer Reviewed-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 8f0bc6dca2b0402fd2a0695903cf261a5b4e19dc..f106e291c276d0c8063e9ac59a126acf5e9e239e 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -31,6 +31,7 @@ #include "cqhci.h" #define ESDHC_SYS_CTRL_DTOCV_MASK 0x0f +#define ESDHC_SYS_CTRL_IPP_RST_N BIT(23) #define ESDHC_CTRL_D3CD 0x08 #define ESDHC_BURST_LEN_EN_INCR (1 << 27) /* VENDOR SPEC register */ @@ -1402,6 +1403,17 @@ static u32 esdhc_cqhci_irq(struct sdhci_host *host, u32 intmask) return 0; } +static void esdhc_hw_reset(struct sdhci_host *host) +{ + esdhc_clrset_le(host, ESDHC_SYS_CTRL_IPP_RST_N, 0, ESDHC_SYSTEM_CONTROL); + /* eMMC spec requires minimum 1us, here delay between 1-10us */ + usleep_range(1, 10); + esdhc_clrset_le(host, ESDHC_SYS_CTRL_IPP_RST_N, + ESDHC_SYS_CTRL_IPP_RST_N, ESDHC_SYSTEM_CONTROL); + /* eMMC spec requires minimum 200us, here delay between 200-300us */ + usleep_range(200, 300); +} + static struct sdhci_ops sdhci_esdhc_ops = { .read_l = esdhc_readl_le, .read_w = esdhc_readw_le, @@ -1420,6 +1432,7 @@ static struct sdhci_ops sdhci_esdhc_ops = { .reset = esdhc_reset, .irq = esdhc_cqhci_irq, .dump_vendor_regs = esdhc_dump_debug_regs, + .hw_reset = esdhc_hw_reset, }; static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = { From patchwork Fri Nov 1 11:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 13859261 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2131.outbound.protection.outlook.com [40.107.22.131]) (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 9254D19F489; Fri, 1 Nov 2024 11:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.131 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461360; cv=fail; b=sk82hAkR+Xj0c35RYnvfkLOGefx6vwOo79Z9PeHM50QGAbTVshycthAm0cD55P8m3T08Skk79iINjCRaHNY+DTp2qygOGKelplrWuDyV0RpZ8SgAFGLaLj6jQUplszkchhJH2iEMEKUAB8dGumNo3jiaunqA3+hzzrc9fPBWeLY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461360; c=relaxed/simple; bh=Ad3uKT55GOIx6uaCx6MBEJw1o2aiHTFI525cnshoTlY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=IUeRX9lTkIWKgyF7BSPwMKCCbk1cKKKySIwiJ9KQIn1VQtlbWwZ4PBjNV2q54YY+vR2J5GCwfUNwCtU3ffuEloEgk3Anxdqd2KIEsMK0SQyj7ZoAgVbELhMTAxOZB5MblvxcpQ0qx1JMwb8H3dGYcVDut/eEoSgvieplTbjdPLo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=solid-run.com; spf=pass smtp.mailfrom=solid-run.com; dkim=pass (1024-bit key) header.d=solidrn.onmicrosoft.com header.i=@solidrn.onmicrosoft.com header.b=fJxT86Ky; arc=fail smtp.client-ip=40.107.22.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=solid-run.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=solid-run.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=solidrn.onmicrosoft.com header.i=@solidrn.onmicrosoft.com header.b="fJxT86Ky" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RvHJMw07XP9iTT3tC9oAyLX/pnAqdskA6vaCewpo8TER1Z0+LL0LEk40VBEEiR77TuVZ5+7jvW4ujMGRbNBCbuzvjHVl9fgnsd05YZXL5dWDyrxemULf+jLXRpBLGkEpdS6oby5FgMabroUN0By3ximIqL0BJVp0U4FozjZI9Cr2pTYZuphqAmWiXinhPuIfY2Pq450UGmz+pf3sBkI7WymyjHLRJP9x3X32wz/kjdeDUSspYavphLX+ww2IenZYFMVaYZwV4dMJq1aqKvmclEUItocG1maEdD6gArnN/zBxqFhLYpFknMAKIyBHnySoOkcbOmutPf0Qp/xABPQYnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=+9ANHnSWP27iHbc+a8ou4FqQNkq16ExJMF8UFj1ohL4=; b=F7FUPjWVafc+2YvvUfU06x6yLqZnGNiefUbuZd8W9Sh8BlCjZ9ZCzfxBJ7Rpjjj3fALLSRiIXUuJacS5SupD5PA/fc8cYJF0L8JYWv/X16z78KUNRf/5Wt9J3MVOr3jtIHd4L7zQlawXf05JtnkqaCaMFtbUmqVVZR4HFHDYVn0cL5vYkCtqZZWSiucWldtUC5Z1rIwQqnoLErlfdoRNebIYhNKdef/VDH5JLmS9UsPy4jUl5xCO82Exl3pmSlbxkNuO+t8QBjeHR6nCztoEKGjdQTgl5KNcuqcL789mr0O9Hpvk7ieJrtLA1SF04p1YFjZBh7o08K/kPfmAe51q9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=solid-run.com; dmarc=pass action=none header.from=solid-run.com; dkim=pass header.d=solid-run.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solidrn.onmicrosoft.com; s=selector1-solidrn-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+9ANHnSWP27iHbc+a8ou4FqQNkq16ExJMF8UFj1ohL4=; b=fJxT86KyseNYwA5ki6LoqEbxYNG88HzmFQNe+owi3lF4oe0cN5W6cJ4k+IXf0uHp68qgyVD3mAhw+i2CbL7fTrrOo58ecRTpbCZ08kzh3gWLJ+4aJ+2Baduc3QkC/ei0P/bTNclcQ9M9fc4/cu0NgXCKarB7xOgh/LOBA95yFEQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=solid-run.com; Received: from AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) by GVXPR04MB10519.eurprd04.prod.outlook.com (2603:10a6:150:1dc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Fri, 1 Nov 2024 11:42:29 +0000 Received: from AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529]) by AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:42:29 +0000 From: Josua Mayer Date: Fri, 01 Nov 2024 12:42:26 +0100 Subject: [PATCH v3 2/2] mmc: host: sdhci-esdhc-imx: update esdhc sysctl dtocv bitmask Message-Id: <20241101-imx-emmc-reset-v3-2-184965eed476@solid-run.com> References: <20241101-imx-emmc-reset-v3-0-184965eed476@solid-run.com> In-Reply-To: <20241101-imx-emmc-reset-v3-0-184965eed476@solid-run.com> To: Adrian Hunter , Haibo Chen , Ulf Hansson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: Mikhail Anikin , Jon Nettleton , Yazan Shhady , Rabeeh Khoury , imx@lists.linux.dev, linux-mmc@vger.kernel.org, s32@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Josua Mayer X-Mailer: b4 0.14.2 X-ClientProxiedBy: FR0P281CA0198.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ad::8) To AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB7586:EE_|GVXPR04MB10519:EE_ X-MS-Office365-Filtering-Correlation-Id: c715eac6-49d5-42cb-6696-08dcfa6a4419 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?5CzhgpyadDWz3yrdUN/1k+PYmnd7tzM?= =?utf-8?q?PuSQ9+ibqvycxRBf1glqykrpF/J8zXDDHCqXAnx/p22g2Eqhd8b6BdxRBTFsbo4EU?= =?utf-8?q?OweGfoJs61kLWRmIkIHAG7A3frtD2wCwTkfBHb6mG/r3xqeTTjEl4TncsvedITUcR?= =?utf-8?q?tFehKmtBVpXoAeMYsLTjPWV29pRMk2ZsM9vylk2sU+VFRVFFjto3ReO3cGa+oJIsu?= =?utf-8?q?S4JATpiI+GiXGxafiNZbt+d3MLPWF5QP+cHaviXp61RM1Ar/F+5IPiPr5DaVjjAVN?= =?utf-8?q?p518SrYmdWPImubPnvG5PFqS3mGWsVySC/TjT0kLXI9d7qYorYoX5tYVpKXWdE0MI?= =?utf-8?q?EQCyWL6IKJFMviWzNUVAHrIO1MzSPbavED/rhN6G0cpw5LgKtYV12AQGRuxyBZa3s?= =?utf-8?q?mNLazY5YWpQHvXr3EY3e3vVfuuFsVqVSqY1pBHDol/dU6ep//dhn9s8OZtG1Rq4/d?= =?utf-8?q?LZ33frBmDkIHwEO0ogHPCtEhGzd3yoRjqsRHerleI/WWzIWtZ0HaVEwz8Fj14FhTX?= =?utf-8?q?q/xHQvUodytNJf/xikdAMELQckE+1/XG+4w9mnsCiC2ni+TNbU2tm7cL1CcxxIOFX?= =?utf-8?q?sXVf4gTQQzBCfklRGUwyQpoUOrGVMq7GYwILujwd6m988sSq4nrLFQ3jfUrIr3X85?= =?utf-8?q?zzIIunavT1pqrXpQCciXqP9K1rQ+uZJ3aoRzcPdPwS63MssIQc32K+eyoRhgQqmRi?= =?utf-8?q?11oHXKdFlt5HeP4472JZXV9i2KD6Cjc+01Fsw/LuO6SIi+7zWcyWfgSYV0vZu4zFz?= =?utf-8?q?HsA/0mG35cjUB/pVPOCl04yTz9d2YJG9GE9xeUoygIIqCUiU3XCox41yno4c6MPVl?= =?utf-8?q?rWclE0QOQTv3faXOwZd90ZQRLUmCU3FIXeQcfzITqtyaJ2NRjt/lqpdZuw9jEut3S?= =?utf-8?q?XIITUYfIU0p6f0jSFU0huFOuUgx4YrFC+r2yeloy2ADQhyqtrwTZWzYRWgRzil+0B?= =?utf-8?q?qwYvuEOiumfvkgVDEezo+waIBhAJgOsyYC4LBQCbsMkmvkTR5Zc92jRQrBS7vSWGk?= =?utf-8?q?NVvt7u3eugcLuuNfe9FbFpoQVn0Fvy45dFiLI5625bntG1+jMtZhomih4nVQ6JTH1?= =?utf-8?q?JYbetJbJcejYPwJYr2Zsg7RIYC2xSOvrNvhYAVOt0dj4WWO89/2Oz4dlo2Yzx+Bry?= =?utf-8?q?mj4rP1KvL9hDnRPegTtckaKf4ifIRBiYWY6TCwk52KnS42FZZ9T6esVaRRgmNosxz?= =?utf-8?q?7QHod4iXjlo2TWVubeHCxHiBFLaT3jkoJbN32vcv1IKxvgP5jqNiuXxXhosMW36ET?= =?utf-8?q?YtoEttgL3OpXMte0f/WxAKB9yzpjItKBDm9JkS7J1qTBErYeibYtnscw=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB7586.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?boxD53OpQvvouRCvTwNaAfOfdXU4?= =?utf-8?q?C8qx4yq+w2Slveb5Q0bA9FyqpQvV9gFQADhMU+rjBlk6rCd4WlbBASa7CRDJEHqua?= =?utf-8?q?kpyrV/utTF2SbMUdQ682KcEBwg/Dx0OR/i3BPtA3HQmoplCoWVLNjb4GF2jqdyH2X?= =?utf-8?q?TZBP8M9DRECzM4asdVbNKERlaOBx/H/d2LFc5CgPuzgmmwY/aO6OYT7R8a7DSQ0bC?= =?utf-8?q?JDKBEAjUjj4TfSX6PxeIBLZTHWdRUKAaywzAfclyMyxem6tOxYdz+PBNkALj3vHd7?= =?utf-8?q?acaFjmvnYvuSVgTvbcyXennbdaYNvJZSx10MBF/ArDWt3joIbKzlVlAIDSS03qEjL?= =?utf-8?q?pOryOig5/prBdCem/PEoTx30NLJjNUXiy1i9df4m/22e9kLmDIxr0Hx6IYQF4NzPI?= =?utf-8?q?etrOWgcQR+VeOciJ5nJlu87VCqh9/VU6hc7xMKRjK19QriIB/agKyppWqZqvlwtE8?= =?utf-8?q?LEM/8vqlUO3grg5xtTh7PMDpHim0z3BKvtHSbdwqCA0LOolToOT2pDb7STYNLrKhv?= =?utf-8?q?T1r0RBHgo0lXWjFatChPp3bpIOSV9UDtfK8iwsiik0lzzTNA/cSljfPDlrjHctrkH?= =?utf-8?q?qJpf5Hliyj1gf37F3qaASP1v7w4YiJbj1+IrElbG1JSVhB261scg7lTJcpKTr/Agj?= =?utf-8?q?IhKU6gO3MzJd+s8ja7Im1aqgSGe6PMQP6J9xoR5wN2q2XjI9lDxal/Bv93BriSQJs?= =?utf-8?q?TmNlZJCcMDEe8HvIQ3DhZ5GWC9uGRbBURKeeDCToEcRUydIG9gM1986bCLF4OhGGu?= =?utf-8?q?mC5uIBO65oaW6fp7CmKE+6ultv/oTucZrTQ/KmqnZnE5q6ER3QuIsxMOb4lMFI5ZZ?= =?utf-8?q?R2utmEyNBQHsnHIMe1t2m94+rvcWk4EPGUw0AVROdhEn7U+ousC8O+yXAZFE8IslW?= =?utf-8?q?4y4UVCh77QDMewXC9yE8lHkrXUNCVwXvHEieY0f579hqp+ea7/z4fNKVSxSyNwUj1?= =?utf-8?q?ofX5ewAYjqxmwvqP7tbaEHks5XOPzfJK2M+iDBCVtxG0rcIbhOdD8yFXEmt6+l5+5?= =?utf-8?q?yjy99CLgSzLNp1vW2176XDka5y8UJINWJIx9shKb2of1e+G10Lebrobrt9KM8/KPZ?= =?utf-8?q?4yo39U37ldBIaxTehFWbQMwc1L0gkYUSNvszTBntNtYFsSnDMa7QHLUF1bk0ID+zA?= =?utf-8?q?Wt9O5wJAnHylBSZCnDGgNXWm3id9iUT+Mnukr+dXEcvV5uDSawWX8OeIf31+5cTJS?= =?utf-8?q?DdZ5uF4NRVd7+6wweLzpnj6owde2rXaamhLoHvu0fd7YTl8bp07MDgvBX4UI/emK/?= =?utf-8?q?dNU5yUwrtt2T/MKdsCxSHL6z9+oI2Nrb8ydMwMxD6TYALtoZ4yJ2Ef1PCSc9y0LMt?= =?utf-8?q?plI6SCTNmOENiFGCznrs5nu78aY+aomFHbFt0yGoGgUWGh2QfiC6IA4SAGDXIvDFc?= =?utf-8?q?EdrlDlp2568vdYLwSC8wj41eynw29P1j+guV633yevXdZjEChDDAP4RbURoPOSehP?= =?utf-8?q?6vJdSz+tnGU0Jq3bN7e4Z/LzGvdgaXLhoeh5ZnJPhxw1BKX1A9MPiftgEBHDnTR63?= =?utf-8?q?sdUGqP9WYMsU?= X-OriginatorOrg: solid-run.com X-MS-Exchange-CrossTenant-Network-Message-Id: c715eac6-49d5-42cb-6696-08dcfa6a4419 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB7586.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:42:29.6750 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a4a8aaf3-fd27-4e27-add2-604707ce5b82 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: POYOjLJUggeu5eT94CLjylHqTV54mUOO2GbJMtywXP887PX6rot5v0KKxQmV4lmanj8GrUPcgFwLOdzbnL3UJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10519 NXP ESDHC supports setting data timeout using uSDHCx_SYS_CTRL register DTOCV bits (bits 16-19). Currently the driver accesses those bits by 32-bit write using SDHCI_TIMEOUT_CONTROL (0x2E) defined in drivers/mmc/host/sdhci.h. This is offset by two bytes relative to uSDHCx_SYS_CTRL (0x2C). The driver also defines ESDHC_SYS_CTRL_DTOCV_MASK as first 4 bits, which is correct relative to SDHCI_TIMEOUT_CONTROL but not relative to uSDHCx_SYS_CTRL. The definition carrying control register in its name is therefore inconsistent. Update the bitmask definition for bits 16-19 to be correct relative to control register base. Update the esdhc_set_timeout function to set timeout value at control register base, not timeout offset. This solves a purely cosmetic problem. Signed-off-by: Josua Mayer Reviewed-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index f106e291c276d0c8063e9ac59a126acf5e9e239e..cda3cc4cc22cfa214369f40f097ca50937898604 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -30,7 +30,7 @@ #include "sdhci-esdhc.h" #include "cqhci.h" -#define ESDHC_SYS_CTRL_DTOCV_MASK 0x0f +#define ESDHC_SYS_CTRL_DTOCV_MASK GENMASK(19, 16) #define ESDHC_SYS_CTRL_IPP_RST_N BIT(23) #define ESDHC_CTRL_D3CD 0x08 #define ESDHC_BURST_LEN_EN_INCR (1 << 27) @@ -1386,8 +1386,8 @@ static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) /* use maximum timeout counter */ esdhc_clrset_le(host, ESDHC_SYS_CTRL_DTOCV_MASK, - esdhc_is_usdhc(imx_data) ? 0xF : 0xE, - SDHCI_TIMEOUT_CONTROL); + esdhc_is_usdhc(imx_data) ? 0xF0000 : 0xE0000, + ESDHC_SYSTEM_CONTROL); } static u32 esdhc_cqhci_irq(struct sdhci_host *host, u32 intmask)