[PATCH 2/3] power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag
Macpaul Lin (林智斌)
Macpaul.Lin at mediatek.com
Mon Apr 13 10:56:07 CEST 2026
On Fri, 2026-03-27 at 14:03 -0500, David Lechner wrote:
> Add a PWRAP_CAP_WDT_SRC flag to indicate if a PMIC wrapper has a
> WDT_SRC
> or not. Then use this to conditionally enable the watchdog timer.
>
> Prior to this change, since the register was not defined, it
> defaulted
> to 0, so the wrong register (DONE2) was being written to.
>
> Signed-off-by: David Lechner <dlechner at baylibre.com>
> ---
> drivers/power/pmic/mtk-pwrap.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/power/pmic/mtk-pwrap.c b/drivers/power/pmic/mtk-
> pwrap.c
> index 9ff06fdb3bd..d8498646921 100644
> --- a/drivers/power/pmic/mtk-pwrap.c
> +++ b/drivers/power/pmic/mtk-pwrap.c
> @@ -60,10 +60,11 @@ static const struct pmic_child_info
> mt6359_pmic_children_info[] = {
>
> /* Group of bits used for shown pwrap capability */
> #define PWRAP_CAP_INT1_EN BIT(3)
> -#define PWRAP_CAP_WDT_SRC1 BIT(4)
> -#define PWRAP_CAP_ARB BIT(5)
> +#define PWRAP_CAP_WDT_SRC BIT(4)
> +#define PWRAP_CAP_WDT_SRC1 BIT(5)
> +#define PWRAP_CAP_ARB BIT(6)
> /* To implement this capability, the registers used in pwrap_init()
> must be defined. */
> -#define PWRAP_CAP_INIT BIT(6)
> +#define PWRAP_CAP_INIT BIT(7)
>
> /* defines for slave device wrapper registers */
> enum dew_regs {
> @@ -780,7 +781,8 @@ static int mtk_pwrap_probe(struct udevice *dev)
> * Since STAUPD was not used on mt8173 platform,
> * so STAUPD of WDT_SRC which should be turned off
> */
> - pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
> + if (HAS_CAP(wrp->master->caps, PWRAP_CAP_WDT_SRC))
> + pwrap_writel(wrp, wrp->master->wdt_src,
> PWRAP_WDT_SRC_EN);
>
> if (HAS_CAP(wrp->master->caps, PWRAP_CAP_WDT_SRC1))
> pwrap_writel(wrp, wrp->master->wdt_src,
> PWRAP_WDT_SRC_EN_1);
> @@ -912,7 +914,7 @@ static const struct pmic_wrapper_type
> pwrap_mt8365 = {
> .int1_en_all = 0x0,
> .spi_w = PWRAP_MAN_CMD_SPI_WRITE,
> .wdt_src = PWRAP_WDT_SRC_MASK_ALL,
> - .caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC1 |
> PWRAP_CAP_INIT,
> + .caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC |
> PWRAP_CAP_WDT_SRC1 | PWRAP_CAP_INIT,
> };
>
> static const struct udevice_id mtk_pwrap_ids[] = {
>
Reviewed-by: Macpaul Lin <macpaul.lin at mediatek.com>
Thanks!
Macpaul Lin
More information about the U-Boot
mailing list