Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4400549pxv; Mon, 5 Jul 2021 23:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuhSyNQLvZGc8qO/hDOJKyPj4/+pR7eF6tl+0AwpCCiI7iYCgAUCRpy872FOpwPUV2HUGB X-Received: by 2002:a92:c0ca:: with SMTP id t10mr14159192ilf.241.1625552549506; Mon, 05 Jul 2021 23:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625552549; cv=none; d=google.com; s=arc-20160816; b=NzSLWNL9fYdZR0sSyedbFC6A5qNNZ4lYvT4Xpa8vnu+eArMjGmDbqUlh1t4fDsL9Z4 1c7i5+oND8AAMoK6Hz9uVX5rqArlsWKBGg44Vp6eagSJAaVM9S6TqItXB/+rEA7uXHim LXzS7Pzj3PzOkaPAzbSP8IVEGGYfCgQLfI5AHHWYU+7h1YfuAH2nM/q1dTj6y3KDI32O Ao0n+oQtZW0GUtCh1kEIN+sZ7S5G4QjcMp0h+gO4Mv+SAUpos+zBprOwpX0FoFt3sfES kamhCWVjsjibkpAh98J+eODQZJkBKI8kUSNZXrLyBjd8KUbC057+0y4+BVeBwfWsDkAQ KwxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=AGESLfBfmbJI1tFX1IHqVLOytcITdUOBZCuI4DiYhAw=; b=EiZ41rKgFd02pS5vKCvmoonQRQzilHLQa8uanMKM2oWAkD8xjyQd5YrUoqmEk4L05i wgX3UMnYkLk0zgMQFZz1t6h/YE8AyChf8gby5C2qcuAiL0A3eyH6PHLEO7Q5KdxcRX0G t7cr1LaxgoIqrFDSZxLx6YxB0DsUImTXv7xGXce/fHS3w+zRHeabcebBE0Ea8smbQPDq wt4QSajuYJ/kaBweaw6KhyJpWXJyj5zUeNeZr7CFlXtFU5WB4LKU70EacQALWi3RSt/R CPFQtlY+U/smcbWvRI5eOYEK/JppBQ/B/S+6BexrptTmpiuwK3c28CILakgs13cgHwiD /aFQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si22684217iow.52.2021.07.05.23.22.17; Mon, 05 Jul 2021 23:22:29 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230488AbhGFGX4 (ORCPT + 99 others); Tue, 6 Jul 2021 02:23:56 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:41534 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230428AbhGFGXv (ORCPT ); Tue, 6 Jul 2021 02:23:51 -0400 X-UUID: 0f5155daebb64956ad28ee6d41490cc5-20210706 X-UUID: 0f5155daebb64956ad28ee6d41490cc5-20210706 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1800733730; Tue, 06 Jul 2021 14:21:10 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Jul 2021 14:21:08 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Jul 2021 14:21:08 +0800 From: Chun-Jie Chen To: Matthias Brugger , Stephen Boyd , Nicolas Boichat , Rob Herring CC: , , , , , , , Weiyi Lu , Chun-Jie Chen Subject: [v13 16/21] clk: mediatek: Add MT8192 mfgcfg clock support Date: Tue, 6 Jul 2021 14:19:15 +0800 Message-ID: <20210706061920.16013-17-chun-jie.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210706061920.16013-1-chun-jie.chen@mediatek.com> References: <20210706061920.16013-1-chun-jie.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add MT8192 mfgcfg clock provider Signed-off-by: Weiyi Lu Signed-off-by: Chun-Jie Chen --- drivers/clk/mediatek/Kconfig | 6 ++++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8192-mfg.c | 50 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8192-mfg.c diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig index 59104b8cd7dc..e212f3416855 100644 --- a/drivers/clk/mediatek/Kconfig +++ b/drivers/clk/mediatek/Kconfig @@ -544,6 +544,12 @@ config COMMON_CLK_MT8192_MDPSYS help This driver supports MediaTek MT8192 mdpsys clocks. +config COMMON_CLK_MT8192_MFGCFG + bool "Clock driver for MediaTek MT8192 mfgcfg" + depends on COMMON_CLK_MT8192 + help + This driver supports MediaTek MT8192 mfgcfg 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 7b258cb1f914..024841a79f1c 100644 --- a/drivers/clk/mediatek/Makefile +++ b/drivers/clk/mediatek/Makefile @@ -74,5 +74,6 @@ obj-$(CONFIG_COMMON_CLK_MT8192_IMGSYS) += clk-mt8192-img.o obj-$(CONFIG_COMMON_CLK_MT8192_IMP_IIC_WRAP) += clk-mt8192-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8192_IPESYS) += clk-mt8192-ipe.o obj-$(CONFIG_COMMON_CLK_MT8192_MDPSYS) += clk-mt8192-mdp.o +obj-$(CONFIG_COMMON_CLK_MT8192_MFGCFG) += clk-mt8192-mfg.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-mt8192-mfg.c b/drivers/clk/mediatek/clk-mt8192-mfg.c new file mode 100644 index 000000000000..3bbc7469f0e4 --- /dev/null +++ b/drivers/clk/mediatek/clk-mt8192-mfg.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Copyright (c) 2021 MediaTek Inc. +// Author: Chun-Jie Chen + +#include +#include +#include + +#include "clk-mtk.h" +#include "clk-gate.h" + +#include + +static const struct mtk_gate_regs mfg_cg_regs = { + .set_ofs = 0x4, + .clr_ofs = 0x8, + .sta_ofs = 0x0, +}; + +#define GATE_MFG(_id, _name, _parent, _shift) \ + GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + +static const struct mtk_gate mfg_clks[] = { + GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_pll_sel", 0), +}; + +static const struct mtk_clk_desc mfg_desc = { + .clks = mfg_clks, + .num_clks = ARRAY_SIZE(mfg_clks), +}; + +static const struct of_device_id of_match_clk_mt8192_mfg[] = { + { + .compatible = "mediatek,mt8192-mfgcfg", + .data = &mfg_desc, + }, { + /* sentinel */ + } +}; + +static struct platform_driver clk_mt8192_mfg_drv = { + .probe = mtk_clk_simple_probe, + .driver = { + .name = "clk-mt8192-mfg", + .of_match_table = of_match_clk_mt8192_mfg, + }, +}; + +builtin_platform_driver(clk_mt8192_mfg_drv); -- 2.18.0