All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhangfei <zhangfei.gao@linaro.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: "tj@kernel.org" <tj@kernel.org>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH RFC 1/2] libahci_platform: add ahci_platform_get_of_property
Date: Thu, 19 Jun 2014 10:22:08 +0800	[thread overview]
Message-ID: <53A24950.2020300@linaro.org> (raw)
In-Reply-To: <20140618140352.GD11895@leverpostej>

Hi Mark,

On 06/18/2014 10:03 PM, Mark Rutland wrote:
> On Wed, Jun 18, 2014 at 05:54:08AM +0100, Zhangfei Gao wrote:
>> Instead of setting hflags in different files,
>> ahci_platform_get_of_property set hpriv->flags when ahci_platform_init_host
>> according to property in dts.
>
> The AHCI_HFLAGS are a Linux implementation detail, so it would be nice
> to have a good justification for each of these being turned into DT
> properties.

Do you mean only add required property now?

Add ahci_platform_get_of_property is considering sharing 
drivers/ata/ahci_platform.c, refering sdhci_get_of_property in 
drivers/mmc/host/sdhci-pltfm.c.

The problem we met is different AHCI_HFLAGS required even in one soc 
series, for example, current version of "hisilicon,hisi-ahci" requires 
AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ, while next version solve the 
limitation, and no HFLAG required.
We may need different compatible, or it may simplier just state in dts.
What's more,  one common compatible can be used instead of adding 
specific compatible string.

>
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> ---
>>   .../devicetree/bindings/ata/ahci-platform.txt      |    9 +++++
>>   drivers/ata/libahci_platform.c                     |   39 ++++++++++++++++++++
>>   2 files changed, 48 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> index c96d8dcf98fd..c0b9f6e76ba4 100644
>> --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> @@ -26,6 +26,15 @@ Optional properties:
>>   - clocks            : must contain the sata, sata_ref and ahb clocks
>>   - clock-names       : must contain "ahb" for the ahb clock
>>
>> +- no-ncq: when present, controller can't do NCQ, turning off CAP_NCQ
>> +- 32bit-only: when present, controller can't do 64bit DMA, forcing 32bit
>> +- no-msi: when present, no PCI MSI
>> +- no-pmp: when present, controller can't do PMP, turning off CAP_PMP
>> +- yes-ncq: when present,controller can do NCQ, turning on CAP_NCQ
>> +- no-suspend: when present, controller can't do suspend
>> +- yes-fbs: when present, controller can do FBS, turning on CAP_FBS
>> +- no-fbs: when present, controller can't do FBS, turning off CAP_FBS
>
> There is absolutely no reason to mention CAP_* here; the DT should
> describe the HW, not Linux internals.
Yes, got it, will remove CAP*.

>
> Do these all make sense to be placed in DT?
Currently, "hisilicon,hisi-ahci" only need AHCI_HFLAG_NO_FBS | 
AHCI_HFLAG_NO_NCQ.
Just grep AHCI_HFLAG under ata.

>
> I worry that for other quirks we may need more flags in future. For that
> reason I'd rather figure this out in the driver based on the compatible
> string.
So do we just add no-ncq & no-fbs now?
>
>> +
>>   Examples:
>>           sata@ffe08000 {
>>   		compatible = "snps,spear-ahci";
>> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
>> index 3a5b4ed25a4f..880b9f360056 100644
>> --- a/drivers/ata/libahci_platform.c
>> +++ b/drivers/ata/libahci_platform.c
>> @@ -278,6 +278,44 @@ err_out:
>>   }
>>   EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
>>
>> +#ifdef CONFIG_OF
>> +static void ahci_platform_get_of_property(struct platform_device *pdev,
>> +					  struct ahci_host_priv *hpriv)
>> +{
>> +	struct device_node *np = pdev->dev.of_node;
>> +
>> +	if (of_device_is_available(np)) {
>> +		if (of_get_property(np, "no-ncq", NULL))
>> +			hpriv->flags |= AHCI_HFLAG_NO_NCQ;
>
> For boolean flags please use of_property_read_bool.
Yes, it's more accurate.

Thanks for advices.
>
> Mark.
>

WARNING: multiple messages have this Message-ID (diff)
From: zhangfei.gao@linaro.org (zhangfei)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 1/2] libahci_platform: add ahci_platform_get_of_property
Date: Thu, 19 Jun 2014 10:22:08 +0800	[thread overview]
Message-ID: <53A24950.2020300@linaro.org> (raw)
In-Reply-To: <20140618140352.GD11895@leverpostej>

Hi Mark,

On 06/18/2014 10:03 PM, Mark Rutland wrote:
> On Wed, Jun 18, 2014 at 05:54:08AM +0100, Zhangfei Gao wrote:
>> Instead of setting hflags in different files,
>> ahci_platform_get_of_property set hpriv->flags when ahci_platform_init_host
>> according to property in dts.
>
> The AHCI_HFLAGS are a Linux implementation detail, so it would be nice
> to have a good justification for each of these being turned into DT
> properties.

Do you mean only add required property now?

Add ahci_platform_get_of_property is considering sharing 
drivers/ata/ahci_platform.c, refering sdhci_get_of_property in 
drivers/mmc/host/sdhci-pltfm.c.

The problem we met is different AHCI_HFLAGS required even in one soc 
series, for example, current version of "hisilicon,hisi-ahci" requires 
AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ, while next version solve the 
limitation, and no HFLAG required.
We may need different compatible, or it may simplier just state in dts.
What's more,  one common compatible can be used instead of adding 
specific compatible string.

>
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> ---
>>   .../devicetree/bindings/ata/ahci-platform.txt      |    9 +++++
>>   drivers/ata/libahci_platform.c                     |   39 ++++++++++++++++++++
>>   2 files changed, 48 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> index c96d8dcf98fd..c0b9f6e76ba4 100644
>> --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
>> @@ -26,6 +26,15 @@ Optional properties:
>>   - clocks            : must contain the sata, sata_ref and ahb clocks
>>   - clock-names       : must contain "ahb" for the ahb clock
>>
>> +- no-ncq: when present, controller can't do NCQ, turning off CAP_NCQ
>> +- 32bit-only: when present, controller can't do 64bit DMA, forcing 32bit
>> +- no-msi: when present, no PCI MSI
>> +- no-pmp: when present, controller can't do PMP, turning off CAP_PMP
>> +- yes-ncq: when present,controller can do NCQ, turning on CAP_NCQ
>> +- no-suspend: when present, controller can't do suspend
>> +- yes-fbs: when present, controller can do FBS, turning on CAP_FBS
>> +- no-fbs: when present, controller can't do FBS, turning off CAP_FBS
>
> There is absolutely no reason to mention CAP_* here; the DT should
> describe the HW, not Linux internals.
Yes, got it, will remove CAP*.

>
> Do these all make sense to be placed in DT?
Currently, "hisilicon,hisi-ahci" only need AHCI_HFLAG_NO_FBS | 
AHCI_HFLAG_NO_NCQ.
Just grep AHCI_HFLAG under ata.

>
> I worry that for other quirks we may need more flags in future. For that
> reason I'd rather figure this out in the driver based on the compatible
> string.
So do we just add no-ncq & no-fbs now?
>
>> +
>>   Examples:
>>           sata at ffe08000 {
>>   		compatible = "snps,spear-ahci";
>> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
>> index 3a5b4ed25a4f..880b9f360056 100644
>> --- a/drivers/ata/libahci_platform.c
>> +++ b/drivers/ata/libahci_platform.c
>> @@ -278,6 +278,44 @@ err_out:
>>   }
>>   EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
>>
>> +#ifdef CONFIG_OF
>> +static void ahci_platform_get_of_property(struct platform_device *pdev,
>> +					  struct ahci_host_priv *hpriv)
>> +{
>> +	struct device_node *np = pdev->dev.of_node;
>> +
>> +	if (of_device_is_available(np)) {
>> +		if (of_get_property(np, "no-ncq", NULL))
>> +			hpriv->flags |= AHCI_HFLAG_NO_NCQ;
>
> For boolean flags please use of_property_read_bool.
Yes, it's more accurate.

Thanks for advices.
>
> Mark.
>

  reply	other threads:[~2014-06-19  2:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <xuwei5@hisilicon.com, kefeng.wang@linaro.org,>
2014-06-18  4:54 ` [PATCH 0/2] add ahci_platform_get_of_property Zhangfei Gao
2014-06-18  4:54   ` Zhangfei Gao
2014-06-18  4:54   ` [PATCH RFC 1/2] libahci_platform: " Zhangfei Gao
2014-06-18  4:54     ` Zhangfei Gao
2014-06-18  7:37     ` Lothar Waßmann
2014-06-18  7:37       ` Lothar Waßmann
2014-06-19  2:23       ` zhangfei
2014-06-19  2:23         ` zhangfei
2014-06-18 14:03     ` Mark Rutland
2014-06-18 14:03       ` Mark Rutland
2014-06-19  2:22       ` zhangfei [this message]
2014-06-19  2:22         ` zhangfei
2014-06-19  7:39         ` Hans de Goede
2014-06-19  7:39           ` Hans de Goede
2014-06-20  5:56           ` zhangfei
2014-06-20  5:56             ` zhangfei
2014-06-20  7:38             ` Hans de Goede
2014-06-20  7:38               ` Hans de Goede
2014-06-18  4:54   ` [PATCH RFC 2/2] ahci: remove AHCI_HFLAG_NO_FBS setting Zhangfei Gao
2014-06-18  4:54     ` Zhangfei Gao
2014-06-18  7:15     ` Zhangfei Gao
2014-06-18  7:15       ` Zhangfei Gao

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=53A24950.2020300@linaro.org \
    --to=zhangfei.gao@linaro.org \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.