Add clock support for Mediatek MT2701
Subsystems (4)
v11 cover Add clock support for Mediatek MT2701
This series is based on v4.8-rc1, add clock and reset controller support for Mediatek MT2701.
This series also refined makefile and Kconfig to support configurable multiple SoC clock support.
changes since v10:
- Remove COMMON_CLK dependency from clk/mediatek/Kconfig.
changes since v9:
- Rebase to v4.8-rc1.
- Drop a fix patch of parent clock initial state. It will be replaced by a new patch from Mike/Stephen.
- Replace clk.h with clk-provider.h.
- Correct register settings of clocks.
changes since v8:
- Rebase to v4.7-rc1.
- Include mt2701-resets.h in mt2701.dtsi.
- Remove an unused property from apmixedsys DT node.
changes since v7:
- Rebase to clk-next.
- Implement subsystem clocks in seperated files.
- Replace critical clock enabling with CLK_IS_CRITICAL flag.
- Reduce most clock registrations in CLK_OF_DECLARE().
- Remove __init and __initconst from most init fucntions and data, and replace driver registration with platform_driver_register().
- Replace some common function or variable names with unique names.
- Use real clock for UARTs.
changes since v6:
- Rebase to v4.6-rc1.
- Register subsystem clocks in probe() instead of CLK_OF_DECLARE().
- Add clocks that referred by subsystem clocks.
- Fix clk_data size of apmixedsys.
- Add config options for each subsystem clock provider.
changes since v5:
- Rebase to v4.5-rc1 and [1].
- Enable critical clocks for MT2701
- Refine dt-binding documents, add reset controller support for hifsys.
changes since v4:
- Rebase to v4.5-rc1.
- Remove CLK_SET_RATE_PARENT from divider flags.
- Add img_jpgdec_smi clock.
- Move clk/mediatek/Kconfig into menu section in clk/Kconfig.
changes since v3:
- Change the parent of mm_mdp_bls_26m from clk26m to pwm_sel.
changes since v2:
- Fix ethsys definition.
- Replace read-modify-write with regmap_update_bits() in clock operations.
- Move mt2701-resets.h to include/dt-bindings/reset/.
- Add hifsys reset patch from John Crispin.
changes since v1:
- Document MT2701 compatible strings.
[1] https://patchwork.kernel.org/patch/8147901/
Erin Lo (1):
arm: dts: mt2701: Use real clock for UARTs
James Liao (4):
clk: mediatek: remove __init from clk registration functions
clk: mediatek: Refine the makefile to support multiple clock drivers
dt-bindings: ARM: Mediatek: Document bindings for MT2701
arm: dts: mt2701: Add clock controller device nodes
Shunli Wang (4):
clk: mediatek: Add dt-bindings for MT2701 clocks
clk: mediatek: Add MT2701 clock support
reset: mediatek: Add MT2701 reset controller dt-binding file
reset: mediatek: Add MT2701 reset driver
.../bindings/arm/mediatek/mediatek,apmixedsys.txt | 3 +- .../bindings/arm/mediatek/mediatek,bdpsys.txt | 22 + .../bindings/arm/mediatek/mediatek,ethsys.txt | 22 + .../bindings/arm/mediatek/mediatek,hifsys.txt | 24 + .../bindings/arm/mediatek/mediatek,imgsys.txt | 3 +- .../bindings/arm/mediatek/mediatek,infracfg.txt | 3 +- .../bindings/arm/mediatek/mediatek,mmsys.txt | 3 +- .../bindings/arm/mediatek/mediatek,pericfg.txt | 3 +- .../bindings/arm/mediatek/mediatek,topckgen.txt | 3 +- .../bindings/arm/mediatek/mediatek,vdecsys.txt | 3 +- arch/arm/boot/dts/mt2701.dtsi | 50 +- drivers/clk/Kconfig | 1 + drivers/clk/mediatek/Kconfig | 64 ++ drivers/clk/mediatek/Makefile | 13 +- drivers/clk/mediatek/clk-gate.c | 54 +- drivers/clk/mediatek/clk-gate.h | 2 + drivers/clk/mediatek/clk-mt2701-bdp.c | 140 +++ drivers/clk/mediatek/clk-mt2701-eth.c | 82 ++ drivers/clk/mediatek/clk-mt2701-hif.c | 81 ++ drivers/clk/mediatek/clk-mt2701-img.c | 82 ++ drivers/clk/mediatek/clk-mt2701-mm.c | 125 +++ drivers/clk/mediatek/clk-mt2701-vdec.c | 93 ++ drivers/clk/mediatek/clk-mt2701.c | 1037 ++++++++++++++++++++ drivers/clk/mediatek/clk-mtk.c | 52 +- drivers/clk/mediatek/clk-mtk.h | 41 +- drivers/clk/mediatek/clk-pll.c | 3 +- include/dt-bindings/clock/mt2701-clk.h | 486 +++++++++ include/dt-bindings/reset/mt2701-resets.h | 83 ++ 28 files changed, 2550 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt create mode 100644 drivers/clk/mediatek/Kconfig create mode 100644 drivers/clk/mediatek/clk-mt2701-bdp.c create mode 100644 drivers/clk/mediatek/clk-mt2701-eth.c create mode 100644 drivers/clk/mediatek/clk-mt2701-hif.c create mode 100644 drivers/clk/mediatek/clk-mt2701-img.c create mode 100644 drivers/clk/mediatek/clk-mt2701-mm.c create mode 100644 drivers/clk/mediatek/clk-mt2701-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt2701.c create mode 100644 include/dt-bindings/clock/mt2701-clk.h create mode 100644 include/dt-bindings/reset/mt2701-resets.h
--
1.9.1
PATCH v11 1/9 clk: mediatek: remove __init from clk registration functions
From: James Liao <[email protected]>
Remove __init from functions that will be used by init functions that support probe deferral.
--- drivers/clk/mediatek/clk-gate.c | 2 +- drivers/clk/mediatek/clk-mtk.c | 12 ++++++------ drivers/clk/mediatek/clk-pll.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/clk/mediatek/clk-gate.c +1 -1
@@ -97,7 +97,7 @@ const struct clk_ops mtk_clk_gate_ops_setclr_inv = { .disable = mtk_cg_disable_inv, }; -struct clk * __init mtk_clk_register_gate( +struct clk *mtk_clk_register_gate( const char *name, const char *parent_name, struct regmap *regmap,
drivers/clk/mediatek/clk-mtk.c +6 -6
@@ -24,7 +24,7 @@#include "clk-mtk.h" #include "clk-gate.h" -struct clk_onecell_data *__init mtk_alloc_clk_data (unsigned int clk_num) +struct clk_onecell_data *mtk_alloc_clk_data (unsigned int clk_num) {int i;struct clk_onecell_data *clk_data;
@@ -49,7 +49,7 @@ err_out:return NULL ; } -void __init mtk_clk_register_fixed_clks (const struct mtk_fixed_clk *clks, +void mtk_clk_register_fixed_clks (const struct mtk_fixed_clk *clks,int num,struct clk_onecell_data *clk_data) {int i;
@@ -72,7 +72,7 @@ void __init mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, } } -void __init mtk_clk_register_factors (const struct mtk_fixed_factor *clks, +void mtk_clk_register_factors (const struct mtk_fixed_factor *clks,int num,struct clk_onecell_data *clk_data) {int i;
@@ -95,7 +95,7 @@ void __init mtk_clk_register_factors(const struct mtk_fixed_factor *clks, } } -int __init mtk_clk_register_gates (struct device_node *node, +int mtk_clk_register_gates (struct device_node *node,const struct mtk_gate *clks,int num,struct clk_onecell_data *clk_data) {
@@ -135,7 +135,7 @@ int __init mtk_clk_register_gates(struct device_node *node,return 0 ; } -struct clk *__init mtk_clk_register_composite (const struct mtk_composite *mc, +struct clk *mtk_clk_register_composite (const struct mtk_composite *mc,void __iomem *base,spinlock_t *lock) {struct clk *clk;
@@ -222,7 +222,7 @@ err_out:return ERR_PTR (ret); } -void __init mtk_clk_register_composites (const struct mtk_composite *mcs, +void mtk_clk_register_composites (const struct mtk_composite *mcs,int num,void __iomem *base,spinlock_t *lock,struct clk_onecell_data *clk_data) {
drivers/clk/mediatek/clk-pll.c +1 -1
@@ -313,7 +313,7 @@ static struct clk *mtk_clk_register_pll(const struct mtk_pll_data *data,return clk; } -void __init mtk_clk_register_plls (struct device_node *node, +void mtk_clk_register_plls (struct device_node *node,const struct mtk_pll_data *plls,int num_plls,struct clk_onecell_data *clk_data) {void __iomem *base;
Signature · 1 line
1.9.1
PATCH v11 2/9 clk: mediatek: Refine the makefile to support multiple clock drivers
In reply to Erin LoFrom: James Liao <[email protected]>
Add a Kconfig to define clock configuration for each SoC, and modify the Makefile to build drivers that only selected in config.
--- drivers/clk/Kconfig | 1 + drivers/clk/mediatek/Kconfig | 21 +++++++++++++++++++++ drivers/clk/mediatek/Makefile | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 drivers/clk/mediatek/Kconfig
drivers/clk/Kconfig +1 -0
@@ -210,6 +210,7 @@ config COMMON_CLK_OXNAS source "drivers/clk/bcm/Kconfig" source "drivers/clk/hisilicon/Kconfig" +source "drivers/clk/mediatek/Kconfig" source "drivers/clk/meson/Kconfig" source "drivers/clk/mvebu/Kconfig" source "drivers/clk/qcom/Kconfig"
drivers/clk/mediatek/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +# +# MediaTek SoC drivers +# +config COMMON_CLK_MEDIATEK + bool + ---help--- + Mediatek SoCs' clock support. + +config COMMON_CLK_MT8135 + bool "Clock driver for Mediatek MT8135" + select COMMON_CLK_MEDIATEK + default ARCH_MEDIATEK + ---help--- + This driver supports Mediatek MT8135 clocks. + +config COMMON_CLK_MT8173 + bool "Clock driver for Mediatek MT8173" + select COMMON_CLK_MEDIATEK + default ARCH_MEDIATEK + ---help--- + This driver supports Mediatek MT8173 clocks.
drivers/clk/mediatek/Makefile +3 -3
@@ -1,4 +1,4 @@ -obj-y += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o +obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o obj-$(CONFIG_RESET_CONTROLLER) += reset.o -obj-y += clk-mt8135.o -obj-y += clk-mt8173.o +obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o +obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH v11 2/9] clk: mediatek: Refine the makefile to support multiple clock drivers
Quoted 11 lines · Erin Lo
From: James Liao <[email protected]>
Add a
Kconfigto define clock configuration for each SoC, and modify theMakefileto build drivers that only selected in config.Signed-off-by Shunli Wang <[email protected]>Signed-off-by James Liao <[email protected]>Signed-off-by Erin Lo <[email protected]>Tested-by John Crispin <[email protected]>Reviewed-by Matthias Brugger <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v11 3/9 dt-bindings: ARM: Mediatek: Document bindings for MT2701
In reply to Erin LoFrom: James Liao <[email protected]>
This patch adds the binding documentation for apmixedsys, bdpsys, ethsys, hifsys, imgsys, infracfg, mmsys, pericfg, topckgen and vdecsys for Mediatek MT2701.
--- .../bindings/arm/mediatek/mediatek,apmixedsys.txt | 3 ++- .../bindings/arm/mediatek/mediatek,bdpsys.txt | 22 ++++++++++++++++++++ .../bindings/arm/mediatek/mediatek,ethsys.txt | 22 ++++++++++++++++++++ .../bindings/arm/mediatek/mediatek,hifsys.txt | 24 ++++++++++++++++++++++ .../bindings/arm/mediatek/mediatek,imgsys.txt | 3 ++- .../bindings/arm/mediatek/mediatek,infracfg.txt | 3 ++- .../bindings/arm/mediatek/mediatek,mmsys.txt | 3 ++- .../bindings/arm/mediatek/mediatek,pericfg.txt | 3 ++- .../bindings/arm/mediatek/mediatek,topckgen.txt | 3 ++- .../bindings/arm/mediatek/mediatek,vdecsys.txt | 3 ++- 10 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt create mode 100644 Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt
Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt +2 -1
@@ -5,7 +5,8 @@ The Mediatek apmixedsys controller provides the PLLs to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-apmixedsys" - "mediatek,mt8135-apmixedsys" - "mediatek,mt8173-apmixedsys" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,bdpsys.txt new file +22 -0
@@ -0,0 +1,22 @@ +Mediatek bdpsys controller +============================ + +The Mediatek bdpsys controller provides various clocks to the system. + +Required Properties: + +- compatible: Should be: + - "mediatek,mt2701-bdpsys", "syscon" +- #clock-cells: Must be 1 + +The bdpsys controller uses the common clk binding from +Documentation/devicetree/bindings/clock/clock-bindings.txt +The available clocks are defined in dt-bindings/clock/mt*-clk.h. + +Example: + +bdpsys: clock-controller at 1c000000 { + compatible = "mediatek,mt2701-bdpsys", "syscon"; + reg = <0 0x1c000000 0 0x1000>; + #clock-cells = <1>; +};
Documentation/devicetree/bindings/arm/mediatek/mediatek,ethsys.txt new file +22 -0
@@ -0,0 +1,22 @@ +Mediatek ethsys controller +============================ + +The Mediatek ethsys controller provides various clocks to the system. + +Required Properties: + +- compatible: Should be: + - "mediatek,mt2701-ethsys", "syscon" +- #clock-cells: Must be 1 + +The ethsys controller uses the common clk binding from +Documentation/devicetree/bindings/clock/clock-bindings.txt +The available clocks are defined in dt-bindings/clock/mt*-clk.h. + +Example: + +ethsys: clock-controller at 1b000000 { + compatible = "mediatek,mt2701-ethsys", "syscon"; + reg = <0 0x1b000000 0 0x1000>; + #clock-cells = <1>; +};
Documentation/devicetree/bindings/arm/mediatek/mediatek,hifsys.txt new file +24 -0
@@ -0,0 +1,24 @@ +Mediatek hifsys controller +============================ + +The Mediatek hifsys controller provides various clocks and reset +outputs to the system. + +Required Properties: + +- compatible: Should be: + - "mediatek,mt2701-hifsys", "syscon" +- #clock-cells: Must be 1 + +The hifsys controller uses the common clk binding from +Documentation/devicetree/bindings/clock/clock-bindings.txt +The available clocks are defined in dt-bindings/clock/mt*-clk.h. + +Example: + +hifsys: clock-controller at 1a000000 { + compatible = "mediatek,mt2701-hifsys", "syscon"; + reg = <0 0x1a000000 0 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; +};
Documentation/devicetree/bindings/arm/mediatek/mediatek,imgsys.txt +2 -1
@@ -5,7 +5,8 @@ The Mediatek imgsys controller provides various clocks to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-imgsys", "syscon" - "mediatek,mt8173-imgsys", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt +2 -1
@@ -6,7 +6,8 @@ outputs to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-infracfg", "syscon" - "mediatek,mt8135-infracfg", "syscon" - "mediatek,mt8173-infracfg", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt +2 -1
@@ -5,7 +5,8 @@ The Mediatek mmsys controller provides various clocks to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-mmsys", "syscon" - "mediatek,mt8173-mmsys", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt +2 -1
@@ -6,7 +6,8 @@ outputs to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-pericfg", "syscon" - "mediatek,mt8135-pericfg", "syscon" - "mediatek,mt8173-pericfg", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt +2 -1
@@ -5,7 +5,8 @@ The Mediatek topckgen controller provides various clocks to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-topckgen" - "mediatek,mt8135-topckgen" - "mediatek,mt8173-topckgen" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,vdecsys.txt +2 -1
@@ -5,7 +5,8 @@ The Mediatek vdecsys controller provides various clocks to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt2701-vdecsys", "syscon" - "mediatek,mt8173-vdecsys", "syscon" - #clock-cells: Must be 1
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH v11 3/9] dt-bindings: ARM: Mediatek: Document bindings for MT2701
Quoted 11 lines · Erin Lo
From: James Liao <[email protected]>
This patch adds the binding documentation for apmixedsys, bdpsys, ethsys, hifsys, imgsys, infracfg, mmsys, pericfg, topckgen and vdecsys for Mediatek MT2701.
Signed-off-by James Liao <[email protected]>Signed-off-by Erin Lo <[email protected]>Tested-by John Crispin <[email protected]>Acked-by Rob Herring <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v11 4/9 clk: mediatek: Add dt-bindings for MT2701 clocks
In reply to Erin LoFrom: Shunli Wang <[email protected]>
Add MT2701 clock dt-bindings, include topckgen, apmixedsys, infracfg, pericfg and subsystem clocks.
--- include/dt-bindings/clock/mt2701-clk.h | 486 +++++++++++++++++++++++++++++++++ 1 file changed, 486 insertions(+) create mode 100644 include/dt-bindings/clock/mt2701-clk.h
include/dt-bindings/clock/mt2701-clk.h new file +486 -0
@@ -0,0 +1,486 @@ +/* +* Copyright (c) 2014 MediaTek Inc. +* Author: Shunli Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _DT_BINDINGS_CLK_MT2701_H +#define _DT_BINDINGS_CLK_MT2701_H + +/* TOPCKGEN */ +#define CLK_TOP_SYSPLL 1 +#define CLK_TOP_SYSPLL_D2 2 +#define CLK_TOP_SYSPLL_D3 3 +#define CLK_TOP_SYSPLL_D5 4 +#define CLK_TOP_SYSPLL_D7 5 +#define CLK_TOP_SYSPLL1_D2 6 +#define CLK_TOP_SYSPLL1_D4 7 +#define CLK_TOP_SYSPLL1_D8 8 +#define CLK_TOP_SYSPLL1_D16 9 +#define CLK_TOP_SYSPLL2_D2 10 +#define CLK_TOP_SYSPLL2_D4 11 +#define CLK_TOP_SYSPLL2_D8 12 +#define CLK_TOP_SYSPLL3_D2 13 +#define CLK_TOP_SYSPLL3_D4 14 +#define CLK_TOP_SYSPLL4_D2 15 +#define CLK_TOP_SYSPLL4_D4 16 +#define CLK_TOP_UNIVPLL 17 +#define CLK_TOP_UNIVPLL_D2 18 +#define CLK_TOP_UNIVPLL_D3 19 +#define CLK_TOP_UNIVPLL_D5 20 +#define CLK_TOP_UNIVPLL_D7 21 +#define CLK_TOP_UNIVPLL_D26 22 +#define CLK_TOP_UNIVPLL_D52 23 +#define CLK_TOP_UNIVPLL_D108 24 +#define CLK_TOP_USB_PHY48M 25 +#define CLK_TOP_UNIVPLL1_D2 26 +#define CLK_TOP_UNIVPLL1_D4 27 +#define CLK_TOP_UNIVPLL1_D8 28 +#define CLK_TOP_UNIVPLL2_D2 29 +#define CLK_TOP_UNIVPLL2_D4 30 +#define CLK_TOP_UNIVPLL2_D8 31 +#define CLK_TOP_UNIVPLL2_D16 32 +#define CLK_TOP_UNIVPLL2_D32 33 +#define CLK_TOP_UNIVPLL3_D2 34 +#define CLK_TOP_UNIVPLL3_D4 35 +#define CLK_TOP_UNIVPLL3_D8 36 +#define CLK_TOP_MSDCPLL 37 +#define CLK_TOP_MSDCPLL_D2 38 +#define CLK_TOP_MSDCPLL_D4 39 +#define CLK_TOP_MSDCPLL_D8 40 +#define CLK_TOP_MMPLL 41 +#define CLK_TOP_MMPLL_D2 42 +#define CLK_TOP_DMPLL 43 +#define CLK_TOP_DMPLL_D2 44 +#define CLK_TOP_DMPLL_D4 45 +#define CLK_TOP_DMPLL_X2 46 +#define CLK_TOP_TVDPLL 47 +#define CLK_TOP_TVDPLL_D2 48 +#define CLK_TOP_TVDPLL_D4 49 +#define CLK_TOP_TVD2PLL 50 +#define CLK_TOP_TVD2PLL_D2 51 +#define CLK_TOP_HADDS2PLL_98M 52 +#define CLK_TOP_HADDS2PLL_294M 53 +#define CLK_TOP_HADDS2_FB 54 +#define CLK_TOP_MIPIPLL_D2 55 +#define CLK_TOP_MIPIPLL_D4 56 +#define CLK_TOP_HDMIPLL 57 +#define CLK_TOP_HDMIPLL_D2 58 +#define CLK_TOP_HDMIPLL_D3 59 +#define CLK_TOP_HDMI_SCL_RX 60 +#define CLK_TOP_HDMI_0_PIX340M 61 +#define CLK_TOP_HDMI_0_DEEP340M 62 +#define CLK_TOP_HDMI_0_PLL340M 63 +#define CLK_TOP_AUD1PLL_98M 64 +#define CLK_TOP_AUD2PLL_90M 65 +#define CLK_TOP_AUDPLL 66 +#define CLK_TOP_AUDPLL_D4 67 +#define CLK_TOP_AUDPLL_D8 68 +#define CLK_TOP_AUDPLL_D16 69 +#define CLK_TOP_AUDPLL_D24 70 +#define CLK_TOP_ETHPLL_500M 71 +#define CLK_TOP_VDECPLL 72 +#define CLK_TOP_VENCPLL 73 +#define CLK_TOP_MIPIPLL 74 +#define CLK_TOP_ARMPLL_1P3G 75 + +#define CLK_TOP_MM_SEL 76 +#define CLK_TOP_DDRPHYCFG_SEL 77 +#define CLK_TOP_MEM_SEL 78 +#define CLK_TOP_AXI_SEL 79 +#define CLK_TOP_CAMTG_SEL 80 +#define CLK_TOP_MFG_SEL 81 +#define CLK_TOP_VDEC_SEL 82 +#define CLK_TOP_PWM_SEL 83 +#define CLK_TOP_MSDC30_0_SEL 84 +#define CLK_TOP_USB20_SEL 85 +#define CLK_TOP_SPI0_SEL 86 +#define CLK_TOP_UART_SEL 87 +#define CLK_TOP_AUDINTBUS_SEL 88 +#define CLK_TOP_AUDIO_SEL 89 +#define CLK_TOP_MSDC30_2_SEL 90 +#define CLK_TOP_MSDC30_1_SEL 91 +#define CLK_TOP_DPI1_SEL 92 +#define CLK_TOP_DPI0_SEL 93 +#define CLK_TOP_SCP_SEL 94 +#define CLK_TOP_PMICSPI_SEL 95 +#define CLK_TOP_APLL_SEL 96 +#define CLK_TOP_HDMI_SEL 97 +#define CLK_TOP_TVE_SEL 98 +#define CLK_TOP_EMMC_HCLK_SEL 99 +#define CLK_TOP_NFI2X_SEL 100 +#define CLK_TOP_RTC_SEL 101 +#define CLK_TOP_OSD_SEL 102 +#define CLK_TOP_NR_SEL 103 +#define CLK_TOP_DI_SEL 104 +#define CLK_TOP_FLASH_SEL 105 +#define CLK_TOP_ASM_M_SEL 106 +#define CLK_TOP_ASM_I_SEL 107 +#define CLK_TOP_INTDIR_SEL 108 +#define CLK_TOP_HDMIRX_BIST_SEL 109 +#define CLK_TOP_ETHIF_SEL 110 +#define CLK_TOP_MS_CARD_SEL 111 +#define CLK_TOP_ASM_H_SEL 112 +#define CLK_TOP_SPI1_SEL 113 +#define CLK_TOP_CMSYS_SEL 114 +#define CLK_TOP_MSDC30_3_SEL 115 +#define CLK_TOP_HDMIRX26_24_SEL 116 +#define CLK_TOP_AUD2DVD_SEL 117 +#define CLK_TOP_8BDAC_SEL 118 +#define CLK_TOP_SPI2_SEL 119 +#define CLK_TOP_AUD_MUX1_SEL 120 +#define CLK_TOP_AUD_MUX2_SEL 121 +#define CLK_TOP_AUDPLL_MUX_SEL 122 +#define CLK_TOP_AUD_K1_SRC_SEL 123 +#define CLK_TOP_AUD_K2_SRC_SEL 124 +#define CLK_TOP_AUD_K3_SRC_SEL 125 +#define CLK_TOP_AUD_K4_SRC_SEL 126 +#define CLK_TOP_AUD_K5_SRC_SEL 127 +#define CLK_TOP_AUD_K6_SRC_SEL 128 +#define CLK_TOP_PADMCLK_SEL 129 +#define CLK_TOP_AUD_EXTCK1_DIV 130 +#define CLK_TOP_AUD_EXTCK2_DIV 131 +#define CLK_TOP_AUD_MUX1_DIV 132 +#define CLK_TOP_AUD_MUX2_DIV 133 +#define CLK_TOP_AUD_K1_SRC_DIV 134 +#define CLK_TOP_AUD_K2_SRC_DIV 135 +#define CLK_TOP_AUD_K3_SRC_DIV 136 +#define CLK_TOP_AUD_K4_SRC_DIV 137 +#define CLK_TOP_AUD_K5_SRC_DIV 138 +#define CLK_TOP_AUD_K6_SRC_DIV 139 +#define CLK_TOP_AUD_I2S1_MCLK 140 +#define CLK_TOP_AUD_I2S2_MCLK 141 +#define CLK_TOP_AUD_I2S3_MCLK 142 +#define CLK_TOP_AUD_I2S4_MCLK 143 +#define CLK_TOP_AUD_I2S5_MCLK 144 +#define CLK_TOP_AUD_I2S6_MCLK 145 +#define CLK_TOP_AUD_48K_TIMING 146 +#define CLK_TOP_AUD_44K_TIMING 147 + +#define CLK_TOP_32K_INTERNAL 148 +#define CLK_TOP_32K_EXTERNAL 149 +#define CLK_TOP_CLK26M_D8 150 +#define CLK_TOP_8BDAC 151 +#define CLK_TOP_WBG_DIG_416M 152 +#define CLK_TOP_DPI 153 +#define CLK_TOP_HDMITX_CLKDIG_CTS 154 +#define CLK_TOP_DSI0_LNTC_DSI 155 +#define CLK_TOP_AUD_EXT1 156 +#define CLK_TOP_AUD_EXT2 157 +#define CLK_TOP_NFI1X_PAD 158 +#define CLK_TOP_NR 159 + +/* APMIXEDSYS */ + +#define CLK_APMIXED_ARMPLL 1 +#define CLK_APMIXED_MAINPLL 2 +#define CLK_APMIXED_UNIVPLL 3 +#define CLK_APMIXED_MMPLL 4 +#define CLK_APMIXED_MSDCPLL 5 +#define CLK_APMIXED_TVDPLL 6 +#define CLK_APMIXED_AUD1PLL 7 +#define CLK_APMIXED_TRGPLL 8 +#define CLK_APMIXED_ETHPLL 9 +#define CLK_APMIXED_VDECPLL 10 +#define CLK_APMIXED_HADDS2PLL 11 +#define CLK_APMIXED_AUD2PLL 12 +#define CLK_APMIXED_TVD2PLL 13 +#define CLK_APMIXED_NR 14 + +/* DDRPHY */ + +#define CLK_DDRPHY_VENCPLL 1 +#define CLK_DDRPHY_NR 2 + +/* INFRACFG */ + +#define CLK_INFRA_DBG 1 +#define CLK_INFRA_SMI 2 +#define CLK_INFRA_QAXI_CM4 3 +#define CLK_INFRA_AUD_SPLIN_B 4 +#define CLK_INFRA_AUDIO 5 +#define CLK_INFRA_EFUSE 6 +#define CLK_INFRA_L2C_SRAM 7 +#define CLK_INFRA_M4U 8 +#define CLK_INFRA_CONNMCU 9 +#define CLK_INFRA_TRNG 10 +#define CLK_INFRA_RAMBUFIF 11 +#define CLK_INFRA_CPUM 12 +#define CLK_INFRA_KP 13 +#define CLK_INFRA_CEC 14 +#define CLK_INFRA_IRRX 15 +#define CLK_INFRA_PMICSPI 16 +#define CLK_INFRA_PMICWRAP 17 +#define CLK_INFRA_DDCCI 18 +#define CLK_INFRA_CLK_13M 19 +#define CLK_INFRA_NR 20 + +/* PERICFG */ + +#define CLK_PERI_NFI 1 +#define CLK_PERI_THERM 2 +#define CLK_PERI_PWM1 3 +#define CLK_PERI_PWM2 4 +#define CLK_PERI_PWM3 5 +#define CLK_PERI_PWM4 6 +#define CLK_PERI_PWM5 7 +#define CLK_PERI_PWM6 8 +#define CLK_PERI_PWM7 9 +#define CLK_PERI_PWM 10 +#define CLK_PERI_USB0 11 +#define CLK_PERI_USB1 12 +#define CLK_PERI_AP_DMA 13 +#define CLK_PERI_MSDC30_0 14 +#define CLK_PERI_MSDC30_1 15 +#define CLK_PERI_MSDC30_2 16 +#define CLK_PERI_MSDC30_3 17 +#define CLK_PERI_MSDC50_3 18 +#define CLK_PERI_NLI 19 +#define CLK_PERI_UART0 20 +#define CLK_PERI_UART1 21 +#define CLK_PERI_UART2 22 +#define CLK_PERI_UART3 23 +#define CLK_PERI_BTIF 24 +#define CLK_PERI_I2C0 25 +#define CLK_PERI_I2C1 26 +#define CLK_PERI_I2C2 27 +#define CLK_PERI_I2C3 28 +#define CLK_PERI_AUXADC 29 +#define CLK_PERI_SPI0 30 +#define CLK_PERI_ETH 31 +#define CLK_PERI_USB0_MCU 32 + +#define CLK_PERI_USB1_MCU 33 +#define CLK_PERI_USB_SLV 34 +#define CLK_PERI_GCPU 35 +#define CLK_PERI_NFI_ECC 36 +#define CLK_PERI_NFI_PAD 37 +#define CLK_PERI_FLASH 38 +#define CLK_PERI_HOST89_INT 39 +#define CLK_PERI_HOST89_SPI 40 +#define CLK_PERI_HOST89_DVD 41 +#define CLK_PERI_SPI1 42 +#define CLK_PERI_SPI2 43 +#define CLK_PERI_FCI 44 + +#define CLK_PERI_UART0_SEL 45 +#define CLK_PERI_UART1_SEL 46 +#define CLK_PERI_UART2_SEL 47 +#define CLK_PERI_UART3_SEL 48 +#define CLK_PERI_NR 49 + +/* AUDIO */ + +#define CLK_AUD_AFE 1 +#define CLK_AUD_LRCK_DETECT 2 +#define CLK_AUD_I2S 3 +#define CLK_AUD_APLL_TUNER 4 +#define CLK_AUD_HDMI 5 +#define CLK_AUD_SPDF 6 +#define CLK_AUD_SPDF2 7 +#define CLK_AUD_APLL 8 +#define CLK_AUD_TML 9 +#define CLK_AUD_AHB_IDLE_EXT 10 +#define CLK_AUD_AHB_IDLE_INT 11 + +#define CLK_AUD_I2SIN1 12 +#define CLK_AUD_I2SIN2 13 +#define CLK_AUD_I2SIN3 14 +#define CLK_AUD_I2SIN4 15 +#define CLK_AUD_I2SIN5 16 +#define CLK_AUD_I2SIN6 17 +#define CLK_AUD_I2SO1 18 +#define CLK_AUD_I2SO2 19 +#define CLK_AUD_I2SO3 20 +#define CLK_AUD_I2SO4 21 +#define CLK_AUD_I2SO5 22 +#define CLK_AUD_I2SO6 23 +#define CLK_AUD_ASRCI1 24 +#define CLK_AUD_ASRCI2 25 +#define CLK_AUD_ASRCO1 26 +#define CLK_AUD_ASRCO2 27 +#define CLK_AUD_ASRC11 28 +#define CLK_AUD_ASRC12 29 +#define CLK_AUD_HDMIRX 30 +#define CLK_AUD_INTDIR 31 +#define CLK_AUD_A1SYS 32 +#define CLK_AUD_A2SYS 33 +#define CLK_AUD_AFE_CONN 34 +#define CLK_AUD_AFE_PCMIF 35 +#define CLK_AUD_AFE_MRGIF 36 + +#define CLK_AUD_MMIF_UL1 37 +#define CLK_AUD_MMIF_UL2 38 +#define CLK_AUD_MMIF_UL3 39 +#define CLK_AUD_MMIF_UL4 40 +#define CLK_AUD_MMIF_UL5 41 +#define CLK_AUD_MMIF_UL6 42 +#define CLK_AUD_MMIF_DL1 43 +#define CLK_AUD_MMIF_DL2 44 +#define CLK_AUD_MMIF_DL3 45 +#define CLK_AUD_MMIF_DL4 46 +#define CLK_AUD_MMIF_DL5 47 +#define CLK_AUD_MMIF_DL6 48 +#define CLK_AUD_MMIF_DLMCH 49 +#define CLK_AUD_MMIF_ARB1 50 +#define CLK_AUD_MMIF_AWB1 51 +#define CLK_AUD_MMIF_AWB2 52 +#define CLK_AUD_MMIF_DAI 53 + +#define CLK_AUD_DMIC1 54 +#define CLK_AUD_DMIC2 55 +#define CLK_AUD_ASRCI3 56 +#define CLK_AUD_ASRCI4 57 +#define CLK_AUD_ASRCI5 58 +#define CLK_AUD_ASRCI6 59 +#define CLK_AUD_ASRCO3 60 +#define CLK_AUD_ASRCO4 61 +#define CLK_AUD_ASRCO5 62 +#define CLK_AUD_ASRCO6 63 +#define CLK_AUD_MEM_ASRC1 64 +#define CLK_AUD_MEM_ASRC2 65 +#define CLK_AUD_MEM_ASRC3 66 +#define CLK_AUD_MEM_ASRC4 67 +#define CLK_AUD_MEM_ASRC5 68 +#define CLK_AUD_DSD_ENC 69 +#define CLK_AUD_ASRC_BRG 70 +#define CLK_AUD_NR 71 + +/* MMSYS */ + +#define CLK_MM_SMI_COMMON 1 +#define CLK_MM_SMI_LARB0 2 +#define CLK_MM_CMDQ 3 +#define CLK_MM_MUTEX 4 +#define CLK_MM_DISP_COLOR 5 +#define CLK_MM_DISP_BLS 6 +#define CLK_MM_DISP_WDMA 7 +#define CLK_MM_DISP_RDMA 8 +#define CLK_MM_DISP_OVL 9 +#define CLK_MM_MDP_TDSHP 10 +#define CLK_MM_MDP_WROT 11 +#define CLK_MM_MDP_WDMA 12 +#define CLK_MM_MDP_RSZ1 13 +#define CLK_MM_MDP_RSZ0 14 +#define CLK_MM_MDP_RDMA 15 +#define CLK_MM_MDP_BLS_26M 16 +#define CLK_MM_CAM_MDP 17 +#define CLK_MM_FAKE_ENG 18 +#define CLK_MM_MUTEX_32K 19 +#define CLK_MM_DISP_RDMA1 20 +#define CLK_MM_DISP_UFOE 21 + +#define CLK_MM_DSI_ENGINE 22 +#define CLK_MM_DSI_DIG 23 +#define CLK_MM_DPI_DIGL 24 +#define CLK_MM_DPI_ENGINE 25 +#define CLK_MM_DPI1_DIGL 26 +#define CLK_MM_DPI1_ENGINE 27 +#define CLK_MM_TVE_OUTPUT 28 +#define CLK_MM_TVE_INPUT 29 +#define CLK_MM_HDMI_PIXEL 30 +#define CLK_MM_HDMI_PLL 31 +#define CLK_MM_HDMI_AUDIO 32 +#define CLK_MM_HDMI_SPDIF 33 +#define CLK_MM_TVE_FMM 34 +#define CLK_MM_NR 35 + +/* IMGSYS */ + +#define CLK_IMG_SMI_COMM 1 +#define CLK_IMG_RESZ 2 +#define CLK_IMG_JPGDEC_SMI 3 +#define CLK_IMG_JPGDEC 4 +#define CLK_IMG_VENC_LT 5 +#define CLK_IMG_VENC 6 +#define CLK_IMG_NR 7 + +/* VDEC */ + +#define CLK_VDEC_CKGEN 1 +#define CLK_VDEC_LARB 2 +#define CLK_VDEC_NR 3 + +/* HIFSYS */ + +#define CLK_HIFSYS_USB0PHY 1 +#define CLK_HIFSYS_USB1PHY 2 +#define CLK_HIFSYS_PCIE0 3 +#define CLK_HIFSYS_PCIE1 4 +#define CLK_HIFSYS_PCIE2 5 +#define CLK_HIFSYS_NR 6 + +/* ETHSYS */ +#define CLK_ETHSYS_HSDMA 1 +#define CLK_ETHSYS_ESW 2 +#define CLK_ETHSYS_GP2 3 +#define CLK_ETHSYS_GP1 4 +#define CLK_ETHSYS_PCM 5 +#define CLK_ETHSYS_GDMA 6 +#define CLK_ETHSYS_I2S 7 +#define CLK_ETHSYS_CRYPTO 8 +#define CLK_ETHSYS_NR 9 + +/* BDP */ + +#define CLK_BDP_BRG_BA 1 +#define CLK_BDP_BRG_DRAM 2 +#define CLK_BDP_LARB_DRAM 3 +#define CLK_BDP_WR_VDI_PXL 4 +#define CLK_BDP_WR_VDI_DRAM 5 +#define CLK_BDP_WR_B 6 +#define CLK_BDP_DGI_IN 7 +#define CLK_BDP_DGI_OUT 8 +#define CLK_BDP_FMT_MAST_27 9 +#define CLK_BDP_FMT_B 10 +#define CLK_BDP_OSD_B 11 +#define CLK_BDP_OSD_DRAM 12 +#define CLK_BDP_OSD_AGENT 13 +#define CLK_BDP_OSD_PXL 14 +#define CLK_BDP_RLE_B 15 +#define CLK_BDP_RLE_AGENT 16 +#define CLK_BDP_RLE_DRAM 17 +#define CLK_BDP_F27M 18 +#define CLK_BDP_F27M_VDOUT 19 +#define CLK_BDP_F27_74_74 20 +#define CLK_BDP_F2FS 21 +#define CLK_BDP_F2FS74_148 22 +#define CLK_BDP_FB 23 +#define CLK_BDP_VDO_DRAM 24 +#define CLK_BDP_VDO_2FS 25 +#define CLK_BDP_VDO_B 26 +#define CLK_BDP_WR_DI_PXL 27 +#define CLK_BDP_WR_DI_DRAM 28 +#define CLK_BDP_WR_DI_B 29 +#define CLK_BDP_NR_PXL 30 +#define CLK_BDP_NR_DRAM 31 +#define CLK_BDP_NR_B 32 + +#define CLK_BDP_RX_F 33 +#define CLK_BDP_RX_X 34 +#define CLK_BDP_RXPDT 35 +#define CLK_BDP_RX_CSCL_N 36 +#define CLK_BDP_RX_CSCL 37 +#define CLK_BDP_RX_DDCSCL_N 38 +#define CLK_BDP_RX_DDCSCL 39 +#define CLK_BDP_RX_VCO 40 +#define CLK_BDP_RX_DP 41 +#define CLK_BDP_RX_P 42 +#define CLK_BDP_RX_M 43 +#define CLK_BDP_RX_PLL 44 +#define CLK_BDP_BRG_RT_B 45 +#define CLK_BDP_BRG_RT_DRAM 46 +#define CLK_BDP_LARBRT_DRAM 47 +#define CLK_BDP_TMDS_SYN 48 +#define CLK_BDP_HDMI_MON 49 +#define CLK_BDP_NR 50 + +#endif /* _DT_BINDINGS_CLK_MT2701_H */
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH v11 4/9] clk: mediatek: Add dt-bindings for MT2701 clocks
Quoted 11 lines · Erin Lo
From: Shunli Wang <[email protected]>
Add MT2701 clock dt-bindings, include topckgen, apmixedsys, infracfg, pericfg and subsystem clocks.
Signed-off-by Shunli Wang <[email protected]>Signed-off-by James Liao <[email protected]>Signed-off-by Erin Lo <[email protected]>Tested-by John Crispin <[email protected]>Reviewed-by Matthias Brugger <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v11 5/9 clk: mediatek: Add MT2701 clock support
In reply to Erin LoFrom: Shunli Wang <[email protected]>
Add MT2701 clock support, include topckgen, apmixedsys, infracfg, pericfg and subsystem clocks.
--- drivers/clk/mediatek/Kconfig | 43 ++ drivers/clk/mediatek/Makefile | 7 + drivers/clk/mediatek/clk-gate.c | 52 ++ drivers/clk/mediatek/clk-gate.h | 2 + drivers/clk/mediatek/clk-mt2701-bdp.c | 140 +++++ drivers/clk/mediatek/clk-mt2701-eth.c | 82 +++ drivers/clk/mediatek/clk-mt2701-hif.c | 79 +++ drivers/clk/mediatek/clk-mt2701-img.c | 82 +++ drivers/clk/mediatek/clk-mt2701-mm.c | 125 ++++ drivers/clk/mediatek/clk-mt2701-vdec.c | 93 +++ drivers/clk/mediatek/clk-mt2701.c | 1033 ++++++++++++++++++++++++++++++++ drivers/clk/mediatek/clk-mtk.c | 40 ++ drivers/clk/mediatek/clk-mtk.h | 41 +- drivers/clk/mediatek/clk-pll.c | 1 + 14 files changed, 1815 insertions(+), 5 deletions(-) create mode 100644 drivers/clk/mediatek/clk-mt2701-bdp.c create mode 100644 drivers/clk/mediatek/clk-mt2701-eth.c create mode 100644 drivers/clk/mediatek/clk-mt2701-hif.c create mode 100644 drivers/clk/mediatek/clk-mt2701-img.c create mode 100644 drivers/clk/mediatek/clk-mt2701-mm.c create mode 100644 drivers/clk/mediatek/clk-mt2701-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt2701.c
drivers/clk/mediatek/Kconfig +43 -0
@@ -6,6 +6,49 @@ config COMMON_CLK_MEDIATEK ---help--- Mediatek SoCs' clock support. +config COMMON_CLK_MT2701 + bool "Clock driver for Mediatek MT2701" + select COMMON_CLK_MEDIATEK + default ARCH_MEDIATEK + ---help--- + This driver supports Mediatek MT2701 basic clocks. + +config COMMON_CLK_MT2701_MMSYS + bool "Clock driver for Mediatek MT2701 mmsys" + select COMMON_CLK_MT2701 + ---help--- + This driver supports Mediatek MT2701 mmsys clocks. + +config COMMON_CLK_MT2701_IMGSYS + bool "Clock driver for Mediatek MT2701 imgsys" + select COMMON_CLK_MT2701 + ---help--- + This driver supports Mediatek MT2701 imgsys clocks. + +config COMMON_CLK_MT2701_VDECSYS + bool "Clock driver for Mediatek MT2701 vdecsys" + select COMMON_CLK_MT2701 + ---help--- + This driver supports Mediatek MT2701 vdecsys clocks. + +config COMMON_CLK_MT2701_HIFSYS + bool "Clock driver for Mediatek MT2701 hifsys" + select COMMON_CLK_MT2701 + ---help--- + This driver supports Mediatek MT2701 hifsys clocks. + +config COMMON_CLK_MT2701_ETHSYS + bool "Clock driver for Mediatek MT2701 ethsys" + select COMMON_CLK_MT2701 + ---help--- + This driver supports Mediatek MT2701 ethsys clocks. + +config COMMON_CLK_MT2701_BDPSYS + bool "Clock driver for Mediatek MT2701 bdpsys" + select COMMON_CLK_MT2701 + ---help--- + This driver supports Mediatek MT2701 bdpsys clocks. + config COMMON_CLK_MT8135 bool "Clock driver for Mediatek MT8135" select COMMON_CLK_MEDIATEK
drivers/clk/mediatek/Makefile +7 -0
@@ -1,4 +1,11 @@ obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o obj-$(CONFIG_RESET_CONTROLLER) += reset.o +obj-$(CONFIG_COMMON_CLK_MT2701) += clk-mt2701.o +obj-$(CONFIG_COMMON_CLK_MT2701_BDPSYS) += clk-mt2701-bdp.o +obj-$(CONFIG_COMMON_CLK_MT2701_ETHSYS) += clk-mt2701-eth.o +obj-$(CONFIG_COMMON_CLK_MT2701_HIFSYS) += clk-mt2701-hif.o +obj-$(CONFIG_COMMON_CLK_MT2701_IMGSYS) += clk-mt2701-img.o +obj-$(CONFIG_COMMON_CLK_MT2701_MMSYS) += clk-mt2701-mm.o +obj-$(CONFIG_COMMON_CLK_MT2701_VDECSYS) += clk-mt2701-vdec.o obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
drivers/clk/mediatek/clk-gate.c +52 -0
70 lines not on this page · raw message
drivers/clk/mediatek/clk-gate.h +2 -0
@@ -36,6 +36,8 @@ static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)extern const struct clk_ops mtk_clk_gate_ops_setclr;extern const struct clk_ops mtk_clk_gate_ops_setclr_inv; +extern const struct clk_ops mtk_clk_gate_ops_no_setclr; +extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv; struct clk *mtk_clk_register_gate( const char *name,
drivers/clk/mediatek/clk-mt2701-bdp.c new file +140 -0
140 lines not on this page · raw message
drivers/clk/mediatek/clk-mt2701-eth.c new file +82 -0
82 lines not on this page · raw message
drivers/clk/mediatek/clk-mt2701-hif.c new file +79 -0
79 lines not on this page · raw message
drivers/clk/mediatek/clk-mt2701-img.c new file +82 -0
82 lines not on this page · raw message
drivers/clk/mediatek/clk-mt2701-mm.c new file +125 -0
125 lines not on this page · raw message
drivers/clk/mediatek/clk-mt2701-vdec.c new file +93 -0
93 lines not on this page · raw message
drivers/clk/mediatek/clk-mt2701.c new file +1033 -0
1,033 lines not on this page · raw message
drivers/clk/mediatek/clk-mtk.c +40 -0
@@ -58,6 +58,9 @@ void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks,for (i =0 ; i < num; i++) {const struct mtk_fixed_clk *rc = &clks[i]; +if (!IS_ERR_OR_NULL (clk_data->clks[rc->id])) +continue ; + clk =clk_register_fixed_rate (NULL , rc->name, rc->parent,0 , rc->rate);
@@ -81,6 +84,9 @@ void mtk_clk_register_factors(const struct mtk_fixed_factor *clks,for (i =0 ; i < num; i++) {const struct mtk_fixed_factor *ff = &clks[i]; +if (!IS_ERR_OR_NULL (clk_data->clks[ff->id])) +continue ; + clk =clk_register_fixed_factor (NULL , ff->name, ff->parent_name,CLK_SET_RATE_PARENT , ff->mult, ff->div);
@@ -116,6 +122,9 @@ int mtk_clk_register_gates(struct device_node *node,for (i =0 ; i < num; i++) {const struct mtk_gate *gate = &clks[i]; +if (!IS_ERR_OR_NULL (clk_data->clks[gate->id])) +continue ; + clk = mtk_clk_register_gate(gate->name, gate->parent_name, regmap, gate->regs->set_ofs,
@@ -232,6 +241,9 @@ void mtk_clk_register_composites(const struct mtk_composite *mcs,for (i =0 ; i < num; i++) {const struct mtk_composite *mc = &mcs[i]; +if (!IS_ERR_OR_NULL (clk_data->clks[mc->id])) +continue ; + clk =mtk_clk_register_composite (mc, base, lock);if (IS_ERR (clk)) {
@@ -244,3 +256,31 @@ void mtk_clk_register_composites(const struct mtk_composite *mcs, clk_data->clks[mc->id] = clk; } } + +void mtk_clk_register_dividers (const struct mtk_clk_divider *mcds, +int num,void __iomem *base,spinlock_t *lock, +struct clk_onecell_data *clk_data) +{ +struct clk *clk; +int i; + +for (i =0 ; i < num; i++) { +const struct mtk_clk_divider *mcd = &mcds[i]; + +if (!IS_ERR_OR_NULL (clk_data->clks[mcd->id])) +continue ; + + clk =clk_register_divider (NULL , mcd->name, mcd->parent_name, + mcd->flags, base + mcd->div_reg, mcd->div_shift, + mcd->div_width, mcd->clk_divider_flags, lock); + +if (IS_ERR (clk)) { +pr_err ("Failed to register clk %s: %ld\n" , + mcd->name,PTR_ERR (clk)); +continue ; + } + +if (clk_data) + clk_data->clks[mcd->id] = clk; + } +}
drivers/clk/mediatek/clk-mtk.h +36 -5
69 lines not on this page · raw message
drivers/clk/mediatek/clk-pll.c +1 -0
@@ -301,6 +301,7 @@ static struct clk *mtk_clk_register_pll(const struct mtk_pll_data *data, pll->data = data; init.name = data->name; + init.flags = (data->flags &PLL_AO ) ?CLK_IS_CRITICAL :0 ; init.ops = &mtk_pll_ops; init.parent_names = &parent_name; init.num_parents =1 ;
Signature · 1 line
1.9.1
Re: [PATCH v11 5/9] clk: mediatek: Add MT2701 clock support
drivers/clk/mediatek/clk-mt2701-vdec.c line 58
Quoted 12 lines · Erin Lo
drivers/clk/mediatek/clk-mt2701-vdec.c new file +7
-0+ +static const struct mtk_gate vdec_clks[] = { +GATE_VDEC0 (CLK_VDEC_CKGEN ,"vdec_cken" ,"vdec_sel" ,0 ), +GATE_VDEC1 (CLK_VDEC_LARB ,"vdec_larb_cken" ,"mm_sel" ,0 ), +}; + +static void mtk_vdecsys_init (struct device_node *node)
Please return errors to driver probe.
Quoted 14 lines
drivers/clk/mediatek/clk-mt2701-vdec.c new file +14
-0+{ +struct clk_onecell_data *clk_data; +int r; + + 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_provider (node, of_clk_src_onecell_get, clk_data); +if (r) +pr_err ("%s(): could not register clock provider: %d\n" , + __func__, r); +}
drivers/clk/mediatek/clk-mt2701-vdec.c line 82
Quoted 10 lines
drivers/clk/mediatek/clk-mt2701-vdec.c new file +10
-0+ +static const struct of_device_id of_match_clk_mt2701_vdec[] = { + { .compatible ="mediatek,mt2701-vdecsys" , }, + {} +}; + +static int clk_mt2701_vdec_probe (struct platform_device *pdev) +{ +mtk_vdecsys_init (pdev->dev.of_node); +return 0 ;
return mtk_vdecsys_init()?
Quoted 28 lines
drivers/clk/mediatek/clk-mt2701-vdec.c new file +2
-0+} +drivers/clk/mediatek/clk-mt2701.c new file +20
-0@@ -0,0 +1,1033 @@ +/* +* Copyright (c) 2014 MediaTek Inc. +* Author: Shunli Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/clk-provider.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/platform_device.h> + +#include "clk-mtk.h"
drivers/clk/mediatek/clk-mt2701.c line 30
Quoted 10 lines
drivers/clk/mediatek/clk-mt2701.c new file +10
-0+#include "clk-gate.h" + +#include <dt-bindings/clock/mt2701-clk.h> + +/* +* For some clocks, we don't care what their actual rates are. And these +* clocks may change their rate on different products or different scenarios. +* So we model these clocks' rate as 0, to denote it's not an actual rate. +*/ +#define DUMMY_RATE 0
This doesn't sound great... Wouldn't we want to get those rates from the dts files then?
drivers/clk/mediatek/clk-mt2701.c line 32
Quoted 2 lines
drivers/clk/mediatek/clk-mt2701.c new file +2
-0+ +static DEFINE_SPINLOCK (lock);
Please use a better name than lock. mtk2701_clk_lock?
drivers/clk/mediatek/clk-mt2701.c line 1004
Quoted 4 lines
drivers/clk/mediatek/clk-mt2701.c new file +4
-0+ +static int clk_mt2701_probe (struct platform_device *pdev) +{ +void (*clk_init)(struct device_node *);
Please return errors from clk_init() callbacks.
drivers/clk/mediatek/clk-mt2701.c line 1008
Quoted 4 lines
drivers/clk/mediatek/clk-mt2701.c new file +4
-0+const struct of_device_id *of_id; + +pr_warn ("%s():%d: %s\n" , __func__, __LINE__, pdev->name); +
This is noise, please remove.
drivers/clk/mediatek/clk-mt2701.c line 1011
Quoted 3 lines
drivers/clk/mediatek/clk-mt2701.c new file +3
-0+ of_id =of_match_node (of_match_clk_mt2701, pdev->dev.of_node); +if (!of_id || !of_id->data) +return -EINVAL ;
We can use of_device_get_match_data() here to simplify things.
drivers/clk/mediatek/clk-mt2701.c line 1023
Quoted 12 lines
drivers/clk/mediatek/clk-mt2701.c new file +12
-0+ + clk_init = of_id->data; +clk_init (pdev->dev.of_node); + +return 0 ; +} + +static struct platform_driver clk_mt2701_drv = { + .probe = clk_mt2701_probe, + .driver = { + .name ="clk-mt2701" , + .owner =THIS_MODULE ,
This isn't needed because of how platform_driver_register() works.
Quoted 21 lines
drivers/clk/mediatek/clk-mt2701.c new file +10
-0+ .of_match_table = of_match_clk_mt2701, + }, +}; + +static int __init clk_mt2701_init (void ) +{ +return platform_driver_register (&clk_mt2701_drv); +} + +arch_initcall (clk_mt2701_init);drivers/clk/mediatek/clk-mtk.c +3
-0@@ -244,3 +256,31 @@ void mtk_clk_register_composites(const struct mtk_composite *mcs, clk_data->clks[mc->id] = clk; } } + +void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, + int num, void __iomem *base, spinlock_t *lock,
drivers/clk/mediatek/clk-mtk.c void mtk_clk_register_composites(const struct mtk_composite *mcs, · line 271
Quoted 10 lines
drivers/clk/mediatek/clk-mtk.c +10
-0+ struct clk_onecell_data *clk_data) +{ +struct clk *clk; +int i; + +for (i =0 ; i < num; i++) { +const struct mtk_clk_divider *mcd = &mcds[i]; + +if (!IS_ERR_OR_NULL (clk_data->clks[mcd->id])) +continue ;
We dereference clk_data here...
drivers/clk/mediatek/clk-mtk.c void mtk_clk_register_composites(const struct mtk_composite *mcs, · line 283
Quoted 12 lines
drivers/clk/mediatek/clk-mtk.c +12
-0+ + clk =clk_register_divider (NULL , mcd->name, mcd->parent_name, + mcd->flags, base + mcd->div_reg, mcd->div_shift, + mcd->div_width, mcd->clk_divider_flags, lock); + +if (IS_ERR (clk)) { +pr_err ("Failed to register clk %s: %ld\n" , + mcd->name,PTR_ERR (clk)); +continue ; + } + +if (clk_data)
But then we check it for NULL here? This happens quite often now after this patch.
Quoted 3 lines
drivers/clk/mediatek/clk-mtk.c +3
-0+ clk_data->clks[mcd->id] = clk; + } +}
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v11 6/9 reset: mediatek: Add MT2701 reset controller dt-binding file
In reply to Erin LoFrom: Shunli Wang <[email protected]>
Dt-binding file about reset controller is used to provide kinds of definition, which is referenced by dts file and IC-specified reset controller driver code.
--- include/dt-bindings/reset/mt2701-resets.h | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 include/dt-bindings/reset/mt2701-resets.h
include/dt-bindings/reset/mt2701-resets.h new file +83 -0
@@ -0,0 +1,83 @@ +/* +* Copyright (c) 2015 MediaTek, Shunli Wang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT2701 +#define _DT_BINDINGS_RESET_CONTROLLER_MT2701 + +/* INFRACFG resets */ +#define MT2701_INFRA_EMI_REG_RST 0 +#define MT2701_INFRA_DRAMC0_A0_RST 1 +#define MT2701_INFRA_FHCTL_RST 2 +#define MT2701_INFRA_APCIRQ_EINT_RST 3 +#define MT2701_INFRA_APXGPT_RST 4 +#define MT2701_INFRA_SCPSYS_RST 5 +#define MT2701_INFRA_KP_RST 6 +#define MT2701_INFRA_PMIC_WRAP_RST 7 +#define MT2701_INFRA_MIPI_RST 8 +#define MT2701_INFRA_IRRX_RST 9 +#define MT2701_INFRA_CEC_RST 10 +#define MT2701_INFRA_EMI_RST 32 +#define MT2701_INFRA_DRAMC0_RST 34 +#define MT2701_INFRA_TRNG_RST 37 +#define MT2701_INFRA_SYSIRQ_RST 38 + +/* PERICFG resets */ +#define MT2701_PERI_UART0_SW_RST 0 +#define MT2701_PERI_UART1_SW_RST 1 +#define MT2701_PERI_UART2_SW_RST 2 +#define MT2701_PERI_UART3_SW_RST 3 +#define MT2701_PERI_GCPU_SW_RST 5 +#define MT2701_PERI_BTIF_SW_RST 6 +#define MT2701_PERI_PWM_SW_RST 8 +#define MT2701_PERI_AUXADC_SW_RST 10 +#define MT2701_PERI_DMA_SW_RST 11 +#define MT2701_PERI_NFI_SW_RST 14 +#define MT2701_PERI_NLI_SW_RST 15 +#define MT2701_PERI_THERM_SW_RST 16 +#define MT2701_PERI_MSDC2_SW_RST 17 +#define MT2701_PERI_MSDC0_SW_RST 19 +#define MT2701_PERI_MSDC1_SW_RST 20 +#define MT2701_PERI_I2C0_SW_RST 22 +#define MT2701_PERI_I2C1_SW_RST 23 +#define MT2701_PERI_I2C2_SW_RST 24 +#define MT2701_PERI_I2C3_SW_RST 25 +#define MT2701_PERI_USB_SW_RST 28 +#define MT2701_PERI_ETH_SW_RST 29 +#define MT2701_PERI_SPI0_SW_RST 33 + +/* TOPRGU resets */ +#define MT2701_TOPRGU_INFRA_RST 0 +#define MT2701_TOPRGU_MM_RST 1 +#define MT2701_TOPRGU_MFG_RST 2 +#define MT2701_TOPRGU_ETHDMA_RST 3 +#define MT2701_TOPRGU_VDEC_RST 4 +#define MT2701_TOPRGU_VENC_IMG_RST 5 +#define MT2701_TOPRGU_DDRPHY_RST 6 +#define MT2701_TOPRGU_MD_RST 7 +#define MT2701_TOPRGU_INFRA_AO_RST 8 +#define MT2701_TOPRGU_CONN_RST 9 +#define MT2701_TOPRGU_APMIXED_RST 10 +#define MT2701_TOPRGU_HIFSYS_RST 11 +#define MT2701_TOPRGU_CONN_MCU_RST 12 +#define MT2701_TOPRGU_BDP_DISP_RST 13 + +/* HIFSYS resets */ +#define MT2701_HIFSYS_UHOST0_RST 3 +#define MT2701_HIFSYS_UHOST1_RST 4 +#define MT2701_HIFSYS_UPHY0_RST 21 +#define MT2701_HIFSYS_UPHY1_RST 22 +#define MT2701_HIFSYS_PCIE0_RST 24 +#define MT2701_HIFSYS_PCIE1_RST 25 +#define MT2701_HIFSYS_PCIE2_RST 26 + +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT2701 */
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH v11 6/9] reset: mediatek: Add MT2701 reset controller dt-binding file
Quoted 6 lines · Erin Lo
From: Shunli Wang <[email protected]>
Dt-binding file about reset controller is used to provide kinds of definition, which is referenced by dts file and IC-specified reset controller driver code.
Quoted 6 lines
Signed-off-by Shunli Wang <[email protected]>Signed-off-by James Liao <[email protected]>Signed-off-by Erin Lo <[email protected]>Tested-by John Crispin <[email protected]>Acked-by Philipp Zabel <[email protected]>---
Applied to clk-next
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v11 7/9 reset: mediatek: Add MT2701 reset driver
In reply to Erin LoFrom: Shunli Wang <[email protected]>
In infrasys and perifsys, there are many reset control bits for kinds of modules. These bits are used as actual reset controllers to be registered into kernel's generic reset controller framework.
--- drivers/clk/mediatek/clk-mt2701-hif.c | 2 ++ drivers/clk/mediatek/clk-mt2701.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/clk/mediatek/clk-mt2701-hif.c +2 -0
@@ -55,6 +55,8 @@ static void mtk_hifsys_init(struct device_node *node)if (r)pr_err ("%s(): could not register clock provider: %d\n" , __func__, r); + +mtk_register_reset_controller (node,1 ,0x34 ); }static const struct of_device_id of_match_clk_mt2701_hif[] = {
drivers/clk/mediatek/clk-mt2701.c +4 -0
@@ -791,6 +791,8 @@ static void mtk_infrasys_init(struct device_node *node)if (r)pr_err ("%s(): could not register clock provider: %d\n" , __func__, r); + +mtk_register_reset_controller (node,2 ,0x30 ); }static const struct mtk_gate_regs peri0_cg_regs = {
@@ -911,6 +913,8 @@ static void mtk_pericfg_init(struct device_node *node)if (r)pr_err ("%s(): could not register clock provider: %d\n" , __func__, r); + +mtk_register_reset_controller (node,2 ,0x0 ); }#define MT8590_PLL_FMAX (2000 * MHZ)
Signature · 1 line
1.9.1
PATCH v11 8/9 arm: dts: mt2701: Add clock controller device nodes
In reply to Erin LoFrom: James Liao <[email protected]>
Add clock controller nodes for MT2701, include topckgen, infracfg, pericfg, apmixedsys, mmsys, imgsys, vdecsys, hifsys, ethsys and bdpsys. This patch also add two oscillators that provide clocks for MT2701.
--- arch/arm/boot/dts/mt2701.dtsi | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm/boot/dts/mt2701.dtsi +42 -0
@@ -12,8 +12,10 @@ * GNU General Public License for more details. */ +#include <dt-bindings/clock/mt2701-clk.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/reset/mt2701-resets.h> #include "skeleton64.dtsi" #include "mt2701-pinfunc.h"
@@ -77,6 +79,20 @@ #clock-cells = <0>; }; + clk26m: oscillator at 0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <26000000>; + clock-output-names = "clk26m"; + }; + + rtc32k: oscillator at 1 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32000>; + clock-output-names = "rtc32k"; + }; + timer { compatible = "arm,armv7-timer"; interrupt-parent = <&gic>;
@@ -104,6 +120,26 @@ reg = <0 0x10005000 0 0x1000>; }; + topckgen: syscon at 10000000 { + compatible = "mediatek,mt2701-topckgen", "syscon"; + reg = <0 0x10000000 0 0x1000>; + #clock-cells = <1>; + }; + + infracfg: syscon at 10001000 { + compatible = "mediatek,mt2701-infracfg", "syscon"; + reg = <0 0x10001000 0 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + pericfg: syscon at 10003000 { + compatible = "mediatek,mt2701-pericfg", "syscon"; + reg = <0 0x10003000 0 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + watchdog: watchdog at 10007000 { compatible = "mediatek,mt2701-wdt", "mediatek,mt6589-wdt";
@@ -128,6 +164,12 @@ reg = <0 0x10200100 0 0x1c>; }; + apmixedsys: syscon at 10209000 { + compatible = "mediatek,mt2701-apmixedsys", "syscon"; + reg = <0 0x10209000 0 0x1000>; + #clock-cells = <1>; + }; + gic: interrupt-controller at 10211000 { compatible = "arm,cortex-a7-gic"; interrupt-controller;
Signature · 1 line
1.9.1
PATCH v11 9/9 arm: dts: mt2701: Use real clock for UARTs
In reply to Erin LoWe used to use a fixed rate clock for the UARTs. Now that we have clock support we can associate the correct clocks to the UARTs and drop the 26MHz fixed rate UART clock.
--- arch/arm/boot/dts/mt2701.dtsi | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
arch/arm/boot/dts/mt2701.dtsi +8 -10
@@ -73,12 +73,6 @@ #clock-cells = <0>; }; - uart_clk: dummy26m { - compatible = "fixed-clock"; - clock-frequency = <26000000>; - #clock-cells = <0>; - }; - clk26m: oscillator at 0 { compatible = "fixed-clock"; #clock-cells = <0>;
@@ -186,7 +180,8 @@ "mediatek,mt6577-uart"; reg = <0 0x11002000 0 0x400>; interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_LOW>; - clocks = <&uart_clk>; + clocks = <&pericfg CLK_PERI_UART0_SEL>, <&pericfg CLK_PERI_UART0>; + clock-names = "baud", "bus"; status = "disabled"; };
@@ -195,7 +190,8 @@ "mediatek,mt6577-uart"; reg = <0 0x11003000 0 0x400>; interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_LOW>; - clocks = <&uart_clk>; + clocks = <&pericfg CLK_PERI_UART1_SEL>, <&pericfg CLK_PERI_UART1>; + clock-names = "baud", "bus"; status = "disabled"; };
@@ -204,7 +200,8 @@ "mediatek,mt6577-uart"; reg = <0 0x11004000 0 0x400>; interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_LOW>; - clocks = <&uart_clk>; + clocks = <&pericfg CLK_PERI_UART2_SEL>, <&pericfg CLK_PERI_UART2>; + clock-names = "baud", "bus"; status = "disabled"; };
@@ -213,7 +210,8 @@ "mediatek,mt6577-uart"; reg = <0 0x11005000 0 0x400>; interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_LOW>; - clocks = <&uart_clk>; + clocks = <&pericfg CLK_PERI_UART3_SEL>, <&pericfg CLK_PERI_UART3>; + clock-names = "baud", "bus"; status = "disabled"; }; };
Signature · 1 line
1.9.1