Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
Hi Matthias, On Wed, 2015-12-30 at 18:49 +0100, Matthias Brugger wrote: > > On Wed, 2015-12-30 at 17:01 +0800, Daniel Kurtz wrote: > >> On Wed, Dec 30, 2015 at 2:41 PM, James Liao > >> wrote: > >>> > >>> From: Shunli Wang > >>> > >>> Add scpsys driver for MT2701 and MT7623. > >>> > >>> Signed-off-by: Shunli Wang > >>> Signed-off-by: James Liao > >>> --- > >>> drivers/soc/mediatek/Kconfig | 11 +++ > >>> drivers/soc/mediatek/Makefile| 1 + > >>> drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 > >>> +++ > >>> 3 files changed, 173 insertions(+) > >>> create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c > >>> > >>> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > >>> index eca6fb7..92cf838 100644 > >>> --- a/drivers/soc/mediatek/Kconfig > >>> +++ b/drivers/soc/mediatek/Kconfig > >>> @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 > >>>driver. > >>>The System Control Processor System (SCPSYS) has several power > >>>management related tasks in the system. > >>> + > >>> +config MTK_SCPSYS_MT2701 > >>> + bool "SCPSYS Support MediaTek MT2701 and MT7623" > >>> + depends on ARCH_MEDIATEK || COMPILE_TEST > >>> + select MTK_SCPSYS > >>> + default ARCH_MEDIATEK > >>> + help > >>> + Say yes here to add support for the MT2701/MT7623 SCPSYS power > >>> + domain driver. > >>> + The System Control Processor System (SCPSYS) has several power > >>> + management related tasks in the system. > >> > >> I don't think we really want different drivers and Kconfig options. > >> > >> Can we just use different compatibles to select the appropriate > >> scp_domain_data? > > > > Yes, we can. All scpsys drivers are built-in by default, and they will > > be activate by specific compatible string. > > > > But some projects don't want to build unused drivers into kernel to save > > code size. Use different Kconfig options for each SoC so that these > > projects can disable unused drivers. > > > > Scpsys is a bool right now, you can disable it if you don't need it for > your project. > > I don't think the impact of adding scp_domain_data justifies adding SoC > specific scpsys drivers and bloat the drivers/soc/mediatek folder. So you prefer to enable MT8173 and MT2701 scpsys drivers at the same time if MTK_SCPSYS is true? BTW, this patchset is based on 4.4-rc7, which lacks two patches from your v4.4-next/soc. Should I rebase to v4.4-next/soc when I send v2 patch? Best regards, James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
Hi Matthias, On Wed, 2015-12-30 at 18:49 +0100, Matthias Brugger wrote: > > On Wed, 2015-12-30 at 17:01 +0800, Daniel Kurtz wrote: > >> On Wed, Dec 30, 2015 at 2:41 PM, James Liao> >> wrote: > >>> > >>> From: Shunli Wang > >>> > >>> Add scpsys driver for MT2701 and MT7623. > >>> > >>> Signed-off-by: Shunli Wang > >>> Signed-off-by: James Liao > >>> --- > >>> drivers/soc/mediatek/Kconfig | 11 +++ > >>> drivers/soc/mediatek/Makefile| 1 + > >>> drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 > >>> +++ > >>> 3 files changed, 173 insertions(+) > >>> create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c > >>> > >>> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > >>> index eca6fb7..92cf838 100644 > >>> --- a/drivers/soc/mediatek/Kconfig > >>> +++ b/drivers/soc/mediatek/Kconfig > >>> @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 > >>>driver. > >>>The System Control Processor System (SCPSYS) has several power > >>>management related tasks in the system. > >>> + > >>> +config MTK_SCPSYS_MT2701 > >>> + bool "SCPSYS Support MediaTek MT2701 and MT7623" > >>> + depends on ARCH_MEDIATEK || COMPILE_TEST > >>> + select MTK_SCPSYS > >>> + default ARCH_MEDIATEK > >>> + help > >>> + Say yes here to add support for the MT2701/MT7623 SCPSYS power > >>> + domain driver. > >>> + The System Control Processor System (SCPSYS) has several power > >>> + management related tasks in the system. > >> > >> I don't think we really want different drivers and Kconfig options. > >> > >> Can we just use different compatibles to select the appropriate > >> scp_domain_data? > > > > Yes, we can. All scpsys drivers are built-in by default, and they will > > be activate by specific compatible string. > > > > But some projects don't want to build unused drivers into kernel to save > > code size. Use different Kconfig options for each SoC so that these > > projects can disable unused drivers. > > > > Scpsys is a bool right now, you can disable it if you don't need it for > your project. > > I don't think the impact of adding scp_domain_data justifies adding SoC > specific scpsys drivers and bloat the drivers/soc/mediatek folder. So you prefer to enable MT8173 and MT2701 scpsys drivers at the same time if MTK_SCPSYS is true? BTW, this patchset is based on 4.4-rc7, which lacks two patches from your v4.4-next/soc. Should I rebase to v4.4-next/soc when I send v2 patch? Best regards, James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
On 30/12/15 11:18, James Liao wrote: Hi Daniel, On Wed, 2015-12-30 at 17:01 +0800, Daniel Kurtz wrote: On Wed, Dec 30, 2015 at 2:41 PM, James Liao wrote: From: Shunli Wang Add scpsys driver for MT2701 and MT7623. Signed-off-by: Shunli Wang Signed-off-by: James Liao --- drivers/soc/mediatek/Kconfig | 11 +++ drivers/soc/mediatek/Makefile| 1 + drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 +++ 3 files changed, 173 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig index eca6fb7..92cf838 100644 --- a/drivers/soc/mediatek/Kconfig +++ b/drivers/soc/mediatek/Kconfig @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 driver. The System Control Processor System (SCPSYS) has several power management related tasks in the system. + +config MTK_SCPSYS_MT2701 + bool "SCPSYS Support MediaTek MT2701 and MT7623" + depends on ARCH_MEDIATEK || COMPILE_TEST + select MTK_SCPSYS + default ARCH_MEDIATEK + help + Say yes here to add support for the MT2701/MT7623 SCPSYS power + domain driver. + The System Control Processor System (SCPSYS) has several power + management related tasks in the system. I don't think we really want different drivers and Kconfig options. Can we just use different compatibles to select the appropriate scp_domain_data? Yes, we can. All scpsys drivers are built-in by default, and they will be activate by specific compatible string. But some projects don't want to build unused drivers into kernel to save code size. Use different Kconfig options for each SoC so that these projects can disable unused drivers. Scpsys is a bool right now, you can disable it if you don't need it for your project. I don't think the impact of adding scp_domain_data justifies adding SoC specific scpsys drivers and bloat the drivers/soc/mediatek folder. Best regards, Matthias -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
Hi Daniel, On Wed, 2015-12-30 at 17:01 +0800, Daniel Kurtz wrote: > On Wed, Dec 30, 2015 at 2:41 PM, James Liao wrote: > > > > From: Shunli Wang > > > > Add scpsys driver for MT2701 and MT7623. > > > > Signed-off-by: Shunli Wang > > Signed-off-by: James Liao > > --- > > drivers/soc/mediatek/Kconfig | 11 +++ > > drivers/soc/mediatek/Makefile| 1 + > > drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 > > +++ > > 3 files changed, 173 insertions(+) > > create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c > > > > diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > > index eca6fb7..92cf838 100644 > > --- a/drivers/soc/mediatek/Kconfig > > +++ b/drivers/soc/mediatek/Kconfig > > @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 > > driver. > > The System Control Processor System (SCPSYS) has several power > > management related tasks in the system. > > + > > +config MTK_SCPSYS_MT2701 > > + bool "SCPSYS Support MediaTek MT2701 and MT7623" > > + depends on ARCH_MEDIATEK || COMPILE_TEST > > + select MTK_SCPSYS > > + default ARCH_MEDIATEK > > + help > > + Say yes here to add support for the MT2701/MT7623 SCPSYS power > > + domain driver. > > + The System Control Processor System (SCPSYS) has several power > > + management related tasks in the system. > > I don't think we really want different drivers and Kconfig options. > > Can we just use different compatibles to select the appropriate > scp_domain_data? Yes, we can. All scpsys drivers are built-in by default, and they will be activate by specific compatible string. But some projects don't want to build unused drivers into kernel to save code size. Use different Kconfig options for each SoC so that these projects can disable unused drivers. Best regards, James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
On Wed, Dec 30, 2015 at 2:41 PM, James Liao wrote: > > From: Shunli Wang > > Add scpsys driver for MT2701 and MT7623. > > Signed-off-by: Shunli Wang > Signed-off-by: James Liao > --- > drivers/soc/mediatek/Kconfig | 11 +++ > drivers/soc/mediatek/Makefile| 1 + > drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 > +++ > 3 files changed, 173 insertions(+) > create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c > > diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > index eca6fb7..92cf838 100644 > --- a/drivers/soc/mediatek/Kconfig > +++ b/drivers/soc/mediatek/Kconfig > @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 > driver. > The System Control Processor System (SCPSYS) has several power > management related tasks in the system. > + > +config MTK_SCPSYS_MT2701 > + bool "SCPSYS Support MediaTek MT2701 and MT7623" > + depends on ARCH_MEDIATEK || COMPILE_TEST > + select MTK_SCPSYS > + default ARCH_MEDIATEK > + help > + Say yes here to add support for the MT2701/MT7623 SCPSYS power > + domain driver. > + The System Control Processor System (SCPSYS) has several power > + management related tasks in the system. I don't think we really want different drivers and Kconfig options. Can we just use different compatibles to select the appropriate scp_domain_data? -Dan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
On 30/12/15 11:18, James Liao wrote: Hi Daniel, On Wed, 2015-12-30 at 17:01 +0800, Daniel Kurtz wrote: On Wed, Dec 30, 2015 at 2:41 PM, James Liaowrote: From: Shunli Wang Add scpsys driver for MT2701 and MT7623. Signed-off-by: Shunli Wang Signed-off-by: James Liao --- drivers/soc/mediatek/Kconfig | 11 +++ drivers/soc/mediatek/Makefile| 1 + drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 +++ 3 files changed, 173 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig index eca6fb7..92cf838 100644 --- a/drivers/soc/mediatek/Kconfig +++ b/drivers/soc/mediatek/Kconfig @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 driver. The System Control Processor System (SCPSYS) has several power management related tasks in the system. + +config MTK_SCPSYS_MT2701 + bool "SCPSYS Support MediaTek MT2701 and MT7623" + depends on ARCH_MEDIATEK || COMPILE_TEST + select MTK_SCPSYS + default ARCH_MEDIATEK + help + Say yes here to add support for the MT2701/MT7623 SCPSYS power + domain driver. + The System Control Processor System (SCPSYS) has several power + management related tasks in the system. I don't think we really want different drivers and Kconfig options. Can we just use different compatibles to select the appropriate scp_domain_data? Yes, we can. All scpsys drivers are built-in by default, and they will be activate by specific compatible string. But some projects don't want to build unused drivers into kernel to save code size. Use different Kconfig options for each SoC so that these projects can disable unused drivers. Scpsys is a bool right now, you can disable it if you don't need it for your project. I don't think the impact of adding scp_domain_data justifies adding SoC specific scpsys drivers and bloat the drivers/soc/mediatek folder. Best regards, Matthias -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
On Wed, Dec 30, 2015 at 2:41 PM, James Liaowrote: > > From: Shunli Wang > > Add scpsys driver for MT2701 and MT7623. > > Signed-off-by: Shunli Wang > Signed-off-by: James Liao > --- > drivers/soc/mediatek/Kconfig | 11 +++ > drivers/soc/mediatek/Makefile| 1 + > drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 > +++ > 3 files changed, 173 insertions(+) > create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c > > diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > index eca6fb7..92cf838 100644 > --- a/drivers/soc/mediatek/Kconfig > +++ b/drivers/soc/mediatek/Kconfig > @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 > driver. > The System Control Processor System (SCPSYS) has several power > management related tasks in the system. > + > +config MTK_SCPSYS_MT2701 > + bool "SCPSYS Support MediaTek MT2701 and MT7623" > + depends on ARCH_MEDIATEK || COMPILE_TEST > + select MTK_SCPSYS > + default ARCH_MEDIATEK > + help > + Say yes here to add support for the MT2701/MT7623 SCPSYS power > + domain driver. > + The System Control Processor System (SCPSYS) has several power > + management related tasks in the system. I don't think we really want different drivers and Kconfig options. Can we just use different compatibles to select the appropriate scp_domain_data? -Dan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
Hi Daniel, On Wed, 2015-12-30 at 17:01 +0800, Daniel Kurtz wrote: > On Wed, Dec 30, 2015 at 2:41 PM, James Liaowrote: > > > > From: Shunli Wang > > > > Add scpsys driver for MT2701 and MT7623. > > > > Signed-off-by: Shunli Wang > > Signed-off-by: James Liao > > --- > > drivers/soc/mediatek/Kconfig | 11 +++ > > drivers/soc/mediatek/Makefile| 1 + > > drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 > > +++ > > 3 files changed, 173 insertions(+) > > create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c > > > > diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig > > index eca6fb7..92cf838 100644 > > --- a/drivers/soc/mediatek/Kconfig > > +++ b/drivers/soc/mediatek/Kconfig > > @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 > > driver. > > The System Control Processor System (SCPSYS) has several power > > management related tasks in the system. > > + > > +config MTK_SCPSYS_MT2701 > > + bool "SCPSYS Support MediaTek MT2701 and MT7623" > > + depends on ARCH_MEDIATEK || COMPILE_TEST > > + select MTK_SCPSYS > > + default ARCH_MEDIATEK > > + help > > + Say yes here to add support for the MT2701/MT7623 SCPSYS power > > + domain driver. > > + The System Control Processor System (SCPSYS) has several power > > + management related tasks in the system. > > I don't think we really want different drivers and Kconfig options. > > Can we just use different compatibles to select the appropriate > scp_domain_data? Yes, we can. All scpsys drivers are built-in by default, and they will be activate by specific compatible string. But some projects don't want to build unused drivers into kernel to save code size. Use different Kconfig options for each SoC so that these projects can disable unused drivers. Best regards, James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
From: Shunli Wang Add scpsys driver for MT2701 and MT7623. Signed-off-by: Shunli Wang Signed-off-by: James Liao --- drivers/soc/mediatek/Kconfig | 11 +++ drivers/soc/mediatek/Makefile| 1 + drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 +++ 3 files changed, 173 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig index eca6fb7..92cf838 100644 --- a/drivers/soc/mediatek/Kconfig +++ b/drivers/soc/mediatek/Kconfig @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 driver. The System Control Processor System (SCPSYS) has several power management related tasks in the system. + +config MTK_SCPSYS_MT2701 + bool "SCPSYS Support MediaTek MT2701 and MT7623" + depends on ARCH_MEDIATEK || COMPILE_TEST + select MTK_SCPSYS + default ARCH_MEDIATEK + help + Say yes here to add support for the MT2701/MT7623 SCPSYS power + domain driver. + The System Control Processor System (SCPSYS) has several power + management related tasks in the system. diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile index 3b22baa..822986d 100644 --- a/drivers/soc/mediatek/Makefile +++ b/drivers/soc/mediatek/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o obj-$(CONFIG_MTK_SCPSYS_MT8173) += mtk-scpsys-mt8173.o +obj-$(CONFIG_MTK_SCPSYS_MT2701) += mtk-scpsys-mt2701.o diff --git a/drivers/soc/mediatek/mtk-scpsys-mt2701.c b/drivers/soc/mediatek/mtk-scpsys-mt2701.c new file mode 100644 index 000..339d5b8 --- /dev/null +++ b/drivers/soc/mediatek/mtk-scpsys-mt2701.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2015 Mediatek, Shunli Wang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include +#include + +#include "mtk-scpsys.h" + +#define SPM_VDE_PWR_CON0x0210 +#define SPM_MFG_PWR_CON0x0214 +#define SPM_ISP_PWR_CON0x0238 +#define SPM_DIS_PWR_CON0x023C +#define SPM_CONN_PWR_CON 0x0280 +#define SPM_BDP_PWR_CON0x029C +#define SPM_ETH_PWR_CON0x02A0 +#define SPM_HIF_PWR_CON0x02A4 +#define SPM_IFR_MSC_PWR_CON0x02A8 +#define SPM_PWR_STATUS 0x060c +#define SPM_PWR_STATUS_2ND 0x0610 + +#define CONN_PWR_STA_MASK BIT(1) +#define DIS_PWR_STA_MASK BIT(3) +#define MFG_PWR_STA_MASK BIT(4) +#define ISP_PWR_STA_MASK BIT(5) +#define VDE_PWR_STA_MASK BIT(7) +#define BDP_PWR_STA_MASK BIT(14) +#define ETH_PWR_STA_MASK BIT(15) +#define HIF_PWR_STA_MASK BIT(16) +#define IFR_MSC_PWR_STA_MASK BIT(17) + +#define MT2701_TOP_AXI_PROT_EN_CONN0x0104 +#define MT2701_TOP_AXI_PROT_EN_DISP0x0002 + +static const struct scp_domain_data scp_domain_data[] = { + [MT2701_POWER_DOMAIN_CONN] = { + .name = "conn", + .sta_mask = CONN_PWR_STA_MASK, + .ctl_offs = SPM_CONN_PWR_CON, + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN, + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_DISP] = { + .name = "disp", + .sta_mask = DIS_PWR_STA_MASK, + .ctl_offs = SPM_DIS_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .clk_id = {CLK_MM}, + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_DISP, + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_MFG] = { + .name = "mfg", + .sta_mask = MFG_PWR_STA_MASK, + .ctl_offs = SPM_MFG_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_VDEC] = { + .name = "vdec", + .sta_mask = VDE_PWR_STA_MASK, + .ctl_offs = SPM_VDE_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .clk_id = {CLK_MM}, + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_ISP] = { + .name = "isp", + .sta_mask =
[PATCH 4/4] soc: mediatek: Add MT2701/MT7623 scpsys driver
From: Shunli WangAdd scpsys driver for MT2701 and MT7623. Signed-off-by: Shunli Wang Signed-off-by: James Liao --- drivers/soc/mediatek/Kconfig | 11 +++ drivers/soc/mediatek/Makefile| 1 + drivers/soc/mediatek/mtk-scpsys-mt2701.c | 161 +++ 3 files changed, 173 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-scpsys-mt2701.c diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig index eca6fb7..92cf838 100644 --- a/drivers/soc/mediatek/Kconfig +++ b/drivers/soc/mediatek/Kconfig @@ -39,3 +39,14 @@ config MTK_SCPSYS_MT8173 driver. The System Control Processor System (SCPSYS) has several power management related tasks in the system. + +config MTK_SCPSYS_MT2701 + bool "SCPSYS Support MediaTek MT2701 and MT7623" + depends on ARCH_MEDIATEK || COMPILE_TEST + select MTK_SCPSYS + default ARCH_MEDIATEK + help + Say yes here to add support for the MT2701/MT7623 SCPSYS power + domain driver. + The System Control Processor System (SCPSYS) has several power + management related tasks in the system. diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile index 3b22baa..822986d 100644 --- a/drivers/soc/mediatek/Makefile +++ b/drivers/soc/mediatek/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o obj-$(CONFIG_MTK_SCPSYS_MT8173) += mtk-scpsys-mt8173.o +obj-$(CONFIG_MTK_SCPSYS_MT2701) += mtk-scpsys-mt2701.o diff --git a/drivers/soc/mediatek/mtk-scpsys-mt2701.c b/drivers/soc/mediatek/mtk-scpsys-mt2701.c new file mode 100644 index 000..339d5b8 --- /dev/null +++ b/drivers/soc/mediatek/mtk-scpsys-mt2701.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2015 Mediatek, Shunli Wang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include +#include + +#include "mtk-scpsys.h" + +#define SPM_VDE_PWR_CON0x0210 +#define SPM_MFG_PWR_CON0x0214 +#define SPM_ISP_PWR_CON0x0238 +#define SPM_DIS_PWR_CON0x023C +#define SPM_CONN_PWR_CON 0x0280 +#define SPM_BDP_PWR_CON0x029C +#define SPM_ETH_PWR_CON0x02A0 +#define SPM_HIF_PWR_CON0x02A4 +#define SPM_IFR_MSC_PWR_CON0x02A8 +#define SPM_PWR_STATUS 0x060c +#define SPM_PWR_STATUS_2ND 0x0610 + +#define CONN_PWR_STA_MASK BIT(1) +#define DIS_PWR_STA_MASK BIT(3) +#define MFG_PWR_STA_MASK BIT(4) +#define ISP_PWR_STA_MASK BIT(5) +#define VDE_PWR_STA_MASK BIT(7) +#define BDP_PWR_STA_MASK BIT(14) +#define ETH_PWR_STA_MASK BIT(15) +#define HIF_PWR_STA_MASK BIT(16) +#define IFR_MSC_PWR_STA_MASK BIT(17) + +#define MT2701_TOP_AXI_PROT_EN_CONN0x0104 +#define MT2701_TOP_AXI_PROT_EN_DISP0x0002 + +static const struct scp_domain_data scp_domain_data[] = { + [MT2701_POWER_DOMAIN_CONN] = { + .name = "conn", + .sta_mask = CONN_PWR_STA_MASK, + .ctl_offs = SPM_CONN_PWR_CON, + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN, + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_DISP] = { + .name = "disp", + .sta_mask = DIS_PWR_STA_MASK, + .ctl_offs = SPM_DIS_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .clk_id = {CLK_MM}, + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_DISP, + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_MFG] = { + .name = "mfg", + .sta_mask = MFG_PWR_STA_MASK, + .ctl_offs = SPM_MFG_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .active_wakeup = true, + }, + [MT2701_POWER_DOMAIN_VDEC] = { + .name = "vdec", + .sta_mask = VDE_PWR_STA_MASK, + .ctl_offs = SPM_VDE_PWR_CON, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .clk_id = {CLK_MM}, + .active_wakeup = true, +