Skip to content

Commit 0bd9b12

Browse files
Tooniisbebarino
authored andcommitted
clk: mediatek: Add drivers for MT6735 syscon clock and reset controllers
Add drivers for IMGSYS, MFGCFG, VDECSYS and VENCSYS clocks and resets on MT6735. Signed-off-by: Yassine Oudjana <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent a747986 commit 0bd9b12

File tree

7 files changed

+286
-0
lines changed

7 files changed

+286
-0
lines changed

MAINTAINERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14534,9 +14534,13 @@ L: [email protected]
1453414534
L: [email protected] (moderated for non-subscribers)
1453514535
S: Maintained
1453614536
F: drivers/clk/mediatek/clk-mt6735-apmixedsys.c
14537+
F: drivers/clk/mediatek/clk-mt6735-imgsys.c
1453714538
F: drivers/clk/mediatek/clk-mt6735-infracfg.c
14539+
F: drivers/clk/mediatek/clk-mt6735-mfgcfg.c
1453814540
F: drivers/clk/mediatek/clk-mt6735-pericfg.c
1453914541
F: drivers/clk/mediatek/clk-mt6735-topckgen.c
14542+
F: drivers/clk/mediatek/clk-mt6735-vdecsys.c
14543+
F: drivers/clk/mediatek/clk-mt6735-vencsys.c
1454014544
F: include/dt-bindings/clock/mediatek,mt6735-apmixedsys.h
1454114545
F: include/dt-bindings/clock/mediatek,mt6735-imgsys.h
1454214546
F: include/dt-bindings/clock/mediatek,mt6735-infracfg.h

drivers/clk/mediatek/Kconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,34 @@ config COMMON_CLK_MT6735
133133
by apmixedsys, topckgen, infracfg and pericfg on the
134134
MediaTek MT6735 SoC.
135135

136+
config COMMON_CLK_MT6735_IMGSYS
137+
tristate "Clock driver for MediaTek MT6735 imgsys"
138+
depends on COMMON_CLK_MT6735
139+
help
140+
This enables a driver for clocks provided by imgsys
141+
on the MediaTek MT6735 SoC.
142+
143+
config COMMON_CLK_MT6735_MFGCFG
144+
tristate "Clock driver for MediaTek MT6735 mfgcfg"
145+
depends on COMMON_CLK_MT6735
146+
help
147+
This enables a driver for clocks and resets provided
148+
by mfgcfg on the MediaTek MT6735 SoC.
149+
150+
config COMMON_CLK_MT6735_VDECSYS
151+
tristate "Clock driver for MediaTek MT6735 vdecsys"
152+
depends on COMMON_CLK_MT6735
153+
help
154+
This enables a driver for clocks and resets provided
155+
by vdecsys on the MediaTek MT6735 SoC.
156+
157+
config COMMON_CLK_MT6735_VENCSYS
158+
tristate "Clock driver for MediaTek MT6735 vencsys"
159+
depends on COMMON_CLK_MT6735
160+
help
161+
This enables a driver for clocks provided by vencsys
162+
on the MediaTek MT6735 SoC.
163+
136164
config COMMON_CLK_MT6765
137165
bool "Clock driver for MediaTek MT6765"
138166
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST

drivers/clk/mediatek/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.
33
obj-$(CONFIG_COMMON_CLK_MEDIATEK_FHCTL) += clk-fhctl.o clk-pllfh.o
44

55
obj-$(CONFIG_COMMON_CLK_MT6735) += clk-mt6735-apmixedsys.o clk-mt6735-infracfg.o clk-mt6735-pericfg.o clk-mt6735-topckgen.o
6+
obj-$(CONFIG_COMMON_CLK_MT6735_IMGSYS) += clk-mt6735-imgsys.o
7+
obj-$(CONFIG_COMMON_CLK_MT6735_MFGCFG) += clk-mt6735-mfgcfg.o
8+
obj-$(CONFIG_COMMON_CLK_MT6735_VDECSYS) += clk-mt6735-vdecsys.o
9+
obj-$(CONFIG_COMMON_CLK_MT6735_VENCSYS) += clk-mt6735-vencsys.o
610
obj-$(CONFIG_COMMON_CLK_MT6765) += clk-mt6765.o
711
obj-$(CONFIG_COMMON_CLK_MT6765_AUDIOSYS) += clk-mt6765-audio.o
812
obj-$(CONFIG_COMMON_CLK_MT6765_CAMSYS) += clk-mt6765-cam.o
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2022 Yassine Oudjana <[email protected]>
4+
*/
5+
6+
#include <linux/clk-provider.h>
7+
#include <linux/platform_device.h>
8+
9+
#include "clk-gate.h"
10+
#include "clk-mtk.h"
11+
12+
#include <dt-bindings/clock/mediatek,mt6735-imgsys.h>
13+
14+
#define IMG_CG_CON 0x00
15+
#define IMG_CG_SET 0x04
16+
#define IMG_CG_CLR 0x08
17+
18+
static struct mtk_gate_regs imgsys_cg_regs = {
19+
.set_ofs = IMG_CG_SET,
20+
.clr_ofs = IMG_CG_CLR,
21+
.sta_ofs = IMG_CG_CON,
22+
};
23+
24+
static const struct mtk_gate imgsys_gates[] = {
25+
GATE_MTK(CLK_IMG_SMI_LARB2, "smi_larb2", "mm_sel", &imgsys_cg_regs, 0, &mtk_clk_gate_ops_setclr),
26+
GATE_MTK(CLK_IMG_CAM_SMI, "cam_smi", "mm_sel", &imgsys_cg_regs, 5, &mtk_clk_gate_ops_setclr),
27+
GATE_MTK(CLK_IMG_CAM_CAM, "cam_cam", "mm_sel", &imgsys_cg_regs, 6, &mtk_clk_gate_ops_setclr),
28+
GATE_MTK(CLK_IMG_SEN_TG, "sen_tg", "mm_sel", &imgsys_cg_regs, 7, &mtk_clk_gate_ops_setclr),
29+
GATE_MTK(CLK_IMG_SEN_CAM, "sen_cam", "mm_sel", &imgsys_cg_regs, 8, &mtk_clk_gate_ops_setclr),
30+
GATE_MTK(CLK_IMG_CAM_SV, "cam_sv", "mm_sel", &imgsys_cg_regs, 9, &mtk_clk_gate_ops_setclr),
31+
GATE_MTK(CLK_IMG_SUFOD, "sufod", "mm_sel", &imgsys_cg_regs, 10, &mtk_clk_gate_ops_setclr),
32+
GATE_MTK(CLK_IMG_FD, "fd", "mm_sel", &imgsys_cg_regs, 11, &mtk_clk_gate_ops_setclr),
33+
};
34+
35+
static const struct mtk_clk_desc imgsys_clks = {
36+
.clks = imgsys_gates,
37+
.num_clks = ARRAY_SIZE(imgsys_gates),
38+
};
39+
40+
static const struct of_device_id of_match_mt6735_imgsys[] = {
41+
{ .compatible = "mediatek,mt6735-imgsys", .data = &imgsys_clks },
42+
{ /* sentinel */ }
43+
};
44+
45+
static struct platform_driver clk_mt6735_imgsys = {
46+
.probe = mtk_clk_simple_probe,
47+
.remove = mtk_clk_simple_remove,
48+
.driver = {
49+
.name = "clk-mt6735-imgsys",
50+
.of_match_table = of_match_mt6735_imgsys,
51+
},
52+
};
53+
module_platform_driver(clk_mt6735_imgsys);
54+
55+
MODULE_AUTHOR("Yassine Oudjana <[email protected]>");
56+
MODULE_DESCRIPTION("MediaTek MT6735 imgsys clock driver");
57+
MODULE_LICENSE("GPL");
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2022 Yassine Oudjana <[email protected]>
4+
*/
5+
6+
#include <linux/clk-provider.h>
7+
#include <linux/platform_device.h>
8+
9+
#include "clk-gate.h"
10+
#include "clk-mtk.h"
11+
12+
#include <dt-bindings/clock/mediatek,mt6735-mfgcfg.h>
13+
14+
#define MFG_CG_CON 0x00
15+
#define MFG_CG_SET 0x04
16+
#define MFG_CG_CLR 0x08
17+
#define MFG_RESET 0x0c
18+
19+
static struct mtk_gate_regs mfgcfg_cg_regs = {
20+
.set_ofs = MFG_CG_SET,
21+
.clr_ofs = MFG_CG_CLR,
22+
.sta_ofs = MFG_CG_CON,
23+
};
24+
25+
static const struct mtk_gate mfgcfg_gates[] = {
26+
GATE_MTK(CLK_MFG_BG3D, "bg3d", "mfg_sel", &mfgcfg_cg_regs, 0, &mtk_clk_gate_ops_setclr),
27+
};
28+
29+
static u16 mfgcfg_rst_ofs[] = { MFG_RESET };
30+
31+
static const struct mtk_clk_rst_desc mfgcfg_resets = {
32+
.version = MTK_RST_SIMPLE,
33+
.rst_bank_ofs = mfgcfg_rst_ofs,
34+
.rst_bank_nr = ARRAY_SIZE(mfgcfg_rst_ofs)
35+
};
36+
37+
static const struct mtk_clk_desc mfgcfg_clks = {
38+
.clks = mfgcfg_gates,
39+
.num_clks = ARRAY_SIZE(mfgcfg_gates),
40+
41+
.rst_desc = &mfgcfg_resets
42+
};
43+
44+
static const struct of_device_id of_match_mt6735_mfgcfg[] = {
45+
{ .compatible = "mediatek,mt6735-mfgcfg", .data = &mfgcfg_clks },
46+
{ /* sentinel */ }
47+
};
48+
49+
static struct platform_driver clk_mt6735_mfgcfg = {
50+
.probe = mtk_clk_simple_probe,
51+
.remove = mtk_clk_simple_remove,
52+
.driver = {
53+
.name = "clk-mt6735-mfgcfg",
54+
.of_match_table = of_match_mt6735_mfgcfg,
55+
},
56+
};
57+
module_platform_driver(clk_mt6735_mfgcfg);
58+
59+
MODULE_AUTHOR("Yassine Oudjana <[email protected]>");
60+
MODULE_DESCRIPTION("Mediatek MT6735 mfgcfg clock and reset driver");
61+
MODULE_LICENSE("GPL");
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2022 Yassine Oudjana <[email protected]>
4+
*/
5+
6+
#include <linux/clk-provider.h>
7+
#include <linux/platform_device.h>
8+
9+
#include "clk-gate.h"
10+
#include "clk-mtk.h"
11+
12+
#include <dt-bindings/clock/mediatek,mt6735-vdecsys.h>
13+
#include <dt-bindings/reset/mediatek,mt6735-vdecsys.h>
14+
15+
#define VDEC_CKEN_SET 0x00
16+
#define VDEC_CKEN_CLR 0x04
17+
#define SMI_LARB1_CKEN_SET 0x08
18+
#define SMI_LARB1_CKEN_CLR 0x0c
19+
#define VDEC_RESETB_CON 0x10
20+
#define SMI_LARB1_RESETB_CON 0x14
21+
22+
#define RST_NR_PER_BANK 32
23+
24+
static struct mtk_gate_regs vdec_cg_regs = {
25+
.set_ofs = VDEC_CKEN_SET,
26+
.clr_ofs = VDEC_CKEN_CLR,
27+
.sta_ofs = VDEC_CKEN_SET,
28+
};
29+
30+
static struct mtk_gate_regs smi_larb1_cg_regs = {
31+
.set_ofs = SMI_LARB1_CKEN_SET,
32+
.clr_ofs = SMI_LARB1_CKEN_CLR,
33+
.sta_ofs = SMI_LARB1_CKEN_SET,
34+
};
35+
36+
static const struct mtk_gate vdecsys_gates[] = {
37+
GATE_MTK(CLK_VDEC_VDEC, "vdec", "vdec_sel", &vdec_cg_regs, 0, &mtk_clk_gate_ops_setclr_inv),
38+
GATE_MTK(CLK_VDEC_SMI_LARB1, "smi_larb1", "vdec_sel", &smi_larb1_cg_regs, 0, &mtk_clk_gate_ops_setclr_inv),
39+
};
40+
41+
static u16 vdecsys_rst_bank_ofs[] = { VDEC_RESETB_CON, SMI_LARB1_RESETB_CON };
42+
43+
static u16 vdecsys_rst_idx_map[] = {
44+
[MT6735_VDEC_RST0_VDEC] = 0 * RST_NR_PER_BANK + 0,
45+
[MT6735_VDEC_RST1_SMI_LARB1] = 1 * RST_NR_PER_BANK + 0,
46+
};
47+
48+
static const struct mtk_clk_rst_desc vdecsys_resets = {
49+
.version = MTK_RST_SIMPLE,
50+
.rst_bank_ofs = vdecsys_rst_bank_ofs,
51+
.rst_bank_nr = ARRAY_SIZE(vdecsys_rst_bank_ofs),
52+
.rst_idx_map = vdecsys_rst_idx_map,
53+
.rst_idx_map_nr = ARRAY_SIZE(vdecsys_rst_idx_map)
54+
};
55+
56+
static const struct mtk_clk_desc vdecsys_clks = {
57+
.clks = vdecsys_gates,
58+
.num_clks = ARRAY_SIZE(vdecsys_gates),
59+
.rst_desc = &vdecsys_resets
60+
};
61+
62+
static const struct of_device_id of_match_mt6735_vdecsys[] = {
63+
{ .compatible = "mediatek,mt6735-vdecsys", .data = &vdecsys_clks },
64+
{ /* sentinel */ }
65+
};
66+
67+
static struct platform_driver clk_mt6735_vdecsys = {
68+
.probe = mtk_clk_simple_probe,
69+
.remove = mtk_clk_simple_remove,
70+
.driver = {
71+
.name = "clk-mt6735-vdecsys",
72+
.of_match_table = of_match_mt6735_vdecsys,
73+
},
74+
};
75+
module_platform_driver(clk_mt6735_vdecsys);
76+
77+
MODULE_AUTHOR("Yassine Oudjana <[email protected]>");
78+
MODULE_DESCRIPTION("MediaTek MT6735 vdecsys clock and reset driver");
79+
MODULE_LICENSE("GPL");
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2022 Yassine Oudjana <[email protected]>
4+
*/
5+
6+
#include <linux/clk-provider.h>
7+
#include <linux/platform_device.h>
8+
9+
#include "clk-gate.h"
10+
#include "clk-mtk.h"
11+
12+
#include <dt-bindings/clock/mediatek,mt6735-vencsys.h>
13+
14+
#define VENC_CG_CON 0x00
15+
#define VENC_CG_SET 0x04
16+
#define VENC_CG_CLR 0x08
17+
18+
static struct mtk_gate_regs venc_cg_regs = {
19+
.set_ofs = VENC_CG_SET,
20+
.clr_ofs = VENC_CG_CLR,
21+
.sta_ofs = VENC_CG_CON,
22+
};
23+
24+
static const struct mtk_gate vencsys_gates[] = {
25+
GATE_MTK(CLK_VENC_SMI_LARB3, "smi_larb3", "mm_sel", &venc_cg_regs, 0, &mtk_clk_gate_ops_setclr_inv),
26+
GATE_MTK(CLK_VENC_VENC, "venc", "mm_sel", &venc_cg_regs, 4, &mtk_clk_gate_ops_setclr_inv),
27+
GATE_MTK(CLK_VENC_JPGENC, "jpgenc", "mm_sel", &venc_cg_regs, 8, &mtk_clk_gate_ops_setclr_inv),
28+
GATE_MTK(CLK_VENC_JPGDEC, "jpgdec", "mm_sel", &venc_cg_regs, 12, &mtk_clk_gate_ops_setclr_inv),
29+
};
30+
31+
static const struct mtk_clk_desc vencsys_clks = {
32+
.clks = vencsys_gates,
33+
.num_clks = ARRAY_SIZE(vencsys_gates),
34+
};
35+
36+
static const struct of_device_id of_match_mt6735_vencsys[] = {
37+
{ .compatible = "mediatek,mt6735-vencsys", .data = &vencsys_clks },
38+
{ /* sentinel */ }
39+
};
40+
41+
static struct platform_driver clk_mt6735_vencsys = {
42+
.probe = mtk_clk_simple_probe,
43+
.remove = mtk_clk_simple_remove,
44+
.driver = {
45+
.name = "clk-mt6735-vencsys",
46+
.of_match_table = of_match_mt6735_vencsys,
47+
},
48+
};
49+
module_platform_driver(clk_mt6735_vencsys);
50+
51+
MODULE_AUTHOR("Yassine Oudjana <[email protected]>");
52+
MODULE_DESCRIPTION("Mediatek MT6735 vencsys clock driver");
53+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)