linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] ahci: support for hisilicon sata
@ 2014-04-10  5:24 Kefeng Wang
  2014-04-10  5:24 ` [PATCH V2 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
  2014-04-10  5:24 ` [PATCH V2 2/2] ahci: add support for Hisilicon sata Kefeng Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Kefeng Wang @ 2014-04-10  5:24 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Hans de Goede, linux-ide, linux-kernel, guohanjun, Kefeng Wang

From: Kefeng Wang <kefeng.wang@linaro.org>

changes in v2:

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                        |    6 +++++-
 drivers/ata/libahci.c                              |    5 +++++
 4 files changed, 13 insertions(+), 2 deletions(-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH V2 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS
  2014-04-10  5:24 [PATCH V2 0/2] ahci: support for hisilicon sata Kefeng Wang
@ 2014-04-10  5:24 ` Kefeng Wang
  2014-04-16 20:49   ` Tejun Heo
  2014-04-10  5:24 ` [PATCH V2 2/2] ahci: add support for Hisilicon sata Kefeng Wang
  1 sibling, 1 reply; 8+ messages in thread
From: Kefeng Wang @ 2014-04-10  5:24 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Hans de Goede, linux-ide, linux-kernel, guohanjun, Kefeng Wang,
	Haojian Zhuang

From: Kefeng Wang <kefeng.wang@linaro.org>

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(+), 0 deletions(-)

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..573edb3 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -452,6 +452,11 @@ void ahci_save_initial_config(struct device *dev,
 		cap &= ~HOST_CAP_SNTF;
 	}
 
+	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 (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) {
 		dev_info(dev, "controller can do FBS, turning on CAP_FBS\n");
 		cap |= HOST_CAP_FBS;
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH V2 2/2] ahci: add support for Hisilicon sata
  2014-04-10  5:24 [PATCH V2 0/2] ahci: support for hisilicon sata Kefeng Wang
  2014-04-10  5:24 ` [PATCH V2 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
@ 2014-04-10  5:24 ` Kefeng Wang
  2014-04-16 20:49   ` Tejun Heo
  1 sibling, 1 reply; 8+ messages in thread
From: Kefeng Wang @ 2014-04-10  5:24 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Hans de Goede, linux-ide, linux-kernel, guohanjun, Kefeng Wang

From: Kefeng Wang <kefeng.wang@linaro.org>

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                        |    6 +++++-
 2 files changed, 7 insertions(+), 2 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..2ee1923 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -32,6 +32,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;
 
@@ -54,8 +55,10 @@ static int ahci_probe(struct platform_device *pdev)
 		if (rc)
 			goto disable_resources;
 	}
+	if (of_device_is_compatible(pdev->dev.of_node, "hisilicon,hisi-ahci"))
+		pi.private_data = (void *)AHCI_HFLAG_NO_FBS;
 
-	rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0);
+	rc = ahci_platform_init_host(pdev, hpriv, &pi, 0, 0);
 	if (rc)
 		goto pdata_exit;
 
@@ -76,6 +79,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.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH V2 2/2] ahci: add support for Hisilicon sata
  2014-04-10  5:24 ` [PATCH V2 2/2] ahci: add support for Hisilicon sata Kefeng Wang
@ 2014-04-16 20:49   ` Tejun Heo
  2014-04-17  7:48     ` Hans de Goede
  0 siblings, 1 reply; 8+ messages in thread
From: Tejun Heo @ 2014-04-16 20:49 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Hans de Goede, linux-ide, linux-kernel, guohanjun, Kefeng Wang

Hello,

On Thu, Apr 10, 2014 at 01:24:28PM +0800, Kefeng Wang wrote:
> From: Kefeng Wang <kefeng.wang@linaro.org>
> 
> 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>
> @@ -54,8 +55,10 @@ static int ahci_probe(struct platform_device *pdev)
>  		if (rc)
>  			goto disable_resources;
>  	}
> +	if (of_device_is_compatible(pdev->dev.of_node, "hisilicon,hisi-ahci"))
> +		pi.private_data = (void *)AHCI_HFLAG_NO_FBS;

Hmmm.... this should work but looks a bit tedious and it could be
better to have a better mechanism to match devices to their
port_infos.  Hans, can you please comment?  If getting something more
structured is too much work, I can go with this but wanna find out
whether that's the case.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS
  2014-04-10  5:24 ` [PATCH V2 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
@ 2014-04-16 20:49   ` Tejun Heo
  0 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2014-04-16 20:49 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Hans de Goede, linux-ide, linux-kernel, guohanjun, Kefeng Wang,
	Haojian Zhuang

On Thu, Apr 10, 2014 at 01:24:27PM +0800, Kefeng Wang wrote:
> diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
> index 6bd4f66..573edb3 100644
> --- a/drivers/ata/libahci.c
> +++ b/drivers/ata/libahci.c
> @@ -452,6 +452,11 @@ void ahci_save_initial_config(struct device *dev,
>  		cap &= ~HOST_CAP_SNTF;
>  	}
>  
> +	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;
> +	}

Can you please put this chunk after YES_FBS?

>  	if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) {
>  		dev_info(dev, "controller can do FBS, turning on CAP_FBS\n");
>  		cap |= HOST_CAP_FBS;

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2 2/2] ahci: add support for Hisilicon sata
  2014-04-16 20:49   ` Tejun Heo
@ 2014-04-17  7:48     ` Hans de Goede
  2014-04-17 13:31       ` Tejun Heo
  0 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2014-04-17  7:48 UTC (permalink / raw)
  To: Tejun Heo, Kefeng Wang; +Cc: linux-ide, linux-kernel, guohanjun, Kefeng Wang

Hi,

On 04/16/2014 10:49 PM, Tejun Heo wrote:
> Hello,
> 
> On Thu, Apr 10, 2014 at 01:24:28PM +0800, Kefeng Wang wrote:
>> From: Kefeng Wang <kefeng.wang@linaro.org>
>>
>> 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>
>> @@ -54,8 +55,10 @@ static int ahci_probe(struct platform_device *pdev)
>>  		if (rc)
>>  			goto disable_resources;
>>  	}
>> +	if (of_device_is_compatible(pdev->dev.of_node, "hisilicon,hisi-ahci"))
>> +		pi.private_data = (void *)AHCI_HFLAG_NO_FBS;
> 
> Hmmm.... this should work but looks a bit tedious and it could be
> better to have a better mechanism to match devices to their
> port_infos.  Hans, can you please comment?  If getting something more
> structured is too much work, I can go with this but wanna find out
> whether that's the case.

The more structured solution would be v1 of this patch, which I asked
Kefan to change since it seemed overkill. But if you prefer that version
that is fine with me.

Note that as I've already mentioned earlier in the thread this could be
made somewhat cleaner by having an host_flags parameter to
ahci_platform_init_host().

Regards,

Hans

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2 2/2] ahci: add support for Hisilicon sata
  2014-04-17  7:48     ` Hans de Goede
@ 2014-04-17 13:31       ` Tejun Heo
  2014-04-18  1:07         ` Kefeng Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Tejun Heo @ 2014-04-17 13:31 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Kefeng Wang, linux-ide, linux-kernel, guohanjun, Kefeng Wang

On Thu, Apr 17, 2014 at 09:48:03AM +0200, Hans de Goede wrote:
> > Hmmm.... this should work but looks a bit tedious and it could be
> > better to have a better mechanism to match devices to their
> > port_infos.  Hans, can you please comment?  If getting something more
> > structured is too much work, I can go with this but wanna find out
> > whether that's the case.
> 
> The more structured solution would be v1 of this patch, which I asked
> Kefan to change since it seemed overkill. But if you prefer that version
> that is fine with me.

I don't care either way at this point but if this grows to a large
list, having a matching mechanism will probably be more manageable.

> Note that as I've already mentioned earlier in the thread this could be
> made somewhat cleaner by having an host_flags parameter to
> ahci_platform_init_host().

Kefeng, can you please update accordingly to Hans' comment and repost?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V2 2/2] ahci: add support for Hisilicon sata
  2014-04-17 13:31       ` Tejun Heo
@ 2014-04-18  1:07         ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2014-04-18  1:07 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Hans de Goede, linux-ide, linux-kernel, guohanjun, Kefeng Wang

On 04/17 21:31, Tejun Heo wrote:
> On Thu, Apr 17, 2014 at 09:48:03AM +0200, Hans de Goede wrote:
>>> Hmmm.... this should work but looks a bit tedious and it could be
>>> better to have a better mechanism to match devices to their
>>> port_infos.  Hans, can you please comment?  If getting something more
>>> structured is too much work, I can go with this but wanna find out
>>> whether that's the case.
>>
>> The more structured solution would be v1 of this patch, which I asked
>> Kefan to change since it seemed overkill. But if you prefer that version
>> that is fine with me.
> 
> I don't care either way at this point but if this grows to a large
> list, having a matching mechanism will probably be more manageable.
> 
>> Note that as I've already mentioned earlier in the thread this could be
>> made somewhat cleaner by having an host_flags parameter to
>> ahci_platform_init_host().
> 
> Kefeng, can you please update accordingly to Hans' comment and repost?

Sure, Thanks for the advice from you and Hans, will update.

> 
> Thanks.
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-18  1:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10  5:24 [PATCH V2 0/2] ahci: support for hisilicon sata Kefeng Wang
2014-04-10  5:24 ` [PATCH V2 1/2] ata: ahci: append new hflag AHCI_HFLAG_NO_FBS Kefeng Wang
2014-04-16 20:49   ` Tejun Heo
2014-04-10  5:24 ` [PATCH V2 2/2] ahci: add support for Hisilicon sata Kefeng Wang
2014-04-16 20:49   ` Tejun Heo
2014-04-17  7:48     ` Hans de Goede
2014-04-17 13:31       ` Tejun Heo
2014-04-18  1:07         ` Kefeng Wang

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).