Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Maud Spierings <maudspierings@gocontroll.com>,
	imx@lists.linux.dev, LW@KARO-electronics.de
Subject: Re: Strange PMIC behaviour with rohm bd71847 on Ka-Ro tx8m-1610 (imx8mm)
Date: Wed, 10 Sep 2025 09:25:47 +0300	[thread overview]
Message-ID: <f5736f7e-26ec-4a20-8f4d-82d45e719f3a@gmail.com> (raw)
In-Reply-To: <56e7a430-79dc-4598-8e58-809759cf0711@gocontroll.com>

On 09/09/2025 18:16, Maud Spierings wrote:
> I have been having some issues running mainline Linux on this specific 
> COM. Specifically with the shutdown/reboot behaviour seemingly being 
> inverted.
> 
> I have now figured out how to make shutdown actually behave like 
> shutdown. It seems like something is setting BD718XX_REG_TRANS_COND1 
> (0x20) to 0xcf. The only bit of code I can find that touches this 
> register is this:
> drivers/regulator/bd718x7-regulator.c bd718xx_probe():
> use_snvs = of_property_read_bool(pdev->dev.parent->of_node,
>                       "rohm,reset-snvs-powered");

AFAICS, this is the only place in kernel touching the TRANS_COND.

> /*
>   * Change the next stage from poweroff to be READY instead of SNVS
>   * for all reset types because OTP loading at READY will clear SEL
>   * bit allowing HW defaults for power rails to be used
>   */
> if (!use_snvs) {
>          err = regmap_update_bits(regmap, BD718XX_REG_TRANS_COND1,
>                       BD718XX_ON_REQ_POWEROFF_MASK |
>                       BD718XX_SWRESET_POWEROFF_MASK |
>                       BD718XX_WDOG_POWEROFF_MASK |
>                       BD718XX_KEY_L_POWEROFF_MASK,
>                       BD718XX_POWOFF_TO_RDY);
>          if (err)
>                  return dev_err_probe(&pdev->dev, err,
>                           "Failed to change reset target\n");
> 
>          dev_dbg(&pdev->dev, "Changed all resets from SVNS to READY\n");
> 
> }
> 
> Even with rohm,reset-snvs-powered set I still end up with 0xcf.

Yes. The driver is not - due to historical reasons :) - configuring the 
reset target to SNVS. This should be done by boot SW if SNVS is intended 
to be used. Then the "rohm,reset-snvs-powered" can be used to prevent 
the driver from overwriting the config, and to prevent the driver from 
taking the control of the boot-critical power-outputs. (This is because, 
when SNVS is used, the SW-controlled power-outputs will not get 
automatically enabled after reset - which may "brick" the device).

Some more discussion can be seen in this thread here:
https://lore.kernel.org/all/87bjs3auj9.fsf@geanix.com/

> I've had 
> to add the inverse in an else block to get the desired outcome.
> 
> else {
>          err = regmap_update_bits(regmap, BD718XX_REG_TRANS_COND1,
>                       BD718XX_ON_REQ_POWEROFF_MASK |
>                       BD718XX_SWRESET_POWEROFF_MASK |
>                       BD718XX_WDOG_POWEROFF_MASK |
>                       BD718XX_KEY_L_POWEROFF_MASK,
>                       BD718XX_POWOFF_TO_SNVS);
>          if (err)
>                  return dev_err_probe(&pdev->dev, err,
>                           "Failed to change reset target\n");
> 
>          dev_dbg(&pdev->dev, "Changed all resets from READY to SNVS\n");
> }

This would've originally been "The Right Thing To Do(tm)". Introducing 
it now in upstream would be risky - as discussed in the thread I linked 
above.

> 
> In uboot I get:
> 
> i2c md 0x4b 0x20.1 0x1
> 0020: c0    .
> 
> So something in the kernel is touching this register when it shouldn't.

1. Do you have the "rohm,reset-snvs-powered" set?
2. Can you read and print the TRANS_COND1 at the bd718x7 MFD driver's 
probe (before it instantiates the regulator driver or other sub devices?)
3. Please also read and print the register content in the else branch 
you added, before writing the TRANS_COND1.

(As I wrote above, AFAIR there should be no other places (in kernel) 
where the TRANS_COND1 is written. Are you sure this is not done by boot?)

Yours,
	-- Matti


  reply	other threads:[~2025-09-10  6:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 15:16 Strange PMIC behaviour with rohm bd71847 on Ka-Ro tx8m-1610 (imx8mm) Maud Spierings
2025-09-10  6:25 ` Matti Vaittinen [this message]
2025-09-10  8:49   ` Maud Spierings
2025-09-10  8:57     ` Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5736f7e-26ec-4a20-8f4d-82d45e719f3a@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=LW@KARO-electronics.de \
    --cc=imx@lists.linux.dev \
    --cc=maudspierings@gocontroll.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox