--- /dev/null
+From 2b2c47d9e1fe90311b725125d6252a859ee87a79 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Mon, 1 Oct 2018 10:33:00 -0700
+Subject: ata: ahci_brcm: Allow optional reset controller to be used
+
+From: Florian Fainelli <f.fainelli@gmail.com>
+
+commit 2b2c47d9e1fe90311b725125d6252a859ee87a79 upstream.
+
+On BCM63138, we need to reset the AHCI core prior to start utilizing it,
+grab the reset controller device cookie and do that.
+
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci_brcm.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/ata/ahci_brcm.c
++++ b/drivers/ata/ahci_brcm.c
+@@ -25,6 +25,7 @@
+ #include <linux/module.h>
+ #include <linux/of.h>
+ #include <linux/platform_device.h>
++#include <linux/reset.h>
+ #include <linux/string.h>
+
+ #include "ahci.h"
+@@ -94,6 +95,7 @@ struct brcm_ahci_priv {
+ u32 port_mask;
+ u32 quirks;
+ enum brcm_ahci_version version;
++ struct reset_control *rcdev;
+ };
+
+ static inline u32 brcm_sata_readreg(void __iomem *addr)
+@@ -433,6 +435,11 @@ static int brcm_ahci_probe(struct platfo
+ 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");
++ 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;
--- a/drivers/ata/ahci_brcm.c
+++ b/drivers/ata/ahci_brcm.c
-@@ -84,8 +84,7 @@ enum brcm_ahci_version {
+@@ -85,8 +85,7 @@ enum brcm_ahci_version {
};
enum brcm_ahci_quirks {
};
struct brcm_ahci_priv {
-@@ -440,18 +439,27 @@ static int brcm_ahci_probe(struct platfo
- if (IS_ERR(priv->top_ctrl))
- return PTR_ERR(priv->top_ctrl);
+@@ -447,18 +446,27 @@ static int brcm_ahci_probe(struct platfo
+ if (!IS_ERR_OR_NULL(priv->rcdev))
+ reset_control_deassert(priv->rcdev);
- if ((priv->version == BRCM_SATA_BCM7425) ||
- (priv->version == BRCM_SATA_NSP)) {
ret = ahci_platform_enable_clks(hpriv);
if (ret)
goto out_reset;
-@@ -471,15 +479,8 @@ static int brcm_ahci_probe(struct platfo
+@@ -478,15 +486,8 @@ static int brcm_ahci_probe(struct platfo
/* Must be done before ahci_platform_enable_phys() */
brcm_sata_phys_enable(priv);
compat_ioctl-block-handle-blkreportzone-blkresetzone.patch
ata-libahci_platform-export-again-ahci_platform_-en-dis-able_phys.patch
ata-ahci_brcm-fix-ahci-resources-management.patch
+ata-ahci_brcm-allow-optional-reset-controller-to-be-used.patch
ata-ahci_brcm-add-missing-clock-management-during-recovery.patch
ata-ahci_brcm-bcm7425-ahci-requires-ahci_hflag_delay_engine.patch
libata-fix-retrieving-of-active-qcs.patch