Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbe379fc authored by Henry Chen's avatar Henry Chen Committed by Matthias Brugger
Browse files

soc: mediatek: Move the initial setting of pmic wrap interrupt before requesting irq.



The watchdog may not be initialized by the bootloader, even if the rest
of the pwrap is. Move the watchdog initialization out of pwrap_init() to
make sure the watchdog is always initialized and not only when the pwrap
is uninitialized.

Signed-off-by: default avatarHenry Chen <henryc.chen@mediatek.com>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
parent 1f93e4a9
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -725,10 +725,6 @@ static int pwrap_init(struct pmic_wrapper *wrp)
	pwrap_writel(wrp, 0x1, PWRAP_WACS2_EN);
	pwrap_writel(wrp, 0x1, PWRAP_WACS2_EN);
	pwrap_writel(wrp, 0x5, PWRAP_STAUPD_PRD);
	pwrap_writel(wrp, 0x5, PWRAP_STAUPD_PRD);
	pwrap_writel(wrp, 0xff, PWRAP_STAUPD_GRPEN);
	pwrap_writel(wrp, 0xff, PWRAP_STAUPD_GRPEN);
	pwrap_writel(wrp, 0xf, PWRAP_WDT_UNIT);
	pwrap_writel(wrp, 0xffffffff, PWRAP_WDT_SRC_EN);
	pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
	pwrap_writel(wrp, ~((1 << 31) | (1 << 1)), PWRAP_INT_EN);


	if (pwrap_is_mt8135(wrp)) {
	if (pwrap_is_mt8135(wrp)) {
		/* enable pwrap events and pwrap bridge in AP side */
		/* enable pwrap events and pwrap bridge in AP side */
@@ -896,6 +892,12 @@ static int pwrap_probe(struct platform_device *pdev)
		return -ENODEV;
		return -ENODEV;
	}
	}


	/* Initialize watchdog, may not be done by the bootloader */
	pwrap_writel(wrp, 0xf, PWRAP_WDT_UNIT);
	pwrap_writel(wrp, 0xffffffff, PWRAP_WDT_SRC_EN);
	pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
	pwrap_writel(wrp, ~((1 << 31) | (1 << 1)), PWRAP_INT_EN);

	irq = platform_get_irq(pdev, 0);
	irq = platform_get_irq(pdev, 0);
	ret = devm_request_irq(wrp->dev, irq, pwrap_interrupt, IRQF_TRIGGER_HIGH,
	ret = devm_request_irq(wrp->dev, irq, pwrap_interrupt, IRQF_TRIGGER_HIGH,
			"mt-pmic-pwrap", wrp);
			"mt-pmic-pwrap", wrp);