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 Costea X-Patchwork-Id: 13725180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA805C3271E for ; Fri, 5 Jul 2024 13:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Sf7OPVuzFCVUbxqXMXgjlFlzFPQmuxktVkyKjUGXAQg=; b=vVLwRp5gCwRbstL6Otq8bEceWd We/zvgdBvuMciUoQsOsOsSv6ny4Mi+wry/Qx0stT0lvPSECjFJ/h4uHUbjKlDLOiubX+FsR/KQFWa YxKoKcYSJUl2FqK6zEiFApgTNINdQHVA0eydsKxPNJwCTp0vSvf4+n5zjM2vlQFCvWGnVIXwexfYm ebYpjbmIglpBBk3o9Za4umEmVkYoGXlc4+29OhfwEmJ3JJxxtQYDi3Wt0PV1A7KTfrpVrIA+m2eYE 7zh+/dfmcjhekVGtlMfh93qiHBmb/bah06Y41aC10ZmbTen89TmTrqaKortph9DqxSKPSmjZejOr4 RqnG5tUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPjIB-0000000G74D-1oEb; Fri, 05 Jul 2024 13:48:03 +0000 Received: from mail-dbaeur03on20600.outbound.protection.outlook.com ([2a01:111:f403:260d::600] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPjHd-0000000G6ss-0SFY for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 13:47:30 +0000 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) 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?HfdqsHPgVwCvVcaK+WmxZIEgovoZ5ansUlLhuYJFBwLdhiDNV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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?IuH4p8O7t597FYJTdTJZP8coNFJrlsTkTtFToSL3hHcV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wyC41hpGN0?= =?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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_064729_158359_53F2D901 X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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");