Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp486721pxv; Fri, 9 Jul 2021 02:31:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNOTKIEppil1T7ymo4qikNP9Gezpa8NVPCcjSClBNMhMRJGca+7MHeCGI65vF0Pb8iWmS2 X-Received: by 2002:a05:6e02:1074:: with SMTP id q20mr9363049ilj.137.1625823103451; Fri, 09 Jul 2021 02:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625823103; cv=none; d=google.com; s=arc-20160816; b=WljYmw+LrDVwvKwbpVt83YYXaYhfP2+0E9LRCBb8qzTvVQfgfP51zPP2JO2c7V6o3Q 4hREx58+4VMwH7PrfoHm3OJUdkQrjmWu6m5gwG5cH7kwFKRiaam4JxecZZvZLwTaa57Z mj1Zp+6+HDYWpz2rRkEDK0PiX8hSe7tNHvbnTMhYYeEL9peW9C3FJzYTnP4ukraEcZrx GB9ZuCbHFIrXiywLfwKh/S47O1+ljOxRWsIWl94+2BeO6etxTU3GtmbfS2Xu+MRVl08N LvMOp8JxBSXPSB8D2BLAfXPSUfq2Vl/YcPVFQu337GC/ccPK3Mu/ulpnyEa85TrqckjH YaRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UVZ3ulaIvieFnQbOO16griGzc0HyegeU7pDblHIW2fk=; b=fucBuRej5ITypO5L9vC5Hdmr/N/uJ+fLGoxfu1kVhe1Ghw553TPfovGMH5BjI2cL2V PA0n0296lQW1clsrSazft4s9MlZozLUh7KHV1os5tR4RCPyvtzhIOoHSp7Od/K0IEPLd /e2UJvmCzWTsJhtC/BNMFw3ywYmhe3Ht8cKyaYZW6nxYeaAQP/66m5t1wZN9HXG0Xn6E 7M9RwDCEPgipbq7fTwefwxpYQGHzCLn0kCuyTMypxN/jQGgRCWEyZ9EPFVZ+xw7VCgDF MoI3q3ZeKfNUE+wkd+tXKDaDWPO72szGsHZLPBuHhQI3l/U6h6gvm3Qsw/8byXiaGNkq UOvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AVIfFhja; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si7516131iow.59.2021.07.09.02.31.31; Fri, 09 Jul 2021 02:31:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AVIfFhja; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbhGIJdI (ORCPT + 99 others); Fri, 9 Jul 2021 05:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbhGIJdI (ORCPT ); Fri, 9 Jul 2021 05:33:08 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 188DAC0613DD for ; Fri, 9 Jul 2021 02:30:25 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id b40so7020195ljf.12 for ; Fri, 09 Jul 2021 02:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UVZ3ulaIvieFnQbOO16griGzc0HyegeU7pDblHIW2fk=; b=AVIfFhjaDrX+xicDV5jotfaj82OLOOQLuIyVuJLdHqlE+dBxiJFDUlsVq4jVqGn9kB YMzvrfhk17oW79bPQ8DocBNpp7vCeIc+8xKPX47CAP8MhrdU+M4r1FpMAs90+VlA1+ls gNqqMRtelpp+xp26dvc8SO3BkhhjvTcW94CCs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UVZ3ulaIvieFnQbOO16griGzc0HyegeU7pDblHIW2fk=; b=BXu0L3+wA47RPT4rWmIHZ3Ae5Jctix9Nq6wwaYjWUsdpFhaUnKJ/n/shMt3cAcAeQK TXjoYMKEZ8CGvgcgiYudUiex6T77jfY0Kl6bmS/H4HCO7I0YCjCwg8dCW9kugIcBNrwK IVW3ggagkCPT4a7Lb0ny3zDeO/Pmbo3rv16Vdl1H9qtc1r5G36yudpNEWU6I6SPTX5kJ YNhLwhpFjaGgIA1PXUBfSP94ta+oq39t2EFxZMHnYd2n+Jza9tsQpwjZmUyQyP5S00v2 B7O03kcsdguX6m/d15l0bzsbsyb+yU0uhImYurHwXa6Rgh5B862a6J6movJHmaHRTL6y GeJQ== X-Gm-Message-State: AOAM533/7VCVIEVDk/DgDiHmUG0mB5WKD41x1w1HUzc7u+3bJF75W0xl FV+SFTIS+rgWmzxRWAP1yJT+3VZETA645Kqq/C15hQ== X-Received: by 2002:a05:651c:2115:: with SMTP id a21mr28217222ljq.185.1625823023471; Fri, 09 Jul 2021 02:30:23 -0700 (PDT) MIME-Version: 1.0 References: <20210616224743.5109-1-chun-jie.chen@mediatek.com> <20210616224743.5109-17-chun-jie.chen@mediatek.com> In-Reply-To: <20210616224743.5109-17-chun-jie.chen@mediatek.com> From: Chen-Yu Tsai Date: Fri, 9 Jul 2021 17:30:11 +0800 Message-ID: Subject: Re: [PATCH 16/22] clk: mediatek: Add MT8195 vdosys1 clock support To: Chun-Jie Chen Cc: Matthias Brugger , Stephen Boyd , Nicolas Boichat , Rob Herring , linux-arm-kernel@lists.infradead.org, LKML , linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, srv_heupstream@mediatek.com, Project_Global_Chrome_Upstream_Group@mediatek.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 17, 2021 at 7:03 AM Chun-Jie Chen wrote: > > Add MT8195 vdosys1 clock provider > > Signed-off-by: Chun-Jie Chen > --- > drivers/clk/mediatek/Kconfig | 6 ++ > drivers/clk/mediatek/Makefile | 1 + > drivers/clk/mediatek/clk-mt8195-vdo1.c | 131 +++++++++++++++++++++++++ > 3 files changed, 138 insertions(+) > create mode 100644 drivers/clk/mediatek/clk-mt8195-vdo1.c > > diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig > index 6602f9ba13c7..1e89c68f6c6c 100644 > --- a/drivers/clk/mediatek/Kconfig > +++ b/drivers/clk/mediatek/Kconfig > @@ -654,6 +654,12 @@ config COMMON_CLK_MT8195_VDOSYS0 > help > This driver supports MediaTek MT8195 vdosys0 clocks. > > +config COMMON_CLK_MT8195_VDOSYS1 > + bool "Clock driver for MediaTek MT8195 vdosys1" > + depends on COMMON_CLK_MT8195 > + help > + This driver supports MediaTek MT8195 vdosys1 clocks. > + > config COMMON_CLK_MT8516 > bool "Clock driver for MediaTek MT8516" > depends on ARCH_MEDIATEK || COMPILE_TEST > diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile > index 6aa1ba00342a..76c0fa837cb0 100644 > --- a/drivers/clk/mediatek/Makefile > +++ b/drivers/clk/mediatek/Makefile > @@ -92,5 +92,6 @@ obj-$(CONFIG_COMMON_CLK_MT8195_SCP_ADSP) += clk-mt8195-scp_adsp.o > obj-$(CONFIG_COMMON_CLK_MT8195_NNASYS) += clk-mt8195-nna.o > obj-$(CONFIG_COMMON_CLK_MT8195_VDECSYS) += clk-mt8195-vdec.o > obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS0) += clk-mt8195-vdo0.o > +obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS1) += clk-mt8195-vdo1.o > obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o > obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o > diff --git a/drivers/clk/mediatek/clk-mt8195-vdo1.c b/drivers/clk/mediatek/clk-mt8195-vdo1.c > new file mode 100644 > index 000000000000..4d16f2e9c03a > --- /dev/null > +++ b/drivers/clk/mediatek/clk-mt8195-vdo1.c > @@ -0,0 +1,131 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +// > +// Copyright (c) 2021 MediaTek Inc. > +// Author: Chun-Jie Chen > + > +#include > +#include > + > +#include "clk-mtk.h" > +#include "clk-gate.h" > + > +#include > + > +static const struct mtk_gate_regs vdo10_cg_regs = { You might want to name these vdo1_X_cg_regs. This would be easier to read and parse. > + .set_ofs = 0x104, > + .clr_ofs = 0x108, > + .sta_ofs = 0x100, > +}; > + > +static const struct mtk_gate_regs vdo11_cg_regs = { > + .set_ofs = 0x124, > + .clr_ofs = 0x128, > + .sta_ofs = 0x120, > +}; > + > +static const struct mtk_gate_regs vdo12_cg_regs = { > + .set_ofs = 0x134, > + .clr_ofs = 0x138, > + .sta_ofs = 0x130, > +}; > + > +static const struct mtk_gate_regs vdo13_cg_regs = { > + .set_ofs = 0x144, > + .clr_ofs = 0x148, > + .sta_ofs = 0x140, > +}; > + > +#define GATE_VDO10(_id, _name, _parent, _shift) \ > + GATE_MTK(_id, _name, _parent, &vdo10_cg_regs, _shift, &mtk_clk_gate_ops_setclr) > + > +#define GATE_VDO11(_id, _name, _parent, _shift) \ > + GATE_MTK(_id, _name, _parent, &vdo11_cg_regs, _shift, &mtk_clk_gate_ops_setclr) > + > +#define GATE_VDO12(_id, _name, _parent, _shift) \ > + GATE_MTK(_id, _name, _parent, &vdo12_cg_regs, _shift, &mtk_clk_gate_ops_setclr) > + > +#define GATE_VDO13(_id, _name, _parent, _shift) \ > + GATE_MTK(_id, _name, _parent, &vdo13_cg_regs, _shift, &mtk_clk_gate_ops_setclr) > + > +static const struct mtk_gate vdo1_clks[] = { > + /* VDO10 */ > + GATE_VDO10(CLK_VDO1_SMI_LARB2, "vdo1_smi_larb2", "vpp_sel", 0), > + GATE_VDO10(CLK_VDO1_SMI_LARB3, "vdo1_smi_larb3", "vpp_sel", 1), > + GATE_VDO10(CLK_VDO1_GALS, "vdo1_gals", "vpp_sel", 2), > + GATE_VDO10(CLK_VDO1_FAKE_ENG0, "vdo1_fake_eng0", "vpp_sel", 3), > + GATE_VDO10(CLK_VDO1_FAKE_ENG, "vdo1_fake_eng", "vpp_sel", 4), > + GATE_VDO10(CLK_VDO1_MDP_RDMA0, "vdo1_mdp_rdma0", "vpp_sel", 5), > + GATE_VDO10(CLK_VDO1_MDP_RDMA1, "vdo1_mdp_rdma1", "vpp_sel", 6), > + GATE_VDO10(CLK_VDO1_MDP_RDMA2, "vdo1_mdp_rdma2", "vpp_sel", 7), > + GATE_VDO10(CLK_VDO1_MDP_RDMA3, "vdo1_mdp_rdma3", "vpp_sel", 8), > + GATE_VDO10(CLK_VDO1_VPP_MERGE0, "vdo1_vpp_merge0", "vpp_sel", 9), > + GATE_VDO10(CLK_VDO1_VPP_MERGE1, "vdo1_vpp_merge1", "vpp_sel", 10), > + GATE_VDO10(CLK_VDO1_VPP_MERGE2, "vdo1_vpp_merge2", "vpp_sel", 11), > + GATE_VDO10(CLK_VDO1_VPP_MERGE3, "vdo1_vpp_merge3", "vpp_sel", 12), > + GATE_VDO10(CLK_VDO1_VPP_MERGE4, "vdo1_vpp_merge4", "vpp_sel", 13), > + GATE_VDO10(CLK_VDO1_VPP2_TO_VDO1_DL_ASYNC, "vdo1_vpp2_to_vdo1_dl_async", "vpp_sel", 14), > + GATE_VDO10(CLK_VDO1_VPP3_TO_VDO1_DL_ASYNC, "vdo1_vpp3_to_vdo1_dl_async", "vpp_sel", 15), > + GATE_VDO10(CLK_VDO1_DISP_MUTEX, "vdo1_disp_mutex", "vpp_sel", 16), > + GATE_VDO10(CLK_VDO1_MDP_RDMA4, "vdo1_mdp_rdma4", "vpp_sel", 17), > + GATE_VDO10(CLK_VDO1_MDP_RDMA5, "vdo1_mdp_rdma5", "vpp_sel", 18), > + GATE_VDO10(CLK_VDO1_MDP_RDMA6, "vdo1_mdp_rdma6", "vpp_sel", 19), > + GATE_VDO10(CLK_VDO1_MDP_RDMA7, "vdo1_mdp_rdma7", "vpp_sel", 20), > + GATE_VDO10(CLK_VDO1_DP_INTF0_MM, "vdo1_dp_intf0_mm", "vpp_sel", 21), > + GATE_VDO10(CLK_VDO1_DPI0_MM, "vdo1_dpi0_mm", "vpp_sel", 22), > + GATE_VDO10(CLK_VDO1_DPI1_MM, "vdo1_dpi1_mm", "vpp_sel", 23), > + GATE_VDO10(CLK_VDO1_DISP_MONITOR, "vdo1_disp_monitor", "vpp_sel", 24), > + GATE_VDO10(CLK_VDO1_MERGE0_DL_ASYNC, "vdo1_merge0_dl_async", "vpp_sel", 25), > + GATE_VDO10(CLK_VDO1_MERGE1_DL_ASYNC, "vdo1_merge1_dl_async", "vpp_sel", 26), > + GATE_VDO10(CLK_VDO1_MERGE2_DL_ASYNC, "vdo1_merge2_dl_async", "vpp_sel", 27), > + GATE_VDO10(CLK_VDO1_MERGE3_DL_ASYNC, "vdo1_merge3_dl_async", "vpp_sel", 28), > + GATE_VDO10(CLK_VDO1_MERGE4_DL_ASYNC, "vdo1_merge4_dl_async", "vpp_sel", 29), > + GATE_VDO10(CLK_VDO1_VDO0_DSC_TO_VDO1_DL_ASYNC, "vdo1_vdo0_dsc_to_vdo1_dl_async", > + "vpp_sel", 30), > + GATE_VDO10(CLK_VDO1_VDO0_MERGE_TO_VDO1_DL_ASYNC, "vdo1_vdo0_merge_to_vdo1_dl_async", > + "vpp_sel", 31), > + /* VDO11 */ > + GATE_VDO11(CLK_VDO1_HDR_VDO_FE0, "vdo1_hdr_vdo_fe0", "vpp_sel", 0), > + GATE_VDO11(CLK_VDO1_HDR_GFX_FE0, "vdo1_hdr_gfx_fe0", "vpp_sel", 1), > + GATE_VDO11(CLK_VDO1_HDR_VDO_BE, "vdo1_hdr_vdo_be", "vpp_sel", 2), > + GATE_VDO11(CLK_VDO1_HDR_VDO_FE1, "vdo1_hdr_vdo_fe1", "vpp_sel", 16), > + GATE_VDO11(CLK_VDO1_HDR_GFX_FE1, "vdo1_hdr_gfx_fe1", "vpp_sel", 17), > + GATE_VDO11(CLK_VDO1_DISP_MIXER, "vdo1_disp_mixer", "vpp_sel", 18), > + GATE_VDO11(CLK_VDO1_HDR_VDO_FE0_DL_ASYNC, "vdo1_hdr_vdo_fe0_dl_async", "vpp_sel", 19), > + GATE_VDO11(CLK_VDO1_HDR_VDO_FE1_DL_ASYNC, "vdo1_hdr_vdo_fe1_dl_async", "vpp_sel", 20), > + GATE_VDO11(CLK_VDO1_HDR_GFX_FE0_DL_ASYNC, "vdo1_hdr_gfx_fe0_dl_async", "vpp_sel", 21), > + GATE_VDO11(CLK_VDO1_HDR_GFX_FE1_DL_ASYNC, "vdo1_hdr_gfx_fe1_dl_async", "vpp_sel", 22), > + GATE_VDO11(CLK_VDO1_HDR_VDO_BE_DL_ASYNC, "vdo1_hdr_vdo_be_dl_async", "vpp_sel", 23), > + /* VDO12 */ > + GATE_VDO12(CLK_VDO1_DPI0, "vdo1_dpi0", "vpp_sel", 0), > + GATE_VDO12(CLK_VDO1_DISP_MONITOR_DPI0, "vdo1_disp_monitor_dpi0", "vpp_sel", 1), > + GATE_VDO12(CLK_VDO1_DPI1, "vdo1_dpi1", "vpp_sel", 8), > + GATE_VDO12(CLK_VDO1_DISP_MONITOR_DPI1, "vdo1_disp_monitor_dpi1", "vpp_sel", 9), > + GATE_VDO12(CLK_VDO1_DPINTF, "vdo1_dpintf", "vpp_sel", 16), > + GATE_VDO12(CLK_VDO1_DISP_MONITOR_DPINTF, "vdo1_disp_monitor_dpintf", "vpp_sel", 17), > + /* VDO13 */ > + GATE_VDO13(CLK_VDO1_26M_SLOW, "vdo1_26m_slow", "clk26m", 8), > +}; > + > +static const struct mtk_clk_desc vdo1_desc = { > + .clks = vdo1_clks, > + .num_clks = ARRAY_SIZE(vdo1_clks), > +}; > + > +static const struct of_device_id of_match_clk_mt8195_vdo1[] = { > + { > + .compatible = "mediatek,mt8195-vdosys1", > + .data = &vdo1_desc, > + }, { > + /* sentinel */ > + } > +}; > + > +static struct platform_driver clk_mt8195_vdo1_drv = { > + .probe = mtk_clk_simple_probe, > + .driver = { > + .name = "clk-mt8195-vdo1", > + .of_match_table = of_match_clk_mt8195_vdo1, > + }, > +}; > + > +builtin_platform_driver(clk_mt8195_vdo1_drv); Same general comments as the previous patch applies. Code looks good otherwise. ChenYu