]>
Commit | Line | Data |
---|---|---|
2b230b77 SS |
1 | From 8e890a259208dbe3aba6f46f7c3a213269d8f123 Mon Sep 17 00:00:00 2001 |
2 | From: Allen Ibara <allen@zee.aero> | |
3 | Date: Tue, 4 Dec 2012 20:44:26 -0800 | |
4 | Subject: [PATCH 2/5] Add IMX6Q AHCI support | |
5 | ||
6 | Adds ahci_platform bits to make AHCI work on sabrelite IMX6Q board. | |
7 | ||
8 | Signed-off-by: Allen Ibara <allen@zee.aero> | |
9 | Signed-off-by: Robert Nelson <robertcnelson@gmail.com> | |
10 | --- | |
11 | ||
12 | diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c | |
13 | index 7a8a284..d324cdf 100644 | |
14 | --- a/drivers/ata/ahci_platform.c | |
15 | +++ b/drivers/ata/ahci_platform.c | |
16 | @@ -23,6 +23,9 @@ | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/libata.h> | |
19 | #include <linux/ahci_platform.h> | |
20 | +#include <linux/of.h> | |
21 | +#include <linux/of_device.h> | |
22 | +#include <linux/of_gpio.h> | |
23 | #include "ahci.h" | |
24 | ||
25 | static void ahci_host_stop(struct ata_host *host); | |
26 | @@ -30,6 +33,7 @@ static void ahci_host_stop(struct ata_host *host); | |
27 | enum ahci_type { | |
28 | AHCI, /* standard platform ahci */ | |
29 | IMX53_AHCI, /* ahci on i.mx53 */ | |
30 | + IMX6Q_AHCI, /* ahci on i.mx6q */ | |
31 | STRICT_AHCI, /* delayed DMA engine start */ | |
32 | }; | |
33 | ||
34 | @@ -41,6 +45,9 @@ static struct platform_device_id ahci_devtype[] = { | |
35 | .name = "imx53-ahci", | |
36 | .driver_data = IMX53_AHCI, | |
37 | }, { | |
38 | + .name = "imx6q-ahci", | |
39 | + .driver_data = IMX53_AHCI, | |
40 | + }, { | |
41 | .name = "strict-ahci", | |
42 | .driver_data = STRICT_AHCI, | |
43 | }, { | |
44 | @@ -86,12 +93,24 @@ static struct scsi_host_template ahci_platform_sht = { | |
45 | AHCI_SHT("ahci_platform"), | |
46 | }; | |
47 | ||
48 | +static const struct of_device_id ahci_of_match[] = { | |
49 | + { .compatible = "calxeda,hb-ahci", .data = &ahci_devtype[AHCI],}, | |
50 | + { .compatible = "fsl,imx6q-ahci", .data = &ahci_devtype[IMX6Q_AHCI],}, | |
51 | + { .compatible = "snps,spear-ahci", }, | |
52 | + {}, | |
53 | +}; | |
54 | +MODULE_DEVICE_TABLE(of, ahci_of_match); | |
55 | + | |
56 | static int ahci_probe(struct platform_device *pdev) | |
57 | { | |
58 | struct device *dev = &pdev->dev; | |
59 | struct ahci_platform_data *pdata = dev_get_platdata(dev); | |
60 | + const struct of_device_id *of_id = | |
61 | + of_match_device(ahci_of_match, &pdev->dev); | |
62 | + const struct platform_device_id *id_entry = of_id->data; | |
63 | const struct platform_device_id *id = platform_get_device_id(pdev); | |
64 | - struct ata_port_info pi = ahci_port_info[id ? id->driver_data : 0]; | |
65 | + struct ata_port_info pi = ahci_port_info[id ? id->driver_data : \ | |
66 | + id_entry->driver_data]; | |
67 | const struct ata_port_info *ppi[] = { &pi, NULL }; | |
68 | struct ahci_host_priv *hpriv; | |
69 | struct ata_host *host; | |
70 | @@ -325,12 +344,6 @@ disable_unprepare_clk: | |
71 | ||
72 | static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); | |
73 | ||
74 | -static const struct of_device_id ahci_of_match[] = { | |
75 | - { .compatible = "snps,spear-ahci", }, | |
76 | - {}, | |
77 | -}; | |
78 | -MODULE_DEVICE_TABLE(of, ahci_of_match); | |
79 | - | |
80 | static struct platform_driver ahci_driver = { | |
81 | .probe = ahci_probe, | |
82 | .remove = ata_platform_remove_one, | |
83 | -- | |
84 | 1.7.10.4 | |
85 |