diff options
author | Anton Vorontsov <avorontsov@mvista.com> | 2010-03-25 16:10:58 -0400 |
---|---|---|
committer | Anton Vorontsov <avorontsov@mvista.com> | 2010-06-08 09:37:09 -0400 |
commit | 23f5cace4f858ddf40eb0ee77b984d329fd23518 (patch) | |
tree | 939bffc2232efead633ea94548f0491e00e173b2 /arch/arm/mach-cns3xxx | |
parent | 6279d0ea928911f7c747a65e880c36a91b066805 (diff) |
ARM: cns3xxx: Add support for AHCI controllers
CNS3xxx chips have AHCI-compatible SATA controller. This patch adds
the support using generic ahci_platform driver.
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Diffstat (limited to 'arch/arm/mach-cns3xxx')
-rw-r--r-- | arch/arm/mach-cns3xxx/cns3420vb.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-cns3xxx/devices.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-cns3xxx/devices.h | 1 |
3 files changed, 54 insertions, 0 deletions
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c index 04ae1ced60f0..9df8391fd78a 100644 --- a/arch/arm/mach-cns3xxx/cns3420vb.c +++ b/arch/arm/mach-cns3xxx/cns3420vb.c | |||
@@ -118,6 +118,7 @@ static void __init cns3420_init(void) | |||
118 | { | 118 | { |
119 | platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); | 119 | platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); |
120 | 120 | ||
121 | cns3xxx_ahci_init(); | ||
121 | cns3xxx_sdhci_init(); | 122 | cns3xxx_sdhci_init(); |
122 | 123 | ||
123 | pm_power_off = cns3xxx_power_off; | 124 | pm_power_off = cns3xxx_power_off; |
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c index b01a30114622..50b4d31c27c0 100644 --- a/arch/arm/mach-cns3xxx/devices.c +++ b/arch/arm/mach-cns3xxx/devices.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <linux/dma-mapping.h> | ||
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
18 | #include <mach/cns3xxx.h> | 19 | #include <mach/cns3xxx.h> |
19 | #include <mach/irqs.h> | 20 | #include <mach/irqs.h> |
@@ -21,6 +22,57 @@ | |||
21 | #include "devices.h" | 22 | #include "devices.h" |
22 | 23 | ||
23 | /* | 24 | /* |
25 | * AHCI | ||
26 | */ | ||
27 | static struct resource cns3xxx_ahci_resource[] = { | ||
28 | [0] = { | ||
29 | .start = CNS3XXX_SATA2_BASE, | ||
30 | .end = CNS3XXX_SATA2_BASE + CNS3XXX_SATA2_SIZE - 1, | ||
31 | .flags = IORESOURCE_MEM, | ||
32 | }, | ||
33 | [1] = { | ||
34 | .start = IRQ_CNS3XXX_SATA, | ||
35 | .end = IRQ_CNS3XXX_SATA, | ||
36 | .flags = IORESOURCE_IRQ, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | static u64 cns3xxx_ahci_dmamask = DMA_BIT_MASK(32); | ||
41 | |||
42 | static struct platform_device cns3xxx_ahci_pdev = { | ||
43 | .name = "ahci", | ||
44 | .id = 0, | ||
45 | .resource = cns3xxx_ahci_resource, | ||
46 | .num_resources = ARRAY_SIZE(cns3xxx_ahci_resource), | ||
47 | .dev = { | ||
48 | .dma_mask = &cns3xxx_ahci_dmamask, | ||
49 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | void __init cns3xxx_ahci_init(void) | ||
54 | { | ||
55 | u32 tmp; | ||
56 | |||
57 | tmp = __raw_readl(MISC_SATA_POWER_MODE); | ||
58 | tmp |= 0x1 << 16; /* Disable SATA PHY 0 from SLUMBER Mode */ | ||
59 | tmp |= 0x1 << 17; /* Disable SATA PHY 1 from SLUMBER Mode */ | ||
60 | __raw_writel(tmp, MISC_SATA_POWER_MODE); | ||
61 | |||
62 | /* Enable SATA PHY */ | ||
63 | cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0); | ||
64 | cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1); | ||
65 | |||
66 | /* Enable SATA Clock */ | ||
67 | cns3xxx_pwr_clk_en(0x1 << PM_CLK_GATE_REG_OFFSET_SATA); | ||
68 | |||
69 | /* De-Asscer SATA Reset */ | ||
70 | cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SATA)); | ||
71 | |||
72 | platform_device_register(&cns3xxx_ahci_pdev); | ||
73 | } | ||
74 | |||
75 | /* | ||
24 | * SDHCI | 76 | * SDHCI |
25 | */ | 77 | */ |
26 | static struct resource cns3xxx_sdhci_resources[] = { | 78 | static struct resource cns3xxx_sdhci_resources[] = { |
diff --git a/arch/arm/mach-cns3xxx/devices.h b/arch/arm/mach-cns3xxx/devices.h index 0735a45a3aee..27e15a10aa85 100644 --- a/arch/arm/mach-cns3xxx/devices.h +++ b/arch/arm/mach-cns3xxx/devices.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #ifndef __CNS3XXX_DEVICES_H_ | 14 | #ifndef __CNS3XXX_DEVICES_H_ |
15 | #define __CNS3XXX_DEVICES_H_ | 15 | #define __CNS3XXX_DEVICES_H_ |
16 | 16 | ||
17 | void __init cns3xxx_ahci_init(void); | ||
17 | void __init cns3xxx_sdhci_init(void); | 18 | void __init cns3xxx_sdhci_init(void); |
18 | 19 | ||
19 | #endif /* __CNS3XXX_DEVICES_H_ */ | 20 | #endif /* __CNS3XXX_DEVICES_H_ */ |