From nobody Sun Nov 24 20:33:01 2024 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-kernel@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?B?dXJxWi9udEJGVFp5a0loTk4wUWtxS20xcHJGVzZvY0dsVHozWi9EOWxMbHhx?= =?utf-8?B?MjN4S20xSjFpc2psekNDWU5BK1lxYnpmSXQ2TVBpdHU1MmhLQ1FmYW1xSWtr?= =?utf-8?B?eHdmN0lheXhYWlpxTnRvYnpITDVpcDRkMmxtVWxRT1V6b1BIbFJtMWg4SG1O?= =?utf-8?B?T1RSYXJIWWZ1YzR5K25lOXg4U2xDdXViRmI5bE4yUXZucGk4L0EyMU1HOUln?= =?utf-8?B?Nk5FME05S1VTR1VoY2JrV2xXenQrTGdTTlNqNTlOZ0FvUXdKenUrbm1YWTRD?= =?utf-8?B?V2Y5d211TGU1TmVYd1ExOGt1S0dPREtkS3RNYzZFanMyOThHaXd5QjlkaGxw?= =?utf-8?B?T0NkU1pFV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= =?utf-8?B?N0kxbVZySHNXdXFzN3Vsd2h6Q1dxQ1NrbDV6WXZrT25QQjZCTGRabnNLNmRu?= =?utf-8?B?UHNjSkswY1FvOEpvNkxyY0M4UEY3aUxOMzU2bmwxaWFuSENXSWxuZ2VvMmpw?= =?utf-8?B?b0liZWJ5ZHduUHdwVCtMbW9rMHhmdFpCTXZBbzlGaWRrUUwvUWxQMlBsMFk1?= =?utf-8?B?eXl2Q0tiRlBnOWQzQ2xrcU9yMEZhZFhDRFdPTjBHZVdJVXI5SDIxci9MSHgz?= =?utf-8?B?U2VNRk93WWR2ZzYybnRiRjRWK3JtWWl2eExuSHJIMmpFa2RFUXFCekJYZHFG?= =?utf-8?B?dTBUYzhweWJYWWxjNWNocHZEaW85WjNhWk1RYVZNNjJIT0JrNExYWHdZZllO?= =?utf-8?B?dUMvdlkwemFqOVB0U0tScTVRazIxcmJvUHUyZWhqbUhiVEIrYWNYSmtBRk90?= =?utf-8?B?d0NqdFNuZWVNUFdkanc0QzdqY0QxWWNVWjhzMEdJdUJTM2VHcUREaXYzWnVU?= =?utf-8?B?Wm52Q3VjUHN0NmdkeTloUGI5WlBBMWJIZWVGR3hMZUNnSWtmY0hwZzgvTnRl?= =?utf-8?Q?D80txqtts6ngCs7J7TQOq6NWObz5ilSRy0hNI=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?B?MDJYekFlekhTUTNoTENKVzBBa3A0WldTWUoxMkFWcE1hbHdXejMzVEJvdVVL?= =?utf-8?B?U0lST3Boc1BoSGN0VlZXMEtsMnRSWWlhVHJlTTdMSlpEOFhCdkFDQ1FaV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RiRUxoVmk4QXpwc0JzaUFWeDNuSEljSHYrNDljMEp1TUFM?= =?utf-8?B?TkNwYk5URmNvdEJQdU9rdTB2K2JIaU1wT2xoWnpyNXFWNklXMXBweTBnRmVV?= =?utf-8?B?czhJd3kyamhITWdNbUJ4RlJrcDFFcUQ0cXVXUEE4eUFzekk1ODBidS95ajlX?= =?utf-8?B?Wm1GRVg3RjJ1azdVRUtxbGkrc3ZTM1d6NHNmemIreXlkUU5FdFF4WFMyQTIw?= =?utf-8?Q?6KL0Jd+weaCtlziymRanb5Eqo?= 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=3D0x01 - sdhc node has cap-mmc-hw-reset - pinmux set for EMMC0_RESET_B - Linux v5.15 Signed-off-by: Josua Mayer Acked-by: Adrian Hunter --- 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-es= dhc-imx.c index 8f0bc6dca2b0402fd2a0695903cf261a5b4e19dc..f106e291c276d0c8063e9ac59a1= 26acf5e9e239e 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -31,6 +31,7 @@ #include "cqhci.h" =20 #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; } =20 +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 =3D { .read_l =3D esdhc_readl_le, .read_w =3D esdhc_readw_le, @@ -1420,6 +1432,7 @@ static struct sdhci_ops sdhci_esdhc_ops =3D { .reset =3D esdhc_reset, .irq =3D esdhc_cqhci_irq, .dump_vendor_regs =3D esdhc_dump_debug_regs, + .hw_reset =3D esdhc_hw_reset, }; =20 static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata =3D { --=20 2.43.0 From nobody Sun Nov 24 20:33:01 2024 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-kernel@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?B?NUN6aGdweWFkRFd6M3lyZFVOLzFrK1BZbW5kN3R6TVB1U1E5K2licXZ5Y3hS?= =?utf-8?B?QmYxZ2xxeWtycEYvSjh6WERESENxWEFueC9wMjJnMkVxaGQ4YjZCZHhSQlRG?= =?utf-8?B?c2JvNEVVT3dlR2ZvSnM2MWtMV1JtSWtJSEFHN0EzZnJ0RDJ3Q3dUa2ZCSGI2?= =?utf-8?B?bUcvcjN4cWVUVGpFbDRUbmNzdmVkSVRVY1J0RmVoS210QlZwWG9BZU1Zc0xU?= =?utf-8?B?alBXVjI5cFJNazJac005dnlsazJzVStWRlJWRkZqdG8zUmVPM2NHYStvSklz?= =?utf-8?B?dVM0SkFUcGlJK0dpWEd4YWZpTlpidCtkM01MUFdGNVFQK2NIYXZpWHA2MVJN?= =?utf-8?B?MUFyL0YrNUlQaVByNURhVmpqQVZOcDUxOF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mSVUwcDZmMGpTRlUwaHVGT3VVZ3g0WXJGQytyMnllbG95MkFEUWh5cXRy?= =?utf-8?B?d1RaV3pZUldnUnppbCswQnF3WXZ1RU9pdW1mdmtnVkRFZXpvK3dhSUJoQUpn?= =?utf-8?B?T3N5WUM0TEJRQ2JzTWttdmtUUjVaYzkyalJRckJTN3ZTV0drTlZ2dDd1M2V1?= =?utf-8?B?Z2NMdXVOZmU5RmJGcG9RVm4wRnZ5NDVkRmlMSTU2MjVibnRHMStqTXRaaG9t?= =?utf-8?B?aWg0blZRNkpUSDFKWWJldEpiSmNlallQd0pZcjJac2c3UklZQzJ4U092ck52?= =?utf-8?B?aFlBVk90MGRqNFdXTzg5LzJPejRkbG8yWXp4K0JyeW1qNHJQMUt2TDloRG5S?= =?utf-8?B?UGVnVHRja2FLZjRpZklSQmlZV1k2VEN3azUyS25TNDJGWlo5VDZlc1ZhUlJn?= =?utf-8?B?bU5vc3h6N1FIb2Q0aVhqbG8yVFdWdWJlSEN4SGlCRkxhVDNqa29KYk4zMnZj?= =?utf-8?B?djFJS3h2Z1A1anFOaXVYeFhob3NNVzM2RVRZdG9FdHRnTDNPcFhNdGUwZi9X?= =?utf-8?Q?xAKB9yzpjItKBDm9JkS7J1qTBErYeibYtnscw=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?B?Ym94RDUzT3BRdnZvdVJDdlR3TmFBZk9mZFhVNEM4cXg0eXErdzJTbHZlYjVR?= =?utf-8?B?MGJBOUZ5cXBRdlY5Z0ZRQURoTVUrcmpCbGs2ckNkNFdsYkJBU2E3Q1JESkVI?= =?utf-8?B?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JGdDB5R29HZ1VXR2gy?= =?utf-8?B?UWZpQzZJQTRTQUdEWEl2REZjRWRybERscDI1Njh2ZFlMd1NDOHdqNDFleW53?= =?utf-8?B?MjlQMWorZ3VWNjMzeWV2WGRaakVDaEREQVA0UmJVUm9QT1NlaFA2dkpkU3or?= =?utf-8?B?dG5HVTBKcTNiTjdlNFovTHpHdmRnYVhMaG9laDVabkpQaHh3MUJLWDFBOU1Q?= =?utf-8?Q?iftgEBHDnTR63sdUGqP9WYMsU?= 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 Acked-by: Adrian Hunter --- 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-es= dhc-imx.c index f106e291c276d0c8063e9ac59a126acf5e9e239e..cda3cc4cc22cfa214369f40f097= ca50937898604 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" =20 -#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) =20 /* 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); } =20 static u32 esdhc_cqhci_irq(struct sdhci_host *host, u32 intmask) --=20 2.43.0