Devicetree
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut+renesas@mailbox.org>
To: linux-pci@vger.kernel.org
Cc: "Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Koichiro Den" <den@valinux.co.jp>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH 3/6] PCI: rcar-gen4: Add Application/Local register reset control
Date: Thu,  3 Sep 2026 22:50:54 +0200	[thread overview]
Message-ID: <20260903205153.283553-3-marek.vasut+renesas@mailbox.org> (raw)
In-Reply-To: <20260903205153.283553-1-marek.vasut+renesas@mailbox.org>

The R-Car Gen4 PCIe controller does contain core reset, which puts
the controller back into well defined state, but it does also tear
down the PCIe link. This is called Application/Local register reset
in the documentation.

Deassert the core reset after the core clock have been enabled, and
assert the core reset in case of error or when shutting down the
controller.

This also fixes reinitialization failure of the controller, where if
the controller driver is unbind and bind again via sysfs attributes,
the controller driver will fail to probe the second time because it
fails to access the controller DBI, which returns all zeroes unless
the core reset is toggled. The following commands trigger this fault
on R-Car V4H:

$ echo e65d0000.pcie > /sys/bus/platform/drivers/pcie-rcar-gen4/unbind
$ echo e65d0000.pcie > /sys/bus/platform/drivers/pcie-rcar-gen4/bind

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: "Krzysztof Wilczyński" <kwilczynski@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Koichiro Den <den@valinux.co.jp>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
 drivers/pci/controller/dwc/pcie-rcar-gen4.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
index f938430644860..ceffaa2e4cf99 100644
--- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
+++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
@@ -197,6 +197,8 @@ static int rcar_gen4_pcie_common_init(struct rcar_gen4_pcie *rcar)
 		return ret;
 	}
 
+	reset_control_deassert(dw->core_rsts[DW_PCIE_CORE_RST].rstc);
+
 	if (!reset_control_status(dw->core_rsts[DW_PCIE_PWR_RST].rstc)) {
 		reset_control_assert(dw->core_rsts[DW_PCIE_PWR_RST].rstc);
 		/*
@@ -247,6 +249,7 @@ static int rcar_gen4_pcie_common_init(struct rcar_gen4_pcie *rcar)
 	return 0;
 
 err_unprepare:
+	reset_control_assert(dw->core_rsts[DW_PCIE_CORE_RST].rstc);
 	clk_bulk_disable_unprepare(DW_PCIE_NUM_CORE_CLKS, dw->core_clks);
 
 	return ret;
@@ -257,6 +260,7 @@ static void rcar_gen4_pcie_common_deinit(struct rcar_gen4_pcie *rcar)
 	struct dw_pcie *dw = &rcar->dw;
 
 	reset_control_assert(dw->core_rsts[DW_PCIE_PWR_RST].rstc);
+	reset_control_assert(dw->core_rsts[DW_PCIE_CORE_RST].rstc);
 	clk_bulk_disable_unprepare(DW_PCIE_NUM_CORE_CLKS, dw->core_clks);
 }
 
-- 
2.53.0


  parent reply	other threads:[~2026-09-03 20:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 20:50 [PATCH 1/6] dt-bindings: PCI: rcar-gen4-pci-host: Document Application/Local register reset Marek Vasut
2026-09-03 20:50 ` [PATCH 2/6] dt-bindings: PCI: rcar-gen4-pci-ep: " Marek Vasut
2026-09-03 20:57   ` sashiko-bot
2026-09-03 20:50 ` Marek Vasut [this message]
2026-09-03 21:02   ` [PATCH 3/6] PCI: rcar-gen4: Add Application/Local register reset control sashiko-bot
2026-09-03 20:50 ` [PATCH 4/6] arm64: dts: renesas: r8a779f0: Add PCIe Application/Local register reset Marek Vasut
2026-09-03 21:01   ` sashiko-bot
2026-09-03 20:50 ` [PATCH 5/6] arm64: dts: renesas: r8a779g0: " Marek Vasut
2026-09-03 21:01   ` sashiko-bot
2026-09-03 20:50 ` [PATCH 6/6] arm64: dts: renesas: r8a779h0: " Marek Vasut
2026-09-03 21:04   ` sashiko-bot
2026-09-03 20:57 ` [PATCH 1/6] dt-bindings: PCI: rcar-gen4-pci-host: Document " sashiko-bot

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=20260903205153.283553-3-marek.vasut+renesas@mailbox.org \
    --to=marek.vasut+renesas@mailbox.org \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=den@valinux.co.jp \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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