From: Fadwa CHIBY <[email protected]>
Hello,
MT8365 requires an extra 2 clocks to be enabled to behave correctly.
This series contains patches adding the support of mt8365 pwrap.
changes in v3:
- Modify "sys" and "tmr" descriptions to be more generic.
Changes in v2 :
- Rebase on top of linux-next/master
- Link to v1 "https://lore.kernel.org/linux-arm-kernel/[email protected]/"
Regards,
Fadwa CHIBY
Fabien Parent (3):
dt-bindings: soc: mediatek: pwrap: add MT8365 SoC bindings
soc: mediatek: pwrap: add support for sys & tmr clocks
soc: mediatek: pwrap: add mt8365 SoC support
.../bindings/soc/mediatek/pwrap.txt | 3 +
drivers/soc/mediatek/mtk-pmic-wrap.c | 114 +++++++++++++++++-
2 files changed, 113 insertions(+), 4 deletions(-)
--
2.25.1
From: Fabien Parent <[email protected]>
Add pwrap binding documentation for
Signed-off-by: Fabien Parent <[email protected]>
Signed-off-by: Fadwa CHIBY <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/soc/mediatek/pwrap.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt b/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
index d24e2bc444be..12e4b4260b40 100644
--- a/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
+++ b/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
@@ -30,6 +30,7 @@ Required properties in pwrap device node.
"mediatek,mt8186-pwrap" for MT8186 SoCs
"mediatek,mt8188-pwrap", "mediatek,mt8195-pwrap" for MT8188 SoCs
"mediatek,mt8195-pwrap" for MT8195 SoCs
+ "mediatek,mt8365-pwrap" for MT8365 SoCs
"mediatek,mt8516-pwrap" for MT8516 SoCs
- interrupts: IRQ for pwrap in SOC
- reg-names: "pwrap" is required; "pwrap-bridge" is optional.
@@ -39,6 +40,8 @@ Required properties in pwrap device node.
- clock-names: Must include the following entries:
"spi": SPI bus clock
"wrap": Main module clock
+ "sys": Optional system module clock
+ "tmr": Optional timer module clock
- clocks: Must contain an entry for each entry in clock-names.
Optional properities:
--
2.25.1
From: Fabien Parent <[email protected]>
MT8365 requires an extra 2 clocks to be enabled to behave correctly.
Add support these 2 clocks, they are made optional since they seem to
be present only on MT8365.
Signed-off-by: Fabien Parent <[email protected]>
Signed-off-by: Fadwa CHIBY <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/soc/mediatek/mtk-pmic-wrap.c | 36 ++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index eb82ae06697f..d56b00023ccd 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -1171,6 +1171,8 @@ struct pmic_wrapper {
const struct pwrap_slv_type *slave;
struct clk *clk_spi;
struct clk *clk_wrap;
+ struct clk *clk_sys;
+ struct clk *clk_tmr;
struct reset_control *rstc;
struct reset_control *rstc_bridge;
@@ -2214,6 +2216,20 @@ static int pwrap_probe(struct platform_device *pdev)
return PTR_ERR(wrp->clk_wrap);
}
+ wrp->clk_sys = devm_clk_get_optional(wrp->dev, "sys");
+ if (IS_ERR(wrp->clk_sys)) {
+ return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_sys),
+ "failed to get clock: %pe\n",
+ wrp->clk_sys);
+ }
+
+ wrp->clk_tmr = devm_clk_get_optional(wrp->dev, "tmr");
+ if (IS_ERR(wrp->clk_tmr)) {
+ return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_tmr),
+ "failed to get clock: %pe\n",
+ wrp->clk_tmr);
+ }
+
ret = clk_prepare_enable(wrp->clk_spi);
if (ret)
return ret;
@@ -2222,6 +2238,14 @@ static int pwrap_probe(struct platform_device *pdev)
if (ret)
goto err_out1;
+ ret = clk_prepare_enable(wrp->clk_sys);
+ if (ret)
+ goto err_out2;
+
+ ret = clk_prepare_enable(wrp->clk_tmr);
+ if (ret)
+ goto err_out3;
+
/* Enable internal dynamic clock */
if (HAS_CAP(wrp->master->caps, PWRAP_CAP_DCM)) {
pwrap_writel(wrp, 1, PWRAP_DCM_EN);
@@ -2236,7 +2260,7 @@ static int pwrap_probe(struct platform_device *pdev)
ret = pwrap_init(wrp);
if (ret) {
dev_dbg(wrp->dev, "init failed with %d\n", ret);
- goto err_out2;
+ goto err_out4;
}
}
@@ -2250,7 +2274,7 @@ static int pwrap_probe(struct platform_device *pdev)
if (!(pwrap_readl(wrp, PWRAP_WACS2_RDATA) & mask_done)) {
dev_dbg(wrp->dev, "initialization isn't finished\n");
ret = -ENODEV;
- goto err_out2;
+ goto err_out4;
}
/* Initialize watchdog, may not be done by the bootloader */
@@ -2288,7 +2312,7 @@ static int pwrap_probe(struct platform_device *pdev)
IRQF_TRIGGER_HIGH,
"mt-pmic-pwrap", wrp);
if (ret)
- goto err_out2;
+ goto err_out4;
wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, wrp->slave->regops->regmap);
if (IS_ERR(wrp->regmap)) {
@@ -2300,11 +2324,15 @@ static int pwrap_probe(struct platform_device *pdev)
if (ret) {
dev_dbg(wrp->dev, "failed to create child devices at %pOF\n",
np);
- goto err_out2;
+ goto err_out4;
}
return 0;
+err_out4:
+ clk_disable_unprepare(wrp->clk_tmr);
+err_out3:
+ clk_disable_unprepare(wrp->clk_sys);
err_out2:
clk_disable_unprepare(wrp->clk_wrap);
err_out1:
--
2.25.1
Il 31/10/22 10:33, [email protected] ha scritto:
> From: Fabien Parent <[email protected]>
>
> Add pwrap binding documentation for
>
> Signed-off-by: Fabien Parent <[email protected]>
> Signed-off-by: Fadwa CHIBY <[email protected]>
> Acked-by: Rob Herring <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
On 31/10/2022 10:33, [email protected] wrote:
> From: Fadwa CHIBY <[email protected]>
>
> Hello,
>
> MT8365 requires an extra 2 clocks to be enabled to behave correctly.
> This series contains patches adding the support of mt8365 pwrap.
>
> changes in v3:
> - Modify "sys" and "tmr" descriptions to be more generic.
> Changes in v2 :
> - Rebase on top of linux-next/master
> - Link to v1 "https://lore.kernel.org/linux-arm-kernel/[email protected]/"
>
> Regards,
> Fadwa CHIBY
>
> Fabien Parent (3):
> dt-bindings: soc: mediatek: pwrap: add MT8365 SoC bindings
> soc: mediatek: pwrap: add support for sys & tmr clocks
> soc: mediatek: pwrap: add mt8365 SoC support
>
> .../bindings/soc/mediatek/pwrap.txt | 3 +
> drivers/soc/mediatek/mtk-pmic-wrap.c | 114 +++++++++++++++++-
> 2 files changed, 113 insertions(+), 4 deletions(-)
>
Whole series applied, thanks!