[PATCH v3 1/3] PCI/pwrctrl: Add optional slot clock to pwrctrl driver for PCI slots
Marek Vasut
marek.vasut+renesas at mailbox.org
Sat Jun 7 12:44:37 PDT 2025
Add the ability to enable optional slot clock into the pwrctrl driver.
This is used to enable slot clock in split-clock topologies, where the
PCIe host/controller supply and PCIe slot supply are not provided by
the same clock. The PCIe host/controller clock should be described in
the controller node as the controller clock, while the slot clock should
be described in controller bridge/slot subnode.
Example DT snippet:
&pcicontroller {
clocks = <&clk_dif 0>; /* PCIe controller clock */
pci at 0,0 {
#address-cells = <3>;
#size-cells = <2>;
reg = <0x0 0x0 0x0 0x0 0x0>;
compatible = "pciclass,0604";
device_type = "pci";
clocks = <&clk_dif 1>; /* PCIe slot clock */
vpcie3v3-supply = <®_3p3v>;
ranges;
};
};
Example clock topology:
____________ ____________
| PCIe host | | PCIe slot |
| | | |
| PCIe RX<|==================|>PCIe TX |
| PCIe TX<|==================|>PCIe RX |
| | | |
| PCIe CLK<|======.. ..======|>PCIe CLK |
'------------' || || '------------'
|| ||
____________ || ||
| 9FGV0441 | || ||
| | || ||
| CLK DIF0<|======'' ||
| CLK DIF1<|==========''
| CLK DIF2<|
| CLK DIF3<|
'------------'
Acked-by: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
Reviewed-by: Anand Moon <linux.amoon at gmail.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Bartosz Golaszewski <brgl at bgdev.pl>
Cc: Bjorn Helgaas <bhelgaas at google.com>
Cc: Conor Dooley <conor+dt at kernel.org>
Cc: Geert Uytterhoeven <geert+renesas at glider.be>
Cc: Krzysztof Kozlowski <krzk+dt at kernel.org>
Cc: Magnus Damm <magnus.damm at gmail.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
Cc: Rob Herring <robh at kernel.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh at renesas.com>
Cc: devicetree at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-pci at vger.kernel.org
Cc: linux-renesas-soc at vger.kernel.org
---
V2: - Fold PTR_ERR() into dev_err_probe()
- Add RB from Anand and Manivannan
V3: - Rebase on top of PCI/pwrctrl: Fix double cleanup on devm_add_action_or_reset() failure
- Move devm_clk_get_optional_enabled() below devm_add_action_or_reset()
- Add AB from Bartosz
---
drivers/pci/pwrctrl/slot.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c
index 26b21746da50b..3320494b62d89 100644
--- a/drivers/pci/pwrctrl/slot.c
+++ b/drivers/pci/pwrctrl/slot.c
@@ -4,6 +4,7 @@
* Author: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
*/
+#include <linux/clk.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
@@ -30,6 +31,7 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)
{
struct pci_pwrctrl_slot_data *slot;
struct device *dev = &pdev->dev;
+ struct clk *clk;
int ret;
slot = devm_kzalloc(dev, sizeof(*slot), GFP_KERNEL);
@@ -56,6 +58,12 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)
if (ret)
return ret;
+ clk = devm_clk_get_optional_enabled(dev, NULL);
+ if (IS_ERR(clk)) {
+ return dev_err_probe(dev, PTR_ERR(clk),
+ "Failed to enable slot clock\n");
+ }
+
pci_pwrctrl_init(&slot->ctx, dev);
ret = devm_pci_pwrctrl_device_set_ready(dev, &slot->ctx);
--
2.47.2
More information about the linux-arm-kernel
mailing list