Skip to contentSkip to conversation

ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

PATCH In review Vidya Sagar 3 participants 9 messages Sep 22, 2014 – Oct 6, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

---
 arch/arm/boot/dts/tegra124-jetson-tk1.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/boot/dts/tegra124-jetson-tk1.dts +3 -0
index 029c9a02..5c2201a 100644
@@ -1550,6 +1550,9 @@
 					regulator-name = "+1.05V_RUN";
 					regulator-min-microvolt = <1050000>;
 					regulator-max-microvolt = <1050000>;
+					regulator-always-on;
+					regulator-boot-on;
+					ams,ext-control = <1>;
 				};
 
 				vddio_1v8: sd5 {
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 3 lines · Vidya Sagar

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

arch/arm/boot/dts/tegra124-jetson-tk1.dts line 1555

Quoted 1 line
arch/arm/boot/dts/tegra124-jetson-tk1.dts +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

#2 lore raw
Quoted 20 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 3 lines · Vidya Sagar

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Quoted 7 lines

arch/arm/boot/dts/tegra124-jetson-tk1.dts line 1555

Quoted 1 line
arch/arm/boot/dts/tegra124-jetson-tk1.dts +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume functionality.
The issue is that, when regulator_bulk_diable() is called, disabling one of the power rails (which is deriving its voltage from SD4) of PCIe is failing. The reason being, I2C controller is getting power gated before power rail disable is called.
Hence SD4 is made dependent on ENABLE1, which is nothing but the deep sleep signal coming from Tegra,
So eventually, SD4 will be powered off when system enters into deep-sleep state.
Source of information is from downstream kernel

#3 lore raw
Quoted 11 lines · Vidya Sagar
Quoted 11 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device
tree

Quoted 8 lines
Quoted 8 lines · Vidya Sagar
Quoted 3 lines

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Can you please comment on this aspect of the issue?

Quoted 11 lines
Quoted 7 lines

arch/arm/boot/dts/tegra124-jetson-tk1.dts line 1555

Quoted 1 line
arch/arm/boot/dts/tegra124-jetson-tk1.dts +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume functionality.
The issue is that, when regulator_bulk_diable() is called, disabling one of the power rails (which is deriving its voltage from SD4) of PCIe is failing. The reason being, I2C controller is getting power gated

Why is the fix being applied to SD4 if the issue is with a power rail derived from SD4? Shouldn't any fix be applied directly to the problematic rail rather than some parent rail?

Since the I2C controller is part of the SoC and we don't have power domain support yet, the only way the I2C controller can get power gated is when the SoC as a whole is turned off.

Quoted 1 line

before power rail disable is called.

... so without making SD4 dependant on ext-control, since no SW can be running at this point, the only way SD4 could get turned off is that the PMIC turns it off itself at the appropriate point in the system power sequence based on its OTP programming, or the board HW is already set up to turn off SD4 at the appropriate time somehow. Is that not happening? That would imply incorrect PMIC programming wouldn't it?

Quoted 2 lines

Hence SD4 is made dependent on ENABLE1, which is nothing but the deep sleep signal coming from Tegra, So eventually, SD4 will be powered off when system enters into deep-sleep state.

This sounds like a workaround that happens to make the system do what you want rather than a root-cause fix.

Quoted 1 line

Source of information is from downstream kernel

We need to use HW schematics and other primary data to determine the correct approach.

#4 lore raw
Quoted 57 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Monday, September 29, 2014 9:15 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device
tree

Quoted 11 lines · Vidya Sagar
Quoted 11 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1
device tree

Quoted 8 lines
Quoted 8 lines · Vidya Sagar
Quoted 3 lines

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Can you please comment on this aspect of the issue?

Quoted 9 lines
Quoted 7 lines

arch/arm/boot/dts/tegra124-jetson-tk1.dts line 1555

Quoted 1 line
arch/arm/boot/dts/tegra124-jetson-tk1.dts +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume

functionality.

Quoted 1 line

The issue is that, when regulator_bulk_diable() is called, disabling one of

the power rails (which is deriving its voltage from SD4) of PCIe is failing.

Quoted 1 line

The reason being, I2C controller is getting power gated

Why is the fix being applied to SD4 if the issue is with a power rail derived from SD4? Shouldn't any fix be applied directly to the problematic rail rather than some parent rail?

Since the I2C controller is part of the SoC and we don't have power domain support yet, the only way the I2C controller can get power gated is when the SoC as a whole is turned off.

Quoted 9 lines
Quoted 1 line

before power rail disable is called.

... so without making SD4 dependant on ext-control, since no SW can be running at this point, the only way SD4 could get turned off is that the PMIC turns it off itself at the appropriate point in the system power sequence based on its OTP programming, or the board HW is already set up to turn off SD4 at the appropriate time somehow. Is that not happening?
That would imply incorrect PMIC programming wouldn't it?

After some debugging, found that the I2C driver's suspend is getting called before the suspend of PCIe is called (BTW, PCie has suspend_noirq..!) Hence, when PCIe driver wants to disable regulators it fails because of I2C write failure, which is expected given I2C is already suspended. Hence, SD4 is made dependent on ENABLE1 input which is the sleep signal from Tegra.

Quoted 11 lines
Quoted 2 lines

Hence SD4 is made dependent on ENABLE1, which is nothing but the deep sleep signal coming from Tegra, So eventually, SD4 will be powered off

when system enters into deep-sleep state.

This sounds like a workaround that happens to make the system do what you want rather than a root-cause fix.

Quoted 1 line

Source of information is from downstream kernel

We need to use HW schematics and other primary data to determine the correct approach.

#5 lore raw
Quoted 67 lines · Vidya Sagar
Quoted 57 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Monday, September 29, 2014 9:15 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device
tree

Quoted 11 lines · Vidya Sagar
Quoted 11 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1
device tree

Quoted 8 lines
Quoted 8 lines · Vidya Sagar
Quoted 3 lines

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Can you please comment on this aspect of the issue?

Quoted 9 lines
Quoted 7 lines

arch/arm/boot/dts/tegra124-jetson-tk1.dts line 1555

Quoted 1 line
arch/arm/boot/dts/tegra124-jetson-tk1.dts +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume

functionality.

Quoted 1 line

The issue is that, when regulator_bulk_diable() is called, disabling one of

the power rails (which is deriving its voltage from SD4) of PCIe is failing.

Quoted 1 line

The reason being, I2C controller is getting power gated

Why is the fix being applied to SD4 if the issue is with a power rail derived from SD4? Shouldn't any fix be applied directly to the problematic rail rather than some parent rail?

Since the I2C controller is part of the SoC and we don't have power domain support yet, the only way the I2C controller can get power gated is when the SoC as a whole is turned off.

Quoted 9 lines
Quoted 1 line

before power rail disable is called.

... so without making SD4 dependant on ext-control, since no SW can be running at this point, the only way SD4 could get turned off is that the PMIC turns it off itself at the appropriate point in the system power sequence based on its OTP programming, or the board HW is already set up to turn off SD4 at the appropriate time somehow. Is that not happening?
That would imply incorrect PMIC programming wouldn't it?

Quoted 3 lines

After some debugging, found that the I2C driver's suspend is getting called before the suspend of PCIe is called (BTW, PCie has suspend_noirq..!) Hence, when PCIe driver wants to disable regulators it fails because of I2C write failure, which is expected given I2C is already suspended.

Ah. It sounds like the PCIe driver should have a regular suspend function not a suspend_noirq function then. It's certainly expected that resources behind an I2C bus (i.e. most regulators) can't be manipulated in a suspend_noirq function.

Quoted 13 lines

Hence, SD4 is made dependent on ENABLE1 input which is the sleep signal from Tegra.

Quoted 11 lines
Quoted 2 lines

Hence SD4 is made dependent on ENABLE1, which is nothing but the deep sleep signal coming from Tegra, So eventually, SD4 will be powered off

when system enters into deep-sleep state.

This sounds like a workaround that happens to make the system do what you want rather than a root-cause fix.

Quoted 1 line

Source of information is from downstream kernel

We need to use HW schematics and other primary data to determine the correct approach.

#6 lore raw
Quoted 85 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Wednesday, October 01, 2014 11:18 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 69 lines · Vidya Sagar
Quoted 60 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Monday, September 29, 2014 9:15 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 11 lines · Vidya Sagar
Quoted 11 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 8 lines
Quoted 8 lines · Vidya Sagar
Quoted 3 lines

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Can you please comment on this aspect of the issue?

Quoted 9 lines
Quoted 7 lines

arch/arm/boot/dts/tegra124-jetson-tk1.dts line 1555

Quoted 1 line
arch/arm/boot/dts/tegra124-jetson-tk1.dts +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume

functionality.

Quoted 2 lines

The issue is that, when regulator_bulk_diable() is called, disabling one of

the power rails (which is deriving its voltage from SD4) of PCIe is failing.

Quoted 1 line

The reason being, I2C controller is getting power gated

Why is the fix being applied to SD4 if the issue is with a power rail derived from SD4? Shouldn't any fix be applied directly to the problematic rail rather than some parent rail?

Since the I2C controller is part of the SoC and we don't have power domain support yet, the only way the I2C controller can get power gated is when the SoC as a whole is turned off.

Quoted 1 line

before power rail disable is called.

Quoted 8 lines

... so without making SD4 dependant on ext-control, since no SW can be running at this point, the only way SD4 could get turned off is that the PMIC turns it off itself at the appropriate point in the system power sequence based on its OTP programming, or the board HW is already set up to turn off
SD4 at the appropriate time somehow. Is that not happening? That would imply incorrect PMIC programming wouldn't it?

Quoted 3 lines

After some debugging, found that the I2C driver's suspend is getting called before the suspend of PCIe is called (BTW, PCie has suspend_noirq..!) Hence, when PCIe driver wants to disable regulators it

Quoted 8 lines

fails because of I2C write failure, which is expected given I2C is already suspended.

Ah. It sounds like the PCIe driver should have a regular suspend function not a suspend_noirq function then. It's certainly expected that resources behind an I2C bus (i.e. most regulators) can't be manipulated in a suspend_noirq function.

PCIe host controller driver can't have regular suspend function, because,
PCI subsystem has its own suspend_noirq which tries to read Config registers of the connected PCIe devices, which in turn results in hang (because host controller would have been suspended by then...!)

Quoted 15 lines
Quoted 1 line

Hence, SD4 is made dependent on ENABLE1 input which is the sleep signal

from Tegra.

Quoted 13 lines
Quoted 13 lines
Quoted 4 lines

Hence SD4 is made dependent on ENABLE1, which is nothing but the deep sleep signal coming from Tegra, So eventually, SD4 will be powered off

when system enters into deep-sleep state.

This sounds like a workaround that happens to make the system do what you want rather than a root-cause fix.

Quoted 1 line

Source of information is from downstream kernel

We need to use HW schematics and other primary data to determine the correct approach.

#7 lore raw
Quoted 94 lines · Vidya Sagar
Quoted 85 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Wednesday, October 01, 2014 11:18 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 69 lines · Vidya Sagar
Quoted 60 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Monday, September 29, 2014 9:15 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 11 lines · Vidya Sagar
Quoted 11 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device tree

Quoted 8 lines
Quoted 8 lines · Vidya Sagar
Quoted 3 lines

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Can you please comment on this aspect of the issue?

Quoted 9 lines
Quoted 7 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume

functionality.

Quoted 2 lines

The issue is that, when regulator_bulk_diable() is called, disabling one of

the power rails (which is deriving its voltage from SD4) of PCIe is failing.

Quoted 1 line

The reason being, I2C controller is getting power gated

Why is the fix being applied to SD4 if the issue is with a power rail derived from SD4? Shouldn't any fix be applied directly to the problematic rail rather than some parent rail?

Since the I2C controller is part of the SoC and we don't have power domain support yet, the only way the I2C controller can get power gated is when the SoC as a whole is turned off.

Quoted 1 line

before power rail disable is called.

Quoted 8 lines

... so without making SD4 dependant on ext-control, since no SW can be running at this point, the only way SD4 could get turned off is that the PMIC turns it off itself at the appropriate point in the system power sequence based on its OTP programming, or the board HW is already set up to turn off
SD4 at the appropriate time somehow. Is that not happening? That would imply incorrect PMIC programming wouldn't it?

Quoted 3 lines

After some debugging, found that the I2C driver's suspend is getting called before the suspend of PCIe is called (BTW, PCie has suspend_noirq..!) Hence, when PCIe driver wants to disable regulators it

Quoted 8 lines

fails because of I2C write failure, which is expected given I2C is already suspended.

Ah. It sounds like the PCIe driver should have a regular suspend function not a suspend_noirq function then. It's certainly expected that resources behind an I2C bus (i.e. most regulators) can't be manipulated in a suspend_noirq function.

Quoted 3 lines

PCIe host controller driver can't have regular suspend function, because,
PCI subsystem has its own suspend_noirq which tries to read Config registers of the connected PCIe devices, which in turn results in hang (because host controller would have been suspended by then...!)

I'd consider it a bug for the PCI core to try to access configuration space when the host controller has been suspended, so I'd say this needs to be fixed somewhere else.

Can you point out which function does this so that I can help coming up with a more suitable fix?

Thierry

#8 lore raw
Quoted 117 lines

-----Original Message-----
From: Thierry Reding [mailto:[email protected]]
Sent: Monday, October 06, 2014 9:05 PM
To: Vidya Sagar
Cc: Stephen Warren; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1 device
tree

* PGP Signed by an unknown key

Quoted 54 lines · Vidya Sagar
Quoted 54 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Wednesday, October 01, 2014 11:18 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson TK1
device tree

Quoted 41 lines · Vidya Sagar
Quoted 41 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Monday, September 29, 2014 9:15 PM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson
TK1 device tree

Quoted 11 lines · Vidya Sagar
Quoted 11 lines

-----Original Message-----
From: Stephen Warren [mailto:[email protected]]
Sent: Tuesday, September 23, 2014 12:36 AM
To: Vidya Sagar
Cc: [email protected]; Laxman Dewangan; Krishna Thota; linux- [email protected]; linux-lFZ/[email protected]; linux- [email protected]
Subject: Re: [PATCH v1] ARM: tegra: Fix sd4 regulator in Jetson
TK1 device tree

Quoted 8 lines
Quoted 8 lines · Vidya Sagar
Quoted 3 lines

sd4 is an always on regulator which is turned on at boot time. It is externally controller through gpio. This change reflects the same in Jetson TK1 device tree

In the schematics, the "Power Sequencing" timing diagram says "S/W controlled" for SD4/+1.05V_RUN. I also don't see an "ENABLE1" pin on the AS3722, which would be required for ...

Can you please comment on this aspect of the issue?

Quoted 6 lines
Quoted 6 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+					ams,ext-control = <1>;

... to be valid.

What's the source of information behind this change?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

What symptoms does this patch correct?

I'm seeing one issue when I add support for PCIe suspend/resume

functionality.

Quoted 2 lines

The issue is that, when regulator_bulk_diable() is called, disabling one of

the power rails (which is deriving its voltage from SD4) of PCIe is

failing.

Quoted 34 lines
Quoted 25 lines
Quoted 21 lines
Quoted 12 lines
Quoted 1 line

The reason being, I2C controller is getting power gated

Why is the fix being applied to SD4 if the issue is with a power rail derived from SD4? Shouldn't any fix be applied directly to the problematic rail rather than some parent rail?

Since the I2C controller is part of the SoC and we don't have power domain support yet, the only way the I2C controller can get power gated is when the SoC as a whole is turned off.

Quoted 1 line

before power rail disable is called.

Quoted 8 lines

... so without making SD4 dependant on ext-control, since no SW can be running at this point, the only way SD4 could get turned off is that the PMIC turns it off itself at the appropriate point in the system power sequence based on its OTP programming, or the board HW is already set up to turn off
SD4 at the appropriate time somehow. Is that not happening? That would imply incorrect PMIC programming wouldn't it?

Quoted 4 lines

After some debugging, found that the I2C driver's suspend is getting called before the suspend of PCIe is called (BTW, PCie has suspend_noirq..!) Hence, when PCIe driver wants to disable regulators it

Quoted 8 lines

fails because of I2C write failure, which is expected given I2C is already suspended.

Ah. It sounds like the PCIe driver should have a regular suspend function not a suspend_noirq function then. It's certainly expected that resources behind an I2C bus (i.e. most regulators) can't be manipulated in a suspend_noirq function.

Quoted 5 lines

PCIe host controller driver can't have regular suspend function, because, PCI subsystem has its own suspend_noirq which tries to read Config registers of the connected PCIe devices, which in turn results in hang (because host controller would have been suspended by then...!)

Quoted 7 lines

I'd consider it a bug for the PCI core to try to access configuration space when the host controller has been suspended, so I'd say this needs to be fixed somewhere else.

Can you point out which function does this so that I can help coming up with a more suitable fix?

This is the flow causing Config reads to take place in suspend_noirq path. pm_suspend -> suspend_devices_and_enter -> dpm_suspend_end -> dpm_run_callback -> pci_pm_suspend_noirq -> pci_save_state -> pci_bus_read_config_dword

Quoted 4 lines

Thierry

* Unknown Key
* 0x7F3EB3A1