Add Basic SoC support for MT6797
Subsystems (5)
v3 cover Add Basic SoC support for MT6797
This patch set adds basic SoC support for mediatek's first 10-core chip, X20, also known as MT6797.
- based on 4.11-rc1
- support multiple base address for sysirq
- support common clk framework
Changes since v2:
- prevent uncessary #intpol-bases for mtk-sysirq
- add fast path for mtk-sysirq set_type when introducing multiple bases
- add acked-by and tested-by
- remove wrong usage for timer node
Changes since v1:
- add multiple base addresses support, v1 only allow 2 bases
- clean up clk driver
Kevin-CW Chen (2):
dt-bindings: arm: mediatek: document clk bindings for MT6797
clk: mediatek: add clk support for MT6797
Mars Cheng (10):
dt-bindings: mediatek: multiple bases support for sysirq
irqchip: mtk-sysirq: extend intpol base to arbitrary number
irqchip: mtk-sysirq: prevent unnecessary visibility when set_type
dt-bindings: mediatek: Add bindings for mediatek MT6797 Platform
arm64: dts: mediatek: add mt6797 support
soc: mediatek: avoid using fixed spm power status defines
soc: mediatek: add vdec item for scpsys
dt-bindings: mediatek: add MT6797 power dt-bindings
soc: mediatek: add MT6797 scysys support
arm64: dts: mediatek: add clk and scp nodes for MT6797
Documentation/devicetree/bindings/arm/mediatek.txt | 4 + .../bindings/arm/mediatek/mediatek,apmixedsys.txt | 1 + .../bindings/arm/mediatek/mediatek,imgsys.txt | 1 + .../bindings/arm/mediatek/mediatek,infracfg.txt | 1 + .../bindings/arm/mediatek/mediatek,mmsys.txt | 1 + .../bindings/arm/mediatek/mediatek,topckgen.txt | 1 + .../bindings/arm/mediatek/mediatek,vdecsys.txt | 1 + .../bindings/arm/mediatek/mediatek,vencsys.txt | 3 +- .../interrupt-controller/mediatek,sysirq.txt | 12 +- .../devicetree/bindings/serial/mtk-uart.txt | 1 + .../devicetree/bindings/soc/mediatek/scpsys.txt | 6 +- arch/arm64/boot/dts/mediatek/Makefile | 1 + arch/arm64/boot/dts/mediatek/mt6797-evb.dts | 36 + arch/arm64/boot/dts/mediatek/mt6797.dtsi | 245 +++++++ drivers/clk/mediatek/Kconfig | 32 + drivers/clk/mediatek/Makefile | 5 + drivers/clk/mediatek/clk-mt6797-img.c | 76 +++ drivers/clk/mediatek/clk-mt6797-mm.c | 136 ++++ drivers/clk/mediatek/clk-mt6797-vdec.c | 93 +++ drivers/clk/mediatek/clk-mt6797-venc.c | 78 +++ drivers/clk/mediatek/clk-mt6797.c | 716 ++++++++++++++++++++ drivers/irqchip/irq-mtk-sysirq.c | 116 +++- drivers/soc/mediatek/mtk-scpsys.c | 149 +++- include/dt-bindings/clock/mt6797-clk.h | 281 ++++++++ include/dt-bindings/power/mt6797-power.h | 30 + 25 files changed, 1993 insertions(+), 33 deletions(-) create mode 100644 arch/arm64/boot/dts/mediatek/mt6797-evb.dts create mode 100644 arch/arm64/boot/dts/mediatek/mt6797.dtsi create mode 100644 drivers/clk/mediatek/clk-mt6797-img.c create mode 100644 drivers/clk/mediatek/clk-mt6797-mm.c create mode 100644 drivers/clk/mediatek/clk-mt6797-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt6797-venc.c create mode 100644 drivers/clk/mediatek/clk-mt6797.c create mode 100644 include/dt-bindings/clock/mt6797-clk.h create mode 100644 include/dt-bindings/power/mt6797-power.h
--
1.7.9.5
PATCH v3 1/12 dt-bindings: mediatek: multiple bases support for sysirq
This describes how to specify multiple base addresses for sysirq in mediatek platforms.
--- .../interrupt-controller/mediatek,sysirq.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt +7 -4
@@ -21,13 +21,16 @@ Required properties: - interrupt-parent: phandle of irq parent for sysirq. The parent must use the same interrupt-cells format as GIC. - reg: Physical base address of the intpol registers and length of memory - mapped region. + mapped region. Could be multiple bases here. Ex: mt6797 needs 2 reg, others + need 1. Example: - sysirq: interrupt-controller@10200100 { - compatible = "mediatek,mt6589-sysirq", "mediatek,mt6577-sysirq"; + sysirq: intpol-controller@10200620 { + compatible = "mediatek,mt6797-sysirq", + "mediatek,mt6577-sysirq"; interrupt-controller; #interrupt-cells = <3>; interrupt-parent = <&gic>; - reg = <0 0x10200100 0 0x1c>; + reg = <0 0x10220620 0 0x20>, + <0 0x10220690 0 0x10>; };
Signature · 1 line
1.7.9.5
Re: [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq
Quoted 7 lines · Mars Cheng
This describes how to specify multiple base addresses for sysirq in mediatek platforms.
Signed-off-by Mars Cheng <[email protected]>--- .../interrupt-controller/mediatek,sysirq.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Re: [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq
Quoted 11 lines · Rob Herring
Quoted 7 lines · Mars Cheng
This describes how to specify multiple base addresses for sysirq in mediatek platforms.
Signed-off-by Mars Cheng <[email protected]>--- .../interrupt-controller/mediatek,sysirq.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)Acked-by Rob Herring <[email protected]>
Thanks Rob. I've queued patches 1-3 for 4.12.
Cheers,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
PATCH v3 2/12 irqchip: mtk-sysirq: extend intpol base to arbitrary number
In reply to Mars ChengOriginally driver only supports one base. However, MT6797 has more than one bases to configure interrupt polarity. To support possible design change, here comes a solution to use arbitrary number of bases.
--- drivers/irqchip/irq-mtk-sysirq.c | 116 +++++++++++++++++++++++++++++++------- 1 file changed, 95 insertions(+), 21 deletions(-)
drivers/irqchip/irq-mtk-sysirq.c +95 -21
@@ -24,22 +24,29 @@struct mtk_sysirq_chip_data {spinlock_t lock; -void __iomem *intpol_base; +u32 nr_intpol_bases; +void __iomem **intpol_bases; +u32 *intpol_words; +u8 *intpol_idx; +u16 *which_word; };static int mtk_sysirq_set_type (struct irq_data *data,unsigned int type) {irq_hw_number_t hwirq = data->hwirq;struct mtk_sysirq_chip_data *chip_data = data->chip_data; +u8 intpol_idx = chip_data->intpol_idx[hwirq]; +void __iomem *base;u32 offset, reg_index, value;unsigned long flags;int ret; + base = chip_data->intpol_bases[intpol_idx]; + reg_index = chip_data->which_word[hwirq]; offset = hwirq &0x1f ; - reg_index = hwirq >>5 ;spin_lock_irqsave (&chip_data->lock, flags); - value =readl_relaxed (chip_data->intpol_base + reg_index *4 ); + value =readl_relaxed (base + reg_index *4 );if (type ==IRQ_TYPE_LEVEL_LOW || type ==IRQ_TYPE_EDGE_FALLING ) {if (type ==IRQ_TYPE_LEVEL_LOW ) type =IRQ_TYPE_LEVEL_HIGH ;
@@ -49,7 +56,8 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) }else { value &= ~(1 << offset); } -writel (value, chip_data->intpol_base + reg_index *4 ); + +writel (value, base + reg_index *4 ); data = data->parent_data; ret = data->chip->irq_set_type (data, type);
@@ -124,8 +132,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, {struct irq_domain *domain, *domain_parent;struct mtk_sysirq_chip_data *chip_data; -int ret, size, intpol_num; -struct resource res; +int ret, size, intpol_num =0 , nr_intpol_bases =0 , i =0 ; domain_parent =irq_find_host (parent);if (!domain_parent) {
@@ -133,36 +140,103 @@ static int __init mtk_sysirq_of_init(struct device_node *node,return -EINVAL ; } - ret =of_address_to_resource (node,0 , &res); -if (ret) -return ret; - chip_data =kzalloc (sizeof (*chip_data),GFP_KERNEL );if (!chip_data)return -ENOMEM ; - size =resource_size (&res); - intpol_num = size *8 ; - chip_data->intpol_base =ioremap (res.start, size); -if (!chip_data->intpol_base) { -pr_err ("mtk_sysirq: unable to map sysirq register\n" ); - ret = -ENXIO ; - goto out_free; +while (of_get_address (node, i++,NULL ,NULL )) + nr_intpol_bases++; + +if (nr_intpol_bases ==0 ) { +pr_err ("mtk_sysirq: base address not specified\n" ); + ret = -EINVAL ; + goto out_free_chip; + } + + chip_data->intpol_words =kcalloc (nr_intpol_bases, +sizeof (*chip_data->intpol_words), +GFP_KERNEL ); +if (!chip_data->intpol_words) { + ret = -ENOMEM ; + goto out_free_chip; + } + + chip_data->intpol_bases =kcalloc (nr_intpol_bases, +sizeof (*chip_data->intpol_bases), +GFP_KERNEL ); +if (!chip_data->intpol_bases) { + ret = -ENOMEM ; + goto out_free_intpol_words; + } + +for (i =0 ; i < nr_intpol_bases; i++) { +struct resource res; + + ret =of_address_to_resource (node, i, &res); + size =resource_size (&res); + intpol_num += size *8 ; + chip_data->intpol_words[i] = size /4 ; + chip_data->intpol_bases[i] =of_iomap (node, i); +if (ret || !chip_data->intpol_bases[i]) { +pr_err ("%s: couldn't map region %d\n" , + node->full_name, i); + ret = -ENODEV ; + goto out_free_intpol; + } + } + + chip_data->intpol_idx =kcalloc (intpol_num, +sizeof (*chip_data->intpol_idx), +GFP_KERNEL ); +if (!chip_data->intpol_idx) { + ret = -ENOMEM ; + goto out_free_intpol; + } + + chip_data->which_word =kcalloc (intpol_num, +sizeof (*chip_data->which_word), +GFP_KERNEL ); +if (!chip_data->which_word) { + ret = -ENOMEM ; + goto out_free_intpol_idx; + } + +/* +* assign an index of the intpol_bases for each irq +* to set it fast later +*/ +for (i =0 ; i < intpol_num ; i++) { +u32 word = i /32 , j; + +for (j =0 ; word >= chip_data->intpol_words[j] ; j++) + word -= chip_data->intpol_words[j]; + + chip_data->intpol_idx[i] = j; + chip_data->which_word[i] = word; } domain =irq_domain_add_hierarchy (domain_parent,0 , intpol_num, node, &sysirq_domain_ops, chip_data);if (!domain) { ret = -ENOMEM ; - goto out_unmap; + goto out_free_which_word; }spin_lock_init (&chip_data->lock);return 0 ; -out_unmap: -iounmap (chip_data->intpol_base); -out_free: +out_free_which_word: +kfree (chip_data->which_word); +out_free_intpol_idx: +kfree (chip_data->intpol_idx); +out_free_intpol: +for (i =0 ; i < nr_intpol_bases; i++) +if (chip_data->intpol_bases[i]) +iounmap (chip_data->intpol_bases[i]); +kfree (chip_data->intpol_bases); +out_free_intpol_words: +kfree (chip_data->intpol_words); +out_free_chip:kfree (chip_data);return ret; }
Signature · 1 line
1.7.9.5
Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number
Quoted 6 lines · Mars Cheng
Originally driver only supports one base. However, MT6797 has more than one bases to configure interrupt polarity. To support possible design change, here comes a solution to use arbitrary number of bases.
Signed-off-by Mars Cheng <[email protected]>
What is the merge strategy for this? I'm happy to take the irqchip stuff through my tree, but there is much more in this series...
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number
Quoted 6 lines · Marc Zyngier
Quoted 5 lines · Mars Cheng
Originally driver only supports one base. However, MT6797 has more than one bases to configure interrupt polarity. To support possible design change, here comes a solution to use arbitrary number of bases.
Quoted 7 lines
Quoted 1 line
Signed-off-by Mars Cheng <[email protected]>Acked-by Marc Zyngier <[email protected]>What is the merge strategy for this? I'm happy to take the irqchip stuff through my tree, but there is much more in this series...
Hi Marc
Thanks for your review.
Hi Matthias
Would you comment on this? If Marc take the following stuff first in his tree:
[PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq
[PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number
[PATCH v3 03/12] irqchip: mtk-sysirq: prevent unnecessary visibility when set_type
Since other stuff might need more review and irqchip didn't affect them.
Thanks.
Quoted 3 lines
Thanks,
M.
Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number
Quoted 18 lines · Mars Cheng
Quoted 6 lines · Marc Zyngier
Quoted 5 lines · Mars Cheng
Originally driver only supports one base. However, MT6797 has more than one bases to configure interrupt polarity. To support possible design change, here comes a solution to use arbitrary number of bases.
Quoted 7 lines
Quoted 1 line
Signed-off-by Mars Cheng <[email protected]>Acked-by Marc Zyngier <[email protected]>What is the merge strategy for this? I'm happy to take the irqchip stuff through my tree, but there is much more in this series...
Hi Marc
Thanks for your review.
Quoted 7 lines
Hi Matthias
Would you comment on this? If Marc take the following stuff first in his tree:
[PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq
Before taking this patch, I still need one of the DT maintainer to ack the binding extension.
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
PATCH v3 3/12 irqchip: mtk-sysirq: prevent unnecessary visibility when set_type
In reply to Mars ChengThis prevent unnecessary visibility when configuring trigger type
--- drivers/irqchip/irq-mtk-sysirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-mtk-sysirq.c +1 -1
@@ -57,7 +57,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) value &= ~(1 << offset); } -writel (value, base + reg_index *4 ); +writel_relaxed (value, base + reg_index *4 ); data = data->parent_data; ret = data->chip->irq_set_type (data, type);
Signature · 1 line
1.7.9.5
Re: [PATCH v3 03/12] irqchip: mtk-sysirq: prevent unnecessary visibility when set_type
Quoted 3 lines · Mars Cheng
This prevent unnecessary visibility when configuring trigger type
Signed-off-by Mars Cheng <[email protected]>
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
PATCH v3 4/12 dt-bindings: mediatek: Add bindings for mediatek MT6797 Platform
In reply to Mars ChengThis adds dt-binding documentation for Mediatek MT6797. Only include very basic items, gic, uart timer and cpu.
--- Documentation/devicetree/bindings/arm/mediatek.txt | 4 ++++ .../interrupt-controller/mediatek,sysirq.txt | 1 + .../devicetree/bindings/serial/mtk-uart.txt | 1 + 3 files changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/mediatek.txt +4 -0
@@ -12,6 +12,7 @@ compatible: Must contain one of "mediatek,mt6592" "mediatek,mt6755" "mediatek,mt6795" + "mediatek,mt6797" "mediatek,mt7623" "mediatek,mt8127" "mediatek,mt8135"
@@ -38,6 +39,9 @@ Supported boards: - Evaluation board for MT6795(Helio X10): Required root node properties: - compatible = "mediatek,mt6795-evb", "mediatek,mt6795"; +- Evaluation board for MT6797(Helio X20): + Required root node properties: + - compatible = "mediatek,mt6797-evb", "mediatek,mt6797"; - Evaluation board for MT7623: Required root node properties: - compatible = "mediatek,mt7623-evb", "mediatek,mt7623";
Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt +1 -0
@@ -9,6 +9,7 @@ Required properties: "mediatek,mt8135-sysirq" "mediatek,mt8127-sysirq" "mediatek,mt6795-sysirq" + "mediatek,mt6797-sysirq" "mediatek,mt6755-sysirq" "mediatek,mt6592-sysirq" "mediatek,mt6589-sysirq"
Documentation/devicetree/bindings/serial/mtk-uart.txt +1 -0
@@ -8,6 +8,7 @@ Required properties: * "mediatek,mt6589-uart" for MT6589 compatible UARTS * "mediatek,mt6755-uart" for MT6755 compatible UARTS * "mediatek,mt6795-uart" for MT6795 compatible UARTS + * "mediatek,mt6797-uart" for MT6797 compatible UARTS * "mediatek,mt7623-uart" for MT7623 compatible UARTS * "mediatek,mt8127-uart" for MT8127 compatible UARTS * "mediatek,mt8135-uart" for MT8135 compatible UARTS
Signature · 1 line
1.7.9.5
PATCH v3 5/12 arm64: dts: mediatek: add mt6797 support
In reply to Mars ChengThis adds basic chip support for MT6797 SoC.
--- arch/arm64/boot/dts/mediatek/Makefile | 1 + arch/arm64/boot/dts/mediatek/mt6797-evb.dts | 36 ++++++ arch/arm64/boot/dts/mediatek/mt6797.dtsi | 182 +++++++++++++++++++++++++++ 3 files changed, 219 insertions(+) create mode 100644 arch/arm64/boot/dts/mediatek/mt6797-evb.dts create mode 100644 arch/arm64/boot/dts/mediatek/mt6797.dtsi
arch/arm64/boot/dts/mediatek/Makefile +1 -0
@@ -1,5 +1,6 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6755-evb.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt6795-evb.dtb +dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-evb.dtb dtb-$(CONFIG_ARCH_MEDIATEK) += mt8173-evb.dtb always := $(dtb-y)
arch/arm64/boot/dts/mediatek/mt6797-evb.dts new file +36 -0
@@ -0,0 +1,36 @@ +/* + * Copyright (c) 2017 MediaTek Inc. + * Author: Mars.C <[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. + */ + +/dts-v1/; +#include "mt6797.dtsi" + +/ { + model = "MediaTek MT6797 Evaluation Board"; + compatible = "mediatek,mt6797-evb", "mediatek,mt6797"; + + aliases { + serial0 = &uart0; + }; + + memory@40000000 { + device_type = "memory"; + reg = <0 0x40000000 0 0x1e800000>; + }; + + chosen {}; +}; + +&uart0 { + status = "okay"; +};
arch/arm64/boot/dts/mediatek/mt6797.dtsi new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 6/12 dt-bindings: arm: mediatek: document clk bindings for MT6797
In reply to Mars ChengFrom: Kevin-CW Chen <[email protected]>
This patch adds the binding documentation for apmixedsys, imgsys, infracfg, mmsys, topckgen, vdecsys and vencsys for MT6797.
--- .../bindings/arm/mediatek/mediatek,apmixedsys.txt | 1 + .../bindings/arm/mediatek/mediatek,imgsys.txt | 1 + .../bindings/arm/mediatek/mediatek,infracfg.txt | 1 + .../bindings/arm/mediatek/mediatek,mmsys.txt | 1 + .../bindings/arm/mediatek/mediatek,topckgen.txt | 1 + .../bindings/arm/mediatek/mediatek,vdecsys.txt | 1 + .../bindings/arm/mediatek/mediatek,vencsys.txt | 3 ++- 7 files changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt +1 -0
@@ -7,6 +7,7 @@ Required Properties: - compatible: Should be one of: - "mediatek,mt2701-apmixedsys" + - "mediatek,mt6797-apmixedsys" - "mediatek,mt8135-apmixedsys" - "mediatek,mt8173-apmixedsys" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,imgsys.txt +1 -0
@@ -7,6 +7,7 @@ Required Properties: - compatible: Should be one of: - "mediatek,mt2701-imgsys", "syscon" + - "mediatek,mt6797-imgsys", "syscon" - "mediatek,mt8173-imgsys", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt +1 -0
@@ -8,6 +8,7 @@ Required Properties: - compatible: Should be one of: - "mediatek,mt2701-infracfg", "syscon" + - "mediatek,mt6797-infracfg", "syscon" - "mediatek,mt8135-infracfg", "syscon" - "mediatek,mt8173-infracfg", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt +1 -0
@@ -7,6 +7,7 @@ Required Properties: - compatible: Should be one of: - "mediatek,mt2701-mmsys", "syscon" + - "mediatek,mt6797-mmsys", "syscon" - "mediatek,mt8173-mmsys", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt +1 -0
@@ -7,6 +7,7 @@ Required Properties: - compatible: Should be one of: - "mediatek,mt2701-topckgen" + - "mediatek,mt6797-topckgen" - "mediatek,mt8135-topckgen" - "mediatek,mt8173-topckgen" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,vdecsys.txt +1 -0
@@ -7,6 +7,7 @@ Required Properties: - compatible: Should be one of: - "mediatek,mt2701-vdecsys", "syscon" + - "mediatek,mt6797-vdecsys", "syscon" - "mediatek,mt8173-vdecsys", "syscon" - #clock-cells: Must be 1
Documentation/devicetree/bindings/arm/mediatek/mediatek,vencsys.txt +2 -1
@@ -5,7 +5,8 @@ The Mediatek vencsys controller provides various clocks to the system. Required Properties: -- compatible: Should be: +- compatible: Should be one of: + - "mediatek,mt6797-vencsys", "syscon" - "mediatek,mt8173-vencsys", "syscon" - #clock-cells: Must be 1
Signature · 1 line
1.7.9.5
PATCH v3 7/12 clk: mediatek: add clk support for MT6797
In reply to Mars ChengFrom: Kevin-CW Chen <[email protected]>
Add MT6797 clock support, include topckgen, apmixedsys, infracfg and subsystem clocks
--- drivers/clk/mediatek/Kconfig | 32 ++ drivers/clk/mediatek/Makefile | 5 + drivers/clk/mediatek/clk-mt6797-img.c | 76 ++++ drivers/clk/mediatek/clk-mt6797-mm.c | 136 ++++++ drivers/clk/mediatek/clk-mt6797-vdec.c | 93 +++++ drivers/clk/mediatek/clk-mt6797-venc.c | 78 ++++ drivers/clk/mediatek/clk-mt6797.c | 716 ++++++++++++++++++++++++++++++++ include/dt-bindings/clock/mt6797-clk.h | 281 +++++++++++++ 8 files changed, 1417 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt6797-img.c create mode 100644 drivers/clk/mediatek/clk-mt6797-mm.c create mode 100644 drivers/clk/mediatek/clk-mt6797-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt6797-venc.c create mode 100644 drivers/clk/mediatek/clk-mt6797.c create mode 100644 include/dt-bindings/clock/mt6797-clk.h
drivers/clk/mediatek/Kconfig +32 -0
@@ -50,6 +50,38 @@ config COMMON_CLK_MT2701_BDPSYS ---help--- This driver supports Mediatek MT2701 bdpsys clocks. +config COMMON_CLK_MT6797 + bool "Clock driver for Mediatek MT6797" + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST + select COMMON_CLK_MEDIATEK + default ARCH_MEDIATEK && ARM64 + ---help--- + This driver supports Mediatek MT6797 basic clocks. + +config COMMON_CLK_MT6797_MMSYS + bool "Clock driver for Mediatek MT6797 mmsys" + depends on COMMON_CLK_MT6797 + ---help--- + This driver supports Mediatek MT6797 mmsys clocks. + +config COMMON_CLK_MT6797_IMGSYS + bool "Clock driver for Mediatek MT6797 imgsys" + depends on COMMON_CLK_MT6797 + ---help--- + This driver supports Mediatek MT6797 imgsys clocks. + +config COMMON_CLK_MT6797_VDECSYS + bool "Clock driver for Mediatek MT6797 vdecsys" + depends on COMMON_CLK_MT6797 + ---help--- + This driver supports Mediatek MT6797 vdecsys clocks. + +config COMMON_CLK_MT6797_VENCSYS + bool "Clock driver for Mediatek MT6797 vencsys" + depends on COMMON_CLK_MT6797 + ---help--- + This driver supports Mediatek MT6797 vencsys clocks. + config COMMON_CLK_MT8135 bool "Clock driver for Mediatek MT8135" depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
drivers/clk/mediatek/Makefile +5 -0
@@ -1,5 +1,10 @@ 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_MT6797) += clk-mt6797.o +obj-$(CONFIG_COMMON_CLK_MT6797_IMGSYS) += clk-mt6797-img.o +obj-$(CONFIG_COMMON_CLK_MT6797_MMSYS) += clk-mt6797-mm.o +obj-$(CONFIG_COMMON_CLK_MT6797_VDECSYS) += clk-mt6797-vdec.o +obj-$(CONFIG_COMMON_CLK_MT6797_VENCSYS) += clk-mt6797-venc.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
drivers/clk/mediatek/clk-mt6797-img.c new file +76 -0
76 lines not on this page · raw message
drivers/clk/mediatek/clk-mt6797-mm.c new file +136 -0
136 lines not on this page · raw message
drivers/clk/mediatek/clk-mt6797-vdec.c new file +93 -0
93 lines not on this page · raw message
drivers/clk/mediatek/clk-mt6797-venc.c new file +78 -0
78 lines not on this page · raw message
drivers/clk/mediatek/clk-mt6797.c new file +716 -0
716 lines not on this page · raw message
include/dt-bindings/clock/mt6797-clk.h new file +281 -0
281 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v3 07/12] clk: mediatek: add clk support for MT6797
Quoted 8 lines · Mars Cheng
From: Kevin-CW Chen <[email protected]>
Add MT6797 clock support, include topckgen, apmixedsys, infracfg and subsystem clocks
Signed-off-by Kevin-CW Chen <[email protected]>Signed-off-by Mars Cheng <[email protected]>Tested-by Matthias Brugger <[email protected]>
Looks fine to me except for the one comment below. Did you want me to merge it into clk tree?
Quoted 11 lines
drivers/clk/mediatek/clk-mt6797.c new file +5
-0@@ -0,0 +1,716 @@ +/* +* Copyright (c) 2016 MediaTek Inc. +* Author: Kevin Chen <[email protected]> +* +* This program is free software; you can redistribute it and/or modify
drivers/clk/mediatek/clk-mt6797.c line 15
Quoted 10 lines
drivers/clk/mediatek/clk-mt6797.c new file +10
-0+* 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.h>
Is this include used? Please include clk-provider if the file is a clk driver. Same comment applies to other files in this patch.
Quoted 22 lines
drivers/clk/mediatek/clk-mt6797.c new file +22
-0+#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-mtk.h" +#include "clk-gate.h" + +#include <dt-bindings/clock/mt6797-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. +*/ + +static DEFINE_SPINLOCK (mt6797_clk_lock); + +static const struct mtk_fixed_factor top_fixed_divs[] = { +FACTOR (CLK_TOP_SYSPLL_CK ,"syspll_ck" ,"mainpll" ,1 ,1 ), +FACTOR (CLK_TOP_SYSPLL_D2 ,"syspll_d2" ,"mainpll" ,1 ,2 ), +FACTOR (CLK_TOP_SYSPLL1_D2 ,"syspll1_d2" ,"syspll_d2" ,1 ,2 ),
[...]
Quoted 8 lines
drivers/clk/mediatek/clk-mt6797.c new file +8
-0+ clk_init =of_device_get_match_data (&pdev->dev); +if (!clk_init) +return -EINVAL ; + + r =clk_init (pdev); +if (r) + dev_err(&pdev->dev, + "could not register clock provider: %s: %d\n",
drivers/clk/mediatek/clk-mt6797.c line 706
Quoted 10 lines
drivers/clk/mediatek/clk-mt6797.c new file +10
-0+ pdev->name, r); + +return r; +} + +static struct platform_driver clk_mt6797_drv = { + .probe = clk_mt6797_probe, + .driver = { + .name ="clk-mt6797" , + .owner =THIS_MODULE ,
This can be removed, platform_driver_register() does it already.
include/dt-bindings/clock/mt6797-clk.h
Quoted 16 lines
drivers/clk/mediatek/clk-mt6797.c new file +10
-0+ .of_match_table = of_match_clk_mt6797, + }, +}; + +static int __init clk_mt6797_init (void ) +{ +return platform_driver_register (&clk_mt6797_drv); +} + +arch_initcall (clk_mt6797_init);include/dt-bindings/clock/mt6797-clk.h new file +0
-0@@ -0,0 +1,281 @@
I think arm-soc folks don't want us merging whole drivers into the DT branch anymore, so please split off the dt-bindings header into a different patch that we can apply directly. Then we can layer the driver on top and just send off the header to arm-soc via a stable clk branch.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v3 07/12] clk: mediatek: add clk support for MT6797
Hi Stephen
Quoted 6 lines · Stephen Boyd
Quoted 5 lines · Mars Cheng
From: Kevin-CW Chen <[email protected]>
Add MT6797 clock support, include topckgen, apmixedsys, infracfg and subsystem clocks
Quoted 8 lines
Quoted 3 lines
Signed-off-by Kevin-CW Chen <[email protected]>Signed-off-by Mars Cheng <[email protected]>Tested-by Matthias Brugger <[email protected]>Acked-by Stephen Boyd <[email protected]>Looks fine to me except for the one comment below. Did you want me to merge it into clk tree?
To prevent another run, I really like you to merge it. However, I also want to make the patch set more cleaner. So I will send v4 later. :-)
Quoted 17 lines
Quoted 17 lines
drivers/clk/mediatek/clk-mt6797.c new file +10
-0@@ -0,0 +1,716 @@ +/* +* Copyright (c) 2016 MediaTek Inc. +* Author: Kevin Chen <[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
Quoted 9 lines
drivers/clk/mediatek/clk-mt6797.c line 15
Quoted 5 lines
drivers/clk/mediatek/clk-mt6797.c new file +5
-0+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/clk.h> Is this include used? Please include clk-provider if the file is a clk driver. Same comment applies to other files in this patch.
Should be removed. Will be done in v4.
Quoted 35 lines
Quoted 22 lines
drivers/clk/mediatek/clk-mt6797.c new file +22
-0+#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-mtk.h" +#include "clk-gate.h" + +#include <dt-bindings/clock/mt6797-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. +*/ + +static DEFINE_SPINLOCK (mt6797_clk_lock); + +static const struct mtk_fixed_factor top_fixed_divs[] = { +FACTOR (CLK_TOP_SYSPLL_CK ,"syspll_ck" ,"mainpll" ,1 ,1 ), +FACTOR (CLK_TOP_SYSPLL_D2 ,"syspll_d2" ,"mainpll" ,1 ,2 ), +FACTOR (CLK_TOP_SYSPLL1_D2 ,"syspll1_d2" ,"syspll_d2" ,1 ,2 ),[...]
Quoted 12 lines
drivers/clk/mediatek/clk-mt6797.c new file +12
-0+ clk_init =of_device_get_match_data (&pdev->dev); +if (!clk_init) +return -EINVAL ; + + r =clk_init (pdev); +if (r) +dev_err (&pdev->dev, +"could not register clock provider: %s: %d\n" , + pdev->name, r); + +return r; +}
Quoted 9 lines
drivers/clk/mediatek/clk-mt6797.c line 706
Quoted 6 lines
drivers/clk/mediatek/clk-mt6797.c new file +6
-0+ +static struct platform_driver clk_mt6797_drv = { + .probe = clk_mt6797_probe, + .driver = { + .name ="clk-mt6797" , + .owner =THIS_MODULE ,This can be removed,
platform_driver_register()does it already.
got it, will be removed.
Quoted 14 lines
Quoted 14 lines
drivers/clk/mediatek/clk-mt6797.c new file +10
-0+ .of_match_table = of_match_clk_mt6797, + }, +}; + +static int __init clk_mt6797_init (void ) +{ +return platform_driver_register (&clk_mt6797_drv); +} + +arch_initcall (clk_mt6797_init);include/dt-bindings/clock/mt6797-clk.h new file +0
-1--- /dev/null
Quoted 9 lines
include/dt-bindings/clock/mt6797-clk.h
Quoted 2 lines
+++
b/include/dt-bindings/clock/mt6797-clk.hinclude/dt-bindings/clock/mt6797-clk.h new file +0
-0@@ -0,0 +1,281 @@I think arm-soc folks don't want us merging whole drivers into the DT branch anymore, so please split off the dt-bindings header into a different patch that we can apply directly. Then we can layer the driver on top and just send off the header to arm-soc via a stable clk branch.
Got it. Will be done in v4.
Thanks for your review.
Re: [PATCH v3 07/12] clk: mediatek: add clk support for MT6797
Quoted 13 lines · Mars Cheng
Hi Stephen
Quoted 10 lines · Stephen Boyd
Quoted 8 lines · Mars Cheng
From: Kevin-CW Chen <[email protected]>
Add MT6797 clock support, include topckgen, apmixedsys, infracfg and subsystem clocks
Signed-off-by Kevin-CW Chen <[email protected]>Signed-off-by Mars Cheng <[email protected]>Tested-by Matthias Brugger <[email protected]>
Quoted 8 lines
Quoted 4 lines
Acked-by Stephen Boyd <[email protected]>Looks fine to me except for the one comment below. Did you want me to merge it into clk tree?
To prevent another run, I really like you to merge it. However, I also want to make the patch set more cleaner. So I will send v4 later. :-)
Ok I'll merge v4 patch then.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 8/12 soc: mediatek: avoid using fixed spm power status defines
In reply to Mars ChengUse variables to replace fixed defines since the offset of the status of spm power might be different for some chips
--- drivers/soc/mediatek/mtk-scpsys.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)
drivers/soc/mediatek/mtk-scpsys.c +27 -6
@@ -107,21 +107,28 @@ struct scp_domain {struct regulator *supply; }; +struct scp_ctrl_reg { +int pwr_sta_offs; +int pwr_sta2nd_offs; +}; +struct scp {struct scp_domain *domains;struct genpd_onecell_data pd_data;struct device *dev;void __iomem *base;struct regmap *infracfg; +struct scp_ctrl_reg ctrl_reg; };static int scpsys_domain_is_on (struct scp_domain *scpd) {struct scp *scp = scpd->scp; -u32 status =readl (scp->base +SPM_PWR_STATUS ) & scpd->data->sta_mask; -u32 status2 =readl (scp->base +SPM_PWR_STATUS_2ND ) & - scpd->data->sta_mask; +u32 status =readl (scp->base + scp->ctrl_reg.pwr_sta_offs) & + scpd->data->sta_mask; +u32 status2 =readl (scp->base + scp->ctrl_reg.pwr_sta2nd_offs) & + scpd->data->sta_mask;/* * A domain is on when both status bits are set. If only one is set
@@ -346,7 +353,8 @@ static void init_clks(struct platform_device *pdev, struct clk **clk) }static struct scp *init_scp (struct platform_device *pdev, -const struct scp_domain_data *scp_domain_data,int num) +const struct scp_domain_data *scp_domain_data,int num, +struct scp_ctrl_reg *scp_ctrl_reg) {struct genpd_onecell_data *pd_data;struct resource *res;
@@ -358,6 +366,9 @@ static struct scp *init_scp(struct platform_device *pdev,if (!scp)return ERR_PTR (-ENOMEM ); + scp->ctrl_reg.pwr_sta_offs = scp_ctrl_reg->pwr_sta_offs; + scp->ctrl_reg.pwr_sta2nd_offs = scp_ctrl_reg->pwr_sta2nd_offs; + scp->dev = &pdev->dev; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -556,8 +567,13 @@ static void mtk_register_power_domains(struct platform_device *pdev,static int __init scpsys_probe_mt2701 (struct platform_device *pdev) {struct scp *scp; +struct scp_ctrl_reg scp_reg; - scp =init_scp (pdev, scp_domain_data_mt2701,NUM_DOMAINS_MT2701 ); + scp_reg.pwr_sta_offs =SPM_PWR_STATUS ; + scp_reg.pwr_sta2nd_offs =SPM_PWR_STATUS_2ND ; + + scp =init_scp (pdev, scp_domain_data_mt2701,NUM_DOMAINS_MT2701 , + &scp_reg);if (IS_ERR (scp))return PTR_ERR (scp);
@@ -667,8 +683,13 @@ static int __init scpsys_probe_mt8173(struct platform_device *pdev)struct scp *scp;struct genpd_onecell_data *pd_data;int ret; +struct scp_ctrl_reg scp_reg; + + scp_reg.pwr_sta_offs =SPM_PWR_STATUS ; + scp_reg.pwr_sta2nd_offs =SPM_PWR_STATUS_2ND ; - scp =init_scp (pdev, scp_domain_data_mt8173,NUM_DOMAINS_MT8173 ); + scp =init_scp (pdev, scp_domain_data_mt8173,NUM_DOMAINS_MT8173 , + &scp_reg);if (IS_ERR (scp))return PTR_ERR (scp);
Signature · 1 line
1.7.9.5
PATCH v3 9/12 soc: mediatek: add vdec item for scpsys
In reply to Mars Chengfor some chips, there is vdec item in scpsys, this patch adds it.
--- drivers/soc/mediatek/mtk-scpsys.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/soc/mediatek/mtk-scpsys.c +2 -0
@@ -71,6 +71,7 @@ enum clk_id {CLK_VENC ,CLK_VENC_LT ,CLK_ETHIF , +CLK_VDEC , CLK_MAX, };
@@ -81,6 +82,7 @@ enum clk_id {"venc" ,"venc_lt" ,"ethif" , +"vdec" , NULL, };
Signature · 1 line
1.7.9.5
PATCH v3 10/12 dt-bindings: mediatek: add MT6797 power dt-bindings
In reply to Mars ChengThis adds scpsys dt-bindings for MT6797
--- .../devicetree/bindings/soc/mediatek/scpsys.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/soc/mediatek/scpsys.txt +5 -1
@@ -9,11 +9,14 @@ domain control. The driver implements the Generic PM domain bindings described in power/power_domain.txt. It provides the power domains defined in -include/dt-bindings/power/mt8173-power.h and mt2701-power.h. +- include/dt-bindings/power/mt8173-power.h +- include/dt-bindings/power/mt6797-power.h +- include/dt-bindings/power/mt2701-power.h Required properties: - compatible: Should be one of: - "mediatek,mt2701-scpsys" + - "mediatek,mt6797-scpsys" - "mediatek,mt8173-scpsys" - #power-domain-cells: Must be 1 - reg: Address range of the SCPSYS unit
@@ -22,6 +25,7 @@ Required properties: These are clocks which hardware needs to be enabled before enabling certain power domains. Required clocks for MT2701: "mm", "mfg", "ethif" + Required clocks for MT6797: "mm", "mfg", "vdec" Required clocks for MT8173: "mm", "mfg", "venc", "venc_lt" Optional properties:
Signature · 1 line
1.7.9.5
Re: [PATCH v3 10/12] dt-bindings: mediatek: add MT6797 power dt-bindings
Quoted 7 lines · Mars Cheng
This adds scpsys dt-bindings for MT6797
Signed-off-by Mars Cheng <[email protected]>Signed-off-by Kevin-CW Chen <[email protected]>--- .../devicetree/bindings/soc/mediatek/scpsys.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
PATCH v3 11/12 soc: mediatek: add MT6797 scysys support
In reply to Mars ChengThis adds scysys support for MT6797
--- drivers/soc/mediatek/mtk-scpsys.c | 114 ++++++++++++++++++++++++++++++ include/dt-bindings/power/mt6797-power.h | 30 ++++++++ 2 files changed, 144 insertions(+) create mode 100644 include/dt-bindings/power/mt6797-power.h
drivers/soc/mediatek/mtk-scpsys.c +114 -0
@@ -21,6 +21,7 @@#include <linux/soc/mediatek/infracfg.h> #include <dt-bindings/power/mt2701-power.h> +#include <dt-bindings/power/mt6797-power.h> #include <dt-bindings/power/mt8173-power.h> #define SPM_VDE_PWR_CON 0x0210
@@ -585,6 +586,116 @@ static int __init scpsys_probe_mt2701(struct platform_device *pdev) }/* +* MT6797 power domain support +*/ + +static const struct scp_domain_data scp_domain_data_mt6797[] = { + [MT6797_POWER_DOMAIN_VDEC ] = { + .name ="vdec" , + .sta_mask =BIT (7 ), + .ctl_offs =0x300 , + .sram_pdn_bits =GENMASK (8 ,8 ), + .sram_pdn_ack_bits =GENMASK (12 ,12 ), + .clk_id = {CLK_VDEC }, + }, + [MT6797_POWER_DOMAIN_VENC ] = { + .name ="venc" , + .sta_mask =BIT (21 ), + .ctl_offs =0x304 , + .sram_pdn_bits =GENMASK (11 ,8 ), + .sram_pdn_ack_bits =GENMASK (15 ,12 ), + .clk_id = {CLK_NONE }, + }, + [MT6797_POWER_DOMAIN_ISP ] = { + .name ="isp" , + .sta_mask =BIT (5 ), + .ctl_offs =0x308 , + .sram_pdn_bits =GENMASK (9 ,8 ), + .sram_pdn_ack_bits =GENMASK (13 ,12 ), + .clk_id = {CLK_NONE }, + }, + [MT6797_POWER_DOMAIN_MM ] = { + .name ="mm" , + .sta_mask =BIT (3 ), + .ctl_offs =0x30C , + .sram_pdn_bits =GENMASK (8 ,8 ), + .sram_pdn_ack_bits =GENMASK (12 ,12 ), + .clk_id = {CLK_MM }, + .bus_prot_mask = (BIT (1 ) |BIT (2 )), + }, + [MT6797_POWER_DOMAIN_AUDIO ] = { + .name ="audio" , + .sta_mask =BIT (24 ), + .ctl_offs =0x314 , + .sram_pdn_bits =GENMASK (11 ,8 ), + .sram_pdn_ack_bits =GENMASK (15 ,12 ), + .clk_id = {CLK_NONE }, + }, + [MT6797_POWER_DOMAIN_MFG_ASYNC ] = { + .name ="mfg_async" , + .sta_mask =BIT (13 ), + .ctl_offs =0x334 , + .sram_pdn_bits =0 , + .sram_pdn_ack_bits =0 , + .clk_id = {CLK_MFG }, + }, + [MT6797_POWER_DOMAIN_MJC ] = { + .name ="mjc" , + .sta_mask =BIT (20 ), + .ctl_offs =0x310 , + .sram_pdn_bits =GENMASK (8 ,8 ), + .sram_pdn_ack_bits =GENMASK (12 ,12 ), + .clk_id = {CLK_NONE }, + }, +}; + +#define NUM_DOMAINS_MT6797 ARRAY_SIZE(scp_domain_data_mt6797) +#define SPM_PWR_STATUS_MT6797 0x0180 +#define SPM_PWR_STATUS_2ND_MT6797 0x0184 + +static int __init scpsys_probe_mt6797 (struct platform_device *pdev) +{ +struct scp *scp; +struct genpd_onecell_data *pd_data; +int ret; +struct scp_ctrl_reg scp_reg; + + scp_reg.pwr_sta_offs =SPM_PWR_STATUS_MT6797 ; + scp_reg.pwr_sta2nd_offs =SPM_PWR_STATUS_2ND_MT6797 ; + + scp =init_scp (pdev, scp_domain_data_mt6797,NUM_DOMAINS_MT6797 , + &scp_reg); +if (IS_ERR (scp)) +return PTR_ERR (scp); + +mtk_register_power_domains (pdev, scp,NUM_DOMAINS_MT6797 ); + + pd_data = &scp->pd_data; + + ret =pm_genpd_add_subdomain (pd_data->domains[MT6797_POWER_DOMAIN_MM ], + pd_data->domains[MT6797_POWER_DOMAIN_VDEC ]); +if (ret &&IS_ENABLED (CONFIG_PM )) +dev_err (&pdev->dev,"Failed to add subdomain: %d\n" , ret); + + ret =pm_genpd_add_subdomain (pd_data->domains[MT6797_POWER_DOMAIN_MM ], + pd_data->domains[MT6797_POWER_DOMAIN_ISP ]); +if (ret &&IS_ENABLED (CONFIG_PM )) +dev_err (&pdev->dev,"Failed to add subdomain: %d\n" , ret); + + ret =pm_genpd_add_subdomain (pd_data->domains[MT6797_POWER_DOMAIN_MM ], + pd_data->domains[MT6797_POWER_DOMAIN_VENC ]); +if (ret &&IS_ENABLED (CONFIG_PM )) +dev_err (&pdev->dev,"Failed to add subdomain: %d\n" , ret); + + ret =pm_genpd_add_subdomain (pd_data->domains[MT6797_POWER_DOMAIN_MM ], + pd_data->domains[MT6797_POWER_DOMAIN_MJC ]); +if (ret &&IS_ENABLED (CONFIG_PM )) +dev_err (&pdev->dev,"Failed to add subdomain: %d\n" , ret); + +return 0 ; +} + +/* * MT8173 power domain support */
@@ -721,6 +832,9 @@ static int __init scpsys_probe_mt8173(struct platform_device *pdev) .compatible = "mediatek,mt2701-scpsys", .data = scpsys_probe_mt2701, }, { + .compatible = "mediatek,mt6797-scpsys", + .data = scpsys_probe_mt6797, + }, { .compatible = "mediatek,mt8173-scpsys", .data = scpsys_probe_mt8173, }, {
include/dt-bindings/power/mt6797-power.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (c) 2017 MediaTek Inc. +* Author: Mars.C <[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, +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _DT_BINDINGS_POWER_MT6797_POWER_H +#define _DT_BINDINGS_POWER_MT6797_POWER_H + +#define MT6797_POWER_DOMAIN_VDEC 0 +#define MT6797_POWER_DOMAIN_VENC 1 +#define MT6797_POWER_DOMAIN_ISP 2 +#define MT6797_POWER_DOMAIN_MM 3 +#define MT6797_POWER_DOMAIN_AUDIO 4 +#define MT6797_POWER_DOMAIN_MFG_ASYNC 5 +#define MT6797_POWER_DOMAIN_MFG 6 +#define MT6797_POWER_DOMAIN_MFG_CORE0 7 +#define MT6797_POWER_DOMAIN_MFG_CORE1 8 +#define MT6797_POWER_DOMAIN_MFG_CORE2 9 +#define MT6797_POWER_DOMAIN_MFG_CORE3 10 +#define MT6797_POWER_DOMAIN_MJC 11 + +#endif /* _DT_BINDINGS_POWER_MT6797_POWER_H */
Signature · 1 line
1.7.9.5
PATCH v3 12/12 arm64: dts: mediatek: add clk and scp nodes for MT6797
In reply to Mars ChengThis adds clk and scp nodes for MT6797
--- arch/arm64/boot/dts/mediatek/mt6797.dtsi | 71 ++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt6797.dtsi +67 -4
@@ -11,6 +11,8 @@ * GNU General Public License for more details. */ +#include <dt-bindings/clock/mt6797-clk.h> +#include <dt-bindings/power/mt6797-power.h> #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h>
@@ -123,6 +125,35 @@ <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>; }; + topckgen: topckgen@10000000 { + compatible = "mediatek,mt6797-topckgen"; + reg = <0 0x10000000 0 0x1000>; + #clock-cells = <1>; + }; + + infrasys: infracfg_ao@10001000 { + compatible = "mediatek,mt6797-infracfg", "syscon"; + reg = <0 0x10001000 0 0x1000>; + #clock-cells = <1>; + }; + + scpsys: scpsys@10006000 { + compatible = "mediatek,mt6797-scpsys"; + #power-domain-cells = <1>; + reg = <0 0x10006000 0 0x1000>; + clocks = <&topckgen CLK_TOP_MUX_MFG>, + <&topckgen CLK_TOP_MUX_MM>, + <&topckgen CLK_TOP_MUX_VDEC>; + clock-names = "mfg", "mm", "vdec"; + infracfg = <&infrasys>; + }; + + apmixedsys: apmixed@1000c000 { + compatible = "mediatek,mt6797-apmixedsys"; + reg = <0 0x1000c000 0 0x1000>; + #clock-cells = <1>; + }; + sysirq: intpol-controller@10200620 { compatible = "mediatek,mt6797-sysirq", "mediatek,mt6577-sysirq";
@@ -138,7 +169,9 @@ "mediatek,mt6577-uart"; reg = <0 0x11002000 0 0x400>; interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>; - clocks = <&clk26m>; + clocks = <&infrasys CLK_INFRA_UART0>, + <&infrasys CLK_INFRA_AP_DMA>; + clock-names = "baud", "bus"; status = "disabled"; };
@@ -147,7 +180,9 @@ "mediatek,mt6577-uart"; reg = <0 0x11003000 0 0x400>; interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_LOW>; - clocks = <&clk26m>; + clocks = <&infrasys CLK_INFRA_UART1>, + <&infrasys CLK_INFRA_AP_DMA>; + clock-names = "baud", "bus"; status = "disabled"; };
@@ -156,7 +191,9 @@ "mediatek,mt6577-uart"; reg = <0 0x11004000 0 0x400>; interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_LOW>; - clocks = <&clk26m>; + clocks = <&infrasys CLK_INFRA_UART2>, + <&infrasys CLK_INFRA_AP_DMA>; + clock-names = "baud", "bus"; status = "disabled"; };
@@ -165,10 +202,36 @@ "mediatek,mt6577-uart"; reg = <0 0x11005000 0 0x400>; interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_LOW>; - clocks = <&clk26m>; + clocks = <&infrasys CLK_INFRA_UART3>, + <&infrasys CLK_INFRA_AP_DMA>; + clock-names = "baud", "bus"; status = "disabled"; }; + mmsys: mmsys_config@14000000 { + compatible = "mediatek,mt6797-mmsys", "syscon"; + reg = <0 0x14000000 0 0x1000>; + #clock-cells = <1>; + }; + + imgsys: imgsys_config@15000000 { + compatible = "mediatek,mt6797-imgsys", "syscon"; + reg = <0 0x15000000 0 0x1000>; + #clock-cells = <1>; + }; + + vdecsys: vdec_gcon@16000000 { + compatible = "mediatek,mt6797-vdecsys", "syscon"; + reg = <0 0x16000000 0 0x10000>; + #clock-cells = <1>; + }; + + vencsys: venc_gcon@17000000 { + compatible = "mediatek,mt6797-vencsys", "syscon"; + reg = <0 0x17000000 0 0x1000>; + #clock-cells = <1>; + }; + gic: interrupt-controller@19000000 { compatible = "arm,gic-v3"; #interrupt-cells = <3>;
Signature · 1 line
1.7.9.5
Hi Matthias, Rob, Marc, Stephen
gentle ping for this patch set.
Thanks.
Quoted 73 lines · Mars Cheng
This patch set adds basic SoC support for mediatek's first 10-core chip, X20, also known as MT6797.
- based on 4.11-rc1
- support multiple base address for sysirq
- support common clk frameworkChanges since v2:
- prevent uncessary #intpol-bases for mtk-sysirq
- add fast path for mtk-sysirqset_typewhen introducing multiple bases
- add acked-by and tested-by
- remove wrong usage for timer nodeChanges since v1:
- add multiple base addresses support, v1 only allow 2 bases
- clean up clk driverKevin-CW Chen (2):
dt-bindings: arm: mediatek: document clk bindings for MT6797
clk: mediatek: add clk support for MT6797Mars Cheng (10):
dt-bindings: mediatek: multiple bases support for sysirq
irqchip: mtk-sysirq: extend intpol base to arbitrary number
irqchip: mtk-sysirq: prevent unnecessary visibility whenset_type
dt-bindings: mediatek: Add bindings for mediatek MT6797 Platform
arm64: dts: mediatek: add mt6797 support
soc: mediatek: avoid using fixed spm power status defines
soc: mediatek: add vdec item for scpsys
dt-bindings: mediatek: add MT6797 power dt-bindings
soc: mediatek: add MT6797 scysys support
arm64: dts: mediatek: add clk and scp nodes for MT6797Documentation/devicetree/bindings/arm/mediatek.txt | 4 + .../bindings/arm/mediatek/mediatek,apmixedsys.txt | 1 + .../bindings/arm/mediatek/mediatek,imgsys.txt | 1 + .../bindings/arm/mediatek/mediatek,infracfg.txt | 1 + .../bindings/arm/mediatek/mediatek,mmsys.txt | 1 + .../bindings/arm/mediatek/mediatek,topckgen.txt | 1 + .../bindings/arm/mediatek/mediatek,vdecsys.txt | 1 + .../bindings/arm/mediatek/mediatek,vencsys.txt | 3 +- .../interrupt-controller/mediatek,sysirq.txt | 12 +- .../devicetree/bindings/serial/mtk-uart.txt | 1 + .../devicetree/bindings/soc/mediatek/scpsys.txt | 6 +- arch/arm64/boot/dts/mediatek/Makefile | 1 + arch/arm64/boot/dts/mediatek/mt6797-evb.dts | 36 + arch/arm64/boot/dts/mediatek/mt6797.dtsi | 245 +++++++ drivers/clk/mediatek/Kconfig | 32 + drivers/clk/mediatek/Makefile | 5 + drivers/clk/mediatek/clk-mt6797-img.c | 76 +++ drivers/clk/mediatek/clk-mt6797-mm.c | 136 ++++ drivers/clk/mediatek/clk-mt6797-vdec.c | 93 +++ drivers/clk/mediatek/clk-mt6797-venc.c | 78 +++ drivers/clk/mediatek/clk-mt6797.c | 716 ++++++++++++++++++++ drivers/irqchip/irq-mtk-sysirq.c | 116 +++- drivers/soc/mediatek/mtk-scpsys.c | 149 +++- include/dt-bindings/clock/mt6797-clk.h | 281 ++++++++ include/dt-bindings/power/mt6797-power.h | 30 + 25 files changed, 1993 insertions(+), 33 deletions(-) create mode 100644 arch/arm64/boot/dts/mediatek/mt6797-evb.dts create mode 100644 arch/arm64/boot/dts/mediatek/mt6797.dtsi create mode 100644 drivers/clk/mediatek/clk-mt6797-img.c create mode 100644 drivers/clk/mediatek/clk-mt6797-mm.c create mode 100644 drivers/clk/mediatek/clk-mt6797-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt6797-venc.c create mode 100644 drivers/clk/mediatek/clk-mt6797.c create mode 100644 include/dt-bindings/clock/mt6797-clk.h create mode 100644 include/dt-bindings/power/mt6797-power.h--
1.7.9.5
Hi Mars,
Quoted 3 lines · Mars Cheng
Hi Matthias, Rob, Marc, Stephen
gentle ping for this patch set.
I appreciate that you're eager to see this reviewed, but less than 4 days between a posting and a reminder is a bit too eager. We're not machines! ;-)
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Quoted 7 lines · Marc Zyngier
Hi Mars,
Quoted 3 lines · Mars Cheng
Hi Matthias, Rob, Marc, Stephen
gentle ping for this patch set.
Quoted 7 lines
I appreciate that you're eager to see this reviewed, but less than 4 days between a posting and a reminder is a bit too eager. We're not machines! ;-)
Thanks,
M.
Hi Marc
My bad. I should wait for one week at least.
Thanks for reminding. :-)
Hi Matthias, Stephen
Would you like to give some comments for this patch set? If there are any suggestions, I will try my best to fix the errors.
Thanks.
Quoted 81 lines · Mars Cheng
Hi Matthias, Rob, Marc, Stephen
gentle ping for this patch set.
Thanks.
Quoted 73 lines · Mars Cheng
This patch set adds basic SoC support for mediatek's first 10-core chip, X20, also known as MT6797.
- based on 4.11-rc1
- support multiple base address for sysirq
- support common clk frameworkChanges since v2:
- prevent uncessary #intpol-bases for mtk-sysirq
- add fast path for mtk-sysirqset_typewhen introducing multiple bases
- add acked-by and tested-by
- remove wrong usage for timer nodeChanges since v1:
- add multiple base addresses support, v1 only allow 2 bases
- clean up clk driverKevin-CW Chen (2):
dt-bindings: arm: mediatek: document clk bindings for MT6797
clk: mediatek: add clk support for MT6797Mars Cheng (10):
dt-bindings: mediatek: multiple bases support for sysirq
irqchip: mtk-sysirq: extend intpol base to arbitrary number
irqchip: mtk-sysirq: prevent unnecessary visibility whenset_type
dt-bindings: mediatek: Add bindings for mediatek MT6797 Platform
arm64: dts: mediatek: add mt6797 support
soc: mediatek: avoid using fixed spm power status defines
soc: mediatek: add vdec item for scpsys
dt-bindings: mediatek: add MT6797 power dt-bindings
soc: mediatek: add MT6797 scysys support
arm64: dts: mediatek: add clk and scp nodes for MT6797Documentation/devicetree/bindings/arm/mediatek.txt | 4 + .../bindings/arm/mediatek/mediatek,apmixedsys.txt | 1 + .../bindings/arm/mediatek/mediatek,imgsys.txt | 1 + .../bindings/arm/mediatek/mediatek,infracfg.txt | 1 + .../bindings/arm/mediatek/mediatek,mmsys.txt | 1 + .../bindings/arm/mediatek/mediatek,topckgen.txt | 1 + .../bindings/arm/mediatek/mediatek,vdecsys.txt | 1 + .../bindings/arm/mediatek/mediatek,vencsys.txt | 3 +- .../interrupt-controller/mediatek,sysirq.txt | 12 +- .../devicetree/bindings/serial/mtk-uart.txt | 1 + .../devicetree/bindings/soc/mediatek/scpsys.txt | 6 +- arch/arm64/boot/dts/mediatek/Makefile | 1 + arch/arm64/boot/dts/mediatek/mt6797-evb.dts | 36 + arch/arm64/boot/dts/mediatek/mt6797.dtsi | 245 +++++++ drivers/clk/mediatek/Kconfig | 32 + drivers/clk/mediatek/Makefile | 5 + drivers/clk/mediatek/clk-mt6797-img.c | 76 +++ drivers/clk/mediatek/clk-mt6797-mm.c | 136 ++++ drivers/clk/mediatek/clk-mt6797-vdec.c | 93 +++ drivers/clk/mediatek/clk-mt6797-venc.c | 78 +++ drivers/clk/mediatek/clk-mt6797.c | 716 ++++++++++++++++++++ drivers/irqchip/irq-mtk-sysirq.c | 116 +++- drivers/soc/mediatek/mtk-scpsys.c | 149 +++- include/dt-bindings/clock/mt6797-clk.h | 281 ++++++++ include/dt-bindings/power/mt6797-power.h | 30 + 25 files changed, 1993 insertions(+), 33 deletions(-) create mode 100644 arch/arm64/boot/dts/mediatek/mt6797-evb.dts create mode 100644 arch/arm64/boot/dts/mediatek/mt6797.dtsi create mode 100644 drivers/clk/mediatek/clk-mt6797-img.c create mode 100644 drivers/clk/mediatek/clk-mt6797-mm.c create mode 100644 drivers/clk/mediatek/clk-mt6797-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt6797-venc.c create mode 100644 drivers/clk/mediatek/clk-mt6797.c create mode 100644 include/dt-bindings/clock/mt6797-clk.h create mode 100644 include/dt-bindings/power/mt6797-power.h--
1.7.9.5