From: Sean Anderson <sean.anderson@linux.dev>
To: Marek Vasut <marek.vasut@mailbox.org>,
Tom Rini <trini@konsulko.com>,
u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Subject: Re: [PATCH] PCI: Add power sequencing driver for PCI slots
Date: Tue, 6 Jan 2026 18:32:06 -0500 [thread overview]
Message-ID: <70d036ee-e61b-44bb-9160-697e4d3f75e1@linux.dev> (raw)
In-Reply-To: <bafc0b79-9126-4cdc-92d1-dd6fe2f884ac@mailbox.org>
On 1/6/26 18:14, Marek Vasut wrote:
> On 1/6/26 11:34 PM, Sean Anderson wrote:
>> Extend the PCI bridge driver to enable resources associated with PCI
>> slots like clocks, power rails, and resets. This is modeled off of the
>> PCI power control subsystem in Linux. The traditional compatible for PCI
>> slots in U-Boot is pci-bridge, but Linux uses the more-systematic
>> pciclass,0604 so add that as an option.
>
> Oh, nice :)
>
>> +static int __maybe_unused pci_bridge_probe(struct udevice *dev)
>> +{
>> + struct clk clk;
>> + struct gpio_desc perst;
>> +
>> + if (!clk_get_by_index(dev, 0, &clk)) {
>> + int ret = clk_enable(&clk);
>> +
>> + if (ret)
>> + return log_msg_ret("clk", ret);
>
> Should we use dev_err() instead ?
I thought we weren't supposed to log by default in device drivers to reduce text size?
>> + /* Delay for T_PERST-CLK (100 us for all slot types) */
>> + udelay(100);
>> + }
>> +
>> + if (!gpio_request_by_name(dev, "reset-gpios", 0, &perst, 0)) {
>
> Invert conditional, reduce indent.
OK
>> + unsigned long delay = 0;
>> + int ret;
>> +
>> + /*
>> + * If PERST is inactive, the following call to dm_gpio_clrset_flags
>> + * will be the first time we assert it and we will need to
>> + * delay for T_PERST.
>> + */
>> + if (dm_gpio_get_value(&perst) != 1)
>> + delay = 100;
>> +
>> + ret = dm_gpio_clrset_flags(&perst, GPIOD_MASK_DIR,
>> + GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
>> + if (ret)
>> + return log_msg_ret("set", ret);
>> + mdelay(delay);
>
> Maybe set a flag and avoid calling mdelay() altogether ?
OK
--Sean
>> + ret = dm_gpio_set_value(&perst, 0);
>> + if (ret)
>> + return log_msg_ret("clr", ret);
>> +
>> + /*
>> + * PCIe section 6.6.1:
>> + * > ... software must wait a minimum of 100 ms before sending a
>> + * > Configuration Request to the device immediately below that
>> + * > Port.
>> + */
>> + mdelay(100);
>> + }
>> +
>> + return 0;
>> +}
>> +
>> U_BOOT_DRIVER(pci_bridge_drv) = {
>> .name = "pci_bridge_drv",
>> .id = UCLASS_PCI,
>> .of_match = pci_bridge_ids,
>> +#if CONFIG_IS_ENABLED(PCI_PWRCTRL_SLOT)
>> + .probe = pci_bridge_probe,
>
> .probe = CONFIG_IS_ENABLED(PCI_PWRCTRL_SLOT, pci_bridge_probe, NULL),
>
> Thanks !
next prev parent reply other threads:[~2026-01-06 23:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 22:34 [PATCH] PCI: Add power sequencing driver for PCI slots Sean Anderson
2026-01-06 23:14 ` Marek Vasut
2026-01-06 23:32 ` Sean Anderson [this message]
2026-01-07 0:03 ` Marek Vasut
2026-01-07 0:14 ` Tom Rini
2026-01-08 4:07 ` Peter Robinson
2026-01-08 14:29 ` Sean Anderson
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=70d036ee-e61b-44bb-9160-697e4d3f75e1@linux.dev \
--to=sean.anderson@linux.dev \
--cc=marek.vasut+renesas@mailbox.org \
--cc=marek.vasut@mailbox.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.