From patchwork Tue Feb 14 13:41:13 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: 56939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2979311wrn; Tue, 14 Feb 2023 05:44:55 -0800 (PST) X-Google-Smtp-Source: AK7set/2FEwZ+DEJ1uDP1tBjFeBPfG2uNw2OlUjzaotE32eS3Lc1V7d65S1zdC3s8AMZ68gC1q4A X-Received: by 2002:a17:906:c014:b0:881:f2f:6633 with SMTP id e20-20020a170906c01400b008810f2f6633mr2972827ejz.50.1676382295204; Tue, 14 Feb 2023 05:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676382295; cv=none; d=google.com; s=arc-20160816; b=ootpzlozXObsgqPbZcm7JFxgEzYCPzrUK2oeIVn/gv3U93k7FxI5xtZpMA317zp7w1 U3AGAHe4hdOVeGksT31R7HxwLKQMw398bpK0S7Kzahe788qARb6o2o5HA3WeYU1yoeHb UN4DX6AAvwOVuvvt6dzjZi9lDooJfKLEOZa5+j7BFr00R5vdhU3sMCC6pZu1ItXkJIcl lL7Jm7Zzfv1pm+I5iz5Mdg99QUpCMCoh45g9X6XvaVXQKneqJw6Kkuf3A8hxYU0uDNO6 2sVRBKLzRLJFHBXv8j3W40pJwpBdJRU9uFQChfK3oVVWKW815WQiNzXfyBCLeCjW7iHC Gs+w== 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=qfkyL35Q87avz+YthEsjK3kkTCX1OXcSswA6mNUoIxY=; b=LtFeWgsekHzJA4LsCQNPJcqeyvqrJXO0OpPZYRWJ2aYhl9P1c7ZWs2xsuK8FCdAhX6 a1NwGHVHczYZI7cARRH2lctG8rCPlLX8Ry+eIw2t6bHB0amvXO4nqWFj1UZYxUFQ6/ET YD2TUF8alJ+ur3qYlr5RgqcMgj5O6LZHb+fF/MBdt+WlWxFHHkUMhJTqHI23w1OTOEsT VlKo1LWttTlvxNA3B8DWifNgsv0VbYKNWyZH5DpHB82TAcHgIyA+H58enz3iDRuQkyke GdEwfQmN9ps15rjkUXT8D3dVVcQMzXP3hnM9+03vNilxysrG1zBMJ17SK9ScIcpsV9I2 9rFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bkkyxXUA; 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=REJECT sp=REJECT 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 y7-20020a170906518700b00886ae06f3d9si13173506ejk.287.2023.02.14.05.44.31; Tue, 14 Feb 2023 05:44:55 -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=bkkyxXUA; 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=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbjBNNnl (ORCPT + 99 others); Tue, 14 Feb 2023 08:43:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232844AbjBNNmz (ORCPT ); Tue, 14 Feb 2023 08:42:55 -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 04F7F28217; Tue, 14 Feb 2023 05:42:27 -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 9A7CF660216D; Tue, 14 Feb 2023 13:42:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676382145; bh=CLknQX9SFUtoj2mggvrjYiI8IwHCqlwdtblptlQ1mvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkkyxXUAHf240CD5sveUJDrpTcPBN7PfFNzCoYtbG+PsrtUCWuqdcYMaJAilJPhq4 mbe97bC0NaZbR5JHLmNDlp3AMJeRBt5wBv9jpoCltE7sfCLY06VYwwtUdQ0duZOrNV KZa8TiqqNimpnucYyJvd6yV16OMZNOMk4EllGKtmDun0+DUxFlhEqXLF/AeTHk7Abl hepzKobZy2/zJpQl+NC7akG1Od8BhefkJ/sAK5ouCo/VKxP5e66wdAxTfLtLqp5asX ZdnVHQn8jW/irlUx1MbWB0BDq6YMlGV/io//e9/5y8fa0Ro4+eI8aXGN6qrZSdzMyS jq1I0L8Byv1VQ== From: AngeloGioacchino Del Regno To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, chun-jie.chen@mediatek.com, daniel@makrotopia.org, fparent@baylibre.com, msp@baylibre.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, zhaojh329@gmail.com, sam.shih@mediatek.com, edward-jw.yang@mediatek.com, yangyingliang@huawei.com, granquet@baylibre.com, pablo.sun@mediatek.com, sean.wang@mediatek.com, chen.zhong@mediatek.com, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com Subject: [PATCH v2 33/47] clk: mediatek: mt8186-mcu: Migrate to common probe mechanism Date: Tue, 14 Feb 2023 14:41:13 +0100 Message-Id: <20230214134127.59273-34-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214134127.59273-1-angelogioacchino.delregno@collabora.com> References: <20230214134127.59273-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?1757814241470338047?= X-GMAIL-MSGID: =?utf-8?q?1757814241470338047?= Convert MT8186 MCUSYS clocks to the common mtk_clk_simple_probe(). Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/clk/mediatek/clk-mt8186-mcu.c | 68 +++++---------------------- 1 file changed, 13 insertions(+), 55 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8186-mcu.c b/drivers/clk/mediatek/clk-mt8186-mcu.c index e52a2d986c99..895856df95df 100644 --- a/drivers/clk/mediatek/clk-mt8186-mcu.c +++ b/drivers/clk/mediatek/clk-mt8186-mcu.c @@ -43,67 +43,25 @@ static struct mtk_composite mcu_muxes[] = { MUX(CLK_MCU_ARMPLL_BUS_SEL, "mcu_armpll_bus_sel", mcu_armpll_bus_parents, 0x2E0, 9, 2), }; -static const struct of_device_id of_match_clk_mt8186_mcu[] = { - { .compatible = "mediatek,mt8186-mcusys", }, - {} +static const struct mtk_clk_desc mcu_desc = { + .composite_clks = mcu_muxes, + .num_composite_clks = ARRAY_SIZE(mcu_muxes), }; -static int clk_mt8186_mcu_probe(struct platform_device *pdev) -{ - struct clk_hw_onecell_data *clk_data; - struct device_node *node = pdev->dev.of_node; - int r; - void __iomem *base; - - clk_data = mtk_alloc_clk_data(CLK_MCU_NR_CLK); - if (!clk_data) - return -ENOMEM; - - base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(base)) { - r = PTR_ERR(base); - goto free_mcu_data; - } - - r = mtk_clk_register_composites(&pdev->dev, mcu_muxes, - ARRAY_SIZE(mcu_muxes), base, - NULL, clk_data); - if (r) - goto free_mcu_data; - - r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); - if (r) - goto unregister_composite_muxes; - - platform_set_drvdata(pdev, clk_data); - - return r; - -unregister_composite_muxes: - mtk_clk_unregister_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), clk_data); -free_mcu_data: - mtk_free_clk_data(clk_data); - return r; -} - -static int clk_mt8186_mcu_remove(struct platform_device *pdev) -{ - struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); - struct device_node *node = pdev->dev.of_node; - - of_clk_del_provider(node); - mtk_clk_unregister_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), clk_data); - mtk_free_clk_data(clk_data); - - return 0; -} +static const struct of_device_id of_match_clk_mt8186_mcu[] = { + { .compatible = "mediatek,mt8186-mcusys", .data = &mcu_desc }, + { /* sentinel */} +}; static struct platform_driver clk_mt8186_mcu_drv = { - .probe = clk_mt8186_mcu_probe, - .remove = clk_mt8186_mcu_remove, .driver = { .name = "clk-mt8186-mcu", .of_match_table = of_match_clk_mt8186_mcu, }, + .probe = mtk_clk_simple_probe, + .remove = mtk_clk_simple_remove, }; -builtin_platform_driver(clk_mt8186_mcu_drv); +module_platform_driver(clk_mt8186_mcu_drv); + +MODULE_DESCRIPTION("MediaTek MT8186 mcusys clocks driver"); +MODULE_LICENSE("GPL");