From patchwork Fri Jan 13 11:06:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 43186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp210659wrt; Fri, 13 Jan 2023 03:16:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXuFpy012uLyKeu24LPH1wJYjdPMKApU41ShHXTBPshVd67/81nOlFIW1qlOINMyA9wjoQrF X-Received: by 2002:a05:6a20:1e51:b0:b2:2e66:5482 with SMTP id cy17-20020a056a201e5100b000b22e665482mr84345540pzb.7.1673608604801; Fri, 13 Jan 2023 03:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673608604; cv=none; d=google.com; s=arc-20160816; b=VQQ9lLpnJmMAWMybGCMK3djD54c1h7S3km1I8UsqsqyEcAJr3fuwyXMAWec5WC/flh VC0Lbb/8NG6PCLo+MEvFbuI67uoV12TziLX+CY1bgKjgZOkRq4UA87L9Ld7Mx9h/2nUG 7veId3mn1b6yeTCRFNgzxA2zp2j/AQsmUVlM05Nue1I6aMhRBin6uYxuWlD50aegjCgB 5iS5L66syzVdwK0M3FEAhTN4ls2QatXRQJMb3SAVcIEoeX6c1XZnxJTLQORW2cqk/d3a MdDjEPwf+bimoAHYmfLEWhiqyu5jn/jJSPv0WZXy4Qfx1Xz2rk1taK+YNWR4oquUgKQ8 k48A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wzW2w5e1Xz2XXVQ/PL0o5Eq79SaDg1mc/j3S7atBrrs=; b=Ut14xpdGeNuE7YXTlnOAWEg1vSeMgklPmYwp1WaE54M+I8llQooNXGWedbi9EY/OO3 T1xgMO1eppX/7xJn6NSz7DMC5eUNKgKLQN+7ea97RNaP7+zB0mXtL4ERXrXLQ4Dodcb+ 67l8OFqEmd3O9lbCy17pjPqeCnj8HTQ/SfaZb1HDAHVy6eqcCkQhZhGMxcLijh0uREdK 7Ia1aAWzo4NaoH+SKI2p7VRrMKU5OsQ6OKqVXK2EcOu38V5Vr3UC9q/tlSsUrQppAIJ2 bHqxnpZ+H7j/SDkGH07glamAghdZQihRjICMHUL0W0KgjOOZFcsOn5TH25oniB4NJrIC pZKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TYIsyC2F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a63e304000000b004a4dc4bcac6si22130467pgh.695.2023.01.13.03.16.31; Fri, 13 Jan 2023 03:16:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TYIsyC2F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241253AbjAMLOp (ORCPT + 99 others); Fri, 13 Jan 2023 06:14:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241042AbjAMLMj (ORCPT ); Fri, 13 Jan 2023 06:12:39 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 669E34829C; Fri, 13 Jan 2023 03:07:22 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id DE3A06602DCE; Fri, 13 Jan 2023 11:07:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1673608041; bh=eMtJpivqUhgCNZSyAJk+gudrCUotkGve5ei7007SRqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYIsyC2Fg+iujZc81skwhFtGKkdJO9FBg2rIIKlpGlCe9zRdHvtTEWPAXAe0DAuwx AOOTLV/i4XMZgsM4OYZf5gmNSVPsCO8oEU7PM5F1S1EbSZ7/bB/kzy2QuQ1CvZhXPP 54blIJVw1C5siDb0NbgjsS44G5bkUVm0ShKs6xBswnC1zuU4kNJErv0+xr9bqHnT4T 5sVX5PYkmLEYtY2G38kM4ml2VSCqFbWZrCngAXX4+TlwpQJM6sgV86XA6wG6Z16jp6 2Q8AfG8F7xdltP3YAuvvBfP63jl03Td8AMsjJxVqFP9846rj05EkUkgDSCUYUebykx r/gpaxsLPu4fw== From: AngeloGioacchino Del Regno To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, fparent@baylibre.com, chun-jie.chen@mediatek.com, sam.shih@mediatek.com, y.oudjana@protonmail.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, ryder.lee@kernel.org, daniel@makrotopia.org, jose.exposito89@gmail.com, yangyingliang@huawei.com, pablo.sun@mediatek.com, msp@baylibre.com, weiyi.lu@mediatek.com, ikjn@chromium.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v3 14/23] clk: mediatek: clk-mt8192: Move CLK_TOP_CSW_F26M_D2 in top_divs Date: Fri, 13 Jan 2023 12:06:07 +0100 Message-Id: <20230113110616.111001-15-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113110616.111001-1-angelogioacchino.delregno@collabora.com> References: <20230113110616.111001-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754905816508120145?= X-GMAIL-MSGID: =?utf-8?q?1754905816508120145?= This driver is registered early in clk_mt8192_top_init_early() and then again in clk_mt8192_top_probe(): the difference between the two is that the early one is probed with CLK_OF_DECLARE_DRIVER and the latter is regularly probed as a platform_driver. Knowing that it is not necessary for this platform to register the TOP_CSW_F26M_D2 clock that early, move it to top_divs and register it with the others during platform_driver probe for topckgen; While at it, since the only reason why the early probe existed was to register that clock, remove that entirely - leaving this driver to use only platform_driver. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Miles Chen Reviewed-by: Chen-Yu Tsai --- drivers/clk/mediatek/clk-mt8192.c | 39 ++++++------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8192.c b/drivers/clk/mediatek/clk-mt8192.c index ea4164c0995e..d012a229274e 100644 --- a/drivers/clk/mediatek/clk-mt8192.c +++ b/drivers/clk/mediatek/clk-mt8192.c @@ -26,10 +26,6 @@ static const struct mtk_fixed_clk top_fixed_clks[] = { FIXED_CLK(CLK_TOP_ULPOSC, "ulposc", NULL, 260000000), }; -static const struct mtk_fixed_factor top_early_divs[] = { - FACTOR(CLK_TOP_CSW_F26M_D2, "csw_f26m_d2", "clk26m", 1, 2), -}; - static const struct mtk_fixed_factor top_divs[] = { FACTOR_FLAGS(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll", 1, 3, 0), FACTOR_FLAGS(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll", 1, 4, 0), @@ -95,6 +91,7 @@ static const struct mtk_fixed_factor top_divs[] = { FACTOR(CLK_TOP_OSC_D10, "osc_d10", "ulposc", 1, 10), FACTOR(CLK_TOP_OSC_D16, "osc_d16", "ulposc", 1, 16), FACTOR(CLK_TOP_OSC_D20, "osc_d20", "ulposc", 1, 20), + FACTOR(CLK_TOP_CSW_F26M_D2, "csw_f26m_d2", "clk26m", 1, 2), FACTOR(CLK_TOP_ADSPPLL, "adsppll_ck", "adsppll", 1, 1), FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M, "univpll_192m", "univpll", 1, 13, 0), FACTOR_FLAGS(CLK_TOP_UNIVPLL_192M_D2, "univpll_192m_d2", "univpll_192m", 1, 2, 0), @@ -1047,27 +1044,6 @@ static const struct mtk_pll_data plls[] = { 0, 0, 32, 0x0330, 24, 0, 0, 0, 0x0334, 0), }; -static struct clk_hw_onecell_data *top_clk_data; - -static void clk_mt8192_top_init_early(struct device_node *node) -{ - int i; - - top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); - if (!top_clk_data) - return; - - for (i = 0; i < CLK_TOP_NR_CLK; i++) - top_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER); - - mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data); - - of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data); -} - -CLK_OF_DECLARE_DRIVER(mt8192_topckgen, "mediatek,mt8192-topckgen", - clk_mt8192_top_init_early); - /* Register mux notifier for MFG mux */ static int clk_mt8192_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) { @@ -1093,6 +1069,7 @@ static int clk_mt8192_reg_mfg_mux_notifier(struct device *dev, struct clk *clk) static int clk_mt8192_top_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; + struct clk_hw_onecell_data *top_clk_data; int r; void __iomem *base; @@ -1100,17 +1077,17 @@ static int clk_mt8192_top_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); + top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK); + if (!top_clk_data) + return; + r = mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data); if (r) return r; - r = mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data); - if (r) - goto unregister_fixed_clks; - r = mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data); if (r) - goto unregister_early_factors; + goto unregister_fixed_clks; r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), node, @@ -1156,8 +1133,6 @@ static int clk_mt8192_top_probe(struct platform_device *pdev) mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), top_clk_data); unregister_factors: mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data); -unregister_early_factors: - mtk_clk_unregister_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data); unregister_fixed_clks: mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data);