From patchwork Wed Oct 30 13:37:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 840353 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2138.outbound.protection.outlook.com [40.107.104.138]) (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 C9F983FB31; Wed, 30 Oct 2024 13:37:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.138 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730295475; cv=fail; b=LrJDWIPyzTtHBnzbDh4t/9tREKIrGicmeI65YjUYRmjVzkLraXSA79HP91rsppeaGwBQcsRl5Sgzn+RWeR8oTscVag5+K4rW3LZKlsxvUVWrcrsEqQnxInnY1P3VU/pXsaukeLkJWyUdgJtB77/PJMFSpn9yG6ClydNlPCD+mg8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730295475; c=relaxed/simple; bh=Iz6D86BJ+v1kD30AlF3lE87DOG5fspHhe5cXH87xy+o=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=YDhoC8b/qbO88wGaf+hW07i/N92v5svRHu3+pNBGxVF8KA1nHp3+ZKzXxqCwbl6rADw1S8yJctNszrqUtoVeUVhAO1r1ZZaStGIxusybDCrrcTvEnEBhnjVw+3r+WPl5pw3tH7wogeXpZG3DmHuJVkQ1au5Pm8TZ4KlIjevee2U= 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=hJK98ixX; arc=fail smtp.client-ip=40.107.104.138 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="hJK98ixX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G0nkapL0KZpG/tYEmA6VRDKMOIEHOLn3kb3dZSu6HBEkyiT8z5pEawK7Tp3xpV2esZiXQHbLhAlnxr/v5XBZ5Xdj2uZqGJHVH4H+2mdAe3bc6ONjGEVN6ZyxRMRY53FY2mOfGM19j16XDWaqd33PVQJlSUVBQZsJGIaIya8iOLWN1L3RlGvkKFxNO5OmmuYJPmW6CCxRVc/l0OwHs54z1X5/TicbEL4nDJXCzFBRAHI2tXMXFYajZMRFnIqYgPjQwEqkByIuyCx7JxVMVak4LpkJaKKd7YlHbOwjDocRVzMEHGDXXNrlhpIIgZW4CxWUO9W86BXFp5SnjLWwuz7e3g== 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=5e184kCNwhO8v3NLRlRa1rf3Zevj3HAR1mS/hzlzijk=; b=WMNchNrfCtIPfNW/74lL9lBU8f5Fvpea7JsBuDBdRxJAvjR27rxEbkMv3sxLAFMwxq3E5/snYfJwdO8g4yE7dS+ODwcZ1hgWsx8V7niczNGks7JyNz3CAFtGEDDAn9ntMTaMrjxfEAI2pXAg7lOQ7lKOlFyrWsMAQHQnU03C5q/GsTlNBmKgnCtLQguJDjSeFkROUn5j7Q1iIvqy3/iCx025tAZtq2vvqwk/VsynO30TXe331RN+y8czH5YWlkCGkkjfLleMKJXVKtRlN6mDT2mgitqy8uODX3bIfDM2oj/GkV/1S7Dmeh0iWeeD5AzkVbNPlghUZCs1TWF2M10hLQ== 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=5e184kCNwhO8v3NLRlRa1rf3Zevj3HAR1mS/hzlzijk=; b=hJK98ixXQPBtTu8nYwR6huE7m4GUiVwm1mFAmlY++ABNo3a1qwL6sgemmGHw/wMfe6iHB5VyjXkRVB3kGNpD+4WSLRRzdk5O1Sq0VnjX9Fh+MOXmco7MmAKUp20L7Kk6Bi6m21eEPLUXKM1P/8v2eW8pVViWMVwVCa8LB4/wC+8= 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 DU2PR04MB9097.eurprd04.prod.outlook.com (2603:10a6:10:2f0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 13:37:49 +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; Wed, 30 Oct 2024 13:37:49 +0000 From: Josua Mayer Date: Wed, 30 Oct 2024 14:37:43 +0100 Subject: [PATCH v2 1/2] mmc: host: sdhci-esdhc-imx: implement emmc hardware reset Message-Id: <20241030-imx-emmc-reset-v2-1-b3a823393974@solid-run.com> References: <20241030-imx-emmc-reset-v2-0-b3a823393974@solid-run.com> In-Reply-To: <20241030-imx-emmc-reset-v2-0-b3a823393974@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: FR0P281CA0165.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b3::13) 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_|DU2PR04MB9097:EE_ X-MS-Office365-Filtering-Correlation-Id: d0a6f39e-3e48-445d-a19e-08dcf8e80b9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7dknJK1BNuct3Hgvfh4rsAT3HebufXk?= =?utf-8?q?9bLR48KMwaE41OmVVRxtoqUFI+AYk+bf1RVHKKuLaGR7iRzrl/sDFaL2SGReaO4o3?= =?utf-8?q?5kKUrUY9Cgq4AJqrpgjNONgEwN+J3UiPR/0gY2seKJk6+TMp5f6JLP6kNF2p/NoEf?= =?utf-8?q?S2KUaNNbr0kXSSbLPZSkvy38OiYvZvcPDEh7i1d6EB/8ul8e0t4Ej9kmfTbkFZZYf?= =?utf-8?q?oO9OrjZtzqgiCgoJUvqlQR/h+YI8865Kphx6GWESFgbiys8JCSUTsb8zMnfw0gANt?= =?utf-8?q?mdT7ZwplivY0GeyNBTP62grohUX98iJxL8NRIRV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QQwdy?= =?utf-8?q?6S6CRTBCuArLAarJvz5JkUdRGvl6nkJnRuT5DDY/BxbZqZmTpj5DLd/ox1zA2InY0?= =?utf-8?q?qy6Mh2oeIZxGdKEqpYSOmtbjEYdW9jfjyFJku5YVqFpdZLBwOy2SnaTE=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)(366016)(1800799024)(52116014)(7416014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?psSIFqXXJwuLUF4N/Tbrc3HwUSAF?= =?utf-8?q?1nGz+3255iCI0hjmZ1njxuL6Lg/5VdSY+20oV8iPBeNzXkpgFSKJgGRbsgQfTV5mz?= =?utf-8?q?L1J+zCJDK4+Nchmmp7vah2fOFOpE2MuvGh1S2Ltnct1F5jFw8cMioWtzqd2otP20U?= =?utf-8?q?EKHq6XcKPCjX42wTJU07gJDdz/zhGWfLrpN6qoTG2F3mqFAhYruRBjbHfHyfzg8Ax?= =?utf-8?q?ZUl3PTJBLK80TXNJDKiSw1f0TISXakqxNYNVjbVsz0Q5mLe9mzpGNGyhYZt3oF4T0?= =?utf-8?q?yxadkjrzw6vXn027erehmP4utq6umDAEa3OdkCFnsVu0yOpSz89Z9mGe1jywwvyOE?= =?utf-8?q?1PUu7HBDWwwFbpCKqujnvM6EIdjP7JZr9lJUkqTp4C1DFbVMDB24ScvaZpJj07xpt?= =?utf-8?q?FAJ2nloZhbZXZQNdzx64Uig+qg5CH781kEjaUSD8FJp7GSZ5her4LRx0BZo+JKxZn?= =?utf-8?q?PJ7f8lSV8TISbiNjGbWP7o982cMuxs2ObFebC/jQxSJfIHPbXtGOdwu/NDlGeB9qk?= =?utf-8?q?Ug0MYU3pUbdeISkyREeHgn7mhbyf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naR9hYBeNsredUjcgTAgJQ/6FKU/mzaYCSgG6OKUme6+Z4?= =?utf-8?q?HSRUypQU7X3m9ZTVHvZjwRKk5XKtRUPnEfs1m1VrmIoeAVP1qpU7z2acdiHSf8qs1?= =?utf-8?q?F2j7DYjQc8it?= X-OriginatorOrg: solid-run.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0a6f39e-3e48-445d-a19e-08dcf8e80b9b X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB7586.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 13:37:49.8078 (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: EvzdhCrEiEXgd1UDtNpdDXY4EjVU2bAg1BJEWEd/aB0nZOrqGuOTpe5VBK8g/jV81oEPPD2nyRv1JghgBZcPrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9097 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 --- drivers/mmc/host/sdhci-esdhc-imx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 8f0bc6dca2b0402fd2a0695903cf261a5b4e19dc..a830d9a9490408d3148b927bf1acc719a13e8975 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -33,6 +33,8 @@ #define ESDHC_SYS_CTRL_DTOCV_MASK 0x0f #define ESDHC_CTRL_D3CD 0x08 #define ESDHC_BURST_LEN_EN_INCR (1 << 27) +#define ESDHC_SYS_CTRL 0x2c +#define ESDHC_SYS_CTRL_IPP_RST_N BIT(23) /* VENDOR SPEC register */ #define ESDHC_VENDOR_SPEC 0xc0 #define ESDHC_VENDOR_SPEC_SDIO_QUIRK (1 << 1) @@ -1402,6 +1404,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_SYS_CTRL); + /* 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_SYS_CTRL); + /* 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 +1433,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 Wed Oct 30 13:37:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 840352 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2138.outbound.protection.outlook.com [40.107.104.138]) (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 CBEA81EBFF7; Wed, 30 Oct 2024 13:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.138 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730295479; cv=fail; b=aJZ5qAjt38CQBCFRiQc0j4HzwzelLSxQnsK1yE3pELrI/6QhI8ubTqnuc+/wPrlCUOy7EudhBztt2qyOmDChAfSG8VyfZkgkff0xyubHR4SblwzQ4rENwyU44Zyk7RN8Wuf0Hc1YzerfB8t0YN+PtkuSbd5PG2njbMlyF9qAysE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730295479; c=relaxed/simple; bh=R/R185xnjGDxDDQYHhH52g9GjQICuTSmE2mmrB/4DdQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=tpPfedczuE7mShE1ql+lG1Tuu4FuoRIy4Zk/X2pv5Oh+LIqGFNnojaViapMqkiQAhEOLnKzaXsteYMdczP3uKQvMvSRbonbyG1qsSJKy4b/iwR90HzN+Sg6DRTWbWV6YzGZKoeOPpV2YhqDFB5O3gJZdgXCaTst9Nod8NoMj1/8= 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=RDAa6fS7; arc=fail smtp.client-ip=40.107.104.138 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="RDAa6fS7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cbSqH2YV/Ck0VJd2RhSe2i/lV4E1Yp9fGL67awahdd+u+UjgEJO9CDRmWxvKyWv6hPynf2Wg3AW/vPNLXXvwyrc8qEgKVzaMe+R2wp+zHwkkc5GNNm73fIg0pI3aDiAO3+FVS/aCBQp1S55MHzsCZv4KorbRLKY1BUVxxWRnRby1zphJru78mGV04peNpj9z+vHzHPdOGU0BnsSBkN6zgc69PltJFaBwEj1jNx83tPj6T4WXFE25y5QyC3swzunQ4lDcTTm0d+n6IFhUxIdWtRnjFAAqCOMK/yPtpBBp58ZxXVdXJ97BOyIUhKMYlar2+h1apZxAP01YUCJSCSKTOw== 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=5CrzKIeNV3LC1Yjtw8TgAbW2jPPZymVcAdYMB9FufyY=; b=SdJFcn1ccaUzNjVSKnS2JgMrgrMaoxBidcWa9yyDVbeGla5uphao93YymG32AlkozIbf2R2G9skZUetU9x7TJ5ObmLIS1SddZdquCHW30NAUBb+qN30EruxZmNopaD1ualCAs22tNwp0kZVr+ZzOM16NPqpmbJuneYJgg3/QsAfrG5RSLKEtZ1ORjT1L3nlrYHo1ILYMwTB87Hjmn8F/h5o0eRF0CsKUWCzGkYnOZ3KN3xgffTjzTWKf7zgl2aZpSsBgrFs2U594NwxBd/IWGCmgH9ukZ/uyrtWhF1mYVoNPAcx5mWNDZrP9qTHx2Q76JgaERpZrqcRc6vNL1suE1g== 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=5CrzKIeNV3LC1Yjtw8TgAbW2jPPZymVcAdYMB9FufyY=; b=RDAa6fS73cDYJywNWlxw5lqJ+pgYMuh1za+Rh6hO2yqJh6LkXHz6JS63qMWl0zrfEgTK0vtxshw52+2wGknpJN/itRkqeHaIpOEZf9aoJgAv5/Yp48LcsJnjXOroSjy8j1o0JZ6fVgIqXYE28Mg3J60IOLnVG2WuIqTsp6Pdpmg= 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 DU2PR04MB9097.eurprd04.prod.outlook.com (2603:10a6:10:2f0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 13:37:50 +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; Wed, 30 Oct 2024 13:37:50 +0000 From: Josua Mayer Date: Wed, 30 Oct 2024 14:37:44 +0100 Subject: [PATCH v2 2/2] mmc: host: sdhci-esdhc-imx: update esdhc sysctl dtocv bitmask Message-Id: <20241030-imx-emmc-reset-v2-2-b3a823393974@solid-run.com> References: <20241030-imx-emmc-reset-v2-0-b3a823393974@solid-run.com> In-Reply-To: <20241030-imx-emmc-reset-v2-0-b3a823393974@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: FR0P281CA0165.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b3::13) 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_|DU2PR04MB9097:EE_ X-MS-Office365-Filtering-Correlation-Id: 93c4eef2-d44a-4a48-262d-08dcf8e80c62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0HZWmxww7Jyu1piLd1B8MVUauDgXFXJ?= =?utf-8?q?mnqE7Nus387rjhwQRdier+Zfc8iD+nTcWhobvyI4b8BmGkkvHUCz8QknoBi2wB5Ny?= =?utf-8?q?/sdCQkSAp8DtzGj37jdGFowRuw8iicAOsxXiguVemPa/Wth4KwgEa6djR2mT2tC9C?= =?utf-8?q?xAz0mGwMlMqIiN/o+FD9Ls9lpg8SDA68TzA6Yn2NUMMdOFEo8BJpqKtIDHLhNKxDu?= =?utf-8?q?TnAN/3Insb5aNey1Zk1msJLhCyLBXrEhKU4EK4Ka5tFNzcK3biD1KZVAIfG4uFPU0?= =?utf-8?q?3kvaqEtIF609fshNrsDFn5984Dh8kTfw/nIzY0PDBSG5DNi79ydkCt5FbKgKCZDCW?= =?utf-8?q?K7zchRuzvXWV4URabYk0dGniEBKMbyj0cQsQWAQ4+QebgB3B1VJMzuJaIirZAvYOS?= =?utf-8?q?lfTql5gbr1Xvx6taXfDlNV1SGW2IyhHuXCL6Hn8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ucBwuNZNj6J8VdVc=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)(366016)(1800799024)(52116014)(7416014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NYWw35ehtMsND8h0tKYPH6GL7/n3?= =?utf-8?q?o2qZIc+3PSObArETIRMOiAN4CaKuP9DGhbhqDpbXh/dCLb+xK3IDe2XIbLn3Ntnby?= =?utf-8?q?t6aol70Fymv/O3CX0BhbP+RIpP10SD3hH/ak2WtlfCcu6bco9/0bWiQMim8JBB+oC?= =?utf-8?q?c+FL7PoDc1RPy6VTGRB2q7a9/zetRlXBC0/tYHLh9FhkgLQBNy1ii3nDckCoPPm/S?= =?utf-8?q?5o3n7QTvRJ55XwonMXop42I/3aZWT944IllLusaig6lYcWBj61Qdh7v5/dycQZLF/?= =?utf-8?q?4pIeWM9ExUOnvwNXulJnQGq0nhlYd7wCUnORZBPGZvO43FH8NNa+kSDalZBz7kgQ7?= =?utf-8?q?kECniu3SNXWLUnV5CbvqiBVoLHUWN68yYd+w2PZa2LwPTA7exN7XOHJaA8NIooaYJ?= =?utf-8?q?UNsrwbuxf/dI1vSjDqVYigXh3wULYBHDsOErH0gFjkz3KVK769bXG54iq9IscJ/oV?= =?utf-8?q?UKb82xOJ43llnpOE1Ws3INNpi43+gzuibr3eZy81Y5xEJrDFkv+UGRqeO0bBGDLUD?= =?utf-8?q?i7HelAPKbbNNPgdriiGAF7oskIxmH7FRgbUnlkRZFKPhYBDVmUjewniqfDtLflIB+?= =?utf-8?q?cer+NWU9FKMfDlRVbN3eHEwTrCRH/Ahm6sp246lo3ViRYnwjb4kqV4umsEkykmD+F?= =?utf-8?q?0Ue6kzlB4/SU3tZnlbSyKA3mAxbfA+2HCCP3NKJn/9t7ntLsXmjpvTyNRvuAcC055?= =?utf-8?q?dTNUoFVsnOzdOpxIdP84nfXv3WVb88xJD7gSMqAVW3zILm85InCRVZSpYOaCF1QH+?= =?utf-8?q?SprpjHGCeCj9b0VEFl+Gv5CF4Hh8deZFv/5JXLYmqmKBBXdL3i4I1xsmEXg45VsiY?= =?utf-8?q?9kmv1jPrHgHvZAMpcqBMcGLVU+lJWUZZtreqKEfKk81MOlA2/LL+OaikxVrJzXF/h?= =?utf-8?q?tuv5RAiTGvu+a1rZu2efORq3zovAIPM/TtoOHBob0YinItRcyHhF2DEj7fDLl9KMD?= =?utf-8?q?4rXuO3x74RI890VpIrDSrtaNPAMMrAAzw5d9WHaQ8y4hMY+SelWw8f+2EmupDmkc1?= =?utf-8?q?wSiTEMobkecNsn0JfYhFIzhZHCvHHGluojtxuoMhfC7aY0o+vr7pkbBTxHAvjwHad?= =?utf-8?q?G/zN3bNLfgDqZbOTQP19ZWppaSMdT60TkslqIiYPj0d2+Kti7AnoCiwJQeD2gavmz?= =?utf-8?q?iD4aCXv+GXWD9kXRj9M6VnzkHBVeD6FlWipWke+0XDdM2L5x5ys+wVmaFGjhPgFdf?= =?utf-8?q?8V1T4/5iXxIbMKE0n3TxEC7/m55NlhKab/n1PijKC6GET5xaIi6x7CBNIjprlub4+?= =?utf-8?q?8qAIyvUd1CST6HaKnCfYH2/X1t7GTsg3zGdRW3beWv0OrkivIR09Aeug7xpLX4MZQ?= =?utf-8?q?W3D6vJFxEwqYaHhVntULlNujN0IS4pXtqOy93ekkoaO64DgodyHnWRH2iEcxNM5S1?= =?utf-8?q?XwKlDfoiEaWIYT3V6SdcZQE+SyGL7pQF+42emEms0o5gUPrROF5WKe+JDZSlYQrB3?= =?utf-8?q?547x70oF6Sn0EdlY1LZoUYiGsE4YWZ36J/SXLGhndej6t/I/hkavO3Cmd73IrNN1C?= =?utf-8?q?cCgeF2AO5Vky?= X-OriginatorOrg: solid-run.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93c4eef2-d44a-4a48-262d-08dcf8e80c62 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB7586.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 13:37:50.4816 (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: B49RqsAbTljftugADP3LdAM1CbZ9p09whC5WdKMeJSQmrxrN88wpRZlWSUlWVRpPq9yVnZyOe5L2IX2NA8CZOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9097 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 --- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index a830d9a9490408d3148b927bf1acc719a13e8975..101feabb24fb41bd10a2e796f4f3f8d4357dc245 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -30,10 +30,10 @@ #include "sdhci-esdhc.h" #include "cqhci.h" -#define ESDHC_SYS_CTRL_DTOCV_MASK 0x0f #define ESDHC_CTRL_D3CD 0x08 #define ESDHC_BURST_LEN_EN_INCR (1 << 27) #define ESDHC_SYS_CTRL 0x2c +#define ESDHC_SYS_CTRL_DTOCV_MASK GENMASK(19, 16) #define ESDHC_SYS_CTRL_IPP_RST_N BIT(23) /* VENDOR SPEC register */ #define ESDHC_VENDOR_SPEC 0xc0 @@ -1387,7 +1387,7 @@ 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, + esdhc_is_usdhc(imx_data) ? 0x0F0000 : 0x0E0000, SDHCI_TIMEOUT_CONTROL); }