Skip to contentSkip to conversation

MediaTek MT8188 clock support

PATCH Superseded Garmin.Chang 2 participants 34 messages Mar 9, 2023 – Mar 31, 2023

Subsystems (5)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover MediaTek MT8188 clock support

Base on tag: next-20230309, linux-next/master

changes since v5:
- modify mediatek,mt8188-clk.h
- modify apmixedsys clock
- modify topckgen clock
- modify mfgcfg clock
- modify vdecsys clock
- modify vdosys0 clock
- modify vdosys1 clock
- modify vencsys clock
- modify vppsys0 clock
- modify vppsys1 clock
- modify vencsys clock
- modify adsp clock

Garmin.Chang (19):
dt-bindings: clock: mediatek: Add new MT8188 clock
clk: mediatek: Add MT8188 apmixedsys clock support
clk: mediatek: Add MT8188 topckgen clock support
clk: mediatek: Add MT8188 peripheral clock support
clk: mediatek: Add MT8188 infrastructure clock support
clk: mediatek: Add MT8188 camsys clock support
clk: mediatek: Add MT8188 ccusys clock support
clk: mediatek: Add MT8188 imgsys clock support
clk: mediatek: Add MT8188 ipesys clock support
clk: mediatek: Add MT8188 mfgcfg clock support
clk: mediatek: Add MT8188 vdecsys clock support
clk: mediatek: Add MT8188 vdosys0 clock support
clk: mediatek: Add MT8188 vdosys1 clock support
clk: mediatek: Add MT8188 vencsys clock support
clk: mediatek: Add MT8188 vppsys0 clock support
clk: mediatek: Add MT8188 vppsys1 clock support
clk: mediatek: Add MT8188 wpesys clock support
clk: mediatek: Add MT8188 imp i2c wrapper clock support
clk: mediatek: Add MT8188 adsp clock support

 .../bindings/clock/mediatek,mt8188-clock.yaml |   71 +
 .../clock/mediatek,mt8188-sys-clock.yaml      |   55 +
 drivers/clk/mediatek/Kconfig                  |   11 +
 drivers/clk/mediatek/Makefile                 |    7 +
 .../clk/mediatek/clk-mt8188-adsp_audio26m.c   |   45 +
 drivers/clk/mediatek/clk-mt8188-apmixedsys.c  |  154 ++
 drivers/clk/mediatek/clk-mt8188-cam.c         |  118 ++
 drivers/clk/mediatek/clk-mt8188-ccu.c         |   48 +
 drivers/clk/mediatek/clk-mt8188-img.c         |  110 ++
 .../clk/mediatek/clk-mt8188-imp_iic_wrap.c    |   78 +
 drivers/clk/mediatek/clk-mt8188-infra_ao.c    |  196 +++
 drivers/clk/mediatek/clk-mt8188-ipe.c         |   50 +
 drivers/clk/mediatek/clk-mt8188-mfg.c         |   47 +
 drivers/clk/mediatek/clk-mt8188-peri_ao.c     |   56 +
 drivers/clk/mediatek/clk-mt8188-topckgen.c    | 1347 +++++++++++++++++
 drivers/clk/mediatek/clk-mt8188-vdec.c        |   90 ++
 drivers/clk/mediatek/clk-mt8188-vdo0.c        |  135 ++
 drivers/clk/mediatek/clk-mt8188-vdo1.c        |  182 +++
 drivers/clk/mediatek/clk-mt8188-venc.c        |   52 +
 drivers/clk/mediatek/clk-mt8188-vpp0.c        |  144 ++
 drivers/clk/mediatek/clk-mt8188-vpp1.c        |  139 ++
 drivers/clk/mediatek/clk-mt8188-wpe.c         |  101 ++
 .../dt-bindings/clock/mediatek,mt8188-clk.h   |  726 +++++++++
 23 files changed, 3962 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8188-clock.yaml
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8188-sys-clock.yaml
 create mode 100644 drivers/clk/mediatek/clk-mt8188-adsp_audio26m.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-apmixedsys.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-cam.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-ccu.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-img.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-imp_iic_wrap.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-infra_ao.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-ipe.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-mfg.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-peri_ao.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-topckgen.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vdec.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vdo0.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vdo1.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-venc.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vpp0.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vpp1.c
 create mode 100644 drivers/clk/mediatek/clk-mt8188-wpe.c
 create mode 100644 include/dt-bindings/clock/mediatek,mt8188-clk.h
Signature · 1 line
2.18.0
#1 lore raw

PATCH v6 1/19 dt-bindings: clock: mediatek: Add new MT8188 clock

Add the new binding documentation for system clock and functional clock on MediaTek MT8188.

---
 .../bindings/clock/mediatek,mt8188-clock.yaml |  71 ++
 .../clock/mediatek,mt8188-sys-clock.yaml      |  55 ++
 .../dt-bindings/clock/mediatek,mt8188-clk.h   | 726 ++++++++++++++++++
 3 files changed, 852 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8188-clock.yaml
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8188-sys-clock.yaml
 create mode 100644 include/dt-bindings/clock/mediatek,mt8188-clk.h
Documentation/devicetree/bindings/clock/mediatek,mt8188-clock.yaml new file +71 -0
new file mode 100644
index 000000000000..d7214d97b2ba
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/mediatek,mt8188-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Functional Clock Controller for MT8188
+
+maintainers:
+  - Garmin Chang <[email protected]>
+
+description: |
+  The clock architecture in MediaTek like below
+  PLLs -->
+          dividers -->
+                      muxes
+                           -->
+                              clock gate
+
+  The devices provide clock gate control in different IP blocks.
+
+properties:
+  compatible:
+    enum:
+      - mediatek,mt8188-adsp-audio26m
+      - mediatek,mt8188-camsys
+      - mediatek,mt8188-camsys-rawa
+      - mediatek,mt8188-camsys-rawb
+      - mediatek,mt8188-camsys-yuva
+      - mediatek,mt8188-camsys-yuvb
+      - mediatek,mt8188-ccusys
+      - mediatek,mt8188-imgsys
+      - mediatek,mt8188-imgsys-wpe1
+      - mediatek,mt8188-imgsys-wpe2
+      - mediatek,mt8188-imgsys-wpe3
+      - mediatek,mt8188-imgsys1-dip-nr
+      - mediatek,mt8188-imgsys1-dip-top
+      - mediatek,mt8188-imp-iic-wrap-c
+      - mediatek,mt8188-imp-iic-wrap-en
+      - mediatek,mt8188-imp-iic-wrap-w
+      - mediatek,mt8188-ipesys
+      - mediatek,mt8188-mfgcfg
+      - mediatek,mt8188-vdecsys
+      - mediatek,mt8188-vdecsys-soc
+      - mediatek,mt8188-vencsys
+      - mediatek,mt8188-vppsys0
+      - mediatek,mt8188-vppsys1
+      - mediatek,mt8188-wpesys
+      - mediatek,mt8188-wpesys-vpp0
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    clock-controller@11283000 {
+        compatible = "mediatek,mt8188-imp-iic-wrap-c";
+        reg = <0x11283000 0x1000>;
+        #clock-cells = <1>;
+    };
+
Documentation/devicetree/bindings/clock/mediatek,mt8188-sys-clock.yaml new file +55 -0

55 lines not on this page · raw message

include/dt-bindings/clock/mediatek,mt8188-clk.h new file +726 -0

726 lines not on this page · raw message

Signature · 1 line
2.18.0
#2 lore raw

PATCH v6 2/19 clk: mediatek: Add MT8188 apmixedsys clock support

In reply to Garmin.Chang

Add MT8188 apmixedsys clock controller which provides Plls generated from SoC 26m and ssusb clock gate control.

---
 drivers/clk/mediatek/Kconfig                 |  11 ++
 drivers/clk/mediatek/Makefile                |   1 +
 drivers/clk/mediatek/clk-mt8188-apmixedsys.c | 154 +++++++++++++++++++
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-apmixedsys.c
drivers/clk/mediatek/Kconfig +11 -0
index 2d14855dd37e..d7115089c4f6 100644
@@ -604,6 +604,17 @@ config COMMON_CLK_MT8186
 	help
 	  This driver supports MediaTek MT8186 clocks.
 
+config COMMON_CLK_MT8188
+	bool "Clock driver for MediaTek MT8188"
+	depends on ARM64 || COMPILE_TEST
+	select COMMON_CLK_MEDIATEK
+	default ARCH_MEDIATEK
+	help
+	  This driver supports MediaTek MT8188 basic clocks and clocks
+	  required for various peripheral found on MediaTek. Choose
+	  M or Y here if you want to use clocks such as peri_ao,
+	  infra_ao, etc.
+
 config COMMON_CLK_MT8192
 	bool "Clock driver for MediaTek MT8192"
 	depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index e5d018270ed0..1f822fcf6084 100644
@@ -91,6 +91,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
 				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.18.0
#3 lore raw

Re: [PATCH v6 02/19] clk: mediatek: Add MT8188 apmixedsys clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 16 lines

Add MT8188 apmixedsys clock controller which provides Plls generated from SoC 26m and ssusb clock gate control.

---
  drivers/clk/mediatek/Kconfig                 |  11 ++
  drivers/clk/mediatek/Makefile                |   1 +
  drivers/clk/mediatek/clk-mt8188-apmixedsys.c | 154 +++++++++++++++++++
  3 files changed, 166 insertions(+)

create mode 100644 drivers/clk/mediatek/clk-mt8188-apmixedsys.c

drivers/clk/mediatek/Kconfig +0 -0
index 2d14855dd37e..d7115089c4f6 100644

drivers/clk/mediatek/Kconfig config COMMON_CLK_MT8186 · line 608

Quoted 5 lines
drivers/clk/mediatek/Kconfig +2 -0
@@ -604,6 +604,17 @@ config COMMON_CLK_MT8186
  	help
  	  This driver supports MediaTek MT8186 clocks.
 
+config COMMON_CLK_MT8188
+	bool "Clock driver for MediaTek MT8188"

this can be a tristate.

Quoted 30 lines
drivers/clk/mediatek/Kconfig +9 -0
+	depends on ARM64 || COMPILE_TEST
+	select COMMON_CLK_MEDIATEK
+	default ARCH_MEDIATEK
+	help
+	  This driver supports MediaTek MT8188 basic clocks and clocks
+	  required for various peripheral found on MediaTek. Choose
+	  M or Y here if you want to use clocks such as peri_ao,
+	  infra_ao, etc.
+
  config COMMON_CLK_MT8192
  	bool "Clock driver for MediaTek MT8192"
  	depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index e5d018270ed0..1f822fcf6084 100644
@@ -91,6 +91,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
  				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
  				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +0 -0
new file mode 100644
index 000000000000..db64340386d9

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 1

Quoted 1 line
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-only

// SPDX ...
/*
* Copyright ...
* Author ..
*/

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 8

Quoted 7 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +7 -0
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>

Please order by name: dt-bindings goes first.

Quoted 75 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +75 -0
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
+
+static const struct mtk_gate_regs apmixed_cg_regs = {
+	.set_ofs = 0x8,
+	.clr_ofs = 0x8,
+	.sta_ofs = 0x8,
+};
+
+#define GATE_APMIXED(_id, _name, _parent, _shift)			\
+	GATE_MTK(_id, _name, _parent, &apmixed_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
+
+static const struct mtk_gate apmixed_clks[] = {
+	GATE_APMIXED(CLK_APMIXED_PLL_SSUSB26M_EN, "pll_ssusb26m_en", "clk26m", 1),
+};
+
+#define MT8188_PLL_FMAX		(3800UL * MHZ)
+#define MT8188_PLL_FMIN		(1500UL * MHZ)
+#define MT8188_INTEGER_BITS	8
+
+#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags,		\
+	    _rst_bar_mask, _pcwbits, _pd_reg, _pd_shift,		\
+	    _tuner_reg, _tuner_en_reg, _tuner_en_bit,			\
+	    _pcw_reg, _pcw_shift, _pcw_chg_reg,				\
+	    _en_reg, _pll_en_bit) {					\
+		.id = _id,						\
+		.name = _name,						\
+		.reg = _reg,						\
+		.pwr_reg = _pwr_reg,					\
+		.en_mask = _en_mask,					\
+		.flags = _flags,					\
+		.rst_bar_mask = _rst_bar_mask,				\
+		.fmax = MT8188_PLL_FMAX,				\
+		.fmin = MT8188_PLL_FMIN,				\
+		.pcwbits = _pcwbits,					\
+		.pcwibits = MT8188_INTEGER_BITS,			\
+		.pd_reg = _pd_reg,					\
+		.pd_shift = _pd_shift,					\
+		.tuner_reg = _tuner_reg,				\
+		.tuner_en_reg = _tuner_en_reg,				\
+		.tuner_en_bit = _tuner_en_bit,				\
+		.pcw_reg = _pcw_reg,					\
+		.pcw_shift = _pcw_shift,				\
+		.pcw_chg_reg = _pcw_chg_reg,				\
+		.en_reg = _en_reg,					\
+		.pll_en_bit = _pll_en_bit,				\
+	}
+
+static const struct mtk_pll_data plls[] = {
+	PLL(CLK_APMIXED_ETHPLL, "ethpll", 0x044C, 0x0458, 0,
+	    0, 0, 22, 0x0450, 24, 0, 0, 0, 0x0450, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0514, 0x0520, 0,
+	    0, 0, 22, 0x0518, 24, 0, 0, 0, 0x0518, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_TVDPLL1, "tvdpll1", 0x0524, 0x0530, 0,
+	    0, 0, 22, 0x0528, 24, 0, 0, 0, 0x0528, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_TVDPLL2, "tvdpll2", 0x0534, 0x0540, 0,
+	    0, 0, 22, 0x0538, 24, 0, 0, 0, 0x0538, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_MMPLL, "mmpll", 0x0544, 0x0550, 0xff000000,
+	    HAVE_RST_BAR, BIT(23), 22, 0x0548, 24, 0, 0, 0, 0x0548, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x045C, 0x0468, 0xff000000,
+	    HAVE_RST_BAR, BIT(23), 22, 0x0460, 24, 0, 0, 0, 0x0460, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_IMGPLL, "imgpll", 0x0554, 0x0560, 0,
+	    0, 0, 22, 0x0558, 24, 0, 0, 0, 0x0558, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0504, 0x0510, 0xff000000,
+	    HAVE_RST_BAR, BIT(23), 22, 0x0508, 24, 0, 0, 0, 0x0508, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_ADSPPLL, "adsppll", 0x042C, 0x0438, 0,
+	    0, 0, 22, 0x0430, 24, 0, 0, 0, 0x0430, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_APLL1, "apll1", 0x0304, 0x0314, 0,
+	    0, 0, 32, 0x0308, 24, 0x0034, 0x0000, 12, 0x030C, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_APLL2, "apll2", 0x0318, 0x0328, 0,
+	    0, 0, 32, 0x031C, 24, 0x0038, 0x0000, 13, 0x0320, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_APLL3, "apll3", 0x032C, 0x033C, 0,
+	    0, 0, 32, 0x0330, 24, 0x003C, 0x0000, 14, 0x0334, 0, 0, 0, 9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 93

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +10 -0
+	PLL(CLK_APMIXED_APLL4, "apll4", 0x0404, 0x0414, 0,
+	    0, 0, 32, 0x0408, 24, 0x0040, 0x0000, 15, 0x040C, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_APLL5, "apll5", 0x0418, 0x0428, 0,
+	    0, 0, 32, 0x041C, 24, 0x0044, 0x0000, 16, 0x0420, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_MFGPLL, "mfgpll", 0x0340, 0x034C, 0,
+	    0, 0, 22, 0x0344, 24, 0, 0, 0, 0x0344, 0, 0, 0, 9),
+};
+
+static const struct of_device_id of_match_clk_mt8188_apmixed[] = {
+	{ .compatible = "mediatek,mt8188-apmixedsys", },

You don't need the comma after compatible

	{ .compatible = "mediatek,mt8188-apmixedsys" },

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 94

Quoted 1 line
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+	{}

At the end, please say what the last entry is; a common way to do this is:

	{ /* sentinel */ }

...since that's a sentinel! :-)

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 95

Quoted 1 line
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+};

You miss just one little step for module auto-loading here.

MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_apmixed);

Quoted 17 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +17 -0
+
+static int clk_mt8188_apmixed_probe(struct platform_device *pdev)
+{
+	struct clk_hw_onecell_data *clk_data;
+	struct device_node *node = pdev->dev.of_node;
+	int r;
+
+	clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
+
+	r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
+	if (r)
+		goto free_apmixed_data;
+
+	r = mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
+				   ARRAY_SIZE(apmixed_clks), clk_data);

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 122

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +10 -0
+	if (r)
+		goto unregister_plls;
+
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
+	if (r)
+		goto unregister_gates;
+
+	platform_set_drvdata(pdev, clk_data);
+
+	return r;

Reaching this point means that no error occurred, so here...

	return 0;
Quoted 22 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +22 -0
+
+unregister_gates:
+	mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
+unregister_plls:
+	mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
+free_apmixed_data:
+	mtk_free_clk_data(clk_data);
+	return r;
+}
+
+static int clk_mt8188_apmixed_remove(struct platform_device *pdev)
+{
+	struct device_node *node = pdev->dev.of_node;
+	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
+
+	of_clk_del_provider(node);
+	mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
+	mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
+	mtk_free_clk_data(clk_data);
+
+	return 0;
+}

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 154

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +10 -0
+
+static struct platform_driver clk_mt8188_apmixed_drv = {
+	.probe = clk_mt8188_apmixed_probe,
+	.remove = clk_mt8188_apmixed_remove,
+	.driver = {
+		.name = "clk-mt8188-apmixed",
+		.of_match_table = of_match_clk_mt8188_apmixed,
+	},
+};
+builtin_platform_driver(clk_mt8188_apmixed_drv);

You can change builtin_platform_driver() to module_platform_driver() here to achieve modularity.

Regards,
Angelo

#4 lore raw

Re: [PATCH v6 02/19] clk: mediatek: Add MT8188 apmixedsys clock support

Quoted 71 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 18 lines

Add MT8188 apmixedsys clock controller which provides Plls generated from SoC 26m and ssusb clock gate control.

---
  drivers/clk/mediatek/Kconfig                 |  11 ++
  drivers/clk/mediatek/Makefile                |   1 +
  drivers/clk/mediatek/clk-mt8188-apmixedsys.c | 154
+++++++++++++++++++
  3 files changed, 166 insertions(+)

create mode 100644 drivers/clk/mediatek/clk-mt8188-apmixedsys.c

drivers/clk/mediatek/Kconfig +0 -0
index 2d14855dd37e..d7115089c4f6 100644

drivers/clk/mediatek/Kconfig config COMMON_CLK_MT8186 · line 608

Quoted 5 lines
drivers/clk/mediatek/Kconfig +2 -0
@@ -604,6 +604,17 @@ config COMMON_CLK_MT8186
  	help
  	  This driver supports MediaTek MT8186 clocks.
 
+config COMMON_CLK_MT8188
+	bool "Clock driver for MediaTek MT8188"

this can be a tristate.

Quoted 36 lines
drivers/clk/mediatek/Kconfig +9 -0
+	depends on ARM64 || COMPILE_TEST
+	select COMMON_CLK_MEDIATEK
+	default ARCH_MEDIATEK
+	help
+	  This driver supports MediaTek MT8188 basic clocks and clocks
+	  required for various peripheral found on MediaTek. Choose
+	  M or Y here if you want to use clocks such as peri_ao,
+	  infra_ao, etc.
+
  config COMMON_CLK_MT8192
  	bool "Clock driver for MediaTek MT8192"
  	depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +0 -0
index e5d018270ed0..1f822fcf6084 100644
@@ -91,6 +91,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
clk-mt8186-mfg.o clk-mt8186-mm.o
clk-mt8186-wpe.o \
clk-mt8186-img.o clk-mt8186-vdec.o
clk-mt8186-venc.o \
clk-mt8186-cam.o clk-mt8186-mdp.o
clk-mt8186-ipe.o

drivers/clk/mediatek/Makefile +1 -0
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +0 -0
new file mode 100644
index 000000000000..db64340386d9

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 1

Quoted 1 line
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-only

// SPDX ...
/*
* Copyright ...
* Author ..
*/

Quoted 10 lines

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 8

Quoted 7 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +7 -0
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>

Please order by name: dt-bindings goes first.

Thank you for your suggestions.

Ok, I would modify this and below in v7.

Quoted 122 lines
Quoted 104 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +12 -0
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
+
+static const struct mtk_gate_regs apmixed_cg_regs = {
+	.set_ofs = 0x8,
+	.clr_ofs = 0x8,
+	.sta_ofs = 0x8,
+};
+
+#define GATE_APMIXED(_id, _name, _parent, _shift)			

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+	GATE_MTK(_id, _name, _parent, &apmixed_cg_regs, _shift,

&mtk_clk_gate_ops_no_setclr_inv)

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +3 -0
+
+static const struct mtk_gate apmixed_clks[] = {
+	GATE_APMIXED(CLK_APMIXED_PLL_SSUSB26M_EN, "pll_ssusb26m_en",

"clk26m", 1),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +7 -0
+};
+
+#define MT8188_PLL_FMAX		(3800UL * MHZ)
+#define MT8188_PLL_FMIN		(1500UL * MHZ)
+#define MT8188_INTEGER_BITS	8
+
+#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags,		

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+	    _rst_bar_mask, _pcwbits, _pd_reg, _pd_shift,		\
+	    _tuner_reg, _tuner_en_reg, _tuner_en_bit,			

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+	    _pcw_reg, _pcw_shift, _pcw_chg_reg,				

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +3 -0
+	    _en_reg, _pll_en_bit) {					\
+		.id = _id,						\
+		.name = _name,						

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+		.reg = _reg,						

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+		.pwr_reg = _pwr_reg,					

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+		.en_mask = _en_mask,					

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+		.flags = _flags,					\
+		.rst_bar_mask = _rst_bar_mask,				

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +3 -0
+		.fmax = MT8188_PLL_FMAX,				\
+		.fmin = MT8188_PLL_FMIN,				\
+		.pcwbits = _pcwbits,					

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +3 -0
+		.pcwibits = MT8188_INTEGER_BITS,			\
+		.pd_reg = _pd_reg,					\
+		.pd_shift = _pd_shift,					

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+		.tuner_reg = _tuner_reg,				\
+		.tuner_en_reg = _tuner_en_reg,				

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+		.tuner_en_bit = _tuner_en_bit,				

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+		.pcw_reg = _pcw_reg,					

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+		.pcw_shift = _pcw_shift,				\
+		.pcw_chg_reg = _pcw_chg_reg,				

\

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +15 -0
+		.en_reg = _en_reg,					\
+		.pll_en_bit = _pll_en_bit,				\
+	}
+
+static const struct mtk_pll_data plls[] = {
+	PLL(CLK_APMIXED_ETHPLL, "ethpll", 0x044C, 0x0458, 0,
+	    0, 0, 22, 0x0450, 24, 0, 0, 0, 0x0450, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0514, 0x0520, 0,
+	    0, 0, 22, 0x0518, 24, 0, 0, 0, 0x0518, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_TVDPLL1, "tvdpll1", 0x0524, 0x0530, 0,
+	    0, 0, 22, 0x0528, 24, 0, 0, 0, 0x0528, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_TVDPLL2, "tvdpll2", 0x0534, 0x0540, 0,
+	    0, 0, 22, 0x0538, 24, 0, 0, 0, 0x0538, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_MMPLL, "mmpll", 0x0544, 0x0550, 0xff000000,
+	    HAVE_RST_BAR, BIT(23), 22, 0x0548, 24, 0, 0, 0, 0x0548, 0,

0, 0, 9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+	PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x045C, 0x0468, 0xff000000,
+	    HAVE_RST_BAR, BIT(23), 22, 0x0460, 24, 0, 0, 0, 0x0460, 0,

0, 0, 9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +4 -0
+	PLL(CLK_APMIXED_IMGPLL, "imgpll", 0x0554, 0x0560, 0,
+	    0, 0, 22, 0x0558, 24, 0, 0, 0, 0x0558, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0504, 0x0510, 0xff000000,
+	    HAVE_RST_BAR, BIT(23), 22, 0x0508, 24, 0, 0, 0, 0x0508, 0,

0, 0, 9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +4 -0
+	PLL(CLK_APMIXED_ADSPPLL, "adsppll", 0x042C, 0x0438, 0,
+	    0, 0, 22, 0x0430, 24, 0, 0, 0, 0x0430, 0, 0, 0, 9),
+	PLL(CLK_APMIXED_APLL1, "apll1", 0x0304, 0x0314, 0,
+	    0, 0, 32, 0x0308, 24, 0x0034, 0x0000, 12, 0x030C, 0, 0, 0,

9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+	PLL(CLK_APMIXED_APLL2, "apll2", 0x0318, 0x0328, 0,
+	    0, 0, 32, 0x031C, 24, 0x0038, 0x0000, 13, 0x0320, 0, 0, 0,

9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+	PLL(CLK_APMIXED_APLL3, "apll3", 0x032C, 0x033C, 0,
+	    0, 0, 32, 0x0330, 24, 0x003C, 0x0000, 14, 0x0334, 0, 0, 0,

9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+	PLL(CLK_APMIXED_APLL4, "apll4", 0x0404, 0x0414, 0,
+	    0, 0, 32, 0x0408, 24, 0x0040, 0x0000, 15, 0x040C, 0, 0, 0,

9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +2 -0
+	PLL(CLK_APMIXED_APLL5, "apll5", 0x0418, 0x0428, 0,
+	    0, 0, 32, 0x041C, 24, 0x0044, 0x0000, 16, 0x0420, 0, 0, 0,

9),

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 93

Quoted 6 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +6 -0
+	PLL(CLK_APMIXED_MFGPLL, "mfgpll", 0x0340, 0x034C, 0,
+	    0, 0, 22, 0x0344, 24, 0, 0, 0, 0x0344, 0, 0, 0, 9),
+};
+
+static const struct of_device_id of_match_clk_mt8188_apmixed[] = {
+	{ .compatible = "mediatek,mt8188-apmixedsys", },

You don't need the comma after compatible

	{ .compatible = "mediatek,mt8188-apmixedsys" },

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 94

Quoted 1 line
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +1 -0
+	{}

At the end, please say what the last entry is; a common way to do this is:

	{ /* sentinel */ }
Quoted 7 lines

...since that's a sentinel! :-)
Ok.

Quoted 1 line

+};

You miss just one little step for module auto-loading here.

MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_apmixed);

Ok.

Quoted 33 lines
Quoted 24 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +12 -0
+
+static int clk_mt8188_apmixed_probe(struct platform_device *pdev)
+{
+	struct clk_hw_onecell_data *clk_data;
+	struct device_node *node = pdev->dev.of_node;
+	int r;
+
+	clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
+
+	r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls),

clk_data);

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +9 -0
+	if (r)
+		goto free_apmixed_data;
+
+	r = mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
+				   ARRAY_SIZE(apmixed_clks), clk_data);
+	if (r)
+		goto unregister_plls;
+
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,

clk_data);

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 122

Quoted 6 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +6 -0
+	if (r)
+		goto unregister_gates;
+
+	platform_set_drvdata(pdev, clk_data);
+
+	return r;

Reaching this point means that no error occurred, so here...

Quoted 2 lines
	return 0;

OK.

Quoted 31 lines
Quoted 31 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +3 -0
+
+unregister_gates:
+	mtk_clk_unregister_gates(apmixed_clks,

ARRAY_SIZE(apmixed_clks), clk_data);

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +11 -0
+unregister_plls:
+	mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
+free_apmixed_data:
+	mtk_free_clk_data(clk_data);
+	return r;
+}
+
+static int clk_mt8188_apmixed_remove(struct platform_device *pdev)
+{
+	struct device_node *node = pdev->dev.of_node;
+	struct clk_hw_onecell_data *clk_data =

platform_get_drvdata(pdev);

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +3 -0
+
+	of_clk_del_provider(node);
+	mtk_clk_unregister_gates(apmixed_clks,

ARRAY_SIZE(apmixed_clks), clk_data);

drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +11 -0
+	mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
+	mtk_free_clk_data(clk_data);
+
+	return 0;
+}
+
+static struct platform_driver clk_mt8188_apmixed_drv = {
+	.probe = clk_mt8188_apmixed_probe,
+	.remove = clk_mt8188_apmixed_remove,
+	.driver = {
+		.name = "clk-mt8188-apmixed",
Quoted 8 lines

drivers/clk/mediatek/clk-mt8188-apmixedsys.c line 154

Quoted 4 lines
drivers/clk/mediatek/clk-mt8188-apmixedsys.c new file +4 -0
+		.of_match_table = of_match_clk_mt8188_apmixed,
+	},
+};
+builtin_platform_driver(clk_mt8188_apmixed_drv);

You can change builtin_platform_driver() to module_platform_driver() here to
achieve modularity.

OK.

Quoted 4 lines

Regards,
Angelo

#5 lore raw

PATCH v6 3/19 clk: mediatek: Add MT8188 topckgen clock support

In reply to Garmin.Chang

Add MT8188 topckgen clock controller which provides muxes, dividers to handle variety clock selection in other IP blocks.

---
 drivers/clk/mediatek/Makefile              |    2 +-
 drivers/clk/mediatek/clk-mt8188-topckgen.c | 1347 ++++++++++++++++++++
 2 files changed, 1348 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-topckgen.c
drivers/clk/mediatek/Makefile +1 -1
index 1f822fcf6084..d845bf7308c3 100644
@@ -91,7 +91,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
 				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
-obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1347 -0

1,347 lines not on this page · raw message

Signature · 1 line
2.18.0
#6 lore raw

Re: [PATCH v6 03/19] clk: mediatek: Add MT8188 topckgen clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 29 lines

Add MT8188 topckgen clock controller which provides muxes, dividers to handle variety clock selection in other IP blocks.

---
  drivers/clk/mediatek/Makefile              |    2 +-
  drivers/clk/mediatek/clk-mt8188-topckgen.c | 1347 ++++++++++++++++++++
  2 files changed, 1348 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-topckgen.c

drivers/clk/mediatek/Makefile +1 -1
index 1f822fcf6084..d845bf7308c3 100644
@@ -91,7 +91,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
  				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
  				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
-obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +0 -0
new file mode 100644
index 000000000000..b3f9577de081
@@ -0,0 +1,1347 @@

..snip..

drivers/clk/mediatek/clk-mt8188-topckgen.c line 1223

Quoted 3 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +3 -0
+
+static const struct of_device_id of_match_clk_mt8188_topck[] = {
+	{ .compatible = "mediatek,mt8188-topckgen", },
	{ .compatible = "mediatek,mt8188-topckgen" },
	{ /* sentinel */ }
Quoted 44 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +44 -0
+	{}
+};
+
+/* Register mux notifier for MFG mux */
+static int clk_mt8188_reg_mfg_mux_notifier(struct device *dev, struct clk *clk)
+{
+	struct mtk_mux_nb *mfg_mux_nb;
+
+	mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL);
+	if (!mfg_mux_nb)
+		return -ENOMEM;
+
+	mfg_mux_nb->ops = &clk_mux_ops;
+	mfg_mux_nb->bypass_index = 0; /* Bypass to TOP_MFG_CORE_TMP */
+
+	return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb);
+}
+
+static int clk_mt8188_topck_probe(struct platform_device *pdev)
+{
+	struct clk_hw_onecell_data *top_clk_data;
+	struct device_node *node = pdev->dev.of_node;
+	struct clk_hw *hw;
+	int r;
+	void __iomem *base;
+
+	top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
+	if (!top_clk_data)
+		return -ENOMEM;
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
+		r = PTR_ERR(base);
+		goto free_top_data;
+	}
+
+	r = mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
+					top_clk_data);
+	if (r)
+		goto free_top_data;
+
+	r = mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
+	if (r)
+		goto unregister_fixed_clks;

drivers/clk/mediatek/clk-mt8188-topckgen.c line 1277

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +10 -0
+
+	r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes,
+				   ARRAY_SIZE(top_mtk_muxes), node,
+				   &mt8188_clk_lock, top_clk_data);
+	if (r)
+		goto unregister_factors;
+
+	hw = devm_clk_hw_register_mux(&pdev->dev, "mfg_ck_fast_ref", mfg_fast_ref_parents,
+				      ARRAY_SIZE(mfg_fast_ref_parents), CLK_SET_RATE_PARENT,
+				      (base + 0x250), 8, 1, 0, &mt8188_clk_lock);

If you make this a mtk mux and put it in top_mtk_muxes, you can migrate topckgen to the simple_probe() mechanism, greatly reducing the size of this file.

Quoted 60 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +60 -0
+	if (IS_ERR(hw)) {
+		r = PTR_ERR(hw);
+		goto unregister_muxes;
+	}
+	top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF] = hw;
+
+	r = clk_mt8188_reg_mfg_mux_notifier(&pdev->dev,
+					    top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF]->clk);
+	if (r)
+		goto unregister_muxes;
+
+	r = mtk_clk_register_composites(&pdev->dev, top_adj_divs,
+					ARRAY_SIZE(top_adj_divs), base,
+					&mt8188_clk_lock, top_clk_data);
+	if (r)
+		goto unregister_muxes;
+
+	r = mtk_clk_register_gates(&pdev->dev, node, top_clks,
+				   ARRAY_SIZE(top_clks), top_clk_data);
+	if (r)
+		goto unregister_composite_divs;
+
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
+	if (r)
+		goto unregister_gates;
+
+	platform_set_drvdata(pdev, top_clk_data);
+
+	return r;
+
+unregister_gates:
+	mtk_clk_unregister_gates(top_clks, ARRAY_SIZE(top_clks), top_clk_data);
+unregister_composite_divs:
+	mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), top_clk_data);
+unregister_muxes:
+	mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), top_clk_data);
+unregister_factors:
+	mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
+unregister_fixed_clks:
+	mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data);
+free_top_data:
+	mtk_free_clk_data(top_clk_data);
+	return r;
+}
+
+static int clk_mt8188_topck_remove(struct platform_device *pdev)
+{
+	struct clk_hw_onecell_data *top_clk_data = platform_get_drvdata(pdev);
+	struct device_node *node = pdev->dev.of_node;
+
+	of_clk_del_provider(node);
+	mtk_clk_unregister_gates(top_clks, ARRAY_SIZE(top_clks), top_clk_data);
+	mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), top_clk_data);
+	mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), top_clk_data);
+	mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
+	mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data);
+	mtk_free_clk_data(top_clk_data);
+
+	return 0;
+}

drivers/clk/mediatek/clk-mt8188-topckgen.c line 1347

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +10 -0
+
+static struct platform_driver clk_mt8188_topck_drv = {
+	.probe = clk_mt8188_topck_probe,
+	.remove = clk_mt8188_topck_remove,
+	.driver = {
+		.name = "clk-mt8188-topck",
+		.of_match_table = of_match_clk_mt8188_topck,
+	},
+};
+builtin_platform_driver(clk_mt8188_topck_drv);

module_platform_driver....
MODULE_LICENSE....

#7 lore raw

Re: [PATCH v6 03/19] clk: mediatek: Add MT8188 topckgen clock support

Quoted 41 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 37 lines

Add MT8188 topckgen clock controller which provides muxes, dividers to handle variety clock selection in other IP blocks.

---
  drivers/clk/mediatek/Makefile              |    2 +-
  drivers/clk/mediatek/clk-mt8188-topckgen.c | 1347
++++++++++++++++++++
  2 files changed, 1348 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-topckgen.c

drivers/clk/mediatek/Makefile +0 -0
index 1f822fcf6084..d845bf7308c3 100644
@@ -91,7 +91,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
clk-mt8186-mfg.o clk-mt8186-mm.o
clk-mt8186-wpe.o \
clk-mt8186-img.o clk-mt8186-vdec.o
clk-mt8186-venc.o \
clk-mt8186-cam.o clk-mt8186-mdp.o
clk-mt8186-ipe.o

drivers/clk/mediatek/Makefile +1 -1
-obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-

mt8188-topckgen.o
obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +0 -0
new file mode 100644
index 000000000000..b3f9577de081
@@ -0,0 +1,1347 @@

..snip..

Quoted 7 lines

drivers/clk/mediatek/clk-mt8188-topckgen.c line 1223

Quoted 3 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +3 -0
+
+static const struct of_device_id of_match_clk_mt8188_topck[] = {
+	{ .compatible = "mediatek,mt8188-topckgen", },
	{ .compatible = "mediatek,mt8188-topckgen" },
	{ /* sentinel */ }

Thank you for your suggestions.

Ok, I would remove comma in v7.

Quoted 58 lines
Quoted 58 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +5 -0
+	{}
+};
+
+/* Register mux notifier for MFG mux */
+static int clk_mt8188_reg_mfg_mux_notifier(struct device *dev,

struct clk *clk)

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +4 -0
+{
+	struct mtk_mux_nb *mfg_mux_nb;
+
+	mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb),

GFP_KERNEL);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +7 -0
+	if (!mfg_mux_nb)
+		return -ENOMEM;
+
+	mfg_mux_nb->ops = &clk_mux_ops;
+	mfg_mux_nb->bypass_index = 0; /* Bypass to TOP_MFG_CORE_TMP */
+
+	return devm_mtk_clk_mux_notifier_register(dev, clk,

mfg_mux_nb);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +21 -0
+}
+
+static int clk_mt8188_topck_probe(struct platform_device *pdev)
+{
+	struct clk_hw_onecell_data *top_clk_data;
+	struct device_node *node = pdev->dev.of_node;
+	struct clk_hw *hw;
+	int r;
+	void __iomem *base;
+
+	top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
+	if (!top_clk_data)
+		return -ENOMEM;
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
+		r = PTR_ERR(base);
+		goto free_top_data;
+	}
+
+	r = mtk_clk_register_fixed_clks(top_fixed_clks,

ARRAY_SIZE(top_fixed_clks),

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +5 -0
+					top_clk_data);
+	if (r)
+		goto free_top_data;
+
+	r = mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs),

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +10 -0
+	if (r)
+		goto unregister_fixed_clks;
+
+	r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes,
+				   ARRAY_SIZE(top_mtk_muxes), node,
+				   &mt8188_clk_lock, top_clk_data);
+	if (r)
+		goto unregister_factors;
+
+	hw = devm_clk_hw_register_mux(&pdev->dev, "mfg_ck_fast_ref",

mfg_fast_ref_parents,

Quoted 9 lines
Quoted 4 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1 -0
+				      ARRAY_SIZE(mfg_fast_ref_parents),

CLK_SET_RATE_PARENT,

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1 -0
+				      (base + 0x250), 8, 1, 0,

&mt8188_clk_lock);

If you make this a mtk mux and put it in top_mtk_muxes, you can migrate topckgen to
the simple_probe() mechanism, greatly reducing the size of this file.

After checking, the mt8195 chip uses top_mtk_muxes and does not use simple_probe() mechanism.

mt8188 and mt8195 also use top_mtk_muxes in the same way, so mt8188 will not be modified this time.

Quoted 87 lines
Quoted 74 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +8 -0
+	if (IS_ERR(hw)) {
+		r = PTR_ERR(hw);
+		goto unregister_muxes;
+	}
+	top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF] = hw;
+
+	r = clk_mt8188_reg_mfg_mux_notifier(&pdev->dev,
+					    top_clk_data-
Quoted 1 line

hws[CLK_TOP_MFG_CK_FAST_REF]->clk);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +6 -0
+	if (r)
+		goto unregister_muxes;
+
+	r = mtk_clk_register_composites(&pdev->dev, top_adj_divs,
+					ARRAY_SIZE(top_adj_divs), base,
+					&mt8188_clk_lock,

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +9 -0
+	if (r)
+		goto unregister_muxes;
+
+	r = mtk_clk_register_gates(&pdev->dev, node, top_clks,
+				   ARRAY_SIZE(top_clks), top_clk_data);
+	if (r)
+		goto unregister_composite_divs;
+
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +9 -0
+	if (r)
+		goto unregister_gates;
+
+	platform_set_drvdata(pdev, top_clk_data);
+
+	return r;
+
+unregister_gates:
+	mtk_clk_unregister_gates(top_clks, ARRAY_SIZE(top_clks),

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +2 -0
+unregister_composite_divs:
+	mtk_clk_unregister_composites(top_adj_divs,

ARRAY_SIZE(top_adj_divs), top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +2 -0
+unregister_muxes:
+	mtk_clk_unregister_muxes(top_mtk_muxes,

ARRAY_SIZE(top_mtk_muxes), top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +2 -0
+unregister_factors:
+	mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs),

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +2 -0
+unregister_fixed_clks:
+	mtk_clk_unregister_fixed_clks(top_fixed_clks,

ARRAY_SIZE(top_fixed_clks), top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +8 -0
+free_top_data:
+	mtk_free_clk_data(top_clk_data);
+	return r;
+}
+
+static int clk_mt8188_topck_remove(struct platform_device *pdev)
+{
+	struct clk_hw_onecell_data *top_clk_data =

platform_get_drvdata(pdev);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +4 -0
+	struct device_node *node = pdev->dev.of_node;
+
+	of_clk_del_provider(node);
+	mtk_clk_unregister_gates(top_clks, ARRAY_SIZE(top_clks),

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1 -0
+	mtk_clk_unregister_composites(top_adj_divs,

ARRAY_SIZE(top_adj_divs), top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1 -0
+	mtk_clk_unregister_muxes(top_mtk_muxes,

ARRAY_SIZE(top_mtk_muxes), top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1 -0
+	mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs),

top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +1 -0
+	mtk_clk_unregister_fixed_clks(top_fixed_clks,

ARRAY_SIZE(top_fixed_clks), top_clk_data);

drivers/clk/mediatek/clk-mt8188-topckgen.c new file +4 -0
+	mtk_free_clk_data(top_clk_data);
+
+	return 0;
+}

drivers/clk/mediatek/clk-mt8188-topckgen.c line 1347

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-topckgen.c new file +10 -0
+
+static struct platform_driver clk_mt8188_topck_drv = {
+	.probe = clk_mt8188_topck_probe,
+	.remove = clk_mt8188_topck_remove,
+	.driver = {
+		.name = "clk-mt8188-topck",
+		.of_match_table = of_match_clk_mt8188_topck,
+	},
+};
+builtin_platform_driver(clk_mt8188_topck_drv);

module_platform_driver....
MODULE_LICENSE....

#8 lore raw

PATCH v6 4/19 clk: mediatek: Add MT8188 peripheral clock support

In reply to Garmin.Chang

Add MT8188 peripheral clock controller which provides clock gate control for ethernet/flashif/pcie/ssusb.

---
 drivers/clk/mediatek/Makefile             |  3 +-
 drivers/clk/mediatek/clk-mt8188-peri_ao.c | 56 +++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-peri_ao.c
drivers/clk/mediatek/Makefile +2 -1
index d845bf7308c3..f38a5cea2925 100644
@@ -91,7 +91,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
 				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
-obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
+				   clk-mt8188-peri_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.18.0
#9 lore raw

Re: [PATCH v6 04/19] clk: mediatek: Add MT8188 peripheral clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 67 lines

Add MT8188 peripheral clock controller which provides clock gate control for ethernet/flashif/pcie/ssusb.

---
  drivers/clk/mediatek/Makefile             |  3 +-
  drivers/clk/mediatek/clk-mt8188-peri_ao.c | 56 +++++++++++++++++++++++
  2 files changed, 58 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-peri_ao.c

drivers/clk/mediatek/Makefile +2 -1
index d845bf7308c3..f38a5cea2925 100644
@@ -91,7 +91,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
  				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
  				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
-obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
+				   clk-mt8188-peri_ao.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +36 -0
new file mode 100644
index 000000000000..683010453a10
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs peri_ao_cg_regs = {
+	.set_ofs = 0x10,
+	.clr_ofs = 0x14,
+	.sta_ofs = 0x18,
+};
+
+#define GATE_PERI_AO(_id, _name, _parent, _shift)			\
+	GATE_MTK(_id, _name, _parent, &peri_ao_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
+
+static const struct mtk_gate peri_ao_clks[] = {
+	GATE_PERI_AO(CLK_PERI_AO_ETHERNET, "peri_ao_ethernet", "top_axi", 0),
+	GATE_PERI_AO(CLK_PERI_AO_ETHERNET_BUS, "peri_ao_ethernet_bus", "top_axi", 1),
+	GATE_PERI_AO(CLK_PERI_AO_FLASHIF_BUS, "peri_ao_flashif_bus", "top_axi", 3),
+	GATE_PERI_AO(CLK_PERI_AO_FLASHIF_26M, "peri_ao_flashif_26m", "clk26m", 4),
+	GATE_PERI_AO(CLK_PERI_AO_FLASHIFLASHCK, "peri_ao_flashiflashck", "top_spinor", 5),
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_2P_BUS, "peri_ao_ssusb_2p_bus", "top_usb_top_2p", 9),
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_2P_XHCI, "peri_ao_ssusb_2p_xhci", "top_ssusb_xhci_2p", 10),
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_3P_BUS, "peri_ao_ssusb_3p_bus", "top_usb_top_3p", 11),
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_3P_XHCI, "peri_ao_ssusb_3p_xhci", "top_ssusb_xhci_3p", 12),
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_BUS, "peri_ao_ssusb_bus", "top_usb_top", 13),
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_XHCI, "peri_ao_ssusb_xhci", "top_ssusb_xhci", 14),
+	GATE_PERI_AO(CLK_PERI_AO_ETHERNET_MAC, "peri_ao_ethernet_mac_clk", "top_snps_eth_250m", 16),
+	GATE_PERI_AO(CLK_PERI_AO_PCIE_P0_FMEM, "peri_ao_pcie_p0_fmem", "hd_466m_fmem_ck", 24),
+};

drivers/clk/mediatek/clk-mt8188-peri_ao.c line 46

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +10 -0
+
+static const struct mtk_clk_desc peri_ao_desc = {
+	.clks = peri_ao_clks,
+	.num_clks = ARRAY_SIZE(peri_ao_clks),
+};
+
+static const struct of_device_id of_match_clk_mt8188_peri_ao[] = {
+	{ .compatible = "mediatek,mt8188-pericfg-ao", .data = &peri_ao_desc },
+	{ /* sentinel */ }
+};

MODULE_DEVICE_TABLE is missing

drivers/clk/mediatek/clk-mt8188-peri_ao.c line 56

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +10 -0
+
+static struct platform_driver clk_mt8188_peri_ao_drv = {
+	.probe = mtk_clk_simple_probe,
+	.remove = mtk_clk_simple_remove,
+	.driver = {
+		.name = "clk-mt8188-peri_ao",
+		.of_match_table = of_match_clk_mt8188_peri_ao,
+	},
+};
+builtin_platform_driver(clk_mt8188_peri_ao_drv);

module_platform_driver()

MODULE_LICENSE

#10 lore raw

Re: [PATCH v6 04/19] clk: mediatek: Add MT8188 peripheral clock support

Quoted 97 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 96 lines

Add MT8188 peripheral clock controller which provides clock gate control for ethernet/flashif/pcie/ssusb.

---
  drivers/clk/mediatek/Makefile             |  3 +-
  drivers/clk/mediatek/clk-mt8188-peri_ao.c | 56
+++++++++++++++++++++++
  2 files changed, 58 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-peri_ao.c

drivers/clk/mediatek/Makefile +0 -0
index d845bf7308c3..f38a5cea2925 100644
@@ -91,7 +91,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
clk-mt8186-mfg.o clk-mt8186-mm.o
clk-mt8186-wpe.o \
clk-mt8186-img.o clk-mt8186-vdec.o
clk-mt8186-venc.o \
clk-mt8186-cam.o clk-mt8186-mdp.o
clk-mt8186-ipe.o
-obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk- mt8188-topckgen.o
+obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk- mt8188-topckgen.o \

drivers/clk/mediatek/Makefile +1 -0
+				   clk-mt8188-peri_ao.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +19 -0
new file mode 100644
index 000000000000..683010453a10
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs peri_ao_cg_regs = {
+	.set_ofs = 0x10,
+	.clr_ofs = 0x14,
+	.sta_ofs = 0x18,
+};
+
+#define GATE_PERI_AO(_id, _name, _parent, _shift)			

\

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_MTK(_id, _name, _parent, &peri_ao_cg_regs, _shift,

&mtk_clk_gate_ops_setclr)

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +3 -0
+
+static const struct mtk_gate peri_ao_clks[] = {
+	GATE_PERI_AO(CLK_PERI_AO_ETHERNET, "peri_ao_ethernet",

"top_axi", 0),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_ETHERNET_BUS, "peri_ao_ethernet_bus",

"top_axi", 1),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_FLASHIF_BUS, "peri_ao_flashif_bus",

"top_axi", 3),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_FLASHIF_26M, "peri_ao_flashif_26m",

"clk26m", 4),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_FLASHIFLASHCK,

"peri_ao_flashiflashck", "top_spinor", 5),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_2P_BUS, "peri_ao_ssusb_2p_bus",

"top_usb_top_2p", 9),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_2P_XHCI,

"peri_ao_ssusb_2p_xhci", "top_ssusb_xhci_2p", 10),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_3P_BUS, "peri_ao_ssusb_3p_bus",

"top_usb_top_3p", 11),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_3P_XHCI,

"peri_ao_ssusb_3p_xhci", "top_ssusb_xhci_3p", 12),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_BUS, "peri_ao_ssusb_bus",

"top_usb_top", 13),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_SSUSB_XHCI, "peri_ao_ssusb_xhci",

"top_ssusb_xhci", 14),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_ETHERNET_MAC,

"peri_ao_ethernet_mac_clk", "top_snps_eth_250m", 16),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +1 -0
+	GATE_PERI_AO(CLK_PERI_AO_PCIE_P0_FMEM, "peri_ao_pcie_p0_fmem",

"hd_466m_fmem_ck", 24),

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +6 -0
+};
+
+static const struct mtk_clk_desc peri_ao_desc = {
+	.clks = peri_ao_clks,
+	.num_clks = ARRAY_SIZE(peri_ao_clks),
+};
Quoted 9 lines

drivers/clk/mediatek/clk-mt8188-peri_ao.c

Quoted 6 lines
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +3 -0
+
+static const struct of_device_id of_match_clk_mt8188_peri_ao[] = {
+	{ .compatible = "mediatek,mt8188-pericfg-ao", .data =

&peri_ao_desc },

drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +2 -0
+	{ /* sentinel */ }
+};

MODULE_DEVICE_TABLE is missing

Thank you for your suggestions.

Ok, I would modify this in v7.

Quoted 14 lines

drivers/clk/mediatek/clk-mt8188-peri_ao.c line 56

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-peri_ao.c new file +10 -0
+
+static struct platform_driver clk_mt8188_peri_ao_drv = {
+	.probe = mtk_clk_simple_probe,
+	.remove = mtk_clk_simple_remove,
+	.driver = {
+		.name = "clk-mt8188-peri_ao",
+		.of_match_table = of_match_clk_mt8188_peri_ao,
+	},
+};
+builtin_platform_driver(clk_mt8188_peri_ao_drv);

module_platform_driver()

MODULE_LICENSE

#11 lore raw

PATCH v6 5/19 clk: mediatek: Add MT8188 infrastructure clock support

In reply to Garmin.Chang

Add MT8188 infrastructure clock controller which provides clock gate control for basic IP like pwm, uart, spi and so on.

---
 drivers/clk/mediatek/Makefile              |   2 +-
 drivers/clk/mediatek/clk-mt8188-infra_ao.c | 196 +++++++++++++++++++++
 2 files changed, 197 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-infra_ao.c
drivers/clk/mediatek/Makefile +1 -1
index f38a5cea2925..172aaef29d5d 100644
@@ -92,7 +92,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
-				   clk-mt8188-peri_ao.o
+				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.18.0
#12 lore raw

Re: [PATCH v6 05/19] clk: mediatek: Add MT8188 infrastructure clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 30 lines

Add MT8188 infrastructure clock controller which provides clock gate control for basic IP like pwm, uart, spi and so on.

---
  drivers/clk/mediatek/Makefile              |   2 +-
  drivers/clk/mediatek/clk-mt8188-infra_ao.c | 196 +++++++++++++++++++++
  2 files changed, 197 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-infra_ao.c

drivers/clk/mediatek/Makefile +1 -1
index f38a5cea2925..172aaef29d5d 100644
@@ -92,7 +92,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
  				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
  obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
-				   clk-mt8188-peri_ao.o
+				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +0 -0
new file mode 100644
index 000000000000..edc0ba18c67f

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 4

Quoted 5 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +4 -0
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0-only
 
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>

Please use C-style comments (apart from the SPDX header) to be consistent with the other clock drivers.

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 8

Quoted 4 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +4 -0
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>

order by name.

Quoted 1 line

+

..snip..

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 186

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +10 -0
+
+static const struct mtk_clk_desc infra_ao_desc = {
+	.clks = infra_ao_clks,
+	.num_clks = ARRAY_SIZE(infra_ao_clks),
+};
+
+static const struct of_device_id of_match_clk_mt8188_infra_ao[] = {
+	{ .compatible = "mediatek,mt8188-infracfg-ao", .data = &infra_ao_desc },
+	{ /* sentinel */ }
+};

MODULE_DEVICE_TABLE is missing

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 196

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +10 -0
+
+static struct platform_driver clk_mt8188_infra_ao_drv = {
+	.probe = mtk_clk_simple_probe,
+	.remove = mtk_clk_simple_remove,
+	.driver = {
+		.name = "clk-mt8188-infra_ao",
+		.of_match_table = of_match_clk_mt8188_infra_ao,
+	},
+};
+builtin_platform_driver(clk_mt8188_infra_ao_drv);

module_platform_driver()

MODULE_LICENSE

Regards,
Angelo

#13 lore raw

Re: [PATCH v6 05/19] clk: mediatek: Add MT8188 infrastructure clock support

Quoted 39 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 38 lines

Add MT8188 infrastructure clock controller which provides clock gate control for basic IP like pwm, uart, spi and so on.

---
  drivers/clk/mediatek/Makefile              |   2 +-
  drivers/clk/mediatek/clk-mt8188-infra_ao.c | 196
+++++++++++++++++++++
  2 files changed, 197 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-infra_ao.c

drivers/clk/mediatek/Makefile +0 -0
index f38a5cea2925..172aaef29d5d 100644
@@ -92,7 +92,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
clk-mt8186-img.o clk-mt8186-vdec.o
clk-mt8186-venc.o \
clk-mt8186-cam.o clk-mt8186-mdp.o
clk-mt8186-ipe.o
obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-
mt8188-topckgen.o \

drivers/clk/mediatek/Makefile +1 -1
-				   clk-mt8188-peri_ao.o
+				   clk-mt8188-peri_ao.o clk-mt8188-

infra_ao.o
obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o

drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +0 -0
new file mode 100644
index 000000000000..edc0ba18c67f
@@ -0,0 +1,196 @@
Quoted 9 lines

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 4

Quoted 4 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +4 -0
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>

Please use C-style comments (apart from the SPDX header) to be consistent with
the other clock drivers.

Thank you for your suggestions.

Ok, I would modify this and below in v7.

Quoted 7 lines

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 8

Quoted 4 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +4 -0
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>

order by name.

Ok.

Quoted 4 lines
Quoted 1 line
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +1 -0
+

..snip..

Quoted 14 lines

drivers/clk/mediatek/clk-mt8188-infra_ao.c

Quoted 12 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +7 -0
+
+static const struct mtk_clk_desc infra_ao_desc = {
+	.clks = infra_ao_clks,
+	.num_clks = ARRAY_SIZE(infra_ao_clks),
+};
+
+static const struct of_device_id of_match_clk_mt8188_infra_ao[] =

{

drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +1 -0
+	{ .compatible = "mediatek,mt8188-infracfg-ao", .data =

&infra_ao_desc },

drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +2 -0
+	{ /* sentinel */ }
+};

MODULE_DEVICE_TABLE is missing

Ok.

Quoted 19 lines

drivers/clk/mediatek/clk-mt8188-infra_ao.c line 196

Quoted 11 lines
drivers/clk/mediatek/clk-mt8188-infra_ao.c new file +10 -0
+
+static struct platform_driver clk_mt8188_infra_ao_drv = {
+	.probe = mtk_clk_simple_probe,
+	.remove = mtk_clk_simple_remove,
+	.driver = {
+		.name = "clk-mt8188-infra_ao",
+		.of_match_table = of_match_clk_mt8188_infra_ao,
+	},
+};
+builtin_platform_driver(clk_mt8188_infra_ao_drv);

module_platform_driver()

MODULE_LICENSE
OK.

Regards,
Angelo

#14 lore raw

PATCH v6 6/19 clk: mediatek: Add MT8188 camsys clock support

In reply to Garmin.Chang

Add MT8188 camsys clock controllers which provide clock gate control for camera IP blocks.

---
 drivers/clk/mediatek/Makefile         |   3 +-
 drivers/clk/mediatek/clk-mt8188-cam.c | 118 ++++++++++++++++++++++++++
 2 files changed, 120 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-cam.c
drivers/clk/mediatek/Makefile +2 -1
index 172aaef29d5d..a4189d28cecc 100644
@@ -92,7 +92,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
-				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o
+				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
+				   clk-mt8188-cam.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-cam.c new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.18.0
#15 lore raw

PATCH v6 7/19 clk: mediatek: Add MT8188 ccusys clock support

In reply to Garmin.Chang

Add MT8188 ccusys clock controller which provides clock gate control in Camera Computing Unit.

---
 drivers/clk/mediatek/Makefile         |  2 +-
 drivers/clk/mediatek/clk-mt8188-ccu.c | 48 +++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-ccu.c
drivers/clk/mediatek/Makefile +1 -1
index a4189d28cecc..fb66d25e98fd 100644
@@ -93,7 +93,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
-				   clk-mt8188-cam.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-ccu.c new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
2.18.0
#16 lore raw

Re: [PATCH v6 07/19] clk: mediatek: Add MT8188 ccusys clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 15 lines

Add MT8188 ccusys clock controller which provides clock gate control in Camera Computing Unit.

---
  drivers/clk/mediatek/Makefile         |  2 +-
  drivers/clk/mediatek/clk-mt8188-ccu.c | 48 +++++++++++++++++++++++++++
  2 files changed, 49 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-ccu.c

drivers/clk/mediatek/Makefile +0 -0
index a4189d28cecc..fb66d25e98fd 100644

drivers/clk/mediatek/Makefile obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt · line 96

Quoted 5 lines
drivers/clk/mediatek/Makefile +1 -1
@@ -93,7 +93,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
  obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
  				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
-				   clk-mt8188-cam.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o

clk-mt8188-cam and clk-mt8188-ccu can go under a different configuration option for modularity.

For example...

obj-$(CONFIG_COMMON_CLK_MT8188_CAM) += ...ccu.o, ...cam.o

Please make sure, for boot performance purposes, to order them as:

obj-$(CONFIG_.....) += driver-clk1.o driver-requiring-clk1-clocks.o

Quoted 33 lines
drivers/clk/mediatek/Makefile +0 -0
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-ccu.c new file +24 -0
new file mode 100644
index 000000000000..b7380060f906
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs ccu_cg_regs = {
+	.set_ofs = 0x4,
+	.clr_ofs = 0x8,
+	.sta_ofs = 0x0,
+};
+
+#define GATE_CCU(_id, _name, _parent, _shift)			\
+	GATE_MTK(_id, _name, _parent, &ccu_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
+
+static const struct mtk_gate ccu_clks[] = {
+	GATE_CCU(CLK_CCU_LARB27, "ccu_larb27", "top_ccu", 0),
+	GATE_CCU(CLK_CCU_AHB, "ccu_ahb", "top_ccu", 1),

drivers/clk/mediatek/clk-mt8188-ccu.c line 34

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-ccu.c new file +10 -0
+	GATE_CCU(CLK_CCU_CCU0, "ccu_ccu0", "top_ccu", 2),
+};
+
+static const struct mtk_clk_desc ccu_desc = {
+	.clks = ccu_clks,
+	.num_clks = ARRAY_SIZE(ccu_clks),
+};
+
+static const struct of_device_id of_match_clk_mt8188_ccu[] = {
+	{ .compatible = "mediatek,mt8188-ccusys", .data = &ccu_desc},

Missing space: { [...] &ccu_desc },

drivers/clk/mediatek/clk-mt8188-ccu.c line 47

Quoted 13 lines
drivers/clk/mediatek/clk-mt8188-ccu.c new file +13 -0
+	{ /* sentinel */ }
+};
+
+static struct platform_driver clk_mt8188_ccu_drv = {
+	.probe = mtk_clk_simple_probe,
+	.remove = mtk_clk_simple_remove,
+	.driver = {
+		.name = "clk-mt8188-ccu",
+		.of_match_table = of_match_clk_mt8188_ccu,
+	},
+};
+
+builtin_platform_driver(clk_mt8188_ccu_drv);

module_platform_driver

Quoted 1 line
drivers/clk/mediatek/clk-mt8188-ccu.c new file +1 -0
+MODULE_LICENSE("GPL");
#17 lore raw

Re: [PATCH v6 07/19] clk: mediatek: Add MT8188 ccusys clock support

Quoted 32 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 24 lines

Add MT8188 ccusys clock controller which provides clock gate control in Camera Computing Unit.

---
  drivers/clk/mediatek/Makefile         |  2 +-
  drivers/clk/mediatek/clk-mt8188-ccu.c | 48
+++++++++++++++++++++++++++
  2 files changed, 49 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-ccu.c

drivers/clk/mediatek/Makefile +0 -0
index a4189d28cecc..fb66d25e98fd 100644
@@ -93,7 +93,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
clk-mt8186-cam.o clk-mt8186-mdp.o
clk-mt8186-ipe.o
obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-
mt8188-topckgen.o \
clk-mt8188-peri_ao.o clk-mt8188-
infra_ao.o \

drivers/clk/mediatek/Makefile obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt · line 96

Quoted 2 lines
drivers/clk/mediatek/Makefile +1 -1
-				   clk-mt8188-cam.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o

clk-mt8188-cam and clk-mt8188-ccu can go under a different configuration option
for modularity.

Quoted 8 lines

For example...

obj-$(CONFIG_COMMON_CLK_MT8188_CAM) += ...ccu.o, ...cam.o

Please make sure, for boot performance purposes, to order them as:

obj-$(CONFIG_.....) += driver-clk1.o driver-requiring-clk1-clocks.o

Thank you for your suggestions.

Ok, I will refer to other chips to modify mt8188 about this in v7.

Quoted 40 lines
Quoted 40 lines
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-ccu.c new file +19 -0
new file mode 100644
index 000000000000..b7380060f906
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs ccu_cg_regs = {
+	.set_ofs = 0x4,
+	.clr_ofs = 0x8,
+	.sta_ofs = 0x0,
+};
+
+#define GATE_CCU(_id, _name, _parent, _shift)			

\

drivers/clk/mediatek/clk-mt8188-ccu.c new file +1 -0
+	GATE_MTK(_id, _name, _parent, &ccu_cg_regs, _shift,

&mtk_clk_gate_ops_setclr)

drivers/clk/mediatek/clk-mt8188-ccu.c new file +8 -0
+
+static const struct mtk_gate ccu_clks[] = {
+	GATE_CCU(CLK_CCU_LARB27, "ccu_larb27", "top_ccu", 0),
+	GATE_CCU(CLK_CCU_AHB, "ccu_ahb", "top_ccu", 1),
+	GATE_CCU(CLK_CCU_CCU0, "ccu_ccu0", "top_ccu", 2),
+};
+
+static const struct mtk_clk_desc ccu_desc = {
Quoted 9 lines

drivers/clk/mediatek/clk-mt8188-ccu.c line 34

Quoted 6 lines
drivers/clk/mediatek/clk-mt8188-ccu.c new file +6 -0
+	.clks = ccu_clks,
+	.num_clks = ARRAY_SIZE(ccu_clks),
+};
+
+static const struct of_device_id of_match_clk_mt8188_ccu[] = {
+	{ .compatible = "mediatek,mt8188-ccusys", .data = &ccu_desc},

Missing space: { [...] &ccu_desc },

Ok, I'll fix this in v7.

Quoted 19 lines

drivers/clk/mediatek/clk-mt8188-ccu.c line 47

Quoted 13 lines
drivers/clk/mediatek/clk-mt8188-ccu.c new file +13 -0
+	{ /* sentinel */ }
+};
+
+static struct platform_driver clk_mt8188_ccu_drv = {
+	.probe = mtk_clk_simple_probe,
+	.remove = mtk_clk_simple_remove,
+	.driver = {
+		.name = "clk-mt8188-ccu",
+		.of_match_table = of_match_clk_mt8188_ccu,
+	},
+};
+
+builtin_platform_driver(clk_mt8188_ccu_drv);

module_platform_driver

Quoted 1 line

+MODULE_LICENSE("GPL");

#18 lore raw

PATCH v6 8/19 clk: mediatek: Add MT8188 imgsys clock support

In reply to Garmin.Chang

Add MT8188 imgsys clock controllers which provide clock gate control for image IP blocks.

---
 drivers/clk/mediatek/Makefile         |   2 +-
 drivers/clk/mediatek/clk-mt8188-img.c | 110 ++++++++++++++++++++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-img.c
drivers/clk/mediatek/Makefile +1 -1
index fb66d25e98fd..935805632018 100644
@@ -93,7 +93,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
-				   clk-mt8188-cam.o clk-mt8188-ccu.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-img.c new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
2.18.0
#19 lore raw

Re: [PATCH v6 08/19] clk: mediatek: Add MT8188 imgsys clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 15 lines

Add MT8188 imgsys clock controllers which provide clock gate control for image IP blocks.

---
  drivers/clk/mediatek/Makefile         |   2 +-
  drivers/clk/mediatek/clk-mt8188-img.c | 110 ++++++++++++++++++++++++++
  2 files changed, 111 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-img.c

drivers/clk/mediatek/Makefile +0 -0
index fb66d25e98fd..935805632018 100644

drivers/clk/mediatek/Makefile obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt · line 96

Quoted 5 lines
drivers/clk/mediatek/Makefile +1 -1
@@ -93,7 +93,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
  obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
  				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
-				   clk-mt8188-cam.o clk-mt8188-ccu.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o

imgsys can go under a different config option.

I won't send any more comments on the other 10 clocks for the same reason, so please split the clocks as needed. Check the others like MT8186, MT8192, MT8195.

#20 lore raw

Re: [PATCH v6 08/19] clk: mediatek: Add MT8188 imgsys clock support

Quoted 31 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 26 lines

Add MT8188 imgsys clock controllers which provide clock gate control for image IP blocks.

---
  drivers/clk/mediatek/Makefile         |   2 +-
  drivers/clk/mediatek/clk-mt8188-img.c | 110
++++++++++++++++++++++++++
  2 files changed, 111 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-img.c

drivers/clk/mediatek/Makefile +0 -0
index fb66d25e98fd..935805632018 100644
@@ -93,7 +93,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
clk-mt8186-cam.o clk-mt8186-mdp.o
clk-mt8186-ipe.o
obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-
mt8188-topckgen.o \
clk-mt8188-peri_ao.o clk-mt8188-
infra_ao.o \

drivers/clk/mediatek/Makefile +1 -1
-				   clk-mt8188-cam.o clk-mt8188-ccu.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o
Quoted 1 line

clk-mt8188-img.o

imgsys can go under a different config option.

Quoted 5 lines

I won't send any more comments on the other 10 clocks for the same reason, so
please split the clocks as needed. Check the others like MT8186, MT8192, MT8195.

Thank you for your suggestions.

Ok, I will modify all mt8188 clocks about this in v7.

Thanks,
Best Regards,
Garmin

#21 lore raw

PATCH v6 9/19 clk: mediatek: Add MT8188 ipesys clock support

In reply to Garmin.Chang

Add MT8188 ipesys clock controller which provides clock gate control for Image Process Engine.

---
 drivers/clk/mediatek/Makefile         |  3 +-
 drivers/clk/mediatek/clk-mt8188-ipe.c | 50 +++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-ipe.c
drivers/clk/mediatek/Makefile +2 -1
index 935805632018..e05fcc2769fa 100644
@@ -93,7 +93,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
-				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o
+				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
+				   clk-mt8188-ipe.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-ipe.c new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.18.0
#22 lore raw

PATCH v6 10/19 clk: mediatek: Add MT8188 mfgcfg clock support

In reply to Garmin.Chang

Add MT8188 mfg clock controller which provides clock gate control for GPU.

---
 drivers/clk/mediatek/Makefile         |  2 +-
 drivers/clk/mediatek/clk-mt8188-mfg.c | 47 +++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-mfg.c
drivers/clk/mediatek/Makefile +1 -1
index e05fcc2769fa..dfe2c74c422c 100644
@@ -94,7 +94,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
-				   clk-mt8188-ipe.o
+				   clk-mt8188-ipe.o clk-mt8188-mfg.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-mfg.c new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.18.0
#23 lore raw

PATCH v6 11/19 clk: mediatek: Add MT8188 vdecsys clock support

In reply to Garmin.Chang

Add MT8188 vdec clock controllers which provide clock gate control for video decoder.

---
 drivers/clk/mediatek/Makefile          |  2 +-
 drivers/clk/mediatek/clk-mt8188-vdec.c | 90 ++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vdec.c
drivers/clk/mediatek/Makefile +1 -1
index dfe2c74c422c..bf8e50b54bb4 100644
@@ -94,7 +94,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
-				   clk-mt8188-ipe.o clk-mt8188-mfg.o
+				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vdec.c new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.18.0
#24 lore raw

PATCH v6 12/19 clk: mediatek: Add MT8188 vdosys0 clock support

In reply to Garmin.Chang

Add MT8188 vdosys0 clock controller which provides clock gate control in video system. This is integrated with mtk-mmsys driver which will populate device by platform_device_register_data to start vdosys clock driver.

---
 drivers/clk/mediatek/Makefile          |   3 +-
 drivers/clk/mediatek/clk-mt8188-vdo0.c | 135 +++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vdo0.c
drivers/clk/mediatek/Makefile +2 -1
index bf8e50b54bb4..fca66c37cecc 100644
@@ -94,7 +94,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
 obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
-				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o
+				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
+				   clk-mt8188-vdo0.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.18.0
#25 lore raw

Re: [PATCH v6 12/19] clk: mediatek: Add MT8188 vdosys0 clock support

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 149 lines

Add MT8188 vdosys0 clock controller which provides clock gate control in video system. This is integrated with mtk-mmsys driver which will populate device by platform_device_register_data to start vdosys clock driver.

---
  drivers/clk/mediatek/Makefile          |   3 +-
  drivers/clk/mediatek/clk-mt8188-vdo0.c | 135 +++++++++++++++++++++++++
  2 files changed, 137 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-vdo0.c

drivers/clk/mediatek/Makefile +2 -1
index bf8e50b54bb4..fca66c37cecc 100644
@@ -94,7 +94,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
  obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
  				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
  				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
-				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o
+				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
+				   clk-mt8188-vdo0.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +117 -0
new file mode 100644
index 000000000000..f649f603aab7
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs vdo0_0_cg_regs = {
+	.set_ofs = 0x104,
+	.clr_ofs = 0x108,
+	.sta_ofs = 0x100,
+};
+
+static const struct mtk_gate_regs vdo0_1_cg_regs = {
+	.set_ofs = 0x114,
+	.clr_ofs = 0x118,
+	.sta_ofs = 0x110,
+};
+
+static const struct mtk_gate_regs vdo0_2_cg_regs = {
+	.set_ofs = 0x124,
+	.clr_ofs = 0x128,
+	.sta_ofs = 0x120,
+};
+
+#define GATE_VDO0_0(_id, _name, _parent, _shift)			\
+	GATE_MTK(_id, _name, _parent, &vdo0_0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
+
+#define GATE_VDO0_1(_id, _name, _parent, _shift)			\
+	GATE_MTK(_id, _name, _parent, &vdo0_1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
+
+#define GATE_VDO0_2(_id, _name, _parent, _shift)			\
+	GATE_MTK(_id, _name, _parent, &vdo0_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
+
+#define GATE_VDO0_2_FLAGS(_id, _name, _parent, _shift, _flags)		\
+	GATE_MTK_FLAGS(_id, _name, _parent, &vdo0_2_cg_regs, _shift,	\
+	&mtk_clk_gate_ops_setclr, _flags)
+
+static const struct mtk_gate vdo0_clks[] = {
+	/* VDO0_0 */
+	GATE_VDO0_0(CLK_VDO0_DISP_OVL0, "vdo0_disp_ovl0", "top_vpp", 0),
+	GATE_VDO0_0(CLK_VDO0_FAKE_ENG0, "vdo0_fake_eng0", "top_vpp", 2),
+	GATE_VDO0_0(CLK_VDO0_DISP_CCORR0, "vdo0_disp_ccorr0", "top_vpp", 4),
+	GATE_VDO0_0(CLK_VDO0_DISP_MUTEX0, "vdo0_disp_mutex0", "top_vpp", 6),
+	GATE_VDO0_0(CLK_VDO0_DISP_GAMMA0, "vdo0_disp_gamma0", "top_vpp", 8),
+	GATE_VDO0_0(CLK_VDO0_DISP_DITHER0, "vdo0_disp_dither0", "top_vpp", 10),
+	GATE_VDO0_0(CLK_VDO0_DISP_WDMA0, "vdo0_disp_wdma0", "top_vpp", 17),
+	GATE_VDO0_0(CLK_VDO0_DISP_RDMA0, "vdo0_disp_rdma0", "top_vpp", 19),
+	GATE_VDO0_0(CLK_VDO0_DSI0, "vdo0_dsi0", "top_vpp", 21),
+	GATE_VDO0_0(CLK_VDO0_DSI1, "vdo0_dsi1", "top_vpp", 22),
+	GATE_VDO0_0(CLK_VDO0_DSC_WRAP0, "vdo0_dsc_wrap0", "top_vpp", 23),
+	GATE_VDO0_0(CLK_VDO0_VPP_MERGE0, "vdo0_vpp_merge0", "top_vpp", 24),
+	GATE_VDO0_0(CLK_VDO0_DP_INTF0, "vdo0_dp_intf0", "top_vpp", 25),
+	GATE_VDO0_0(CLK_VDO0_DISP_AAL0, "vdo0_disp_aal0", "top_vpp", 26),
+	GATE_VDO0_0(CLK_VDO0_INLINEROT0, "vdo0_inlinerot0", "top_vpp", 27),
+	GATE_VDO0_0(CLK_VDO0_APB_BUS, "vdo0_apb_bus", "top_vpp", 28),
+	GATE_VDO0_0(CLK_VDO0_DISP_COLOR0, "vdo0_disp_color0", "top_vpp", 29),
+	GATE_VDO0_0(CLK_VDO0_MDP_WROT0, "vdo0_mdp_wrot0", "top_vpp", 30),
+	GATE_VDO0_0(CLK_VDO0_DISP_RSZ0, "vdo0_disp_rsz0", "top_vpp", 31),
+	/* VDO0_1 */
+	GATE_VDO0_1(CLK_VDO0_DISP_POSTMASK0, "vdo0_disp_postmask0", "top_vpp", 0),
+	GATE_VDO0_1(CLK_VDO0_FAKE_ENG1, "vdo0_fake_eng1", "top_vpp", 1),
+	GATE_VDO0_1(CLK_VDO0_DL_ASYNC2, "vdo0_dl_async2", "top_vpp", 5),
+	GATE_VDO0_1(CLK_VDO0_DL_RELAY3, "vdo0_dl_relay3", "top_vpp", 6),
+	GATE_VDO0_1(CLK_VDO0_DL_RELAY4, "vdo0_dl_relay4", "top_vpp", 7),
+	GATE_VDO0_1(CLK_VDO0_SMI_GALS, "vdo0_smi_gals", "top_vpp", 10),
+	GATE_VDO0_1(CLK_VDO0_SMI_COMMON, "vdo0_smi_common", "top_vpp", 11),
+	GATE_VDO0_1(CLK_VDO0_SMI_EMI, "vdo0_smi_emi", "top_vpp", 12),
+	GATE_VDO0_1(CLK_VDO0_SMI_IOMMU, "vdo0_smi_iommu", "top_vpp", 13),
+	GATE_VDO0_1(CLK_VDO0_SMI_LARB, "vdo0_smi_larb", "top_vpp", 14),
+	GATE_VDO0_1(CLK_VDO0_SMI_RSI, "vdo0_smi_rsi", "top_vpp", 15),
+	/* VDO0_2 */
+	GATE_VDO0_2(CLK_VDO0_DSI0_DSI, "vdo0_dsi0_dsi", "top_dsi_occ", 0),
+	GATE_VDO0_2(CLK_VDO0_DSI1_DSI, "vdo0_dsi1_dsi", "top_dsi_occ", 8),
+	GATE_VDO0_2_FLAGS(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf",
+		"top_edp", 16, CLK_SET_RATE_PARENT),
+};
+
+static int clk_mt8188_vdo0_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *node = dev->parent->of_node;
+	struct clk_hw_onecell_data *clk_data;
+	int r;
+
+	clk_data = mtk_alloc_clk_data(CLK_VDO0_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
+
+	r = mtk_clk_register_gates(&pdev->dev, node, vdo0_clks,
+				   ARRAY_SIZE(vdo0_clks), clk_data);
+	if (r)
+		goto free_vdo0_data;
+
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
+	if (r)
+		goto unregister_gates;
+
+	platform_set_drvdata(pdev, clk_data);
+
+	return r;
+
+unregister_gates:
+	mtk_clk_unregister_gates(vdo0_clks, ARRAY_SIZE(vdo0_clks), clk_data);
+free_vdo0_data:
+	mtk_free_clk_data(clk_data);
+	return r;
+}
+
+static int clk_mt8188_vdo0_remove(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;

drivers/clk/mediatek/clk-mt8188-vdo0.c line 127

Quoted 10 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +10 -0
+	struct device_node *node = dev->parent->of_node;
+	struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
+
+	of_clk_del_provider(node);
+	mtk_clk_unregister_gates(vdo0_clks, ARRAY_SIZE(vdo0_clks), clk_data);
+	mtk_free_clk_data(clk_data);
+
+	return 0;
+}
+
static const struct mtk_clk_desc vdo0_desc = {
	.clks ...
	.num_clks ....
};
static const struct platform_device_id clk_mt8188_vdo0_id_table[] = {
	{ .name = "clk-mt8188-vdo0", .driver_data = (kernel_ulong_T)&vdo0_desc },
	{ /* sentinel */ }
};

drivers/clk/mediatek/clk-mt8188-vdo0.c line 130

Quoted 3 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +3 -0
+static struct platform_driver clk_mt8188_vdo0_drv = {
+	.probe = clk_mt8188_vdo0_probe,
+	.remove = clk_mt8188_vdo0_remove,

.probe = mtk_clk_pdev_probe,
.remove = mtk_clk_pdev_remove,

drivers/clk/mediatek/clk-mt8188-vdo0.c line 133

Quoted 3 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +3 -0
+	.driver = {
+		.name = "clk-mt8188-vdo0",
+	},
	.id_table = clk_mt8188_vdo0_id_table,

drivers/clk/mediatek/clk-mt8188-vdo0.c line 135

Quoted 2 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+};
+builtin_platform_driver(clk_mt8188_vdo0_drv);

module_platform_driver and MODULE_LICENSE.

Same for VDO1, VPP0, VPP1.

Regards,
Angelo

#26 lore raw

Re: [PATCH v6 12/19] clk: mediatek: Add MT8188 vdosys0 clock support

Quoted 236 lines · AngeloGioacchino Del Regno

Il 09/03/23 14:54, Garmin.Chang ha scritto:

Quoted 200 lines

Add MT8188 vdosys0 clock controller which provides clock gate control in video system. This is integrated with mtk-mmsys driver which will populate device by platform_device_register_data to start vdosys clock driver.

---
  drivers/clk/mediatek/Makefile          |   3 +-
  drivers/clk/mediatek/clk-mt8188-vdo0.c | 135
+++++++++++++++++++++++++
  2 files changed, 137 insertions(+), 1 deletion(-)

create mode 100644 drivers/clk/mediatek/clk-mt8188-vdo0.c

drivers/clk/mediatek/Makefile +0 -0
index bf8e50b54bb4..fca66c37cecc 100644
@@ -94,7 +94,8 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-

mcu.o clk-mt8186-topckgen.o clk-mt
obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-
mt8188-topckgen.o \
clk-mt8188-peri_ao.o clk-mt8188-
infra_ao.o \
clk-mt8188-cam.o clk-mt8188-ccu.o
clk-mt8188-img.o \

drivers/clk/mediatek/Makefile +0 -1
-				   clk-mt8188-ipe.o clk-mt8188-mfg.o

clk-mt8188-vdec.o

drivers/clk/mediatek/Makefile +1 -0
+				   clk-mt8188-ipe.o clk-mt8188-mfg.o

clk-mt8188-vdec.o \

drivers/clk/mediatek/Makefile +1 -0
+				   clk-mt8188-vdo0.o
  obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
  obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
  obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +31 -0
new file mode 100644
index 000000000000..f649f603aab7
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// Copyright (c) 2022 MediaTek Inc.
+// Author: Garmin Chang <[email protected]>
+
+#include <linux/clk-provider.h>
+#include <linux/platform_device.h>
+#include <dt-bindings/clock/mediatek,mt8188-clk.h>
+
+#include "clk-gate.h"
+#include "clk-mtk.h"
+
+static const struct mtk_gate_regs vdo0_0_cg_regs = {
+	.set_ofs = 0x104,
+	.clr_ofs = 0x108,
+	.sta_ofs = 0x100,
+};
+
+static const struct mtk_gate_regs vdo0_1_cg_regs = {
+	.set_ofs = 0x114,
+	.clr_ofs = 0x118,
+	.sta_ofs = 0x110,
+};
+
+static const struct mtk_gate_regs vdo0_2_cg_regs = {
+	.set_ofs = 0x124,
+	.clr_ofs = 0x128,
+	.sta_ofs = 0x120,
+};
+
+#define GATE_VDO0_0(_id, _name, _parent, _shift)			

\

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_MTK(_id, _name, _parent, &vdo0_0_cg_regs, _shift,

&mtk_clk_gate_ops_setclr)

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+
+#define GATE_VDO0_1(_id, _name, _parent, _shift)			

\

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_MTK(_id, _name, _parent, &vdo0_1_cg_regs, _shift,

&mtk_clk_gate_ops_setclr)

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+
+#define GATE_VDO0_2(_id, _name, _parent, _shift)			

\

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_MTK(_id, _name, _parent, &vdo0_2_cg_regs, _shift,

&mtk_clk_gate_ops_setclr)

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+
+#define GATE_VDO0_2_FLAGS(_id, _name, _parent, _shift, _flags)	
	\
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_MTK_FLAGS(_id, _name, _parent, &vdo0_2_cg_regs, _shift,	

\

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +5 -0
+	&mtk_clk_gate_ops_setclr, _flags)
+
+static const struct mtk_gate vdo0_clks[] = {
+	/* VDO0_0 */
+	GATE_VDO0_0(CLK_VDO0_DISP_OVL0, "vdo0_disp_ovl0", "top_vpp",

0),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_FAKE_ENG0, "vdo0_fake_eng0", "top_vpp",

2),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_CCORR0, "vdo0_disp_ccorr0",

"top_vpp", 4),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_MUTEX0, "vdo0_disp_mutex0",

"top_vpp", 6),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_GAMMA0, "vdo0_disp_gamma0",

"top_vpp", 8),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_DITHER0, "vdo0_disp_dither0",

"top_vpp", 10),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_WDMA0, "vdo0_disp_wdma0", "top_vpp",

17),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_RDMA0, "vdo0_disp_rdma0", "top_vpp",

19),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +3 -0
+	GATE_VDO0_0(CLK_VDO0_DSI0, "vdo0_dsi0", "top_vpp", 21),
+	GATE_VDO0_0(CLK_VDO0_DSI1, "vdo0_dsi1", "top_vpp", 22),
+	GATE_VDO0_0(CLK_VDO0_DSC_WRAP0, "vdo0_dsc_wrap0", "top_vpp",

23),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_VPP_MERGE0, "vdo0_vpp_merge0", "top_vpp",

24),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+	GATE_VDO0_0(CLK_VDO0_DP_INTF0, "vdo0_dp_intf0", "top_vpp", 25),
+	GATE_VDO0_0(CLK_VDO0_DISP_AAL0, "vdo0_disp_aal0", "top_vpp",

26),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_INLINEROT0, "vdo0_inlinerot0", "top_vpp",

27),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+	GATE_VDO0_0(CLK_VDO0_APB_BUS, "vdo0_apb_bus", "top_vpp", 28),
+	GATE_VDO0_0(CLK_VDO0_DISP_COLOR0, "vdo0_disp_color0",

"top_vpp", 29),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_MDP_WROT0, "vdo0_mdp_wrot0", "top_vpp",

30),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_0(CLK_VDO0_DISP_RSZ0, "vdo0_disp_rsz0", "top_vpp",

31),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+	/* VDO0_1 */
+	GATE_VDO0_1(CLK_VDO0_DISP_POSTMASK0, "vdo0_disp_postmask0",

"top_vpp", 0),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_1(CLK_VDO0_FAKE_ENG1, "vdo0_fake_eng1", "top_vpp",

1),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_1(CLK_VDO0_DL_ASYNC2, "vdo0_dl_async2", "top_vpp",

5),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_1(CLK_VDO0_DL_RELAY3, "vdo0_dl_relay3", "top_vpp",

6),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_1(CLK_VDO0_DL_RELAY4, "vdo0_dl_relay4", "top_vpp",

7),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+	GATE_VDO0_1(CLK_VDO0_SMI_GALS, "vdo0_smi_gals", "top_vpp", 10),
+	GATE_VDO0_1(CLK_VDO0_SMI_COMMON, "vdo0_smi_common", "top_vpp",

11),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+	GATE_VDO0_1(CLK_VDO0_SMI_EMI, "vdo0_smi_emi", "top_vpp", 12),
+	GATE_VDO0_1(CLK_VDO0_SMI_IOMMU, "vdo0_smi_iommu", "top_vpp",

13),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +4 -0
+	GATE_VDO0_1(CLK_VDO0_SMI_LARB, "vdo0_smi_larb", "top_vpp", 14),
+	GATE_VDO0_1(CLK_VDO0_SMI_RSI, "vdo0_smi_rsi", "top_vpp", 15),
+	/* VDO0_2 */
+	GATE_VDO0_2(CLK_VDO0_DSI0_DSI, "vdo0_dsi0_dsi", "top_dsi_occ",

0),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_2(CLK_VDO0_DSI1_DSI, "vdo0_dsi1_dsi", "top_dsi_occ",

8),

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +1 -0
+	GATE_VDO0_2_FLAGS(CLK_VDO0_DP_INTF0_DP_INTF,

"vdo0_dp_intf0_dp_intf",

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +20 -0
+		"top_edp", 16, CLK_SET_RATE_PARENT),
+};
+
+static int clk_mt8188_vdo0_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *node = dev->parent->of_node;
+	struct clk_hw_onecell_data *clk_data;
+	int r;
+
+	clk_data = mtk_alloc_clk_data(CLK_VDO0_NR_CLK);
+	if (!clk_data)
+		return -ENOMEM;
+
+	r = mtk_clk_register_gates(&pdev->dev, node, vdo0_clks,
+				   ARRAY_SIZE(vdo0_clks), clk_data);
+	if (r)
+		goto free_vdo0_data;
+
+	r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,

clk_data);

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +9 -0
+	if (r)
+		goto unregister_gates;
+
+	platform_set_drvdata(pdev, clk_data);
+
+	return r;
+
+unregister_gates:
+	mtk_clk_unregister_gates(vdo0_clks, ARRAY_SIZE(vdo0_clks),

clk_data);

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +10 -0
+free_vdo0_data:
+	mtk_free_clk_data(clk_data);
+	return r;
+}
+
+static int clk_mt8188_vdo0_remove(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *node = dev->parent->of_node;
+	struct clk_hw_onecell_data *clk_data =

platform_get_drvdata(pdev);

drivers/clk/mediatek/clk-mt8188-vdo0.c new file +3 -0
+
+	of_clk_del_provider(node);
+	mtk_clk_unregister_gates(vdo0_clks, ARRAY_SIZE(vdo0_clks),

clk_data);

drivers/clk/mediatek/clk-mt8188-vdo0.c line 127

Quoted 5 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +5 -0
+	mtk_free_clk_data(clk_data);
+
+	return 0;
+}
+
static const struct mtk_clk_desc vdo0_desc = {
	.clks ...
	.num_clks ....
};
static const struct platform_device_id clk_mt8188_vdo0_id_table[] = {
	{ .name = "clk-mt8188-vdo0", .driver_data =
(kernel_ulong_T)&vdo0_desc },
	{ /* sentinel */ }
};

drivers/clk/mediatek/clk-mt8188-vdo0.c line 130

Quoted 3 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +3 -0
+static struct platform_driver clk_mt8188_vdo0_drv = {
+	.probe = clk_mt8188_vdo0_probe,
+	.remove = clk_mt8188_vdo0_remove,

.probe = mtk_clk_pdev_probe,
.remove = mtk_clk_pdev_remove,

drivers/clk/mediatek/clk-mt8188-vdo0.c line 133

Quoted 3 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +3 -0
+	.driver = {
+		.name = "clk-mt8188-vdo0",
+	},
	.id_table = clk_mt8188_vdo0_id_table,

drivers/clk/mediatek/clk-mt8188-vdo0.c

Quoted 2 lines
drivers/clk/mediatek/clk-mt8188-vdo0.c new file +2 -0
+};
+builtin_platform_driver(clk_mt8188_vdo0_drv);

module_platform_driver and MODULE_LICENSE.

Quoted 4 lines

Same for VDO1, VPP0, VPP1.

Regards,
Angelo

Thank you for your suggestions.

OK, I use mtk_clk_pdev_probe for VDO0, VDO1, VPP0, VPP1 in v7.

Thanks,
Best Regards,
Garmin

#27 lore raw

PATCH v6 13/19 clk: mediatek: Add MT8188 vdosys1 clock support

In reply to Garmin.Chang

Add MT8188 vdosys1 clock controller which provides clock gate control in video system. This is integrated with mtk-mmsys driver which will populate device by platform_device_register_data to start vdosys clock driver.

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-mt8188-vdo1.c | 182 +++++++++++++++++++++++++
 2 files changed, 183 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vdo1.c
drivers/clk/mediatek/Makefile +1 -1
index fca66c37cecc..78885318e026 100644
@@ -95,7 +95,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
-				   clk-mt8188-vdo0.o
+				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vdo1.c new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
2.18.0
#28 lore raw

PATCH v6 14/19 clk: mediatek: Add MT8188 vencsys clock support

In reply to Garmin.Chang

Add MT8188 vencsys clock controllers which provide clock gate control for video encoder.

---
 drivers/clk/mediatek/Makefile          |  2 +-
 drivers/clk/mediatek/clk-mt8188-venc.c | 52 ++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-venc.c
drivers/clk/mediatek/Makefile +1 -1
index 78885318e026..4e5c15cb93ad 100644
@@ -95,7 +95,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
-				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o
+				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-venc.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.18.0
#29 lore raw

PATCH v6 15/19 clk: mediatek: Add MT8188 vppsys0 clock support

In reply to Garmin.Chang

Add MT8188 vppsys0 clock controller which provides clock gate controller for Video Processor Pipe.

---
 drivers/clk/mediatek/Makefile          |   3 +-
 drivers/clk/mediatek/clk-mt8188-vpp0.c | 144 +++++++++++++++++++++++++
 2 files changed, 146 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vpp0.c
drivers/clk/mediatek/Makefile +2 -1
index 4e5c15cb93ad..b32ccf53bf77 100644
@@ -95,7 +95,8 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o \
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
-				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o
+				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o \
+				   clk-mt8188-vpp0.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vpp0.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
2.18.0
#30 lore raw

PATCH v6 16/19 clk: mediatek: Add MT8188 vppsys1 clock support

In reply to Garmin.Chang

Add MT8188 vppsys1 clock controller which provides clock gate controller for Video Processor Pipe.

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-mt8188-vpp1.c | 139 +++++++++++++++++++++++++
 2 files changed, 140 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-vpp1.c
drivers/clk/mediatek/Makefile +1 -1
index b32ccf53bf77..96628c87a5d4 100644
@@ -96,7 +96,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
 				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o \
-				   clk-mt8188-vpp0.o
+				   clk-mt8188-vpp0.o clk-mt8188-vpp1.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-vpp1.c new file +139 -0

139 lines not on this page · raw message

Signature · 1 line
2.18.0
#31 lore raw

PATCH v6 17/19 clk: mediatek: Add MT8188 wpesys clock support

In reply to Garmin.Chang

Add MT8188 wpesys clock controllers which provide clock gate control in Wrapping Engine.

---
 drivers/clk/mediatek/Makefile         |   2 +-
 drivers/clk/mediatek/clk-mt8188-wpe.c | 101 ++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-wpe.c
drivers/clk/mediatek/Makefile +1 -1
index 96628c87a5d4..a7b8dcf9c0bc 100644
@@ -96,7 +96,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
 				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o \
-				   clk-mt8188-vpp0.o clk-mt8188-vpp1.o
+				   clk-mt8188-vpp0.o clk-mt8188-vpp1.o clk-mt8188-wpe.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-wpe.c new file +101 -0

101 lines not on this page · raw message

Signature · 1 line
2.18.0
#32 lore raw

PATCH v6 18/19 clk: mediatek: Add MT8188 imp i2c wrapper clock support

In reply to Garmin.Chang

Add MT8188 imp i2c wrapper clock controllers which provide clock gate control in I2C IP blocks.

---
 drivers/clk/mediatek/Makefile                 |  3 +-
 .../clk/mediatek/clk-mt8188-imp_iic_wrap.c    | 78 +++++++++++++++++++
 2 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-imp_iic_wrap.c
drivers/clk/mediatek/Makefile +2 -1
index a7b8dcf9c0bc..0e75308e31d7 100644
@@ -96,7 +96,8 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-cam.o clk-mt8188-ccu.o clk-mt8188-img.o \
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
 				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o \
-				   clk-mt8188-vpp0.o clk-mt8188-vpp1.o clk-mt8188-wpe.o
+				   clk-mt8188-vpp0.o clk-mt8188-vpp1.o clk-mt8188-wpe.o \
+				   clk-mt8188-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-imp_iic_wrap.c new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.18.0
#33 lore raw

PATCH v6 19/19 clk: mediatek: Add MT8188 adsp clock support

In reply to Garmin.Chang

Add MT8188 adsp clock controller which provides clock gate control for Audio DSP.

---
 drivers/clk/mediatek/Makefile                 |  2 +-
 .../clk/mediatek/clk-mt8188-adsp_audio26m.c   | 45 +++++++++++++++++++
 2 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8188-adsp_audio26m.c
drivers/clk/mediatek/Makefile +1 -1
index 0e75308e31d7..18cd06a45bf1 100644
@@ -97,7 +97,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
 				   clk-mt8188-ipe.o clk-mt8188-mfg.o clk-mt8188-vdec.o \
 				   clk-mt8188-vdo0.o clk-mt8188-vdo1.o clk-mt8188-venc.o \
 				   clk-mt8188-vpp0.o clk-mt8188-vpp1.o clk-mt8188-wpe.o \
-				   clk-mt8188-imp_iic_wrap.o
+				   clk-mt8188-imp_iic_wrap.o clk-mt8188-adsp_audio26m.o
 obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
 obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
 obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8188-adsp_audio26m.c new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.18.0