1 --- a/arch/arm/mach-cns3xxx/devices.c
2 +++ b/arch/arm/mach-cns3xxx/devices.c
3 @@ -41,7 +41,7 @@ static struct resource cns3xxx_ahci_reso
4 static u64 cns3xxx_ahci_dmamask = DMA_BIT_MASK(32);
6 static struct platform_device cns3xxx_ahci_pdev = {
8 + .name = "ahci-cns3xxx",
10 .resource = cns3xxx_ahci_resource,
11 .num_resources = ARRAY_SIZE(cns3xxx_ahci_resource),
12 --- a/drivers/ata/Kconfig
13 +++ b/drivers/ata/Kconfig
14 @@ -83,6 +83,17 @@ config SATA_AHCI_PLATFORM
18 +config SATA_AHCI_CNS3XXX
19 + bool "AHCI Support on the Cavium Networks CNS3xxx SOC"
20 + depends on ARCH_CNS3XXX
21 + depends on SATA_AHCI_PLATFORM
23 + This option enables AHCI platform driver to support CNS3xxx
24 + System-on-Chip devices. This is only needed when using CNS3xxx AHCI
30 tristate "Freescale 3.0Gbps SATA support"
32 --- a/drivers/ata/Makefile
33 +++ b/drivers/ata/Makefile
34 @@ -4,7 +4,10 @@ obj-$(CONFIG_ATA) += libata.o
36 obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o
37 obj-$(CONFIG_SATA_ACARD_AHCI) += acard-ahci.o libahci.o
38 -obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o
39 +obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platforms.o libahci.o
40 +ahci_platforms-y += ahci_platform.o
41 +ahci_platforms-$(CONFIG_SATA_AHCI_CNS3XXX) += ahci_cns3xxx.o
43 obj-$(CONFIG_SATA_FSL) += sata_fsl.o
44 obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
45 obj-$(CONFIG_SATA_SIL24) += sata_sil24.o
47 +++ b/drivers/ata/ahci_cns3xxx.c
50 + * AHCI support for CNS3xxx SoC
52 + * Copyright 2010 MontaVista Software, LLC.
53 + * Copyright 2010 Cavium Networks
55 + * Authors: Anton Vorontsov <avorontsov@xxxxxxxxxx>
56 + * Mac Lin <mkl0301@xxxxxxxxx>
58 + * This program is free software; you can redistribute it and/or modify
59 + * it under the terms of the GNU General Public License version 2 as
60 + * published by the Free Software Foundation.
63 +#include <linux/libata.h>
64 +#include <linux/ahci_platform.h>
68 + * TODO: move cns3xxx_ahci_init to here after cns3xxx_pwr*() calls are
72 +static int cns3xxx_ahci_softreset(struct ata_link *link, unsigned int *class,
73 + unsigned long deadline)
75 + int pmp = sata_srst_pmp(link);
78 + ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
80 + return ahci_do_softreset(link, class, 0, deadline,
85 +static struct ata_port_operations cns3xxx_ahci_ops = {
86 + .inherits = &ahci_ops,
87 + .softreset = cns3xxx_ahci_softreset,
90 +static const struct ata_port_info cns3xxx_ata_port_info = {
91 + .flags = AHCI_FLAG_COMMON,
92 + .pio_mask = ATA_PIO4,
93 + .udma_mask = ATA_UDMA6,
94 + .port_ops = &cns3xxx_ahci_ops,
97 +struct ahci_platform_data cns3xxx_ahci_platform_data = {
98 + .ata_port_info = &cns3xxx_ata_port_info,
101 --- a/drivers/ata/ahci_platform.c
102 +++ b/drivers/ata/ahci_platform.c
104 #include <linux/interrupt.h>
105 #include <linux/device.h>
106 #include <linux/platform_device.h>
107 +#include <linux/mod_devicetable.h>
108 #include <linux/libata.h>
109 #include <linux/ahci_platform.h>
111 +#include "ahci_platform.h"
113 static struct scsi_host_template ahci_platform_sht = {
114 AHCI_SHT("ahci_platform"),
115 @@ -29,6 +31,7 @@ static struct scsi_host_template ahci_pl
117 static int __init ahci_probe(struct platform_device *pdev)
119 + const struct platform_device_id *platid = platform_get_device_id(pdev);
120 struct device *dev = &pdev->dev;
121 struct ahci_platform_data *pdata = dev->platform_data;
122 struct ata_port_info pi = {
123 @@ -46,6 +49,9 @@ static int __init ahci_probe(struct plat
127 + if (!pdata && platid && platid->driver_data)
128 + pdata = (void *)platid->driver_data;
130 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
132 dev_err(dev, "no mmio space\n");
133 @@ -171,17 +177,28 @@ static int __devexit ahci_remove(struct
137 +static const struct platform_device_id ahci_platform_ids[] = {
139 +#ifdef CONFIG_SATA_AHCI_CNS3XXX
140 + { "ahci-cns3xxx", (kernel_ulong_t)&cns3xxx_ahci_platform_data},
144 +MODULE_DEVICE_TABLE(platform, ahci_platform_ids);
146 static struct platform_driver ahci_driver = {
147 - .remove = __devexit_p(ahci_remove),
150 .owner = THIS_MODULE,
152 + .probe = ahci_probe,
153 + .remove = __devexit_p(ahci_remove),
154 + .id_table = ahci_platform_ids,
157 static int __init ahci_init(void)
159 - return platform_driver_probe(&ahci_driver, ahci_probe);
160 + return platform_driver_register(&ahci_driver);
162 module_init(ahci_init);
164 @@ -194,4 +211,3 @@ module_exit(ahci_exit);
165 MODULE_DESCRIPTION("AHCI SATA platform driver");
166 MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
167 MODULE_LICENSE("GPL");
168 -MODULE_ALIAS("platform:ahci");
170 +++ b/drivers/ata/ahci_platform.h
173 + * Copyright 2010 MontaVista Software, LLC.
174 + * Copyright 2010 Cavium Networks
176 + * Authors: Anton Vorontsov <avorontsov@xxxxxxxxxx>
177 + * Mac Lin <mkl0301@xxxxxxxxx>
179 + * This program is free software; you can redistribute it and/or modify
180 + * it under the terms of the GNU General Public License version 2 as
181 + * published by the Free Software Foundation.
184 +#ifndef _DRIVERS_SATA_AHCI_PLATFORMS_H
185 +#define _DRIVERS_SATA_AHCI_PLATFORMS_H
187 +extern struct ahci_platform_data cns3xxx_ahci_platform_data;
189 +#endif /*_DRIVERS_SATA_AHCI_PLATFORMS_H*/