From patchwork Wed Apr 3 16:20:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13616461 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 D23D9CD128A for ; Wed, 3 Apr 2024 16:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=yQcXW1IvCscZtmuF53Fh6R7j6X2YCaI8fyFFi0VwJg0=; b=DfbOlFkq0KPCSN CofSC+PKk5PEmlGkGn+6vhql8biGpLke4GxaRKsuZoLcodKzNl7L0j8NJ4SyENcXfS0bdyPShSJ3E U3h8m+XEs8KZ6RU5byo9oEtVR7YrtU0BNXc906peJYxEnQqD3FeGyQ/QzIs8MSPLO7ol6Eykw0pja ojm5jbQwAKfk2pZPnTrRxS4ebbno+kcgHtuUmOTYHwuvBUkf6+DEdPsZ3kVp6gGCpsEwQKs9eleqJ o06f0GywQj3APBm8KzxdZc5o47dr+9Av9x7bkRn1WZaSXNTvGlo2fYbuoiEHsGPd7wXtWl/5CcdD1 U3uXabua8MwbXaGsjbzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs3Mi-0000000GwHa-32zV; Wed, 03 Apr 2024 16:21:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs3Mb-0000000GwDU-0mVr for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2024 16:21:26 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6FCA5614A4; Wed, 3 Apr 2024 16:21:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAB34C433F1; Wed, 3 Apr 2024 16:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712161284; bh=AaHst2Jf0vHwQ7OHGptaWr3uKz5EntjSR1A8lyMilrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFRvBOQLzJE5JBNz/dcEnxnE21YmiebFYWVzeDpjKFDGPo+NMwkmt5spmCOTSFW75 9n9e6y08Qs9coeMI/WXLTjZjshgtiDI6kC/15xygfcRMRDgYOSj8G21h4Cxia/XABD lIU97lMtEmH0OEEVBNz9MpTxl5BpbV/TlyzwdE2hutMD2TWOspoAw56+ELUiKKbwSb Bgue2wKmNJO7QscMmnmR+RWd0q748+6CQAl+50yjR5vxaxpJoouB67AnnCJI1jlu3J ZpNa8mvVYX6B/iLWxkcClettO93azyxHrxaO9DQy44S9Ibychtw7QluThHG0oK/H3L 9lcRBfzExui3g== From: Lorenzo Bianconi To: linux-clk@vger.kernel.org Cc: mturquette@baylibre.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, nbd@nbd.name, john@phrozen.org, devicetree@vger.kernel.org, dd@embedd.com, catalin.marinas@arm.com, will@kernel.org, upstream@airoha.com, lorenzo.bianconi83@gmail.com, angelogioacchino.delregno@collabora.com Subject: [PATCH 3/4] clk: en7523: make pcie clk_ops accessible through of_device_id struct Date: Wed, 3 Apr 2024 18:20:44 +0200 Message-ID: <3eba4d9bd16c7598c42400c0ce1bf6c2f80cdbad.1712160869.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240403_092125_356208_9424CA75 X-CRM114-Status: GOOD ( 14.03 ) 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 Make pcie clk_ops structure accessible through of_device_id data pointer in order to define multiple clk_ops for each supported SoC. This is a preliminary patch to introduce EN7581 clock support. Signed-off-by: Lorenzo Bianconi --- drivers/clk/clk-en7523.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c index 7cde328495e2..c7def87b74c6 100644 --- a/drivers/clk/clk-en7523.c +++ b/drivers/clk/clk-en7523.c @@ -145,11 +145,6 @@ static const struct en_clk_desc en7523_base_clks[] = { } }; -static const struct of_device_id of_match_clk_en7523[] = { - { .compatible = "airoha,en7523-scu", }, - { /* sentinel */ } -}; - static unsigned int en7523_get_base_rate(void __iomem *base, unsigned int i) { const struct en_clk_desc *desc = &en7523_base_clks[i]; @@ -247,14 +242,9 @@ static void en7523_pci_unprepare(struct clk_hw *hw) static struct clk_hw *en7523_register_pcie_clk(struct device *dev, void __iomem *np_base) { - static const struct clk_ops pcie_gate_ops = { - .is_enabled = en7523_pci_is_enabled, - .prepare = en7523_pci_prepare, - .unprepare = en7523_pci_unprepare, - }; struct clk_init_data init = { .name = "pcie", - .ops = &pcie_gate_ops, + .ops = of_device_get_match_data(dev), }; struct en_clk_gate *cg; @@ -264,7 +254,7 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev, cg->base = np_base; cg->hw.init = &init; - en7523_pci_unprepare(&cg->hw); + init.ops->unprepare(&cg->hw); if (clk_hw_register(dev, &cg->hw)) return NULL; @@ -333,6 +323,17 @@ static int en7523_clk_probe(struct platform_device *pdev) return r; } +static const struct clk_ops en7523_pcie_ops = { + .is_enabled = en7523_pci_is_enabled, + .prepare = en7523_pci_prepare, + .unprepare = en7523_pci_unprepare, +}; + +static const struct of_device_id of_match_clk_en7523[] = { + { .compatible = "airoha,en7523-scu", .data = &en7523_pcie_ops }, + { /* sentinel */ } +}; + static struct platform_driver clk_en7523_drv = { .probe = en7523_clk_probe, .driver = {