* [PATCH v3 0/2] ahci: add support for hisilicon sata
@ 2014-04-21 4:01 Kefeng Wang
2014-04-21 4:01 ` [PATCH v3 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
2014-04-21 4:01 ` [PATCH v3 2/2] ahci: add support for Hisilicon sata Kefeng Wang
0 siblings, 2 replies; 5+ messages in thread
From: Kefeng Wang @ 2014-04-21 4:01 UTC (permalink / raw)
To: Tejun Heo; +Cc: Hans de Goede, linux-ide, linux-kernel, wangkefeng.wang
changes in v3:
1) move NO_FBS chunk after YES_FBS, Tejun's suggestion
2) use ata_port_info pointer to avoid struct ata_port_info
on the stack twice
changes in v2:
1) make code more concise according to Hans's advice
Kefeng Wang (2):
ata: ahci: append new hflag AHCI_HFLAG_NO_FBS
ahci: add support for Hisilicon sata
.../devicetree/bindings/ata/ahci-platform.txt | 3 ++-
drivers/ata/ahci.h | 1 +
drivers/ata/ahci_platform.c | 10 ++++++++--
drivers/ata/libahci.c | 5 +++++
4 files changed, 16 insertions(+), 3 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS
2014-04-21 4:01 [PATCH v3 0/2] ahci: add support for hisilicon sata Kefeng Wang
@ 2014-04-21 4:01 ` Kefeng Wang
2014-04-21 4:01 ` [PATCH v3 2/2] ahci: add support for Hisilicon sata Kefeng Wang
1 sibling, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2014-04-21 4:01 UTC (permalink / raw)
To: Tejun Heo
Cc: Hans de Goede, linux-ide, linux-kernel, wangkefeng.wang,
Haojian Zhuang
Append AHCI_HFLAG_NO_FBS to force turning off FBS flag.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
---
drivers/ata/ahci.h | 1 +
drivers/ata/libahci.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 51af275..60db49b 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -235,6 +235,7 @@ enum {
port start (wait until
error-handling stage) */
AHCI_HFLAG_MULTI_MSI = (1 << 16), /* multiple PCI MSIs */
+ AHCI_HFLAG_NO_FBS = (1 << 17), /* no FBS */
/* ap->flags bits */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 6bd4f66..e1cf859 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -457,6 +457,11 @@ void ahci_save_initial_config(struct device *dev,
cap |= HOST_CAP_FBS;
}
+ if ((cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_NO_FBS)) {
+ dev_info(dev, "controller can't do FBS, turning off CAP_FBS\n");
+ cap &= ~HOST_CAP_FBS;
+ }
+
if (force_port_map && port_map != force_port_map) {
dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
port_map, force_port_map);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] ahci: add support for Hisilicon sata
2014-04-21 4:01 [PATCH v3 0/2] ahci: add support for hisilicon sata Kefeng Wang
2014-04-21 4:01 ` [PATCH v3 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
@ 2014-04-21 4:01 ` Kefeng Wang
2014-04-21 4:13 ` kefeng.wang
1 sibling, 1 reply; 5+ messages in thread
From: Kefeng Wang @ 2014-04-21 4:01 UTC (permalink / raw)
To: Tejun Heo; +Cc: Hans de Goede, linux-ide, linux-kernel, wangkefeng.wang
The hip04 SoC of hisilicon has an AHCI compliant SATA controller,
and it is compliant with the ahci 1.3 and sata 3.0 specification.
There is a wrong bit in HOST_CAP of hip04 sata controller, which
enable unsupported feature of FBS, use AHCI_HFLAG_NO_FBS hflag to
disable it.
Cc: Hans de Geode <hdegoede@redhat.com>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
---
.../devicetree/bindings/ata/ahci-platform.txt | 3 ++-
drivers/ata/ahci_platform.c | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
index 48b285f..aab1d70 100644
--- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
@@ -7,7 +7,8 @@ Required properties:
- compatible : compatible list, one of "snps,spear-ahci",
"snps,exynos5440-ahci", "ibm,476gtr-ahci",
"allwinner,sun4i-a10-ahci", "fsl,imx53-ahci"
- "fsl,imx6q-ahci" or "snps,dwc-ahci"
+ "fsl,imx6q-ahci", "snps,dwc-ahci" or
+ "hisilicon,hisi-ahci"
- interrupts : <interrupt mapping for SATA IRQ>
- reg : <registers mapping>
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index ef67e79..48b9feb 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -17,11 +17,12 @@
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/platform_device.h>
+#include <linux/of_device.h>
#include <linux/libata.h>
#include <linux/ahci_platform.h>
#include "ahci.h"
-static const struct ata_port_info ahci_port_info = {
+static struct ata_port_info ahci_port_info = {
.flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
@@ -32,6 +33,7 @@ static int ahci_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ahci_platform_data *pdata = dev_get_platdata(dev);
+ struct ata_port_info *pi = &ahci_port_info;
struct ahci_host_priv *hpriv;
int rc;
@@ -55,7 +57,10 @@ static int ahci_probe(struct platform_device *pdev)
goto disable_resources;
}
- rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0);
+ if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
+ pi->private_data = (void *)AHCI_HFLAG_NO_FBS;
+
+ rc = ahci_platform_init_host(pdev, hpriv, pi, 0, 0);
if (rc)
goto pdata_exit;
@@ -76,6 +81,7 @@ static const struct of_device_id ahci_of_match[] = {
{ .compatible = "snps,exynos5440-ahci", },
{ .compatible = "ibm,476gtr-ahci", },
{ .compatible = "snps,dwc-ahci", },
+ { .compatible = "hisilicon,hisi-ahci", },
{},
};
MODULE_DEVICE_TABLE(of, ahci_of_match);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] ahci: add support for Hisilicon sata
2014-04-21 4:01 ` [PATCH v3 2/2] ahci: add support for Hisilicon sata Kefeng Wang
@ 2014-04-21 4:13 ` kefeng.wang
2014-04-21 15:38 ` Hans de Goede
0 siblings, 1 reply; 5+ messages in thread
From: kefeng.wang @ 2014-04-21 4:13 UTC (permalink / raw)
To: Hans de Goede; +Cc: Kefeng Wang, Tejun Heo, linux-ide, linux-kernel
Hi Hans,
A hflags argument is useless in ahci_platform_init_host for another driver's caller,
use the pointer of ata_port_info in ahci_probe, is this OK?
Regards,
Kefeng
On 2014-4-21 12:01, Kefeng Wang wrote:
> The hip04 SoC of hisilicon has an AHCI compliant SATA controller,
> and it is compliant with the ahci 1.3 and sata 3.0 specification.
>
> There is a wrong bit in HOST_CAP of hip04 sata controller, which
> enable unsupported feature of FBS, use AHCI_HFLAG_NO_FBS hflag to
> disable it.
>
> Cc: Hans de Geode <hdegoede@redhat.com>
> Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
> ---
> .../devicetree/bindings/ata/ahci-platform.txt | 3 ++-
> drivers/ata/ahci_platform.c | 10 ++++++++--
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
> index 48b285f..aab1d70 100644
> --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
> +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
> @@ -7,7 +7,8 @@ Required properties:
> - compatible : compatible list, one of "snps,spear-ahci",
> "snps,exynos5440-ahci", "ibm,476gtr-ahci",
> "allwinner,sun4i-a10-ahci", "fsl,imx53-ahci"
> - "fsl,imx6q-ahci" or "snps,dwc-ahci"
> + "fsl,imx6q-ahci", "snps,dwc-ahci" or
> + "hisilicon,hisi-ahci"
> - interrupts : <interrupt mapping for SATA IRQ>
> - reg : <registers mapping>
>
> diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
> index ef67e79..48b9feb 100644
> --- a/drivers/ata/ahci_platform.c
> +++ b/drivers/ata/ahci_platform.c
> @@ -17,11 +17,12 @@
> #include <linux/pm.h>
> #include <linux/device.h>
> #include <linux/platform_device.h>
> +#include <linux/of_device.h>
> #include <linux/libata.h>
> #include <linux/ahci_platform.h>
> #include "ahci.h"
>
> -static const struct ata_port_info ahci_port_info = {
> +static struct ata_port_info ahci_port_info = {
> .flags = AHCI_FLAG_COMMON,
> .pio_mask = ATA_PIO4,
> .udma_mask = ATA_UDMA6,
> @@ -32,6 +33,7 @@ static int ahci_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct ahci_platform_data *pdata = dev_get_platdata(dev);
> + struct ata_port_info *pi = &ahci_port_info;
> struct ahci_host_priv *hpriv;
> int rc;
>
> @@ -55,7 +57,10 @@ static int ahci_probe(struct platform_device *pdev)
> goto disable_resources;
> }
>
> - rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0);
> + if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
> + pi->private_data = (void *)AHCI_HFLAG_NO_FBS;
> +
> + rc = ahci_platform_init_host(pdev, hpriv, pi, 0, 0);
> if (rc)
> goto pdata_exit;
>
> @@ -76,6 +81,7 @@ static const struct of_device_id ahci_of_match[] = {
> { .compatible = "snps,exynos5440-ahci", },
> { .compatible = "ibm,476gtr-ahci", },
> { .compatible = "snps,dwc-ahci", },
> + { .compatible = "hisilicon,hisi-ahci", },
> {},
> };
> MODULE_DEVICE_TABLE(of, ahci_of_match);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] ahci: add support for Hisilicon sata
2014-04-21 4:13 ` kefeng.wang
@ 2014-04-21 15:38 ` Hans de Goede
0 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2014-04-21 15:38 UTC (permalink / raw)
To: kefeng.wang; +Cc: Kefeng Wang, Tejun Heo, linux-ide, linux-kernel
Hi Kefeng,
On 04/21/2014 06:13 AM, kefeng.wang wrote:
> Hi Hans,
>
> A hflags argument is useless in ahci_platform_init_host for another driver's caller,
> use the pointer of ata_port_info in ahci_probe, is this OK?
Hmm, this can theoretically break when multiple platform ahci-s are present in a
single system. This likely will never happen, but I still think you should not
be changing a global struct which may be shared between multiple runs of the
probe method, that is just asking for trouble.
I know that other users of ahci_platform_init_host don't need a dynamic hflags
argument, but you can just remove the AHCI_HFLAGS(...) argument from their
ata_port_info - template and pass that in as the new arguments, this makes
ahci_platform_init_host more flexible which will hopefully also benefit us
in the future with other new ahci platform drivers.
Regards,
Hans
>
> Regards,
> Kefeng
>
> On 2014-4-21 12:01, Kefeng Wang wrote:
>> The hip04 SoC of hisilicon has an AHCI compliant SATA controller,
>> and it is compliant with the ahci 1.3 and sata 3.0 specification.
>>
>> There is a wrong bit in HOST_CAP of hip04 sata controller, which
>> enable unsupported feature of FBS, use AHCI_HFLAG_NO_FBS hflag to
>> disable it.
>>
>> Cc: Hans de Geode <hdegoede@redhat.com>
>> Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
>> ---
>> .../devicetree/bindings/ata/ahci-platform.txt | 3 ++-
>> drivers/ata/ahci_platform.c | 10 ++++++++--
>> 2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> index 48b285f..aab1d70 100644
>> --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> @@ -7,7 +7,8 @@ Required properties:
>> - compatible : compatible list, one of "snps,spear-ahci",
>> "snps,exynos5440-ahci", "ibm,476gtr-ahci",
>> "allwinner,sun4i-a10-ahci", "fsl,imx53-ahci"
>> - "fsl,imx6q-ahci" or "snps,dwc-ahci"
>> + "fsl,imx6q-ahci", "snps,dwc-ahci" or
>> + "hisilicon,hisi-ahci"
>> - interrupts : <interrupt mapping for SATA IRQ>
>> - reg : <registers mapping>
>>
>> diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
>> index ef67e79..48b9feb 100644
>> --- a/drivers/ata/ahci_platform.c
>> +++ b/drivers/ata/ahci_platform.c
>> @@ -17,11 +17,12 @@
>> #include <linux/pm.h>
>> #include <linux/device.h>
>> #include <linux/platform_device.h>
>> +#include <linux/of_device.h>
>> #include <linux/libata.h>
>> #include <linux/ahci_platform.h>
>> #include "ahci.h"
>>
>> -static const struct ata_port_info ahci_port_info = {
>> +static struct ata_port_info ahci_port_info = {
>> .flags = AHCI_FLAG_COMMON,
>> .pio_mask = ATA_PIO4,
>> .udma_mask = ATA_UDMA6,
>> @@ -32,6 +33,7 @@ static int ahci_probe(struct platform_device *pdev)
>> {
>> struct device *dev = &pdev->dev;
>> struct ahci_platform_data *pdata = dev_get_platdata(dev);
>> + struct ata_port_info *pi = &ahci_port_info;
>> struct ahci_host_priv *hpriv;
>> int rc;
>>
>> @@ -55,7 +57,10 @@ static int ahci_probe(struct platform_device *pdev)
>> goto disable_resources;
>> }
>>
>> - rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0);
>> + if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
>> + pi->private_data = (void *)AHCI_HFLAG_NO_FBS;
>> +
>> + rc = ahci_platform_init_host(pdev, hpriv, pi, 0, 0);
>> if (rc)
>> goto pdata_exit;
>>
>> @@ -76,6 +81,7 @@ static const struct of_device_id ahci_of_match[] = {
>> { .compatible = "snps,exynos5440-ahci", },
>> { .compatible = "ibm,476gtr-ahci", },
>> { .compatible = "snps,dwc-ahci", },
>> + { .compatible = "hisilicon,hisi-ahci", },
>> {},
>> };
>> MODULE_DEVICE_TABLE(of, ahci_of_match);
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-04-21 15:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-21 4:01 [PATCH v3 0/2] ahci: add support for hisilicon sata Kefeng Wang
2014-04-21 4:01 ` [PATCH v3 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
2014-04-21 4:01 ` [PATCH v3 2/2] ahci: add support for Hisilicon sata Kefeng Wang
2014-04-21 4:13 ` kefeng.wang
2014-04-21 15:38 ` Hans de Goede
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).