From patchwork Fri Jul 5 13:46:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Marian Costea X-Patchwork-Id: 810584 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (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 EC590152184; Fri, 5 Jul 2024 13:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720187250; cv=fail; b=r1AW9xzfTlJgOEIDTcypbL6laTJPsjCqhTZLPmmaHGLpQSr/sDD5h6kofnekzxRGKgRhzWGy8YpO8sHfjNx4i94HEQk32w3ayAMrOWWW/cF7gRiluWWImq2h6BYaDjwmSXG5YtSmxUZFh8+lAh8KnO2g9g5bwHJnjtKj9vZPNLw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720187250; c=relaxed/simple; bh=4/UivPtlR60qrSoh3s+mf7nWjTTkNYETFIIUAGpASAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=d7HJzQz+cfKBYkRX56b/kTXrQRRraemvvUIKii1HQZv+qTaM9i3fTlWBlMJ06DDTwSIDlhG2HjT8t+oEP+1iklJeLCC8ScxCqBc59hae7q5ej8l4u8jVSuEGE080fgZolcuOdfye12XM/zIV6p4XEZTjSsoL0PpfmDqSzFywgGE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=j8G2L2eM; arc=fail smtp.client-ip=40.107.104.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="j8G2L2eM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gCuqvQMRSMS5UZnPk1tbxSu9Ek9RKv74uQd5PaEZ+ymtz8epbhTX50vO4DCt/4BXrf39IOqxPtirJCrmQTSxMABeUGQejFCxTdCC4/CAeO9uhOkSWPgfgMI/Yg+xqiYmwTaVp6XIs6AosE0OiJZWgEMnG+/lFzMVK7GPSdhGE5KFRs34IuRdpancJaQFu0O0lfbOxgReLMRjLDLTQH4IBiiQTANDfK8wAyQymaQJR21qA4CfGS7kYqBEnj5MS6bJPMXSTK0agFQ1PecRlEQoe/iRFn8elIVr2Ltu7VnKZBUwiyT35NJIanh9fP6RE19bjt74VJmhTOShMpARbM+4bA== 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=Sf7OPVuzFCVUbxqXMXgjlFlzFPQmuxktVkyKjUGXAQg=; b=nR8iKJOENa3yu5/HDaqrb8rv58mSHrtWw5d2qyyQnu7PnGZyZoSHDx2fNO22gLnWs/wqPtpDpARBPuSiBXgfkL5KFinJXF3Vf6KOFfA2OUDxsvWV3cV25WoXMAoJFSuuHrBJSQ/sGG8jugvmHSbqprFljCF21Duydu4VUfL8xS26gkBgMURKA88Lsg+nr9EiylBhIh0Pn8GEa1WVZ08vSSDOX7XRIz6uIAxCzc/Ru65bpy9TJjWQbiTYDjD6oNrZfRRNE+6T2QsMvMMRHgAD/s2Qb6QL/tCfRIoHKJ01gYzB3UncZnN+4VZu17bcmSGO2gPXFdu1dTJtwzCzmP4sKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sf7OPVuzFCVUbxqXMXgjlFlzFPQmuxktVkyKjUGXAQg=; b=j8G2L2eMeViQhmakzwiAqXIuYx+8NIDO3jJO8B3G8AFYsuj8GaUflgt+7EXaURhnp+9eKYLZnJSIUTs9rqTCGaSrV9ajQyt+JhwwbT0xYNnB9w6uW6yQv1YWW8sSfpgMfS1OZ5SFiCoWZ8eCNbrTnK5RrcrDwmvrcVzQb2Usrj8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) by GV1PR04MB10244.eurprd04.prod.outlook.com (2603:10a6:150:17b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.30; Fri, 5 Jul 2024 13:47:22 +0000 Received: from DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd]) by DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd%5]) with mapi id 15.20.7741.027; Fri, 5 Jul 2024 13:47:21 +0000 From: Ciprian Costea To: Haibo Chen , Adrian Hunter , Ulf Hansson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, s32@nxp.com, Ciprian Costea Subject: [PATCH 2/4] mmc: sdhci-esdhc-imx: obtain the 'per' clock rate after its enablement Date: Fri, 5 Jul 2024 16:46:45 +0300 Message-ID: <20240705134647.3524969-3-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240705134647.3524969-1-ciprianmarian.costea@oss.nxp.com> References: <20240705134647.3524969-1-ciprianmarian.costea@oss.nxp.com> X-ClientProxiedBy: AS4P189CA0033.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::6) To DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9251:EE_|GV1PR04MB10244:EE_ X-MS-Office365-Filtering-Correlation-Id: b70175c4-7977-4f52-f217-08dc9cf8fe9b X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9O7FI+wyGX5ZKAyIjNHCre/ca5JvzzM?= =?utf-8?q?uEQxBVTI34AbMcltxUHhAY7Bxm5hgIwDeumRxXT/owcWl+Ccb1NZLiK01j3aMPZUh?= =?utf-8?q?N+ZZQInsgm9P8klyNcTCFcjLpFsZ8zuq3dWQRKf+OlOpyzbHYIINNcDgXiJQXCRLc?= =?utf-8?q?E1gLc22isQ96HCgwJFARNtpY06Y7spzAT5Jc529D3n0JavPndqc3rUEtlV7wvSpzm?= =?utf-8?q?bImlOI2qV2icX9y7OqDUAbOqy5Shn6aVMrY1bV8OZkV9yFvJevORhVTSsuo88I8RF?= =?utf-8?q?HfdqsHP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hH/zPaAk+FHdlJlhPlFFwjtwV32jMQHbwpLx09a5lR+eiIQYvvrhE?= =?utf-8?q?ZyXY5/B2zCop1ihWYwfRgYIwD6tBOV/pNjVHy9ar5HHkLpwSez3TU2XsCOl8uH7mn?= =?utf-8?q?9dMknPz6b/OGcTIZ1gQLezPrF6XO+XxfNDQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9251.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(7416014)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?U5AyYS7J2cuFDJ2T3BNk4ogZC3nO?= =?utf-8?q?4BWDjVd9A1ET5kbrQlPH2c0VP/WcYTBbp0x/Ofntei3pUABcewblLuRzV6C2ylScC?= =?utf-8?q?L6ee5dUdl3q1PQ3EJr6ZlF/K/f8/tX5OXrh3nzUKsRTIAW6YcX+meHXlLgd+t7XEZ?= =?utf-8?q?oVSbKzd0B3+lHv/nUKjeA5gPQhOl1cTMdKYF+My4Hjn+ZnKd3md5JfEdXOXBskOJq?= =?utf-8?q?ML1I3x7hENRVg1AnwFamOCOyFFuuEBwDKU2wEKZwwfMKgJgDbv8AEOXG0qGDaA4mo?= =?utf-8?q?g+EkfEfgsXz++hVqRNRk733B/vA/fAc/PSFm/4nhFlUsgOv9Pjw/qNSzhP62vrC7g?= =?utf-8?q?HcF602HJAkiEIRJ1k7V+W3TdU57VPqtnesCFTAPSb9Rz1sAxoMb9XZcwQTbt3CeSn?= =?utf-8?q?cPf6DWoTh/XfnnMfSfT3o9FwY453IFetF04P++HabWDmnygVYUMm8Ouf0W5mHoXZy?= =?utf-8?q?bmHmkVe0Xf2Wf4tOIbkJMsLl/Xjm0O710R6zAnfiUn+koANcqPGytuxDTQc1zFl4E?= =?utf-8?q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kTT6SdMJn/v7ygKPozg3IpaIGdTdi4Y/95qDDeMZ5wyC41hpGN0?= =?utf-8?q?2wkdsQVsHKSGJ1k7D7uj/VnvakZ4BPs/w1IeoyopqpN5OXy3Fx7/ngjEoXvvy79Qs?= =?utf-8?q?azVVoIZA12fLxGFdaMLxz8ossKOJ9KdIhg=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b70175c4-7977-4f52-f217-08dc9cf8fe9b X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 13:47:21.8437 (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: 17rOjZFZWSx89+Z6vbVtRZOL44/R2vODoNIy01bQH/cNAH2BtSPZuyewmbnBTMeotIpBlu6Ry7LGAkH9xdl7W7u09LlsY2W7DcWB60d1UFM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10244 The I.MX SDHCI driver assumes that the frequency of the 'per' clock can be obtained even on disabled clocks, which is not always the case. According to 'clk_get_rate' documentation, it is only valid once the clock source has been enabled. Signed-off-by: Ciprian Costea Reviewed-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 21d984a77be8..8f0bc6dca2b0 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1709,7 +1709,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) } pltfm_host->clk = imx_data->clk_per; - pltfm_host->clock = clk_get_rate(pltfm_host->clk); err = clk_prepare_enable(imx_data->clk_per); if (err) goto free_sdhci; @@ -1720,6 +1719,13 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) if (err) goto disable_ipg_clk; + pltfm_host->clock = clk_get_rate(pltfm_host->clk); + if (!pltfm_host->clock) { + dev_err(mmc_dev(host->mmc), "could not get clk rate\n"); + err = -EINVAL; + goto disable_ahb_clk; + } + imx_data->pinctrl = devm_pinctrl_get(&pdev->dev); if (IS_ERR(imx_data->pinctrl)) dev_warn(mmc_dev(host->mmc), "could not get pinctrl\n");