[PATCH 01/11] power: pmic: mtk-pwrap: add MT8195 support

David Lechner dlechner at baylibre.com
Tue Mar 17 21:59:05 CET 2026


On 3/17/26 3:24 PM, David Lechner wrote:
> On 3/17/26 9:24 AM, Julien Stephan wrote:
>> Add mt8195 support.
>> Support comes directly from commit e88edc977b00 ("soc: mediatek: pwrap:
>> add pwrap driver for MT8195 SoC") from the Linux Kernel
>>
>> Signed-off-by: Julien Stephan <jstephan at baylibre.com>
>> ---
>>  drivers/power/pmic/mtk-pwrap.c | 31 +++++++++++++++++++++++++++++++
>>  1 file changed, 31 insertions(+)
>>
>> diff --git a/drivers/power/pmic/mtk-pwrap.c b/drivers/power/pmic/mtk-pwrap.c
>> index 3e3a691d9e8..8ff6458a5f2 100644
>> --- a/drivers/power/pmic/mtk-pwrap.c
>> +++ b/drivers/power/pmic/mtk-pwrap.c
>> @@ -276,6 +276,23 @@ static int mt8189_regs[] = {
>>  	[PWRAP_WACS2_RDATA] =		0x8A8,
>>  };
>>  
>> +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,
>> +};
> 
> I think we need to take a harder look at the driver here. There are many
> registers that are accessed unconditionally in the code that aren't defined
> here. (It looks like the Linux driver has similar issues as well. And we
> have the same problem with mt8188 and mt8189 here in U-Boot.)
> 
> So either the code is broken and should have more conditionals or the
> register tables are incomplete.
> 
> Most of this is in pwrap_init() which is conditional on an earlier bootloader
> doing the initialization. If that is the case, we could avoid the issue
> by adding a capability flag PWRAP_CAP_INIT and use that to avoid calling
> pwrap_init() when we don't have the registers defined and raise an error
> instead.
> 
> 
> 	/*
> 	 * The PMIC could already be initialized by the bootloader.
> 	 * Skip initialization here in this case.
> 	 */
> 	if (!pwrap_readl(wrp, PWRAP_INIT_DONE2)) {
> +		if (!HAS_CAP(wrp->master->caps, PWRAP_CAP_INIT)) {
> +			dev_err(dev, "PMIC is not initialized\n");
> +			return -EINVAL;
> +		}
> +
> 		ret = pwrap_init(wrp);
> 		if (ret) {
> 			dev_err(dev, "init failed with %d\n", ret);
> 			return ret;
> 		}
> 	}
> 
FYI, I've prepared a patch and tested this on Genio 720 (mt8189 in this
context), so it seems OK to do this at least on that platform. An earlier
bootloader is initializing the PMIC already. I'll wait to send it though
until we get feedback on the other issues.


More information about the U-Boot mailing list