From: Bjorn Helgaas <helgaas@kernel.org>
To: Siddharth Vadapalli <s-vadapalli@ti.com>
Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, lpieralisi@kernel.org, kw@linux.com,
bhelgaas@google.com, vigneshr@ti.com, kishon@kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
srk@ti.com
Subject: Re: [PATCH 3/3] PCI: j721e: Add support for enabling ACSPCIE PAD IO Buffer output
Date: Thu, 25 Jul 2024 16:18:41 -0500 [thread overview]
Message-ID: <20240725211841.GA859405@bhelgaas> (raw)
In-Reply-To: <20240715120936.1150314-4-s-vadapalli@ti.com>
On Mon, Jul 15, 2024 at 05:39:36PM +0530, Siddharth Vadapalli wrote:
> The ACSPCIE module is capable of driving the reference clock required by
> the PCIe Endpoint device. It is an alternative to on-board and external
> reference clock generators. Enabling the output from the ACSPCIE module's
> PAD IO Buffers requires clearing the "PAD IO disable" bits of the
> ACSPCIE_PROXY_CTRL register in the CTRL_MMR register space.
And I guess this patch actually *does* enable the ACSPCIE PAD IO
Buffer output?
This commit log tells me what is *required* to enable the output, but
it doesn't actually say whether the patch *does* enable the output.
Similarly, if this patch enables ACSPCIE PAD IO Buffer output, I would
make the subject be:
PCI: j721e: Enable ACSPCIE Refclk output when DT property is present
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> ---
> drivers/pci/controller/cadence/pci-j721e.c | 33 ++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c
> index 85718246016b..2fa0eff68a8a 100644
> --- a/drivers/pci/controller/cadence/pci-j721e.c
> +++ b/drivers/pci/controller/cadence/pci-j721e.c
> @@ -44,6 +44,7 @@ enum link_status {
> #define J721E_MODE_RC BIT(7)
> #define LANE_COUNT(n) ((n) << 8)
>
> +#define ACSPCIE_PAD_ENABLE_MASK GENMASK(1, 0)
> #define GENERATION_SEL_MASK GENMASK(1, 0)
>
> struct j721e_pcie {
> @@ -220,6 +221,30 @@ static int j721e_pcie_set_lane_count(struct j721e_pcie *pcie,
> return ret;
> }
>
> +static int j721e_acspcie_pad_enable(struct j721e_pcie *pcie, struct regmap *syscon)
> +{
> + struct device *dev = pcie->cdns_pcie->dev;
> + struct device_node *node = dev->of_node;
> + u32 mask = ACSPCIE_PAD_ENABLE_MASK;
> + struct of_phandle_args args;
> + u32 val;
> + int ret;
> +
> + ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-acspcie-proxy-ctrl",
> + 1, 0, &args);
> + if (!ret) {
> + /* PAD Enable Bits have to be cleared to in order to enable output */
Most of this file fits in 80 columns (printf strings are an exception
so they're easier to find with grep). It'd be nice if your new code
and comments fit in 80 columns as well.
An easy fix for the comment would be:
/* Clear PAD Enable bits to enable output */
Although it sounds non-sensical to *clear* enable bits to enable
something, and the commit log talks about clearing PAD IO *disable*
bits, so maybe you meant this instead?
/* Clear PAD IO disable bits to enable output */
If the logical operation here is to enable driving Refclk, I think the
function name and error messages might be more informative if they
mentioned "refclk" instead of "PAD".
> + val = ~(args.args[0]);
> + ret = regmap_update_bits(syscon, 0, mask, val);
> + if (ret)
> + dev_err(dev, "Enabling ACSPCIE PAD output failed: %d\n", ret);
> + } else {
> + dev_err(dev, "ti,syscon-acspcie-proxy-ctrl has invalid parameters\n");
> + }
> +
> + return ret;
> +}
> +
> static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)
> {
> struct device *dev = pcie->cdns_pcie->dev;
> @@ -259,6 +284,14 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)
> return ret;
> }
>
> + /* Enable ACSPCIe PAD IO Buffers if the optional property exists */
Is the canonical name "ACSPCIE" or "ACSPCIe"? You used "ACSPCIE"
above?
> + syscon = syscon_regmap_lookup_by_phandle_optional(node, "ti,syscon-acspcie-proxy-ctrl");
> + if (syscon) {
> + ret = j721e_acspcie_pad_enable(pcie, syscon);
> + if (ret)
> + return ret;
> + }
> +
> return 0;
> }
>
> --
> 2.40.1
>
next prev parent reply other threads:[~2024-07-25 21:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-15 12:09 [PATCH 0/3] Add support for ACSPCIE refclk output on J784S4-EVM Siddharth Vadapalli
2024-07-15 12:09 ` [PATCH 1/3] dt-bindings: mfd: syscon: Add ti,j784s4-acspcie-proxy-ctrl compatible Siddharth Vadapalli
2024-07-17 12:08 ` Krzysztof Kozlowski
2024-07-25 10:23 ` (subset) " Lee Jones
2024-07-29 5:41 ` Siddharth Vadapalli
2024-07-15 12:09 ` [PATCH 2/3] dt-bindings: PCI: ti,j721e-pci-host: Add ACSPCIE proxy control property Siddharth Vadapalli
2024-07-17 12:08 ` Krzysztof Kozlowski
2024-07-15 12:09 ` [PATCH 3/3] PCI: j721e: Add support for enabling ACSPCIE PAD IO Buffer output Siddharth Vadapalli
2024-07-25 21:18 ` Bjorn Helgaas [this message]
2024-07-26 10:15 ` Siddharth Vadapalli
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=20240725211841.GA859405@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
/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;
as well as URLs for NNTP newsgroup(s).