All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryder Lee <ryder.lee@mediatek.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 13/18] power domain: MediaTek: add power domain driver for MT7623 SoC
Date: Fri, 2 Nov 2018 23:15:41 +0800	[thread overview]
Message-ID: <6f137d9b350a71b5f4b4168d8d2c0433f9cb19a1.1541171496.git.ryder.lee@mediatek.com> (raw)
In-Reply-To: <cover.1541171496.git.ryder.lee@mediatek.com>

This adds power domain (scpsys) support for MT7623 SoC.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 drivers/power/domain/mtk-power-domain.c | 80 +++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/drivers/power/domain/mtk-power-domain.c b/drivers/power/domain/mtk-power-domain.c
index ed4a718..c67e880 100644
--- a/drivers/power/domain/mtk-power-domain.c
+++ b/drivers/power/domain/mtk-power-domain.c
@@ -14,9 +14,19 @@
 #include <asm/processor.h>
 #include <linux/iopoll.h>
 
+#include <dt-bindings/power/mt7623-power.h>
 #include <dt-bindings/power/mt7629-power.h>
 
 #define SPM_EN			(0xb16 << 16 | 0x1)
+#define SPM_VDE_PWR_CON		0x0210
+#define SPM_MFG_PWR_CON		0x0214
+#define SPM_ISP_PWR_CON		0x0238
+#define SPM_DIS_PWR_CON		0x023c
+#define SPM_CONN_PWR_CON	0x0280
+#define SPM_BDP_PWR_CON		0x029c
+#define SPM_ETH_PWR_CON		0x02a0
+#define SPM_HIF_PWR_CON		0x02a4
+#define SPM_IFR_MSC_PWR_CON	0x02a8
 #define SPM_ETHSYS_PWR_CON	0x2e0
 #define SPM_HIF0_PWR_CON	0x2e4
 #define SPM_HIF1_PWR_CON	0x2e8
@@ -29,6 +39,15 @@
 #define PWR_ON_2ND_BIT		BIT(3)
 #define PWR_CLK_DIS_BIT		BIT(4)
 
+#define PWR_STATUS_CONN		BIT(1)
+#define PWR_STATUS_DISP		BIT(3)
+#define PWR_STATUS_MFG		BIT(4)
+#define PWR_STATUS_ISP		BIT(5)
+#define PWR_STATUS_VDEC		BIT(7)
+#define PWR_STATUS_BDP		BIT(14)
+#define PWR_STATUS_ETH		BIT(15)
+#define PWR_STATUS_HIF		BIT(16)
+#define PWR_STATUS_IFR_MSC	BIT(17)
 #define PWR_STATUS_ETHSYS	BIT(24)
 #define PWR_STATUS_HIF0		BIT(25)
 #define PWR_STATUS_HIF1		BIT(26)
@@ -41,6 +60,7 @@
 #define DCM_TOP_EN		BIT(0)
 
 enum scp_domain_type {
+	SCPSYS_MT7623,
 	SCPSYS_MT7629,
 };
 
@@ -62,6 +82,59 @@ struct scp_domain {
 	struct scp_domain_data *data;
 };
 
+static struct scp_domain_data scp_domain_mt7623[] = {
+	[MT7623_POWER_DOMAIN_CONN] = {
+		.sta_mask = PWR_STATUS_CONN,
+		.ctl_offs = SPM_CONN_PWR_CON,
+		.bus_prot_mask = BIT(8) | BIT(2),
+	},
+	[MT7623_POWER_DOMAIN_DISP] = {
+		.sta_mask = PWR_STATUS_DISP,
+		.ctl_offs = SPM_DIS_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+		.bus_prot_mask = BIT(2),
+	},
+	[MT7623_POWER_DOMAIN_MFG] = {
+		.sta_mask = PWR_STATUS_MFG,
+		.ctl_offs = SPM_MFG_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+		.sram_pdn_ack_bits = GENMASK(12, 12),
+	},
+	[MT7623_POWER_DOMAIN_VDEC] = {
+		.sta_mask = PWR_STATUS_VDEC,
+		.ctl_offs = SPM_VDE_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+		.sram_pdn_ack_bits = GENMASK(12, 12),
+	},
+	[MT7623_POWER_DOMAIN_ISP] = {
+		.sta_mask = PWR_STATUS_ISP,
+		.ctl_offs = SPM_ISP_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+		.sram_pdn_ack_bits = GENMASK(13, 12),
+	},
+	[MT7623_POWER_DOMAIN_BDP] = {
+		.sta_mask = PWR_STATUS_BDP,
+		.ctl_offs = SPM_BDP_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+	},
+	[MT7623_POWER_DOMAIN_ETH] = {
+		.sta_mask = PWR_STATUS_ETH,
+		.ctl_offs = SPM_ETH_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+		.sram_pdn_ack_bits = GENMASK(15, 12),
+	},
+	[MT7623_POWER_DOMAIN_HIF] = {
+		.sta_mask = PWR_STATUS_HIF,
+		.ctl_offs = SPM_HIF_PWR_CON,
+		.sram_pdn_bits = GENMASK(11, 8),
+		.sram_pdn_ack_bits = GENMASK(15, 12),
+	},
+	[MT7623_POWER_DOMAIN_IFR_MSC] = {
+		.sta_mask = PWR_STATUS_IFR_MSC,
+		.ctl_offs = SPM_IFR_MSC_PWR_CON,
+	},
+};
+
 static struct scp_domain_data scp_domain_mt7629[] = {
 	[MT7629_POWER_DOMAIN_ETHSYS] = {
 		.sta_mask = PWR_STATUS_ETHSYS,
@@ -252,6 +325,9 @@ static int mtk_power_domain_hook(struct udevice *dev)
 	scpd->type = (enum scp_domain_type)dev_get_driver_data(dev);
 
 	switch (scpd->type) {
+	case SCPSYS_MT7623:
+		scpd->data = scp_domain_mt7623;
+		break;
 	case SCPSYS_MT7629:
 		scpd->data = scp_domain_mt7629;
 		break;
@@ -303,6 +379,10 @@ static int mtk_power_domain_probe(struct udevice *dev)
 
 static const struct udevice_id mtk_power_domain_ids[] = {
 	{
+		.compatible = "mediatek,mt7623-scpsys",
+		.data = SCPSYS_MT7623,
+	},
+	{
 		.compatible = "mediatek,mt7629-scpsys",
 		.data = SCPSYS_MT7629,
 	},
-- 
1.9.1

  parent reply	other threads:[~2018-11-02 15:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 15:15 [U-Boot] [PATCH v3 00/18] Add U-Boot support for MediaTek SoCs - MT7623n & MT7629 Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 01/18] tools: MediaTek: add MTK boot header generation to mkimage Ryder Lee
2018-11-03  6:08   ` Simon Glass
2018-11-05  8:05     ` Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 02/18] arm: dts: MediaTek: add device tree for MT7629 Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 03/18] arm: dts: MediaTek: add device tree for MT7623 Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 04/18] arm: MediaTek: add basic support for MT7629 boards Ryder Lee
2018-11-03  6:08   ` Simon Glass
2018-11-02 15:15 ` [U-Boot] [PATCH v3 05/18] arm: MediaTek: add basic support for MT7623 boards Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 06/18] clk: MediaTek: add clock driver for MT7629 SoC Ryder Lee
2018-11-03  6:08   ` Simon Glass
2018-11-05  8:06     ` Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 07/18] clk: MediaTek: add clock driver for MT7623 SoC Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 08/18] timer: MediaTek: add timer driver for MediaTek SoCs Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 09/18] watchdog: MediaTek: add watchdog " Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 10/18] pinctrl: MediaTek: add pinctrl driver for MT7629 SoC Ryder Lee
2018-11-03  6:08   ` Simon Glass
2018-11-02 15:15 ` [U-Boot] [PATCH v3 11/18] pinctrl: MediaTek: add pinctrl driver for MT7623 SoC Ryder Lee
2018-11-03  6:08   ` Simon Glass
2018-11-02 15:15 ` [U-Boot] [PATCH v3 12/18] power domain: MediaTek: add power domain driver for MT7629 SoC Ryder Lee
2018-11-02 15:15 ` Ryder Lee [this message]
2018-11-02 15:15 ` [U-Boot] [PATCH v3 14/18] serial: 16550: allow the driver to support MediaTek serial Ryder Lee
2018-11-03  6:09   ` Simon Glass
2018-11-05  2:20     ` Ryder Lee
2018-11-05  8:37       ` Ryder Lee
2018-11-06  2:48         ` Weijie Gao
2018-11-13 19:53           ` Simon Glass
2018-11-02 15:15 ` [U-Boot] [PATCH v3 15/18] ram: MediaTek: add DDR3 driver for MT7629 SoC Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 16/18] mmc: mtk-sd: add SD/MMC host controller driver for MT7623 SoC Ryder Lee
2018-11-02 15:15 ` [U-Boot] [PATCH v3 17/18] doc: README.mediatek: Add a simple README for MediaTek Ryder Lee
2018-11-03  6:08   ` Simon Glass
2018-11-02 15:15 ` [U-Boot] [PATCH v3 18/18] MAINTAINERS: add an entry " Ryder Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f137d9b350a71b5f4b4168d8d2c0433f9cb19a1.1541171496.git.ryder.lee@mediatek.com \
    --to=ryder.lee@mediatek.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.