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.
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(+)
@@ -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+ Examples: sata at ffe08000 { compatible = "snps,spear-ahci";
AHCI_HFLAG can be set directly in dts.
For example
ahci:sata at f9900000 {
no-fbs;
no-ncq;
};
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
drivers/ata/ahci_platform.c | 3 ---
1 file changed, 3 deletions(-)
AHCI_HFLAG can be set directly in dts.
For example
ahci:sata at f9900000 {
no-fbs;
no-ncq;
};
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
drivers/ata/ahci_platform.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
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.
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(+)
@@ -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+
'yes-...' sounds a bit silly to me.
What about 'force-...'?
That's also what the comment to the flag definitions in
drivers/ata/ahci.h says:
|AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */
|AHCI_HFLAG_YES_FBS = (1 << 14), /* force FBS cap on */
Lothar Wa?mann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
From: Mark Rutland <mark.rutland@arm.com> Date: 2014-06-18 14:03:52
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.
@@ -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.
Do these all make sense to be placed in DT?
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.
quoted hunk
+
Examples:
sata at ffe08000 {
compatible = "snps,spear-ahci";
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:
quoted
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.
@@ -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?
quoted
+
Examples:
sata at ffe08000 {
compatible = "snps,spear-ahci";
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.
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(+)
@@ -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+
'yes-...' sounds a bit silly to me.
What about 'force-...'?
Yes, good idea, thanks for the suggestion.
That's also what the comment to the flag definitions in
drivers/ata/ahci.h says:
|AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */
|AHCI_HFLAG_YES_FBS = (1 << 14), /* force FBS cap on */
Lothar Wa?mann
From: Hans de Goede <hidden> Date: 2014-06-19 07:39:55
Hi,
On 06/19/2014 04:22 AM, zhangfei wrote:
Hi Mark,
On 06/18/2014 10:03 PM, Mark Rutland wrote:
quoted
On Wed, Jun 18, 2014 at 05:54:08AM +0100, Zhangfei Gao wrote:
quoted
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?
No you should not add any properties at all using properties to set SoC specific quirks
is just wrong, if a device is not 100% ahci compatible you should use a SoC specific
compatible string for it, and set quirks in the kernel driver based on that.
Devicetree is supposed to describe hardware, in this case the quirks are a property
of the specific model of the hardware, so this should be expressed through the
compatible string. Extra properties in devicetree are meant to be used for board
specific things, like having a gpio to enable power to the sata target device.
Extra properties should not be used in the way you are proposing to use them now.
Regards,
Hans
Hi Mark,
On 06/18/2014 10:03 PM, Mark Rutland wrote:
quoted
On Wed, Jun 18, 2014 at 05:54:08AM +0100, Zhangfei Gao wrote:
quoted
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?
No you should not add any properties at all using properties to set SoC specific quirks
is just wrong, if a device is not 100% ahci compatible you should use a SoC specific
compatible string for it, and set quirks in the kernel driver based on that.
Devicetree is supposed to describe hardware, in this case the quirks are a property
of the specific model of the hardware, so this should be expressed through the
compatible string. Extra properties in devicetree are meant to be used for board
specific things, like having a gpio to enable power to the sata target device.
Extra properties should not be used in the way you are proposing to use them now.
OK, got it.
What I thoutht is using ahci_platform_get_of_property could make
ahci_platform.c more shareable, adding the chance of removing specific
compatible.
Just refer mmc_of_parse and sdhci_get_of_property, they are parsing
property directly from dts.
Anyway, it is fine, here is not so many cases like mmc.
Thanks
From: Hans de Goede <hidden> Date: 2014-06-20 07:38:31
Hi,
On 06/20/2014 07:56 AM, zhangfei wrote:
On 06/19/2014 03:39 PM, Hans de Goede wrote:
quoted
Hi,
On 06/19/2014 04:22 AM, zhangfei wrote:
quoted
Hi Mark,
On 06/18/2014 10:03 PM, Mark Rutland wrote:
quoted
On Wed, Jun 18, 2014 at 05:54:08AM +0100, Zhangfei Gao wrote:
quoted
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?
No you should not add any properties at all using properties to set SoC specific quirks
is just wrong, if a device is not 100% ahci compatible you should use a SoC specific
compatible string for it, and set quirks in the kernel driver based on that.
Devicetree is supposed to describe hardware, in this case the quirks are a property
of the specific model of the hardware, so this should be expressed through the
compatible string. Extra properties in devicetree are meant to be used for board
specific things, like having a gpio to enable power to the sata target device.
Extra properties should not be used in the way you are proposing to use them now.
OK, got it.
What I thoutht is using ahci_platform_get_of_property could make ahci_platform.c more shareable, adding the chance of removing specific compatible.
Just refer mmc_of_parse and sdhci_get_of_property, they are parsing property directly from dts.
I'm not familiar with sdhci_get_of_property, but mmc_of_parse is all about
describing the board, not controller specific quirks. It sets things like
how many bits the sdcard slot has (just because the controller has x
bits does not mean they are all wired up), things like max speed (which again
is not only a host but also a board property), things like which gpio to use for
card detect, or if the mmc/sdio device is always present as it is soldered
onto the board, etc.
Regards,
Hans