Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1604008 > unrolled thread
| Started by | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| First post | 2017-03-19 16:30 +0100 |
| Last post | 2017-03-24 00:50 +0100 |
| Articles | 15 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v3 00/12] Add Basic SoC support for MT6797 Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:30 +0100
[PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:30 +0100
Re: [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq Rob Herring <robh@kernel.org> - 2017-03-24 16:30 +0100
Re: [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq Marc Zyngier <marc.zyngier@arm.com> - 2017-03-24 17:10 +0100
[PATCH v3 04/12] dt-bindings: mediatek: Add bindings for mediatek MT6797 Platform Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:30 +0100
[PATCH v3 09/12] soc: mediatek: add vdec item for scpsys Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:30 +0100
[PATCH v3 11/12] soc: mediatek: add MT6797 scysys support Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:30 +0100
[PATCH v3 08/12] soc: mediatek: avoid using fixed spm power status defines Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:30 +0100
[PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number Mars Cheng <mars.cheng@mediatek.com> - 2017-03-19 16:40 +0100
Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number Marc Zyngier <marc.zyngier@arm.com> - 2017-03-23 17:30 +0100
Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number Mars Cheng <mars.cheng@mediatek.com> - 2017-03-24 01:00 +0100
Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number Marc Zyngier <marc.zyngier@arm.com> - 2017-03-24 10:50 +0100
Re: [PATCH v3 00/12] Add Basic SoC support for MT6797 Mars Cheng <mars.cheng@mediatek.com> - 2017-03-23 01:50 +0100
Re: [PATCH v3 00/12] Add Basic SoC support for MT6797 Marc Zyngier <marc.zyngier@arm.com> - 2017-03-23 16:40 +0100
Re: [PATCH v3 00/12] Add Basic SoC support for MT6797 Mars Cheng <mars.cheng@mediatek.com> - 2017-03-24 00:50 +0100
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:30 +0100 |
| Subject | [PATCH v3 00/12] Add Basic SoC support for MT6797 |
| Message-ID | <tmKWm-7EG-3@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:30 +0100 |
| Subject | [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq |
| Message-ID | <tmKWm-7EG-13@gated-at.bofh.it> |
| In reply to | #1604008 |
This describes how to specify multiple base addresses for sysirq
in mediatek platforms.
Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
---
.../interrupt-controller/mediatek,sysirq.txt | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt b/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
index 9d1d72c..40bf9b9 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
@@ -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>;
};
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2017-03-24 16:30 +0100 |
| Subject | Re: [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq |
| Message-ID | <tozk7-3uM-69@gated-at.bofh.it> |
| In reply to | #1604009 |
On Sun, Mar 19, 2017 at 11:26:22PM +0800, Mars Cheng wrote: > This describes how to specify multiple base addresses for sysirq > in mediatek platforms. > > Signed-off-by: Mars Cheng <mars.cheng@mediatek.com> > --- > .../interrupt-controller/mediatek,sysirq.txt | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) Acked-by: Rob Herring <robh@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2017-03-24 17:10 +0100 |
| Subject | Re: [PATCH v3 01/12] dt-bindings: mediatek: multiple bases support for sysirq |
| Message-ID | <tozWO-44H-23@gated-at.bofh.it> |
| In reply to | #1608560 |
On 24/03/17 15:20, Rob Herring wrote: > On Sun, Mar 19, 2017 at 11:26:22PM +0800, Mars Cheng wrote: >> This describes how to specify multiple base addresses for sysirq >> in mediatek platforms. >> >> Signed-off-by: Mars Cheng <mars.cheng@mediatek.com> >> --- >> .../interrupt-controller/mediatek,sysirq.txt | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) > > Acked-by: Rob Herring <robh@kernel.org> > Thanks Rob. I've queued patches 1-3 for 4.12. Cheers, M. -- Jazz is not dead. It just smells funny...
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:30 +0100 |
| Subject | [PATCH v3 04/12] dt-bindings: mediatek: Add bindings for mediatek MT6797 Platform |
| Message-ID | <tmKWm-7EG-19@gated-at.bofh.it> |
| In reply to | #1604008 |
This adds dt-binding documentation for Mediatek MT6797. Only
include very basic items, gic, uart timer and cpu.
Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
---
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(+)
diff --git a/Documentation/devicetree/bindings/arm/mediatek.txt b/Documentation/devicetree/bindings/arm/mediatek.txt
index c860b24..2d3344d 100644
--- a/Documentation/devicetree/bindings/arm/mediatek.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek.txt
@@ -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";
diff --git a/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt b/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
index 40bf9b9..04e162a 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
@@ -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"
diff --git a/Documentation/devicetree/bindings/serial/mtk-uart.txt b/Documentation/devicetree/bindings/serial/mtk-uart.txt
index 0015c72..5b8513d 100644
--- a/Documentation/devicetree/bindings/serial/mtk-uart.txt
+++ b/Documentation/devicetree/bindings/serial/mtk-uart.txt
@@ -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
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:30 +0100 |
| Subject | [PATCH v3 09/12] soc: mediatek: add vdec item for scpsys |
| Message-ID | <tmKWm-7EG-15@gated-at.bofh.it> |
| In reply to | #1604008 |
for some chips, there is vdec item in scpsys, this patch adds it.
Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
---
drivers/soc/mediatek/mtk-scpsys.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index eadbf0d..a8ba800 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -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,
};
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:30 +0100 |
| Subject | [PATCH v3 11/12] soc: mediatek: add MT6797 scysys support |
| Message-ID | <tmKWm-7EG-23@gated-at.bofh.it> |
| In reply to | #1604008 |
This adds scysys support for MT6797
Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
Signed-off-by: Kevin-CW Chen <kevin-cw.chen@mediatek.com>
---
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
diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index a8ba800..fc7bf95 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -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,
}, {
diff --git a/include/dt-bindings/power/mt6797-power.h b/include/dt-bindings/power/mt6797-power.h
new file mode 100644
index 0000000..d54b377
--- /dev/null
+++ b/include/dt-bindings/power/mt6797-power.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Mars.C <mars.cheng@mediatek.com>
+ *
+ * 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 */
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:30 +0100 |
| Subject | [PATCH v3 08/12] soc: mediatek: avoid using fixed spm power status defines |
| Message-ID | <tmKWm-7EG-21@gated-at.bofh.it> |
| In reply to | #1604008 |
Use variables to replace fixed defines since the offset
of the status of spm power might be different for some chips
Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
Signed-off-by: Kevin-CW Chen <kevin-cw.chen@mediatek.com>
---
drivers/soc/mediatek/mtk-scpsys.c | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index beb7916..eadbf0d 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -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);
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-19 16:40 +0100 |
| Subject | [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number |
| Message-ID | <tmL62-7I7-7@gated-at.bofh.it> |
| In reply to | #1604008 |
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 <mars.cheng@mediatek.com>
---
drivers/irqchip/irq-mtk-sysirq.c | 116 +++++++++++++++++++++++++++++++-------
1 file changed, 95 insertions(+), 21 deletions(-)
diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c
index 63ac73b..9ba969c 100644
--- a/drivers/irqchip/irq-mtk-sysirq.c
+++ b/drivers/irqchip/irq-mtk-sysirq.c
@@ -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;
}
--
1.7.9.5
[toc] | [prev] | [next] | [standalone]
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2017-03-23 17:30 +0100 |
| Subject | Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number |
| Message-ID | <todMC-4Je-9@gated-at.bofh.it> |
| In reply to | #1604016 |
On 19/03/17 15:26, Mars Cheng wrote: > 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 <mars.cheng@mediatek.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> 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. -- Jazz is not dead. It just smells funny...
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-24 01:00 +0100 |
| Subject | Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number |
| Message-ID | <tokO5-1iH-1@gated-at.bofh.it> |
| In reply to | #1607677 |
On Thu, 2017-03-23 at 16:25 +0000, Marc Zyngier wrote: > On 19/03/17 15:26, Mars Cheng wrote: > > 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 <mars.cheng@mediatek.com> > > Acked-by: Marc Zyngier <marc.zyngier@arm.com> > > 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. > Thanks, > > M.
[toc] | [prev] | [next] | [standalone]
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2017-03-24 10:50 +0100 |
| Subject | Re: [PATCH v3 02/12] irqchip: mtk-sysirq: extend intpol base to arbitrary number |
| Message-ID | <tou14-80L-19@gated-at.bofh.it> |
| In reply to | #1608021 |
On 23/03/17 23:52, Mars Cheng wrote: > On Thu, 2017-03-23 at 16:25 +0000, Marc Zyngier wrote: >> On 19/03/17 15:26, Mars Cheng wrote: >>> 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 <mars.cheng@mediatek.com> >> >> Acked-by: Marc Zyngier <marc.zyngier@arm.com> >> >> 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 Before taking this patch, I still need one of the DT maintainer to ack the binding extension. Thanks, M. -- Jazz is not dead. It just smells funny...
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-23 01:50 +0100 |
| Message-ID | <tnZ6V-2Fr-1@gated-at.bofh.it> |
| In reply to | #1604008 |
Hi Matthias, Rob, Marc, Stephen gentle ping for this patch set. Thanks. On Sun, 2017-03-19 at 23:26 +0800, Mars Cheng wrote: > 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 >
[toc] | [prev] | [next] | [standalone]
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Date | 2017-03-23 16:40 +0100 |
| Message-ID | <tod0e-4a5-23@gated-at.bofh.it> |
| In reply to | #1607102 |
Hi Mars, On 23/03/17 00:46, Mars Cheng wrote: > 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. -- Jazz is not dead. It just smells funny...
[toc] | [prev] | [next] | [standalone]
| From | Mars Cheng <mars.cheng@mediatek.com> |
|---|---|
| Date | 2017-03-24 00:50 +0100 |
| Message-ID | <tokEp-1ff-3@gated-at.bofh.it> |
| In reply to | #1607628 |
On Thu, 2017-03-23 at 15:24 +0000, Marc Zyngier wrote: > Hi Mars, > > On 23/03/17 00:46, Mars Cheng wrote: > > 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. Hi Marc My bad. I should wait for one week at least. Thanks for reminding. :-)
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web