--- /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"
+@@ -87,6 +88,7 @@ struct brcm_ahci_priv {
+ u32 port_mask;
+ u32 quirks;
+ enum brcm_ahci_version version;
++ struct reset_control *rcdev;
+ };
+
+ static const struct ata_port_info ahci_brcm_port_info = {
+@@ -327,6 +329,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
-@@ -221,19 +221,12 @@ static void brcm_sata_phys_disable(struc
+@@ -223,19 +223,12 @@ static void brcm_sata_phys_disable(struc
brcm_sata_phy_disable(priv, i);
}
if (fls(impl) > SATA_TOP_MAX_PHYS)
dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n",
-@@ -241,9 +234,6 @@ static u32 brcm_ahci_get_portmask(struct
+@@ -243,9 +236,6 @@ static u32 brcm_ahci_get_portmask(struct
else if (!impl)
dev_info(priv->dev, "no ports found\n");
return impl;
}
-@@ -270,11 +260,10 @@ static int brcm_ahci_suspend(struct devi
+@@ -272,11 +262,10 @@ static int brcm_ahci_suspend(struct devi
struct ata_host *host = dev_get_drvdata(dev);
struct ahci_host_priv *hpriv = host->private_data;
struct brcm_ahci_priv *priv = hpriv->plat_data;
}
static int brcm_ahci_resume(struct device *dev)
-@@ -282,11 +271,44 @@ static int brcm_ahci_resume(struct devic
+@@ -284,11 +273,44 @@ static int brcm_ahci_resume(struct devic
struct ata_host *host = dev_get_drvdata(dev);
struct ahci_host_priv *hpriv = host->private_data;
struct brcm_ahci_priv *priv = hpriv->plat_data;
}
#endif
-@@ -333,38 +355,63 @@ static int brcm_ahci_probe(struct platfo
+@@ -340,38 +362,63 @@ static int brcm_ahci_probe(struct platfo
priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE;
}
}
static int brcm_ahci_remove(struct platform_device *pdev)
-@@ -374,12 +421,12 @@ static int brcm_ahci_remove(struct platf
+@@ -381,12 +428,12 @@ static int brcm_ahci_remove(struct platf
struct brcm_ahci_priv *priv = hpriv->plat_data;
int ret;
compat_ioctl-block-handle-persistent-reservations.patch
compat_ioctl-block-handle-blkreportzone-blkresetzone.patch
ata-libahci_platform-export-again-ahci_platform_-en-dis-able_phys.patch
+ata-ahci_brcm-allow-optional-reset-controller-to-be-used.patch
ata-ahci_brcm-fix-ahci-resources-management.patch
gpiolib-fix-up-emulated-open-drain-outputs.patch
tracing-fix-lock-inversion-in-trace_event_enable_tgid_record.patch