aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r--arch/arm/mach-mxs/Kconfig4
-rw-r--r--arch/arm/mach-mxs/clock-mx23.c13
-rw-r--r--arch/arm/mach-mxs/clock-mx28.c14
-rw-r--r--arch/arm/mach-mxs/devices-mx23.h4
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h4
-rw-r--r--arch/arm/mach-mxs/devices.c17
-rw-r--r--arch/arm/mach-mxs/devices/Kconfig3
-rw-r--r--arch/arm/mach-mxs/devices/Makefile2
-rw-r--r--arch/arm/mach-mxs/devices/amba-duart.c40
-rw-r--r--arch/arm/mach-mxs/devices/platform-duart.c48
-rw-r--r--arch/arm/mach-mxs/devices/platform-fec.c2
-rw-r--r--arch/arm/mach-mxs/include/mach/devices-common.h11
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c26
13 files changed, 116 insertions, 72 deletions
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index c4ac7b415195..8bfc8df54617 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -15,7 +15,7 @@ comment "MXS platforms:"
15config MACH_MX23EVK 15config MACH_MX23EVK
16 bool "Support MX23EVK Platform" 16 bool "Support MX23EVK Platform"
17 select SOC_IMX23 17 select SOC_IMX23
18 select MXS_HAVE_PLATFORM_DUART 18 select MXS_HAVE_AMBA_DUART
19 default y 19 default y
20 help 20 help
21 Include support for MX23EVK platform. This includes specific 21 Include support for MX23EVK platform. This includes specific
@@ -24,7 +24,7 @@ config MACH_MX23EVK
24config MACH_MX28EVK 24config MACH_MX28EVK
25 bool "Support MX28EVK Platform" 25 bool "Support MX28EVK Platform"
26 select SOC_IMX28 26 select SOC_IMX28
27 select MXS_HAVE_PLATFORM_DUART 27 select MXS_HAVE_AMBA_DUART
28 select MXS_HAVE_PLATFORM_FEC 28 select MXS_HAVE_PLATFORM_FEC
29 default y 29 default y
30 help 30 help
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index 8f5a19ab558c..b1a362ebfded 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/clkdev.h>
24 25
25#include <asm/clkdev.h> 26#include <asm/clkdev.h>
26#include <asm/div64.h> 27#include <asm/div64.h>
@@ -437,10 +438,12 @@ _DEFINE_CLOCK(clk32k_clk, XTAL, TIMROT_CLK32K_GATE, &ref_xtal_clk);
437 }, 438 },
438 439
439static struct clk_lookup lookups[] = { 440static struct clk_lookup lookups[] = {
440 _REGISTER_CLOCK("mxs-duart.0", NULL, uart_clk) 441 /* for amba bus driver */
442 _REGISTER_CLOCK("duart", "apb_pclk", xbus_clk)
443 /* for amba-pl011 driver */
444 _REGISTER_CLOCK("duart", NULL, uart_clk)
441 _REGISTER_CLOCK("rtc", NULL, rtc_clk) 445 _REGISTER_CLOCK("rtc", NULL, rtc_clk)
442 _REGISTER_CLOCK(NULL, "hclk", hbus_clk) 446 _REGISTER_CLOCK(NULL, "hclk", hbus_clk)
443 _REGISTER_CLOCK(NULL, "xclk", xbus_clk)
444 _REGISTER_CLOCK(NULL, "usb", usb_clk) 447 _REGISTER_CLOCK(NULL, "usb", usb_clk)
445 _REGISTER_CLOCK(NULL, "audio", audio_clk) 448 _REGISTER_CLOCK(NULL, "audio", audio_clk)
446 _REGISTER_CLOCK(NULL, "pwm", pwm_clk) 449 _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
@@ -518,6 +521,12 @@ int __init mx23_clocks_init(void)
518{ 521{
519 clk_misc_init(); 522 clk_misc_init();
520 523
524 clk_enable(&cpu_clk);
525 clk_enable(&hbus_clk);
526 clk_enable(&xbus_clk);
527 clk_enable(&emi_clk);
528 clk_enable(&uart_clk);
529
521 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 530 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
522 531
523 mxs_timer_init(&clk32k_clk, MX23_INT_TIMER0); 532 mxs_timer_init(&clk32k_clk, MX23_INT_TIMER0);
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 74e2103c6011..56312c092a9e 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/clkdev.h>
24 25
25#include <asm/clkdev.h> 26#include <asm/clkdev.h>
26#include <asm/div64.h> 27#include <asm/div64.h>
@@ -602,7 +603,12 @@ _DEFINE_CLOCK(fec_clk, ENET, DISABLE, &hbus_clk);
602 }, 603 },
603 604
604static struct clk_lookup lookups[] = { 605static struct clk_lookup lookups[] = {
605 _REGISTER_CLOCK("mxs-duart.0", NULL, uart_clk) 606 /* for amba bus driver */
607 _REGISTER_CLOCK("duart", "apb_pclk", xbus_clk)
608 /* for amba-pl011 driver */
609 _REGISTER_CLOCK("duart", NULL, uart_clk)
610 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
611 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
606 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 612 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
607 _REGISTER_CLOCK("rtc", NULL, rtc_clk) 613 _REGISTER_CLOCK("rtc", NULL, rtc_clk)
608 _REGISTER_CLOCK("pll2", NULL, pll2_clk) 614 _REGISTER_CLOCK("pll2", NULL, pll2_clk)
@@ -726,6 +732,12 @@ int __init mx28_clocks_init(void)
726{ 732{
727 clk_misc_init(); 733 clk_misc_init();
728 734
735 clk_enable(&cpu_clk);
736 clk_enable(&hbus_clk);
737 clk_enable(&xbus_clk);
738 clk_enable(&emi_clk);
739 clk_enable(&uart_clk);
740
729 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 741 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
730 742
731 mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0); 743 mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index d0f49fc0abb5..1256788561d0 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -11,6 +11,6 @@
11#include <mach/mx23.h> 11#include <mach/mx23.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13 13
14extern const struct mxs_duart_data mx23_duart_data __initconst; 14extern const struct amba_device mx23_duart_device __initconst;
15#define mx23_add_duart() \ 15#define mx23_add_duart() \
16 mxs_add_duart(&mx23_duart_data) 16 mxs_add_duart(&mx23_duart_device)
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 00b736c434ba..33773a6333a2 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -11,9 +11,9 @@
11#include <mach/mx28.h> 11#include <mach/mx28.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13 13
14extern const struct mxs_duart_data mx28_duart_data __initconst; 14extern const struct amba_device mx28_duart_device __initconst;
15#define mx28_add_duart() \ 15#define mx28_add_duart() \
16 mxs_add_duart(&mx28_duart_data) 16 mxs_add_duart(&mx28_duart_device)
17 17
18extern const struct mxs_fec_data mx28_fec_data[] __initconst; 18extern const struct mxs_fec_data mx28_fec_data[] __initconst;
19#define mx28_add_fec(id, pdata) \ 19#define mx28_add_fec(id, pdata) \
diff --git a/arch/arm/mach-mxs/devices.c b/arch/arm/mach-mxs/devices.c
index 6b60f02ca2e3..c20d54740b0b 100644
--- a/arch/arm/mach-mxs/devices.c
+++ b/arch/arm/mach-mxs/devices.c
@@ -19,9 +19,8 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/err.h>
23#include <linux/platform_device.h> 22#include <linux/platform_device.h>
24#include <mach/common.h> 23#include <linux/amba/bus.h>
25 24
26struct platform_device *__init mxs_add_platform_device_dmamask( 25struct platform_device *__init mxs_add_platform_device_dmamask(
27 const char *name, int id, 26 const char *name, int id,
@@ -73,3 +72,17 @@ err:
73 72
74 return pdev; 73 return pdev;
75} 74}
75
76int __init mxs_add_amba_device(const struct amba_device *dev)
77{
78 struct amba_device *adev = kmalloc(sizeof(*adev), GFP_KERNEL);
79
80 if (!adev) {
81 pr_err("%s: failed to allocate memory", __func__);
82 return -ENOMEM;
83 }
84
85 *adev = *dev;
86
87 return amba_device_register(adev, &iomem_resource);
88}
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index a35a2dc55395..cf7dc1ae575b 100644
--- a/arch/arm/mach-mxs/devices/Kconfig
+++ b/arch/arm/mach-mxs/devices/Kconfig
@@ -1,5 +1,6 @@
1config MXS_HAVE_PLATFORM_DUART 1config MXS_HAVE_AMBA_DUART
2 bool 2 bool
3 select ARM_AMBA
3 4
4config MXS_HAVE_PLATFORM_FEC 5config MXS_HAVE_PLATFORM_FEC
5 bool 6 bool
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
index 4b5266a3e6d9..d0a09f6934b8 100644
--- a/arch/arm/mach-mxs/devices/Makefile
+++ b/arch/arm/mach-mxs/devices/Makefile
@@ -1,2 +1,2 @@
1obj-$(CONFIG_MXS_HAVE_PLATFORM_DUART) += platform-duart.o 1obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
2obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o 2obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
diff --git a/arch/arm/mach-mxs/devices/amba-duart.c b/arch/arm/mach-mxs/devices/amba-duart.c
new file mode 100644
index 000000000000..a559db09b49c
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/amba-duart.c
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License version 2 as published by the
9 * Free Software Foundation.
10 */
11#include <asm/irq.h>
12#include <mach/mx23.h>
13#include <mach/mx28.h>
14#include <mach/devices-common.h>
15
16#define MXS_AMBA_DUART_DEVICE(name, soc) \
17const struct amba_device name##_device __initconst = { \
18 .dev = { \
19 .init_name = "duart", \
20 }, \
21 .res = { \
22 .start = soc ## _DUART_BASE_ADDR, \
23 .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \
24 .flags = IORESOURCE_MEM, \
25 }, \
26 .irq = {soc ## _INT_DUART, NO_IRQ}, \
27}
28
29#ifdef CONFIG_SOC_IMX23
30MXS_AMBA_DUART_DEVICE(mx23_duart, MX23);
31#endif
32
33#ifdef CONFIG_SOC_IMX28
34MXS_AMBA_DUART_DEVICE(mx28_duart, MX28);
35#endif
36
37int __init mxs_add_duart(const struct amba_device *dev)
38{
39 return mxs_add_amba_device(dev);
40}
diff --git a/arch/arm/mach-mxs/devices/platform-duart.c b/arch/arm/mach-mxs/devices/platform-duart.c
deleted file mode 100644
index 2fe0df5b0aad..000000000000
--- a/arch/arm/mach-mxs/devices/platform-duart.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License version 2 as published by the
9 * Free Software Foundation.
10 */
11#include <mach/mx23.h>
12#include <mach/mx28.h>
13#include <mach/devices-common.h>
14
15#define mxs_duart_data_entry(soc) \
16 { \
17 .iobase = soc ## _DUART_BASE_ADDR, \
18 .irq = soc ## _INT_DUART, \
19 }
20
21#ifdef CONFIG_SOC_IMX23
22const struct mxs_duart_data mx23_duart_data __initconst =
23 mxs_duart_data_entry(MX23);
24#endif
25
26#ifdef CONFIG_SOC_IMX28
27const struct mxs_duart_data mx28_duart_data __initconst =
28 mxs_duart_data_entry(MX28);
29#endif
30
31struct platform_device *__init mxs_add_duart(
32 const struct mxs_duart_data *data)
33{
34 struct resource res[] = {
35 {
36 .start = data->iobase,
37 .end = data->iobase + SZ_8K - 1,
38 .flags = IORESOURCE_MEM,
39 }, {
40 .start = data->irq,
41 .end = data->irq,
42 .flags = IORESOURCE_IRQ,
43 },
44 };
45
46 return mxs_add_platform_device("mxs-duart", 0, res, ARRAY_SIZE(res),
47 NULL, 0);
48}
diff --git a/arch/arm/mach-mxs/devices/platform-fec.c b/arch/arm/mach-mxs/devices/platform-fec.c
index c08168cf3dec..c42dff72b46c 100644
--- a/arch/arm/mach-mxs/devices/platform-fec.c
+++ b/arch/arm/mach-mxs/devices/platform-fec.c
@@ -45,6 +45,6 @@ struct platform_device *__init mxs_add_fec(
45 }, 45 },
46 }; 46 };
47 47
48 return mxs_add_platform_device("fec", data->id, 48 return mxs_add_platform_device("imx28-fec", data->id,
49 res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 49 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
50} 50}
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index 3da48d4d3273..6c3d1a103433 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/amba/bus.h>
12 13
13struct platform_device *mxs_add_platform_device_dmamask( 14struct platform_device *mxs_add_platform_device_dmamask(
14 const char *name, int id, 15 const char *name, int id,
@@ -24,14 +25,10 @@ static inline struct platform_device *mxs_add_platform_device(
24 name, id, res, num_resources, data, size_data, 0); 25 name, id, res, num_resources, data, size_data, 0);
25} 26}
26 27
28int __init mxs_add_amba_device(const struct amba_device *dev);
29
27/* duart */ 30/* duart */
28struct mxs_duart_data { 31int __init mxs_add_duart(const struct amba_device *dev);
29 resource_size_t iobase;
30 resource_size_t iosize;
31 resource_size_t irq;
32};
33struct platform_device *__init mxs_add_duart(
34 const struct mxs_duart_data *data);
35 32
36/* fec */ 33/* fec */
37#include <linux/fec.h> 34#include <linux/fec.h>
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index d162e95910f3..8e2c5975001e 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -57,6 +57,19 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
57 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 57 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
58 MX28_PAD_ENET_CLK__CLKCTRL_ENET | 58 MX28_PAD_ENET_CLK__CLKCTRL_ENET |
59 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 59 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
60 /* fec1 */
61 MX28_PAD_ENET0_CRS__ENET1_RX_EN |
62 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
63 MX28_PAD_ENET0_RXD2__ENET1_RXD0 |
64 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
65 MX28_PAD_ENET0_RXD3__ENET1_RXD1 |
66 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
67 MX28_PAD_ENET0_COL__ENET1_TX_EN |
68 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
69 MX28_PAD_ENET0_TXD2__ENET1_TXD0 |
70 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
71 MX28_PAD_ENET0_TXD3__ENET1_TXD1 |
72 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
60 /* phy power line */ 73 /* phy power line */
61 MX28_PAD_SSP1_DATA3__GPIO_2_15 | 74 MX28_PAD_SSP1_DATA3__GPIO_2_15 |
62 (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 75 (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
@@ -106,8 +119,14 @@ static void __init mx28evk_fec_reset(void)
106 gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); 119 gpio_set_value(MX28EVK_FEC_PHY_RESET, 1);
107} 120}
108 121
109static const struct fec_platform_data mx28_fec_pdata __initconst = { 122static struct fec_platform_data mx28_fec_pdata[] = {
110 .phy = PHY_INTERFACE_MODE_RMII, 123 {
124 /* fec0 */
125 .phy = PHY_INTERFACE_MODE_RMII,
126 }, {
127 /* fec1 */
128 .phy = PHY_INTERFACE_MODE_RMII,
129 },
111}; 130};
112 131
113static void __init mx28evk_init(void) 132static void __init mx28evk_init(void)
@@ -117,7 +136,8 @@ static void __init mx28evk_init(void)
117 mx28_add_duart(); 136 mx28_add_duart();
118 137
119 mx28evk_fec_reset(); 138 mx28evk_fec_reset();
120 mx28_add_fec(0, &mx28_fec_pdata); 139 mx28_add_fec(0, &mx28_fec_pdata[0]);
140 mx28_add_fec(1, &mx28_fec_pdata[1]);
121} 141}
122 142
123static void __init mx28evk_timer_init(void) 143static void __init mx28evk_timer_init(void)