Commit f6b3f4ac authored by Olof Johansson's avatar Olof Johansson

Merge tag 'v4.17-next-soc' of...

Merge tag 'v4.17-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux into next/drivers

- use timeout helpers for scpsys and infracfg drivers
- use of_device_get_match_data in pmic wrapper and scpsys

* tag 'v4.17-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux:
  soc: mediatek: remove unneeded semicolon
  soc: mediatek: add a fixed wait for SRAM stable
  soc: mediatek: introduce a CAPS flag for scp_domain_data
  soc: mediatek: reuse regmap_read_poll_timeout helpers
  regmap: include <linux/ktime.h> from include/linux/regmap.h
  soc: mediatek: reuse read[l,x]_poll_timeout helpers
  soc: mediatek: use of_device_get_match_data()
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 3ea8f233 0afd32c6
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include <linux/soc/mediatek/infracfg.h> #include <linux/soc/mediatek/infracfg.h>
#include <asm/processor.h> #include <asm/processor.h>
#define MTK_POLL_DELAY_US 10
#define MTK_POLL_TIMEOUT (jiffies_to_usecs(HZ))
#define INFRA_TOPAXI_PROTECTEN 0x0220 #define INFRA_TOPAXI_PROTECTEN 0x0220
#define INFRA_TOPAXI_PROTECTSTA1 0x0228 #define INFRA_TOPAXI_PROTECTSTA1 0x0228
#define INFRA_TOPAXI_PROTECTEN_SET 0x0260 #define INFRA_TOPAXI_PROTECTEN_SET 0x0260
...@@ -37,7 +40,6 @@ ...@@ -37,7 +40,6 @@
int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask, int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask,
bool reg_update) bool reg_update)
{ {
unsigned long expired;
u32 val; u32 val;
int ret; int ret;
...@@ -47,22 +49,11 @@ int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask, ...@@ -47,22 +49,11 @@ int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask,
else else
regmap_write(infracfg, INFRA_TOPAXI_PROTECTEN_SET, mask); regmap_write(infracfg, INFRA_TOPAXI_PROTECTEN_SET, mask);
expired = jiffies + HZ; ret = regmap_read_poll_timeout(infracfg, INFRA_TOPAXI_PROTECTSTA1,
val, (val & mask) == mask,
MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
while (1) {
ret = regmap_read(infracfg, INFRA_TOPAXI_PROTECTSTA1, &val);
if (ret)
return ret; return ret;
if ((val & mask) == mask)
break;
cpu_relax();
if (time_after(jiffies, expired))
return -EIO;
}
return 0;
} }
/** /**
...@@ -80,30 +71,17 @@ int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask, ...@@ -80,30 +71,17 @@ int mtk_infracfg_set_bus_protection(struct regmap *infracfg, u32 mask,
int mtk_infracfg_clear_bus_protection(struct regmap *infracfg, u32 mask, int mtk_infracfg_clear_bus_protection(struct regmap *infracfg, u32 mask,
bool reg_update) bool reg_update)
{ {
unsigned long expired;
int ret; int ret;
u32 val;
if (reg_update) if (reg_update)
regmap_update_bits(infracfg, INFRA_TOPAXI_PROTECTEN, mask, 0); regmap_update_bits(infracfg, INFRA_TOPAXI_PROTECTEN, mask, 0);
else else
regmap_write(infracfg, INFRA_TOPAXI_PROTECTEN_CLR, mask); regmap_write(infracfg, INFRA_TOPAXI_PROTECTEN_CLR, mask);
expired = jiffies + HZ; ret = regmap_read_poll_timeout(infracfg, INFRA_TOPAXI_PROTECTSTA1,
val, !(val & mask),
MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
while (1) {
u32 val;
ret = regmap_read(infracfg, INFRA_TOPAXI_PROTECTSTA1, &val);
if (ret)
return ret; return ret;
if (!(val & mask))
break;
cpu_relax();
if (time_after(jiffies, expired))
return -EIO;
}
return 0;
} }
...@@ -1458,19 +1458,12 @@ static int pwrap_probe(struct platform_device *pdev) ...@@ -1458,19 +1458,12 @@ static int pwrap_probe(struct platform_device *pdev)
int ret, irq; int ret, irq;
struct pmic_wrapper *wrp; struct pmic_wrapper *wrp;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
const struct of_device_id *of_id =
of_match_device(of_pwrap_match_tbl, &pdev->dev);
const struct of_device_id *of_slave_id = NULL; const struct of_device_id *of_slave_id = NULL;
struct resource *res; struct resource *res;
if (!of_id) { if (np->child)
dev_err(&pdev->dev, "Error: No device match found\n"); of_slave_id = of_match_node(of_slave_match_tbl, np->child);
return -ENODEV;
}
if (pdev->dev.of_node->child)
of_slave_id = of_match_node(of_slave_match_tbl,
pdev->dev.of_node->child);
if (!of_slave_id) { if (!of_slave_id) {
dev_dbg(&pdev->dev, "slave pmic should be defined in dts\n"); dev_dbg(&pdev->dev, "slave pmic should be defined in dts\n");
return -EINVAL; return -EINVAL;
...@@ -1482,7 +1475,7 @@ static int pwrap_probe(struct platform_device *pdev) ...@@ -1482,7 +1475,7 @@ static int pwrap_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wrp); platform_set_drvdata(pdev, wrp);
wrp->master = of_id->data; wrp->master = of_device_get_match_data(&pdev->dev);
wrp->slave = of_slave_id->data; wrp->slave = of_slave_id->data;
wrp->dev = &pdev->dev; wrp->dev = &pdev->dev;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -27,6 +28,13 @@ ...@@ -27,6 +28,13 @@
#include <dt-bindings/power/mt7623a-power.h> #include <dt-bindings/power/mt7623a-power.h>
#include <dt-bindings/power/mt8173-power.h> #include <dt-bindings/power/mt8173-power.h>
#define MTK_POLL_DELAY_US 10
#define MTK_POLL_TIMEOUT (jiffies_to_usecs(HZ))
#define MTK_SCPD_ACTIVE_WAKEUP BIT(0)
#define MTK_SCPD_FWAIT_SRAM BIT(1)
#define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x))
#define SPM_VDE_PWR_CON 0x0210 #define SPM_VDE_PWR_CON 0x0210
#define SPM_MFG_PWR_CON 0x0214 #define SPM_MFG_PWR_CON 0x0214
#define SPM_VEN_PWR_CON 0x0230 #define SPM_VEN_PWR_CON 0x0230
...@@ -116,7 +124,7 @@ struct scp_domain_data { ...@@ -116,7 +124,7 @@ struct scp_domain_data {
u32 sram_pdn_ack_bits; u32 sram_pdn_ack_bits;
u32 bus_prot_mask; u32 bus_prot_mask;
enum clk_id clk_id[MAX_CLKS]; enum clk_id clk_id[MAX_CLKS];
bool active_wakeup; u8 caps;
}; };
struct scp; struct scp;
...@@ -184,12 +192,10 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) ...@@ -184,12 +192,10 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
{ {
struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd); struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd);
struct scp *scp = scpd->scp; struct scp *scp = scpd->scp;
unsigned long timeout;
bool expired;
void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs; void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs;
u32 sram_pdn_ack = scpd->data->sram_pdn_ack_bits; u32 pdn_ack = scpd->data->sram_pdn_ack_bits;
u32 val; u32 val;
int ret; int ret, tmp;
int i; int i;
if (scpd->supply) { if (scpd->supply) {
...@@ -215,23 +221,10 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) ...@@ -215,23 +221,10 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
writel(val, ctl_addr); writel(val, ctl_addr);
/* wait until PWR_ACK = 1 */ /* wait until PWR_ACK = 1 */
timeout = jiffies + HZ; ret = readx_poll_timeout(scpsys_domain_is_on, scpd, tmp, tmp > 0,
expired = false; MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
while (1) { if (ret < 0)
ret = scpsys_domain_is_on(scpd);
if (ret > 0)
break;
if (expired) {
ret = -ETIMEDOUT;
goto err_pwr_ack; goto err_pwr_ack;
}
cpu_relax();
if (time_after(jiffies, timeout))
expired = true;
}
val &= ~PWR_CLK_DIS_BIT; val &= ~PWR_CLK_DIS_BIT;
writel(val, ctl_addr); writel(val, ctl_addr);
...@@ -245,22 +238,22 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) ...@@ -245,22 +238,22 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
val &= ~scpd->data->sram_pdn_bits; val &= ~scpd->data->sram_pdn_bits;
writel(val, ctl_addr); writel(val, ctl_addr);
/* wait until SRAM_PDN_ACK all 0 */ /* Either wait until SRAM_PDN_ACK all 0 or have a force wait */
timeout = jiffies + HZ; if (MTK_SCPD_CAPS(scpd, MTK_SCPD_FWAIT_SRAM)) {
expired = false; /*
while (sram_pdn_ack && (readl(ctl_addr) & sram_pdn_ack)) { * Currently, MTK_SCPD_FWAIT_SRAM is necessary only for
* MT7622_POWER_DOMAIN_WB and thus just a trivial setup is
* applied here.
*/
usleep_range(12000, 12100);
if (expired) { } else {
ret = -ETIMEDOUT; ret = readl_poll_timeout(ctl_addr, tmp, (tmp & pdn_ack) == 0,
MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
if (ret < 0)
goto err_pwr_ack; goto err_pwr_ack;
} }
cpu_relax();
if (time_after(jiffies, timeout))
expired = true;
}
if (scpd->data->bus_prot_mask) { if (scpd->data->bus_prot_mask) {
ret = mtk_infracfg_clear_bus_protection(scp->infracfg, ret = mtk_infracfg_clear_bus_protection(scp->infracfg,
scpd->data->bus_prot_mask, scpd->data->bus_prot_mask,
...@@ -289,12 +282,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) ...@@ -289,12 +282,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
{ {
struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd); struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd);
struct scp *scp = scpd->scp; struct scp *scp = scpd->scp;
unsigned long timeout;
bool expired;
void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs; void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs;
u32 pdn_ack = scpd->data->sram_pdn_ack_bits; u32 pdn_ack = scpd->data->sram_pdn_ack_bits;
u32 val; u32 val;
int ret; int ret, tmp;
int i; int i;
if (scpd->data->bus_prot_mask) { if (scpd->data->bus_prot_mask) {
...@@ -310,19 +301,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) ...@@ -310,19 +301,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
writel(val, ctl_addr); writel(val, ctl_addr);
/* wait until SRAM_PDN_ACK all 1 */ /* wait until SRAM_PDN_ACK all 1 */
timeout = jiffies + HZ; ret = readl_poll_timeout(ctl_addr, tmp, (tmp & pdn_ack) == pdn_ack,
expired = false; MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
while (pdn_ack && (readl(ctl_addr) & pdn_ack) != pdn_ack) { if (ret < 0)
if (expired) {
ret = -ETIMEDOUT;
goto out; goto out;
}
cpu_relax();
if (time_after(jiffies, timeout))
expired = true;
}
val |= PWR_ISO_BIT; val |= PWR_ISO_BIT;
writel(val, ctl_addr); writel(val, ctl_addr);
...@@ -340,23 +322,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) ...@@ -340,23 +322,10 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
writel(val, ctl_addr); writel(val, ctl_addr);
/* wait until PWR_ACK = 0 */ /* wait until PWR_ACK = 0 */
timeout = jiffies + HZ; ret = readx_poll_timeout(scpsys_domain_is_on, scpd, tmp, tmp == 0,
expired = false; MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
while (1) { if (ret < 0)
ret = scpsys_domain_is_on(scpd);
if (ret == 0)
break;
if (expired) {
ret = -ETIMEDOUT;
goto out; goto out;
}
cpu_relax();
if (time_after(jiffies, timeout))
expired = true;
}
for (i = 0; i < MAX_CLKS && scpd->clk[i]; i++) for (i = 0; i < MAX_CLKS && scpd->clk[i]; i++)
clk_disable_unprepare(scpd->clk[i]); clk_disable_unprepare(scpd->clk[i]);
...@@ -469,7 +438,7 @@ static struct scp *init_scp(struct platform_device *pdev, ...@@ -469,7 +438,7 @@ static struct scp *init_scp(struct platform_device *pdev,
genpd->name = data->name; genpd->name = data->name;
genpd->power_off = scpsys_power_off; genpd->power_off = scpsys_power_off;
genpd->power_on = scpsys_power_on; genpd->power_on = scpsys_power_on;
if (scpd->data->active_wakeup) if (MTK_SCPD_CAPS(scpd, MTK_SCPD_ACTIVE_WAKEUP))
genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP; genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP;
} }
...@@ -522,7 +491,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -522,7 +491,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M | .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M |
MT2701_TOP_AXI_PROT_EN_CONN_S, MT2701_TOP_AXI_PROT_EN_CONN_S,
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_DISP] = { [MT2701_POWER_DOMAIN_DISP] = {
.name = "disp", .name = "disp",
...@@ -531,7 +500,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -531,7 +500,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.clk_id = {CLK_MM}, .clk_id = {CLK_MM},
.bus_prot_mask = MT2701_TOP_AXI_PROT_EN_MM_M0, .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_MM_M0,
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_MFG] = { [MT2701_POWER_DOMAIN_MFG] = {
.name = "mfg", .name = "mfg",
...@@ -540,7 +509,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -540,7 +509,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(12, 12), .sram_pdn_ack_bits = GENMASK(12, 12),
.clk_id = {CLK_MFG}, .clk_id = {CLK_MFG},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_VDEC] = { [MT2701_POWER_DOMAIN_VDEC] = {
.name = "vdec", .name = "vdec",
...@@ -549,7 +518,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -549,7 +518,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(12, 12), .sram_pdn_ack_bits = GENMASK(12, 12),
.clk_id = {CLK_MM}, .clk_id = {CLK_MM},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_ISP] = { [MT2701_POWER_DOMAIN_ISP] = {
.name = "isp", .name = "isp",
...@@ -558,7 +527,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -558,7 +527,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(13, 12), .sram_pdn_ack_bits = GENMASK(13, 12),
.clk_id = {CLK_MM}, .clk_id = {CLK_MM},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_BDP] = { [MT2701_POWER_DOMAIN_BDP] = {
.name = "bdp", .name = "bdp",
...@@ -566,7 +535,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -566,7 +535,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.ctl_offs = SPM_BDP_PWR_CON, .ctl_offs = SPM_BDP_PWR_CON,
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_ETH] = { [MT2701_POWER_DOMAIN_ETH] = {
.name = "eth", .name = "eth",
...@@ -575,7 +544,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -575,7 +544,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_ETHIF}, .clk_id = {CLK_ETHIF},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_HIF] = { [MT2701_POWER_DOMAIN_HIF] = {
.name = "hif", .name = "hif",
...@@ -584,14 +553,14 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { ...@@ -584,14 +553,14 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_ETHIF}, .clk_id = {CLK_ETHIF},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2701_POWER_DOMAIN_IFR_MSC] = { [MT2701_POWER_DOMAIN_IFR_MSC] = {
.name = "ifr_msc", .name = "ifr_msc",
.sta_mask = PWR_STATUS_IFR_MSC, .sta_mask = PWR_STATUS_IFR_MSC,
.ctl_offs = SPM_IFR_MSC_PWR_CON, .ctl_offs = SPM_IFR_MSC_PWR_CON,
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
}; };
...@@ -606,7 +575,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -606,7 +575,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(8, 8), .sram_pdn_bits = GENMASK(8, 8),
.sram_pdn_ack_bits = GENMASK(12, 12), .sram_pdn_ack_bits = GENMASK(12, 12),
.clk_id = {CLK_MM}, .clk_id = {CLK_MM},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_VDEC] = { [MT2712_POWER_DOMAIN_VDEC] = {
.name = "vdec", .name = "vdec",
...@@ -615,7 +584,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -615,7 +584,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(8, 8), .sram_pdn_bits = GENMASK(8, 8),
.sram_pdn_ack_bits = GENMASK(12, 12), .sram_pdn_ack_bits = GENMASK(12, 12),
.clk_id = {CLK_MM, CLK_VDEC}, .clk_id = {CLK_MM, CLK_VDEC},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_VENC] = { [MT2712_POWER_DOMAIN_VENC] = {
.name = "venc", .name = "venc",
...@@ -624,7 +593,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -624,7 +593,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_MM, CLK_VENC, CLK_JPGDEC}, .clk_id = {CLK_MM, CLK_VENC, CLK_JPGDEC},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_ISP] = { [MT2712_POWER_DOMAIN_ISP] = {
.name = "isp", .name = "isp",
...@@ -633,7 +602,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -633,7 +602,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(13, 12), .sram_pdn_ack_bits = GENMASK(13, 12),
.clk_id = {CLK_MM}, .clk_id = {CLK_MM},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_AUDIO] = { [MT2712_POWER_DOMAIN_AUDIO] = {
.name = "audio", .name = "audio",
...@@ -642,7 +611,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -642,7 +611,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_AUDIO}, .clk_id = {CLK_AUDIO},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_USB] = { [MT2712_POWER_DOMAIN_USB] = {
.name = "usb", .name = "usb",
...@@ -651,7 +620,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -651,7 +620,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(10, 8), .sram_pdn_bits = GENMASK(10, 8),
.sram_pdn_ack_bits = GENMASK(14, 12), .sram_pdn_ack_bits = GENMASK(14, 12),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_USB2] = { [MT2712_POWER_DOMAIN_USB2] = {
.name = "usb2", .name = "usb2",
...@@ -660,7 +629,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -660,7 +629,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(10, 8), .sram_pdn_bits = GENMASK(10, 8),
.sram_pdn_ack_bits = GENMASK(14, 12), .sram_pdn_ack_bits = GENMASK(14, 12),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_MFG] = { [MT2712_POWER_DOMAIN_MFG] = {
.name = "mfg", .name = "mfg",
...@@ -670,7 +639,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -670,7 +639,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_ack_bits = GENMASK(16, 16), .sram_pdn_ack_bits = GENMASK(16, 16),
.clk_id = {CLK_MFG}, .clk_id = {CLK_MFG},
.bus_prot_mask = BIT(14) | BIT(21) | BIT(23), .bus_prot_mask = BIT(14) | BIT(21) | BIT(23),
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_MFG_SC1] = { [MT2712_POWER_DOMAIN_MFG_SC1] = {
.name = "mfg_sc1", .name = "mfg_sc1",
...@@ -679,7 +648,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -679,7 +648,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(8, 8), .sram_pdn_bits = GENMASK(8, 8),
.sram_pdn_ack_bits = GENMASK(16, 16), .sram_pdn_ack_bits = GENMASK(16, 16),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_MFG_SC2] = { [MT2712_POWER_DOMAIN_MFG_SC2] = {
.name = "mfg_sc2", .name = "mfg_sc2",
...@@ -688,7 +657,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -688,7 +657,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(8, 8), .sram_pdn_bits = GENMASK(8, 8),
.sram_pdn_ack_bits = GENMASK(16, 16), .sram_pdn_ack_bits = GENMASK(16, 16),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT2712_POWER_DOMAIN_MFG_SC3] = { [MT2712_POWER_DOMAIN_MFG_SC3] = {
.name = "mfg_sc3", .name = "mfg_sc3",
...@@ -697,7 +666,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = { ...@@ -697,7 +666,7 @@ static const struct scp_domain_data scp_domain_data_mt2712[] = {
.sram_pdn_bits = GENMASK(8, 8), .sram_pdn_bits = GENMASK(8, 8),
.sram_pdn_ack_bits = GENMASK(16, 16), .sram_pdn_ack_bits = GENMASK(16, 16),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
}; };
...@@ -797,7 +766,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = { ...@@ -797,7 +766,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = {
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.bus_prot_mask = MT7622_TOP_AXI_PROT_EN_ETHSYS, .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_ETHSYS,
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT7622_POWER_DOMAIN_HIF0] = { [MT7622_POWER_DOMAIN_HIF0] = {
.name = "hif0", .name = "hif0",
...@@ -807,7 +776,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = { ...@@ -807,7 +776,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = {
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_HIFSEL}, .clk_id = {CLK_HIFSEL},
.bus_prot_mask = MT7622_TOP_AXI_PROT_EN_HIF0, .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_HIF0,
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT7622_POWER_DOMAIN_HIF1] = { [MT7622_POWER_DOMAIN_HIF1] = {
.name = "hif1", .name = "hif1",
...@@ -817,7 +786,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = { ...@@ -817,7 +786,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = {
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_HIFSEL}, .clk_id = {CLK_HIFSEL},
.bus_prot_mask = MT7622_TOP_AXI_PROT_EN_HIF1, .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_HIF1,
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT7622_POWER_DOMAIN_WB] = { [MT7622_POWER_DOMAIN_WB] = {
.name = "wb", .name = "wb",
...@@ -827,7 +796,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = { ...@@ -827,7 +796,7 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = {
.sram_pdn_ack_bits = 0, .sram_pdn_ack_bits = 0,
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.bus_prot_mask = MT7622_TOP_AXI_PROT_EN_WB, .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_WB,
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP | MTK_SCPD_FWAIT_SRAM,
}, },
}; };
...@@ -843,7 +812,7 @@ static const struct scp_domain_data scp_domain_data_mt7623a[] = { ...@@ -843,7 +812,7 @@ static const struct scp_domain_data scp_domain_data_mt7623a[] = {
.bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M | .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M |
MT2701_TOP_AXI_PROT_EN_CONN_S, MT2701_TOP_AXI_PROT_EN_CONN_S,
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT7623A_POWER_DOMAIN_ETH] = { [MT7623A_POWER_DOMAIN_ETH] = {
.name = "eth", .name = "eth",
...@@ -852,7 +821,7 @@ static const struct scp_domain_data scp_domain_data_mt7623a[] = { ...@@ -852,7 +821,7 @@ static const struct scp_domain_data scp_domain_data_mt7623a[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_ETHIF}, .clk_id = {CLK_ETHIF},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT7623A_POWER_DOMAIN_HIF] = { [MT7623A_POWER_DOMAIN_HIF] = {
.name = "hif", .name = "hif",
...@@ -861,14 +830,14 @@ static const struct scp_domain_data scp_domain_data_mt7623a[] = { ...@@ -861,14 +830,14 @@ static const struct scp_domain_data scp_domain_data_mt7623a[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_ETHIF}, .clk_id = {CLK_ETHIF},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT7623A_POWER_DOMAIN_IFR_MSC] = { [MT7623A_POWER_DOMAIN_IFR_MSC] = {
.name = "ifr_msc", .name = "ifr_msc",
.sta_mask = PWR_STATUS_IFR_MSC, .sta_mask = PWR_STATUS_IFR_MSC,
.ctl_offs = SPM_IFR_MSC_PWR_CON, .ctl_offs = SPM_IFR_MSC_PWR_CON,
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
}; };
...@@ -934,7 +903,7 @@ static const struct scp_domain_data scp_domain_data_mt8173[] = { ...@@ -934,7 +903,7 @@ static const struct scp_domain_data scp_domain_data_mt8173[] = {
.sram_pdn_bits = GENMASK(11, 8), .sram_pdn_bits = GENMASK(11, 8),
.sram_pdn_ack_bits = GENMASK(15, 12), .sram_pdn_ack_bits = GENMASK(15, 12),
.clk_id = {CLK_NONE}, .clk_id = {CLK_NONE},
.active_wakeup = true, .caps = MTK_SCPD_ACTIVE_WAKEUP,
}, },
[MT8173_POWER_DOMAIN_MFG_ASYNC] = { [MT8173_POWER_DOMAIN_MFG_ASYNC] = {
.name = "mfg_async", .name = "mfg_async",
...@@ -1067,15 +1036,13 @@ static const struct of_device_id of_scpsys_match_tbl[] = { ...@@ -1067,15 +1036,13 @@ static const struct of_device_id of_scpsys_match_tbl[] = {
static int scpsys_probe(struct platform_device *pdev) static int scpsys_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match;
const struct scp_subdomain *sd; const struct scp_subdomain *sd;
const struct scp_soc_data *soc; const struct scp_soc_data *soc;
struct scp *scp; struct scp *scp;
struct genpd_onecell_data *pd_data; struct genpd_onecell_data *pd_data;
int i, ret; int i, ret;
match = of_match_device(of_scpsys_match_tbl, &pdev->dev); soc = of_device_get_match_data(&pdev->dev);
soc = (const struct scp_soc_data *)match->data;
scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs, scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs,
soc->bus_prot_reg_update); soc->bus_prot_reg_update);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <linux/ktime.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/bug.h> #include <linux/bug.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment