From: Jaedon Shin <jaedon.shin@gmail.com>
To: Tejun Heo <tj@kernel.org>, Kishon Vijay Abraham I <kishon@ti.com>,
Rob Herring <robh+dt@kernel.org>,
Brian Norris <computersforpeace@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
linux-ide@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>,
Dragan Stancevic <dragan.stancevic@gmail.com>,
Jaedon Shin <jaedon.shin@gmail.com>
Subject: [v5 2/7] ata: ahci_brcmstb: add quirk for broken ncq
Date: Thu, 19 Nov 2015 11:41:14 +0900 [thread overview]
Message-ID: <1447900879-1549-3-git-send-email-jaedon.shin@gmail.com> (raw)
In-Reply-To: <1447900879-1549-1-git-send-email-jaedon.shin@gmail.com>
Add quirk for broken ncq. Some chipsets (eg. BCM7349A0, BCM7445A0,
BCM7445B0, and all 40nm chipsets including BCM7425) need a workaround
disabling NCQ.
Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/ahci_brcmstb.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c
index 73e3b0b2a3c2..3bf1cf6259d7 100644
--- a/drivers/ata/ahci_brcmstb.c
+++ b/drivers/ata/ahci_brcmstb.c
@@ -69,10 +69,15 @@
(DATA_ENDIAN << DMADESC_ENDIAN_SHIFT) | \
(MMIO_ENDIAN << MMIO_ENDIAN_SHIFT))
+enum brcm_ahci_quirks {
+ BRCM_AHCI_QUIRK_NONCQ = BIT(0),
+};
+
struct brcm_ahci_priv {
struct device *dev;
void __iomem *top_ctrl;
u32 port_mask;
+ u32 quirks;
};
static const struct ata_port_info ahci_brcm_port_info = {
@@ -202,6 +207,42 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev,
return impl;
}
+static void brcm_sata_quirks(struct platform_device *pdev,
+ struct brcm_ahci_priv *priv)
+{
+ if (priv->quirks & BRCM_AHCI_QUIRK_NONCQ) {
+ void __iomem *ctrl = priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL;
+ void __iomem *ahci;
+ struct resource *res;
+ u32 reg;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "ahci");
+ ahci = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(ahci))
+ return;
+
+ reg = brcm_sata_readreg(ctrl);
+ reg |= OVERRIDE_HWINIT;
+ brcm_sata_writereg(reg, ctrl);
+
+ /* Clear out the NCQ bit so the AHCI driver will not issue
+ * FPDMA/NCQ commands.
+ */
+ reg = brcm_sata_readreg(ahci + HOST_CAP);
+ reg &= ~HOST_CAP_NCQ;
+ brcm_sata_writereg(reg, ahci + HOST_CAP);
+
+ reg = brcm_sata_readreg(ctrl);
+ reg &= ~OVERRIDE_HWINIT;
+ brcm_sata_writereg(reg, ctrl);
+
+ devm_iounmap(&pdev->dev, ahci);
+ devm_release_mem_region(&pdev->dev, res->start,
+ resource_size(res));
+ }
+}
+
static void brcm_sata_init(struct brcm_ahci_priv *priv)
{
/* Configure endianness */
@@ -256,6 +297,11 @@ static int brcm_ahci_probe(struct platform_device *pdev)
if (IS_ERR(priv->top_ctrl))
return PTR_ERR(priv->top_ctrl);
+ if (of_device_is_compatible(dev->of_node, "brcm,bcm7425-ahci"))
+ priv->quirks |= BRCM_AHCI_QUIRK_NONCQ;
+
+ brcm_sata_quirks(pdev, priv);
+
brcm_sata_init(priv);
priv->port_mask = brcm_ahci_get_portmask(pdev, priv);
--
2.6.3
next prev parent reply other threads:[~2015-11-19 2:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 2:41 [v5 0/7] add support SATA for BMIPS_GENERIC Jaedon Shin
2015-11-19 2:41 ` [v5 1/7] ata: ahci_brcmstb: add support MIPS-based platforms Jaedon Shin
2015-11-19 2:41 ` Jaedon Shin [this message]
2015-11-19 18:44 ` [v5 2/7] ata: ahci_brcmstb: add quirk for broken ncq Brian Norris
2015-11-19 2:41 ` [v5 3/7] ata: ahci_brcmstb: add quirk for different phy Jaedon Shin
2015-11-19 2:41 ` [v5 4/7] ata: ahci_brcmstb: remove unused definitions Jaedon Shin
2015-11-19 2:41 ` [v5 5/7] phy: phy_brcmstb_sata: remove duplicate definitions Jaedon Shin
2015-11-19 2:41 ` [v5 6/7] phy: phy_brcmstb_sata: add data for phy version Jaedon Shin
2015-11-19 2:41 ` [v5 7/7] phy: phy_brcmstb_sata: add support MIPS-based platforms Jaedon Shin
2015-11-19 13:49 ` Kishon Vijay Abraham I
2015-11-24 23:51 ` [v5 0/7] add support SATA for BMIPS_GENERIC Florian Fainelli
2015-11-25 9:30 ` Jaedon Shin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447900879-1549-3-git-send-email-jaedon.shin@gmail.com \
--to=jaedon.shin@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dragan.stancevic@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=kishon@ti.com \
--cc=linux-ide@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=robh+dt@kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox