Devicetree
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Alastair D'Silva <alastair@d-silva.org>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Vinod Koul" <vkoul@kernel.org>, "Chen-Yu Tsai" <wens@kernel.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Lee Jones" <lee@kernel.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Enzo Adriano" <enzo.adriano.code@gmail.com>,
	devicetree@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-phy@lists.infradead.org, linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org, mfd@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver
Date: Mon, 30 Nov 2026 14:12:50 -0600	[thread overview]
Message-ID: <20261130201250.GA339623@bhelgaas> (raw)
In-Reply-To: <20261130052450.177136-5-alastair@d-silva.org>

On Mon, Nov 30, 2026 at 04:24:45PM +1100, Alastair D'Silva wrote:
> Add a DesignWare PCIe Root Complex glue driver for Allwinner A733
> (sun60i) SoCs using dw_pcie_host_init().

> +++ b/drivers/pci/controller/dwc/Kconfig
> @@ -487,6 +487,21 @@ config PCIE_STM32_EP
>  	  This driver can also be built as a module. If so, the module
>  	  will be called pcie-stm32-ep.
>  
> +config PCIE_SUNXI
> +	tristate "Allwinner A733 (sun60i) PCIe host controller"

Reorder this so the Kconfig menu stays sorted by vendor.

> +#define SII_INT_MASK0			0x0e00
> +#define INTX_RX_ASSERT_SHIFT		5

Remove *_SHIFT definitions and use FIELD_GET() etc.  See other drivers
for examples.

> +#define INTX_RX_ASSERT_MASK		GENMASK(8, 5)
> +#define INTX_RX_ASSERT(x)		BIT((x) + INTX_RX_ASSERT_SHIFT)

> +static int sunxi_pcie_start_link(struct dw_pcie *pci)
> +{
> +	struct sunxi_pcie *sunxi = to_sunxi_pcie(pci);
> +	u32 val;
> +
> +	if (sunxi->rst_gpio) {
> +		/* Ensure T_PERST-CLK (>= 100 us) after REFCLK is stable */
> +		usleep_range(100, 200);

Use #define from drivers/pci/pci.h for the sleep.  Add one if needed.

> +static int sunxi_pcie_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct sunxi_pcie *sunxi;
> +	int ret;
> +
> +	sunxi = devm_kzalloc(dev, sizeof(*sunxi), GFP_KERNEL);
> +	if (!sunxi)
> +		return -ENOMEM;
> +
> +	sunxi->pci.dev = dev;
> +	sunxi->pci.ops = &sunxi_dw_pcie_ops;
> +	sunxi->pci.pp.ops = &sunxi_pcie_host_ops;
> +	raw_spin_lock_init(&sunxi->intx_lock);
> +	platform_set_drvdata(pdev, sunxi);
> +
> +	ret = sunxi_pcie_get_resources(pdev, sunxi);
> +	if (ret)
> +		return ret;
> +
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (sunxi->vpcie3v3) {
> +		ret = regulator_enable(sunxi->vpcie3v3);
> +		if (ret)
> +			goto err_pm;
> +	}
> +
> +	/* Ensure T_PVPERL (100 ms) from power/PERST# assertion before release */
> +	if (sunxi->vpcie3v3 || sunxi->rst_gpio)
> +		msleep(PCIE_T_PVPERL_MS);
> +
> +	ret = clk_set_rate(sunxi->clks[CLK_ID_SLV].clk, PCIE_SLV_CLK_RATE);
> +	if (ret)
> +		goto err_reg;
> +
> +	ret = clk_bulk_prepare_enable(NUM_SUNXI_PCIE_CLKS, sunxi->clks);
> +	if (ret)
> +		goto err_reg;
> +
> +	ret = reset_control_bulk_assert(NUM_SUNXI_PCIE_RSTS, sunxi->rsts);
> +	if (ret)
> +		goto err_clks;
> +
> +	usleep_range(10, 20);

Reference for this?

  reply	other threads:[~2026-11-30 20:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 1/9] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 2/9] phy: allwinner: Add Allwinner A733 Cadence Combo PHY driver Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding Alastair D'Silva
2026-11-30 20:18   ` Bjorn Helgaas
2026-11-30  5:24 ` [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver Alastair D'Silva
2026-11-30 20:12   ` Bjorn Helgaas [this message]
2026-11-30  5:24 ` [PATCH v2 5/9] arm64: dts: allwinner: sun60i-a733: Add PCIe and Combo PHY nodes Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 6/9] arm64: dts: allwinner: orangepi-4-pro: Enable PCIe Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 7/9] arm64: dts: allwinner: cubie-a7a: " Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 8/9] arm64: dts: allwinner: cubie-a7s: " Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 9/9] arm64: dts: allwinner: cubie-a7z: " Alastair D'Silva

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=20261130201250.GA339623@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alastair@d-silva.org \
    --cc=bhelgaas@google.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=enzo.adriano.code@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=vkoul@kernel.org \
    --cc=wens@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