Commit 97a56667 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'v5.13-next-soc' of...

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

devapc:
- add missing MODULE_DEVICE_TABLE to fix modalias

mkt-pm-domains:
- register smi node as regmap and not as syscon
- prepare-enable and unprepare-disable dependent clocks

pwrap:
- add support for MT8195

* tag 'v5.13-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux:
  soc: mediatek: pwrap: add pwrap driver for MT8195 SoC
  dt-bindings: mediatek: add compatible for MT8195 pwrap
  soc: mtk-pm-domains: Fix the clock prepared issue
  soc: mtk-pm-domains: do not register smi node as syscon
  soc: mediatek: add missing MODULE_DEVICE_TABLE

Link: https://lore.kernel.org/r/479ec9ad-95d3-ce91-8243-63596c4c6676@gmail.comSigned-off-by: default avatarOlof Johansson <olof@lixom.net>
parents ec7f5cff e88edc97
...@@ -27,6 +27,7 @@ Required properties in pwrap device node. ...@@ -27,6 +27,7 @@ Required properties in pwrap device node.
"mediatek,mt8135-pwrap" for MT8135 SoCs "mediatek,mt8135-pwrap" for MT8135 SoCs
"mediatek,mt8173-pwrap" for MT8173 SoCs "mediatek,mt8173-pwrap" for MT8173 SoCs
"mediatek,mt8183-pwrap" for MT8183 SoCs "mediatek,mt8183-pwrap" for MT8183 SoCs
"mediatek,mt8195-pwrap" for MT8195 SoCs
"mediatek,mt8516-pwrap" for MT8516 SoCs "mediatek,mt8516-pwrap" for MT8516 SoCs
- interrupts: IRQ for pwrap in SOC - interrupts: IRQ for pwrap in SOC
- reg-names: Must include the following entries: - reg-names: Must include the following entries:
......
...@@ -234,6 +234,7 @@ static const struct of_device_id mtk_devapc_dt_match[] = { ...@@ -234,6 +234,7 @@ static const struct of_device_id mtk_devapc_dt_match[] = {
}, { }, {
}, },
}; };
MODULE_DEVICE_TABLE(of, mtk_devapc_dt_match);
static int mtk_devapc_probe(struct platform_device *pdev) static int mtk_devapc_probe(struct platform_device *pdev)
{ {
......
...@@ -211,7 +211,7 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) ...@@ -211,7 +211,7 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
if (ret) if (ret)
return ret; return ret;
ret = clk_bulk_enable(pd->num_clks, pd->clks); ret = clk_bulk_prepare_enable(pd->num_clks, pd->clks);
if (ret) if (ret)
goto err_reg; goto err_reg;
...@@ -229,7 +229,7 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) ...@@ -229,7 +229,7 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT);
regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
ret = clk_bulk_enable(pd->num_subsys_clks, pd->subsys_clks); ret = clk_bulk_prepare_enable(pd->num_subsys_clks, pd->subsys_clks);
if (ret) if (ret)
goto err_pwr_ack; goto err_pwr_ack;
...@@ -246,9 +246,9 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) ...@@ -246,9 +246,9 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
err_disable_sram: err_disable_sram:
scpsys_sram_disable(pd); scpsys_sram_disable(pd);
err_disable_subsys_clks: err_disable_subsys_clks:
clk_bulk_disable(pd->num_subsys_clks, pd->subsys_clks); clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks);
err_pwr_ack: err_pwr_ack:
clk_bulk_disable(pd->num_clks, pd->clks); clk_bulk_disable_unprepare(pd->num_clks, pd->clks);
err_reg: err_reg:
scpsys_regulator_disable(pd->supply); scpsys_regulator_disable(pd->supply);
return ret; return ret;
...@@ -269,7 +269,7 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) ...@@ -269,7 +269,7 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
if (ret < 0) if (ret < 0)
return ret; return ret;
clk_bulk_disable(pd->num_subsys_clks, pd->subsys_clks); clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks);
/* subsys power off */ /* subsys power off */
regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT);
...@@ -284,7 +284,7 @@ static int scpsys_power_off(struct generic_pm_domain *genpd) ...@@ -284,7 +284,7 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
if (ret < 0) if (ret < 0)
return ret; return ret;
clk_bulk_disable(pd->num_clks, pd->clks); clk_bulk_disable_unprepare(pd->num_clks, pd->clks);
scpsys_regulator_disable(pd->supply); scpsys_regulator_disable(pd->supply);
...@@ -297,6 +297,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no ...@@ -297,6 +297,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
const struct scpsys_domain_data *domain_data; const struct scpsys_domain_data *domain_data;
struct scpsys_domain *pd; struct scpsys_domain *pd;
struct device_node *root_node = scpsys->dev->of_node; struct device_node *root_node = scpsys->dev->of_node;
struct device_node *smi_node;
struct property *prop; struct property *prop;
const char *clk_name; const char *clk_name;
int i, ret, num_clks; int i, ret, num_clks;
...@@ -352,9 +353,13 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no ...@@ -352,9 +353,13 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
if (IS_ERR(pd->infracfg)) if (IS_ERR(pd->infracfg))
return ERR_CAST(pd->infracfg); return ERR_CAST(pd->infracfg);
pd->smi = syscon_regmap_lookup_by_phandle_optional(node, "mediatek,smi"); smi_node = of_parse_phandle(node, "mediatek,smi", 0);
if (IS_ERR(pd->smi)) if (smi_node) {
return ERR_CAST(pd->smi); pd->smi = device_node_to_regmap(smi_node);
of_node_put(smi_node);
if (IS_ERR(pd->smi))
return ERR_CAST(pd->smi);
}
num_clks = of_clk_get_parent_count(node); num_clks = of_clk_get_parent_count(node);
if (num_clks > 0) { if (num_clks > 0) {
...@@ -405,14 +410,6 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no ...@@ -405,14 +410,6 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
pd->subsys_clks[i].clk = clk; pd->subsys_clks[i].clk = clk;
} }
ret = clk_bulk_prepare(pd->num_clks, pd->clks);
if (ret)
goto err_put_subsys_clocks;
ret = clk_bulk_prepare(pd->num_subsys_clks, pd->subsys_clks);
if (ret)
goto err_unprepare_clocks;
/* /*
* Initially turn on all domains to make the domains usable * Initially turn on all domains to make the domains usable
* with !CONFIG_PM and to get the hardware in sync with the * with !CONFIG_PM and to get the hardware in sync with the
...@@ -427,7 +424,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no ...@@ -427,7 +424,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
ret = scpsys_power_on(&pd->genpd); ret = scpsys_power_on(&pd->genpd);
if (ret < 0) { if (ret < 0) {
dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret);
goto err_unprepare_clocks; goto err_put_subsys_clocks;
} }
} }
...@@ -435,7 +432,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no ...@@ -435,7 +432,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
ret = -EINVAL; ret = -EINVAL;
dev_err(scpsys->dev, dev_err(scpsys->dev,
"power domain with id %d already exists, check your device-tree\n", id); "power domain with id %d already exists, check your device-tree\n", id);
goto err_unprepare_subsys_clocks; goto err_put_subsys_clocks;
} }
if (!pd->data->name) if (!pd->data->name)
...@@ -455,10 +452,6 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no ...@@ -455,10 +452,6 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
return scpsys->pd_data.domains[id]; return scpsys->pd_data.domains[id];
err_unprepare_subsys_clocks:
clk_bulk_unprepare(pd->num_subsys_clks, pd->subsys_clks);
err_unprepare_clocks:
clk_bulk_unprepare(pd->num_clks, pd->clks);
err_put_subsys_clocks: err_put_subsys_clocks:
clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks); clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks);
err_put_clocks: err_put_clocks:
...@@ -537,10 +530,7 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd) ...@@ -537,10 +530,7 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd)
"failed to remove domain '%s' : %d - state may be inconsistent\n", "failed to remove domain '%s' : %d - state may be inconsistent\n",
pd->genpd.name, ret); pd->genpd.name, ret);
clk_bulk_unprepare(pd->num_clks, pd->clks);
clk_bulk_put(pd->num_clks, pd->clks); clk_bulk_put(pd->num_clks, pd->clks);
clk_bulk_unprepare(pd->num_subsys_clks, pd->subsys_clks);
clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks); clk_bulk_put(pd->num_subsys_clks, pd->subsys_clks);
} }
......
...@@ -961,6 +961,23 @@ static int mt8183_regs[] = { ...@@ -961,6 +961,23 @@ static int mt8183_regs[] = {
[PWRAP_WACS2_VLDCLR] = 0xC28, [PWRAP_WACS2_VLDCLR] = 0xC28,
}; };
static int mt8195_regs[] = {
[PWRAP_INIT_DONE2] = 0x0,
[PWRAP_STAUPD_CTRL] = 0x4C,
[PWRAP_TIMER_EN] = 0x3E4,
[PWRAP_INT_EN] = 0x420,
[PWRAP_INT_FLG] = 0x428,
[PWRAP_INT_CLR] = 0x42C,
[PWRAP_INT1_EN] = 0x450,
[PWRAP_INT1_FLG] = 0x458,
[PWRAP_INT1_CLR] = 0x45C,
[PWRAP_WACS2_CMD] = 0x880,
[PWRAP_SWINF_2_WDATA_31_0] = 0x884,
[PWRAP_SWINF_2_RDATA_31_0] = 0x894,
[PWRAP_WACS2_VLDCLR] = 0x8A4,
[PWRAP_WACS2_RDATA] = 0x8A8,
};
static int mt8516_regs[] = { static int mt8516_regs[] = {
[PWRAP_MUX_SEL] = 0x0, [PWRAP_MUX_SEL] = 0x0,
[PWRAP_WRAP_EN] = 0x4, [PWRAP_WRAP_EN] = 0x4,
...@@ -1066,6 +1083,7 @@ enum pwrap_type { ...@@ -1066,6 +1083,7 @@ enum pwrap_type {
PWRAP_MT8135, PWRAP_MT8135,
PWRAP_MT8173, PWRAP_MT8173,
PWRAP_MT8183, PWRAP_MT8183,
PWRAP_MT8195,
PWRAP_MT8516, PWRAP_MT8516,
}; };
...@@ -1525,6 +1543,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp) ...@@ -1525,6 +1543,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)
break; break;
case PWRAP_MT6873: case PWRAP_MT6873:
case PWRAP_MT8183: case PWRAP_MT8183:
case PWRAP_MT8195:
break; break;
} }
...@@ -2025,6 +2044,19 @@ static const struct pmic_wrapper_type pwrap_mt8183 = { ...@@ -2025,6 +2044,19 @@ static const struct pmic_wrapper_type pwrap_mt8183 = {
.init_soc_specific = pwrap_mt8183_init_soc_specific, .init_soc_specific = pwrap_mt8183_init_soc_specific,
}; };
static struct pmic_wrapper_type pwrap_mt8195 = {
.regs = mt8195_regs,
.type = PWRAP_MT8195,
.arb_en_all = 0x777f, /* NEED CONFIRM */
.int_en_all = 0x180000, /* NEED CONFIRM */
.int1_en_all = 0,
.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_ARB,
.init_reg_clock = pwrap_common_init_reg_clock,
.init_soc_specific = NULL,
};
static struct pmic_wrapper_type pwrap_mt8516 = { static struct pmic_wrapper_type pwrap_mt8516 = {
.regs = mt8516_regs, .regs = mt8516_regs,
.type = PWRAP_MT8516, .type = PWRAP_MT8516,
...@@ -2065,6 +2097,9 @@ static const struct of_device_id of_pwrap_match_tbl[] = { ...@@ -2065,6 +2097,9 @@ static const struct of_device_id of_pwrap_match_tbl[] = {
}, { }, {
.compatible = "mediatek,mt8183-pwrap", .compatible = "mediatek,mt8183-pwrap",
.data = &pwrap_mt8183, .data = &pwrap_mt8183,
}, {
.compatible = "mediatek,mt8195-pwrap",
.data = &pwrap_mt8195,
}, { }, {
.compatible = "mediatek,mt8516-pwrap", .compatible = "mediatek,mt8516-pwrap",
.data = &pwrap_mt8516, .data = &pwrap_mt8516,
......
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