From patchwork Mon Jul 8 12:10:17 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: 13726551 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 1E0F4C3271E for ; Mon, 8 Jul 2024 12:11:23 +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=LcULGWCUhsGGM0gjQu6OvooYUz qjXBzx6w/wobbrNEnJBfjWZLQNx1fKBaczy8KfBbLs93fvTR56pm2XUluohmkbPDavR+FS2Z7Jbk7 wgriSJE0kxsEy4+nmv1rYWqRIePpzXQ/QUKhyWyQnjpuamTDupDqOZwmwr/zO9e3E0FsBDR4v0hDF knSeySZYIuO5ghID3Z5UxG4s1n0UqbbzbVaDiAOpSORFUg+WrYfR5OU6Ic64BwH+6y2aexLA82oZM 5bdTzw9hirk8T9MVHvZT2uTD2GSg6bE0Vsb9FUky6DAgE8GQjjVgKS1veP52dU3/GACelQ3+aAtnm FJwmY+Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQnD7-00000003jKn-0zmP; Mon, 08 Jul 2024 12:11:13 +0000 Received: from mail-db5eur02on20601.outbound.protection.outlook.com ([2a01:111:f403:2608::601] helo=EUR02-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQnCU-00000003ivt-1Xm5 for linux-arm-kernel@lists.infradead.org; Mon, 08 Jul 2024 12:10:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hNH5zlwwUjPXXiwMHwiao6+UBC6Se5uO7ViHlpurPqhgMYfKyL8NmdYJtqCOynN9SBmkR5CX8tVX+6XSEk/w/k2rn/ocjCoQayctavGy82DlGjYzq/jr6B76acuJxOVWeezO1KE95hI+ErEhdUiGe8+zGpRozlNGFrc5FbENYS/Hv9p3oiapHnAcHAdmgWSJzv/kPviZgbHV1F/y4RWa+jvg5wxCcCamowgKQVVRAe2FtSxnGLXbj3nx4X8jaRRxZbzUqBelgqUTcXjsT5JsMqTSTeITZEgGFM0H2xBVnx3P6bnlJQuHfLwRxiOVnECSQIGb92UiunO4fmnXM1a3HA== 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=fTIBijthe6CNHMTddwgIbskHBQ0+lAUmCT9HlNuc/criiYyk4CvQvBcFCJiFjyxVLsmRrG74adh1i4lGOyzftHMxTs+rXAbl9oHDKnHWliUoh/dr41Dt/wLqoQl3zDFkhtUlEljle1DFULKB3+dWOpfUPK3lcacnSlA2JjGy4dQgtbVKd4s6nKg6PNzqAVpa2DjUOSudm1Gzx5Kdh8ItKGFRqgZeX8JCnWd5kymsk9lfCj/dsrySk5XAuFw9qo+1Oxqsj4XtQFqWzEyhXw4AIr8OypE9kTIT7VH+NBI8VL1sgezap/bUphWUkZVLeJCepQ7P/odecMA1+SlVzcrAPA== 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=mhL/bqLPZ+rF10pgfwH2bEB3d+XeXrGEvtfZRl4gSqTkVqOp0BYVZgui38GU2HOjKZtkLWEsUtVdFopX7e+csVvvI+HFhordW3o+guh3DEyhQOFjHtNdpucmgwFUvm9Sx6v07FUaJLmyFqSOFQruEOfo9ZZt+q4FvvW6Q7ZSSTY= 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 VI0PR04MB10614.eurprd04.prod.outlook.com (2603:10a6:800:260::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 12:10:27 +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.033; Mon, 8 Jul 2024 12:10:25 +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/3] mmc: sdhci-esdhc-imx: obtain the 'per' clock rate after its enablement Date: Mon, 8 Jul 2024 15:10:17 +0300 Message-ID: <20240708121018.246476-3-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240708121018.246476-1-ciprianmarian.costea@oss.nxp.com> References: <20240708121018.246476-1-ciprianmarian.costea@oss.nxp.com> X-ClientProxiedBy: AS4P190CA0014.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:5de::18) 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_|VI0PR04MB10614:EE_ X-MS-Office365-Filtering-Correlation-Id: a859684a-6210-4c5b-0157-08dc9f46f33e 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|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7NjSBv3Ja4RgC9iOc8FbMyUehGGo4Zd?= =?utf-8?q?siUUEaPOAyAYYT9iyU2O8wN5jI5XZC7ogoZMeWu8Izsg81pa6OQVJeUM/BN3LZ7rW?= =?utf-8?q?K76QPlI4iyr9Yfc/v/PLnGIMiq/vkYf9Z8W9NNPnGwr/1RtAEgPOvqS9hWboFmye+?= =?utf-8?q?G5aUvm0r0X4dkdgNUgKqReNqD3PL7NwjH/GQTlZStA3RdvOPElr5RWKVbmotCru1m?= =?utf-8?q?NR1V9v4fbDIVgqKaJUjFKnfiUWlRvrUGLvH5p/Sxl2QVhlYRhWQf0sF75If3XoWMv?= =?utf-8?q?8rJeJsrvRPn8+Yz3Pcw05DSvLViT3J2K64kmBCl2Es2OnAWXgAmluD1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=?utf-8?q?lx9f2vrUOvjcjIeu1Snk2lENHPpJ5B0jVVpGVsynyoeJWGgDpI13ynWevcw5Jt45g?= =?utf-8?q?v5WGidaf1miuOwmzX8LX/Y4DCxY1VDAF6dg=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)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kPVI9vE3ySNWH0/QYe32YwWuwJtd?= =?utf-8?q?TMjqrczkPn5v4CYXU0wCzM7mjovTIS1rytIejDcIrmGmhHvT300Zm6BRbRvsXEyhU?= =?utf-8?q?Po3QhS0qLmgif1bR4o4wkrmLJ7Rcrig434EcFkP4Vhyg/fm1YqnwTJz8ObB2wrojR?= =?utf-8?q?coNBqQrecW/9naNakbnBsxx7eJFcjw34/fVtlfRyj5hUz+kMwz/x9XBeASAeTfFmd?= =?utf-8?q?PLln9w26en5GWZxNBeEhOYx5Vs81G9htcUKksa40Q7FwgbuwUYIovjWlwKQ9ixR3/?= =?utf-8?q?HnqriSc8AKhvoTZivcAnZrElWRzHiFHmV0cgUbbOZcqkWl2tkaHBFTX7nJHLXSp0I?= =?utf-8?q?athW0+rIMS7vs8PV5/uwmAsZWgKBEyUj+wYv5lTri/ew27rcEkTVMdS6NBesT0LYA?= =?utf-8?q?kXpelu9J+7qBRZgXSoLce1XghVQ8RP9bJu+d4k4cF/9YMblYOHGxMMT6kNNO8tDzo?= =?utf-8?q?MJz0jNyotGoFCYOpyHYcQYuOB490Da65kZaWAAPNPUxEIReap01mVHKu3NbF2OyqO?= =?utf-8?q?QUtAuPDaGcRsh00RVJaNqbt5fjf1kvW6NB2+dJ8PXvWbjbe8TLxlkRoaKr4lHW0YM?= =?utf-8?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?YS+JQogKm3Vv7sqyZY0OoiBLi/dBo0m++MxBEVo0zNN29vxkej0Ehm3PLni3Xf8oG?= =?utf-8?q?P2cqIMLExwBI/CHZz/039wKEuFAbr9/6sw=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a859684a-6210-4c5b-0157-08dc9f46f33e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 12:10:25.8833 (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: RhANsu6diJ6xLneHGe/h3oqadYBDlBRJL80z6Z/ANp5teuTAzOJSNPpagTCa7E5tm7JRpUHuOB6h1hHP3FGXv64hz5Hpbv7jerVzdKuAZ10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10614 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240708_051034_487596_4F295041 X-CRM114-Status: GOOD ( 13.36 ) 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 Acked-by: Adrian Hunter --- 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");