From patchwork Thu Jul 4 13:21:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Costea X-Patchwork-Id: 13723747 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 C1D9DC30653 for ; Thu, 4 Jul 2024 13:22:14 +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=jXo4x0V25puTJ2j8IcXQGPJUH0 rxlEzWSiZAt7rZR73hXVxv5tPmg5o9sUGTpCtBZxBVRr6jyYD332x3n3HBZQCUjtF/4J8v+zQoRVw xqAjnQD+ybOAhI2LDDU4IkQolkdvFVh616Ihsl80MNc7kH12onUHtn19ZRJOQl37EHPWYcZqMYjGy ZSv3q7TX4iHIRP+vII2sJW2I3/0IPMxWFXZtXg5utdMZgSGPY4wgOpm0bfauRKfE9lHtMwn2JcfqC n6lSI8zP/3LLAhiCD2PyJBwqxHa/hWYMij/M+9lzAOLEGH7EPuJKuwcvXBRN8NPShKlYzv/9fVHIh TEzRHSuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPMPV-0000000DGkK-1ZfL; Thu, 04 Jul 2024 13:22:05 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPMP0-0000000DGYj-2A8u for linux-arm-kernel@lists.infradead.org; Thu, 04 Jul 2024 13:21:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DRoxbc+KFGS6ibBvEl5UUiExNoj2oAC7hDCxzlpdtee5aNb3zf60QfGwYw4tJhQW66omIsFSWina1TgeaOciV3pQa6xvBnmGeWwHkhW/golAyDHJPk5ICU6bHqNTiLsGFAAjddtUcNLY/BA1M2kAXNKEnkquz5Z29IPOkttRWolwc5yKm78IfPtIjls64CaV0lU+SeDb7lAUwIy2qrHJkd6heN3mXmJ3mwAnsgve73RHKYgobZhfD/wUmjADRaQgY3TWKSMMfGgFwZp2ha+L7SoN+MljWdXBFfWfV0YDxnBK14d3KyoxtSoUryc6V0jRSogt0//TbEEJrD9uaKXKqA== 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=l0Q+3aQ7QyaZqebWNvxH8ItA9ZIvjbU6xGVkKbQr0KOGuDMIg4NtATfv4WsDwgsvCE5Z0YPJBlmuwa0HO6XiwMYD0mGJDgr3737X8K5dW5j+BpnIHiCOHPbTWsAQIcvyRpWhiORX7WGitgVsj61iWDrXwrU9UMYLPAOE71CYRkLn2MkOyHrT+unC+h6qOElL16uniVzR3FJ1+BTQnaQy25RD8D7TOZe6NQyr4gCmH9TG39Ps9OAG3XudgSFABpUn4PEBU9kLIadmFHV2o3eAll3zIw9NIXE9t3SVC6uflDKq1FnkH+YfzekpF4eSHkttdKsP7GY8pby49Tm1Bo5TfQ== 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=XFQedrG6zTZzhgJ6bFNX5Ws6B+XyTrN5lZe/nstjWkt0moFtER2kjUM+D3fhwc2/ES9TlyMGEkL4v4r1xJ1+2IIbe0ydoIqeAK+lbK1ixVTgfgFvr6Kf+OWIpNART+eYoVYQbzK67dM4pZSsgGs3rvItS7hJy9vlSk/DAX+rGc8= 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 PA2PR04MB10422.eurprd04.prod.outlook.com (2603:10a6:102:417::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.32; Thu, 4 Jul 2024 13:21:24 +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; Thu, 4 Jul 2024 13:21:24 +0000 From: Ciprian Costea To: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Haibo Chen Cc: linux-kernel@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: Thu, 4 Jul 2024 16:21:14 +0300 Message-ID: <20240704132116.2865864-3-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704132116.2865864-1-ciprianmarian.costea@oss.nxp.com> References: <20240704132116.2865864-1-ciprianmarian.costea@oss.nxp.com> X-ClientProxiedBy: AS4P195CA0025.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5d6::20) 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_|PA2PR04MB10422:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b408c50-c8d1-4b45-ec7f-08dc9c2c33e8 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|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JdCGTMGYjIYaKUJNS5LjUt8lyhXOqgU?= =?utf-8?q?YEkU+wJZaxch2+WHP8avlbQvlCzc85Ee8j60vG0+orulVpcoVDr5byrAtm9GCYNcB?= =?utf-8?q?btCS1NQVV8+y4tExAOjfQIafDu9Dp6MIZXmf0TJVTrXugOezjKRPcSOv4D7y9MsRx?= =?utf-8?q?jRJpaHMI5yJM1XT9nKsIIEH6W7kOrhqWQQpXp5sN6eu+CABGtNo9VOMgYzd3H4CWB?= =?utf-8?q?ZLn7Y/zPD4/VdZotYrCnBa2m6hFln6Wq3HApj9Fz4hrWON0Dq5Rp4qi+VQD1+fmtS?= =?utf-8?q?O7+POVDnLZh69WndeL0eMtfItNHrZ+Fpo2cQBRwcwC+tCroDVyZhqAmeQophNyoZB?= =?utf-8?q?6k1SfLsN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E1xdi1MKNseGE9HI/DB7oGuApLmPoU4GZH7tTFnFV7r?= =?utf-8?q?FhVdCXfI7dxu09vcDnwqQil8Za2fVe1hAXQ=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)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IWIzWmm3TPtlFfoebiaaS4i1f38q?= =?utf-8?q?OMoh/2JDiJyQBAKtm+e2pDtX/moWAKI8K6mPqvyIM788p+7z1b3b+Z2hvzagSgLkX?= =?utf-8?q?p6lRBnZfadW+E4ZVeFKkjXDMZKShtyXQdT5AmwZ7sn4JTBhcThxNzbZ3Sd/jQuJ+4?= =?utf-8?q?zsPujCg4tOmX//CDPOLcK0F/6zGzahep04un752bCFoVRgp6lKKHmKoRI16NCuX74?= =?utf-8?q?c9O7ai9HTw/2nTPPVqUY1uhpl01j7XeMAGS+OkcIsu99M30Dejywrx7l3gcDKpGT0?= =?utf-8?q?zqdedWZeiJ6U9llGElaGONpT1xuHwc4iIrpkUtv5zTXX2Irp9VA8SyIMYfS7hRpTf?= =?utf-8?q?em16g4tr+hWn7voQGtNmYsjLn15lYgfXmKAtDby0oHlkwYyCfug4ozjoZKGLYuZom?= =?utf-8?q?EvtEbtU4fBDeMNkA+P1KaXY8nzdcX1zNGRBX0cl6oIIg9lfSRMS8YJnNj0qHxUg4H?= =?utf-8?q?yFTvjpEUV+qY2asPRre6wfxfQHwC5M8DmmlRJ8vcARY+WklJKtcvXnunNWVYhoVbp?= =?utf-8?q?4Wy0dqp9UKE7h3JuEz556g++aF2hJy0MTZyJSujC/10bvakQEBQNlOff844r/wrqw?= =?utf-8?q?YjqytakPG/x/y7BwbDTW7kVWMI0PvwHZpOdVG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kDzofwMqOvdr67r/HLF?= =?utf-8?q?ZEsWQyRXC/eo3Owj3EcnigMar7+EHAcBAQ=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b408c50-c8d1-4b45-ec7f-08dc9c2c33e8 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2024 13:21:24.3985 (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: YmPHeCLJCfr1kQ3KK9pSfbpGF8QFHkB7JvFO5v9dV5sKLnLAq+m4J56w8dV+txHNlUQHrYZksYFzdP7GvH73ERvYaUuVXYP2tA7PFmfi3fE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA2PR04MB10422 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240704_062134_582062_EBF704C8 X-CRM114-Status: GOOD ( 13.08 ) 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 --- 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");