From: Tejun Heo <tj@kernel.org>
To: Jaedon Shin <jaedon.shin@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Kishon Vijay Abraham I <kishon@ti.com>,
Ralf Baechle <ralf@linux-mips.org>,
Rob Herring <robh+dt@kernel.org>,
Kevin Cernekee <cernekee@gmail.com>,
Dragan Stancevic <dragan.stancevic@gmail.com>,
linux-ide@vger.kernel.org, Linux-MIPS <linux-mips@linux-mips.org>,
devicetree@vger.kernel.org
Subject: Re: [v4 02/10] ata: ahci_brcmstb: add quirk for broken ncq
Date: Tue, 17 Nov 2015 15:01:23 -0500 [thread overview]
Message-ID: <20151117200123.GD22864@mtj.duckdns.org> (raw)
In-Reply-To: <1446213684-2625-3-git-send-email-jaedon.shin@gmail.com>
Hello,
On Fri, Oct 30, 2015 at 11:01:16PM +0900, Jaedon Shin wrote:
> +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 = readl(ahci + HOST_CAP);
> + reg &= ~HOST_CAP_NCQ;
> + writel(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));
> + }
> +}
Does the controller actually need HOST_CAP_NCQ bit turned off to work
correctly? If the only thing necessary is the host not issuing NCQ
commands, setting AHCI_HFLAG_NO_NCQ should do.
> 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);
What's the point of "branch - set a bit - test the bit" sequence?
Just do
if (of_device_is_compatiable(...))
brcm_ahci_disable_ncq(...);
Thanks.
--
tejun
next prev parent reply other threads:[~2015-11-17 20:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 14:01 [v4 00/10] add support SATA for BMIPS_GENERIC Jaedon Shin
2015-10-30 14:01 ` [v4 01/10] ata: ahci_brcmstb: add support MIPS-based platforms Jaedon Shin
2015-10-30 14:01 ` [v4 02/10] ata: ahci_brcmstb: add quirk for broken ncq Jaedon Shin
2015-11-17 2:16 ` Brian Norris
2015-11-17 5:31 ` Jaedon Shin
2015-11-17 20:01 ` Tejun Heo [this message]
2015-10-30 14:01 ` [v4 05/10] phy: phy_brcmstb_sata: remove duplicate definitions Jaedon Shin
2015-10-30 14:01 ` [v4 06/10] phy: phy_brcmstb_sata: add data for phy version Jaedon Shin
2015-10-30 14:01 ` [v4 07/10] phy: phy_brcmstb_sata: add support MIPS-based platforms Jaedon Shin
2015-10-30 14:01 ` [v4 08/10] MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7425 Jaedon Shin
2015-10-30 14:01 ` [v4 09/10] MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7346 Jaedon Shin
2015-10-30 14:01 ` [v4 10/10] MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7362 Jaedon Shin
2015-11-13 20:27 ` [v4 00/10] add support SATA for BMIPS_GENERIC Florian Fainelli
2015-11-14 2:16 ` Jaedon Shin
[not found] ` <1446213684-2625-1-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-30 14:01 ` [v4 03/10] ata: ahci_brcmstb: add quirk for different phy Jaedon Shin
[not found] ` <1446213684-2625-4-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-11-17 20:06 ` Tejun Heo
2015-10-30 14:01 ` [v4 04/10] ata: ahci_brcmstb: remove unused definitions Jaedon Shin
2015-11-17 2:22 ` [v4 00/10] add support SATA for BMIPS_GENERIC Brian Norris
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=20151117200123.GD22864@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=cernekee@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dragan.stancevic@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=jaedon.shin@gmail.com \
--cc=kishon@ti.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).