From patchwork Fri Dec 23 09:42:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 36184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp230315wrn; Fri, 23 Dec 2022 01:46:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXsTZOXBMhaMAnnq5dpvPNah9Z5qXkRIn4kxPc7PvrVdSSWbWL65N/UCnW+gmy4LqmNPbU4j X-Received: by 2002:a05:6a21:6d82:b0:ac:f68:d0f8 with SMTP id wl2-20020a056a216d8200b000ac0f68d0f8mr14521616pzb.23.1671788761181; Fri, 23 Dec 2022 01:46:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671788761; cv=none; d=google.com; s=arc-20160816; b=BQ1cQYCiYeY3KZ1FiQRVo/RGa47oo059m6h1rREEx8LwYhawCHxSvf8uXZ0iY6uZDB YUug5JPbQthKXjfawWskJ5JE1WhheldV6KZEjTMYEpXZ6uEovjddJMS634l67l55FSE4 IP731f1BEPlut2LsNN3/sOhBr7cnDoery07T0iP2PMrOp81kujnvbvuGV+JxC6M2AD7n JHQSkc9vNibxq/R1iC39FaQC5L/kVbr2n0eaAuhP4gnUyjuPS8KCb0zrLrmQmOaYwzQl RImJrV6HRTjqYdO19zaDo3OqqI01oZe/dlv+9wUGdIKF1FVNfhQdRbZzbwfxCpWkttme SpUw== 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=jzEbirQxyhh6OeixBejRbj0ImzFqrXdHVgrtBLOEbEA=; b=a5jCNlWsVEYjyCe5syJTjhMghi+pTy5k1g1Z1TsAYZ31T1Jjss9AfmrLeHXJPiVxyQ Akm6WS1pfSJu8X++XcKatKj8Qx45qYAJ3UPCK1bIVsMDVHAQXjnhq1B2JmXhSd5OSXlg kQMDOp/Z4bSECnpK6my3A8RymRFal4FexkrXwN6x5DxN1TD1Dns0ZkLou45RLzLjrNiF 17gRoErzADQovCxFdzISWTAS1QKZC5CHrQpjbpX5rzuXDn3Pt7WxxdxkHR3umrO2dbb6 EA3T/jhdqCG9RBHpFYOH/3m12p8WHkt2IAanPf2vA4dqmw+60UyLPZq59Cm+Rx2OoIf2 riLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=h7rfYJzi; 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 f8-20020a056a00238800b0056bc627dbeesi3179304pfc.124.2022.12.23.01.45.45; Fri, 23 Dec 2022 01:46:01 -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=h7rfYJzi; 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 S236214AbiLWJnx (ORCPT + 99 others); Fri, 23 Dec 2022 04:43:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236126AbiLWJnT (ORCPT ); Fri, 23 Dec 2022 04:43:19 -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 69D20379C6; Fri, 23 Dec 2022 01:43:18 -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 0EB5A6602CE0; Fri, 23 Dec 2022 09:43:16 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671788597; bh=K3qkzfY6G2DncdZI0kKDSL9TE5yrQJlLDsPQh9qExmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7rfYJziYRTHZ0eQUwgwBzY8/kMqSYFctHhDbsLYwP9y+abK/xGYat6S3B1xP8Aji RURnwCX9FzTzYvhgCloZxW5ZVmgSiYQsb85RCCrjM6mtrxq688whSy+BkHlguRMrHP OQrZLpC8ouLxLML5ryoVfuAOpN1RJFn+tejNxuSaqY+HBAAReO0dfUrmLuSCfkhKXL yI5h7DocKpQ4cCE1t3phW3PDvBoAqxQ4dGibUGcfZWnbNeX5/Vvxeo9gSGdz3Te4WU oQUJrODFfsfSZwEGqqeutAMV9Go/029L+U7tI6Dc5xNLMJnrKMoBhoCZSDc8aCW4g8 RUZivulr8ltjA== 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 v2 07/23] clk: mediatek: clk-mtk: Add dummy clock ops Date: Fri, 23 Dec 2022 10:42:43 +0100 Message-Id: <20221223094259.87373-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> References: <20221223094259.87373-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?1752997572196995033?= X-GMAIL-MSGID: =?utf-8?q?1752997572196995033?= In order to migrate some (few) old clock drivers to the common mtk_clk_simple_probe() function, add dummy clock ops to be able to insert a dummy clock with ID 0 at the beginning of the list. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Miles Chen Reviewed-by: Chen-Yu Tsai --- drivers/clk/mediatek/clk-mtk.c | 15 +++++++++++++++ drivers/clk/mediatek/clk-mtk.h | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index a1ab34305b95..d05364e17e95 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -18,6 +18,21 @@ #include "clk-mtk.h" #include "clk-gate.h" +const struct mtk_gate_regs cg_regs_dummy = { 0, 0, 0 }; + +static int mtk_clk_dummy_enable(struct clk_hw *hw) +{ + return 0; +} + +static void mtk_clk_dummy_disable(struct clk_hw *hw) { } + +const struct clk_ops mtk_clk_dummy_ops = { + .enable = mtk_clk_dummy_enable, + .disable = mtk_clk_dummy_disable, +}; +EXPORT_SYMBOL_GPL(mtk_clk_dummy_ops); + static void mtk_init_clk_data(struct clk_hw_onecell_data *clk_data, unsigned int clk_num) { diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h index 15122504c02d..dd43235285db 100644 --- a/drivers/clk/mediatek/clk-mtk.h +++ b/drivers/clk/mediatek/clk-mtk.h @@ -22,6 +22,25 @@ struct platform_device; +/* + * We need the clock IDs to start from zero but to maintain devicetree + * backwards compatibility we can't change bindings to start from zero. + * Only a few platforms are affected, so we solve issues given by the + * commonized MTK clocks probe function(s) by adding a dummy clock at + * the beginning where needed. + */ +#define CLK_DUMMY 0 + +extern const struct clk_ops mtk_clk_dummy_ops; +extern const struct mtk_gate_regs cg_regs_dummy; + +#define GATE_DUMMY(_id, _name) { \ + .id = _id, \ + .name = _name, \ + .regs = &cg_regs_dummy, \ + .ops = &mtk_clk_dummy_ops, \ + } + struct mtk_fixed_clk { int id; const char *name;