From: Yassine Oudjana <[email protected]>
These patches are part of a larger effort to support the MT6735 SoC family in
mainline Linux. More patches (unsent or sent and pending review or revision)
can be found here[1].
This series adds support for most SCPSYS power domains on MT6735. See patches
for details.
Changes since v1:
- Squash DT binding patches
- Dual-licence DT binding as GPL/BSD
- Switch to mtk-pm-domains driver
- Add MFG bus protection bit
[1] https://gitlab.com/mt6735-mainline/linux/-/commits/mt6735-staging
Yassine Oudjana (2):
dt-bindings: power: Add binding for MediaTek MT6735 power controller
soc: mediatek: pm-domains: Add support for MT6735
.../power/mediatek,power-controller.yaml | 2 +
.../bindings/soc/mediatek/scpsys.txt | 1 +
drivers/soc/mediatek/mt6735-pm-domains.h | 96 +++++++++++++++++++
drivers/soc/mediatek/mtk-pm-domains.c | 5 +
drivers/soc/mediatek/mtk-pm-domains.h | 2 +
include/dt-bindings/power/mt6735-power.h | 14 +++
include/linux/soc/mediatek/infracfg.h | 5 +
7 files changed, 125 insertions(+)
create mode 100644 drivers/soc/mediatek/mt6735-pm-domains.h
create mode 100644 include/dt-bindings/power/mt6735-power.h
--
2.39.2
From: Yassine Oudjana <[email protected]>
Add DT binding for MediaTek MT6735 SCPSYS power controller.
Signed-off-by: Yassine Oudjana <[email protected]>
---
.../bindings/power/mediatek,power-controller.yaml | 2 ++
.../devicetree/bindings/soc/mediatek/scpsys.txt | 1 +
include/dt-bindings/power/mt6735-power.h | 14 ++++++++++++++
3 files changed, 17 insertions(+)
create mode 100644 include/dt-bindings/power/mt6735-power.h
diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
index c9acef80f452..710db61cab53 100644
--- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
+++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
@@ -23,6 +23,7 @@ properties:
compatible:
enum:
+ - mediatek,mt6735-power-controller
- mediatek,mt6795-power-controller
- mediatek,mt8167-power-controller
- mediatek,mt8173-power-controller
@@ -81,6 +82,7 @@ $defs:
reg:
description: |
Power domain index. Valid values are defined in:
+ "include/dt-bindings/power/mt6735-power.h" - for MT6735 type power domain.
"include/dt-bindings/power/mt6795-power.h" - for MT8167 type power domain.
"include/dt-bindings/power/mt8167-power.h" - for MT8167 type power domain.
"include/dt-bindings/power/mt8173-power.h" - for MT8173 type power domain.
diff --git a/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt b/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
index 2bc367793aec..3530a6668b48 100644
--- a/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
+++ b/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
@@ -20,6 +20,7 @@ Required properties:
- compatible: Should be one of:
- "mediatek,mt2701-scpsys"
- "mediatek,mt2712-scpsys"
+ - "mediatek,mt6735-scpsys"
- "mediatek,mt6765-scpsys"
- "mediatek,mt6797-scpsys"
- "mediatek,mt7622-scpsys"
diff --git a/include/dt-bindings/power/mt6735-power.h b/include/dt-bindings/power/mt6735-power.h
new file mode 100644
index 000000000000..782b49a88773
--- /dev/null
+++ b/include/dt-bindings/power/mt6735-power.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef _DT_BINDINGS_POWER_MT6735_POWER_H
+#define _DT_BINDINGS_POWER_MT6735_POWER_H
+
+#define MT6735_POWER_DOMAIN_MD1 0
+#define MT6735_POWER_DOMAIN_CONN 1
+#define MT6735_POWER_DOMAIN_DIS 2
+#define MT6735_POWER_DOMAIN_MFG 3
+#define MT6735_POWER_DOMAIN_ISP 4
+#define MT6735_POWER_DOMAIN_VDE 5
+#define MT6735_POWER_DOMAIN_VEN 6
+
+#endif
--
2.39.2
From: Yassine Oudjana <[email protected]>
Add support for SCPSYS power domains of MT6735. All non-CPU power domains
are added except for MD2 (C2K modem), which is left out due to issues
with powering it on.
Signed-off-by: Yassine Oudjana <[email protected]>
---
drivers/soc/mediatek/mt6735-pm-domains.h | 96 ++++++++++++++++++++++++
drivers/soc/mediatek/mtk-pm-domains.c | 5 ++
drivers/soc/mediatek/mtk-pm-domains.h | 2 +
include/linux/soc/mediatek/infracfg.h | 5 ++
4 files changed, 108 insertions(+)
create mode 100644 drivers/soc/mediatek/mt6735-pm-domains.h
diff --git a/drivers/soc/mediatek/mt6735-pm-domains.h b/drivers/soc/mediatek/mt6735-pm-domains.h
new file mode 100644
index 000000000000..59e830fc354b
--- /dev/null
+++ b/drivers/soc/mediatek/mt6735-pm-domains.h
@@ -0,0 +1,96 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __SOC_MEDIATEK_MT6735_PM_DOMAINS_H
+#define __SOC_MEDIATEK_MT6735_PM_DOMAINS_H
+
+#include "mtk-pm-domains.h"
+#include <dt-bindings/power/mt6735-power.h>
+
+/*
+ * MT6735 power domain support
+ */
+
+static const struct scpsys_domain_data scpsys_domain_data_mt6735[] = {
+ [MT6735_POWER_DOMAIN_MD1] = {
+ .name = "md1",
+ .sta_mask = PWR_STATUS_MD1,
+ .ctl_offs = SPM_MD1_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(8, 8),
+ .sram_pdn_ack_bits = 0,
+ .bp_infracfg = {
+ BUS_PROT_UPDATE_TOPAXI(MT6735_TOP_AXI_PROT_EN_MD1),
+ },
+ },
+ [MT6735_POWER_DOMAIN_CONN] = {
+ .name = "conn",
+ .sta_mask = PWR_STATUS_CONN,
+ .ctl_offs = SPM_CONN_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(8, 8),
+ .sram_pdn_ack_bits = 0,
+ .bp_infracfg = {
+ BUS_PROT_UPDATE_TOPAXI(MT6735_TOP_AXI_PROT_EN_CONN),
+ },
+ },
+ [MT6735_POWER_DOMAIN_DIS] = {
+ .name = "dis",
+ .sta_mask = PWR_STATUS_DISP,
+ .ctl_offs = SPM_DIS_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(11, 8),
+ .sram_pdn_ack_bits = GENMASK(12, 12),
+ .bp_infracfg = {
+ BUS_PROT_UPDATE_TOPAXI(MT8173_TOP_AXI_PROT_EN_MM_M0),
+ },
+ },
+ [MT6735_POWER_DOMAIN_MFG] = {
+ .name = "mfg",
+ .sta_mask = PWR_STATUS_MFG,
+ .ctl_offs = SPM_MFG_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(11, 8),
+ .sram_pdn_ack_bits = GENMASK(12, 12),
+ .bp_infracfg = {
+ BUS_PROT_UPDATE_TOPAXI(MT8173_TOP_AXI_PROT_EN_MFG_S),
+ },
+ },
+ [MT6735_POWER_DOMAIN_ISP] = {
+ .name = "isp",
+ .sta_mask = PWR_STATUS_ISP,
+ .ctl_offs = SPM_ISP_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(11, 8),
+ .sram_pdn_ack_bits = GENMASK(13, 12),
+ },
+ [MT6735_POWER_DOMAIN_VDE] = {
+ .name = "vde",
+ .sta_mask = PWR_STATUS_VDEC,
+ .ctl_offs = SPM_VDE_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(11, 8),
+ .sram_pdn_ack_bits = GENMASK(12, 12),
+ },
+ [MT6735_POWER_DOMAIN_VEN] = {
+ .name = "ven",
+ .sta_mask = BIT(8),
+ .ctl_offs = SPM_VEN_PWR_CON,
+ .pwr_sta_offs = SPM_PWR_STATUS,
+ .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND,
+ .sram_pdn_bits = GENMASK(11, 8),
+ .sram_pdn_ack_bits = GENMASK(15, 12),
+ },
+};
+
+static const struct scpsys_soc_data mt6735_scpsys_data = {
+ .domains_data = scpsys_domain_data_mt6735,
+ .num_domains = ARRAY_SIZE(scpsys_domain_data_mt6735),
+};
+
+#endif /* __SOC_MEDIATEK_MT6735_PM_DOMAINS_H */
diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
index 354249cc1b12..0ade6b8cafff 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.c
+++ b/drivers/soc/mediatek/mtk-pm-domains.c
@@ -16,6 +16,7 @@
#include <linux/regulator/consumer.h>
#include <linux/soc/mediatek/infracfg.h>
+#include "mt6735-pm-domains.h"
#include "mt6795-pm-domains.h"
#include "mt8167-pm-domains.h"
#include "mt8173-pm-domains.h"
@@ -568,6 +569,10 @@ static void scpsys_domain_cleanup(struct scpsys *scpsys)
}
static const struct of_device_id scpsys_of_match[] = {
+ {
+ .compatible = "mediatek,mt6735-power-controller",
+ .data = &mt6735_scpsys_data,
+ },
{
.compatible = "mediatek,mt6795-power-controller",
.data = &mt6795_scpsys_data,
diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h
index 5ec53ee073c4..4aa37dc57ac7 100644
--- a/drivers/soc/mediatek/mtk-pm-domains.h
+++ b/drivers/soc/mediatek/mtk-pm-domains.h
@@ -19,6 +19,7 @@
#define SPM_ISP_PWR_CON 0x0238
#define SPM_DIS_PWR_CON 0x023c
#define SPM_CONN_PWR_CON 0x0280
+#define SPM_MD1_PWR_CON 0x0284
#define SPM_VEN2_PWR_CON 0x0298
#define SPM_AUDIO_PWR_CON 0x029c
#define SPM_MFG_2D_PWR_CON 0x02c0
@@ -28,6 +29,7 @@
#define SPM_PWR_STATUS 0x060c
#define SPM_PWR_STATUS_2ND 0x0610
+#define PWR_STATUS_MD1 BIT(0)
#define PWR_STATUS_CONN BIT(1)
#define PWR_STATUS_DISP BIT(3)
#define PWR_STATUS_MFG BIT(4)
diff --git a/include/linux/soc/mediatek/infracfg.h b/include/linux/soc/mediatek/infracfg.h
index 07f67b3d8e97..c60f8e7e976e 100644
--- a/include/linux/soc/mediatek/infracfg.h
+++ b/include/linux/soc/mediatek/infracfg.h
@@ -393,6 +393,11 @@
#define MT7622_TOP_AXI_PROT_EN_WB (BIT(2) | BIT(6) | \
BIT(7) | BIT(8))
+#define MT6735_TOP_AXI_PROT_EN_CONN (BIT(2) | BIT(8))
+#define MT6735_TOP_AXI_PROT_EN_MD1 (BIT(24) | BIT(25) | \
+ BIT(26) | BIT(27) | \
+ BIT(28))
+
#define INFRA_TOPAXI_PROTECTEN 0x0220
#define INFRA_TOPAXI_PROTECTSTA1 0x0228
#define INFRA_TOPAXI_PROTECTEN_SET 0x0260
--
2.39.2
Il 02/03/23 13:27, Yassine Oudjana ha scritto:
> From: Yassine Oudjana <[email protected]>
>
> Add DT binding for MediaTek MT6735 SCPSYS power controller.
>
> Signed-off-by: Yassine Oudjana <[email protected]>
> ---
> .../bindings/power/mediatek,power-controller.yaml | 2 ++
> .../devicetree/bindings/soc/mediatek/scpsys.txt | 1 +
> include/dt-bindings/power/mt6735-power.h | 14 ++++++++++++++
I know many others don't follow the right binding filenames and I am sure
you named it like that looking at the other ones, but please rename this
to mediatek,mt6735-power.h and resend.
The rest looks good.
> 3 files changed, 17 insertions(+)
> create mode 100644 include/dt-bindings/power/mt6735-power.h
>
> diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> index c9acef80f452..710db61cab53 100644
> --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> @@ -23,6 +23,7 @@ properties:
>
> compatible:
> enum:
> + - mediatek,mt6735-power-controller
> - mediatek,mt6795-power-controller
> - mediatek,mt8167-power-controller
> - mediatek,mt8173-power-controller
> @@ -81,6 +82,7 @@ $defs:
> reg:
> description: |
> Power domain index. Valid values are defined in:
> + "include/dt-bindings/power/mt6735-power.h" - for MT6735 type power domain.
P.S.: Don't forget to update this addition after the rename :-)
After - and only after - renaming,
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Il 02/03/23 13:27, Yassine Oudjana ha scritto:
> From: Yassine Oudjana <[email protected]>
>
> Add support for SCPSYS power domains of MT6735. All non-CPU power domains
For the CPU power domains, I was cooking something locally.... but then I
stopped for some other higher priority stuff.
I'll make sure to ping you when ready, as I think you'll be interested to that.
> are added except for MD2 (C2K modem), which is left out due to issues
> with powering it on.
>
> Signed-off-by: Yassine Oudjana <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
On 02/03/2023 13:27, Yassine Oudjana wrote:
> From: Yassine Oudjana <[email protected]>
>
> Add DT binding for MediaTek MT6735 SCPSYS power controller.
>
> Signed-off-by: Yassine Oudjana <[email protected]>
> ---
> .../bindings/power/mediatek,power-controller.yaml | 2 ++
> .../devicetree/bindings/soc/mediatek/scpsys.txt | 1 +
> include/dt-bindings/power/mt6735-power.h | 14 ++++++++++++++
> 3 files changed, 17 insertions(+)
> create mode 100644 include/dt-bindings/power/mt6735-power.h
>
> diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> index c9acef80f452..710db61cab53 100644
> --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> @@ -23,6 +23,7 @@ properties:
>
> compatible:
> enum:
> + - mediatek,mt6735-power-controller
> - mediatek,mt6795-power-controller
> - mediatek,mt8167-power-controller
> - mediatek,mt8173-power-controller
> @@ -81,6 +82,7 @@ $defs:
> reg:
> description: |
> Power domain index. Valid values are defined in:
> + "include/dt-bindings/power/mt6735-power.h" - for MT6735 type power domain.
Isn't the comment obvious? Maybe let's stop adding them?
> "include/dt-bindings/power/mt6795-power.h" - for MT8167 type power domain.
> "include/dt-bindings/power/mt8167-power.h" - for MT8167 type power domain.
> "include/dt-bindings/power/mt8173-power.h" - for MT8173 type power domain.
> diff --git a/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt b/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
> index 2bc367793aec..3530a6668b48 100644
> --- a/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
> +++ b/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
> @@ -20,6 +20,7 @@ Required properties:
> - compatible: Should be one of:
> - "mediatek,mt2701-scpsys"
> - "mediatek,mt2712-scpsys"
> + - "mediatek,mt6735-scpsys"
> - "mediatek,mt6765-scpsys"
> - "mediatek,mt6797-scpsys"
> - "mediatek,mt7622-scpsys"
> diff --git a/include/dt-bindings/power/mt6735-power.h b/include/dt-bindings/power/mt6735-power.h
> new file mode 100644
> index 000000000000..782b49a88773
> --- /dev/null
> +++ b/include/dt-bindings/power/mt6735-power.h
I am pretty sure we already discussed the file naming with some other
patches... mediatek,mt6735-power-controller.h
Best regards,
Krzysztof