* [PATCH 0/2] PCI: apple: Integrate pwrctrl API
@ 2026-07-06 22:38 Yureka Lilian
2026-07-06 22:38 ` [PATCH 1/2] " Yureka Lilian
2026-07-06 22:38 ` [PATCH 2/2] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
0 siblings, 2 replies; 7+ messages in thread
From: Yureka Lilian @ 2026-07-06 22:38 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Marc Zyngier,
Sven Peter, Janne Grunau, Neal Gompa, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree,
Yureka Lilian
Hi all,
this is my attempt at using the pci-pwrctrl framework to power on the
PCIe-connected WiFi and SD card reader on Apple Silicon Macs.
Back in 2022, Hector Martin proposed a custom solution for this[1].
Since then, the pci-pwrctrl framework has evolved and
pci-pwrctrl-generic seems to be the way to do this nowadays.
Device tree changes for t600x are included as an example for how this
could be used.
Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
Link[2]: https://lwn.net/Articles/1052333/
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
---
Yureka Lilian (2):
PCI: apple: Integrate pwrctrl API
arm64: dts: apple: t600x: Add PCIe pwren gpios
arch/arm64/boot/dts/apple/t600x-die0.dtsi | 4 ++++
arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi | 16 +++++++++++++++
arch/arm64/boot/dts/apple/t600x-j375.dtsi | 27 ++++++++++++++++++++++++++
drivers/pci/controller/Kconfig | 1 +
drivers/pci/controller/pcie-apple.c | 16 +++++++++++++++
5 files changed, 64 insertions(+)
---
base-commit: 8e9685d3c41c35dd1b37df70d854137abcb2fbac
change-id: 20260706-apple-pcie-pwren-0dd1ebdf1c4c
Best regards,
--
Yureka Lilian <yureka@cyberchaos.dev>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] PCI: apple: Integrate pwrctrl API
2026-07-06 22:38 [PATCH 0/2] PCI: apple: Integrate pwrctrl API Yureka Lilian
@ 2026-07-06 22:38 ` Yureka Lilian
2026-07-07 9:25 ` Marc Zyngier
2026-07-06 22:38 ` [PATCH 2/2] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
1 sibling, 1 reply; 7+ messages in thread
From: Yureka Lilian @ 2026-07-06 22:38 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Marc Zyngier,
Sven Peter, Janne Grunau, Neal Gompa, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree,
Yureka Lilian
Integrate the PCI pwrctrl framework into the Apple PCIe host driver to
provide standardized power management for PCI devices.
Notably, this allows enabling powering on the WiFi, SD card reader on
various Macs by means of the pwrctrl framework before probing the ports.
Previously, a custom solution for powering on the WiFi and SD card
reader was proposed[1], but we can now use the new pci-pwrctrl-generic
driver for this purpose.
Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
---
drivers/pci/controller/Kconfig | 1 +
drivers/pci/controller/pcie-apple.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index 2247709ef6d6..af64630d28fa 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -46,6 +46,7 @@ config PCIE_APPLE
depends on OF
depends on PCI_MSI
select PCI_HOST_COMMON
+ select PCI_PWRCTRL_GENERIC
select IRQ_MSI_LIB
help
Say Y here if you want to enable PCIe controller support on Apple
diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index c2cffc0659f4..db038a9d4831 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -30,6 +30,7 @@
#include <linux/msi.h>
#include <linux/of_irq.h>
#include <linux/pci-ecam.h>
+#include <linux/pci-pwrctrl.h>
#include "pci-host-common.h"
@@ -825,6 +826,21 @@ static int apple_pcie_init(struct pci_config_window *cfg)
if (WARN_ON(!pcie))
return -ENOENT;
+ ret = pci_pwrctrl_create_devices(pcie->dev);
+ if (ret) {
+ dev_err(pcie->dev, "Failed to create pwrctrl devices: %pe\n", ret);
+ return ret;
+ }
+
+ ret = pci_pwrctrl_power_on_devices(pcie->dev);
+ if (ret) {
+ if (ret != -EPROBE_DEFER) {
+ dev_err(pcie->dev, "Failed to power on devices: %pe\n", ret);
+ pci_pwrctrl_destroy_devices(pcie->dev);
+ }
+ return ret;
+ }
+
for_each_available_child_of_node_scoped(dev->of_node, of_port) {
ret = apple_pcie_setup_port(pcie, of_port);
if (ret) {
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] arm64: dts: apple: t600x: Add PCIe pwren gpios
2026-07-06 22:38 [PATCH 0/2] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-07-06 22:38 ` [PATCH 1/2] " Yureka Lilian
@ 2026-07-06 22:38 ` Yureka Lilian
1 sibling, 0 replies; 7+ messages in thread
From: Yureka Lilian @ 2026-07-06 22:38 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Marc Zyngier,
Sven Peter, Janne Grunau, Neal Gompa, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree,
Yureka Lilian
For the MacBook Pro and Mac Studio devices using the M1 Pro/Max/Ultra
SoCs, add the appropriate fixed regulators for enabling the peripherals
connected to the PCIe ports (WiFi, SD card reader and USB xHCI), which
are controlled by GPIOs connected to the SMC.
Set the regulators as the power-supply of the respective PCIe port, so
that the endpoints are powered on before probing the ports.
Add the 'pciclass,0604' compatible string to the PCIe bridge nodes in
the SoC to allow the pci-pwrctrl-generic driver to bind to them.
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
---
arch/arm64/boot/dts/apple/t600x-die0.dtsi | 4 ++++
arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi | 16 +++++++++++++++
arch/arm64/boot/dts/apple/t600x-j375.dtsi | 27 ++++++++++++++++++++++++++
3 files changed, 47 insertions(+)
diff --git a/arch/arm64/boot/dts/apple/t600x-die0.dtsi b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
index f715b19efd16..53a633a3c652 100644
--- a/arch/arm64/boot/dts/apple/t600x-die0.dtsi
+++ b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
@@ -449,6 +449,7 @@ pcie0: pcie@590000000 {
pinctrl-names = "default";
port00: pci@0,0 {
+ compatible = "pciclass,0604";
device_type = "pci";
reg = <0x0 0x0 0x0 0x0 0x0>;
reset-gpios = <&pinctrl_ap 4 GPIO_ACTIVE_LOW>;
@@ -468,6 +469,7 @@ port00: pci@0,0 {
};
port01: pci@1,0 {
+ compatible = "pciclass,0604";
device_type = "pci";
reg = <0x800 0x0 0x0 0x0 0x0>;
reset-gpios = <&pinctrl_ap 5 GPIO_ACTIVE_LOW>;
@@ -487,6 +489,7 @@ port01: pci@1,0 {
};
port02: pci@2,0 {
+ compatible = "pciclass,0604";
device_type = "pci";
reg = <0x1000 0x0 0x0 0x0 0x0>;
reset-gpios = <&pinctrl_ap 6 GPIO_ACTIVE_LOW>;
@@ -507,6 +510,7 @@ port02: pci@2,0 {
};
port03: pci@3,0 {
+ compatible = "pciclass,0604";
device_type = "pci";
reg = <0x1800 0x0 0x0 0x0 0x0>;
reset-gpios = <&pinctrl_ap 7 GPIO_ACTIVE_LOW>;
diff --git a/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi b/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi
index fee84f809a9c..7954cbbe4514 100644
--- a/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi
+++ b/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi
@@ -55,6 +55,20 @@ led-0 {
default-state = "keep";
};
};
+
+ vreg_pcie0_port0: regulator-pcie0-port0 {
+ compatible = "regulator-fixed";
+ regulator-name = "pwren-pcie0-port0";
+ gpio = <&smc_gpio 13 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ vreg_pcie0_port1: regulator-pcie0-port1 {
+ compatible = "regulator-fixed";
+ regulator-name = "pwren-pcie0-port1";
+ gpio = <&smc_gpio 26 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
};
&serial0 {
@@ -176,6 +190,7 @@ &nco_clkref {
/* PCIe devices */
&port00 {
/* WLAN */
+ power-supply = <&vreg_pcie0_port0>;
bus-range = <1 1>;
wifi0: wifi@0,0 {
compatible = "pci14e4,4433";
@@ -195,6 +210,7 @@ bluetooth0: bluetooth@0,1 {
&port01 {
/* SD card reader */
+ power-supply = <&vreg_pcie0_port1>;
bus-range = <2 2>;
sdhci0: mmc@0,0 {
compatible = "pci17a0,9755";
diff --git a/arch/arm64/boot/dts/apple/t600x-j375.dtsi b/arch/arm64/boot/dts/apple/t600x-j375.dtsi
index 8a1494949e4c..412b2fe109be 100644
--- a/arch/arm64/boot/dts/apple/t600x-j375.dtsi
+++ b/arch/arm64/boot/dts/apple/t600x-j375.dtsi
@@ -42,6 +42,30 @@ memory@10000000000 {
device_type = "memory";
reg = <0x100 0 0x2 0>; /* To be filled by loader */
};
+
+ /* WLAN/BT */
+ vreg_pcie0_port0: regulator-pcie0-port0 {
+ compatible = "regulator-fixed";
+ regulator-name = "pwren-pcie0-port0";
+ gpio = <&smc_gpio 13 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ /* SD card reader */
+ vreg_pcie0_port1: regulator-pcie0-port1 {
+ compatible = "regulator-fixed";
+ regulator-name = "pwren-pcie0-port1";
+ gpio = <&smc_gpio 26 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ /* USB xHCI */
+ vreg_pcie0_port3: regulator-pcie0-port3 {
+ compatible = "regulator-fixed";
+ regulator-name = "pwren-pcie0-port3";
+ gpio = <&smc_gpio 20 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
};
&serial0 {
@@ -356,6 +380,7 @@ &nco_clkref {
/* PCIe devices */
&port00 {
/* WLAN */
+ power-supply = <&vreg_pcie0_port0>;
bus-range = <1 1>;
wifi0: wifi@0,0 {
compatible = "pci14e4,4433";
@@ -375,6 +400,7 @@ bluetooth0: bluetooth@0,1 {
&port01 {
/* SD card reader */
+ power-supply = <&vreg_pcie0_port1>;
bus-range = <2 2>;
sdhci0: mmc@0,0 {
compatible = "pci17a0,9755";
@@ -397,6 +423,7 @@ ethernet0: ethernet@0,0 {
&port03 {
/* USB xHCI */
+ power-supply = <&vreg_pcie0_port3>;
bus-range = <4 4>;
status = "okay";
};
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] PCI: apple: Integrate pwrctrl API
2026-07-06 22:38 ` [PATCH 1/2] " Yureka Lilian
@ 2026-07-07 9:25 ` Marc Zyngier
2026-07-07 12:04 ` Yureka Lilian
0 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2026-07-07 9:25 UTC (permalink / raw)
To: Yureka Lilian
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Sven Peter,
Janne Grunau, Neal Gompa, Krzysztof Kozlowski, Conor Dooley,
linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree
On Mon, 06 Jul 2026 23:38:27 +0100,
Yureka Lilian <yureka@cyberchaos.dev> wrote:
>
> Integrate the PCI pwrctrl framework into the Apple PCIe host driver to
> provide standardized power management for PCI devices.
>
> Notably, this allows enabling powering on the WiFi, SD card reader on
> various Macs by means of the pwrctrl framework before probing the ports.
>
> Previously, a custom solution for powering on the WiFi and SD card
> reader was proposed[1], but we can now use the new pci-pwrctrl-generic
> driver for this purpose.
>
> Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
>
nit: this paragraph and the accompanying link don't belong in the
commit message and should be moved below the --- mark or even better,
to the cover letter.
> Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
> ---
> drivers/pci/controller/Kconfig | 1 +
> drivers/pci/controller/pcie-apple.c | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
> index 2247709ef6d6..af64630d28fa 100644
> --- a/drivers/pci/controller/Kconfig
> +++ b/drivers/pci/controller/Kconfig
> @@ -46,6 +46,7 @@ config PCIE_APPLE
> depends on OF
> depends on PCI_MSI
> select PCI_HOST_COMMON
> + select PCI_PWRCTRL_GENERIC
> select IRQ_MSI_LIB
> help
> Say Y here if you want to enable PCIe controller support on Apple
> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> index c2cffc0659f4..db038a9d4831 100644
> --- a/drivers/pci/controller/pcie-apple.c
> +++ b/drivers/pci/controller/pcie-apple.c
> @@ -30,6 +30,7 @@
> #include <linux/msi.h>
> #include <linux/of_irq.h>
> #include <linux/pci-ecam.h>
> +#include <linux/pci-pwrctrl.h>
>
> #include "pci-host-common.h"
>
> @@ -825,6 +826,21 @@ static int apple_pcie_init(struct pci_config_window *cfg)
> if (WARN_ON(!pcie))
> return -ENOENT;
>
> + ret = pci_pwrctrl_create_devices(pcie->dev);
> + if (ret) {
> + dev_err(pcie->dev, "Failed to create pwrctrl devices: %pe\n", ret);
> + return ret;
> + }
> +
> + ret = pci_pwrctrl_power_on_devices(pcie->dev);
> + if (ret) {
> + if (ret != -EPROBE_DEFER) {
> + dev_err(pcie->dev, "Failed to power on devices: %pe\n", ret);
> + pci_pwrctrl_destroy_devices(pcie->dev);
> + }
> + return ret;
> + }
> +
Why is this done globally while the whole driver works on a per-port
basis, and that the proposed DT updates are also per port?
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] PCI: apple: Integrate pwrctrl API
2026-07-07 9:25 ` Marc Zyngier
@ 2026-07-07 12:04 ` Yureka Lilian
2026-07-07 13:58 ` Marc Zyngier
0 siblings, 1 reply; 7+ messages in thread
From: Yureka Lilian @ 2026-07-07 12:04 UTC (permalink / raw)
To: Marc Zyngier, Yureka Lilian
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Sven Peter,
Janne Grunau, Neal Gompa, Krzysztof Kozlowski, Conor Dooley,
linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree
On 7/7/26 11:25, Marc Zyngier wrote:
> On Mon, 06 Jul 2026 23:38:27 +0100,
> Yureka Lilian <yureka@cyberchaos.dev> wrote:
>> Integrate the PCI pwrctrl framework into the Apple PCIe host driver to
>> provide standardized power management for PCI devices.
>>
>> Notably, this allows enabling powering on the WiFi, SD card reader on
>> various Macs by means of the pwrctrl framework before probing the ports.
>>
>> Previously, a custom solution for powering on the WiFi and SD card
>> reader was proposed[1], but we can now use the new pci-pwrctrl-generic
>> driver for this purpose.
>>
>> Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
>>
> nit: this paragraph and the accompanying link don't belong in the
> commit message and should be moved below the --- mark or even better,
> to the cover letter.
ack, will leave it out of the commit message of the individual commit in v2
>> Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
>> ---
>> drivers/pci/controller/Kconfig | 1 +
>> drivers/pci/controller/pcie-apple.c | 16 ++++++++++++++++
>> 2 files changed, 17 insertions(+)
>>
>> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
>> index 2247709ef6d6..af64630d28fa 100644
>> --- a/drivers/pci/controller/Kconfig
>> +++ b/drivers/pci/controller/Kconfig
>> @@ -46,6 +46,7 @@ config PCIE_APPLE
>> depends on OF
>> depends on PCI_MSI
>> select PCI_HOST_COMMON
>> + select PCI_PWRCTRL_GENERIC
>> select IRQ_MSI_LIB
>> help
>> Say Y here if you want to enable PCIe controller support on Apple
>> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
>> index c2cffc0659f4..db038a9d4831 100644
>> --- a/drivers/pci/controller/pcie-apple.c
>> +++ b/drivers/pci/controller/pcie-apple.c
>> @@ -30,6 +30,7 @@
>> #include <linux/msi.h>
>> #include <linux/of_irq.h>
>> #include <linux/pci-ecam.h>
>> +#include <linux/pci-pwrctrl.h>
>>
>> #include "pci-host-common.h"
>>
>> @@ -825,6 +826,21 @@ static int apple_pcie_init(struct pci_config_window *cfg)
>> if (WARN_ON(!pcie))
>> return -ENOENT;
>>
>> + ret = pci_pwrctrl_create_devices(pcie->dev);
>> + if (ret) {
>> + dev_err(pcie->dev, "Failed to create pwrctrl devices: %pe\n", ret);
>> + return ret;
>> + }
>> +
>> + ret = pci_pwrctrl_power_on_devices(pcie->dev);
>> + if (ret) {
>> + if (ret != -EPROBE_DEFER) {
>> + dev_err(pcie->dev, "Failed to power on devices: %pe\n", ret);
>> + pci_pwrctrl_destroy_devices(pcie->dev);
>> + }
>> + return ret;
>> + }
>> +
> Why is this done globally while the whole driver works on a per-port
> basis, and that the proposed DT updates are also per port?
pci_pwrctrl_power_on_devices takes a struct device as parameter, but
pcie-apple does not allocate device structs for the individual ports.
This could be changed of course. But since pci_pwrctrl_* operate on
the subnodes recursively, it works just fine this way.
Additionally, we would like to be sure all the endpoints can be powered
before we start initializing the individual ports. Otherwise we could
end up in a situation where some ports are initialized but others are
not when we realize some driver needed to power on the endpoints for
port n is not yet bound. There is no appropriate pci_pwrctrl API for
checking for the availability without changing the state, so this is
an additional reason to do it early.
>
> Thanks,
>
> M.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] PCI: apple: Integrate pwrctrl API
2026-07-07 12:04 ` Yureka Lilian
@ 2026-07-07 13:58 ` Marc Zyngier
2026-07-09 12:29 ` Manivannan Sadhasivam
0 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2026-07-07 13:58 UTC (permalink / raw)
To: Yureka Lilian
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Sven Peter,
Janne Grunau, Neal Gompa, Krzysztof Kozlowski, Conor Dooley,
linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree
On Tue, 07 Jul 2026 13:04:21 +0100,
Yureka Lilian <yureka@cyberchaos.dev> wrote:
>
> On 7/7/26 11:25, Marc Zyngier wrote:
> > On Mon, 06 Jul 2026 23:38:27 +0100,
> > Yureka Lilian <yureka@cyberchaos.dev> wrote:
> >> Integrate the PCI pwrctrl framework into the Apple PCIe host driver to
> >> provide standardized power management for PCI devices.
> >>
> >> Notably, this allows enabling powering on the WiFi, SD card reader on
> >> various Macs by means of the pwrctrl framework before probing the ports.
> >>
> >> Previously, a custom solution for powering on the WiFi and SD card
> >> reader was proposed[1], but we can now use the new pci-pwrctrl-generic
> >> driver for this purpose.
> >>
> >> Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
> >>
> > nit: this paragraph and the accompanying link don't belong in the
> > commit message and should be moved below the --- mark or even better,
> > to the cover letter.
> ack, will leave it out of the commit message of the individual commit in v2
> >> Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
> >> ---
> >> drivers/pci/controller/Kconfig | 1 +
> >> drivers/pci/controller/pcie-apple.c | 16 ++++++++++++++++
> >> 2 files changed, 17 insertions(+)
> >>
> >> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
> >> index 2247709ef6d6..af64630d28fa 100644
> >> --- a/drivers/pci/controller/Kconfig
> >> +++ b/drivers/pci/controller/Kconfig
> >> @@ -46,6 +46,7 @@ config PCIE_APPLE
> >> depends on OF
> >> depends on PCI_MSI
> >> select PCI_HOST_COMMON
> >> + select PCI_PWRCTRL_GENERIC
> >> select IRQ_MSI_LIB
> >> help
> >> Say Y here if you want to enable PCIe controller support on Apple
> >> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> >> index c2cffc0659f4..db038a9d4831 100644
> >> --- a/drivers/pci/controller/pcie-apple.c
> >> +++ b/drivers/pci/controller/pcie-apple.c
> >> @@ -30,6 +30,7 @@
> >> #include <linux/msi.h>
> >> #include <linux/of_irq.h>
> >> #include <linux/pci-ecam.h>
> >> +#include <linux/pci-pwrctrl.h>
> >> #include "pci-host-common.h"
> >> @@ -825,6 +826,21 @@ static int apple_pcie_init(struct
> >> pci_config_window *cfg)
> >> if (WARN_ON(!pcie))
> >> return -ENOENT;
> >> + ret = pci_pwrctrl_create_devices(pcie->dev);
> >> + if (ret) {
> >> + dev_err(pcie->dev, "Failed to create pwrctrl devices: %pe\n", ret);
> >> + return ret;
> >> + }
> >> +
> >> + ret = pci_pwrctrl_power_on_devices(pcie->dev);
> >> + if (ret) {
> >> + if (ret != -EPROBE_DEFER) {
> >> + dev_err(pcie->dev, "Failed to power on devices: %pe\n", ret);
> >> + pci_pwrctrl_destroy_devices(pcie->dev);
> >> + }
> >> + return ret;
> >> + }
> >> +
> > Why is this done globally while the whole driver works on a per-port
> > basis, and that the proposed DT updates are also per port?
>
> pci_pwrctrl_power_on_devices takes a struct device as parameter, but
> pcie-apple does not allocate device structs for the individual ports.
> This could be changed of course. But since pci_pwrctrl_* operate on
> the subnodes recursively, it works just fine this way.
Works fine is one thing. Being consistent with the way the rest of the
driver works is another. pci_pwrctrl_create_device() and
pci_pwrctrl_power_on_device() appear to do exactly what would be
required for a single port. They just needs to be exported made
global/exported.
> Additionally, we would like to be sure all the endpoints can be powered
> before we start initializing the individual ports. Otherwise we could
> end up in a situation where some ports are initialized but others are
> not when we realize some driver needed to power on the endpoints for
> port n is not yet bound.
How can a driver be bound to a device connected to a port if we
haven't been through the initial link-up dance, which is what
apple_pcie_setup_port() does? The power supplies are per-port for a
reason.
> There is no appropriate pci_pwrctrl API for checking for the
> availability without changing the state, so this is an additional
> reason to do it early.
Availability of what? To be clear, I'm not suggesting delaying
switching of the power. I'm merely suggesting managing it on a per
port basis.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] PCI: apple: Integrate pwrctrl API
2026-07-07 13:58 ` Marc Zyngier
@ 2026-07-09 12:29 ` Manivannan Sadhasivam
0 siblings, 0 replies; 7+ messages in thread
From: Manivannan Sadhasivam @ 2026-07-09 12:29 UTC (permalink / raw)
To: Marc Zyngier
Cc: Yureka Lilian, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Bjorn Helgaas, Sven Peter, Janne Grunau, Neal Gompa,
Krzysztof Kozlowski, Conor Dooley, linux-pci, linux-kernel, asahi,
linux-arm-kernel, devicetree
On Tue, Jul 07, 2026 at 02:58:39PM +0100, Marc Zyngier wrote:
> On Tue, 07 Jul 2026 13:04:21 +0100,
> Yureka Lilian <yureka@cyberchaos.dev> wrote:
> >
> > On 7/7/26 11:25, Marc Zyngier wrote:
> > > On Mon, 06 Jul 2026 23:38:27 +0100,
> > > Yureka Lilian <yureka@cyberchaos.dev> wrote:
> > >> Integrate the PCI pwrctrl framework into the Apple PCIe host driver to
> > >> provide standardized power management for PCI devices.
> > >>
> > >> Notably, this allows enabling powering on the WiFi, SD card reader on
> > >> various Macs by means of the pwrctrl framework before probing the ports.
> > >>
> > >> Previously, a custom solution for powering on the WiFi and SD card
> > >> reader was proposed[1], but we can now use the new pci-pwrctrl-generic
> > >> driver for this purpose.
> > >>
> > >> Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
> > >>
> > > nit: this paragraph and the accompanying link don't belong in the
> > > commit message and should be moved below the --- mark or even better,
> > > to the cover letter.
> > ack, will leave it out of the commit message of the individual commit in v2
> > >> Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
> > >> ---
> > >> drivers/pci/controller/Kconfig | 1 +
> > >> drivers/pci/controller/pcie-apple.c | 16 ++++++++++++++++
> > >> 2 files changed, 17 insertions(+)
> > >>
> > >> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
> > >> index 2247709ef6d6..af64630d28fa 100644
> > >> --- a/drivers/pci/controller/Kconfig
> > >> +++ b/drivers/pci/controller/Kconfig
> > >> @@ -46,6 +46,7 @@ config PCIE_APPLE
> > >> depends on OF
> > >> depends on PCI_MSI
> > >> select PCI_HOST_COMMON
> > >> + select PCI_PWRCTRL_GENERIC
> > >> select IRQ_MSI_LIB
> > >> help
> > >> Say Y here if you want to enable PCIe controller support on Apple
> > >> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> > >> index c2cffc0659f4..db038a9d4831 100644
> > >> --- a/drivers/pci/controller/pcie-apple.c
> > >> +++ b/drivers/pci/controller/pcie-apple.c
> > >> @@ -30,6 +30,7 @@
> > >> #include <linux/msi.h>
> > >> #include <linux/of_irq.h>
> > >> #include <linux/pci-ecam.h>
> > >> +#include <linux/pci-pwrctrl.h>
> > >> #include "pci-host-common.h"
> > >> @@ -825,6 +826,21 @@ static int apple_pcie_init(struct
> > >> pci_config_window *cfg)
> > >> if (WARN_ON(!pcie))
> > >> return -ENOENT;
> > >> + ret = pci_pwrctrl_create_devices(pcie->dev);
> > >> + if (ret) {
> > >> + dev_err(pcie->dev, "Failed to create pwrctrl devices: %pe\n", ret);
> > >> + return ret;
> > >> + }
> > >> +
> > >> + ret = pci_pwrctrl_power_on_devices(pcie->dev);
> > >> + if (ret) {
> > >> + if (ret != -EPROBE_DEFER) {
> > >> + dev_err(pcie->dev, "Failed to power on devices: %pe\n", ret);
> > >> + pci_pwrctrl_destroy_devices(pcie->dev);
> > >> + }
> > >> + return ret;
> > >> + }
> > >> +
> > > Why is this done globally while the whole driver works on a per-port
> > > basis, and that the proposed DT updates are also per port?
> >
> > pci_pwrctrl_power_on_devices takes a struct device as parameter, but
> > pcie-apple does not allocate device structs for the individual ports.
> > This could be changed of course. But since pci_pwrctrl_* operate on
> > the subnodes recursively, it works just fine this way.
>
> Works fine is one thing. Being consistent with the way the rest of the
> driver works is another. pci_pwrctrl_create_device() and
> pci_pwrctrl_power_on_device() appear to do exactly what would be
> required for a single port. They just needs to be exported made
> global/exported.
>
I'm fine with exporting pci_pwrctrl_create_device() and
pci_pwrctrl_power_on_device() and calling them with per-port np.
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-07-09 12:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 22:38 [PATCH 0/2] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-07-06 22:38 ` [PATCH 1/2] " Yureka Lilian
2026-07-07 9:25 ` Marc Zyngier
2026-07-07 12:04 ` Yureka Lilian
2026-07-07 13:58 ` Marc Zyngier
2026-07-09 12:29 ` Manivannan Sadhasivam
2026-07-06 22:38 ` [PATCH 2/2] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox