Commit f882a1e2 authored by Stephen Boyd's avatar Stephen Boyd

Merge tag 'mtk-clk-for-6.1' of...

Merge tag 'mtk-clk-for-6.1' of https://git.kernel.org/pub/scm/linux/kernel/git/wens/linux into clk-mtk

Pull MediaTek clk driver updates from Chen-Yu Tsai:

A lot of clean up work, as well as new drivers and new functions

 - New clock drivers for MediaTek Helio X10 MT6795
 - Add missing DPI1_HDMI clock in MT8195 VDOSYS1
 - Clock driver changes to support GPU DVFS on MT8183, MT8192, MT8195
   - Fix GPU clock topology on MT8195
   - Propogate rate changes from GPU clock gate up the tree
   - Clock mux notifiers for GPU-related PLLs
 - Conversion of more "simple" drivers to mtk_clk_simple_probe()
 - Hook up mtk_clk_simple_remove() for "simple" MT8192 clock drivers
 - Fixes to previous |struct clk| to |struct clk_hw| conversion
 - Shrink MT8192 clock driver by deduplicating clock parent lists

* tag 'mtk-clk-for-6.1' of https://git.kernel.org/pub/scm/linux/kernel/git/wens/linux: (31 commits)
  clk: mediatek: mt8192: deduplicate parent clock lists
  clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*()
  clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup
  clk: mediatek: clk-mt8192: Add clock mux notifier for mfg_pll_sel
  clk: mediatek: clk-mt8192-mfg: Propagate rate changes to parent
  clk: mediatek: clk-mt8195-topckgen: Drop univplls from mfg mux parents
  clk: mediatek: clk-mt8195-topckgen: Add GPU clock mux notifier
  clk: mediatek: clk-mt8195-topckgen: Register mfg_ck_fast_ref as generic mux
  clk: mediatek: clk-mt8195-mfg: Reparent mfg_bg3d and propagate rate changes
  clk: mediatek: mt8183: Add clk mux notifier for MFG mux
  clk: mediatek: mux: add clk notifier functions
  clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent
  clk: mediatek: Use mtk_clk_register_gates_with_dev in simple probe
  clk: mediatek: gate: Export mtk_clk_register_gates_with_dev
  clk: mediatek: add VDOSYS1 clock
  dt-bindings: clk: mediatek: Add MT8195 DPI clocks
  clk: mediatek: mt8192: add mtk_clk_simple_remove
  clk: mediatek: mt8183: use mtk_clk_simple_probe to simplify driver
  clk: mediatek: mt6797: use mtk_clk_simple_probe to simplify driver
  clk: mediatek: mt6779: use mtk_clk_simple_probe to simplify driver
  ...
parents 3cc53c57 99f3a5e8
......@@ -23,6 +23,7 @@ properties:
- mediatek,mt2701-infracfg
- mediatek,mt2712-infracfg
- mediatek,mt6765-infracfg
- mediatek,mt6795-infracfg
- mediatek,mt6779-infracfg_ao
- mediatek,mt6797-infracfg
- mediatek,mt7622-infracfg
......@@ -60,6 +61,7 @@ if:
enum:
- mediatek,mt2701-infracfg
- mediatek,mt2712-infracfg
- mediatek,mt6795-infracfg
- mediatek,mt7622-infracfg
- mediatek,mt7986-infracfg
- mediatek,mt8135-infracfg
......
......@@ -25,6 +25,7 @@ properties:
- mediatek,mt2712-mmsys
- mediatek,mt6765-mmsys
- mediatek,mt6779-mmsys
- mediatek,mt6795-mmsys
- mediatek,mt6797-mmsys
- mediatek,mt8167-mmsys
- mediatek,mt8173-mmsys
......
......@@ -21,6 +21,7 @@ properties:
- mediatek,mt2701-pericfg
- mediatek,mt2712-pericfg
- mediatek,mt6765-pericfg
- mediatek,mt6795-pericfg
- mediatek,mt7622-pericfg
- mediatek,mt7629-pericfg
- mediatek,mt8135-pericfg
......
......@@ -34,6 +34,7 @@ properties:
- mediatek,mt2712-apmixedsys
- mediatek,mt6765-apmixedsys
- mediatek,mt6779-apmixedsys
- mediatek,mt6795-apmixedsys
- mediatek,mt7629-apmixedsys
- mediatek,mt8167-apmixedsys
- mediatek,mt8183-apmixedsys
......
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/mediatek,mt6795-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: MediaTek Functional Clock Controller for MT6795
maintainers:
- AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
- Chun-Jie Chen <chun-jie.chen@mediatek.com>
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,mt6795-mfgcfg
- mediatek,mt6795-vdecsys
- mediatek,mt6795-vencsys
reg:
maxItems: 1
'#clock-cells':
const: 1
required:
- compatible
- reg
- '#clock-cells'
additionalProperties: false
examples:
- |
soc {
#address-cells = <2>;
#size-cells = <2>;
mfgcfg: clock-controller@13000000 {
compatible = "mediatek,mt6795-mfgcfg";
reg = <0 0x13000000 0 0x1000>;
#clock-cells = <1>;
};
vdecsys: clock-controller@16000000 {
compatible = "mediatek,mt6795-vdecsys";
reg = <0 0x16000000 0 0x1000>;
#clock-cells = <1>;
};
vencsys: clock-controller@18000000 {
compatible = "mediatek,mt6795-vencsys";
reg = <0 0x18000000 0 0x1000>;
#clock-cells = <1>;
};
};
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/mediatek,mt6795-sys-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: MediaTek System Clock Controller for MT6795
maintainers:
- AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
- Chun-Jie Chen <chun-jie.chen@mediatek.com>
description:
The Mediatek system clock controller provides various clocks and system
configuration like reset and bus protection on MT6795.
properties:
compatible:
items:
- enum:
- mediatek,mt6795-apmixedsys
- mediatek,mt6795-infracfg
- mediatek,mt6795-pericfg
- mediatek,mt6795-topckgen
- const: syscon
reg:
maxItems: 1
'#clock-cells':
const: 1
'#reset-cells':
const: 1
required:
- compatible
- reg
- '#clock-cells'
additionalProperties: false
examples:
- |
soc {
#address-cells = <2>;
#size-cells = <2>;
topckgen: clock-controller@10000000 {
compatible = "mediatek,mt6795-topckgen", "syscon";
reg = <0 0x10000000 0 0x1000>;
#clock-cells = <1>;
};
};
......@@ -33,6 +33,7 @@ properties:
- mediatek,mt2712-topckgen
- mediatek,mt6765-topckgen
- mediatek,mt6779-topckgen
- mediatek,mt6795-topckgen
- mediatek,mt7629-topckgen
- mediatek,mt7986-topckgen
- mediatek,mt8167-topckgen
......
......@@ -259,6 +259,43 @@ config COMMON_CLK_MT6779_AUDSYS
help
This driver supports Mediatek MT6779 audsys clocks.
config COMMON_CLK_MT6795
tristate "Clock driver for MediaTek MT6795"
depends on ARCH_MEDIATEK || COMPILE_TEST
select COMMON_CLK_MEDIATEK
default ARCH_MEDIATEK
help
This driver supports MediaTek MT6795 basic clocks and clocks
required for various peripherals found on MediaTek.
config COMMON_CLK_MT6795_MFGCFG
tristate "Clock driver for MediaTek MT6795 mfgcfg"
depends on COMMON_CLK_MT6795
default COMMON_CLK_MT6795
help
This driver supports MediaTek MT6795 mfgcfg clocks.
config COMMON_CLK_MT6795_MMSYS
tristate "Clock driver for MediaTek MT6795 mmsys"
depends on COMMON_CLK_MT6795
default COMMON_CLK_MT6795
help
This driver supports MediaTek MT6795 mmsys clocks.
config COMMON_CLK_MT6795_VDECSYS
tristate "Clock driver for MediaTek MT6795 VDECSYS"
depends on COMMON_CLK_MT6795
default COMMON_CLK_MT6795
help
This driver supports MediaTek MT6795 vdecsys clocks.
config COMMON_CLK_MT6795_VENCSYS
tristate "Clock driver for MediaTek MT6795 VENCSYS"
depends on COMMON_CLK_MT6795
default COMMON_CLK_MT6795
help
This driver supports MediaTek MT6795 vencsys clocks.
config COMMON_CLK_MT6797
bool "Clock driver for MediaTek MT6797"
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
......
......@@ -17,6 +17,12 @@ obj-$(CONFIG_COMMON_CLK_MT6779_VDECSYS) += clk-mt6779-vdec.o
obj-$(CONFIG_COMMON_CLK_MT6779_VENCSYS) += clk-mt6779-venc.o
obj-$(CONFIG_COMMON_CLK_MT6779_MFGCFG) += clk-mt6779-mfg.o
obj-$(CONFIG_COMMON_CLK_MT6779_AUDSYS) += clk-mt6779-aud.o
obj-$(CONFIG_COMMON_CLK_MT6795) += clk-mt6795-apmixedsys.o clk-mt6795-infracfg.o \
clk-mt6795-pericfg.o clk-mt6795-topckgen.o
obj-$(CONFIG_COMMON_CLK_MT6795_MFGCFG) += clk-mt6795-mfg.o
obj-$(CONFIG_COMMON_CLK_MT6795_MMSYS) += clk-mt6795-mm.o
obj-$(CONFIG_COMMON_CLK_MT6795_VDECSYS) += clk-mt6795-vdecsys.o
obj-$(CONFIG_COMMON_CLK_MT6795_VENCSYS) += clk-mt6795-vencsys.o
obj-$(CONFIG_COMMON_CLK_MT6797) += clk-mt6797.o
obj-$(CONFIG_COMMON_CLK_MT6797_IMGSYS) += clk-mt6797-img.o
obj-$(CONFIG_COMMON_CLK_MT6797_MMSYS) += clk-mt6797-mm.o
......
......@@ -70,7 +70,7 @@ static const struct clk_ops mtk_ref2usb_tx_ops = {
.unprepare = mtk_ref2usb_tx_unprepare,
};
struct clk_hw * __init mtk_clk_register_ref2usb_tx(const char *name,
struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
const char *parent_name, void __iomem *reg)
{
struct mtk_ref2usb_tx *tx;
......@@ -98,5 +98,15 @@ struct clk_hw * __init mtk_clk_register_ref2usb_tx(const char *name,
return &tx->hw;
}
EXPORT_SYMBOL_GPL(mtk_clk_register_ref2usb_tx);
void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw)
{
struct mtk_ref2usb_tx *tx = to_mtk_ref2usb_tx(hw);
clk_hw_unregister(hw);
kfree(tx);
}
EXPORT_SYMBOL_GPL(mtk_clk_unregister_ref2usb_tx);
MODULE_LICENSE("GPL");
......@@ -150,6 +150,7 @@ int mtk_clk_register_cpumuxes(struct device_node *node,
return PTR_ERR(hw);
}
EXPORT_SYMBOL_GPL(mtk_clk_register_cpumuxes);
void mtk_clk_unregister_cpumuxes(const struct mtk_composite *clks, int num,
struct clk_hw_onecell_data *clk_data)
......@@ -166,5 +167,6 @@ void mtk_clk_unregister_cpumuxes(const struct mtk_composite *clks, int num,
clk_data->hws[mux->id] = ERR_PTR(-ENOENT);
}
}
EXPORT_SYMBOL_GPL(mtk_clk_unregister_cpumuxes);
MODULE_LICENSE("GPL");
......@@ -261,6 +261,7 @@ int mtk_clk_register_gates_with_dev(struct device_node *node,
return PTR_ERR(hw);
}
EXPORT_SYMBOL_GPL(mtk_clk_register_gates_with_dev);
int mtk_clk_register_gates(struct device_node *node,
const struct mtk_gate *clks, int num,
......
......@@ -94,33 +94,23 @@ static const struct mtk_gate bdp_clks[] = {
GATE_BDP1(CLK_BDP_HDMI_MON, "hdmi_mon", "hdmi_0_pll340m", 16),
};
static const struct of_device_id of_match_clk_mt2701_bdp[] = {
{ .compatible = "mediatek,mt2701-bdpsys", },
{}
static const struct mtk_clk_desc bdp_desc = {
.clks = bdp_clks,
.num_clks = ARRAY_SIZE(bdp_clks),
};
static int clk_mt2701_bdp_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_BDP_NR);
mtk_clk_register_gates(node, bdp_clks, ARRAY_SIZE(bdp_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static const struct of_device_id of_match_clk_mt2701_bdp[] = {
{
.compatible = "mediatek,mt2701-bdpsys",
.data = &bdp_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2701_bdp_drv = {
.probe = clk_mt2701_bdp_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2701-bdp",
.of_match_table = of_match_clk_mt2701_bdp,
......
......@@ -36,33 +36,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_VENC, "img_venc", "mm_sel", 9),
};
static const struct of_device_id of_match_clk_mt2701_img[] = {
{ .compatible = "mediatek,mt2701-imgsys", },
{}
static const struct mtk_clk_desc img_desc = {
.clks = img_clks,
.num_clks = ARRAY_SIZE(img_clks),
};
static int clk_mt2701_img_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IMG_NR);
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static const struct of_device_id of_match_clk_mt2701_img[] = {
{
.compatible = "mediatek,mt2701-imgsys",
.data = &img_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2701_img_drv = {
.probe = clk_mt2701_img_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2701-img",
.of_match_table = of_match_clk_mt2701_img,
......
......@@ -47,33 +47,23 @@ static const struct mtk_gate vdec_clks[] = {
GATE_VDEC1(CLK_VDEC_LARB, "vdec_larb_cken", "mm_sel", 0),
};
static const struct of_device_id of_match_clk_mt2701_vdec[] = {
{ .compatible = "mediatek,mt2701-vdecsys", },
{}
static const struct mtk_clk_desc vdec_desc = {
.clks = vdec_clks,
.num_clks = ARRAY_SIZE(vdec_clks),
};
static int clk_mt2701_vdec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR);
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static const struct of_device_id of_match_clk_mt2701_vdec[] = {
{
.compatible = "mediatek,mt2701-vdecsys",
.data = &vdec_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2701_vdec_drv = {
.probe = clk_mt2701_vdec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2701-vdec",
.of_match_table = of_match_clk_mt2701_vdec,
......
......@@ -58,33 +58,23 @@ static const struct mtk_gate bdp_clks[] = {
GATE_BDP(CLK_BDP_TVD_CBUS, "bdp_tvd_cbus", "mm_sel", 30),
};
static int clk_mt2712_bdp_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_BDP_NR_CLK);
mtk_clk_register_gates(node, bdp_clks, ARRAY_SIZE(bdp_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc bdp_desc = {
.clks = bdp_clks,
.num_clks = ARRAY_SIZE(bdp_clks),
};
static const struct of_device_id of_match_clk_mt2712_bdp[] = {
{ .compatible = "mediatek,mt2712-bdpsys", },
{}
{
.compatible = "mediatek,mt2712-bdpsys",
.data = &bdp_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2712_bdp_drv = {
.probe = clk_mt2712_bdp_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2712-bdp",
.of_match_table = of_match_clk_mt2712_bdp,
......
......@@ -36,33 +36,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_CAM_SV2_EN, "img_cam_sv2_en", "mm_sel", 11),
};
static int clk_mt2712_img_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc img_desc = {
.clks = img_clks,
.num_clks = ARRAY_SIZE(img_clks),
};
static const struct of_device_id of_match_clk_mt2712_img[] = {
{ .compatible = "mediatek,mt2712-imgsys", },
{}
{
.compatible = "mediatek,mt2712-imgsys",
.data = &img_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2712_img_drv = {
.probe = clk_mt2712_img_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2712-img",
.of_match_table = of_match_clk_mt2712_img,
......
......@@ -32,33 +32,23 @@ static const struct mtk_gate jpgdec_clks[] = {
GATE_JPGDEC(CLK_JPGDEC_JPGDEC, "jpgdec_jpgdec", "jpgdec_sel", 4),
};
static int clk_mt2712_jpgdec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_JPGDEC_NR_CLK);
mtk_clk_register_gates(node, jpgdec_clks, ARRAY_SIZE(jpgdec_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc jpgdec_desc = {
.clks = jpgdec_clks,
.num_clks = ARRAY_SIZE(jpgdec_clks),
};
static const struct of_device_id of_match_clk_mt2712_jpgdec[] = {
{ .compatible = "mediatek,mt2712-jpgdecsys", },
{}
{
.compatible = "mediatek,mt2712-jpgdecsys",
.data = &jpgdec_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2712_jpgdec_drv = {
.probe = clk_mt2712_jpgdec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2712-jpgdec",
.of_match_table = of_match_clk_mt2712_jpgdec,
......
......@@ -31,33 +31,23 @@ static const struct mtk_gate mfg_clks[] = {
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0),
};
static int clk_mt2712_mfg_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_MFG_NR_CLK);
mtk_clk_register_gates(node, mfg_clks, ARRAY_SIZE(mfg_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc mfg_desc = {
.clks = mfg_clks,
.num_clks = ARRAY_SIZE(mfg_clks),
};
static const struct of_device_id of_match_clk_mt2712_mfg[] = {
{ .compatible = "mediatek,mt2712-mfgcfg", },
{}
{
.compatible = "mediatek,mt2712-mfgcfg",
.data = &mfg_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2712_mfg_drv = {
.probe = clk_mt2712_mfg_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2712-mfg",
.of_match_table = of_match_clk_mt2712_mfg,
......
......@@ -50,33 +50,23 @@ static const struct mtk_gate vdec_clks[] = {
GATE_VDEC1(CLK_VDEC_IMGRZ_CKEN, "vdec_imgrz_cken", "vdec_sel", 1),
};
static int clk_mt2712_vdec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc vdec_desc = {
.clks = vdec_clks,
.num_clks = ARRAY_SIZE(vdec_clks),
};
static const struct of_device_id of_match_clk_mt2712_vdec[] = {
{ .compatible = "mediatek,mt2712-vdecsys", },
{}
{
.compatible = "mediatek,mt2712-vdecsys",
.data = &vdec_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2712_vdec_drv = {
.probe = clk_mt2712_vdec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2712-vdec",
.of_match_table = of_match_clk_mt2712_vdec,
......
......@@ -33,33 +33,23 @@ static const struct mtk_gate venc_clks[] = {
GATE_VENC(CLK_VENC_SMI_LARB6, "venc_smi_larb6", "jpgdec_sel", 12),
};
static int clk_mt2712_venc_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VENC_NR_CLK);
mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc venc_desc = {
.clks = venc_clks,
.num_clks = ARRAY_SIZE(venc_clks),
};
static const struct of_device_id of_match_clk_mt2712_venc[] = {
{ .compatible = "mediatek,mt2712-vencsys", },
{}
{
.compatible = "mediatek,mt2712-vencsys",
.data = &venc_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt2712_venc_drv = {
.probe = clk_mt2712_venc_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt2712-venc",
.of_match_table = of_match_clk_mt2712_venc,
......
......@@ -64,33 +64,23 @@ static const struct mtk_gate audio_clks[] = {
"audio_ck", 7),
};
static int clk_mt6765_audio_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
mtk_clk_register_gates(node, audio_clks,
ARRAY_SIZE(audio_clks), clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc audio_desc = {
.clks = audio_clks,
.num_clks = ARRAY_SIZE(audio_clks),
};
static const struct of_device_id of_match_clk_mt6765_audio[] = {
{ .compatible = "mediatek,mt6765-audsys", },
{}
{
.compatible = "mediatek,mt6765-audsys",
.data = &audio_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6765_audio_drv = {
.probe = clk_mt6765_audio_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6765-audio",
.of_match_table = of_match_clk_mt6765_audio,
......
......@@ -39,32 +39,23 @@ static const struct mtk_gate cam_clks[] = {
GATE_CAM(CLK_CAM_CCU, "cam_ccu", "mm_ck", 12),
};
static int clk_mt6765_cam_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_CAM_NR_CLK);
mtk_clk_register_gates(node, cam_clks, ARRAY_SIZE(cam_clks), clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc cam_desc = {
.clks = cam_clks,
.num_clks = ARRAY_SIZE(cam_clks),
};
static const struct of_device_id of_match_clk_mt6765_cam[] = {
{ .compatible = "mediatek,mt6765-camsys", },
{}
{
.compatible = "mediatek,mt6765-camsys",
.data = &cam_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6765_cam_drv = {
.probe = clk_mt6765_cam_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6765-cam",
.of_match_table = of_match_clk_mt6765_cam,
......
......@@ -35,32 +35,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_RSC, "img_rsc", "mm_ck", 5),
};
static int clk_mt6765_img_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks), clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc img_desc = {
.clks = img_clks,
.num_clks = ARRAY_SIZE(img_clks),
};
static const struct of_device_id of_match_clk_mt6765_img[] = {
{ .compatible = "mediatek,mt6765-imgsys", },
{}
{
.compatible = "mediatek,mt6765-imgsys",
.data = &img_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6765_img_drv = {
.probe = clk_mt6765_img_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6765-img",
.of_match_table = of_match_clk_mt6765_img,
......
......@@ -32,33 +32,23 @@ static const struct mtk_gate mipi0a_clks[] = {
"mipi0a_csr_0a", "f_fseninf_ck", 1),
};
static int clk_mt6765_mipi0a_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_MIPI0A_NR_CLK);
mtk_clk_register_gates(node, mipi0a_clks,
ARRAY_SIZE(mipi0a_clks), clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc mipi0a_desc = {
.clks = mipi0a_clks,
.num_clks = ARRAY_SIZE(mipi0a_clks),
};
static const struct of_device_id of_match_clk_mt6765_mipi0a[] = {
{ .compatible = "mediatek,mt6765-mipi0a", },
{}
{
.compatible = "mediatek,mt6765-mipi0a",
.data = &mipi0a_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6765_mipi0a_drv = {
.probe = clk_mt6765_mipi0a_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6765-mipi0a",
.of_match_table = of_match_clk_mt6765_mipi0a,
......
......@@ -61,32 +61,23 @@ static const struct mtk_gate mm_clks[] = {
GATE_MM(CLK_MM_F26M_HRTWT, "mm_hrtwt", "f_f26m_ck", 29),
};
static int clk_mt6765_mm_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks), clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc mm_desc = {
.clks = mm_clks,
.num_clks = ARRAY_SIZE(mm_clks),
};
static const struct of_device_id of_match_clk_mt6765_mm[] = {
{ .compatible = "mediatek,mt6765-mmsys", },
{}
{
.compatible = "mediatek,mt6765-mmsys",
.data = &mm_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6765_mm_drv = {
.probe = clk_mt6765_mm_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6765-mm",
.of_match_table = of_match_clk_mt6765_mm,
......
......@@ -34,33 +34,23 @@ static const struct mtk_gate venc_clks[] = {
GATE_VENC(CLK_VENC_SET3_VDEC, "venc_set3_vdec", "mm_ck", 12),
};
static int clk_mt6765_vcodec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VENC_NR_CLK);
mtk_clk_register_gates(node, venc_clks,
ARRAY_SIZE(venc_clks), clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
return r;
}
static const struct mtk_clk_desc venc_desc = {
.clks = venc_clks,
.num_clks = ARRAY_SIZE(venc_clks),
};
static const struct of_device_id of_match_clk_mt6765_vcodec[] = {
{ .compatible = "mediatek,mt6765-vcodecsys", },
{}
{
.compatible = "mediatek,mt6765-vcodecsys",
.data = &venc_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6765_vcodec_drv = {
.probe = clk_mt6765_vcodec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6765-vcodec",
.of_match_table = of_match_clk_mt6765_vcodec,
......
......@@ -89,26 +89,23 @@ static const struct mtk_gate audio_clks[] = {
"audio_h_sel", 31),
};
static const struct of_device_id of_match_clk_mt6779_aud[] = {
{ .compatible = "mediatek,mt6779-audio", },
{}
static const struct mtk_clk_desc audio_desc = {
.clks = audio_clks,
.num_clks = ARRAY_SIZE(audio_clks),
};
static int clk_mt6779_aud_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK);
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct of_device_id of_match_clk_mt6779_aud[] = {
{
.compatible = "mediatek,mt6779-audio",
.data = &audio_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_aud_drv = {
.probe = clk_mt6779_aud_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-aud",
.of_match_table = of_match_clk_mt6779_aud,
......
......@@ -38,26 +38,23 @@ static const struct mtk_gate cam_clks[] = {
GATE_CAM(CLK_CAM_FAKE_ENG, "camsys_fake_eng", "cam_sel", 14),
};
static const struct of_device_id of_match_clk_mt6779_cam[] = {
{ .compatible = "mediatek,mt6779-camsys", },
{}
static const struct mtk_clk_desc cam_desc = {
.clks = cam_clks,
.num_clks = ARRAY_SIZE(cam_clks),
};
static int clk_mt6779_cam_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_CAM_NR_CLK);
mtk_clk_register_gates(node, cam_clks, ARRAY_SIZE(cam_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct of_device_id of_match_clk_mt6779_cam[] = {
{
.compatible = "mediatek,mt6779-camsys",
.data = &cam_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_cam_drv = {
.probe = clk_mt6779_cam_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-cam",
.of_match_table = of_match_clk_mt6779_cam,
......
......@@ -30,26 +30,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_WPE_A, "imgsys_wpe_a", "img_sel", 7),
};
static const struct of_device_id of_match_clk_mt6779_img[] = {
{ .compatible = "mediatek,mt6779-imgsys", },
{}
static const struct mtk_clk_desc img_desc = {
.clks = img_clks,
.num_clks = ARRAY_SIZE(img_clks),
};
static int clk_mt6779_img_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct of_device_id of_match_clk_mt6779_img[] = {
{
.compatible = "mediatek,mt6779-imgsys",
.data = &img_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_img_drv = {
.probe = clk_mt6779_img_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-img",
.of_match_table = of_match_clk_mt6779_img,
......
......@@ -32,26 +32,23 @@ static const struct mtk_gate ipe_clks[] = {
GATE_IPE(CLK_IPE_DPE, "ipe_dpe", "ipe_sel", 6),
};
static const struct of_device_id of_match_clk_mt6779_ipe[] = {
{ .compatible = "mediatek,mt6779-ipesys", },
{}
static const struct mtk_clk_desc ipe_desc = {
.clks = ipe_clks,
.num_clks = ARRAY_SIZE(ipe_clks),
};
static int clk_mt6779_ipe_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IPE_NR_CLK);
mtk_clk_register_gates(node, ipe_clks, ARRAY_SIZE(ipe_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct of_device_id of_match_clk_mt6779_ipe[] = {
{
.compatible = "mediatek,mt6779-ipesys",
.data = &ipe_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_ipe_drv = {
.probe = clk_mt6779_ipe_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-ipe",
.of_match_table = of_match_clk_mt6779_ipe,
......
......@@ -27,26 +27,23 @@ static const struct mtk_gate mfg_clks[] = {
GATE_MFG(CLK_MFGCFG_BG3D, "mfg_bg3d", "mfg_sel", 0),
};
static int clk_mt6779_mfg_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_MFGCFG_NR_CLK);
mtk_clk_register_gates(node, mfg_clks, ARRAY_SIZE(mfg_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc mfg_desc = {
.clks = mfg_clks,
.num_clks = ARRAY_SIZE(mfg_clks),
};
static const struct of_device_id of_match_clk_mt6779_mfg[] = {
{ .compatible = "mediatek,mt6779-mfgcfg", },
{}
{
.compatible = "mediatek,mt6779-mfgcfg",
.data = &mfg_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_mfg_drv = {
.probe = clk_mt6779_mfg_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-mfg",
.of_match_table = of_match_clk_mt6779_mfg,
......
......@@ -39,26 +39,23 @@ static const struct mtk_gate vdec_clks[] = {
GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1_cken", "vdec_sel", 0),
};
static const struct of_device_id of_match_clk_mt6779_vdec[] = {
{ .compatible = "mediatek,mt6779-vdecsys", },
{}
static const struct mtk_clk_desc vdec_desc = {
.clks = vdec_clks,
.num_clks = ARRAY_SIZE(vdec_clks),
};
static int clk_mt6779_vdec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VDEC_GCON_NR_CLK);
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct of_device_id of_match_clk_mt6779_vdec[] = {
{
.compatible = "mediatek,mt6779-vdecsys",
.data = &vdec_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_vdec_drv = {
.probe = clk_mt6779_vdec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-vdec",
.of_match_table = of_match_clk_mt6779_vdec,
......
......@@ -30,26 +30,23 @@ static const struct mtk_gate venc_clks[] = {
GATE_VENC_I(CLK_VENC_GCON_GALS, "venc_gals", "venc_sel", 28),
};
static const struct of_device_id of_match_clk_mt6779_venc[] = {
{ .compatible = "mediatek,mt6779-vencsys", },
{}
static const struct mtk_clk_desc venc_desc = {
.clks = venc_clks,
.num_clks = ARRAY_SIZE(venc_clks),
};
static int clk_mt6779_venc_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VENC_GCON_NR_CLK);
mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct of_device_id of_match_clk_mt6779_venc[] = {
{
.compatible = "mediatek,mt6779-vencsys",
.data = &venc_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6779_venc_drv = {
.probe = clk_mt6779_venc_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6779-venc",
.of_match_table = of_match_clk_mt6779_venc,
......
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-mtk.h"
#include "clk-pll.h"
#define REG_REF2USB 0x8
#define REG_AP_PLL_CON7 0x1c
#define MD1_MTCMOS_OFF BIT(0)
#define MD1_MEM_OFF BIT(1)
#define MD1_CLK_OFF BIT(4)
#define MD1_ISO_OFF BIT(8)
#define MT6795_PLL_FMAX (3000UL * MHZ)
#define MT6795_CON0_EN BIT(0)
#define MT6795_CON0_RST_BAR BIT(24)
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift) { \
.id = _id, \
.name = _name, \
.reg = _reg, \
.pwr_reg = _pwr_reg, \
.en_mask = MT6795_CON0_EN | _en_mask, \
.flags = _flags, \
.rst_bar_mask = MT6795_CON0_RST_BAR, \
.fmax = MT6795_PLL_FMAX, \
.pcwbits = _pcwbits, \
.pd_reg = _pd_reg, \
.pd_shift = _pd_shift, \
.tuner_reg = _tuner_reg, \
.pcw_reg = _pcw_reg, \
.pcw_shift = _pcw_shift, \
.div_table = NULL, \
.pll_en_bit = 0, \
}
static const struct mtk_pll_data plls[] = {
PLL(CLK_APMIXED_ARMCA53PLL, "armca53pll", 0x200, 0x20c, 0, PLL_AO,
21, 0x204, 24, 0x0, 0x204, 0),
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x220, 0x22c, 0xf0000101, HAVE_RST_BAR,
21, 0x220, 4, 0x0, 0x224, 0),
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x230, 0x23c, 0xfe000101, HAVE_RST_BAR,
7, 0x230, 4, 0x0, 0x234, 14),
PLL(CLK_APMIXED_MMPLL, "mmpll", 0x240, 0x24c, 0, 0, 21, 0x244, 24, 0x0, 0x244, 0),
PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x250, 0x25c, 0, 0, 21, 0x250, 4, 0x0, 0x254, 0),
PLL(CLK_APMIXED_VENCPLL, "vencpll", 0x260, 0x26c, 0, 0, 21, 0x260, 4, 0x0, 0x264, 0),
PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x270, 0x27c, 0, 0, 21, 0x270, 4, 0x0, 0x274, 0),
PLL(CLK_APMIXED_MPLL, "mpll", 0x280, 0x28c, 0, 0, 21, 0x280, 4, 0x0, 0x284, 0),
PLL(CLK_APMIXED_VCODECPLL, "vcodecpll", 0x290, 0x29c, 0, 0, 21, 0x290, 4, 0x0, 0x294, 0),
PLL(CLK_APMIXED_APLL1, "apll1", 0x2a0, 0x2b0, 0, 0, 31, 0x2a0, 4, 0x2a8, 0x2a4, 0),
PLL(CLK_APMIXED_APLL2, "apll2", 0x2b4, 0x2c4, 0, 0, 31, 0x2b4, 4, 0x2bc, 0x2b8, 0),
};
static void clk_mt6795_apmixed_setup_md1(void __iomem *base)
{
void __iomem *reg = base + REG_AP_PLL_CON7;
/* Turn on MD1 internal clock */
writel(readl(reg) & ~MD1_CLK_OFF, reg);
/* Unlock MD1's MTCMOS power path */
writel(readl(reg) & ~MD1_MTCMOS_OFF, reg);
/* Turn on ISO */
writel(readl(reg) & ~MD1_ISO_OFF, reg);
/* Turn on memory */
writel(readl(reg) & ~MD1_MEM_OFF, reg);
}
static const struct of_device_id of_match_clk_mt6795_apmixed[] = {
{ .compatible = "mediatek,mt6795-apmixedsys" },
{ /* sentinel */ }
};
static int clk_mt6795_apmixed_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
void __iomem *base;
struct clk_hw *hw;
int ret;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
if (!clk_data)
return -ENOMEM;
ret = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
if (ret)
goto free_clk_data;
hw = mtk_clk_register_ref2usb_tx("ref2usb_tx", "clk26m", base + REG_REF2USB);
if (IS_ERR(hw)) {
ret = PTR_ERR(hw);
dev_err(dev, "Failed to register ref2usb_tx: %d\n", ret);
goto unregister_plls;
}
clk_data->hws[CLK_APMIXED_REF2USB_TX] = hw;
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (ret) {
dev_err(dev, "Cannot register clock provider: %d\n", ret);
goto unregister_ref2usb;
}
/* Setup MD1 to avoid random crashes */
dev_dbg(dev, "Performing initial setup for MD1\n");
clk_mt6795_apmixed_setup_md1(base);
return 0;
unregister_ref2usb:
mtk_clk_unregister_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);
unregister_plls:
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
free_clk_data:
mtk_free_clk_data(clk_data);
return ret;
}
static int clk_mt6795_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_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
mtk_free_clk_data(clk_data);
return 0;
}
static struct platform_driver clk_mt6795_apmixed_drv = {
.probe = clk_mt6795_apmixed_probe,
.remove = clk_mt6795_apmixed_remove,
.driver = {
.name = "clk-mt6795-apmixed",
.of_match_table = of_match_clk_mt6795_apmixed,
},
};
module_platform_driver(clk_mt6795_apmixed_drv);
MODULE_DESCRIPTION("MediaTek MT6795 apmixed clocks driver");
MODULE_LICENSE("GPL");
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <dt-bindings/reset/mediatek,mt6795-resets.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-cpumux.h"
#include "clk-gate.h"
#include "clk-mtk.h"
#include "reset.h"
#define GATE_ICG(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &infra_cg_regs, \
_shift, &mtk_clk_gate_ops_no_setclr)
static const struct mtk_gate_regs infra_cg_regs = {
.set_ofs = 0x0040,
.clr_ofs = 0x0044,
.sta_ofs = 0x0048,
};
static const char * const ca53_c0_parents[] = {
"clk26m",
"armca53pll",
"mainpll",
"univpll"
};
static const char * const ca53_c1_parents[] = {
"clk26m",
"armca53pll",
"mainpll",
"univpll"
};
static const struct mtk_composite cpu_muxes[] = {
MUX(CLK_INFRA_CA53_C0_SEL, "infra_ca53_c0_sel", ca53_c0_parents, 0x00, 0, 2),
MUX(CLK_INFRA_CA53_C1_SEL, "infra_ca53_c1_sel", ca53_c1_parents, 0x00, 2, 2),
};
static const struct mtk_gate infra_gates[] = {
GATE_ICG(CLK_INFRA_DBGCLK, "infra_dbgclk", "axi_sel", 0),
GATE_ICG(CLK_INFRA_SMI, "infra_smi", "mm_sel", 1),
GATE_ICG(CLK_INFRA_AUDIO, "infra_audio", "aud_intbus_sel", 5),
GATE_ICG(CLK_INFRA_GCE, "infra_gce", "axi_sel", 6),
GATE_ICG(CLK_INFRA_L2C_SRAM, "infra_l2c_sram", "axi_sel", 7),
GATE_ICG(CLK_INFRA_M4U, "infra_m4u", "mem_sel", 8),
GATE_ICG(CLK_INFRA_MD1MCU, "infra_md1mcu", "clk26m", 9),
GATE_ICG(CLK_INFRA_MD1BUS, "infra_md1bus", "axi_sel", 10),
GATE_ICG(CLK_INFRA_MD1DBB, "infra_dbb", "axi_sel", 11),
GATE_ICG(CLK_INFRA_DEVICE_APC, "infra_devapc", "clk26m", 12),
GATE_ICG(CLK_INFRA_TRNG, "infra_trng", "axi_sel", 13),
GATE_ICG(CLK_INFRA_MD1LTE, "infra_md1lte", "axi_sel", 14),
GATE_ICG(CLK_INFRA_CPUM, "infra_cpum", "cpum_ck", 15),
GATE_ICG(CLK_INFRA_KP, "infra_kp", "axi_sel", 16),
};
static u16 infra_ao_rst_ofs[] = { 0x30, 0x34 };
static u16 infra_ao_idx_map[] = {
[MT6795_INFRA_RST0_SCPSYS_RST] = 0 * RST_NR_PER_BANK + 5,
[MT6795_INFRA_RST0_PMIC_WRAP_RST] = 0 * RST_NR_PER_BANK + 7,
[MT6795_INFRA_RST1_MIPI_DSI_RST] = 1 * RST_NR_PER_BANK + 4,
[MT6795_INFRA_RST1_MIPI_CSI_RST] = 1 * RST_NR_PER_BANK + 7,
[MT6795_INFRA_RST1_MM_IOMMU_RST] = 1 * RST_NR_PER_BANK + 15,
};
static const struct mtk_clk_rst_desc clk_rst_desc = {
.version = MTK_RST_SET_CLR,
.rst_bank_ofs = infra_ao_rst_ofs,
.rst_bank_nr = ARRAY_SIZE(infra_ao_rst_ofs),
.rst_idx_map = infra_ao_idx_map,
.rst_idx_map_nr = ARRAY_SIZE(infra_ao_idx_map),
};
static const struct of_device_id of_match_clk_mt6795_infracfg[] = {
{ .compatible = "mediatek,mt6795-infracfg" },
{ /* sentinel */ }
};
static int clk_mt6795_infracfg_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
void __iomem *base;
int ret;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
if (!clk_data)
return -ENOMEM;
ret = mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc);
if (ret)
goto free_clk_data;
ret = mtk_clk_register_gates(node, infra_gates, ARRAY_SIZE(infra_gates), clk_data);
if (ret)
goto free_clk_data;
ret = mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
if (ret)
goto unregister_gates;
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (ret)
goto unregister_cpumuxes;
return 0;
unregister_cpumuxes:
mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
unregister_gates:
mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data);
free_clk_data:
mtk_free_clk_data(clk_data);
return ret;
}
static int clk_mt6795_infracfg_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_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data);
mtk_free_clk_data(clk_data);
return 0;
}
static struct platform_driver clk_mt6795_infracfg_drv = {
.driver = {
.name = "clk-mt6795-infracfg",
.of_match_table = of_match_clk_mt6795_infracfg,
},
.probe = clk_mt6795_infracfg_probe,
.remove = clk_mt6795_infracfg_remove,
};
module_platform_driver(clk_mt6795_infracfg_drv);
MODULE_DESCRIPTION("MediaTek MT6795 infracfg clocks driver");
MODULE_LICENSE("GPL");
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-gate.h"
#include "clk-mtk.h"
static const struct mtk_gate_regs mfg_cg_regs = {
.set_ofs = 0x4,
.clr_ofs = 0x8,
.sta_ofs = 0x0,
};
#define GATE_MFG(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
static const struct mtk_gate mfg_clks[] = {
GATE_MFG(CLK_MFG_BAXI, "mfg_baxi", "axi_mfg_in_sel", 0),
GATE_MFG(CLK_MFG_BMEM, "mfg_bmem", "mem_mfg_in_sel", 1),
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 2),
GATE_MFG(CLK_MFG_B26M, "mfg_b26m", "clk26m", 3),
};
static const struct mtk_clk_desc mfg_desc = {
.clks = mfg_clks,
.num_clks = ARRAY_SIZE(mfg_clks),
};
static const struct of_device_id of_match_clk_mt6795_mfg[] = {
{ .compatible = "mediatek,mt6795-mfgcfg", .data = &mfg_desc },
{ /* sentinel */ }
};
static struct platform_driver clk_mt6795_mfg_drv = {
.driver = {
.name = "clk-mt6795-mfg",
.of_match_table = of_match_clk_mt6795_mfg,
},
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
};
module_platform_driver(clk_mt6795_mfg_drv);
MODULE_DESCRIPTION("MediaTek MT6795 mfg clocks driver");
MODULE_LICENSE("GPL");
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-gate.h"
#include "clk-mtk.h"
#define GATE_MM0(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &mm0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
#define GATE_MM1(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &mm1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
static const struct mtk_gate_regs mm0_cg_regs = {
.set_ofs = 0x0104,
.clr_ofs = 0x0108,
.sta_ofs = 0x0100,
};
static const struct mtk_gate_regs mm1_cg_regs = {
.set_ofs = 0x0114,
.clr_ofs = 0x0118,
.sta_ofs = 0x0110,
};
static const struct mtk_gate mm_gates[] = {
/* MM0 */
GATE_MM0(CLK_MM_SMI_COMMON, "mm_smi_common", "mm_sel", 0),
GATE_MM0(CLK_MM_SMI_LARB0, "mm_smi_larb0", "mm_sel", 1),
GATE_MM0(CLK_MM_CAM_MDP, "mm_cam_mdp", "mm_sel", 2),
GATE_MM0(CLK_MM_MDP_RDMA0, "mm_mdp_rdma0", "mm_sel", 3),
GATE_MM0(CLK_MM_MDP_RDMA1, "mm_mdp_rdma1", "mm_sel", 4),
GATE_MM0(CLK_MM_MDP_RSZ0, "mm_mdp_rsz0", "mm_sel", 5),
GATE_MM0(CLK_MM_MDP_RSZ1, "mm_mdp_rsz1", "mm_sel", 6),
GATE_MM0(CLK_MM_MDP_RSZ2, "mm_mdp_rsz2", "mm_sel", 7),
GATE_MM0(CLK_MM_MDP_TDSHP0, "mm_mdp_tdshp0", "mm_sel", 8),
GATE_MM0(CLK_MM_MDP_TDSHP1, "mm_mdp_tdshp1", "mm_sel", 9),
GATE_MM0(CLK_MM_MDP_CROP, "mm_mdp_crop", "mm_sel", 10),
GATE_MM0(CLK_MM_MDP_WDMA, "mm_mdp_wdma", "mm_sel", 11),
GATE_MM0(CLK_MM_MDP_WROT0, "mm_mdp_wrot0", "mm_sel", 12),
GATE_MM0(CLK_MM_MDP_WROT1, "mm_mdp_wrot1", "mm_sel", 13),
GATE_MM0(CLK_MM_FAKE_ENG, "mm_fake_eng", "mm_sel", 14),
GATE_MM0(CLK_MM_MUTEX_32K, "mm_mutex_32k", "clk32k", 15),
GATE_MM0(CLK_MM_DISP_OVL0, "mm_disp_ovl0", "mm_sel", 16),
GATE_MM0(CLK_MM_DISP_OVL1, "mm_disp_ovl1", "mm_sel", 17),
GATE_MM0(CLK_MM_DISP_RDMA0, "mm_disp_rdma0", "mm_sel", 18),
GATE_MM0(CLK_MM_DISP_RDMA1, "mm_disp_rdma1", "mm_sel", 19),
GATE_MM0(CLK_MM_DISP_RDMA2, "mm_disp_rdma2", "mm_sel", 20),
GATE_MM0(CLK_MM_DISP_WDMA0, "mm_disp_wdma0", "mm_sel", 21),
GATE_MM0(CLK_MM_DISP_WDMA1, "mm_disp_wdma1", "mm_sel", 22),
GATE_MM0(CLK_MM_DISP_COLOR0, "mm_disp_color0", "mm_sel", 23),
GATE_MM0(CLK_MM_DISP_COLOR1, "mm_disp_color1", "mm_sel", 24),
GATE_MM0(CLK_MM_DISP_AAL, "mm_disp_aal", "mm_sel", 25),
GATE_MM0(CLK_MM_DISP_GAMMA, "mm_disp_gamma", "mm_sel", 26),
GATE_MM0(CLK_MM_DISP_UFOE, "mm_disp_ufoe", "mm_sel", 27),
GATE_MM0(CLK_MM_DISP_SPLIT0, "mm_disp_split0", "mm_sel", 28),
GATE_MM0(CLK_MM_DISP_SPLIT1, "mm_disp_split1", "mm_sel", 29),
GATE_MM0(CLK_MM_DISP_MERGE, "mm_disp_merge", "mm_sel", 30),
GATE_MM0(CLK_MM_DISP_OD, "mm_disp_od", "mm_sel", 31),
/* MM1 */
GATE_MM1(CLK_MM_DISP_PWM0MM, "mm_disp_pwm0mm", "mm_sel", 0),
GATE_MM1(CLK_MM_DISP_PWM026M, "mm_disp_pwm026m", "pwm_sel", 1),
GATE_MM1(CLK_MM_DISP_PWM1MM, "mm_disp_pwm1mm", "mm_sel", 2),
GATE_MM1(CLK_MM_DISP_PWM126M, "mm_disp_pwm126m", "pwm_sel", 3),
GATE_MM1(CLK_MM_DSI0_ENGINE, "mm_dsi0_engine", "mm_sel", 4),
GATE_MM1(CLK_MM_DSI0_DIGITAL, "mm_dsi0_digital", "dsi0_dig", 5),
GATE_MM1(CLK_MM_DSI1_ENGINE, "mm_dsi1_engine", "mm_sel", 6),
GATE_MM1(CLK_MM_DSI1_DIGITAL, "mm_dsi1_digital", "dsi1_dig", 7),
GATE_MM1(CLK_MM_DPI_PIXEL, "mm_dpi_pixel", "dpi0_sel", 8),
GATE_MM1(CLK_MM_DPI_ENGINE, "mm_dpi_engine", "mm_sel", 9),
};
static int clk_mt6795_mm_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 ret;
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
if (!clk_data)
return -ENOMEM;
ret = mtk_clk_register_gates(node, mm_gates, ARRAY_SIZE(mm_gates), clk_data);
if (ret)
goto free_clk_data;
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (ret)
goto unregister_gates;
platform_set_drvdata(pdev, clk_data);
return 0;
unregister_gates:
mtk_clk_unregister_gates(mm_gates, ARRAY_SIZE(mm_gates), clk_data);
free_clk_data:
mtk_free_clk_data(clk_data);
return ret;
}
static int clk_mt6795_mm_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);
of_clk_del_provider(node);
mtk_clk_unregister_gates(mm_gates, ARRAY_SIZE(mm_gates), clk_data);
mtk_free_clk_data(clk_data);
return 0;
}
static struct platform_driver clk_mt6795_mm_drv = {
.driver = {
.name = "clk-mt6795-mm",
},
.probe = clk_mt6795_mm_probe,
.remove = clk_mt6795_mm_remove,
};
module_platform_driver(clk_mt6795_mm_drv);
MODULE_DESCRIPTION("MediaTek MT6795 MultiMedia clocks driver");
MODULE_LICENSE("GPL");
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <dt-bindings/reset/mediatek,mt6795-resets.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-gate.h"
#include "clk-mtk.h"
#include "reset.h"
#define GATE_PERI(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &peri_cg_regs, \
_shift, &mtk_clk_gate_ops_setclr)
static DEFINE_SPINLOCK(mt6795_peri_clk_lock);
static const struct mtk_gate_regs peri_cg_regs = {
.set_ofs = 0x0008,
.clr_ofs = 0x0010,
.sta_ofs = 0x0018,
};
static const char * const uart_ck_sel_parents[] = {
"clk26m",
"uart_sel",
};
static const struct mtk_composite peri_clks[] = {
MUX(CLK_PERI_UART0_SEL, "uart0_ck_sel", uart_ck_sel_parents, 0x40c, 0, 1),
MUX(CLK_PERI_UART1_SEL, "uart1_ck_sel", uart_ck_sel_parents, 0x40c, 1, 1),
MUX(CLK_PERI_UART2_SEL, "uart2_ck_sel", uart_ck_sel_parents, 0x40c, 2, 1),
MUX(CLK_PERI_UART3_SEL, "uart3_ck_sel", uart_ck_sel_parents, 0x40c, 3, 1),
};
static const struct mtk_gate peri_gates[] = {
GATE_PERI(CLK_PERI_NFI, "peri_nfi", "axi_sel", 0),
GATE_PERI(CLK_PERI_THERM, "peri_therm", "axi_sel", 1),
GATE_PERI(CLK_PERI_PWM1, "peri_pwm1", "axi_sel", 2),
GATE_PERI(CLK_PERI_PWM2, "peri_pwm2", "axi_sel", 3),
GATE_PERI(CLK_PERI_PWM3, "peri_pwm3", "axi_sel", 4),
GATE_PERI(CLK_PERI_PWM4, "peri_pwm4", "axi_sel", 5),
GATE_PERI(CLK_PERI_PWM5, "peri_pwm5", "axi_sel", 6),
GATE_PERI(CLK_PERI_PWM6, "peri_pwm6", "axi_sel", 7),
GATE_PERI(CLK_PERI_PWM7, "peri_pwm7", "axi_sel", 8),
GATE_PERI(CLK_PERI_PWM, "peri_pwm", "axi_sel", 9),
GATE_PERI(CLK_PERI_USB0, "peri_usb0", "usb30_sel", 10),
GATE_PERI(CLK_PERI_USB1, "peri_usb1", "usb20_sel", 11),
GATE_PERI(CLK_PERI_AP_DMA, "peri_ap_dma", "axi_sel", 12),
GATE_PERI(CLK_PERI_MSDC30_0, "peri_msdc30_0", "msdc50_0_sel", 13),
GATE_PERI(CLK_PERI_MSDC30_1, "peri_msdc30_1", "msdc30_1_sel", 14),
GATE_PERI(CLK_PERI_MSDC30_2, "peri_msdc30_2", "msdc30_2_sel", 15),
GATE_PERI(CLK_PERI_MSDC30_3, "peri_msdc30_3", "msdc30_3_sel", 16),
GATE_PERI(CLK_PERI_NLI_ARB, "peri_nli_arb", "axi_sel", 17),
GATE_PERI(CLK_PERI_IRDA, "peri_irda", "irda_sel", 18),
GATE_PERI(CLK_PERI_UART0, "peri_uart0", "axi_sel", 19),
GATE_PERI(CLK_PERI_UART1, "peri_uart1", "axi_sel", 20),
GATE_PERI(CLK_PERI_UART2, "peri_uart2", "axi_sel", 21),
GATE_PERI(CLK_PERI_UART3, "peri_uart3", "axi_sel", 22),
GATE_PERI(CLK_PERI_I2C0, "peri_i2c0", "axi_sel", 23),
GATE_PERI(CLK_PERI_I2C1, "peri_i2c1", "axi_sel", 24),
GATE_PERI(CLK_PERI_I2C2, "peri_i2c2", "axi_sel", 25),
GATE_PERI(CLK_PERI_I2C3, "peri_i2c3", "axi_sel", 26),
GATE_PERI(CLK_PERI_I2C4, "peri_i2c4", "axi_sel", 27),
GATE_PERI(CLK_PERI_AUXADC, "peri_auxadc", "clk26m", 28),
GATE_PERI(CLK_PERI_SPI0, "peri_spi0", "spi_sel", 29),
};
static u16 peri_rst_ofs[] = { 0x0 };
static u16 peri_idx_map[] = {
[MT6795_PERI_NFI_SW_RST] = 14,
[MT6795_PERI_THERM_SW_RST] = 16,
[MT6795_PERI_MSDC1_SW_RST] = 20,
};
static const struct mtk_clk_rst_desc clk_rst_desc = {
.version = MTK_RST_SIMPLE,
.rst_bank_ofs = peri_rst_ofs,
.rst_bank_nr = ARRAY_SIZE(peri_rst_ofs),
.rst_idx_map = peri_idx_map,
.rst_idx_map_nr = ARRAY_SIZE(peri_idx_map),
};
static const struct of_device_id of_match_clk_mt6795_pericfg[] = {
{ .compatible = "mediatek,mt6795-pericfg" },
{ /* sentinel */ }
};
static int clk_mt6795_pericfg_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
void __iomem *base;
int ret;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
if (!clk_data)
return -ENOMEM;
ret = mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc);
if (ret)
goto free_clk_data;
ret = mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates), clk_data);
if (ret)
goto free_clk_data;
ret = mtk_clk_register_composites(peri_clks, ARRAY_SIZE(peri_clks), base,
&mt6795_peri_clk_lock, clk_data);
if (ret)
goto unregister_gates;
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (ret)
goto unregister_composites;
return 0;
unregister_composites:
mtk_clk_unregister_composites(peri_clks, ARRAY_SIZE(peri_clks), clk_data);
unregister_gates:
mtk_clk_unregister_gates(peri_gates, ARRAY_SIZE(peri_gates), clk_data);
free_clk_data:
mtk_free_clk_data(clk_data);
return ret;
}
static int clk_mt6795_pericfg_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_composites(peri_clks, ARRAY_SIZE(peri_clks), clk_data);
mtk_clk_unregister_gates(peri_gates, ARRAY_SIZE(peri_gates), clk_data);
mtk_free_clk_data(clk_data);
return 0;
}
static struct platform_driver clk_mt6795_pericfg_drv = {
.driver = {
.name = "clk-mt6795-pericfg",
.of_match_table = of_match_clk_mt6795_pericfg,
},
.probe = clk_mt6795_pericfg_probe,
.remove = clk_mt6795_pericfg_remove,
};
module_platform_driver(clk_mt6795_pericfg_drv);
MODULE_DESCRIPTION("MediaTek MT6795 pericfg clocks driver");
MODULE_LICENSE("GPL");
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-gate.h"
#include "clk-mtk.h"
#define GATE_VDEC(_id, _name, _parent, _regs) \
GATE_MTK(_id, _name, _parent, _regs, 0, \
&mtk_clk_gate_ops_setclr_inv)
static const struct mtk_gate_regs vdec0_cg_regs = {
.set_ofs = 0x0000,
.clr_ofs = 0x0004,
.sta_ofs = 0x0000,
};
static const struct mtk_gate_regs vdec1_cg_regs = {
.set_ofs = 0x0008,
.clr_ofs = 0x000c,
.sta_ofs = 0x0008,
};
static const struct mtk_gate vdec_clks[] = {
GATE_VDEC(CLK_VDEC_CKEN, "vdec_cken", "vdec_sel", &vdec0_cg_regs),
GATE_VDEC(CLK_VDEC_LARB_CKEN, "vdec_larb_cken", "mm_sel", &vdec1_cg_regs),
};
static const struct mtk_clk_desc vdec_desc = {
.clks = vdec_clks,
.num_clks = ARRAY_SIZE(vdec_clks),
};
static const struct of_device_id of_match_clk_mt6795_vdecsys[] = {
{ .compatible = "mediatek,mt6795-vdecsys", .data = &vdec_desc },
{ /* sentinel */ }
};
static struct platform_driver clk_mt6795_vdecsys_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6795-vdecsys",
.of_match_table = of_match_clk_mt6795_vdecsys,
},
};
module_platform_driver(clk_mt6795_vdecsys_drv);
MODULE_DESCRIPTION("MediaTek MT6795 vdecsys clocks driver");
MODULE_LICENSE("GPL");
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "clk-gate.h"
#include "clk-mtk.h"
static const struct mtk_gate_regs venc_cg_regs = {
.set_ofs = 0x4,
.clr_ofs = 0x8,
.sta_ofs = 0x0,
};
#define GATE_VENC(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
static const struct mtk_gate venc_clks[] = {
GATE_VENC(CLK_VENC_LARB, "venc_larb", "venc_sel", 0),
GATE_VENC(CLK_VENC_VENC, "venc_venc", "venc_sel", 4),
GATE_VENC(CLK_VENC_JPGENC, "venc_jpgenc", "venc_sel", 8),
GATE_VENC(CLK_VENC_JPGDEC, "venc_jpgdec", "venc_sel", 12),
};
static const struct mtk_clk_desc venc_desc = {
.clks = venc_clks,
.num_clks = ARRAY_SIZE(venc_clks),
};
static const struct of_device_id of_match_clk_mt6795_vencsys[] = {
{ .compatible = "mediatek,mt6795-vencsys", .data = &venc_desc },
{ /* sentinel */ }
};
static struct platform_driver clk_mt6795_vencsys_drv = {
.driver = {
.name = "clk-mt6795-vencsys",
.of_match_table = of_match_clk_mt6795_vencsys,
},
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
};
module_platform_driver(clk_mt6795_vencsys_drv);
MODULE_DESCRIPTION("MediaTek MT6795 vdecsys clocks driver");
MODULE_LICENSE("GPL");
......@@ -32,33 +32,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_LARB6, "img_larb6", "mm_sel", 0),
};
static const struct of_device_id of_match_clk_mt6797_img[] = {
{ .compatible = "mediatek,mt6797-imgsys", },
{}
static const struct mtk_clk_desc img_desc = {
.clks = img_clks,
.num_clks = ARRAY_SIZE(img_clks),
};
static int clk_mt6797_img_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IMG_NR);
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static const struct of_device_id of_match_clk_mt6797_img[] = {
{
.compatible = "mediatek,mt6797-imgsys",
.data = &img_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6797_img_drv = {
.probe = clk_mt6797_img_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6797-img",
.of_match_table = of_match_clk_mt6797_img,
......
......@@ -49,33 +49,23 @@ static const struct mtk_gate vdec_clks[] = {
GATE_VDEC1(CLK_VDEC_LARB1_CKEN, "vdec_larb1_cken", "mm_sel", 0),
};
static const struct of_device_id of_match_clk_mt6797_vdec[] = {
{ .compatible = "mediatek,mt6797-vdecsys", },
{}
static const struct mtk_clk_desc vdec_desc = {
.clks = vdec_clks,
.num_clks = ARRAY_SIZE(vdec_clks),
};
static int clk_mt6797_vdec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR);
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static const struct of_device_id of_match_clk_mt6797_vdec[] = {
{
.compatible = "mediatek,mt6797-vdecsys",
.data = &vdec_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6797_vdec_drv = {
.probe = clk_mt6797_vdec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6797-vdec",
.of_match_table = of_match_clk_mt6797_vdec,
......
......@@ -34,33 +34,23 @@ static const struct mtk_gate venc_clks[] = {
GATE_VENC(CLK_VENC_3, "venc_3", "venc_sel", 12),
};
static const struct of_device_id of_match_clk_mt6797_venc[] = {
{ .compatible = "mediatek,mt6797-vencsys", },
{}
static const struct mtk_clk_desc venc_desc = {
.clks = venc_clks,
.num_clks = ARRAY_SIZE(venc_clks),
};
static int clk_mt6797_venc_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
int r;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VENC_NR);
mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
clk_data);
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
dev_err(&pdev->dev,
"could not register clock provider: %s: %d\n",
pdev->name, r);
return r;
}
static const struct of_device_id of_match_clk_mt6797_venc[] = {
{
.compatible = "mediatek,mt6797-vencsys",
.data = &venc_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt6797_venc_drv = {
.probe = clk_mt6797_venc_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt6797-venc",
.of_match_table = of_match_clk_mt6797_venc,
......
......@@ -34,26 +34,23 @@ static const struct mtk_gate cam_clks[] = {
GATE_CAM(CLK_CAM_CCU, "cam_ccu", "cam_sel", 12),
};
static int clk_mt8183_cam_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_CAM_NR_CLK);
mtk_clk_register_gates(node, cam_clks, ARRAY_SIZE(cam_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc cam_desc = {
.clks = cam_clks,
.num_clks = ARRAY_SIZE(cam_clks),
};
static const struct of_device_id of_match_clk_mt8183_cam[] = {
{ .compatible = "mediatek,mt8183-camsys", },
{}
{
.compatible = "mediatek,mt8183-camsys",
.data = &cam_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_cam_drv = {
.probe = clk_mt8183_cam_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-cam",
.of_match_table = of_match_clk_mt8183_cam,
......
......@@ -34,26 +34,23 @@ static const struct mtk_gate img_clks[] = {
GATE_IMG(CLK_IMG_OWE, "img_owe", "img_sel", 9),
};
static int clk_mt8183_img_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc img_desc = {
.clks = img_clks,
.num_clks = ARRAY_SIZE(img_clks),
};
static const struct of_device_id of_match_clk_mt8183_img[] = {
{ .compatible = "mediatek,mt8183-imgsys", },
{}
{
.compatible = "mediatek,mt8183-imgsys",
.data = &img_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_img_drv = {
.probe = clk_mt8183_img_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-img",
.of_match_table = of_match_clk_mt8183_img,
......
......@@ -27,26 +27,23 @@ static const struct mtk_gate ipu_core0_clks[] = {
GATE_IPU_CORE0(CLK_IPU_CORE0_IPU, "ipu_core0_ipu", "dsp_sel", 2),
};
static int clk_mt8183_ipu_core0_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IPU_CORE0_NR_CLK);
mtk_clk_register_gates(node, ipu_core0_clks, ARRAY_SIZE(ipu_core0_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc ipu_core0_desc = {
.clks = ipu_core0_clks,
.num_clks = ARRAY_SIZE(ipu_core0_clks),
};
static const struct of_device_id of_match_clk_mt8183_ipu_core0[] = {
{ .compatible = "mediatek,mt8183-ipu_core0", },
{}
{
.compatible = "mediatek,mt8183-ipu_core0",
.data = &ipu_core0_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_ipu_core0_drv = {
.probe = clk_mt8183_ipu_core0_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-ipu_core0",
.of_match_table = of_match_clk_mt8183_ipu_core0,
......
......@@ -27,26 +27,23 @@ static const struct mtk_gate ipu_core1_clks[] = {
GATE_IPU_CORE1(CLK_IPU_CORE1_IPU, "ipu_core1_ipu", "dsp_sel", 2),
};
static int clk_mt8183_ipu_core1_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IPU_CORE1_NR_CLK);
mtk_clk_register_gates(node, ipu_core1_clks, ARRAY_SIZE(ipu_core1_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc ipu_core1_desc = {
.clks = ipu_core1_clks,
.num_clks = ARRAY_SIZE(ipu_core1_clks),
};
static const struct of_device_id of_match_clk_mt8183_ipu_core1[] = {
{ .compatible = "mediatek,mt8183-ipu_core1", },
{}
{
.compatible = "mediatek,mt8183-ipu_core1",
.data = &ipu_core1_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_ipu_core1_drv = {
.probe = clk_mt8183_ipu_core1_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-ipu_core1",
.of_match_table = of_match_clk_mt8183_ipu_core1,
......
......@@ -25,26 +25,23 @@ static const struct mtk_gate ipu_adl_clks[] = {
GATE_IPU_ADL_I(CLK_IPU_ADL_CABGEN, "ipu_adl_cabgen", "dsp_sel", 24),
};
static int clk_mt8183_ipu_adl_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IPU_ADL_NR_CLK);
mtk_clk_register_gates(node, ipu_adl_clks, ARRAY_SIZE(ipu_adl_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc ipu_adl_desc = {
.clks = ipu_adl_clks,
.num_clks = ARRAY_SIZE(ipu_adl_clks),
};
static const struct of_device_id of_match_clk_mt8183_ipu_adl[] = {
{ .compatible = "mediatek,mt8183-ipu_adl", },
{}
{
.compatible = "mediatek,mt8183-ipu_adl",
.data = &ipu_adl_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_ipu_adl_drv = {
.probe = clk_mt8183_ipu_adl_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-ipu_adl",
.of_match_table = of_match_clk_mt8183_ipu_adl,
......
......@@ -94,26 +94,23 @@ static const struct mtk_gate ipu_conn_clks[] = {
"ipu_conn_cab3to1_slice", "dsp1_sel", 17),
};
static int clk_mt8183_ipu_conn_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_IPU_CONN_NR_CLK);
mtk_clk_register_gates(node, ipu_conn_clks, ARRAY_SIZE(ipu_conn_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc ipu_conn_desc = {
.clks = ipu_conn_clks,
.num_clks = ARRAY_SIZE(ipu_conn_clks),
};
static const struct of_device_id of_match_clk_mt8183_ipu_conn[] = {
{ .compatible = "mediatek,mt8183-ipu_conn", },
{}
{
.compatible = "mediatek,mt8183-ipu_conn",
.data = &ipu_conn_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_ipu_conn_drv = {
.probe = clk_mt8183_ipu_conn_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-ipu_conn",
.of_match_table = of_match_clk_mt8183_ipu_conn,
......
......@@ -19,35 +19,30 @@ static const struct mtk_gate_regs mfg_cg_regs = {
};
#define GATE_MFG(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, \
&mtk_clk_gate_ops_setclr)
GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \
&mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT)
static const struct mtk_gate mfg_clks[] = {
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0)
};
static int clk_mt8183_mfg_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
pm_runtime_enable(&pdev->dev);
clk_data = mtk_alloc_clk_data(CLK_MFG_NR_CLK);
mtk_clk_register_gates_with_dev(node, mfg_clks, ARRAY_SIZE(mfg_clks),
clk_data, &pdev->dev);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc mfg_desc = {
.clks = mfg_clks,
.num_clks = ARRAY_SIZE(mfg_clks),
};
static const struct of_device_id of_match_clk_mt8183_mfg[] = {
{ .compatible = "mediatek,mt8183-mfgcfg", },
{}
{
.compatible = "mediatek,mt8183-mfgcfg",
.data = &mfg_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_mfg_drv = {
.probe = clk_mt8183_mfg_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-mfg",
.of_match_table = of_match_clk_mt8183_mfg,
......
......@@ -38,26 +38,23 @@ static const struct mtk_gate vdec_clks[] = {
GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1", "mm_sel", 0),
};
static int clk_mt8183_vdec_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc vdec_desc = {
.clks = vdec_clks,
.num_clks = ARRAY_SIZE(vdec_clks),
};
static const struct of_device_id of_match_clk_mt8183_vdec[] = {
{ .compatible = "mediatek,mt8183-vdecsys", },
{}
{
.compatible = "mediatek,mt8183-vdecsys",
.data = &vdec_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_vdec_drv = {
.probe = clk_mt8183_vdec_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-vdec",
.of_match_table = of_match_clk_mt8183_vdec,
......
......@@ -30,26 +30,23 @@ static const struct mtk_gate venc_clks[] = {
"mm_sel", 8),
};
static int clk_mt8183_venc_probe(struct platform_device *pdev)
{
struct clk_hw_onecell_data *clk_data;
struct device_node *node = pdev->dev.of_node;
clk_data = mtk_alloc_clk_data(CLK_VENC_NR_CLK);
mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
clk_data);
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
}
static const struct mtk_clk_desc venc_desc = {
.clks = venc_clks,
.num_clks = ARRAY_SIZE(venc_clks),
};
static const struct of_device_id of_match_clk_mt8183_venc[] = {
{ .compatible = "mediatek,mt8183-vencsys", },
{}
{
.compatible = "mediatek,mt8183-vencsys",
.data = &venc_desc,
}, {
/* sentinel */
}
};
static struct platform_driver clk_mt8183_venc_drv = {
.probe = clk_mt8183_venc_probe,
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8183-venc",
.of_match_table = of_match_clk_mt8183_venc,
......
......@@ -1198,10 +1198,33 @@ static void clk_mt8183_top_init_early(struct device_node *node)
CLK_OF_DECLARE_DRIVER(mt8183_topckgen, "mediatek,mt8183-topckgen",
clk_mt8183_top_init_early);
/* Register mux notifier for MFG mux */
static int clk_mt8183_reg_mfg_mux_notifier(struct device *dev, struct clk *clk)
{
struct mtk_mux_nb *mfg_mux_nb;
int i;
mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL);
if (!mfg_mux_nb)
return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(top_muxes); i++)
if (top_muxes[i].id == CLK_TOP_MUX_MFG)
break;
if (i == ARRAY_SIZE(top_muxes))
return -EINVAL;
mfg_mux_nb->ops = top_muxes[i].ops;
mfg_mux_nb->bypass_index = 0; /* Bypass to 26M crystal */
return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb);
}
static int clk_mt8183_top_probe(struct platform_device *pdev)
{
void __iomem *base;
struct device_node *node = pdev->dev.of_node;
int ret;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
......@@ -1227,6 +1250,11 @@ static int clk_mt8183_top_probe(struct platform_device *pdev)
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
top_clk_data);
ret = clk_mt8183_reg_mfg_mux_notifier(&pdev->dev,
top_clk_data->hws[CLK_TOP_MUX_MFG]->clk);
if (ret)
return ret;
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
top_clk_data);
}
......
......@@ -98,6 +98,7 @@ static const struct of_device_id of_match_clk_mt8192_cam[] = {
static struct platform_driver clk_mt8192_cam_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-cam",
.of_match_table = of_match_clk_mt8192_cam,
......
......@@ -61,6 +61,7 @@ static const struct of_device_id of_match_clk_mt8192_img[] = {
static struct platform_driver clk_mt8192_img_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-img",
.of_match_table = of_match_clk_mt8192_img,
......
......@@ -110,6 +110,7 @@ static const struct of_device_id of_match_clk_mt8192_imp_iic_wrap[] = {
static struct platform_driver clk_mt8192_imp_iic_wrap_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-imp_iic_wrap",
.of_match_table = of_match_clk_mt8192_imp_iic_wrap,
......
......@@ -48,6 +48,7 @@ static const struct of_device_id of_match_clk_mt8192_ipe[] = {
static struct platform_driver clk_mt8192_ipe_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-ipe",
.of_match_table = of_match_clk_mt8192_ipe,
......
......@@ -73,6 +73,7 @@ static const struct of_device_id of_match_clk_mt8192_mdp[] = {
static struct platform_driver clk_mt8192_mdp_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-mdp",
.of_match_table = of_match_clk_mt8192_mdp,
......
......@@ -19,7 +19,9 @@ static const struct mtk_gate_regs mfg_cg_regs = {
};
#define GATE_MFG(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, \
_shift, &mtk_clk_gate_ops_setclr, \
CLK_SET_RATE_PARENT)
static const struct mtk_gate mfg_clks[] = {
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_pll_sel", 0),
......@@ -41,6 +43,7 @@ static const struct of_device_id of_match_clk_mt8192_mfg[] = {
static struct platform_driver clk_mt8192_mfg_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-mfg",
.of_match_table = of_match_clk_mt8192_mfg,
......
......@@ -55,6 +55,7 @@ static const struct of_device_id of_match_clk_mt8192_msdc[] = {
static struct platform_driver clk_mt8192_msdc_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-msdc",
.of_match_table = of_match_clk_mt8192_msdc,
......
......@@ -41,6 +41,7 @@ static const struct of_device_id of_match_clk_mt8192_scp_adsp[] = {
static struct platform_driver clk_mt8192_scp_adsp_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-scp_adsp",
.of_match_table = of_match_clk_mt8192_scp_adsp,
......
......@@ -85,6 +85,7 @@ static const struct of_device_id of_match_clk_mt8192_vdec[] = {
static struct platform_driver clk_mt8192_vdec_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-vdec",
.of_match_table = of_match_clk_mt8192_vdec,
......
......@@ -44,6 +44,7 @@ static const struct of_device_id of_match_clk_mt8192_venc[] = {
static struct platform_driver clk_mt8192_venc_drv = {
.probe = mtk_clk_simple_probe,
.remove = mtk_clk_simple_remove,
.driver = {
.name = "clk-mt8192-venc",
.of_match_table = of_match_clk_mt8192_venc,
......
This diff is collapsed.
......@@ -17,10 +17,12 @@ static const struct mtk_gate_regs mfg_cg_regs = {
};
#define GATE_MFG(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, \
_shift, &mtk_clk_gate_ops_setclr, \
CLK_SET_RATE_PARENT)
static const struct mtk_gate mfg_clks[] = {
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "top_mfg_core_tmp", 0),
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_ck_fast_ref", 0),
};
static const struct mtk_clk_desc mfg_desc = {
......
......@@ -298,11 +298,14 @@ static const char * const ipu_if_parents[] = {
"mmpll_d4"
};
/*
* MFG can be also parented to "univpll_d6" and "univpll_d7":
* these have been removed from the parents list to let us
* achieve GPU DVFS without any special clock handlers.
*/
static const char * const mfg_parents[] = {
"clk26m",
"mainpll_d5_d2",
"univpll_d6",
"univpll_d7"
"mainpll_d5_d2"
};
static const char * const camtg_parents[] = {
......@@ -1149,11 +1152,6 @@ static const struct mtk_mux top_mtk_muxes[] = {
*/
};
static struct mtk_composite top_muxes[] = {
/* CLK_MISC_CFG_3 */
MUX(CLK_TOP_MFG_CK_FAST_REF, "mfg_ck_fast_ref", mfg_fast_parents, 0x0250, 8, 1),
};
static const struct mtk_composite top_adj_divs[] = {
DIV_GATE(CLK_TOP_APLL12_DIV0, "apll12_div0", "top_i2si1_mck", 0x0320, 0, 0x0328, 8, 0),
DIV_GATE(CLK_TOP_APLL12_DIV1, "apll12_div1", "top_i2si2_mck", 0x0320, 1, 0x0328, 8, 8),
......@@ -1222,10 +1220,26 @@ static const struct of_device_id of_match_clk_mt8195_topck[] = {
{}
};
/* Register mux notifier for MFG mux */
static int clk_mt8195_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_mt8195_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;
......@@ -1253,15 +1267,22 @@ static int clk_mt8195_topck_probe(struct platform_device *pdev)
if (r)
goto unregister_factors;
r = mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
&mt8195_clk_lock, top_clk_data);
hw = devm_clk_hw_register_mux(&pdev->dev, "mfg_ck_fast_ref", mfg_fast_parents,
ARRAY_SIZE(mfg_fast_parents), CLK_SET_RATE_PARENT,
(base + 0x250), 8, 1, 0, &mt8195_clk_lock);
if (IS_ERR(hw))
goto unregister_muxes;
top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF] = hw;
r = clk_mt8195_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(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
&mt8195_clk_lock, top_clk_data);
if (r)
goto unregister_composite_muxes;
goto unregister_muxes;
r = mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), top_clk_data);
if (r)
......@@ -1279,8 +1300,6 @@ static int clk_mt8195_topck_probe(struct platform_device *pdev)
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_composite_muxes:
mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), top_clk_data);
unregister_muxes:
mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), top_clk_data);
unregister_factors:
......@@ -1300,7 +1319,6 @@ static int clk_mt8195_topck_remove(struct platform_device *pdev)
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_composites(top_muxes, ARRAY_SIZE(top_muxes), 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);
......
......@@ -34,6 +34,12 @@ static const struct mtk_gate_regs vdo1_3_cg_regs = {
.sta_ofs = 0x140,
};
static const struct mtk_gate_regs vdo1_4_cg_regs = {
.set_ofs = 0x400,
.clr_ofs = 0x400,
.sta_ofs = 0x400,
};
#define GATE_VDO1_0(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &vdo1_0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
......@@ -50,6 +56,9 @@ static const struct mtk_gate_regs vdo1_3_cg_regs = {
#define GATE_VDO1_3(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &vdo1_3_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
#define GATE_VDO1_4(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &vdo1_4_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
static const struct mtk_gate vdo1_clks[] = {
/* VDO1_0 */
GATE_VDO1_0(CLK_VDO1_SMI_LARB2, "vdo1_smi_larb2", "top_vpp", 0),
......@@ -107,6 +116,8 @@ static const struct mtk_gate vdo1_clks[] = {
GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPINTF, "vdo1_disp_monitor_dpintf", "top_vpp", 17),
/* VDO1_3 */
GATE_VDO1_3(CLK_VDO1_26M_SLOW, "vdo1_26m_slow", "clk26m", 8),
/* VDO1_4 */
GATE_VDO1_4(CLK_VDO1_DPI1_HDMI, "vdo1_dpi1_hdmi", "hdmi_txpll", 0),
};
static int clk_mt8195_vdo1_probe(struct platform_device *pdev)
......
......@@ -80,7 +80,7 @@ int mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, int num,
if (IS_ERR_OR_NULL(clk_data->hws[rc->id]))
continue;
clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk);
clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]);
clk_data->hws[rc->id] = ERR_PTR(-ENOENT);
}
......@@ -102,7 +102,7 @@ void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int num,
if (IS_ERR_OR_NULL(clk_data->hws[rc->id]))
continue;
clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk);
clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]);
clk_data->hws[rc->id] = ERR_PTR(-ENOENT);
}
}
......@@ -146,7 +146,7 @@ int mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num,
if (IS_ERR_OR_NULL(clk_data->hws[ff->id]))
continue;
clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk);
clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]);
clk_data->hws[ff->id] = ERR_PTR(-ENOENT);
}
......@@ -168,7 +168,7 @@ void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num,
if (IS_ERR_OR_NULL(clk_data->hws[ff->id]))
continue;
clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk);
clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]);
clk_data->hws[ff->id] = ERR_PTR(-ENOENT);
}
}
......@@ -393,7 +393,7 @@ int mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, int num,
if (IS_ERR_OR_NULL(clk_data->hws[mcd->id]))
continue;
mtk_clk_unregister_composite(clk_data->hws[mcd->id]);
clk_hw_unregister_divider(clk_data->hws[mcd->id]);
clk_data->hws[mcd->id] = ERR_PTR(-ENOENT);
}
......@@ -414,7 +414,7 @@ void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num,
if (IS_ERR_OR_NULL(clk_data->hws[mcd->id]))
continue;
clk_unregister_divider(clk_data->hws[mcd->id]->clk);
clk_hw_unregister_divider(clk_data->hws[mcd->id]);
clk_data->hws[mcd->id] = ERR_PTR(-ENOENT);
}
}
......@@ -434,7 +434,8 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
if (!clk_data)
return -ENOMEM;
r = mtk_clk_register_gates(node, mcd->clks, mcd->num_clks, clk_data);
r = mtk_clk_register_gates_with_dev(node, mcd->clks, mcd->num_clks,
clk_data, &pdev->dev);
if (r)
goto free_data;
......@@ -459,6 +460,7 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
mtk_free_clk_data(clk_data);
return r;
}
EXPORT_SYMBOL_GPL(mtk_clk_simple_probe);
int mtk_clk_simple_remove(struct platform_device *pdev)
{
......@@ -472,5 +474,6 @@ int mtk_clk_simple_remove(struct platform_device *pdev)
return 0;
}
EXPORT_SYMBOL_GPL(mtk_clk_simple_remove);
MODULE_LICENSE("GPL");
......@@ -188,6 +188,7 @@ void mtk_free_clk_data(struct clk_hw_onecell_data *clk_data);
struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
const char *parent_name, void __iomem *reg);
void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw);
struct mtk_clk_desc {
const struct mtk_gate *clks;
......
......@@ -4,6 +4,7 @@
* Author: Owen Chen <owen.chen@mediatek.com>
*/
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/compiler_types.h>
#include <linux/container_of.h>
......@@ -259,4 +260,41 @@ void mtk_clk_unregister_muxes(const struct mtk_mux *muxes, int num,
}
EXPORT_SYMBOL_GPL(mtk_clk_unregister_muxes);
/*
* This clock notifier is called when the frequency of the parent
* PLL clock is to be changed. The idea is to switch the parent to a
* stable clock, such as the main oscillator, while the PLL frequency
* stabilizes.
*/
static int mtk_clk_mux_notifier_cb(struct notifier_block *nb,
unsigned long event, void *_data)
{
struct clk_notifier_data *data = _data;
struct clk_hw *hw = __clk_get_hw(data->clk);
struct mtk_mux_nb *mux_nb = to_mtk_mux_nb(nb);
int ret = 0;
switch (event) {
case PRE_RATE_CHANGE:
mux_nb->original_index = mux_nb->ops->get_parent(hw);
ret = mux_nb->ops->set_parent(hw, mux_nb->bypass_index);
break;
case POST_RATE_CHANGE:
case ABORT_RATE_CHANGE:
ret = mux_nb->ops->set_parent(hw, mux_nb->original_index);
break;
}
return notifier_from_errno(ret);
}
int devm_mtk_clk_mux_notifier_register(struct device *dev, struct clk *clk,
struct mtk_mux_nb *mux_nb)
{
mux_nb->nb.notifier_call = mtk_clk_mux_notifier_cb;
return devm_clk_notifier_register(dev, clk, &mux_nb->nb);
}
EXPORT_SYMBOL_GPL(devm_mtk_clk_mux_notifier_register);
MODULE_LICENSE("GPL");
......@@ -7,12 +7,14 @@
#ifndef __DRV_CLK_MTK_MUX_H
#define __DRV_CLK_MTK_MUX_H
#include <linux/notifier.h>
#include <linux/spinlock.h>
#include <linux/types.h>
struct clk;
struct clk_hw_onecell_data;
struct clk_ops;
struct device;
struct device_node;
struct mtk_mux {
......@@ -89,4 +91,17 @@ int mtk_clk_register_muxes(const struct mtk_mux *muxes,
void mtk_clk_unregister_muxes(const struct mtk_mux *muxes, int num,
struct clk_hw_onecell_data *clk_data);
struct mtk_mux_nb {
struct notifier_block nb;
const struct clk_ops *ops;
u8 bypass_index; /* Which parent to temporarily use */
u8 original_index; /* Set by notifier callback */
};
#define to_mtk_mux_nb(_nb) container_of(_nb, struct mtk_mux_nb, nb)
int devm_mtk_clk_mux_notifier_register(struct device *dev, struct clk *clk,
struct mtk_mux_nb *mux_nb);
#endif /* __DRV_CLK_MTK_MUX_H */
......@@ -228,5 +228,6 @@ int mtk_register_reset_controller_with_dev(struct device *dev,
return 0;
}
EXPORT_SYMBOL_GPL(mtk_register_reset_controller_with_dev);
MODULE_LICENSE("GPL");
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause) */
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#ifndef _DT_BINDINGS_CLK_MT6795_H
#define _DT_BINDINGS_CLK_MT6795_H
/* TOPCKGEN */
#define CLK_TOP_ADSYS_26M 0
#define CLK_TOP_CLKPH_MCK_O 1
#define CLK_TOP_USB_SYSPLL_125M 2
#define CLK_TOP_DSI0_DIG 3
#define CLK_TOP_DSI1_DIG 4
#define CLK_TOP_ARMCA53PLL_754M 5
#define CLK_TOP_ARMCA53PLL_502M 6
#define CLK_TOP_MAIN_H546M 7
#define CLK_TOP_MAIN_H364M 8
#define CLK_TOP_MAIN_H218P4M 9
#define CLK_TOP_MAIN_H156M 10
#define CLK_TOP_TVDPLL_445P5M 11
#define CLK_TOP_TVDPLL_594M 12
#define CLK_TOP_UNIV_624M 13
#define CLK_TOP_UNIV_416M 14
#define CLK_TOP_UNIV_249P6M 15
#define CLK_TOP_UNIV_178P3M 16
#define CLK_TOP_UNIV_48M 17
#define CLK_TOP_CLKRTC_EXT 18
#define CLK_TOP_CLKRTC_INT 19
#define CLK_TOP_FPC 20
#define CLK_TOP_HDMITXPLL_D2 21
#define CLK_TOP_HDMITXPLL_D3 22
#define CLK_TOP_ARMCA53PLL_D2 23
#define CLK_TOP_ARMCA53PLL_D3 24
#define CLK_TOP_APLL1 25
#define CLK_TOP_APLL2 26
#define CLK_TOP_DMPLL 27
#define CLK_TOP_DMPLL_D2 28
#define CLK_TOP_DMPLL_D4 29
#define CLK_TOP_DMPLL_D8 30
#define CLK_TOP_DMPLL_D16 31
#define CLK_TOP_MMPLL 32
#define CLK_TOP_MMPLL_D2 33
#define CLK_TOP_MSDCPLL 34
#define CLK_TOP_MSDCPLL_D2 35
#define CLK_TOP_MSDCPLL_D4 36
#define CLK_TOP_MSDCPLL2 37
#define CLK_TOP_MSDCPLL2_D2 38
#define CLK_TOP_MSDCPLL2_D4 39
#define CLK_TOP_SYSPLL_D2 40
#define CLK_TOP_SYSPLL1_D2 41
#define CLK_TOP_SYSPLL1_D4 42
#define CLK_TOP_SYSPLL1_D8 43
#define CLK_TOP_SYSPLL1_D16 44
#define CLK_TOP_SYSPLL_D3 45
#define CLK_TOP_SYSPLL2_D2 46
#define CLK_TOP_SYSPLL2_D4 47
#define CLK_TOP_SYSPLL_D5 48
#define CLK_TOP_SYSPLL3_D2 49
#define CLK_TOP_SYSPLL3_D4 50
#define CLK_TOP_SYSPLL_D7 51
#define CLK_TOP_SYSPLL4_D2 52
#define CLK_TOP_SYSPLL4_D4 53
#define CLK_TOP_TVDPLL 54
#define CLK_TOP_TVDPLL_D2 55
#define CLK_TOP_TVDPLL_D4 56
#define CLK_TOP_TVDPLL_D8 57
#define CLK_TOP_TVDPLL_D16 58
#define CLK_TOP_UNIVPLL_D2 59
#define CLK_TOP_UNIVPLL1_D2 60
#define CLK_TOP_UNIVPLL1_D4 61
#define CLK_TOP_UNIVPLL1_D8 62
#define CLK_TOP_UNIVPLL_D3 63
#define CLK_TOP_UNIVPLL2_D2 64
#define CLK_TOP_UNIVPLL2_D4 65
#define CLK_TOP_UNIVPLL2_D8 66
#define CLK_TOP_UNIVPLL_D5 67
#define CLK_TOP_UNIVPLL3_D2 68
#define CLK_TOP_UNIVPLL3_D4 69
#define CLK_TOP_UNIVPLL3_D8 70
#define CLK_TOP_UNIVPLL_D7 71
#define CLK_TOP_UNIVPLL_D26 72
#define CLK_TOP_UNIVPLL_D52 73
#define CLK_TOP_VCODECPLL 74
#define CLK_TOP_VCODECPLL_370P5 75
#define CLK_TOP_VENCPLL 76
#define CLK_TOP_VENCPLL_D2 77
#define CLK_TOP_VENCPLL_D4 78
#define CLK_TOP_AXI_SEL 79
#define CLK_TOP_MEM_SEL 80
#define CLK_TOP_DDRPHYCFG_SEL 81
#define CLK_TOP_MM_SEL 82
#define CLK_TOP_PWM_SEL 83
#define CLK_TOP_VDEC_SEL 84
#define CLK_TOP_VENC_SEL 85
#define CLK_TOP_MFG_SEL 86
#define CLK_TOP_CAMTG_SEL 87
#define CLK_TOP_UART_SEL 88
#define CLK_TOP_SPI_SEL 89
#define CLK_TOP_USB20_SEL 90
#define CLK_TOP_USB30_SEL 91
#define CLK_TOP_MSDC50_0_H_SEL 92
#define CLK_TOP_MSDC50_0_SEL 93
#define CLK_TOP_MSDC30_1_SEL 94
#define CLK_TOP_MSDC30_2_SEL 95
#define CLK_TOP_MSDC30_3_SEL 96
#define CLK_TOP_AUDIO_SEL 97
#define CLK_TOP_AUD_INTBUS_SEL 98
#define CLK_TOP_PMICSPI_SEL 99
#define CLK_TOP_SCP_SEL 100
#define CLK_TOP_MJC_SEL 101
#define CLK_TOP_DPI0_SEL 102
#define CLK_TOP_IRDA_SEL 103
#define CLK_TOP_CCI400_SEL 104
#define CLK_TOP_AUD_1_SEL 105
#define CLK_TOP_AUD_2_SEL 106
#define CLK_TOP_MEM_MFG_IN_SEL 107
#define CLK_TOP_AXI_MFG_IN_SEL 108
#define CLK_TOP_SCAM_SEL 109
#define CLK_TOP_I2S0_M_SEL 110
#define CLK_TOP_I2S1_M_SEL 111
#define CLK_TOP_I2S2_M_SEL 112
#define CLK_TOP_I2S3_M_SEL 113
#define CLK_TOP_I2S3_B_SEL 114
#define CLK_TOP_APLL1_DIV0 115
#define CLK_TOP_APLL1_DIV1 116
#define CLK_TOP_APLL1_DIV2 117
#define CLK_TOP_APLL1_DIV3 118
#define CLK_TOP_APLL1_DIV4 119
#define CLK_TOP_APLL1_DIV5 120
#define CLK_TOP_APLL2_DIV0 121
#define CLK_TOP_APLL2_DIV1 122
#define CLK_TOP_APLL2_DIV2 123
#define CLK_TOP_APLL2_DIV3 124
#define CLK_TOP_APLL2_DIV4 125
#define CLK_TOP_APLL2_DIV5 126
#define CLK_TOP_NR_CLK 127
/* APMIXED_SYS */
#define CLK_APMIXED_ARMCA53PLL 0
#define CLK_APMIXED_MAINPLL 1
#define CLK_APMIXED_UNIVPLL 2
#define CLK_APMIXED_MMPLL 3
#define CLK_APMIXED_MSDCPLL 4
#define CLK_APMIXED_VENCPLL 5
#define CLK_APMIXED_TVDPLL 6
#define CLK_APMIXED_MPLL 7
#define CLK_APMIXED_VCODECPLL 8
#define CLK_APMIXED_APLL1 9
#define CLK_APMIXED_APLL2 10
#define CLK_APMIXED_REF2USB_TX 11
#define CLK_APMIXED_NR_CLK 12
/* INFRA_SYS */
#define CLK_INFRA_DBGCLK 0
#define CLK_INFRA_SMI 1
#define CLK_INFRA_AUDIO 2
#define CLK_INFRA_GCE 3
#define CLK_INFRA_L2C_SRAM 4
#define CLK_INFRA_M4U 5
#define CLK_INFRA_MD1MCU 6
#define CLK_INFRA_MD1BUS 7
#define CLK_INFRA_MD1DBB 8
#define CLK_INFRA_DEVICE_APC 9
#define CLK_INFRA_TRNG 10
#define CLK_INFRA_MD1LTE 11
#define CLK_INFRA_CPUM 12
#define CLK_INFRA_KP 13
#define CLK_INFRA_CA53_C0_SEL 14
#define CLK_INFRA_CA53_C1_SEL 15
#define CLK_INFRA_NR_CLK 16
/* PERI_SYS */
#define CLK_PERI_NFI 0
#define CLK_PERI_THERM 1
#define CLK_PERI_PWM1 2
#define CLK_PERI_PWM2 3
#define CLK_PERI_PWM3 4
#define CLK_PERI_PWM4 5
#define CLK_PERI_PWM5 6
#define CLK_PERI_PWM6 7
#define CLK_PERI_PWM7 8
#define CLK_PERI_PWM 9
#define CLK_PERI_USB0 10
#define CLK_PERI_USB1 11
#define CLK_PERI_AP_DMA 12
#define CLK_PERI_MSDC30_0 13
#define CLK_PERI_MSDC30_1 14
#define CLK_PERI_MSDC30_2 15
#define CLK_PERI_MSDC30_3 16
#define CLK_PERI_NLI_ARB 17
#define CLK_PERI_IRDA 18
#define CLK_PERI_UART0 19
#define CLK_PERI_UART1 20
#define CLK_PERI_UART2 21
#define CLK_PERI_UART3 22
#define CLK_PERI_I2C0 23
#define CLK_PERI_I2C1 24
#define CLK_PERI_I2C2 25
#define CLK_PERI_I2C3 26
#define CLK_PERI_I2C4 27
#define CLK_PERI_AUXADC 28
#define CLK_PERI_SPI0 29
#define CLK_PERI_UART0_SEL 30
#define CLK_PERI_UART1_SEL 31
#define CLK_PERI_UART2_SEL 32
#define CLK_PERI_UART3_SEL 33
#define CLK_PERI_NR_CLK 34
/* MFG */
#define CLK_MFG_BAXI 0
#define CLK_MFG_BMEM 1
#define CLK_MFG_BG3D 2
#define CLK_MFG_B26M 3
#define CLK_MFG_NR_CLK 4
/* MM_SYS */
#define CLK_MM_SMI_COMMON 0
#define CLK_MM_SMI_LARB0 1
#define CLK_MM_CAM_MDP 2
#define CLK_MM_MDP_RDMA0 3
#define CLK_MM_MDP_RDMA1 4
#define CLK_MM_MDP_RSZ0 5
#define CLK_MM_MDP_RSZ1 6
#define CLK_MM_MDP_RSZ2 7
#define CLK_MM_MDP_TDSHP0 8
#define CLK_MM_MDP_TDSHP1 9
#define CLK_MM_MDP_CROP 10
#define CLK_MM_MDP_WDMA 11
#define CLK_MM_MDP_WROT0 12
#define CLK_MM_MDP_WROT1 13
#define CLK_MM_FAKE_ENG 14
#define CLK_MM_MUTEX_32K 15
#define CLK_MM_DISP_OVL0 16
#define CLK_MM_DISP_OVL1 17
#define CLK_MM_DISP_RDMA0 18
#define CLK_MM_DISP_RDMA1 19
#define CLK_MM_DISP_RDMA2 20
#define CLK_MM_DISP_WDMA0 21
#define CLK_MM_DISP_WDMA1 22
#define CLK_MM_DISP_COLOR0 23
#define CLK_MM_DISP_COLOR1 24
#define CLK_MM_DISP_AAL 25
#define CLK_MM_DISP_GAMMA 26
#define CLK_MM_DISP_UFOE 27
#define CLK_MM_DISP_SPLIT0 28
#define CLK_MM_DISP_SPLIT1 29
#define CLK_MM_DISP_MERGE 30
#define CLK_MM_DISP_OD 31
#define CLK_MM_DISP_PWM0MM 32
#define CLK_MM_DISP_PWM026M 33
#define CLK_MM_DISP_PWM1MM 34
#define CLK_MM_DISP_PWM126M 35
#define CLK_MM_DSI0_ENGINE 36
#define CLK_MM_DSI0_DIGITAL 37
#define CLK_MM_DSI1_ENGINE 38
#define CLK_MM_DSI1_DIGITAL 39
#define CLK_MM_DPI_PIXEL 40
#define CLK_MM_DPI_ENGINE 41
#define CLK_MM_NR_CLK 42
/* VDEC_SYS */
#define CLK_VDEC_CKEN 0
#define CLK_VDEC_LARB_CKEN 1
#define CLK_VDEC_NR_CLK 2
/* VENC_SYS */
#define CLK_VENC_LARB 0
#define CLK_VENC_VENC 1
#define CLK_VENC_JPGENC 2
#define CLK_VENC_JPGDEC 3
#define CLK_VENC_NR_CLK 4
#endif /* _DT_BINDINGS_CLK_MT6795_H */
......@@ -859,6 +859,8 @@
#define CLK_VDO1_DPINTF 47
#define CLK_VDO1_DISP_MONITOR_DPINTF 48
#define CLK_VDO1_26M_SLOW 49
#define CLK_VDO1_NR_CLK 50
#define CLK_VDO1_DPI1_HDMI 50
#define CLK_VDO1_NR_CLK 51
#endif /* _DT_BINDINGS_CLK_MT8195_H */
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause) */
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT6795
#define _DT_BINDINGS_RESET_CONTROLLER_MT6795
/* INFRACFG resets */
#define MT6795_INFRA_RST0_SCPSYS_RST 0
#define MT6795_INFRA_RST0_PMIC_WRAP_RST 1
#define MT6795_INFRA_RST1_MIPI_DSI_RST 2
#define MT6795_INFRA_RST1_MIPI_CSI_RST 3
#define MT6795_INFRA_RST1_MM_IOMMU_RST 4
/* MMSYS resets */
#define MT6795_MMSYS_SW0_RST_B_SMI_COMMON 0
#define MT6795_MMSYS_SW0_RST_B_SMI_LARB 1
#define MT6795_MMSYS_SW0_RST_B_CAM_MDP 2
#define MT6795_MMSYS_SW0_RST_B_MDP_RDMA0 3
#define MT6795_MMSYS_SW0_RST_B_MDP_RDMA1 4
#define MT6795_MMSYS_SW0_RST_B_MDP_RSZ0 5
#define MT6795_MMSYS_SW0_RST_B_MDP_RSZ1 6
#define MT6795_MMSYS_SW0_RST_B_MDP_RSZ2 7
#define MT6795_MMSYS_SW0_RST_B_MDP_TDSHP0 8
#define MT6795_MMSYS_SW0_RST_B_MDP_TDSHP1 9
#define MT6795_MMSYS_SW0_RST_B_MDP_WDMA 10
#define MT6795_MMSYS_SW0_RST_B_MDP_WROT0 11
#define MT6795_MMSYS_SW0_RST_B_MDP_WROT1 12
#define MT6795_MMSYS_SW0_RST_B_MDP_CROP 13
/* PERICFG resets */
#define MT6795_PERI_NFI_SW_RST 0
#define MT6795_PERI_THERM_SW_RST 1
#define MT6795_PERI_MSDC1_SW_RST 2
/* TOPRGU resets */
#define MT6795_TOPRGU_INFRA_SW_RST 0
#define MT6795_TOPRGU_MM_SW_RST 1
#define MT6795_TOPRGU_MFG_SW_RST 2
#define MT6795_TOPRGU_VENC_SW_RST 3
#define MT6795_TOPRGU_VDEC_SW_RST 4
#define MT6795_TOPRGU_IMG_SW_RST 5
#define MT6795_TOPRGU_DDRPHY_SW_RST 6
#define MT6795_TOPRGU_MD_SW_RST 7
#define MT6795_TOPRGU_INFRA_AO_SW_RST 8
#define MT6795_TOPRGU_MD_LITE_SW_RST 9
#define MT6795_TOPRGU_APMIXED_SW_RST 10
#define MT6795_TOPRGU_PWRAP_SPI_CTL_RST 11
#define MT6795_TOPRGU_SW_RST_NUM 12
#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT6795 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment