aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-01 23:16:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-01 23:16:43 -0400
commit25498e5b3df931a3d52a6e0642ae242e4ee19488 (patch)
tree5a627d71015fde644d8c61a04f7718c2f0a748db /arch/arm/plat-mxc
parent952414505f55afe5cd6dc004765076aa22b3ed7e (diff)
parent995a0605a6665858d73f9e80053414909be33f27 (diff)
Merge branch 'next/driver' of git://git.linaro.org/people/arnd/arm-soc
* 'next/driver' of git://git.linaro.org/people/arnd/arm-soc: hw_random: add driver for atmel true hardware random number generator ARM: at91: at91sam9g45: add trng clock and platform device MX53 Enable the AHCI SATA on MX53 SMD board MX53 Enable the AHCI SATA on MX53 LOCO board MX53 Enable the AHCI SATA on MX53 ARD board AHCI Add the AHCI SATA feature on the MX53 platforms Fix pata imx resource ARM: imx: Define functions for registering PATA ARM: imx: Add PATA clock support ARM: imx: Add PATA resources for other i.MX processors imx: efika: Enable pata. imx51: add pata clock imx51: add pata device Fix up trivial conflict (new selects next to each other from separate branches for EFIKA_COMMON) in arch/arm/mach-mx5/Kconfig
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig7
-rw-r--r--arch/arm/plat-mxc/devices/Makefile2
-rw-r--r--arch/arm/plat-mxc/devices/platform-ahci-imx.c156
-rw-r--r--arch/arm/plat-mxc/devices/platform-pata_imx.c59
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h18
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h2
6 files changed, 243 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 39b08957e8ad..cb3e3eef55c0 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -31,6 +31,9 @@ config IMX_HAVE_PLATFORM_IMX_I2C
31config IMX_HAVE_PLATFORM_IMX_KEYPAD 31config IMX_HAVE_PLATFORM_IMX_KEYPAD
32 bool 32 bool
33 33
34config IMX_HAVE_PLATFORM_PATA_IMX
35 bool
36
34config IMX_HAVE_PLATFORM_IMX_SSI 37config IMX_HAVE_PLATFORM_IMX_SSI
35 bool 38 bool
36 39
@@ -76,3 +79,7 @@ config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
76 79
77config IMX_HAVE_PLATFORM_SPI_IMX 80config IMX_HAVE_PLATFORM_SPI_IMX
78 bool 81 bool
82
83config IMX_HAVE_PLATFORM_AHCI
84 bool
85 default y if ARCH_MX53
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index b41bf972b54b..c11ac8472beb 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -10,6 +10,7 @@ obj-y += platform-imx-dma.o
10obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o 10obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
11obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o 11obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
12obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o 12obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
13obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o
13obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o 14obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
14obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o 15obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
15obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o 16obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
@@ -25,3 +26,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o
25obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o 26obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
26obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o 27obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o
27obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o 28obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
29obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
new file mode 100644
index 000000000000..d8a56aee521b
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
@@ -0,0 +1,156 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/io.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/device.h>
25#include <linux/dma-mapping.h>
26#include <asm/sizes.h>
27#include <mach/hardware.h>
28#include <mach/devices-common.h>
29
30#define imx_ahci_imx_data_entry_single(soc, _devid) \
31 { \
32 .devid = _devid, \
33 .iobase = soc ## _SATA_BASE_ADDR, \
34 .irq = soc ## _INT_SATA, \
35 }
36
37#ifdef CONFIG_SOC_IMX53
38const struct imx_ahci_imx_data imx53_ahci_imx_data __initconst =
39 imx_ahci_imx_data_entry_single(MX53, "imx53-ahci");
40#endif
41
42enum {
43 HOST_CAP = 0x00,
44 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */
45 HOST_PORTS_IMPL = 0x0c,
46 HOST_TIMER1MS = 0xe0, /* Timer 1-ms */
47};
48
49static struct clk *sata_clk, *sata_ref_clk;
50
51/* AHCI module Initialization, if return 0, initialization is successful. */
52static int imx_sata_init(struct device *dev, void __iomem *addr)
53{
54 u32 tmpdata;
55 int ret = 0;
56 struct clk *clk;
57
58 sata_clk = clk_get(dev, "ahci");
59 if (IS_ERR(sata_clk)) {
60 dev_err(dev, "no sata clock.\n");
61 return PTR_ERR(sata_clk);
62 }
63 ret = clk_enable(sata_clk);
64 if (ret) {
65 dev_err(dev, "can't enable sata clock.\n");
66 goto put_sata_clk;
67 }
68
69 /* Get the AHCI SATA PHY CLK */
70 sata_ref_clk = clk_get(dev, "ahci_phy");
71 if (IS_ERR(sata_ref_clk)) {
72 dev_err(dev, "no sata ref clock.\n");
73 ret = PTR_ERR(sata_ref_clk);
74 goto release_sata_clk;
75 }
76 ret = clk_enable(sata_ref_clk);
77 if (ret) {
78 dev_err(dev, "can't enable sata ref clock.\n");
79 goto put_sata_ref_clk;
80 }
81
82 /* Get the AHB clock rate, and configure the TIMER1MS reg later */
83 clk = clk_get(dev, "ahci_dma");
84 if (IS_ERR(clk)) {
85 dev_err(dev, "no dma clock.\n");
86 ret = PTR_ERR(clk);
87 goto release_sata_ref_clk;
88 }
89 tmpdata = clk_get_rate(clk) / 1000;
90 clk_put(clk);
91
92 writel(tmpdata, addr + HOST_TIMER1MS);
93
94 tmpdata = readl(addr + HOST_CAP);
95 if (!(tmpdata & HOST_CAP_SSS)) {
96 tmpdata |= HOST_CAP_SSS;
97 writel(tmpdata, addr + HOST_CAP);
98 }
99
100 if (!(readl(addr + HOST_PORTS_IMPL) & 0x1))
101 writel((readl(addr + HOST_PORTS_IMPL) | 0x1),
102 addr + HOST_PORTS_IMPL);
103
104 return 0;
105
106release_sata_ref_clk:
107 clk_disable(sata_ref_clk);
108put_sata_ref_clk:
109 clk_put(sata_ref_clk);
110release_sata_clk:
111 clk_disable(sata_clk);
112put_sata_clk:
113 clk_put(sata_clk);
114
115 return ret;
116}
117
118static void imx_sata_exit(struct device *dev)
119{
120 clk_disable(sata_ref_clk);
121 clk_put(sata_ref_clk);
122
123 clk_disable(sata_clk);
124 clk_put(sata_clk);
125
126}
127struct platform_device *__init imx_add_ahci_imx(
128 const struct imx_ahci_imx_data *data,
129 const struct ahci_platform_data *pdata)
130{
131 struct resource res[] = {
132 {
133 .start = data->iobase,
134 .end = data->iobase + SZ_4K - 1,
135 .flags = IORESOURCE_MEM,
136 }, {
137 .start = data->irq,
138 .end = data->irq,
139 .flags = IORESOURCE_IRQ,
140 },
141 };
142
143 return imx_add_platform_device_dmamask(data->devid, 0,
144 res, ARRAY_SIZE(res),
145 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
146}
147
148struct platform_device *__init imx53_add_ahci_imx(void)
149{
150 struct ahci_platform_data pdata = {
151 .init = imx_sata_init,
152 .exit = imx_sata_exit,
153 };
154
155 return imx_add_ahci_imx(&imx53_ahci_imx_data, &pdata);
156}
diff --git a/arch/arm/plat-mxc/devices/platform-pata_imx.c b/arch/arm/plat-mxc/devices/platform-pata_imx.c
new file mode 100644
index 000000000000..70e2f2a44714
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-pata_imx.c
@@ -0,0 +1,59 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it under
3 * the terms of the GNU General Public License version 2 as published by the
4 * Free Software Foundation.
5 */
6#include <mach/hardware.h>
7#include <mach/devices-common.h>
8
9#define imx_pata_imx_data_entry_single(soc, _size) \
10 { \
11 .iobase = soc ## _ATA_BASE_ADDR, \
12 .iosize = _size, \
13 .irq = soc ## _INT_ATA, \
14 }
15
16#ifdef CONFIG_SOC_IMX27
17const struct imx_pata_imx_data imx27_pata_imx_data __initconst =
18 imx_pata_imx_data_entry_single(MX27, SZ_4K);
19#endif /* ifdef CONFIG_SOC_IMX27 */
20
21#ifdef CONFIG_SOC_IMX31
22const struct imx_pata_imx_data imx31_pata_imx_data __initconst =
23 imx_pata_imx_data_entry_single(MX31, SZ_16K);
24#endif /* ifdef CONFIG_SOC_IMX31 */
25
26#ifdef CONFIG_SOC_IMX35
27const struct imx_pata_imx_data imx35_pata_imx_data __initconst =
28 imx_pata_imx_data_entry_single(MX35, SZ_16K);
29#endif /* ifdef CONFIG_SOC_IMX35 */
30
31#ifdef CONFIG_SOC_IMX51
32const struct imx_pata_imx_data imx51_pata_imx_data __initconst =
33 imx_pata_imx_data_entry_single(MX51, SZ_16K);
34#endif /* ifdef CONFIG_SOC_IMX51 */
35
36#ifdef CONFIG_SOC_IMX53
37const struct imx_pata_imx_data imx53_pata_imx_data __initconst =
38 imx_pata_imx_data_entry_single(MX53, SZ_16K);
39#endif /* ifdef CONFIG_SOC_IMX53 */
40
41struct platform_device *__init imx_add_pata_imx(
42 const struct imx_pata_imx_data *data)
43{
44 struct resource res[] = {
45 {
46 .start = data->iobase,
47 .end = data->iobase + data->iosize - 1,
48 .flags = IORESOURCE_MEM,
49 },
50 {
51 .start = data->irq,
52 .end = data->irq,
53 .flags = IORESOURCE_IRQ,
54 },
55 };
56 return imx_add_platform_device("pata_imx", -1,
57 res, ARRAY_SIZE(res), NULL, 0);
58}
59
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 543525d76a60..def9ba53e23a 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -263,6 +263,14 @@ struct platform_device *__init imx_add_mxc_nand(
263 const struct imx_mxc_nand_data *data, 263 const struct imx_mxc_nand_data *data,
264 const struct mxc_nand_platform_data *pdata); 264 const struct mxc_nand_platform_data *pdata);
265 265
266struct imx_pata_imx_data {
267 resource_size_t iobase;
268 resource_size_t iosize;
269 resource_size_t irq;
270};
271struct platform_device *__init imx_add_pata_imx(
272 const struct imx_pata_imx_data *data);
273
266struct imx_mxc_pwm_data { 274struct imx_mxc_pwm_data {
267 int id; 275 int id;
268 resource_size_t iobase; 276 resource_size_t iobase;
@@ -313,3 +321,13 @@ struct platform_device *__init imx_add_spi_imx(
313struct platform_device *imx_add_imx_dma(void); 321struct platform_device *imx_add_imx_dma(void);
314struct platform_device *imx_add_imx_sdma(char *name, 322struct platform_device *imx_add_imx_sdma(char *name,
315 resource_size_t iobase, int irq, struct sdma_platform_data *pdata); 323 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
324
325#include <linux/ahci_platform.h>
326struct imx_ahci_imx_data {
327 const char *devid;
328 resource_size_t iobase;
329 resource_size_t irq;
330};
331struct platform_device *__init imx_add_ahci_imx(
332 const struct imx_ahci_imx_data *data,
333 const struct ahci_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index d13dbfeef08a..80965a99aa55 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -36,7 +36,7 @@
36#define MX35_UART3_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x0c000) 36#define MX35_UART3_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x0c000)
37#define MX35_CSPI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x10000) 37#define MX35_CSPI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x10000)
38#define MX35_SSI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x14000) 38#define MX35_SSI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x14000)
39#define MX35_ATA_DMA_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x20000) 39#define MX35_ATA_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x20000)
40#define MX35_MSHC1_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x24000) 40#define MX35_MSHC1_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x24000)
41#define MX35_FEC_BASE_ADDR 0x50038000 41#define MX35_FEC_BASE_ADDR 0x50038000
42#define MX35_SPBA_CTRL_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x3c000) 42#define MX35_SPBA_CTRL_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x3c000)