add CNS3xxx AHCI support
v5 cover add CNS3xxx AHCI support
From: Mac Lin <[email protected]>
v5:
- Rename ahci_platforms.h to ahci_platform.h
- s/pltfm/platform/ in ahci_platform.c
v4: http://www.spinics.net/lists/linux-ide/msg39852.html
- v2 basically, which make SoC-specific changes into separate files
- Rename module ahci_platform to ahci_platforms, into which link the ahci_platform and the SoC-specific changes
- No rename of ahci_platform.c
- Some cosmetic code changes since v2
v3: http://www.spinics.net/lists/arm-kernel/msg109924.html
- Make the SoC-specific changes into ahci_platform.c directly.
- Some cosmetic code changes
=> ahci_platform.c is less readable due to SoC-specific changes and macro
v2: http://www.spinics.net/lists/linux-ide/msg39766.html
- Renaming ahci_platform.c to ahci_pltfm.c for linking SoC specific changes into ahci_platform, while not changing the module name.
- Switch ahci_platform to module device table matching to add SoC specific support
- Add CNS3xxx SoC specific AHCI support to ahci_cns3xxx.c
v1: http://www.spinics.net/lists/arm-kernel/msg106236.html
- Add CNS3xxx SoC specific AHCI support to arch/arm/mach-cns3xxx
=> The changes depends on libahci and libata, i.e. both of them need to be built into kernel
This patchset is based on linux-2.6.37
PATCH v5 1/3 ahci_platform: rename module ahci_platform to ahci_platforms
From: Mac Lin <[email protected]>
Due to build system limitations, intermediate and final objects can't have the same names. And as we're going to start building SoC-specific objects, rename ahci_platform to ahci_platforms, into which link ahci_platform and SoC-specific objects.
--- drivers/ata/Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/ata/Makefile +3 -1
@@ -3,7 +3,9 @@ obj-$(CONFIG_ATA) += libata.o # non-SFF interface obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o -obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o +obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platforms.o libahci.o +ahci_platforms-y += ahci_platform.o + obj-$(CONFIG_SATA_FSL) += sata_fsl.o obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o obj-$(CONFIG_SATA_SIL24) += sata_sil24.o
Signature · 1 line
1.7.3
PATCH v5 2/3 ahci_platform: switch to module device table matching
In reply to mkl0301 at gmail.comFrom: Mac Lin <[email protected]>
Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver.
--- drivers/ata/ahci_platform.c | 14 +++++++++++++- drivers/ata/ahci_platform.h | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletions(-) create mode 100644 drivers/ata/ahci_platform.h
drivers/ata/ahci_platform.c +13 -1
@@ -19,9 +19,11 @@#include <linux/interrupt.h> #include <linux/device.h> #include <linux/platform_device.h> +#include <linux/mod_devicetable.h> #include <linux/libata.h> #include <linux/ahci_platform.h> #include "ahci.h" +#include "ahci_platform.h" static struct scsi_host_template ahci_platform_sht = {AHCI_SHT ("ahci_platform" ),
@@ -29,6 +31,7 @@ static struct scsi_host_template ahci_platform_sht = {static int __init ahci_probe (struct platform_device *pdev) { +const struct platform_device_id *platid =platform_get_device_id (pdev);struct device *dev = &pdev->dev;struct ahci_platform_data *pdata = dev->platform_data;struct ata_port_info pi = {
@@ -46,6 +49,9 @@ static int __init ahci_probe(struct platform_device *pdev)int i;int rc; +if (!pdata && platid && platid->driver_data) + pdata = (void *)platid->driver_data; + mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!mem) {dev_err (dev,"no mmio space\n" );
@@ -171,12 +177,19 @@ static int __devexit ahci_remove(struct platform_device *pdev)return 0 ; } +static const struct platform_device_id ahci_platform_ids[] = { + {"ahci" , }, + { }, +}; +MODULE_DEVICE_TABLE (platform, ahci_platform_ids); +static struct platform_driver ahci_driver = { .remove =__devexit_p (ahci_remove), .driver = { .name ="ahci" , .owner =THIS_MODULE , }, + .id_table = ahci_platform_ids, };static int __init ahci_init (void )
@@ -194,4 +207,3 @@ module_exit(ahci_exit);MODULE_DESCRIPTION ("AHCI SATA platform driver" );MODULE_AUTHOR ("Anton Vorontsov <[email protected]>" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:ahci" );
drivers/ata/ahci_platform.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* Copyright 2010 MontaVista Software, LLC. +* Copyright 2010 Cavium Networks +* +* Authors: Anton Vorontsov <[email protected]> +* Mac Lin <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _DRIVERS_SATA_AHCI_PLATFORMS_H +#define _DRIVERS_SATA_AHCI_PLATFORMS_H + +#endif /*_DRIVERS_SATA_AHCI_PLATFORMS_H*/
Signature · 1 line
1.7.3
PATCH v5 3/3 ahci_platforms: add support for CNS3xxx SoC devices
In reply to mkl0301 at gmail.comFrom: Mac Lin <[email protected]>
CNS3xxx override the softreset function of ahci_platform ahci_softreset by cns3xxx_ahci_softreset, which would retry ahci_do_softreset again with pmp=0 if pmp=15 failed, for the controller has problem receiving D2H Reg FIS of the different PMP setting of the previous sent H2D Reg FIS.
Following describe the isssue with original ahci_platform driver on linux-2.6.37-rc3, arm/cns3xxx.
If CONFIG_SATA_PMP is enabled, while not using multiplier and connect the disks directly to the board, the disk cannot be found due to software reset always failed.
ahci ahci.0: forcing PORTS_IMPL to 0x3
ahci ahci.0: AHCI 0001.0100 32 slots 2 ports 3 Gbps 0x3 impl platform mode ahci ahci.0: flags: ncq sntf pm led clo only pmp pio slum part ccc scsi0 : ahci_platform
scsi1 : ahci_platform
ata1: SATA max UDMA/133 irq_stat 0x00400040, connection status changed irq 65
ata2: SATA max UDMA/133 mmio [mem 0x83000000-0x83ffffff] port 0x180 irq 65
ata2: SATA link down (SStatus 0 SControl 300)
ata1: link is slow to respond, please be patient (ready=0)
ata1: softreset failed (device not ready)
ata1: link is slow to respond, please be patient (ready=0)
ata1: softreset failed (device not ready)
ata1: link is slow to respond, please be patient (ready=0)
ata1: softreset failed (device not ready)
ata1: limiting SATA link speed to 1.5 Gbps
ata1: SATA link down (SStatus 1 SControl 310)
While using multiplier with CONFIG_SATA_PMP enabled, or using disks directly without CONFIG_SATA_PMP have no issue. It seems the device is sending D2H Reg FIS, but controller is not reflecting it on any known means.
--- arch/arm/mach-cns3xxx/devices.c | 2 +- drivers/ata/Kconfig | 11 ++++++++ drivers/ata/Makefile | 1 + drivers/ata/ahci_cns3xxx.c | 51 +++++++++++++++++++++++++++++++++++++++ drivers/ata/ahci_platform.c | 3 ++ drivers/ata/ahci_platform.h | 2 + 6 files changed, 69 insertions(+), 1 deletions(-) create mode 100644 drivers/ata/ahci_cns3xxx.c
arch/arm/mach-cns3xxx/devices.c +1 -1
@@ -40,7 +40,7 @@ static struct resource cns3xxx_ahci_resource[] = {static u64 cns3xxx_ahci_dmamask =DMA_BIT_MASK (32 );static struct platform_device cns3xxx_ahci_pdev = { - .name ="ahci" , + .name ="ahci-cns3xxx" , .id =0 , .resource = cns3xxx_ahci_resource, .num_resources =ARRAY_SIZE (cns3xxx_ahci_resource),
drivers/ata/Kconfig +11 -0
@@ -75,6 +75,17 @@ config SATA_AHCI_PLATFORM If unsure, say N. +config SATA_AHCI_CNS3XXX + bool "AHCI Support on the Cavium Networks CNS3xxx SOC" + depends on ARCH_CNS3XXX + depends on SATA_AHCI_PLATFORM + help + This option enables AHCI platform driver to support CNS3xxx + System-on-Chip devices. This is only needed when using CNS3xxx AHCI + controller. + + If unsure, say N. + config SATA_FSL tristate "Freescale 3.0Gbps SATA support" depends on FSL_SOC
drivers/ata/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATA) += libata.o obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platforms.o libahci.o ahci_platforms-y += ahci_platform.o +ahci_platforms-$(CONFIG_SATA_AHCI_CNS3XXX) += ahci_cns3xxx.o obj-$(CONFIG_SATA_FSL) += sata_fsl.o obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
drivers/ata/ahci_cns3xxx.c new file +51 -0
51 lines not on this page · raw message
drivers/ata/ahci_platform.c +3 -0
@@ -179,6 +179,9 @@ static int __devexit ahci_remove(struct platform_device *pdev)static const struct platform_device_id ahci_platform_ids[] = { {"ahci" , }, +#ifdef CONFIG_SATA_AHCI_CNS3XXX + {"ahci-cns3xxx" , (kernel_ulong_t)&cns3xxx_ahci_platform_data}, +#endif { }, };MODULE_DEVICE_TABLE (platform, ahci_platform_ids);
drivers/ata/ahci_platform.h +2 -0
@@ -13,4 +13,6 @@#ifndef _DRIVERS_SATA_AHCI_PLATFORMS_H#define _DRIVERS_SATA_AHCI_PLATFORMS_H +extern struct ahci_platform_data cns3xxx_ahci_platform_data; +#endif /*_DRIVERS_SATA_AHCI_PLATFORMS_H*/
Signature · 1 line
1.7.3
PATCH v5 3/3 ahci_platforms: add support for CNS3xxx SoC devices
Quoted 8 lines
From: Mac Lin <[email protected]>
CNS3xxx override the softreset function of
ahci_platformahci_softresetbycns3xxx_ahci_softreset, which would retryahci_do_softresetagain with pmp=0 if
pmp=15 failed, for the controller has problem receiving D2H Reg FIS of the different PMP setting of the previous sent H2D Reg FIS.
Is this issue only with your ahci platform controller? I came across another thread here,
http://www.spinics.net/lists/linux-ide/msg39865.html
Also, the ahci platform controller on Texas Instruments OMAP L138 platform behaves in a similar fashion.
Currently I see only Cavium Networks, Faraday and TI using ahci platform controller and all 3 facing same issue.
Hence, should we fix this in ahci_platform.c conditionally using platform data, otherwise we will end-up adding file for every platform (just for one function).
Thanks
Mansoor Ahamed
PATCH v5 3/3 ahci_platforms: add support for CNS3xxx SoC devices
2011/1/10 Basheer, Mansoor Ahamed <[email protected]>:
Quoted 9 lines
Quoted 8 lines
From: Mac Lin <[email protected]>
CNS3xxx override the softreset function of
ahci_platformahci_softresetbycns3xxx_ahci_softreset, which would retryahci_do_softresetagain with pmp=0 if
pmp=15 failed, for the controller has problem receiving D2H Reg FIS of the different PMP setting of the previous sent H2D Reg FIS.
Quoted 4 lines
Is this issue only with your ahci platform controller? I came across another thread here,
Thanks for mentioning this.
They do look alike. I'll confirm with them.
Quoted 9 lines
Also, the ahci platform controller on Texas Instruments OMAP L138 platform behaves in a similar fashion.
Currently I see only Cavium Networks, Faraday and TI using ahci platform controller and all 3 facing same issue.
Hence, should we fix this in
ahci_platform.cconditionally using platform data, otherwise we will end-up adding file for every platform (just for one function).
We can add quirk in ahci platform data, just like sdhci_pltfm.c and sdhci_cns3xxx.c.
Thus, in cns3xxx's case, all we need is to include <linux/ahci_platform.h>, and all the SoC specific code could exist in arch folder, similar to my v1 patchset.
Best Regards,
Mac Lin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libahci-Fixup-for-softwreset-failures-with-direct-co.patch
Type: text/x-diff
Size: 1002 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110110/acb4bf7f/attachment.bin>
RE: [PATCH v5 3/3] ahci_platforms: add support for CNS3xxx SoC devices
In reply to mkl0301 at gmail.comQuoted 8 lines
From: Mac Lin <[email protected]>
CNS3xxx override the softreset function of
ahci_platformahci_softresetbycns3xxx_ahci_softreset, which would retryahci_do_softresetagain with pmp=0 if
pmp=15 failed, for the controller has problem receiving D2H Reg FIS of the different PMP setting of the previous sent H2D Reg FIS.
Is this issue only with your ahci platform controller? I came across another thread here,
http://www.spinics.net/lists/linux-ide/msg39865.html
Also, the ahci platform controller on Texas Instruments OMAP L138 platform behaves in a similar fashion.
Currently I see only Cavium Networks, Faraday and TI using ahci platform controller and all 3 facing same issue.
Hence, should we fix this in ahci_platform.c conditionally using platform data, otherwise we will end-up adding file for every platform (just for one function).
Thanks
Mansoor Ahamed
v5 cover add CNS3xxx AHCI support
In reply to mkl0301 at gmail.com2011/1/9 <[email protected]>:
Quoted 22 lines
From: Mac Lin <[email protected]>
v5:
?- Renameahci_platforms.htoahci_platform.h
?- s/pltfm/platform/ inahci_platform.cv4: http://www.spinics.net/lists/linux-ide/msg39852.html
?- v2 basically, which make SoC-specific changes into separate files
?- Rename moduleahci_platformtoahci_platforms, into which link theahci_platformand the SoC-specific changes ?- No rename ofahci_platform.c
?- Some cosmetic code changes since v2v3: http://www.spinics.net/lists/arm-kernel/msg109924.html
?- Make the SoC-specific changes intoahci_platform.cdirectly. ?- Some cosmetic code changes
=>ahci_platform.cis less readable due to SoC-specific changes and macrov2: http://www.spinics.net/lists/linux-ide/msg39766.html
?- Renamingahci_platform.ctoahci_pltfm.cfor linking SoC specific changes intoahci_platform, while not changing the module name. ?- Switchahci_platformto module device table matching to add SoC specific support
?- Add CNS3xxx SoC specific AHCI support toahci_cns3xxx.c
Quoted 6 lines
v1: http://www.spinics.net/lists/arm-kernel/msg106236.html
?- Add CNS3xxx SoC specific AHCI support toarch/arm/mach-cns3xxx
=> The changes depends on libahci and libata, i.e. both of them need to be built into kernelThis patchset is based on linux-2.6.37
ping?
Please kindly provide your opinion.
Best Regards,
Mac Lin