linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller
@ 2021-04-30 15:21 Jim Quinlan
  2021-04-30 15:21 ` [PATCH v6 3/3] PCI: brcmstb: Use reset/rearm instead of deassert/assert Jim Quinlan
  2021-05-03 18:57 ` [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Jim Quinlan @ 2021-04-30 15:21 UTC (permalink / raw)
  To: Bjorn Helgaas, Amjad Ouled-Ameur, Philipp Zabel, linux-pci,
	Nicolas Saenz Julienne, bcm-kernel-feedback-list, james.quinlan,
	jim2101024
  Cc: Florian Fainelli, Hans de Goede, Jens Axboe, Jim Quinlan,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
	open list,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	Lorenzo Pieralisi, Rob Herring

v6 -- Added new commit which adds a missing function to the reset API.
      This fixes 557acb3d2cd9 and should be destined for linux stable.

v5 -- Improved (I hope) commit description (Bjorn).
   -- Rnamed error labels (Krzyszt).
   -- Fixed typos.

v4 -- does not rely on a pending commit, unlike v3.

v3 -- discard commit from v2; instead rely on the new function
      reset_control_rearm provided in a recent commit [1] applied
      to reset/next.
   -- New commit to correct pcie-brcmstb.c usage of a reset controller
      to use reset/rearm verses deassert/assert.

v2 -- refactor rescal-reset driver to implement assert/deassert rather than
      reset because the reset call only fires once per lifetime and we need
      to reset after every resume from S2 or S3.
   -- Split the use of "ahci" and "rescal" controllers in separate fields
      to keep things simple.

v1 -- original

Jim Quinlan (3):
  reset: add missing empty function reset_control_rearm()
  ata: ahci_brcm: Fix use of BCM7216 reset controller
  PCI: brcmstb: Use reset/rearm instead of deassert/assert

 drivers/ata/ahci_brcm.c               | 46 +++++++++++++--------------
 drivers/pci/controller/pcie-brcmstb.c | 19 +++++++----
 include/linux/reset.h                 |  5 +++
 3 files changed, 41 insertions(+), 29 deletions(-)

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v6 3/3] PCI: brcmstb: Use reset/rearm instead of deassert/assert
  2021-04-30 15:21 [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller Jim Quinlan
@ 2021-04-30 15:21 ` Jim Quinlan
  2021-05-03 18:57 ` [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Quinlan @ 2021-04-30 15:21 UTC (permalink / raw)
  To: Bjorn Helgaas, Amjad Ouled-Ameur, Philipp Zabel, linux-pci,
	Nicolas Saenz Julienne, bcm-kernel-feedback-list, james.quinlan,
	jim2101024
  Cc: Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas, Florian Fainelli,
	Jim Quinlan,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	open list

The Broadcom STB PCIe RC uses a reset control "rescal" for certain chips.
The "rescal" implements a "pulse reset" so using assert/deassert is wrong
for this device.  Instead, we use reset/rearm.  We need to use rearm so
that we can reset it after a suspend/resume cycle; w/o using "rearm", the
"rescal" device will only ever fire once.

Of course for suspend/resume to work we also need to put the reset/rearm
calls in the suspend and resume routines.

Fixes: 740d6c3708a9 ("PCI: brcmstb: Add control of rescal reset")
Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/pci/controller/pcie-brcmstb.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index e330e6811f0b..3b35d629035e 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1148,6 +1148,7 @@ static int brcm_pcie_suspend(struct device *dev)
 
 	brcm_pcie_turn_off(pcie);
 	ret = brcm_phy_stop(pcie);
+	reset_control_rearm(pcie->rescal);
 	clk_disable_unprepare(pcie->clk);
 
 	return ret;
@@ -1163,9 +1164,13 @@ static int brcm_pcie_resume(struct device *dev)
 	base = pcie->base;
 	clk_prepare_enable(pcie->clk);
 
+	ret = reset_control_reset(pcie->rescal);
+	if (ret)
+		goto err_disable_clk;
+
 	ret = brcm_phy_start(pcie);
 	if (ret)
-		goto err;
+		goto err_reset;
 
 	/* Take bridge out of reset so we can access the SERDES reg */
 	pcie->bridge_sw_init_set(pcie, 0);
@@ -1180,14 +1185,16 @@ static int brcm_pcie_resume(struct device *dev)
 
 	ret = brcm_pcie_setup(pcie);
 	if (ret)
-		goto err;
+		goto err_reset;
 
 	if (pcie->msi)
 		brcm_msi_set_regs(pcie->msi);
 
 	return 0;
 
-err:
+err_reset:
+	reset_control_rearm(pcie->rescal);
+err_disable_clk:
 	clk_disable_unprepare(pcie->clk);
 	return ret;
 }
@@ -1197,7 +1204,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie)
 	brcm_msi_remove(pcie);
 	brcm_pcie_turn_off(pcie);
 	brcm_phy_stop(pcie);
-	reset_control_assert(pcie->rescal);
+	reset_control_rearm(pcie->rescal);
 	clk_disable_unprepare(pcie->clk);
 }
 
@@ -1278,13 +1285,13 @@ static int brcm_pcie_probe(struct platform_device *pdev)
 		return PTR_ERR(pcie->perst_reset);
 	}
 
-	ret = reset_control_deassert(pcie->rescal);
+	ret = reset_control_reset(pcie->rescal);
 	if (ret)
 		dev_err(&pdev->dev, "failed to deassert 'rescal'\n");
 
 	ret = brcm_phy_start(pcie);
 	if (ret) {
-		reset_control_assert(pcie->rescal);
+		reset_control_rearm(pcie->rescal);
 		clk_disable_unprepare(pcie->clk);
 		return ret;
 	}
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller
  2021-04-30 15:21 [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller Jim Quinlan
  2021-04-30 15:21 ` [PATCH v6 3/3] PCI: brcmstb: Use reset/rearm instead of deassert/assert Jim Quinlan
@ 2021-05-03 18:57 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2021-05-03 18:57 UTC (permalink / raw)
  To: Jim Quinlan
  Cc: Amjad Ouled-Ameur, Philipp Zabel, linux-pci,
	Nicolas Saenz Julienne, bcm-kernel-feedback-list, james.quinlan,
	Florian Fainelli, Hans de Goede, Jens Axboe, Jim Quinlan,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
	open list,
	moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
	Lorenzo Pieralisi, Rob Herring

On Fri, Apr 30, 2021 at 11:21:53AM -0400, Jim Quinlan wrote:
> v6 -- Added new commit which adds a missing function to the reset API.
>       This fixes 557acb3d2cd9 and should be destined for linux stable.
> 
> v5 -- Improved (I hope) commit description (Bjorn).
>    -- Rnamed error labels (Krzyszt).
>    -- Fixed typos.
> 
> v4 -- does not rely on a pending commit, unlike v3.
> 
> v3 -- discard commit from v2; instead rely on the new function
>       reset_control_rearm provided in a recent commit [1] applied
>       to reset/next.
>    -- New commit to correct pcie-brcmstb.c usage of a reset controller
>       to use reset/rearm verses deassert/assert.
> 
> v2 -- refactor rescal-reset driver to implement assert/deassert rather than
>       reset because the reset call only fires once per lifetime and we need
>       to reset after every resume from S2 or S3.
>    -- Split the use of "ahci" and "rescal" controllers in separate fields
>       to keep things simple.
> 
> v1 -- original
> 
> Jim Quinlan (3):
>   reset: add missing empty function reset_control_rearm()
>   ata: ahci_brcm: Fix use of BCM7216 reset controller
>   PCI: brcmstb: Use reset/rearm instead of deassert/assert
> 
>  drivers/ata/ahci_brcm.c               | 46 +++++++++++++--------------
>  drivers/pci/controller/pcie-brcmstb.c | 19 +++++++----
>  include/linux/reset.h                 |  5 +++
>  3 files changed, 41 insertions(+), 29 deletions(-)

I provisionally applied these to my pci/brcmstb branch for v5.13.

I carried forward Jens' ack on "ata: ahci_brcm: Fix use of BCM7216
reset controller" since the patch is identical to the v5 version that
he acked.

I'm hoping to get an ack from Philipp for the reset.h change.

Bjorn

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-03 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 15:21 [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller Jim Quinlan
2021-04-30 15:21 ` [PATCH v6 3/3] PCI: brcmstb: Use reset/rearm instead of deassert/assert Jim Quinlan
2021-05-03 18:57 ` [PATCH v6 0/3] ata: ahci_brcm: Fix use of BCM7216 reset controller Bjorn Helgaas

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).