* [PATCH v2 0/3] PCI: apple: Integrate pwrctrl API
@ 2026-11-04 11:40 Yureka Lilian
2026-11-04 11:40 ` [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs Yureka Lilian
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yureka Lilian @ 2026-11-04 11:40 UTC (permalink / raw)
To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
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 series integrates the PCI pwrctrl framework into the Apple PCIe
host driver to provide standardized power management for PCI ports.
This allows powering on the WiFi, SD card reader, and USB xHCI on
Apple Silicon Macs through the pwrctrl framework before probing the ports.
The first patch in this series exposes the necessary APIs to create,
destroy, and power on/off pwrctrl devices for individual ports.
The second patch integrates these APIs into the Apple PCIe driver on a
per-port basis. The third patch adds device tree changes for t600x as an
example.
Originally, a custom solution for powering on the WiFi and SD card
reader was proposed[1], but we can now use the pci-pwrctrl framework
for this purpose.
Link[1]: https://lore.kernel.org/lkml/20220502093832.32778-4-marcan@marcan.st/
---
Changes in v2:
- Split the pwrctrl API integration to work on a per-port basis for
consistency with the rest of the driver
- Correctly use ERR_PTR to convert the error value before printing
To: Bartosz Golaszewski <brgl@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
To: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Krzysztof Wilczyński <kwilczynski@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Marc Zyngier <maz@kernel.org>
To: Sven Peter <sven@kernel.org>
To: Janne Grunau <j@jannau.net>
To: Neal Gompa <neal@gompa.dev>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
Cc: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: asahi@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org
---
Yureka Lilian (3):
PCI/pwrctrl: Export per-device APIs
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 | 23 ++++++++++++
drivers/pci/pwrctrl/core.c | 51 +++++++++++++++++++++++---
include/linux/pci-pwrctrl.h | 4 ++
7 files changed, 121 insertions(+), 5 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20260706-apple-pcie-pwren-0dd1ebdf1c4c
Best regards,
--
Yureka Lilian <yureka@cyberchaos.dev>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs
2026-11-04 11:40 [PATCH v2 0/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
@ 2026-11-04 11:40 ` Yureka Lilian
2026-11-05 6:28 ` kernel test robot
2026-11-04 11:40 ` [PATCH v2 2/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-11-04 11:40 ` [PATCH v2 3/3] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
2 siblings, 1 reply; 7+ messages in thread
From: Yureka Lilian @ 2026-11-04 11:40 UTC (permalink / raw)
To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Marc Zyngier, Sven Peter, Janne Grunau, Neal Gompa,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-pci, linux-kernel, asahi, linux-arm-kernel, devicetree,
Yureka Lilian
Export the `pci_pwrctrl_power_on_device()` and
`pci_pwrctrl_power_off_device()` functions to allow PCIe host drivers
to call manage power control on a per-port basis.
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
---
drivers/pci/pwrctrl/core.c | 51 ++++++++++++++++++++++++++++++++++++++++-----
include/linux/pci-pwrctrl.h | 4 ++++
2 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
index 0e2387cf4657..b59dbedf251b 100644
--- a/drivers/pci/pwrctrl/core.c
+++ b/drivers/pci/pwrctrl/core.c
@@ -191,7 +191,16 @@ static int __pci_pwrctrl_power_off_device(struct device *dev)
return pwrctrl->power_off(pwrctrl);
}
-static void pci_pwrctrl_power_off_device(struct device_node *np)
+/**
+ * pci_pwrctrl_power_off_device - Power off pwrctrl devices
+ *
+ * @device_node: PCI port or device to operate on
+ *
+ * Recursively traverse all pwrctrl devices for the devicetree hierarchy
+ * below the specified PCI port or device and power them off in a depth
+ * first manner.
+ */
+void pci_pwrctrl_power_off_device(struct device_node *np)
{
struct platform_device *pdev;
int ret;
@@ -216,6 +225,7 @@ static void pci_pwrctrl_power_off_device(struct device_node *np)
platform_device_put(pdev);
}
+EXPORT_SYMBOL_GPL(pci_pwrctrl_power_off_device);
/**
* pci_pwrctrl_power_off_devices - Power off pwrctrl devices
@@ -245,11 +255,21 @@ static int __pci_pwrctrl_power_on_device(struct device *dev)
return pwrctrl->power_on(pwrctrl);
}
-/*
+/**
+ * pci_pwrctrl_power_on_device - Power on pwrctrl devices
+ *
+ * @device_node: PCI port or device to operate on
+ *
* Power on the devices in a depth first manner. Before powering on the device,
* make sure its driver is bound.
+ * Recursively traverse all pwrctrl devices for the devicetree hierarchy
+ * below the specified PCI port or device and power them on in a depth
+ * first manner. Before powering on the device, make sure its driver is bound.
+ *
+ * Return: 0 on success, -EPROBE_DEFER if any pwrctrl driver is not bound, an
+ * appropriate error code otherwise.
*/
-static int pci_pwrctrl_power_on_device(struct device_node *np)
+int pci_pwrctrl_power_on_device(struct device_node *np)
{
struct platform_device *pdev;
struct device_node *child;
@@ -296,6 +316,7 @@ static int pci_pwrctrl_power_on_device(struct device_node *np)
return ret;
}
+EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_device);
/**
* pci_pwrctrl_power_on_devices - Power on pwrctrl devices
@@ -335,7 +356,17 @@ int pci_pwrctrl_power_on_devices(struct device *parent)
}
EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);
-static int pci_pwrctrl_create_device(struct device_node *np,
+/**
+ * pci_pwrctrl_create_device - Create pwrctrl devices
+ *
+ * @device_node: PCI port or device to operate on
+ *
+ * Recursively create pwrctrl devices for the devicetree hierarchy below
+ * the specified PCI port or device in a depth first manner.
+ *
+ * Return: 0 on success, negative error number on error.
+ */
+int pci_pwrctrl_create_device(struct device_node *np,
struct device *parent)
{
struct platform_device *pdev;
@@ -368,6 +399,7 @@ static int pci_pwrctrl_create_device(struct device_node *np,
return 0;
}
+EXPORT_SYMBOL_GPL(pci_pwrctrl_create_device);
/**
* pci_pwrctrl_create_devices - Create pwrctrl devices
@@ -396,7 +428,15 @@ int pci_pwrctrl_create_devices(struct device *parent)
}
EXPORT_SYMBOL_GPL(pci_pwrctrl_create_devices);
-static void pci_pwrctrl_destroy_device(struct device_node *np)
+/**
+ * pci_pwrctrl_destroy_device - Destroy pwrctrl devices
+ *
+ * @device_node: PCI port or device to operate on
+ *
+ * Recursively destroy pwrctrl devices for the devicetree hierarchy below
+ * the specified PCI port or device in a depth first manner.
+ */
+void pci_pwrctrl_destroy_device(struct device_node *np)
{
struct platform_device *pdev;
@@ -415,6 +455,7 @@ static void pci_pwrctrl_destroy_device(struct device_node *np)
of_node_clear_flag(np, OF_POPULATED);
}
+EXPORT_SYMBOL_GPL(pci_pwrctrl_destroy_device);
/**
* pci_pwrctrl_destroy_devices - Destroy pwrctrl devices
diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h
index 1192a2527521..f27be6489b50 100644
--- a/include/linux/pci-pwrctrl.h
+++ b/include/linux/pci-pwrctrl.h
@@ -59,6 +59,10 @@ int pci_pwrctrl_create_devices(struct device *parent);
void pci_pwrctrl_destroy_devices(struct device *parent);
int pci_pwrctrl_power_on_devices(struct device *parent);
void pci_pwrctrl_power_off_devices(struct device *parent);
+int pci_pwrctrl_create_device(struct device_node *np, struct device *parent);
+void pci_pwrctrl_destroy_device(struct device_node *np);
+int pci_pwrctrl_power_on_device(struct device_node *np);
+void pci_pwrctrl_power_off_device(struct device_node *np);
#else
static inline int pci_pwrctrl_create_devices(struct device *parent) { return 0; }
static void pci_pwrctrl_destroy_devices(struct device *parent) { }
--
2.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] PCI: apple: Integrate pwrctrl API
2026-11-04 11:40 [PATCH v2 0/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-11-04 11:40 ` [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs Yureka Lilian
@ 2026-11-04 11:40 ` Yureka Lilian
2026-11-04 13:41 ` Janne Grunau
2026-11-04 11:40 ` [PATCH v2 3/3] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
2 siblings, 1 reply; 7+ messages in thread
From: Yureka Lilian @ 2026-11-04 11:40 UTC (permalink / raw)
To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
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.
Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
---
drivers/pci/controller/Kconfig | 1 +
drivers/pci/controller/pcie-apple.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index d246bbe37948..791892a6c0c6 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..2d32092e2122 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,28 @@ static int apple_pcie_init(struct pci_config_window *cfg)
if (WARN_ON(!pcie))
return -ENOENT;
+ // Ensure all ports can be powered on before attempting initialization
+ for_each_available_child_of_node_scoped(dev->of_node, of_port) {
+ ret = pci_pwrctrl_create_device(of_port, pcie->dev);
+ if (ret) {
+ dev_err(pcie->dev, "Failed to create pwrctrl device: %pe\n", ERR_PTR(ret));
+ return ret;
+ }
+
+ ret = pci_pwrctrl_power_on_device(of_port);
+ if (ret) {
+ if (ret != -EPROBE_DEFER) {
+ dev_err(pcie->dev,
+ "Failed to power on device: %pe\n",
+ ERR_PTR(ret));
+ for_each_available_child_of_node_scoped(dev->of_node, of_port) {
+ pci_pwrctrl_destroy_device(of_port);
+ }
+ }
+ 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.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] arm64: dts: apple: t600x: Add PCIe pwren gpios
2026-11-04 11:40 [PATCH v2 0/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-11-04 11:40 ` [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs Yureka Lilian
2026-11-04 11:40 ` [PATCH v2 2/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
@ 2026-11-04 11:40 ` Yureka Lilian
2026-11-04 13:57 ` Janne Grunau
2 siblings, 1 reply; 7+ messages in thread
From: Yureka Lilian @ 2026-11-04 11:40 UTC (permalink / raw)
To: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
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 122a566e75d1..635635c4bfbd 100644
--- a/arch/arm64/boot/dts/apple/t600x-die0.dtsi
+++ b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
@@ -460,6 +460,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>;
@@ -479,6 +480,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>;
@@ -498,6 +500,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>;
@@ -518,6 +521,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 caded1636f3d..4f9dccf839ad 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.56.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] PCI: apple: Integrate pwrctrl API
2026-11-04 11:40 ` [PATCH v2 2/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
@ 2026-11-04 13:41 ` Janne Grunau
0 siblings, 0 replies; 7+ messages in thread
From: Janne Grunau @ 2026-11-04 13:41 UTC (permalink / raw)
To: Yureka Lilian
Cc: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Marc Zyngier, Sven Peter, Neal Gompa, Krzysztof Kozlowski,
Conor Dooley, linux-pci, linux-kernel, asahi, linux-arm-kernel,
devicetree
On Wed, Nov 04, 2026 at 12:40:30PM +0100, Yureka Lilian 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.
>
> Signed-off-by: Yureka Lilian <yureka@cyberchaos.dev>
> ---
> drivers/pci/controller/Kconfig | 1 +
> drivers/pci/controller/pcie-apple.c | 23 +++++++++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
> index d246bbe37948..791892a6c0c6 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..2d32092e2122 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,28 @@ static int apple_pcie_init(struct pci_config_window *cfg)
> if (WARN_ON(!pcie))
> return -ENOENT;
>
> + // Ensure all ports can be powered on before attempting initialization
> + for_each_available_child_of_node_scoped(dev->of_node, of_port) {
> + ret = pci_pwrctrl_create_device(of_port, pcie->dev);
> + if (ret) {
> + dev_err(pcie->dev, "Failed to create pwrctrl device: %pe\n", ERR_PTR(ret));
This should power down devices it already powered up and destroy the
created devices. As far as I can see -EINVAL is the only possible error
so the platform devices should be cleaned up
> + return ret;
> + }
> +
> + ret = pci_pwrctrl_power_on_device(of_port);
> + if (ret) {
> + if (ret != -EPROBE_DEFER) {
-EPROBE_DEFER can be persistent, devices should be powered and
destroyed here as well.
> + dev_err(pcie->dev,
> + "Failed to power on device: %pe\n",
> + ERR_PTR(ret));
> + for_each_available_child_of_node_scoped(dev->of_node, of_port) {
> + pci_pwrctrl_destroy_device(of_port);
this misses to power down already powered up devices.
One way to avoid the need to power down devices after
pci_pwrctrl_create_device() failures would be to split the loop into
two.
The power handling is now done on a per port basis as asked in v1 but it
is more or less a re-implementation of pci_pwrctrl_create_devices(),
pci_pwrctrl_destroy_devices() and pci_pwrctrl_power_on_devices().
For pcie-apple those are essentially loops over the the available ports
with error handling.
One annoying side effect of this change. I a single device fails to
power-on we will break ethernet on desktop Macs although it does not
need power control. So maybe ignoring errors except -EPROBE_DEFER would
be the better implementation. -EPROBE_DEFER itself is still a problem as
the power control for some ports are a optional dependency for other
ports.
Janne
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 3/3] arm64: dts: apple: t600x: Add PCIe pwren gpios
2026-11-04 11:40 ` [PATCH v2 3/3] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
@ 2026-11-04 13:57 ` Janne Grunau
0 siblings, 0 replies; 7+ messages in thread
From: Janne Grunau @ 2026-11-04 13:57 UTC (permalink / raw)
To: Yureka Lilian
Cc: Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Helgaas,
Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Marc Zyngier, Sven Peter, Neal Gompa, Krzysztof Kozlowski,
Conor Dooley, linux-pci, linux-kernel, asahi, linux-arm-kernel,
devicetree
On Wed, Nov 04, 2026 at 12:40:31PM +0100, Yureka Lilian wrote:
> 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 122a566e75d1..635635c4bfbd 100644
> --- a/arch/arm64/boot/dts/apple/t600x-die0.dtsi
> +++ b/arch/arm64/boot/dts/apple/t600x-die0.dtsi
> @@ -460,6 +460,7 @@ pcie0: pcie@590000000 {
> pinctrl-names = "default";
>
> port00: pci@0,0 {
> + compatible = "pciclass,0604";
> device_type = "pci";
`dt-check-style --mode strict` wants "device_type" before "compatible"
> diff --git a/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi b/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi
> index caded1636f3d..4f9dccf839ad 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>;
Please do the t602x changes in the same commit. This file is included by
t602x-j414-j416.dtsi and the M2 Pro/Max devices use different gpio pins.
If they aren't overriden in the same commit this will toggled a random
GPIO pin on M2 Pro/Max Macbook Pros.
> 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 */
this is included indirectly on t6020-j474.dts which doesn't have a card
reader.
> + vreg_pcie0_port1: regulator-pcie0-port1 {
> + compatible = "regulator-fixed";
> + regulator-name = "pwren-pcie0-port1";
> + gpio = <&smc_gpio 26 GPIO_ACTIVE_HIGH>;
Same comment about the GPIO pins as for the Macbook Pros.
I'm not sure if the cross-SoC generation device .dtsi files were a good
idea even though the devices are very similar. I probably wouldn't
repeat that but I don't think it's worth to untangle at this point.
Janne
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs
2026-11-04 11:40 ` [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs Yureka Lilian
@ 2026-11-05 6:28 ` kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-11-05 6:28 UTC (permalink / raw)
To: Yureka Lilian, Bartosz Golaszewski, Manivannan Sadhasivam,
Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Marc Zyngier, Sven Peter, Janne Grunau, Neal Gompa,
Krzysztof Kozlowski, Conor Dooley
Cc: llvm, oe-kbuild-all, linux-pci, linux-kernel, asahi,
linux-arm-kernel, devicetree, Yureka Lilian
Hi Yureka,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4]
url: https://github.com/intel-lab-lkp/linux/commits/Yureka-Lilian/PCI-pwrctrl-Export-per-device-APIs/20261104-124029
base: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
patch link: https://lore.kernel.org/r/20261104-apple-pcie-pwren-v2-1-216a4066965f%40cyberchaos.dev
patch subject: [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs
config: arm-defconfig (https://download.01.org/0day-ci/archive/20261105/202611051425.vj4FPfnn-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 812626a41399a1d464a0d69627ab45c83b8ebfb9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261105/202611051425.vj4FPfnn-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611051425.vj4FPfnn-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> Warning: drivers/pci/pwrctrl/core.c:203 function parameter 'np' not described in 'pci_pwrctrl_power_off_device'
>> Warning: drivers/pci/pwrctrl/core.c:203 Excess function parameter 'device_node' description in 'pci_pwrctrl_power_off_device'
>> Warning: drivers/pci/pwrctrl/core.c:272 function parameter 'np' not described in 'pci_pwrctrl_power_on_device'
>> Warning: drivers/pci/pwrctrl/core.c:272 Excess function parameter 'device_node' description in 'pci_pwrctrl_power_on_device'
>> Warning: drivers/pci/pwrctrl/core.c:370 function parameter 'np' not described in 'pci_pwrctrl_create_device'
>> Warning: drivers/pci/pwrctrl/core.c:370 function parameter 'parent' not described in 'pci_pwrctrl_create_device'
>> Warning: drivers/pci/pwrctrl/core.c:370 Excess function parameter 'device_node' description in 'pci_pwrctrl_create_device'
>> Warning: drivers/pci/pwrctrl/core.c:439 function parameter 'np' not described in 'pci_pwrctrl_destroy_device'
>> Warning: drivers/pci/pwrctrl/core.c:439 Excess function parameter 'device_node' description in 'pci_pwrctrl_destroy_device'
>> Warning: drivers/pci/pwrctrl/core.c:203 function parameter 'np' not described in 'pci_pwrctrl_power_off_device'
>> Warning: drivers/pci/pwrctrl/core.c:203 Excess function parameter 'device_node' description in 'pci_pwrctrl_power_off_device'
>> Warning: drivers/pci/pwrctrl/core.c:272 function parameter 'np' not described in 'pci_pwrctrl_power_on_device'
>> Warning: drivers/pci/pwrctrl/core.c:272 Excess function parameter 'device_node' description in 'pci_pwrctrl_power_on_device'
>> Warning: drivers/pci/pwrctrl/core.c:370 function parameter 'np' not described in 'pci_pwrctrl_create_device'
>> Warning: drivers/pci/pwrctrl/core.c:370 function parameter 'parent' not described in 'pci_pwrctrl_create_device'
>> Warning: drivers/pci/pwrctrl/core.c:370 Excess function parameter 'device_node' description in 'pci_pwrctrl_create_device'
>> Warning: drivers/pci/pwrctrl/core.c:439 function parameter 'np' not described in 'pci_pwrctrl_destroy_device'
>> Warning: drivers/pci/pwrctrl/core.c:439 Excess function parameter 'device_node' description in 'pci_pwrctrl_destroy_device'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-05 6:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 11:40 [PATCH v2 0/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-11-04 11:40 ` [PATCH v2 1/3] PCI/pwrctrl: Export per-device APIs Yureka Lilian
2026-11-05 6:28 ` kernel test robot
2026-11-04 11:40 ` [PATCH v2 2/3] PCI: apple: Integrate pwrctrl API Yureka Lilian
2026-11-04 13:41 ` Janne Grunau
2026-11-04 11:40 ` [PATCH v2 3/3] arm64: dts: apple: t600x: Add PCIe pwren gpios Yureka Lilian
2026-11-04 13:57 ` Janne Grunau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®