* [PATCH v4 0/3] add CNS3xxx AHCI support
@ 2011-01-09 1:49 ` mkl0301 at gmail.com
0 siblings, 0 replies; 14+ messages in thread
From: mkl0301 @ 2011-01-09 1:49 UTC (permalink / raw)
To: htejun, cbouatmailru, linux-arm-kernel, jgarzik, linux-ide; +Cc: Mac Lin
From: Mac Lin <mkl0301@gmail.com>
v4:
- 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
Mac Lin (3):
ahci_platform: rename module ahci_platform to ahci_platforms
ahci_platform: switch to module device table matching
ahci_platforms: add support for CNS3xxx SoC devices
arch/arm/mach-cns3xxx/devices.c | 2 +-
drivers/ata/Kconfig | 11 ++++++++
drivers/ata/Makefile | 5 +++-
drivers/ata/ahci_cns3xxx.c | 51 +++++++++++++++++++++++++++++++++++++++
drivers/ata/ahci_platform.c | 17 ++++++++++++-
drivers/ata/ahci_platforms.h | 18 +++++++++++++
6 files changed, 101 insertions(+), 3 deletions(-)
create mode 100644 drivers/ata/ahci_cns3xxx.c
create mode 100644 drivers/ata/ahci_platforms.h
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH v4 0/3] add CNS3xxx AHCI support @ 2011-01-09 1:49 ` mkl0301 at gmail.com 0 siblings, 0 replies; 14+ messages in thread From: mkl0301 at gmail.com @ 2011-01-09 1:49 UTC (permalink / raw) To: linux-arm-kernel From: Mac Lin <mkl0301@gmail.com> v4: - 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 Mac Lin (3): ahci_platform: rename module ahci_platform to ahci_platforms ahci_platform: switch to module device table matching ahci_platforms: add support for CNS3xxx SoC devices arch/arm/mach-cns3xxx/devices.c | 2 +- drivers/ata/Kconfig | 11 ++++++++ drivers/ata/Makefile | 5 +++- drivers/ata/ahci_cns3xxx.c | 51 +++++++++++++++++++++++++++++++++++++++ drivers/ata/ahci_platform.c | 17 ++++++++++++- drivers/ata/ahci_platforms.h | 18 +++++++++++++ 6 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 drivers/ata/ahci_cns3xxx.c create mode 100644 drivers/ata/ahci_platforms.h ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 1/3] ahci_platform: rename module ahci_platform to ahci_platforms 2011-01-09 1:49 ` mkl0301 at gmail.com @ 2011-01-09 1:49 ` mkl0301 at gmail.com -1 siblings, 0 replies; 14+ messages in thread From: mkl0301 @ 2011-01-09 1:49 UTC (permalink / raw) To: htejun, cbouatmailru, linux-arm-kernel, jgarzik, linux-ide; +Cc: Mac Lin From: Mac Lin <mkl0301@gmail.com> 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. Signed-off-by: Mac Lin <mkl0301@gmail.com> --- drivers/ata/Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 2b67c90..d17bfe7 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -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 -- 1.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 1/3] ahci_platform: rename module ahci_platform to ahci_platforms @ 2011-01-09 1:49 ` mkl0301 at gmail.com 0 siblings, 0 replies; 14+ messages in thread From: mkl0301 at gmail.com @ 2011-01-09 1:49 UTC (permalink / raw) To: linux-arm-kernel From: Mac Lin <mkl0301@gmail.com> 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. Signed-off-by: Mac Lin <mkl0301@gmail.com> --- drivers/ata/Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 2b67c90..d17bfe7 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -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 -- 1.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v4 1/3] ahci_platform: rename module ahci_platform to ahci_platforms 2011-01-09 1:49 ` mkl0301 at gmail.com @ 2011-01-09 3:03 ` Anton Vorontsov -1 siblings, 0 replies; 14+ messages in thread From: Anton Vorontsov @ 2011-01-09 3:03 UTC (permalink / raw) To: mkl0301; +Cc: htejun, linux-arm-kernel, jgarzik, linux-ide On Sun, Jan 09, 2011 at 09:49:33AM +0800, mkl0301@gmail.com wrote: > From: Mac Lin <mkl0301@gmail.com> > > 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. > > Signed-off-by: Mac Lin <mkl0301@gmail.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Thanks Mac! > --- > drivers/ata/Makefile | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile > index 2b67c90..d17bfe7 100644 > --- a/drivers/ata/Makefile > +++ b/drivers/ata/Makefile > @@ -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 > -- > 1.7.3 -- Anton Vorontsov Email: cbouatmailru@gmail.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 1/3] ahci_platform: rename module ahci_platform to ahci_platforms @ 2011-01-09 3:03 ` Anton Vorontsov 0 siblings, 0 replies; 14+ messages in thread From: Anton Vorontsov @ 2011-01-09 3:03 UTC (permalink / raw) To: linux-arm-kernel On Sun, Jan 09, 2011 at 09:49:33AM +0800, mkl0301 at gmail.com wrote: > From: Mac Lin <mkl0301@gmail.com> > > 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. > > Signed-off-by: Mac Lin <mkl0301@gmail.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Thanks Mac! > --- > drivers/ata/Makefile | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile > index 2b67c90..d17bfe7 100644 > --- a/drivers/ata/Makefile > +++ b/drivers/ata/Makefile > @@ -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 > -- > 1.7.3 -- Anton Vorontsov Email: cbouatmailru at gmail.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 2/3] ahci_platform: switch to module device table matching 2011-01-09 1:49 ` mkl0301 at gmail.com @ 2011-01-09 1:49 ` mkl0301 at gmail.com -1 siblings, 0 replies; 14+ messages in thread From: mkl0301 @ 2011-01-09 1:49 UTC (permalink / raw) To: htejun, cbouatmailru, linux-arm-kernel, jgarzik, linux-ide; +Cc: Mac Lin From: Mac Lin <mkl0301@gmail.com> Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver. Signed-off-by: Mac Lin <mkl0301@gmail.com> --- drivers/ata/ahci_platform.c | 14 +++++++++++++- drivers/ata/ahci_platforms.h | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletions(-) create mode 100644 drivers/ata/ahci_platforms.h diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 6fef1fa..190db2c 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -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_platforms.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_pltfm_ids[] = { + { "ahci", }, + { }, +}; +MODULE_DEVICE_TABLE(platform, ahci_pltfm_ids); + static struct platform_driver ahci_driver = { .remove = __devexit_p(ahci_remove), .driver = { .name = "ahci", .owner = THIS_MODULE, }, + .id_table = ahci_pltfm_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 <avorontsov@ru.mvista.com>"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:ahci"); diff --git a/drivers/ata/ahci_platforms.h b/drivers/ata/ahci_platforms.h new file mode 100644 index 0000000..cf16e6f --- /dev/null +++ b/drivers/ata/ahci_platforms.h @@ -0,0 +1,16 @@ +/* + * Copyright 2010 MontaVista Software, LLC. + * Copyright 2010 Cavium Networks + * + * Authors: Anton Vorontsov <avorontsov@mvista.com> + * Mac Lin <mkl0301@gmail.com> + * + * 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*/ -- 1.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 2/3] ahci_platform: switch to module device table matching @ 2011-01-09 1:49 ` mkl0301 at gmail.com 0 siblings, 0 replies; 14+ messages in thread From: mkl0301 at gmail.com @ 2011-01-09 1:49 UTC (permalink / raw) To: linux-arm-kernel From: Mac Lin <mkl0301@gmail.com> Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver. Signed-off-by: Mac Lin <mkl0301@gmail.com> --- drivers/ata/ahci_platform.c | 14 +++++++++++++- drivers/ata/ahci_platforms.h | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletions(-) create mode 100644 drivers/ata/ahci_platforms.h diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 6fef1fa..190db2c 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -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_platforms.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_pltfm_ids[] = { + { "ahci", }, + { }, +}; +MODULE_DEVICE_TABLE(platform, ahci_pltfm_ids); + static struct platform_driver ahci_driver = { .remove = __devexit_p(ahci_remove), .driver = { .name = "ahci", .owner = THIS_MODULE, }, + .id_table = ahci_pltfm_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 <avorontsov@ru.mvista.com>"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:ahci"); diff --git a/drivers/ata/ahci_platforms.h b/drivers/ata/ahci_platforms.h new file mode 100644 index 0000000..cf16e6f --- /dev/null +++ b/drivers/ata/ahci_platforms.h @@ -0,0 +1,16 @@ +/* + * Copyright 2010 MontaVista Software, LLC. + * Copyright 2010 Cavium Networks + * + * Authors: Anton Vorontsov <avorontsov@mvista.com> + * Mac Lin <mkl0301@gmail.com> + * + * 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*/ -- 1.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v4 2/3] ahci_platform: switch to module device table matching 2011-01-09 1:49 ` mkl0301 at gmail.com @ 2011-01-09 2:56 ` Anton Vorontsov -1 siblings, 0 replies; 14+ messages in thread From: Anton Vorontsov @ 2011-01-09 2:56 UTC (permalink / raw) To: mkl0301; +Cc: htejun, linux-arm-kernel, jgarzik, linux-ide On Sun, Jan 09, 2011 at 09:49:34AM +0800, mkl0301@gmail.com wrote: > From: Mac Lin <mkl0301@gmail.com> > > Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver. > > Signed-off-by: Mac Lin <mkl0301@gmail.com> > --- > drivers/ata/ahci_platform.c | 14 +++++++++++++- > drivers/ata/ahci_platforms.h | 16 ++++++++++++++++ I think header and .c file names should match. I.e. just ahci_platform.h. > 2 files changed, 29 insertions(+), 1 deletions(-) > create mode 100644 drivers/ata/ahci_platforms.h > > diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c > index 6fef1fa..190db2c 100644 > --- a/drivers/ata/ahci_platform.c > +++ b/drivers/ata/ahci_platform.c > @@ -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_platforms.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_pltfm_ids[] = { s/pltfm/platform/ to match the rest of the driver. On the next resend, feel free to add my Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Thanks! -- Anton Vorontsov Email: cbouatmailru@gmail.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 2/3] ahci_platform: switch to module device table matching @ 2011-01-09 2:56 ` Anton Vorontsov 0 siblings, 0 replies; 14+ messages in thread From: Anton Vorontsov @ 2011-01-09 2:56 UTC (permalink / raw) To: linux-arm-kernel On Sun, Jan 09, 2011 at 09:49:34AM +0800, mkl0301 at gmail.com wrote: > From: Mac Lin <mkl0301@gmail.com> > > Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver. > > Signed-off-by: Mac Lin <mkl0301@gmail.com> > --- > drivers/ata/ahci_platform.c | 14 +++++++++++++- > drivers/ata/ahci_platforms.h | 16 ++++++++++++++++ I think header and .c file names should match. I.e. just ahci_platform.h. > 2 files changed, 29 insertions(+), 1 deletions(-) > create mode 100644 drivers/ata/ahci_platforms.h > > diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c > index 6fef1fa..190db2c 100644 > --- a/drivers/ata/ahci_platform.c > +++ b/drivers/ata/ahci_platform.c > @@ -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_platforms.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_pltfm_ids[] = { s/pltfm/platform/ to match the rest of the driver. On the next resend, feel free to add my Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Thanks! -- Anton Vorontsov Email: cbouatmailru at gmail.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 3/3] ahci_platforms: add support for CNS3xxx SoC devices 2011-01-09 1:49 ` mkl0301 at gmail.com @ 2011-01-09 1:49 ` mkl0301 at gmail.com -1 siblings, 0 replies; 14+ messages in thread From: mkl0301 @ 2011-01-09 1:49 UTC (permalink / raw) To: htejun, cbouatmailru, linux-arm-kernel, jgarzik, linux-ide; +Cc: Mac Lin From: Mac Lin <mkl0301@gmail.com> 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. Signed-off-by: Mac Lin <mkl0301@gmail.com> --- 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_platforms.h | 2 + 6 files changed, 69 insertions(+), 1 deletions(-) create mode 100644 drivers/ata/ahci_cns3xxx.c diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c index 50b4d31..b496f02 100644 --- a/arch/arm/mach-cns3xxx/devices.c +++ b/arch/arm/mach-cns3xxx/devices.c @@ -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), diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 36e2319..5d8b1a3 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -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 diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index d17bfe7..7f2d32e 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -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 diff --git a/drivers/ata/ahci_cns3xxx.c b/drivers/ata/ahci_cns3xxx.c new file mode 100644 index 0000000..7cc841e --- /dev/null +++ b/drivers/ata/ahci_cns3xxx.c @@ -0,0 +1,51 @@ +/* + * AHCI support for CNS3xxx SoC + * + * Copyright 2010 MontaVista Software, LLC. + * Copyright 2010 Cavium Networks + * + * Authors: Anton Vorontsov <avorontsov@mvista.com> + * Mac Lin <mkl0301@gmail.com> + * + * 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. + */ + +#include <linux/libata.h> +#include <linux/ahci_platform.h> +#include "ahci.h" + +/* + * TODO: move cns3xxx_ahci_init to here after cns3xxx_pwr*() calls are + * thread-safe + */ + +static int cns3xxx_ahci_softreset(struct ata_link *link, unsigned int *class, + unsigned long deadline) +{ + int pmp = sata_srst_pmp(link); + int ret; + + ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready); + if (pmp && ret) + return ahci_do_softreset(link, class, 0, deadline, + ahci_check_ready); + return ret; +} + +static struct ata_port_operations cns3xxx_ahci_ops = { + .inherits = &ahci_ops, + .softreset = cns3xxx_ahci_softreset, +}; + +static const struct ata_port_info cns3xxx_ata_port_info = { + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &cns3xxx_ahci_ops, +}; + +struct ahci_platform_data cns3xxx_ahci_platform_data = { + .ata_port_info = &cns3xxx_ata_port_info, +}; diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 190db2c..ad0f921 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -179,6 +179,9 @@ static int __devexit ahci_remove(struct platform_device *pdev) static const struct platform_device_id ahci_pltfm_ids[] = { { "ahci", }, +#ifdef CONFIG_SATA_AHCI_CNS3XXX + { "ahci-cns3xxx", (kernel_ulong_t)&cns3xxx_ahci_platform_data}, +#endif { }, }; MODULE_DEVICE_TABLE(platform, ahci_pltfm_ids); diff --git a/drivers/ata/ahci_platforms.h b/drivers/ata/ahci_platforms.h index cf16e6f..d9ea5ab 100644 --- a/drivers/ata/ahci_platforms.h +++ b/drivers/ata/ahci_platforms.h @@ -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*/ -- 1.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v4 3/3] ahci_platforms: add support for CNS3xxx SoC devices @ 2011-01-09 1:49 ` mkl0301 at gmail.com 0 siblings, 0 replies; 14+ messages in thread From: mkl0301 at gmail.com @ 2011-01-09 1:49 UTC (permalink / raw) To: linux-arm-kernel From: Mac Lin <mkl0301@gmail.com> 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. Signed-off-by: Mac Lin <mkl0301@gmail.com> --- 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_platforms.h | 2 + 6 files changed, 69 insertions(+), 1 deletions(-) create mode 100644 drivers/ata/ahci_cns3xxx.c diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c index 50b4d31..b496f02 100644 --- a/arch/arm/mach-cns3xxx/devices.c +++ b/arch/arm/mach-cns3xxx/devices.c @@ -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), diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 36e2319..5d8b1a3 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -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 diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index d17bfe7..7f2d32e 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -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 diff --git a/drivers/ata/ahci_cns3xxx.c b/drivers/ata/ahci_cns3xxx.c new file mode 100644 index 0000000..7cc841e --- /dev/null +++ b/drivers/ata/ahci_cns3xxx.c @@ -0,0 +1,51 @@ +/* + * AHCI support for CNS3xxx SoC + * + * Copyright 2010 MontaVista Software, LLC. + * Copyright 2010 Cavium Networks + * + * Authors: Anton Vorontsov <avorontsov@mvista.com> + * Mac Lin <mkl0301@gmail.com> + * + * 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. + */ + +#include <linux/libata.h> +#include <linux/ahci_platform.h> +#include "ahci.h" + +/* + * TODO: move cns3xxx_ahci_init to here after cns3xxx_pwr*() calls are + * thread-safe + */ + +static int cns3xxx_ahci_softreset(struct ata_link *link, unsigned int *class, + unsigned long deadline) +{ + int pmp = sata_srst_pmp(link); + int ret; + + ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready); + if (pmp && ret) + return ahci_do_softreset(link, class, 0, deadline, + ahci_check_ready); + return ret; +} + +static struct ata_port_operations cns3xxx_ahci_ops = { + .inherits = &ahci_ops, + .softreset = cns3xxx_ahci_softreset, +}; + +static const struct ata_port_info cns3xxx_ata_port_info = { + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &cns3xxx_ahci_ops, +}; + +struct ahci_platform_data cns3xxx_ahci_platform_data = { + .ata_port_info = &cns3xxx_ata_port_info, +}; diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 190db2c..ad0f921 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -179,6 +179,9 @@ static int __devexit ahci_remove(struct platform_device *pdev) static const struct platform_device_id ahci_pltfm_ids[] = { { "ahci", }, +#ifdef CONFIG_SATA_AHCI_CNS3XXX + { "ahci-cns3xxx", (kernel_ulong_t)&cns3xxx_ahci_platform_data}, +#endif { }, }; MODULE_DEVICE_TABLE(platform, ahci_pltfm_ids); diff --git a/drivers/ata/ahci_platforms.h b/drivers/ata/ahci_platforms.h index cf16e6f..d9ea5ab 100644 --- a/drivers/ata/ahci_platforms.h +++ b/drivers/ata/ahci_platforms.h @@ -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*/ -- 1.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v4 3/3] ahci_platforms: add support for CNS3xxx SoC devices 2011-01-09 1:49 ` mkl0301 at gmail.com @ 2011-01-09 3:02 ` Anton Vorontsov -1 siblings, 0 replies; 14+ messages in thread From: Anton Vorontsov @ 2011-01-09 3:02 UTC (permalink / raw) To: mkl0301; +Cc: htejun, linux-arm-kernel, jgarzik, linux-ide On Sun, Jan 09, 2011 at 09:49:35AM +0800, mkl0301@gmail.com wrote: > From: Mac Lin <mkl0301@gmail.com> > > 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. [...] > Signed-off-by: Mac Lin <mkl0301@gmail.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Thanks! -- Anton Vorontsov Email: cbouatmailru@gmail.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 3/3] ahci_platforms: add support for CNS3xxx SoC devices @ 2011-01-09 3:02 ` Anton Vorontsov 0 siblings, 0 replies; 14+ messages in thread From: Anton Vorontsov @ 2011-01-09 3:02 UTC (permalink / raw) To: linux-arm-kernel On Sun, Jan 09, 2011 at 09:49:35AM +0800, mkl0301 at gmail.com wrote: > From: Mac Lin <mkl0301@gmail.com> > > 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. [...] > Signed-off-by: Mac Lin <mkl0301@gmail.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Thanks! -- Anton Vorontsov Email: cbouatmailru at gmail.com ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-01-09 3:03 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-01-09 1:49 [PATCH v4 0/3] add CNS3xxx AHCI support mkl0301 2011-01-09 1:49 ` mkl0301 at gmail.com 2011-01-09 1:49 ` [PATCH v4 1/3] ahci_platform: rename module ahci_platform to ahci_platforms mkl0301 2011-01-09 1:49 ` mkl0301 at gmail.com 2011-01-09 3:03 ` Anton Vorontsov 2011-01-09 3:03 ` Anton Vorontsov 2011-01-09 1:49 ` [PATCH v4 2/3] ahci_platform: switch to module device table matching mkl0301 2011-01-09 1:49 ` mkl0301 at gmail.com 2011-01-09 2:56 ` Anton Vorontsov 2011-01-09 2:56 ` Anton Vorontsov 2011-01-09 1:49 ` [PATCH v4 3/3] ahci_platforms: add support for CNS3xxx SoC devices mkl0301 2011-01-09 1:49 ` mkl0301 at gmail.com 2011-01-09 3:02 ` Anton Vorontsov 2011-01-09 3:02 ` Anton Vorontsov
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.