From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.83.63 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796114060; b=tkqqpXjD/GDUx7lmHJ2t7LFhDX52BUZhJDczaErLexJ1FcAXv6Hb1jzk4ywPFCe5YdjA YVssdocYDroM/t4MDyHMjPbYx0Uki/Ouq8LbfESFVRKrRC622GiptVgYXvJQl2DBVaCKh IKNrgOAgm50laxbLWuqG+KQ/zXfNL7UuUlOeqpwcn0isP3EVj3Vbuxz744aLFnt4rvquw uCQcp3fzAIbCrQblWCjoS9KjuSjLbqpu5FOcOtQU8UsYOuOmmGGBt3wUc2I9ZzIBHpOdF 4oB1wVFe4EE8MU+laF1dKL25cNRB+XLlpWG35wJP+kHR8tLwRKY4mYMFAmbdwk5vScw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796114060; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:References:In-Reply-To:To:CC: X-Mailer:X-Developer-Signature:X-Developer-Key:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=tLSxwasaFh1HLpCeeqfX2Ghh4EldAP/IJfCoLGH2pNc=; b=Rsd5gxd2sqUjTI/4fHz5XQr6CRQTI2aqSc8QMJVDnwUgIg9aolAZRsKv9dQ5CEqCTudQ a6s43qecH7kwa3MEdQVrjs48GGrRSYcg8SjbbiaaQS/m+1MhTKRjfhUXaPx55CbUyc/ns FCKfYiEUUQKNeaxhYJuTLJS7aRNBf0Kw/YSNqQe8gxMFyIkdsW2egGqYwgxQMJn/GYHve /pJeT+IP3lbzOZAtPjskbsOHge5pj3QAUNYZyTIVi0EnWkVtKny2Tq2jbGnTGEeJXuqYJ +qJ1+6jPQU0HhZEc8FBWul1gLAJ3FsErcNwrfVkXYb3DYLdMgwQzJFbBlTyw3mbVmSQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector2 header.b=ZK24ktyq; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.83.63 Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11013063.outbound.protection.outlook.com [52.101.83.63]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57F10606A32C; Tue, 1 Dec 2026 08:34:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 57F10606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector2 header.b=ZK24ktyq ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZToa7UFoYgMq1cI8Z2O0Xm0PaPq0HU9KikhvevJ4bDClX5PDgcJXCU0TlTUh93BZ+EiQCkkOAHNz0DZQuhIefGjpDmxLgg24Z4/cne9V8jhGX+5OpkAQokbgSpXmj1WVHLz6E8YbP3ctTKj5Fixhpe90+islCr24VjsmbF87DWhMDDKjhtCAUra6zqKgFvNCnTbmUiR6jEhrDk1gRc48kNDqc+JXNVn+uwmDb1WRK75Mb3jqvBpcU9HYHZBCjjdTB5pk4X9Ko9LX1xvYt2WGuiFgGUBOKJjlJ2NL20QKo1SPnFt4qveGVqADIRfG2rHFbRiluLfy1kdi1IdSrH6yZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=tLSxwasaFh1HLpCeeqfX2Ghh4EldAP/IJfCoLGH2pNc=; b=hWamUUuWPwDi2mLlpQZn1NCD66pqD9ZRufRZPF/rFfdksUJ11EFTB0uz576jnmoqK4JcbKTt0cOhI0uA/tim1ff70Ff6sQEGFfipL6ybQZgN4V2lANbHhhUXUQyNdjaxDOk7iXVHwI+gB67nKbm6LTY5b0utV/31RH2jYZYz0+L8pLo+B4Se2G3p43Nr2iDzS6v3l4YF25PUP9IIsKgkqrkewNFHn9whvU44623C67b/0wEq0AEcqqNjPqfWplJzbY0K5o8/QrkJBj+eBhqUCIE+ofqIyUgk8ibocE2TPOV6q1pScTuf6aWtpUguHIX0Rd1+Yg/4BsAgE8ecyXjleA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 164.130.1.59) smtp.rcpttodomain=gmail.com smtp.mailfrom=foss.st.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=foss.st.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tLSxwasaFh1HLpCeeqfX2Ghh4EldAP/IJfCoLGH2pNc=; b=ZK24ktyqG5DfHtPINMctI9W2JGDJ/Ir+C15DYh1gGB0tP1714Zf5/wqSW/8WOtNU9QM7SWbf83E1HX0T/hY+xEOg7PeIx5YFlmzfetN7i7zGN/OiaZlk58ZTk05UvQMJy71XAkcy2U917MRMXWi3IDSdVXPK7nFrLezs/rd+t3fKQSwPWlgWpzBTgd2ENSyJdSUG9Jr+rExlUM47iRDn0jdMsj1DP6J7YU65GGlG3iIZQiInzJfJhWF/W3Y839cYdg3Sbt5usAX+ly0sI0mMPtZqRvvut8PQO+L2aA+c/pIy/XMnuShd9FR82uwHqlMObgf7Uwjs6oJC2f2Vwhpvig== Received: from MA3P292CA0013.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250:2c::6) by GVXPR10MB8105.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:113::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 08:34:08 +0000 Received: from MAD0EPF000008B6.eurprd04.prod.outlook.com (2603:10a6:250:2c:cafe::6) by MA3P292CA0013.outlook.office365.com (2603:10a6:250:2c::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Tue, 1 Dec 2026 08:34:07 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=fail (sender IP is 164.130.1.59) smtp.mailfrom=foss.st.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=foss.st.com; Received-SPF: Fail (protection.outlook.com: domain of foss.st.com does not designate 164.130.1.59 as permitted sender) receiver=protection.outlook.com; client-ip=164.130.1.59; helo=smtpO365.st.com; Received: from smtpO365.st.com (164.130.1.59) by MAD0EPF000008B6.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 08:34:07 +0000 Received: from STKDAG1NODE2.st.com (10.75.128.133) by smtpo365.st.com (10.250.44.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Tue, 1 Dec 2026 09:35:08 +0100 Received: from localhost (10.48.87.14) by STKDAG1NODE2.st.com (10.75.128.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Tue, 1 Dec 2026 09:34:02 +0100 From: Gabriel Fernandez Date: Tue, 1 Dec 2026 09:33:48 +0100 Subject: [PATCH v5 2/5] clk: stm32: Add STM32MP25 SYSCFG clock driver X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20261201-ups_mp25_clk_syscfg-v5-2-aaf559bf6c15@foss.st.com> References: <20261201-ups_mp25_clk_syscfg-v5-0-aaf559bf6c15@foss.st.com> In-Reply-To: <20261201-ups_mp25_clk_syscfg-v5-0-aaf559bf6c15@foss.st.com> To: Stephen Boyd , Brian Masney , Jerome Brunet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Christophe Roullier , CC: Dario Binacchi , , , , , , Gabriel Fernandez , Brian Masney X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796114040; l=7239; i=gabriel.fernandez@foss.st.com; s=20261013; h=from:subject:message-id; bh=BRUI+ZpFLUANObI/QWzhjnA2boQHvb+yr0+/V6TgRIA=; b=cxmqUObjY/kMJSg73hcsl5IVR+1aKwZJSqQ5Wo+KLYspPj8+WMZibqnSdTiuD5c2/+VhYZhbr Wf60KtUiYErB6bMVVoL3TS10c0TPbXsR3o0TNybRrwmEF8pOQnyqOVG X-Developer-Key: i=gabriel.fernandez@foss.st.com; a=ed25519; pk=BVZE1QjIfcrviw9RyyOGQGGsg9CNbaxyjYn9pAlkNyQ= X-ClientProxiedBy: ENXCAS1NODE2.st.com (10.75.128.138) To STKDAG1NODE2.st.com (10.75.128.133) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAD0EPF000008B6:EE_|GVXPR10MB8105:EE_ X-MS-Office365-Filtering-Correlation-Id: c1b0689e-6246-49f3-f7b1-08df4f85dd80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|36860700016|23010399003|82310400026|921020|10067099003|56012099006|261028144727099003|261102123227099003|261021135927099003|261021121427099003|261022105027099003|261026121527099003|261026140227099003|261022075727099003|261009223027099003|261009221227099003|18002099003|22082099003|11063799006|3023799007; X-Microsoft-Antispam-Message-Info: ztsw3ecwiKP8saA5o14il6wdIs0iGwECOa7WXJnHa4nczezJNtUK/+kKt0EvPrlsIvUvWimoN5TxGB8PQ4OtBKHwNZpscD37hgO2fghryN8lJlVNGGuCaRBWoHxeXDJaqROdiL6aVU+uH/itc7sbcoqodvoO+AcTlPtojSqaORRjCh2ePmWPhLHfNAJK1YUIOuevIdeUTBgNOS8RFxZvfL+1pCwKScvDoR8T/CUn/Gvi4gWl/IY86wobIBTRSlGZ9feUDku1cIrrvxNXBfmf/yFRZOamNk8VqSlVVKkJUQVwvJeA1eGBOjsmp1azfxvP3K9VQ/r0a0579rnwmJcwGJmhCUFZ3qq8D2uud2jt9OFmq1CcjxPTpin4FtPivIPbuXPbaVqSfr7RH+Jt4pQnaD/Vj+V0VgdO70Izqo7nU2Hk7yrbM9c9NsEFB2OvodEX/9eNKAoPm01lFMZ77D01WyKSSIq5vDTw6zHbrKzvjJ5zqqBTXhrWWcbfpYdexZCOebwbPUNWbLBBd/HzRYpBLi3J5wqWbPaku9hp2fcSHi1+YanBAQE4DLcCTH0w33QrnHX4wqOI9R5l78AdYSC/Nsl6t8t4DkI9WtCAb2sg/1y4v+Z5GhA5xQ1V5WWYy+tu/B9tFwEbPVoFVhS+B8LWChFfJzseTn7uIAMKFl2AN9Vuj3KJqf/CX3KuY7FRASr8s7SJn1itlb4tIBPwuiYKlvZcXh8tlZS1LnJXlWlYPZAdO9yyBLHof2BMZmnsiUFW X-Forefront-Antispam-Report: CIP:164.130.1.59;CTRY:IT;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:smtpO365.st.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(36860700016)(23010399003)(82310400026)(921020)(10067099003)(56012099006)(261028144727099003)(261102123227099003)(261021135927099003)(261021121427099003)(261022105027099003)(261026121527099003)(261026140227099003)(261022075727099003)(261009223027099003)(261009221227099003)(18002099003)(22082099003)(11063799006)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ahi1T/7yDhwjRdsoE5hRMz37B1T2jvHiDG5/1AjoQEjaY37G+BKznm3mP2qQ4e6NCzIMN7ezopKowVdSTQENh9CYM54fbrwArCP8eKcasxgGoHQUXvoX0gbs6EJZoo9G5+jpfWlm85CxvZxN0A2WNtwLeIQbm6i3lLg9RLhAdEK+DTtas9WctwYPHLeezcuzdkeOXcsIYuvg38p2z4VTAWiOIIgqfBGjFNyu9WQHvmq+2T/onN0lQPeN4t//VCpclNiRk51bYgqQTuahuuHYgaHTZbCr/kxAKlYVyHfP+QWP4ZEoHnTWS8HWQpqIGGqGSIXcE4T+0RIGmdpPNM3+ogNBqh6ukCJMsHToLATivfwfP7jtfwSTPTnjqME4Vpua5XeF2hmVRrN6TeB5xWI2dhGh7LIqpBc0UeeJ5jyLXAouDv5dPRQLMI15OKZeW8to X-OriginatorOrg: foss.st.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 08:34:07.4213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1b0689e-6246-49f3-f7b1-08df4f85dd80 X-MS-Exchange-CrossTenant-Id: 75e027c9-20d5-47d5-b82f-77d7cd041e8f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=75e027c9-20d5-47d5-b82f-77d7cd041e8f;Ip=[164.130.1.59];Helo=[smtpO365.st.com] X-MS-Exchange-CrossTenant-AuthSource: MAD0EPF000008B6.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR10MB8105 On STM32MP23x and STM32MP25x, the LTDC pixel clock is selected in the SYSCFG DISPLAYCLKCR register among the DSI PHY byte lane clock, the LVDS PHY pixel clock (reset value) and the LTDC kernel clock, the latter being the one needed by the RGB (DPI) output. The SYSCFG node is described as the provider of this clock, but no driver registers it, so the selection can't be changed from its reset value and a display connected to the LTDC RGB output can't work. Add a driver registering this clock as a mux. The SYSCFG node is bound to the STM32MP2 SYSCFG driver, so this driver is an auxiliary driver, probed from an auxiliary device which shares the SYSCFG node. The mux parents are taken from the "clocks" property of the SYSCFG node, which remains the clock provider. The DISPLAYCLKCR register is accessed through the syscon regmap of the SYSCFG node. On STM32MP235 and STM32MP255, the syscon core attaches the first clock of the node, the LTDC kernel clock, to this regmap: it is kept prepared and enabled around each register access. The SYSCFG registers don't need it, but this has no functional impact. Co-developed-by: Dario Binacchi Signed-off-by: Dario Binacchi Signed-off-by: Gabriel Fernandez Reviewed-by: Brian Masney --- drivers/clk/stm32/Kconfig | 13 ++++ drivers/clk/stm32/Makefile | 1 + drivers/clk/stm32/clk-stm32mp25-syscfg.c | 127 +++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) diff --git a/drivers/clk/stm32/Kconfig b/drivers/clk/stm32/Kconfig index 5dbd75cde657..18289816f030 100644 --- a/drivers/clk/stm32/Kconfig +++ b/drivers/clk/stm32/Kconfig @@ -39,5 +39,18 @@ config COMMON_CLK_STM32MP257 help Support for stm32mp25x SoC family clocks. +config COMMON_CLK_STM32MP25_SYSCFG + tristate "Clock driver for stm32mp25x SYSCFG clocks" + depends on COMMON_CLK_STM32MP257 + depends on SOC_STM32MP2 || COMPILE_TEST + select AUXILIARY_BUS + select MFD_SYSCON + default COMMON_CLK_STM32MP257 + help + Support for the clocks provided by the stm32mp25x SYSCFG, i.e. + the LTDC pixel clock source selection between the LTDC kernel + clock (RGB output), the LVDS PHY pixel clock and the DSI byte + lane clock. + endif diff --git a/drivers/clk/stm32/Makefile b/drivers/clk/stm32/Makefile index e04727b59449..8088d172651f 100644 --- a/drivers/clk/stm32/Makefile +++ b/drivers/clk/stm32/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_COMMON_CLK_STM32MP135) += clk-stm32mp13.o clk-stm32-core.o reset-st obj-$(CONFIG_COMMON_CLK_STM32MP157) += clk-stm32mp1.o reset-stm32.o obj-$(CONFIG_COMMON_CLK_STM32MP215) += clk-stm32mp21.o clk-stm32-core.o reset-stm32.o obj-$(CONFIG_COMMON_CLK_STM32MP257) += clk-stm32mp25.o clk-stm32-core.o reset-stm32.o +obj-$(CONFIG_COMMON_CLK_STM32MP25_SYSCFG) += clk-stm32mp25-syscfg.o diff --git a/drivers/clk/stm32/clk-stm32mp25-syscfg.c b/drivers/clk/stm32/clk-stm32mp25-syscfg.c new file mode 100644 index 000000000000..c7e840fb2d95 --- /dev/null +++ b/drivers/clk/stm32/clk-stm32mp25-syscfg.c @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) STMicroelectronics 2026 - All Rights Reserved + * Author: Gabriel Fernandez for STMicroelectronics. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SYSCFG_DISPLAYCLKCR 0x5000 +#define DISPLAYCLKCR_DPIVSLVDS GENMASK(1, 0) + +/* + * The LTDC pixel clock source is selected in SYSCFG_DISPLAYCLKCR among + * the DSI byte lane clock, the LVDS PHY pixel clock (reset value) and + * the LTDC kernel clock, which is used with the RGB (DPI) output. + * + * The parents are listed in the DPIVSLVDS field order, while .index refers + * to the "clocks" property of the SYSCFG node, ordered "ltdc", "lvds", "dsi". + */ +static const struct clk_parent_data clk_pix_ltdc_parents[] = { + { .index = 2 }, /* dsi */ + { .index = 1 }, /* lvds */ + { .index = 0 }, /* ltdc */ +}; + +struct stm32mp25_syscfg_mux { + struct clk_hw hw; + struct device *dev; + struct regmap *regmap; +}; + +static inline struct stm32mp25_syscfg_mux *to_syscfg_mux(struct clk_hw *hw) +{ + return container_of(hw, struct stm32mp25_syscfg_mux, hw); +} + +static u8 stm32mp25_syscfg_mux_get_parent(struct clk_hw *hw) +{ + struct stm32mp25_syscfg_mux *mux = to_syscfg_mux(hw); + unsigned int val; + int ret; + + ret = regmap_read(mux->regmap, SYSCFG_DISPLAYCLKCR, &val); + if (ret) { + dev_err(mux->dev, "%s: failed to read the parent: %pe\n", + clk_hw_get_name(hw), ERR_PTR(ret)); + /* An out of range index leaves the clock orphan */ + return U8_MAX; + } + + return FIELD_GET(DISPLAYCLKCR_DPIVSLVDS, val); +} + +static int stm32mp25_syscfg_mux_set_parent(struct clk_hw *hw, u8 index) +{ + struct stm32mp25_syscfg_mux *mux = to_syscfg_mux(hw); + + return regmap_update_bits(mux->regmap, SYSCFG_DISPLAYCLKCR, + DISPLAYCLKCR_DPIVSLVDS, + FIELD_PREP(DISPLAYCLKCR_DPIVSLVDS, index)); +} + +static const struct clk_ops stm32mp25_syscfg_mux_ops = { + .get_parent = stm32mp25_syscfg_mux_get_parent, + .set_parent = stm32mp25_syscfg_mux_set_parent, + .determine_rate = clk_hw_determine_rate_no_reparent, +}; + +static int stm32mp25_syscfg_clk_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) +{ + struct stm32mp25_syscfg_mux *mux; + struct device *dev = &adev->dev; + struct clk_init_data init = { }; + int ret; + + mux = devm_kzalloc_obj(dev, *mux); + if (!mux) + return -ENOMEM; + + mux->dev = dev; + + /* The auxiliary device shares the node of the SYSCFG */ + mux->regmap = syscon_node_to_regmap(dev->of_node); + if (IS_ERR(mux->regmap)) + return dev_err_probe(dev, PTR_ERR(mux->regmap), + "failed to get the SYSCFG regmap\n"); + + init.name = "clk_pix_ltdc"; + init.ops = &stm32mp25_syscfg_mux_ops; + init.parent_data = clk_pix_ltdc_parents; + init.num_parents = ARRAY_SIZE(clk_pix_ltdc_parents); + init.flags = CLK_SET_RATE_PARENT; + mux->hw.init = &init; + + ret = devm_clk_hw_register(dev, &mux->hw); + if (ret) + return dev_err_probe(dev, ret, "failed to register %s\n", + init.name); + + return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &mux->hw); +} + +static const struct auxiliary_device_id stm32mp25_syscfg_clk_ids[] = { + { .name = "stm32mp2_syscfg.clk" }, + { } +}; +MODULE_DEVICE_TABLE(auxiliary, stm32mp25_syscfg_clk_ids); + +static struct auxiliary_driver stm32mp25_syscfg_clk_driver = { + .probe = stm32mp25_syscfg_clk_probe, + .id_table = stm32mp25_syscfg_clk_ids, +}; +module_auxiliary_driver(stm32mp25_syscfg_clk_driver); + +MODULE_AUTHOR("Gabriel Fernandez "); +MODULE_DESCRIPTION("STM32MP25 SYSCFG clock driver"); +MODULE_LICENSE("GPL"); -- 2.43.0