From: Bjorn Helgaas <helgaas@kernel.org>
To: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"chaitanya chundru" <quic_krichai@quicinc.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
cros-qcom-dts-watchers@chromium.org,
"Jingoo Han" <jingoohan1@gmail.com>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
quic_vbadigan@quicnic.com, amitk@kernel.org,
linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
jorge.ramirez@oss.qualcomm.com,
"Dmitry Baryshkov" <lumag@kernel.org>,
"Bartosz Golaszewski" <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v5 8/9] PCI: pwrctrl: Add power control driver for tc9563
Date: Fri, 18 Apr 2025 15:16:31 -0500 [thread overview]
Message-ID: <20250418201631.GA82526@bhelgaas> (raw)
In-Reply-To: <20250412-qps615_v4_1-v5-8-5b6a06132fec@oss.qualcomm.com>
On Sat, Apr 12, 2025 at 07:19:57AM +0530, Krishna Chaitanya Chundru wrote:
> TC9563 is a PCIe switch which has one upstream and three downstream
> ports. To one of the downstream ports ethernet MAC is connected as endpoint
> device. Other two downstream ports are supposed to connect to external
> device. One Host can connect to TC9563 by upstream port. TC9563 switch
> needs to be configured after powering on and before PCIe link was up.
This is described as a generic driver for TC9563, but the ethernet MAC
stuff built into doesn't sound generic. Maybe this could be clarified
here and in the Kconfig help text.
> +#define TC9563_GPIO_CONFIG 0x801208
> +#define TC9563_RESET_GPIO 0x801210
I guess these are i2c register addresses?
> +#define TC9563_BUS_CONTROL 0x801014
Unused.
> +#define TC9563_PORT_L0S_DELAY 0x82496c
> +#define TC9563_PORT_L1_DELAY 0x824970
I guess these correspond to "L0s Exit Latency" and "L1 Exit Latency"
in the PCIe spec? Can we name them to suggest that? Where do the
values come from?
> +#define TC9563_EMBEDDED_ETH_DELAY 0x8200d8
> +#define TC9563_ETH_L1_DELAY_MASK GENMASK(27, 18)
> +#define TC9563_ETH_L1_DELAY_VALUE(x) FIELD_PREP(TC9563_ETH_L1_DELAY_MASK, x)
> +#define TC9563_ETH_L0S_DELAY_MASK GENMASK(17, 13)
> +#define TC9563_ETH_L0S_DELAY_VALUE(x) FIELD_PREP(TC9563_ETH_L0S_DELAY_MASK, x)
> +#define TC9563_PWRCTL_MAX_SUPPLY 6
> +
> +struct tc9563_pwrctrl_ctx {
> + struct regulator_bulk_data supplies[TC9563_PWRCTL_MAX_SUPPLY];
> + struct tc9563_pwrctrl_cfg cfg[TC9563_MAX];
> + struct gpio_desc *reset_gpio;
> + struct i2c_adapter *adapter;
> + struct i2c_client *client;
> + struct pci_pwrctrl pwrctrl;
> +};
> +static int tc9563_pwrctrl_i2c_write(struct i2c_client *client,
> + u32 reg_addr, u32 reg_val)
> +{
> + struct i2c_msg msg;
> + u8 msg_buf[7];
> + int ret;
> +
> + msg.addr = client->addr;
> + msg.len = 7;
> + msg.flags = 0;
> +
> + /* Big Endian for reg addr */
> + put_unaligned_be24(reg_addr, &msg_buf[0]);
Of the 1000+ calls to i2c_transfer(), I only see about 25 uses of
put_unaligned_be*() beforehand. Are most of the other 975 calls
broken? Or maybe they are only used on platforms of known endianness
so they don't need it? Just a question; I have no idea how i2c works.
> + /* Little Endian for reg val */
> + put_unaligned_le32(reg_val, &msg_buf[3]);
> +
> + msg.buf = msg_buf;
> + ret = i2c_transfer(client->adapter, &msg, 1);
> + return ret == 1 ? 0 : ret;
> +}
> + ret = of_property_read_u8_array(node, "nfts", cfg->nfts, 2);
> + if (ret && ret != -EINVAL)
> + return ret;
Asked elsewhere whether "nfts" is supposed to match the DT "n-fts"
property.
> +static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctrl_ctx *ctx)
> +{
> + struct tc9563_pwrctrl_cfg *cfg;
> + int ret, i;
> +
> + ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
> + if (ret < 0)
> + return dev_err_probe(ctx->pwrctrl.dev, ret, "cannot enable regulators\n");
> +
> + gpiod_set_value(ctx->reset_gpio, 0);
> +
> + /* wait for the internal osc frequency to stablise */
s/stablise/stabilize/ (or "stabilise" if you prefer)
> + usleep_range(10000, 10500);
Where do these values come from? Can we add a spec citation?
> + ret = tc9563_pwrctrl_set_l0s_l1_entry_delay(ctx, i, false, cfg->l0s_delay);
> + if (ret) {
> + dev_err(ctx->pwrctrl.dev, "Setting L0s entry delay failed\n");
Since these are *entry* delays, maybe they're not related to the "Exit
Latencies" from the PCIe spec. But if they *are* related, can we use
the same terms here?
> + ret = tc9563_pwrctrl_set_l0s_l1_entry_delay(ctx, i, true, cfg->l1_delay);
> + if (ret) {
> + dev_err(ctx->pwrctrl.dev, "Setting L1 entry delay failed\n");
> + ret = tc9563_pwrctrl_set_tx_amplitude(ctx, i, cfg->tx_amp);
> + if (ret) {
> + dev_err(ctx->pwrctrl.dev, "Setting Tx amplitube failed\n");
s/amplitube/amplitude/
> + goto power_off;
> + }
> +
> + ret = tc9563_pwrctrl_set_nfts(ctx, i, cfg->nfts);
> + if (ret) {
> + dev_err(ctx->pwrctrl.dev, "Setting nfts failed\n");
s/nfts/N_FTS/ to match spec usage.
> +static int tc9563_pwrctrl_probe(struct platform_device *pdev)
> +{
> ...
> + ctx->supplies[0].supply = "vddc";
> + ctx->supplies[1].supply = "vdd18";
> + ctx->supplies[2].supply = "vdd09";
> + ctx->supplies[3].supply = "vddio1";
> + ctx->supplies[4].supply = "vddio2";
> + ctx->supplies[5].supply = "vddio18";
Seems like this could be made into a const static array, maybe next to
TC9563_PWRCTL_MAX_SUPPLY?
> + for_each_child_of_node_scoped(pdev->dev.of_node, child) {
> + ret = tc9563_pwrctrl_parse_device_dt(ctx, child, port++);
> + if (ret)
> + break;
> + /* Embedded ethernet device are under DSP3 */
> + if (port == TC9563_DSP3)
Is this ethernet thing integrated into the TC9563? Seems like the
sort of topology thing that would normally be described via DT.
> + for_each_child_of_node_scoped(child, child1) {
> + ret = tc9563_pwrctrl_parse_device_dt(ctx, child1, port++);
> + if (ret)
> + break;
> + }
> + }
Bjorn
next prev parent reply other threads:[~2025-04-18 20:16 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-12 1:49 [PATCH v5 0/9] PCI: Enable Power and configure the TC9563 PCIe switch Krishna Chaitanya Chundru
2025-04-12 1:49 ` [PATCH v5 1/9] dt-bindings: PCI: Add binding for Toshiba " Krishna Chaitanya Chundru
2025-04-12 18:12 ` Rob Herring (Arm)
2025-04-12 1:49 ` [PATCH v5 2/9] arm64: dts: qcom: qcs6490-rb3gen2: Add TC9563 PCIe switch node Krishna Chaitanya Chundru
2025-04-13 16:35 ` Dmitry Baryshkov
2025-04-12 1:49 ` [PATCH v5 3/9] PCI: Add new start_link() & stop_link function ops Krishna Chaitanya Chundru
2025-04-18 20:20 ` Bjorn Helgaas
2025-04-12 1:49 ` [PATCH v5 4/9] PCI: dwc: Add host_start_link() & host_start_link() hooks for dwc glue drivers Krishna Chaitanya Chundru
2025-04-15 19:13 ` Frank Li
2025-04-16 4:20 ` Krishna Chaitanya Chundru
2025-04-12 1:49 ` [PATCH v5 5/9] PCI: dwc: Implement .start_link(), .stop_link() hooks Krishna Chaitanya Chundru
2025-04-12 1:49 ` [PATCH v5 6/9] PCI: qcom: Add support for host_stop_link() & host_start_link() Krishna Chaitanya Chundru
2025-04-12 1:49 ` [PATCH v5 7/9] PCI: PCI: Add pcie_link_is_active() to determine if the PCIe link is active Krishna Chaitanya Chundru
2025-04-12 3:52 ` Lukas Wunner
2025-04-13 17:14 ` Lukas Wunner
2025-04-14 4:21 ` Krishna Chaitanya Chundru
2025-04-14 4:23 ` Krishna Chaitanya Chundru
2025-04-12 18:11 ` Rob Herring
2025-04-12 1:49 ` [PATCH v5 8/9] PCI: pwrctrl: Add power control driver for tc9563 Krishna Chaitanya Chundru
2025-04-15 8:44 ` kernel test robot
2025-04-15 8:55 ` kernel test robot
2025-04-18 20:16 ` Bjorn Helgaas [this message]
2025-04-19 3:24 ` Krishna Chaitanya Chundru
2025-06-27 12:17 ` Dmitry Baryshkov
2025-04-12 1:49 ` [PATCH v5 9/9] arm64: defconfig: Enable TC9563 PWRCTL driver Krishna Chaitanya Chundru
2025-04-18 20:00 ` [PATCH v5 0/9] PCI: Enable Power and configure the TC9563 PCIe switch Bjorn Helgaas
2025-04-19 3:26 ` Krishna Chaitanya Chundru
2025-07-01 7:11 ` Dmitry Baryshkov
2025-07-01 7:40 ` Krishna Chaitanya Chundru
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=20250418201631.GA82526@bhelgaas \
--to=helgaas@kernel.org \
--cc=amitk@kernel.org \
--cc=andersson@kernel.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=bhelgaas@google.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=cros-qcom-dts-watchers@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=jingoohan1@gmail.com \
--cc=jorge.ramirez@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krishna.chundru@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=lumag@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=quic_krichai@quicinc.com \
--cc=quic_vbadigan@quicnic.com \
--cc=robh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox