Skip to contentSkip to conversation

ata: ahci_brcm: Add back regulators management

PATCH Superseded Florian Fainelli 1 participant 3 messages Dec 23, 2020 – Jan 21, 2021 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ata: ahci_brcm: Add back regulators management

While reworking the resources management and departing from using ahci_platform_enable_resources() which did not allow a proper step separation like we need, we unfortunately lost the ability to control AHCI regulators. This broke some Broadcom STB systems that do expect regulators to be turned on to link up with attached hard drives.

Fixes c0cdf2ac4b5b ("ata: ahci_brcm: Fix AHCI resources management")

---
Jens,

This is based on your for-next branch, let me know if you need me to rebase to a different branch. Thanks!

 drivers/ata/ahci_brcm.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/ata/ahci_brcm.c +13 -1
index 49f7acbfcf01..5b32df5d33ad 100644
@@ -377,6 +377,10 @@ static int __maybe_unused brcm_ahci_resume(struct device *dev)
 	if (ret)
 		return ret;
 
+	ret = ahci_platform_enable_regulators(hpriv);
+	if (ret)
+		goto out_disable_clks;
+
 	brcm_sata_init(priv);
 	brcm_sata_phys_enable(priv);
 	brcm_sata_alpm_init(hpriv);
@@ -406,6 +410,8 @@ static int __maybe_unused brcm_ahci_resume(struct device *dev)
 	ahci_platform_disable_phys(hpriv);
 out_disable_phys:
 	brcm_sata_phys_disable(priv);
+	ahci_platform_disable_regulators(hpriv);
+out_disable_clks:
 	ahci_platform_disable_clks(hpriv);
 	return ret;
 }
@@ -490,6 +496,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_reset;
 
+	ret = ahci_platform_enable_regulators(hpriv);
+	if (ret)
+		goto out_disable_clks;
+
 	/* Must be first so as to configure endianness including that
 	 * of the standard AHCI register space.
 	 */
@@ -499,7 +509,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	priv->port_mask = brcm_ahci_get_portmask(hpriv, priv);
 	if (!priv->port_mask) {
 		ret = -ENODEV;
-		goto out_disable_clks;
+		goto out_disable_regulators;
 	}
 
 	/* Must be done before ahci_platform_enable_phys() */
@@ -524,6 +534,8 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	ahci_platform_disable_phys(hpriv);
 out_disable_phys:
 	brcm_sata_phys_disable(priv);
+out_disable_regulators:
+	ahci_platform_disable_regulators(hpriv);
 out_disable_clks:
 	ahci_platform_disable_clks(hpriv);
 out_reset:
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Florian Fainelli

While reworking the resources management and departing from using ahci_platform_enable_resources() which did not allow a proper step separation like we need, we unfortunately lost the ability to control AHCI regulators. This broke some Broadcom STB systems that do expect regulators to be turned on to link up with attached hard drives.

Quoted 7 lines
Fixes c0cdf2ac4b5b ("ata: ahci_brcm: Fix AHCI resources management")

---
Jens,

This is based on your for-next branch, let me know if you need me to rebase to a different branch. Thanks!

Jens, this is a bug fix so it would be nice to get this applied at some point. Thank you

Signature · 1 line
Florian
#2 lore raw
Quoted 12 lines · Florian Fainelli
Quoted 11 lines · Florian Fainelli

While reworking the resources management and departing from using ahci_platform_enable_resources() which did not allow a proper step separation like we need, we unfortunately lost the ability to control AHCI regulators. This broke some Broadcom STB systems that do expect regulators to be turned on to link up with attached hard drives.

Fixes c0cdf2ac4b5b ("ata: ahci_brcm: Fix AHCI resources management")

---
Jens,

Quoted 4 lines
Quoted 2 lines

This is based on your for-next branch, let me know if you need me to rebase to a different branch. Thanks!

Jens, this is a bug fix so it would be nice to get this applied at some> point. Thank you

Jens, can you apply this patch or let me know if you need me to change something? Thanks

Signature · 1 line
Florian