ata: ahci_brcm: Fix use of BCM7216 reset controller
Subsystems (6)
Jim Quinlan
maintainerv3 cover ata: ahci_brcm: Fix use of BCM7216 reset controller
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
[1] Applied commit "reset: make shared pulsed reset controls re-triggerable" found at git://git.pengutronix.de/git/pza/linux.git
branch reset/shared-retrigger
Jim Quinlan (2):
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 +++++++---- 2 files changed, 36 insertions(+), 29 deletions(-)
Signature · 1 line
2.17.1
Jim Quinlan
maintainerPATCH RESEND v3 1/2 ata: ahci_brcm: Fix use of BCM7216 reset controller
From: Jim Quinlan <[email protected]>
This driver may use one of two resets controllers. Keep them in separate variables to keep things simple. The reset controller "rescal" is shared between the AHCI driver and the PCIe driver for the BrcmSTB 7216 chip. Use devm_reset_control_get_optional_shared() to handle this sharing.
--- drivers/ata/ahci_brcm.c | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/ata/ahci_brcm.c +23 -23
@@ -86,7 +86,8 @@ struct brcm_ahci_priv {u32 port_mask;u32 quirks;enum brcm_ahci_version version; -struct reset_control *rcdev; +struct reset_control *rcdev_rescal; +struct reset_control *rcdev_ahci; };static inline u32 brcm_sata_readreg (void __iomem *addr)
@@ -352,8 +353,8 @@ static int brcm_ahci_suspend(struct device *dev)else ret =0 ; -if (priv->version !=BRCM_SATA_BCM7216 ) -reset_control_assert (priv->rcdev); +reset_control_assert (priv->rcdev_ahci); +reset_control_rearm (priv->rcdev_rescal);return ret; }
@@ -365,10 +366,10 @@ static int __maybe_unused brcm_ahci_resume(struct device *dev)struct brcm_ahci_priv *priv = hpriv->plat_data;int ret =0 ; -if (priv->version ==BRCM_SATA_BCM7216 ) - ret =reset_control_reset (priv->rcdev); -else - ret =reset_control_deassert (priv->rcdev); + ret =reset_control_deassert (priv->rcdev_ahci); +if (ret) +return ret; + ret =reset_control_reset (priv->rcdev_rescal);if (ret)return ret;
@@ -428,7 +429,6 @@ static int brcm_ahci_probe(struct platform_device *pdev) {const struct of_device_id *of_id;struct device *dev = &pdev->dev; -const char *reset_name =NULL ;struct brcm_ahci_priv *priv;struct ahci_host_priv *hpriv;struct resource *res;
@@ -450,15 +450,15 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (IS_ERR (priv->top_ctrl))return PTR_ERR (priv->top_ctrl); -/* Reset is optional depending on platform and named differently */ -if (priv->version ==BRCM_SATA_BCM7216 ) - reset_name ="rescal" ; -else - reset_name ="ahci" ; - - priv->rcdev =devm_reset_control_get_optional (&pdev->dev, reset_name); -if (IS_ERR (priv->rcdev)) -return PTR_ERR (priv->rcdev); +if (priv->version ==BRCM_SATA_BCM7216 ) { + priv->rcdev_rescal =devm_reset_control_get_optional_shared ( + &pdev->dev,"rescal" ); +if (IS_ERR (priv->rcdev_rescal)) +return PTR_ERR (priv->rcdev_rescal); + } + priv->rcdev_ahci =devm_reset_control_get_optional (&pdev->dev,"ahci" ); +if (IS_ERR (priv->rcdev_ahci)) +return PTR_ERR (priv->rcdev_ahci); hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv))
@@ -479,10 +479,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)break ; } -if (priv->version ==BRCM_SATA_BCM7216 ) - ret =reset_control_reset (priv->rcdev); -else - ret =reset_control_deassert (priv->rcdev); + ret =reset_control_reset (priv->rcdev_rescal); +if (ret) +return ret; + ret =reset_control_deassert (priv->rcdev_ahci);if (ret)return ret;
@@ -527,8 +527,8 @@ static int brcm_ahci_probe(struct platform_device *pdev) out_disable_clks:ahci_platform_disable_clks (hpriv); out_reset: -if (priv->version !=BRCM_SATA_BCM7216 ) -reset_control_assert (priv->rcdev); +reset_control_assert (priv->rcdev_ahci); +reset_control_rearm (priv->rcdev_rescal);return ret; }
Signature · 1 line
2.17.1
Jim Quinlan
maintainerPATCH RESEND v3 2/2 PCI: brcmstb: use reset/rearm instead of deassert/assert
In reply to Jim QuinlanThe Brcmstb PCIe RC uses a reset control "rescal" for certain chips. This reset implements a "pulse reset" so it matches more the reset/rearm calls instead of the deassert/assert calls.
Also, add reset_control calls in suspend/resume functions.
--- drivers/pci/controller/pcie-brcmstb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/pci/controller/pcie-brcmstb.c +13 -6
@@ -1127,6 +1127,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;
@@ -1142,9 +1143,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 err0; + ret =brcm_phy_start (pcie);if (ret) - goto err; + goto err1;/* Take bridge out of reset so we can access the SERDES reg */ pcie->bridge_sw_init_set (pcie,0 );
@@ -1159,14 +1164,16 @@ static int brcm_pcie_resume(struct device *dev) ret =brcm_pcie_setup (pcie);if (ret) - goto err; + goto err1;if (pcie->msi)brcm_msi_set_regs (pcie->msi);return 0 ; -err: +err1: +reset_control_rearm (pcie->rescal); +err0:clk_disable_unprepare (pcie->clk);return ret; }
@@ -1176,7 +1183,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); }
@@ -1251,13 +1258,13 @@ static int brcm_pcie_probe(struct platform_device *pdev)return PTR_ERR (pcie->rescal); } - 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; }
Signature · 1 line
2.17.1
Quoted 10 lines · Jim Quinlan
From: Jim Quinlan <[email protected]>
This driver may use one of two resets controllers. Keep them in separate variables to keep things simple. The reset controller "rescal" is shared between the AHCI driver and the PCIe driver for the BrcmSTB 7216 chip. Use
devm_reset_control_get_optional_shared()to handle this sharing.Fixes 272ecd60a636 ("ata: ahci_brcm: BCM7216 reset is self de-asserting")Fixes c345ec6a50e9 ("ata: ahci_brcm: Support BCM7216 reset controller name")Signed-off-by Jim Quinlan <[email protected]>
Thanks a lot for fixing this Jim, given the reset lines are still mutually exclusive the single variable along with the 7216 versus another chip differentiation would still work, but I have no objection to the approach you have taken:
Signature · 1 line
Florian
Re: [RESEND PATCH v3 2/2] PCI: brcmstb: use reset/rearm instead of deassert/assert
In reply to Jim QuinlanQuoted 7 lines · Jim Quinlan
The Brcmstb PCIe RC uses a reset control "rescal" for certain chips. This reset implements a "pulse reset" so it matches more the reset/rearm calls instead of the deassert/assert calls.
Also, add
reset_controlcalls in suspend/resume functions.Signed-off-by Jim Quinlan <[email protected]>
This should probably deserve a Fixes tag as well:
Thanks!
Signature · 1 line
Florian
Quoted 12 lines · Jim Quinlan
v3 -- discard commit from v2; instead rely on the new function
reset_control_rearmprovided in a recent commit [1] applied to reset/next.
-- New commit to correctpcie-brcmstb.cusage 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.
Quoted 6 lines
v1 -- original
[1] Applied commit "reset: make shared pulsed reset controls re-triggerable" found at
git://git.pengutronix.de/git/pza/linux.git
branch reset/shared-retrigger
The changes in that branch above have now landed in Linus' tree with:
It would be good if we could get both patches applied via the same tree or within the same cycle to avoid having either PCIe or SATA broken on these platforms.
Thanks!
Signature · 1 line
Florian
Quoted 22 lines · Florian Fainelli
Quoted 12 lines · Jim Quinlan
v3 -- discard commit from v2; instead rely on the new function
reset_control_rearmprovided in a recent commit [1] applied to reset/next.
-- New commit to correctpcie-brcmstb.cusage 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.Quoted 6 lines
v1 -- original
[1] Applied commit "reset: make shared pulsed reset controls re-triggerable" found at
git://git.pengutronix.de/git/pza/linux.git
branch reset/shared-retrigger
Quoted 7 lines
The changes in that branch above have now landed in Linus' tree with:
It would be good if we could get both patches applied via the same tree or within the same cycle to avoid having either PCIe or SATA broken on these platforms.
Ping? Can someone apply those patches if you are happy with them? Thank you.
Signature · 1 line
Florian
Quoted 25 lines · Florian Fainelli
Quoted 24 lines · Florian Fainelli
Quoted 12 lines · Jim Quinlan
v3 -- discard commit from v2; instead rely on the new function
reset_control_rearmprovided in a recent commit [1] applied to reset/next.
-- New commit to correctpcie-brcmstb.cusage 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.Quoted 6 lines
v1 -- original
[1] Applied commit "reset: make shared pulsed reset controls re-triggerable" found at
git://git.pengutronix.de/git/pza/linux.git
branch reset/shared-retriggerThe changes in that branch above have now landed in Linus' tree with:
Quoted 7 lines
Quoted 5 lines
It would be good if we could get both patches applied via the same tree or within the same cycle to avoid having either PCIe or SATA broken on these platforms.
Ping? Can someone apply those patches if you are happy with them? Thank you.
Ping? Can we review and ideally also apply these patches? Thanks
Signature · 1 line
Florian
Quoted 28 lines · Florian Fainelli
Quoted 27 lines · Florian Fainelli
Quoted 26 lines · Florian Fainelli
Quoted 12 lines · Jim Quinlan
v3 -- discard commit from v2; instead rely on the new function
reset_control_rearmprovided in a recent commit [1] applied to reset/next.
-- New commit to correctpcie-brcmstb.cusage 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.Quoted 6 lines
v1 -- original
[1] Applied commit "reset: make shared pulsed reset controls re-triggerable" found at
git://git.pengutronix.de/git/pza/linux.git
branch reset/shared-retriggerThe changes in that branch above have now landed in Linus' tree with:
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
It would be good if we could get both patches applied via the same tree or within the same cycle to avoid having either PCIe or SATA broken on these platforms.
Ping? Can someone apply those patches if you are happy with them? Thank you.
Ping? Can we review and ideally also apply these patches? Thanks
Is there something going on preventing these patches from being reviewed and/or applied?
Signature · 1 line
Florian
Quoted 33 lines · Florian Fainelli
Quoted 32 lines · Florian Fainelli
Quoted 31 lines · Florian Fainelli
Quoted 29 lines · Florian Fainelli
Quoted 12 lines · Jim Quinlan
v3 -- discard commit from v2; instead rely on the new function
reset_control_rearmprovided in a recent commit [1] applied to reset/next.
-- New commit to correctpcie-brcmstb.cusage 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.Quoted 6 lines
v1 -- original
[1] Applied commit "reset: make shared pulsed reset controls re-triggerable" found at
git://git.pengutronix.de/git/pza/linux.git
branch reset/shared-retriggerThe changes in that branch above have now landed in Linus' tree with:
It would be good if we could get both patches applied via the same tree or within the same cycle to avoid having either PCIe or SATA broken on these platforms.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Ping? Can someone apply those patches if you are happy with them? Thank you.
Ping? Can we review and ideally also apply these patches? Thanks
Is there something going on preventing these patches from being reviewed and/or applied?
It mentions a dependency, which makes it harder to apply. I see that dependency seems to have been applied, so maybe post an updated version of the series, including both patches.
The series touches both ATA and PCI, so not immediately obvious where it should go. It looks like the ATA part is bigger, but only 2/2 went to linux-pci, so it's harder to figure this out than it should be. I poked around a bit on lore, but I can't find 1/2 at all:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Maybe also include Nicolas Saenz Julienne <[email protected]> directly in "To:". I know I look at stuff addressed directly to me first; the "CC:" flood gets overwhelming fast. I assume Lorenzo will look for at least an ack from Nicolas before doing anything.
If you repost, it's nice if you match existing style, e.g.,
- PCI: brcmstb: use reset/rearm instead of deassert/assert
+ PCI: brcmstb: Use reset/rearm instead of deassert/assert
Bjorn