Skip to contentSkip to conversation

ata: ahci_brcm: Fixes and new device support

PATCH In review Florian Fainelli 6 participants 18 messages Dec 10, 2019 – Jan 7, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ata: ahci_brcm: Fixes and new device support

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Thanks!

Florian Fainelli (8):
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
ata: ahci_brcm: Fix AHCI resources management
ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE
ata: ahci_brcm: Add missing clock management during recovery
ata: ahci_brcm: Manage reset line during suspend/resume
ata: ahci_brcm: Add a shutdown callback
dt-bindings: ata: Document BCM7216 AHCI controller compatible
ata: ahci_brcm: Support BCM7216 reset controller name

 .../bindings/ata/brcm,sata-brcm.txt           |   7 +
 drivers/ata/ahci_brcm.c                       | 167 ++++++++++++++----
 drivers/ata/libahci_platform.c                |   6 +-
 include/linux/ahci_platform.h                 |   2 +
 4 files changed, 141 insertions(+), 41 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/8 ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()

This reverts commit 6bb86fefa086faba7b60bb452300b76a47cde1a5 ("libahci_platform: Staticize ahci_platform_<en/dis>able_phys()") we are going to need ahci_platform_{enable,disable}_phys() in a subsequent commit for ahci_brcm.c in order to properly control the PHY initialization order.

Also make sure the function prototypes are declared in include/linux/ahci_platform.h as a result.

---
 drivers/ata/libahci_platform.c | 6 ++++--
 include/linux/ahci_platform.h  | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +4 -2
index 8befce036af8..129556fcf6be 100644
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops);
  * RETURNS:
  * 0 on success otherwise a negative error code
  */
-static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
+int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
 {
 	int rc, i;
 
@@ -74,6 +74,7 @@ static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
 	}
 	return rc;
 }
+EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);
 
 /**
  * ahci_platform_disable_phys - Disable PHYs
@@ -81,7 +82,7 @@ static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
  *
  * This function disables all PHYs found in hpriv->phys.
  */
-static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
+void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
 {
 	int i;
 
@@ -90,6 +91,7 @@ static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
 		phy_exit(hpriv->phys[i]);
 	}
 }
+EXPORT_SYMBOL_GPL(ahci_platform_disable_phys);
 
 /**
  * ahci_platform_enable_clks - Enable platform clocks
include/linux/ahci_platform.h +2 -0
index 6782f0d45ebe..49e5383d4222 100644
@@ -19,6 +19,8 @@ struct ahci_host_priv;
 struct platform_device;
 struct scsi_host_template;
 
+int ahci_platform_enable_phys(struct ahci_host_priv *hpriv);
+void ahci_platform_disable_phys(struct ahci_host_priv *hpriv);
 int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
 void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
 int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv);
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/8 ata: ahci_brcm: Fix AHCI resources management

In reply to Florian Fainelli

The AHCI resources management within ahci_brcm.c is a little convoluted, largely because it historically had a dedicated clock that was managed within this file in the downstream tree. Once brough upstream though, the clock was left to be managed by libahci_platform.c which is entirely appropriate.

This patch series ensures that the AHCI resources are fetched and enabled before any register access is done, thus avoiding bus errors on platforms which clock gate the controller by default.

As a result we need to re-arrange the suspend() and resume() functions in order to avoid accessing registers after the clocks have been turned off respectively before the clocks have been turned on. Finally, we can refactor brcm_ahci_get_portmask() in order to fetch the number of ports from hpriv->mmio which is now accessible without jumping through hoops like we used to do.

The commit pointed in the Fixes tag is both old and new enough not to require major headaches for backporting of this patch.

Fixes eba68f829794 ("ata: ahci_brcmstb: rename to support across Broadcom SoC's")
---
 drivers/ata/ahci_brcm.c | 105 +++++++++++++++++++++++++++++-----------
 1 file changed, 76 insertions(+), 29 deletions(-)
drivers/ata/ahci_brcm.c +76 -29
index f41744b9b38a..a8b2f3f7bbbc 100644
@@ -213,19 +213,12 @@ static void brcm_sata_phys_disable(struct brcm_ahci_priv *priv)
 			brcm_sata_phy_disable(priv, i);
 }
 
-static u32 brcm_ahci_get_portmask(struct platform_device *pdev,
+static u32 brcm_ahci_get_portmask(struct ahci_host_priv *hpriv,
 				  struct brcm_ahci_priv *priv)
 {
-	void __iomem *ahci;
-	struct resource *res;
 	u32 impl;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahci");
-	ahci = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(ahci))
-		return 0;
-
-	impl = readl(ahci + HOST_PORTS_IMPL);
+	impl = readl(hpriv->mmio + HOST_PORTS_IMPL);
 
 	if (fls(impl) > SATA_TOP_MAX_PHYS)
 		dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n",
@@ -233,9 +226,6 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev,
 	else if (!impl)
 		dev_info(priv->dev, "no ports found\n");
 
-	devm_iounmap(&pdev->dev, ahci);
-	devm_release_mem_region(&pdev->dev, res->start, resource_size(res));
-
 	return impl;
 }
 
@@ -347,11 +337,10 @@ static int brcm_ahci_suspend(struct device *dev)
 	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
 	struct brcm_ahci_priv *priv = hpriv->plat_data;
-	int ret;
 
-	ret = ahci_platform_suspend(dev);
 	brcm_sata_phys_disable(priv);
-	return ret;
+
+	return ahci_platform_suspend(dev);
 }
 
 static int brcm_ahci_resume(struct device *dev)
@@ -359,11 +348,44 @@ static int brcm_ahci_resume(struct device *dev)
 	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
 	struct brcm_ahci_priv *priv = hpriv->plat_data;
+	int ret;
+
+	/* Make sure clocks are turned on before re-configuration */
+	ret = ahci_platform_enable_clks(hpriv);
+	if (ret)
+		return ret;
 
 	brcm_sata_init(priv);
 	brcm_sata_phys_enable(priv);
 	brcm_sata_alpm_init(hpriv);
-	return ahci_platform_resume(dev);
+
+	/* Since we had to enable clocks earlier on, we cannot use
+	 * ahci_platform_resume() as-is since a second call to
+	 * ahci_platform_enable_resources() would bump up the resources
+	 * (regulators, clocks, PHYs) count artificially so we copy the part
+	 * after ahci_platform_enable_resources().
+	 */
+	ret = ahci_platform_enable_phys(hpriv);
+	if (ret)
+		goto out_disable_phys;
+
+	ret = ahci_platform_resume_host(dev);
+	if (ret)
+		goto out_disable_platform_phys;
+
+	/* We resumed so update PM runtime state */
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
+	return 0;
+
+out_disable_platform_phys:
+	ahci_platform_disable_phys(hpriv);
+out_disable_phys:
+	brcm_sata_phys_disable(priv);
+	ahci_platform_disable_clks(hpriv);
+	return ret;
 }
 #endif
 
@@ -416,38 +438,63 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 		priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
 	}
 
+	hpriv = ahci_platform_get_resources(pdev, 0);
+	if (IS_ERR(hpriv)) {
+		ret = PTR_ERR(hpriv);
+		goto out_reset;
+	}
+
+	ret = ahci_platform_enable_clks(hpriv);
+	if (ret)
+		goto out_reset;
+
+	/* Must be first so as to configure endianness including that
+	 * of the standard AHCI register space.
+	 */
 	brcm_sata_init(priv);
 
-	priv->port_mask = brcm_ahci_get_portmask(pdev, priv);
-	if (!priv->port_mask)
-		return -ENODEV;
+	/* Initializes priv->port_mask which is used below */
+	priv->port_mask = brcm_ahci_get_portmask(hpriv, priv);
+	if (!priv->port_mask) {
+		ret = -ENODEV;
+		goto out_disable_clks;
+	}
 
+	/* Must be done before ahci_platform_enable_phys() */
 	brcm_sata_phys_enable(priv);
 
-	hpriv = ahci_platform_get_resources(pdev, 0);
-	if (IS_ERR(hpriv))
-		return PTR_ERR(hpriv);
 	hpriv->plat_data = priv;
 	hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP;
 
 	brcm_sata_alpm_init(hpriv);
 
-	ret = ahci_platform_enable_resources(hpriv);
-	if (ret)
-		return ret;
-
 	if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ)
 		hpriv->flags |= AHCI_HFLAG_NO_NCQ;
 	hpriv->flags |= AHCI_HFLAG_NO_WRITE_TO_RO;
 
+	ret = ahci_platform_enable_phys(hpriv);
+	if (ret)
+		goto out_disable_phys;
+
 	ret = ahci_platform_init_host(pdev, hpriv, &ahci_brcm_port_info,
 				      &ahci_platform_sht);
 	if (ret)
-		return ret;
+		goto out_disable_platform_phys;
 
 	dev_info(dev, "Broadcom AHCI SATA3 registered\n");
 
 	return 0;
+
+out_disable_platform_phys:
+	ahci_platform_disable_phys(hpriv);
+out_disable_phys:
+	brcm_sata_phys_disable(priv);
+out_disable_clks:
+	ahci_platform_disable_clks(hpriv);
+out_reset:
+	if (!IS_ERR_OR_NULL(priv->rcdev))
+		reset_control_assert(priv->rcdev);
+	return ret;
 }
 
 static int brcm_ahci_remove(struct platform_device *pdev)
@@ -457,12 +504,12 @@ static int brcm_ahci_remove(struct platform_device *pdev)
 	struct brcm_ahci_priv *priv = hpriv->plat_data;
 	int ret;
 
+	brcm_sata_phys_disable(priv);
+
 	ret = ata_platform_remove_one(pdev);
 	if (ret)
 		return ret;
 
-	brcm_sata_phys_disable(priv);
-
 	return 0;
 }
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/8 ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE

In reply to Florian Fainelli

Set AHCI_HFLAG_DELAY_ENGINE for the BCM7425 AHCI controller thus making it conforming to the 'strict' AHCI implementation which this controller is based on.

This solves long link establishment with specific hard drives (e.g.:
Seagate ST1000VM002-9ZL1 SC12) that would otherwise have to complete the error recovery handling before finally establishing a succesful SATA link at the desired speed.

We re-order the hpriv->flags assignment to also remove the NONCQ quirk since we can set the flag directly.

Fixes 9586114cf1e9 ("ata: ahci_brcmstb: add support MIPS-based platforms")
Fixes 423be77daabe ("ata: ahci_brcmstb: add quirk for broken ncq")
---
 drivers/ata/ahci_brcm.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/ata/ahci_brcm.c +16 -15
index a8b2f3f7bbbc..58f8fd7bb8b8 100644
@@ -76,8 +76,7 @@ enum brcm_ahci_version {
 };
 
 enum brcm_ahci_quirks {
-	BRCM_AHCI_QUIRK_NO_NCQ		= BIT(0),
-	BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE	= BIT(1),
+	BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE	= BIT(0),
 };
 
 struct brcm_ahci_priv {
@@ -432,18 +431,27 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	if (!IS_ERR_OR_NULL(priv->rcdev))
 		reset_control_deassert(priv->rcdev);
 
-	if ((priv->version == BRCM_SATA_BCM7425) ||
-		(priv->version == BRCM_SATA_NSP)) {
-		priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ;
-		priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
-	}
-
 	hpriv = ahci_platform_get_resources(pdev, 0);
 	if (IS_ERR(hpriv)) {
 		ret = PTR_ERR(hpriv);
 		goto out_reset;
 	}
 
+	hpriv->plat_data = priv;
+	hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP | AHCI_HFLAG_NO_WRITE_TO_RO;
+
+	switch (priv->version) {
+	case BRCM_SATA_BCM7425:
+		hpriv->flags |= AHCI_HFLAG_DELAY_ENGINE;
+		/* fall through */
+	case BRCM_SATA_NSP:
+		hpriv->flags |= AHCI_HFLAG_NO_NCQ;
+		priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
+		break;
+	default:
+		break;
+	}
+
 	ret = ahci_platform_enable_clks(hpriv);
 	if (ret)
 		goto out_reset;
@@ -463,15 +471,8 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	/* Must be done before ahci_platform_enable_phys() */
 	brcm_sata_phys_enable(priv);
 
-	hpriv->plat_data = priv;
-	hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP;
-
 	brcm_sata_alpm_init(hpriv);
 
-	if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ)
-		hpriv->flags |= AHCI_HFLAG_NO_NCQ;
-	hpriv->flags |= AHCI_HFLAG_NO_WRITE_TO_RO;
-
 	ret = ahci_platform_enable_phys(hpriv);
 	if (ret)
 		goto out_disable_phys;
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/8 ata: ahci_brcm: Add missing clock management during recovery

In reply to Florian Fainelli

The downstream implementation of ahci_brcm.c did contain clock management recovery, but until recently, did that outside of the libahci_platform helpers and this was unintentionally stripped out while forward porting the patch upstream.

Add the missing clock management during recovery and sleep for 10 milliseconds per the design team recommendations to ensure the SATA PHY controller and AFE have been fully quiesced.

Fixes eb73390ae241 ("ata: ahci_brcm: Recover from failures to identify devices")
---
 drivers/ata/ahci_brcm.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/ata/ahci_brcm.c +7 -0
index 58f8fd7bb8b8..66a570d0da83 100644
@@ -274,6 +274,13 @@ static unsigned int brcm_ahci_read_id(struct ata_device *dev,
 	/* Perform the SATA PHY reset sequence */
 	brcm_sata_phy_disable(priv, ap->port_no);
 
+	/* Reset the SATA clock */
+	ahci_platform_disable_clks(hpriv);
+	msleep(10);
+
+	ahci_platform_enable_clks(hpriv);
+	msleep(10);
+
 	/* Bring the PHY back on */
 	brcm_sata_phy_enable(priv, ap->port_no);
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/8 ata: ahci_brcm: Manage reset line during suspend/resume

In reply to Florian Fainelli

We were not managing the reset line during suspend/resume, but this needs to be done to ensure that the controller can exit low power modes correctly, especially with deep sleep suspend mode that may reset parts of the logic.

---
 drivers/ata/ahci_brcm.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/ata/ahci_brcm.c +13 -2
index 66a570d0da83..76612577a59a 100644
@@ -343,10 +343,16 @@ static int brcm_ahci_suspend(struct device *dev)
 	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
 	struct brcm_ahci_priv *priv = hpriv->plat_data;
+	int ret;
 
 	brcm_sata_phys_disable(priv);
 
-	return ahci_platform_suspend(dev);
+	ret = ahci_platform_suspend(dev);
+
+	if (!IS_ERR_OR_NULL(priv->rcdev))
+		reset_control_assert(priv->rcdev);
+
+	return ret;
 }
 
 static int brcm_ahci_resume(struct device *dev)
@@ -354,7 +360,12 @@ static int brcm_ahci_resume(struct device *dev)
 	struct ata_host *host = dev_get_drvdata(dev);
 	struct ahci_host_priv *hpriv = host->private_data;
 	struct brcm_ahci_priv *priv = hpriv->plat_data;
-	int ret;
+	int ret = 0;
+
+	if (!IS_ERR_OR_NULL(priv->rcdev))
+		ret = reset_control_deassert(priv->rcdev);
+	if (ret)
+		return ret;
 
 	/* Make sure clocks are turned on before re-configuration */
 	ret = ahci_platform_enable_clks(hpriv);
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/8 ata: ahci_brcm: Add a shutdown callback

In reply to Florian Fainelli

Make sure that we quiesce the controller and shut down the clocks in a shutdown callback.

---
 drivers/ata/ahci_brcm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/ata/ahci_brcm.c +15 -0
index 76612577a59a..58e1a6e5478d 100644
@@ -532,11 +532,26 @@ static int brcm_ahci_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void brcm_ahci_shutdown(struct platform_device *pdev)
+{
+	int ret;
+
+	/* All resources releasing happens via devres, but our device, unlike a
+	 * proper remove is not disappearing, therefore using
+	 * brcm_ahci_suspend() here which does explicit power management is
+	 * appropriate.
+	 */
+	ret = brcm_ahci_suspend(&pdev->dev);
+	if (ret)
+		dev_err(&pdev->dev, "failed to shutdown\n");
+}
+
 static SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume);
 
 static struct platform_driver brcm_ahci_driver = {
 	.probe = brcm_ahci_probe,
 	.remove = brcm_ahci_remove,
+	.shutdown = brcm_ahci_shutdown,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_of_match,
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/8 dt-bindings: ata: Document BCM7216 AHCI controller compatible

In reply to Florian Fainelli

The BCM7216 AHCI controller makes use of a specific reset controller line/name, document the compatible string and the optional reset properties.

---
 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt +7 -0
index 7713a413c6a7..b9ae4ce4a0a0 100644
@@ -5,6 +5,7 @@ Each SATA controller should have its own node.
 
 Required properties:
 - compatible         : should be one or more of
+			"brcm,bcm7216-ahci"
 			"brcm,bcm7425-ahci"
 			"brcm,bcm7445-ahci"
 			"brcm,bcm-nsp-ahci"
@@ -14,6 +15,12 @@ Required properties:
 - reg-names          : "ahci" and "top-ctrl"
 - interrupts         : interrupt mapping for SATA IRQ
 
+Optional properties:
+
+- reset: for "brcm,bcm7216-ahci" must be a valid reset phandle
+  pointing to the RESCAL reset controller provider node.
+- reset-names: for "brcm,bcm7216-ahci", must be "rescal".
+
 Also see ahci-platform.txt.
 
 Example:
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 7/8
#8 lore raw

Re: [PATCH 7/8] dt-bindings: ata: Document BCM7216 AHCI controller compatible

Quoted 9 lines · Florian Fainelli

The BCM7216 AHCI controller makes use of a specific reset controller line/name, document the compatible string and the optional reset properties.

---
 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt | 7 +++++++
 1 file changed, 7 insertions(+)
#9 lore raw

PATCH 8/8 ata: ahci_brcm: Support BCM7216 reset controller name

In reply to Florian Fainelli

BCM7216 uses a different reset controller name which is "rescal" instead of "ahci", match the compatible string to account for that minor difference, the reset is otherwise identical to how other generations of SATA controllers work.

---
 drivers/ata/ahci_brcm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/ata/ahci_brcm.c +10 -2
index 58e1a6e5478d..13ceca687104 100644
@@ -73,6 +73,7 @@ enum brcm_ahci_version {
 	BRCM_SATA_BCM7425 = 1,
 	BRCM_SATA_BCM7445,
 	BRCM_SATA_NSP,
+	BRCM_SATA_BCM7216,
 };
 
 enum brcm_ahci_quirks {
@@ -415,6 +416,7 @@ static const struct of_device_id ahci_of_match[] = {
 	{.compatible = "brcm,bcm7445-ahci", .data = (void *)BRCM_SATA_BCM7445},
 	{.compatible = "brcm,bcm63138-ahci", .data = (void *)BRCM_SATA_BCM7445},
 	{.compatible = "brcm,bcm-nsp-ahci", .data = (void *)BRCM_SATA_NSP},
+	{.compatible = "brcm,bcm7216-ahci", .data = (void *)BRCM_SATA_BCM7216},
 	{},
 };
 MODULE_DEVICE_TABLE(of, ahci_of_match);
@@ -423,6 +425,7 @@ 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;
@@ -444,8 +447,13 @@ 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 */
-	priv->rcdev = devm_reset_control_get(&pdev->dev, "ahci");
+	/* 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(&pdev->dev, reset_name);
 	if (!IS_ERR_OR_NULL(priv->rcdev))
 		reset_control_deassert(priv->rcdev);
 
Signature · 1 line
2.17.1
Reviewed-by on the v1 series
#10 lore raw
In reply to Florian Fainelli

Hi,

Quoted 6 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Quoted 6 lines

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Thanks!

The entire series looks good to me:

Regards,

Hans

Quoted 17 lines

Florian Fainelli (8):
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
ata: ahci_brcm: Fix AHCI resources management
ata: ahci_brcm: BCM7425 AHCI requires AHCI_HFLAG_DELAY_ENGINE
ata: ahci_brcm: Add missing clock management during recovery
ata: ahci_brcm: Manage reset line during suspend/resume
ata: ahci_brcm: Add a shutdown callback
dt-bindings: ata: Document BCM7216 AHCI controller compatible
ata: ahci_brcm: Support BCM7216 reset controller name

  .../bindings/ata/brcm,sata-brcm.txt           |   7 +
  drivers/ata/ahci_brcm.c                       | 167 ++++++++++++++----
  drivers/ata/libahci_platform.c                |   6 +-
  include/linux/ahci_platform.h                 |   2 +
  4 files changed, 141 insertions(+), 41 deletions(-)
#11 lore raw
Quoted 14 lines · Hans de Goede

Hi,

Quoted 11 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Quoted 7 lines
Quoted 1 line

Thanks!

The entire series looks good to me:

Regards,

Thanks Hans, Jens is this good to go from your perspective? --
Florian

#12 lore raw
Quoted 19 lines · Florian Fainelli
Quoted 16 lines · Hans de Goede

Hi,

Quoted 12 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Thanks!

Quoted 7 lines
Quoted 5 lines

The entire series looks good to me:

Regards,

Thanks Hans, Jens is this good to go from your perspective?

I'll queue 1-4 up for 5.5 and mark for stable, then add 5-8 for 5.6. Thanks!

Signature · 1 line
Jens Axboe
#13 lore raw
Quoted 22 lines · Jens Axboe
Quoted 21 lines · Florian Fainelli
Quoted 18 lines · Hans de Goede

Hi,

Quoted 6 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Quoted 6 lines

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Thanks!

The entire series looks good to me:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Regards,

Thanks Hans, Jens is this good to go from your perspective?

I'll queue 1-4 up for 5.5 and mark for stable, then add 5-8 for 5.6. Thanks!

It looks like I will have two incremental changes on top to minimize the number of resources that get cycled through during EPROBE_DEFER and also ensure that the 7216 reset line gets properly managed with a call to reset_control_reset() per review feedback from the reset controller maintainer.

Signature · 1 line
Florian
#14 lore raw
In reply to Florian Fainelli
Quoted 10 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Quoted 7 lines

Please let me know if you have any comments.

Thanks!

Florian Fainelli (8):
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
ata: ahci_brcm: Fix AHCI resources management

Following error on stable-rc 4.14 and 4.9 branch for arm build.

drivers/ata/ahci_brcm.c: In function 'brcm_ahci_probe':
drivers/ata/ahci_brcm.c:412:28: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
if (!IS_ERR_OR_NULL(priv->rcdev))

                             ^~~~~
                             dev

CC fs/pnode.o
CC block/genhd.o
drivers/ata/ahci_brcm.c:413:3: error: implicit declaration of
function 'reset_control_assert'; did you mean 'ahci_reset_controller'? [-Werror=implicit-function-declaration]

    reset_control_assert(priv->rcdev);
    ^~~~~~~~~~~~~~~~~~~~
    ahci_reset_controller
 drivers/ata/ahci_brcm.c:413:30: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
    reset_control_assert(priv->rcdev);
                               ^~~~~
                               dev

cc1: some warnings being treated as errors

Full build log links,
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.14/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/702/consoleText
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.9/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/773/consoleText

Signature · 2 lines
Linaro LKFT
https://lkft.linaro.org
#15 lore raw
Quoted 14 lines · Naresh Kamboju
Quoted 12 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Quoted 7 lines
Quoted 5 lines

Thanks!

Florian Fainelli (8):
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
ata: ahci_brcm: Fix AHCI resources management

Following error on stable-rc 4.14 and 4.9 branch for arm build.

Following error on stable-rc 4.19, 4.14 and 4.9 branch for arm build.

Quoted 20 lines

drivers/ata/ahci_brcm.c: In function 'brcm_ahci_probe':
drivers/ata/ahci_brcm.c:412:28: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
if (!IS_ERR_OR_NULL(priv->rcdev))

                             ^~~~~
                             dev

CC fs/pnode.o
CC block/genhd.o
drivers/ata/ahci_brcm.c:413:3: error: implicit declaration of
function 'reset_control_assert'; did you mean 'ahci_reset_controller'? [-Werror=implicit-function-declaration]

    reset_control_assert(priv->rcdev);
    ^~~~~~~~~~~~~~~~~~~~
    ahci_reset_controller
 drivers/ata/ahci_brcm.c:413:30: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
    reset_control_assert(priv->rcdev);
                               ^~~~~
                               dev
Quoted 5 lines

cc1: some warnings being treated as errors

Full build log links,
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.14/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/702/consoleText
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.9/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/773/consoleText

https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.19/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/404/consoleText

Quoted 5 lines

--
Linaro LKFT
https://lkft.linaro.org

#16 lore raw
Quoted 47 lines · Naresh Kamboju
Quoted 14 lines · Naresh Kamboju
Quoted 12 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Quoted 7 lines
Quoted 5 lines

Thanks!

Florian Fainelli (8):
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
ata: ahci_brcm: Fix AHCI resources management

Following error on stable-rc 4.14 and 4.9 branch for arm build.

Following error on stable-rc 4.19, 4.14 and 4.9 branch for arm build.

Quoted 22 lines

drivers/ata/ahci_brcm.c: In function 'brcm_ahci_probe':
drivers/ata/ahci_brcm.c:412:28: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
if (!IS_ERR_OR_NULL(priv->rcdev))

                             ^~~~~
                             dev

CC fs/pnode.o
CC block/genhd.o
drivers/ata/ahci_brcm.c:413:3: error: implicit declaration of
function 'reset_control_assert'; did you mean 'ahci_reset_controller'? [-Werror=implicit-function-declaration]

    reset_control_assert(priv->rcdev);
    ^~~~~~~~~~~~~~~~~~~~
    ahci_reset_controller
 drivers/ata/ahci_brcm.c:413:30: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
    reset_control_assert(priv->rcdev);
                               ^~~~~
                               dev

cc1: some warnings being treated as errors

Quoted 4 lines
Quoted 3 lines

Full build log links,
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.14/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/702/consoleText
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.9/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/773/consoleText

https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.19/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/404/consoleText

The reset controller support was added in 2b2c47d9e1fe90311b725125d6252a859ee87a79 ("ata: ahci_brcm: Allow optional reset controller to be used") which was include in v4.20 and newer so that explains the build failure.

You may want to cherry pick that change into the respective stable branches and then back port the fixes if that is not too much trouble. If that does not work or is impractical, please let me know and I can provide directed backport changes for 4.9, 4.14 and 4.19.

Thank you

Signature · 1 line
Florian
#17 lore raw
Quoted 58 lines · Florian Fainelli
Quoted 47 lines · Naresh Kamboju
Quoted 14 lines · Naresh Kamboju
Quoted 12 lines · Florian Fainelli

Hi Jens,

The first 4 patches are fixes and should ideally be queued up/picked up by stable. The last 4 patches add support for BCM7216 which is one of our latest devices supported by this driver.

Patch #2 does a few things, but it was pretty badly broken before and it is hard not to fix all call sites (probe, suspend, resume) in one shot.

Please let me know if you have any comments.

Quoted 7 lines
Quoted 5 lines

Thanks!

Florian Fainelli (8):
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
ata: ahci_brcm: Fix AHCI resources management

Following error on stable-rc 4.14 and 4.9 branch for arm build.

Following error on stable-rc 4.19, 4.14 and 4.9 branch for arm build.

Quoted 22 lines

drivers/ata/ahci_brcm.c: In function 'brcm_ahci_probe':
drivers/ata/ahci_brcm.c:412:28: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
if (!IS_ERR_OR_NULL(priv->rcdev))

                             ^~~~~
                             dev

CC fs/pnode.o
CC block/genhd.o
drivers/ata/ahci_brcm.c:413:3: error: implicit declaration of
function 'reset_control_assert'; did you mean 'ahci_reset_controller'? [-Werror=implicit-function-declaration]

    reset_control_assert(priv->rcdev);
    ^~~~~~~~~~~~~~~~~~~~
    ahci_reset_controller
 drivers/ata/ahci_brcm.c:413:30: error: 'struct brcm_ahci_priv' has no
member named 'rcdev'; did you mean 'dev'?
    reset_control_assert(priv->rcdev);
                               ^~~~~
                               dev

cc1: some warnings being treated as errors

Quoted 4 lines
Quoted 3 lines

Full build log links,
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.14/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/702/consoleText
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.9/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/773/consoleText

https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.19/DISTRO=lkft,MACHINE=am57xx-evm,label=docker-lkft/404/consoleText

The reset controller support was added in 2b2c47d9e1fe90311b725125d6252a859ee87a79 ("ata: ahci_brcm: Allow optional reset controller to be used") which was include in v4.20 and newer so that explains the build failure.

Quoted 4 lines

You may want to cherry pick that change into the respective stable branches and then back port the fixes if that is not too much trouble. If that does not work or is impractical, please let me know and I can provide directed backport changes for 4.9, 4.14 and 4.19.

No need, I'll just queue up the other needed patch now, thanks.

greg k-h