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: 811348 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2040.outbound.protection.outlook.com [40.107.249.40]) (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 AC4391422DF; Mon, 8 Jul 2024 12:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440635; cv=fail; b=JMBgG0e/hEptpUg6tZubaTSvoUuO6odUFuC5V6arGLxjkXxYDZD/rJRO97LwkgoY3UMJIhAfTfBq+m+bu/RQtbwLkQnCSaXMfDrR7LQ6w+yq3oPOg2eohZsqSxaf0+H6jLXR/6mlKBXVOaQ69/Z+tuuyZEvjz0vnxTbzSsM6ajA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720440635; c=relaxed/simple; bh=4/UivPtlR60qrSoh3s+mf7nWjTTkNYETFIIUAGpASAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Rzb3/btc/wDfc96R/q3p1dvlAnpMrvJrhd7pFxFxZd9YdiHglxACUgG2IfV65cGWxJAT0q1R51AQM7VWAei2e0cx7CvSN4dWUnCfJw4Vkgto1mvg0A5PBI/IWtkzuYtOi5THlPocFbfP1tkZfi3JyVEKqzr/JRChFFgQanDZQQE= 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=mhL/bqLP; arc=fail smtp.client-ip=40.107.249.40 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="mhL/bqLP" 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) 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_|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?8rJeJsrvRPn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VBSrgDkwPsW4SSpRyuhJaaPVs48/YjhnRN8gw4R8m?= =?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?QUtAuPDaGcRsh00RVJaNqbt5fjf1kvW6N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Rqbm84NfXWqcbxDt26xSzo+Yq6ew5Md7g?= =?utf-8?q?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 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");