Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp751802rwb; Fri, 13 Jan 2023 03:51:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXs0vz7nail35Vn+eWn67OqrbIpP2H9PYO6n/K3KU2V8omh4eeJyAsE/o4BdzRqFqsqkRxBz X-Received: by 2002:a17:907:8c0c:b0:7c1:1901:a445 with SMTP id ta12-20020a1709078c0c00b007c11901a445mr71460991ejc.20.1673610696232; Fri, 13 Jan 2023 03:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673610696; cv=none; d=google.com; s=arc-20160816; b=CFvjDnuKXVilNTx0T/+eSDeXdDnqNrK7LfBRs9NBJghv3brOsS1g4/vCKJz2FUQzLM KN2fMxJrO0B5+3Mffyt1HJOnfZS7yefcAeDLmhtQj2I2oQOq5Df5x2Zmx13nZ6rUOl9Z wNpf42E885kJIUtRrnGBj3/401oX5gb0hUbKKbT/wQMHzTfHLqD4kaNQAeVC06vZx9H6 8ypHTc3ynPmOiBmQsTh3yjdKfMw0QfS2PDzDEqQdAI9MnZcgyhbZAuscuGie66YWKqk0 GCrNTUGZoodNkb6jNj8dpBSD6GEWygW67zoxCCG/6NEj/wajO6LQGReq/MsJX2S7AOX+ w3FQ== 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=CXXGfX39UcR8FWmBjlpomDVvQl+DUEkJIompu3hL6NY=; b=NZFQtvYfR8BbLv1oyi/z1v8cO+XkCmC5anB16LpkB1l6okPlxLWpF1Vj7VeZ94qlP7 RvRLgSG0/jvXPertqm4nMg/+ZAcE9GysYnVTkTmVxkEXWqGTW6kIOUykyfqRnyS8aY60 aQIqujhFBc15BJ/F8hajlqIb/FecKoLQpJxZX7/NPpiQ5l3O4xxA79UxVW3ME87YnUqn QiFej7N+/M8zkdTPqGLyO7uCquQ7N893qFZaKhXp6G7h6wI8wj7qh0CJJ+XkMd3y7TYI vq/JiA/4WsaNNyXpIJJ9xzBdcUH/HOmV6mWb7nIj9dZxLCZaIHNkh8hEJ8fomt81zlHV wl8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WxNBeUkV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a056402444600b004829afcc563si19092193edb.404.2023.01.13.03.51.23; Fri, 13 Jan 2023 03:51:36 -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=WxNBeUkV; 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 S240413AbjAMLN4 (ORCPT + 51 others); Fri, 13 Jan 2023 06:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240984AbjAMLMj (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 D029A40C27; Fri, 13 Jan 2023 03:07:11 -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 65A8A6602DD3; Fri, 13 Jan 2023 11:07:09 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1673608030; bh=GGQBiBEeum02wzJcRprKO+Yvg5qHXyXn5xKwlPyEGJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WxNBeUkVqMNr65Cv5KnVbonazfGugB6wKjV39Tb3rE6peeMexRqgd2zZFHHXttqwI W0XR8hUrEcIr8pKrSRmGMD2P0qo7VrhdorH6EoT3BwXM2KOmtH/Ukk/Rq8C1790PpW +q77MPqRt9v04uBgsuwY+1SSQtYUp95/Q4tDGYGAjX+pEOWsalV969AKbpMsbu39aT i9lJwMe9znTMVtYUy35Kx2uAw7L78aRw4HaqNF+AkoxyJzVyhRupY5a69Nc3pfL7RS +6cyx8tIkAyEJYqtHcmHE6u/7ox7lmNcgPsBghWCmYDXa4AlSdKFpFd6Lo9Lhi0dJS OsrfbgoWyYXmw== 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 07/23] clk: mediatek: clk-mtk: Add dummy clock ops Date: Fri, 13 Jan 2023 12:06:00 +0100 Message-Id: <20230113110616.111001-8-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 Content-Transfer-Encoding: 8bit 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 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 cf2f465ecf22..7d7a5bfe1214 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 cd97d2722380..ed329d8d7349 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; -- 2.39.0