aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx5
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-10-11 12:30:44 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-10-11 12:30:44 -0400
commitc9ee46a910f6edb40ddb7fb9aeac0030057c6fdb (patch)
treeeede22c95d61618360b6059e082f579cbe681e2b /arch/arm/mach-mx5
parent4fa046655b80e9bb361a95da5c86ce778f5018b9 (diff)
parent81490fcdf406f42fff9d9f57d541788f90242885 (diff)
Merge branch 'for-rmk-next' of git://git.pengutronix.de/git/imx/linux-2.6 into devel-stable
Diffstat (limited to 'arch/arm/mach-mx5')
-rw-r--r--arch/arm/mach-mx5/Kconfig14
-rw-r--r--arch/arm/mach-mx5/Makefile1
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c14
-rw-r--r--arch/arm/mach-mx5/board-mx51_3ds.c42
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c72
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikamx.c121
-rw-r--r--arch/arm/mach-mx5/clock-mx51.c231
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h38
-rw-r--r--arch/arm/mach-mx5/devices.c114
-rw-r--r--arch/arm/mach-mx5/devices.h6
-rw-r--r--arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c7
11 files changed, 480 insertions, 180 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 0848db5dd364..fad31cc5004b 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -5,11 +5,14 @@ config ARCH_MX51
5 default y 5 default y
6 select MXC_TZIC 6 select MXC_TZIC
7 select ARCH_MXC_IOMUX_V3 7 select ARCH_MXC_IOMUX_V3
8 select ARCH_MXC_AUDMUX_V2
8 9
9comment "MX5 platforms:" 10comment "MX5 platforms:"
10 11
11config MACH_MX51_BABBAGE 12config MACH_MX51_BABBAGE
12 bool "Support MX51 BABBAGE platforms" 13 bool "Support MX51 BABBAGE platforms"
14 select IMX_HAVE_PLATFORM_IMX_I2C
15 select IMX_HAVE_PLATFORM_IMX_UART
13 help 16 help
14 Include support for MX51 Babbage platform, also known as MX51EVK in 17 Include support for MX51 Babbage platform, also known as MX51EVK in
15 u-boot. This includes specific configurations for the board and its 18 u-boot. This includes specific configurations for the board and its
@@ -17,6 +20,8 @@ config MACH_MX51_BABBAGE
17 20
18config MACH_MX51_3DS 21config MACH_MX51_3DS
19 bool "Support MX51PDK (3DS)" 22 bool "Support MX51PDK (3DS)"
23 select IMX_HAVE_PLATFORM_IMX_UART
24 select IMX_HAVE_PLATFORM_SPI_IMX
20 select MXC_DEBUG_BOARD 25 select MXC_DEBUG_BOARD
21 help 26 help
22 Include support for MX51PDK (3DS) platform. This includes specific 27 Include support for MX51PDK (3DS) platform. This includes specific
@@ -24,6 +29,8 @@ config MACH_MX51_3DS
24 29
25config MACH_EUKREA_CPUIMX51 30config MACH_EUKREA_CPUIMX51
26 bool "Support Eukrea CPUIMX51 module" 31 bool "Support Eukrea CPUIMX51 module"
32 select IMX_HAVE_PLATFORM_IMX_I2C
33 select IMX_HAVE_PLATFORM_IMX_UART
27 help 34 help
28 Include support for Eukrea CPUIMX51 platform. This includes 35 Include support for Eukrea CPUIMX51 platform. This includes
29 specific configurations for the module and its peripherals. 36 specific configurations for the module and its peripherals.
@@ -42,4 +49,11 @@ config MACH_EUKREA_MBIMX51_BASEBOARD
42 49
43endchoice 50endchoice
44 51
52config MACH_MX51_EFIKAMX
53 bool "Support MX51 Genesi Efika MX nettop"
54 select IMX_HAVE_PLATFORM_IMX_UART
55 help
56 Include support for Genesi Efika MX nettop. This includes specific
57 configurations for the board and its peripherals.
58
45endif 59endif
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 86c66e7f52f3..d1aac9c3d33c 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o 9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o 10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
11obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o 11obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
12obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 623607a20f57..61f051043bbc 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -28,9 +28,7 @@
28#include <mach/eukrea-baseboards.h> 28#include <mach/eukrea-baseboards.h>
29#include <mach/common.h> 29#include <mach/common.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/imx-uart.h>
32#include <mach/iomux-mx51.h> 31#include <mach/iomux-mx51.h>
33#include <mach/i2c.h>
34#include <mach/mxc_ehci.h> 32#include <mach/mxc_ehci.h>
35 33
36#include <asm/irq.h> 34#include <asm/irq.h>
@@ -39,6 +37,7 @@
39#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 38#include <asm/mach/time.h>
41 39
40#include "devices-imx51.h"
42#include "devices.h" 41#include "devices.h"
43 42
44#define CPUIMX51_USBH1_STP (0*32 + 27) 43#define CPUIMX51_USBH1_STP (0*32 + 27)
@@ -109,7 +108,6 @@ static struct platform_device serial_device = {
109#endif 108#endif
110 109
111static struct platform_device *devices[] __initdata = { 110static struct platform_device *devices[] __initdata = {
112 &mxc_fec_device,
113#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 111#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
114 &serial_device, 112 &serial_device,
115#endif 113#endif
@@ -148,11 +146,12 @@ static struct pad_desc eukrea_cpuimx51_pads[] = {
148 MX51_PAD_USBH1_STP__USBH1_STP, 146 MX51_PAD_USBH1_STP__USBH1_STP,
149}; 147};
150 148
151static struct imxuart_platform_data uart_pdata = { 149static const struct imxuart_platform_data uart_pdata __initconst = {
152 .flags = IMXUART_HAVE_RTSCTS, 150 .flags = IMXUART_HAVE_RTSCTS,
153}; 151};
154 152
155static struct imxi2c_platform_data eukrea_cpuimx51_i2c_data = { 153static const
154struct imxi2c_platform_data eukrea_cpuimx51_i2c_data __initconst = {
156 .bitrate = 100000, 155 .bitrate = 100000,
157}; 156};
158 157
@@ -239,7 +238,7 @@ static void __init eukrea_cpuimx51_init(void)
239 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads, 238 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
240 ARRAY_SIZE(eukrea_cpuimx51_pads)); 239 ARRAY_SIZE(eukrea_cpuimx51_pads));
241 240
242 mxc_register_device(&mxc_uart_device0, &uart_pdata); 241 imx51_add_imx_uart(0, &uart_pdata);
243 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq"); 242 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
244 gpio_direction_input(CPUIMX51_QUARTA_GPIO); 243 gpio_direction_input(CPUIMX51_QUARTA_GPIO);
245 gpio_free(CPUIMX51_QUARTA_GPIO); 244 gpio_free(CPUIMX51_QUARTA_GPIO);
@@ -253,9 +252,10 @@ static void __init eukrea_cpuimx51_init(void)
253 gpio_direction_input(CPUIMX51_QUARTD_GPIO); 252 gpio_direction_input(CPUIMX51_QUARTD_GPIO);
254 gpio_free(CPUIMX51_QUARTD_GPIO); 253 gpio_free(CPUIMX51_QUARTD_GPIO);
255 254
255 imx51_add_fec(NULL);
256 platform_add_devices(devices, ARRAY_SIZE(devices)); 256 platform_add_devices(devices, ARRAY_SIZE(devices));
257 257
258 mxc_register_device(&mxc_i2c_device1, &eukrea_cpuimx51_i2c_data); 258 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
259 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices, 259 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
260 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices)); 260 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
261 261
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
index f95c2fd94667..ed08a2352a1a 100644
--- a/arch/arm/mach-mx5/board-mx51_3ds.c
+++ b/arch/arm/mach-mx5/board-mx51_3ds.c
@@ -13,6 +13,7 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input/matrix_keypad.h> 15#include <linux/input/matrix_keypad.h>
16#include <linux/spi/spi.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
@@ -21,12 +22,13 @@
21#include <mach/hardware.h> 22#include <mach/hardware.h>
22#include <mach/common.h> 23#include <mach/common.h>
23#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
24#include <mach/imx-uart.h>
25#include <mach/3ds_debugboard.h> 25#include <mach/3ds_debugboard.h>
26 26
27#include "devices-imx51.h"
27#include "devices.h" 28#include "devices.h"
28 29
29#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6) 30#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6)
31#define MX51_3DS_ECSPI2_CS (GPIO_PORTC + 28)
30 32
31static struct pad_desc mx51_3ds_pads[] = { 33static struct pad_desc mx51_3ds_pads[] = {
32 /* UART1 */ 34 /* UART1 */
@@ -61,19 +63,25 @@ static struct pad_desc mx51_3ds_pads[] = {
61 MX51_PAD_KEY_COL3__KEY_COL3, 63 MX51_PAD_KEY_COL3__KEY_COL3,
62 MX51_PAD_KEY_COL4__KEY_COL4, 64 MX51_PAD_KEY_COL4__KEY_COL4,
63 MX51_PAD_KEY_COL5__KEY_COL5, 65 MX51_PAD_KEY_COL5__KEY_COL5,
66
67 /* eCSPI2 */
68 MX51_PAD_NANDF_RB2__ECSPI2_SCLK,
69 MX51_PAD_NANDF_RB3__ECSPI2_MISO,
70 MX51_PAD_NANDF_D15__ECSPI2_MOSI,
71 MX51_PAD_NANDF_D12__GPIO_3_28,
64}; 72};
65 73
66/* Serial ports */ 74/* Serial ports */
67#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 75#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
68static struct imxuart_platform_data uart_pdata = { 76static const struct imxuart_platform_data uart_pdata __initconst = {
69 .flags = IMXUART_HAVE_RTSCTS, 77 .flags = IMXUART_HAVE_RTSCTS,
70}; 78};
71 79
72static inline void mxc_init_imx_uart(void) 80static inline void mxc_init_imx_uart(void)
73{ 81{
74 mxc_register_device(&mxc_uart_device0, &uart_pdata); 82 imx51_add_imx_uart(0, &uart_pdata);
75 mxc_register_device(&mxc_uart_device1, &uart_pdata); 83 imx51_add_imx_uart(1, &uart_pdata);
76 mxc_register_device(&mxc_uart_device2, &uart_pdata); 84 imx51_add_imx_uart(2, &uart_pdata);
77} 85}
78#else /* !SERIAL_IMX */ 86#else /* !SERIAL_IMX */
79static inline void mxc_init_imx_uart(void) 87static inline void mxc_init_imx_uart(void)
@@ -127,6 +135,26 @@ static inline void mxc_init_keypad(void)
127} 135}
128#endif 136#endif
129 137
138static int mx51_3ds_spi2_cs[] = {
139 MXC_SPI_CS(0),
140 MX51_3DS_ECSPI2_CS,
141};
142
143static const struct spi_imx_master mx51_3ds_ecspi2_pdata __initconst = {
144 .chipselect = mx51_3ds_spi2_cs,
145 .num_chipselect = ARRAY_SIZE(mx51_3ds_spi2_cs),
146};
147
148static struct spi_board_info mx51_3ds_spi_nor_device[] = {
149 {
150 .modalias = "m25p80",
151 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
152 .bus_num = 1,
153 .chip_select = 1,
154 .mode = SPI_MODE_0,
155 .platform_data = NULL,},
156};
157
130/* 158/*
131 * Board specific initialization. 159 * Board specific initialization.
132 */ 160 */
@@ -136,6 +164,10 @@ static void __init mxc_board_init(void)
136 ARRAY_SIZE(mx51_3ds_pads)); 164 ARRAY_SIZE(mx51_3ds_pads));
137 mxc_init_imx_uart(); 165 mxc_init_imx_uart();
138 166
167 imx51_add_ecspi(1, &mx51_3ds_ecspi2_pdata);
168 spi_register_board_info(mx51_3ds_spi_nor_device,
169 ARRAY_SIZE(mx51_3ds_spi_nor_device));
170
139 if (mxc_expio_init(MX51_CS5_BASE_ADDR, EXPIO_PARENT_INT)) 171 if (mxc_expio_init(MX51_CS5_BASE_ADDR, EXPIO_PARENT_INT))
140 printk(KERN_WARNING "Init of the debugboard failed, all " 172 printk(KERN_WARNING "Init of the debugboard failed, all "
141 "devices on the board are unusable.\n"); 173 "devices on the board are unusable.\n");
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 6e384d92e625..23ee4a447406 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -17,12 +17,11 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/fsl_devices.h> 19#include <linux/fsl_devices.h>
20#include <linux/fec.h>
20 21
21#include <mach/common.h> 22#include <mach/common.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/imx-uart.h>
24#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
25#include <mach/i2c.h>
26#include <mach/mxc_ehci.h> 25#include <mach/mxc_ehci.h>
27 26
28#include <asm/irq.h> 27#include <asm/irq.h>
@@ -31,11 +30,13 @@
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 31#include <asm/mach/time.h>
33 32
33#include "devices-imx51.h"
34#include "devices.h" 34#include "devices.h"
35 35
36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */ 36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */
37#define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ 37#define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */
38#define BABBAGE_PHY_RESET (1*32 +5) /* GPIO_2_5 */ 38#define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */
39#define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */
39 40
40/* USB_CTRL_1 */ 41/* USB_CTRL_1 */
41#define MX51_USB_CTRL_1_OFFSET 0x10 42#define MX51_USB_CTRL_1_OFFSET 0x10
@@ -45,10 +46,6 @@
45#define MX51_USB_PLL_DIV_19_2_MHZ 0x01 46#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
46#define MX51_USB_PLL_DIV_24_MHZ 0x02 47#define MX51_USB_PLL_DIV_24_MHZ 0x02
47 48
48static struct platform_device *devices[] __initdata = {
49 &mxc_fec_device,
50};
51
52static struct pad_desc mx51babbage_pads[] = { 49static struct pad_desc mx51babbage_pads[] = {
53 /* UART1 */ 50 /* UART1 */
54 MX51_PAD_UART1_RXD__UART1_RXD, 51 MX51_PAD_UART1_RXD__UART1_RXD,
@@ -93,19 +90,41 @@ static struct pad_desc mx51babbage_pads[] = {
93 90
94 /* USB HUB reset line*/ 91 /* USB HUB reset line*/
95 MX51_PAD_GPIO_1_7__GPIO_1_7, 92 MX51_PAD_GPIO_1_7__GPIO_1_7,
93
94 /* FEC */
95 MX51_PAD_EIM_EB2__FEC_MDIO,
96 MX51_PAD_EIM_EB3__FEC_RDAT1,
97 MX51_PAD_EIM_CS2__FEC_RDAT2,
98 MX51_PAD_EIM_CS3__FEC_RDAT3,
99 MX51_PAD_EIM_CS4__FEC_RX_ER,
100 MX51_PAD_EIM_CS5__FEC_CRS,
101 MX51_PAD_NANDF_RB2__FEC_COL,
102 MX51_PAD_NANDF_RB3__FEC_RXCLK,
103 MX51_PAD_NANDF_RB6__FEC_RDAT0,
104 MX51_PAD_NANDF_RB7__FEC_TDAT0,
105 MX51_PAD_NANDF_CS2__FEC_TX_ER,
106 MX51_PAD_NANDF_CS3__FEC_MDC,
107 MX51_PAD_NANDF_CS4__FEC_TDAT1,
108 MX51_PAD_NANDF_CS5__FEC_TDAT2,
109 MX51_PAD_NANDF_CS6__FEC_TDAT3,
110 MX51_PAD_NANDF_CS7__FEC_TX_EN,
111 MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK,
112
113 /* FEC PHY reset line */
114 MX51_PAD_EIM_A20__GPIO_2_14,
96}; 115};
97 116
98/* Serial ports */ 117/* Serial ports */
99#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 118#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
100static struct imxuart_platform_data uart_pdata = { 119static const struct imxuart_platform_data uart_pdata __initconst = {
101 .flags = IMXUART_HAVE_RTSCTS, 120 .flags = IMXUART_HAVE_RTSCTS,
102}; 121};
103 122
104static inline void mxc_init_imx_uart(void) 123static inline void mxc_init_imx_uart(void)
105{ 124{
106 mxc_register_device(&mxc_uart_device0, &uart_pdata); 125 imx51_add_imx_uart(0, &uart_pdata);
107 mxc_register_device(&mxc_uart_device1, &uart_pdata); 126 imx51_add_imx_uart(1, &uart_pdata);
108 mxc_register_device(&mxc_uart_device2, &uart_pdata); 127 imx51_add_imx_uart(2, &uart_pdata);
109} 128}
110#else /* !SERIAL_IMX */ 129#else /* !SERIAL_IMX */
111static inline void mxc_init_imx_uart(void) 130static inline void mxc_init_imx_uart(void)
@@ -113,7 +132,7 @@ static inline void mxc_init_imx_uart(void)
113} 132}
114#endif /* SERIAL_IMX */ 133#endif /* SERIAL_IMX */
115 134
116static struct imxi2c_platform_data babbage_i2c_data = { 135static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
117 .bitrate = 100000, 136 .bitrate = 100000,
118}; 137};
119 138
@@ -171,6 +190,22 @@ static inline void babbage_usbhub_reset(void)
171 gpio_set_value(BABBAGE_USB_HUB_RESET, 1); 190 gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
172} 191}
173 192
193static inline void babbage_fec_reset(void)
194{
195 int ret;
196
197 /* reset FEC PHY */
198 ret = gpio_request(BABBAGE_FEC_PHY_RESET, "fec-phy-reset");
199 if (ret) {
200 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
201 return;
202 }
203 gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
204 gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
205 msleep(1);
206 gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
207}
208
174/* This function is board specific as the bit mask for the plldiv will also 209/* This function is board specific as the bit mask for the plldiv will also
175be different for other Freescale SoCs, thus a common bitmask is not 210be different for other Freescale SoCs, thus a common bitmask is not
176possible and cannot get place in /plat-mxc/ehci.c.*/ 211possible and cannot get place in /plat-mxc/ehci.c.*/
@@ -178,7 +213,7 @@ static int initialize_otg_port(struct platform_device *pdev)
178{ 213{
179 u32 v; 214 u32 v;
180 void __iomem *usb_base; 215 void __iomem *usb_base;
181 u32 usbother_base; 216 void __iomem *usbother_base;
182 217
183 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); 218 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
184 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; 219 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
@@ -196,7 +231,7 @@ static int initialize_usbh1_port(struct platform_device *pdev)
196{ 231{
197 u32 v; 232 u32 v;
198 void __iomem *usb_base; 233 void __iomem *usb_base;
199 u32 usbother_base; 234 void __iomem *usbother_base;
200 235
201 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); 236 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
202 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; 237 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
@@ -250,10 +285,11 @@ static void __init mxc_board_init(void)
250 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, 285 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
251 ARRAY_SIZE(mx51babbage_pads)); 286 ARRAY_SIZE(mx51babbage_pads));
252 mxc_init_imx_uart(); 287 mxc_init_imx_uart();
253 platform_add_devices(devices, ARRAY_SIZE(devices)); 288 babbage_fec_reset();
289 imx51_add_fec(NULL);
254 290
255 mxc_register_device(&mxc_i2c_device0, &babbage_i2c_data); 291 imx51_add_imx_i2c(0, &babbage_i2c_data);
256 mxc_register_device(&mxc_i2c_device1, &babbage_i2c_data); 292 imx51_add_imx_i2c(1, &babbage_i2c_data);
257 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); 293 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
258 294
259 if (otg_mode_host) 295 if (otg_mode_host)
@@ -283,7 +319,7 @@ MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board")
283 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */ 319 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */
284 .phys_io = MX51_AIPS1_BASE_ADDR, 320 .phys_io = MX51_AIPS1_BASE_ADDR,
285 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 321 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
286 .boot_params = PHYS_OFFSET + 0x100, 322 .boot_params = MX51_PHYS_OFFSET + 0x100,
287 .map_io = mx51_map_io, 323 .map_io = mx51_map_io,
288 .init_irq = mx51_init_irq, 324 .init_irq = mx51_init_irq,
289 .init_machine = mxc_board_init, 325 .init_machine = mxc_board_init,
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
new file mode 100644
index 000000000000..b00502acdc15
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
@@ -0,0 +1,121 @@
1/*
2 * Copyright (C) 2010 Linaro Limited
3 *
4 * based on code from the following
5 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
7 * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/i2c.h>
20#include <linux/gpio.h>
21#include <linux/delay.h>
22#include <linux/io.h>
23#include <linux/fsl_devices.h>
24
25#include <mach/common.h>
26#include <mach/hardware.h>
27#include <mach/iomux-mx51.h>
28#include <mach/i2c.h>
29#include <mach/mxc_ehci.h>
30
31#include <asm/irq.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/time.h>
36
37#include "devices-imx51.h"
38#include "devices.h"
39
40#define MX51_USB_PLL_DIV_24_MHZ 0x01
41
42static struct pad_desc mx51efikamx_pads[] = {
43 /* UART1 */
44 MX51_PAD_UART1_RXD__UART1_RXD,
45 MX51_PAD_UART1_TXD__UART1_TXD,
46 MX51_PAD_UART1_RTS__UART1_RTS,
47 MX51_PAD_UART1_CTS__UART1_CTS,
48};
49
50/* Serial ports */
51#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
52static const struct imxuart_platform_data uart_pdata = {
53 .flags = IMXUART_HAVE_RTSCTS,
54};
55
56static inline void mxc_init_imx_uart(void)
57{
58 imx51_add_imx_uart(0, &uart_pdata);
59 imx51_add_imx_uart(1, &uart_pdata);
60 imx51_add_imx_uart(2, &uart_pdata);
61}
62#else /* !SERIAL_IMX */
63static inline void mxc_init_imx_uart(void)
64{
65}
66#endif /* SERIAL_IMX */
67
68/* This function is board specific as the bit mask for the plldiv will also
69 * be different for other Freescale SoCs, thus a common bitmask is not
70 * possible and cannot get place in /plat-mxc/ehci.c.
71 */
72static int initialize_otg_port(struct platform_device *pdev)
73{
74 u32 v;
75 void __iomem *usb_base;
76 void __iomem *usbother_base;
77 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
78 usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
79
80 /* Set the PHY clock to 19.2MHz */
81 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
82 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
83 v |= MX51_USB_PLL_DIV_24_MHZ;
84 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
85 iounmap(usb_base);
86 return 0;
87}
88
89static struct mxc_usbh_platform_data dr_utmi_config = {
90 .init = initialize_otg_port,
91 .portsc = MXC_EHCI_UTMI_16BIT,
92 .flags = MXC_EHCI_INTERNAL_PHY,
93};
94
95static void __init mxc_board_init(void)
96{
97 mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
98 ARRAY_SIZE(mx51efikamx_pads));
99 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
100 mxc_init_imx_uart();
101}
102
103static void __init mx51_efikamx_timer_init(void)
104{
105 mx51_clocks_init(32768, 24000000, 22579200, 24576000);
106}
107
108static struct sys_timer mxc_timer = {
109 .init = mx51_efikamx_timer_init,
110};
111
112MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop")
113 /* Maintainer: Amit Kucheria <amit.kucheria@linaro.org> */
114 .phys_io = MX51_AIPS1_BASE_ADDR,
115 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
116 .boot_params = MX51_PHYS_OFFSET + 0x100,
117 .map_io = mx51_map_io,
118 .init_irq = mx51_init_irq,
119 .init_machine = mxc_board_init,
120 .timer = &mxc_timer,
121MACHINE_END
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c
index 57c10a9926cc..21cecc040172 100644
--- a/arch/arm/mach-mx5/clock-mx51.c
+++ b/arch/arm/mach-mx5/clock-mx51.c
@@ -41,34 +41,36 @@ static struct clk usboh3_clk;
41 41
42#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */ 42#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */
43 43
44static int _clk_ccgr_enable(struct clk *clk) 44static void _clk_ccgr_setclk(struct clk *clk, unsigned mode)
45{ 45{
46 u32 reg; 46 u32 reg = __raw_readl(clk->enable_reg);
47
48 reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
49 reg |= mode << clk->enable_shift;
47 50
48 reg = __raw_readl(clk->enable_reg);
49 reg |= MXC_CCM_CCGRx_MOD_ON << clk->enable_shift;
50 __raw_writel(reg, clk->enable_reg); 51 __raw_writel(reg, clk->enable_reg);
52}
51 53
54static int _clk_ccgr_enable(struct clk *clk)
55{
56 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_ON);
52 return 0; 57 return 0;
53} 58}
54 59
55static void _clk_ccgr_disable(struct clk *clk) 60static void _clk_ccgr_disable(struct clk *clk)
56{ 61{
57 u32 reg; 62 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_OFF);
58 reg = __raw_readl(clk->enable_reg); 63}
59 reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
60 __raw_writel(reg, clk->enable_reg);
61 64
65static int _clk_ccgr_enable_inrun(struct clk *clk)
66{
67 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_IDLE);
68 return 0;
62} 69}
63 70
64static void _clk_ccgr_disable_inwait(struct clk *clk) 71static void _clk_ccgr_disable_inwait(struct clk *clk)
65{ 72{
66 u32 reg; 73 _clk_ccgr_setclk(clk, MXC_CCM_CCGRx_MOD_IDLE);
67
68 reg = __raw_readl(clk->enable_reg);
69 reg &= ~(MXC_CCM_CCGRx_CG_MASK << clk->enable_shift);
70 reg |= MXC_CCM_CCGRx_MOD_IDLE << clk->enable_shift;
71 __raw_writel(reg, clk->enable_reg);
72} 74}
73 75
74/* 76/*
@@ -571,6 +573,64 @@ static int _clk_uart_set_parent(struct clk *clk, struct clk *parent)
571 return 0; 573 return 0;
572} 574}
573 575
576#define clk_nfc_set_parent NULL
577
578static unsigned long clk_nfc_get_rate(struct clk *clk)
579{
580 unsigned long rate;
581 u32 reg, div;
582
583 reg = __raw_readl(MXC_CCM_CBCDR);
584 div = ((reg & MXC_CCM_CBCDR_NFC_PODF_MASK) >>
585 MXC_CCM_CBCDR_NFC_PODF_OFFSET) + 1;
586 rate = clk_get_rate(clk->parent) / div;
587 WARN_ON(rate == 0);
588 return rate;
589}
590
591static unsigned long clk_nfc_round_rate(struct clk *clk,
592 unsigned long rate)
593{
594 u32 div;
595 unsigned long parent_rate = clk_get_rate(clk->parent);
596
597 if (!rate)
598 return -EINVAL;
599
600 div = parent_rate / rate;
601
602 if (parent_rate % rate)
603 div++;
604
605 if (div > 8)
606 return -EINVAL;
607
608 return parent_rate / div;
609
610}
611
612static int clk_nfc_set_rate(struct clk *clk, unsigned long rate)
613{
614 u32 reg, div;
615
616 div = clk_get_rate(clk->parent) / rate;
617 if (div == 0)
618 div++;
619 if (((clk_get_rate(clk->parent) / div) != rate) || (div > 8))
620 return -EINVAL;
621
622 reg = __raw_readl(MXC_CCM_CBCDR);
623 reg &= ~MXC_CCM_CBCDR_NFC_PODF_MASK;
624 reg |= (div - 1) << MXC_CCM_CBCDR_NFC_PODF_OFFSET;
625 __raw_writel(reg, MXC_CCM_CBCDR);
626
627 while (__raw_readl(MXC_CCM_CDHIPR) &
628 MXC_CCM_CDHIPR_NFC_IPG_INT_MEM_PODF_BUSY){
629 }
630
631 return 0;
632}
633
574static unsigned long clk_usboh3_get_rate(struct clk *clk) 634static unsigned long clk_usboh3_get_rate(struct clk *clk)
575{ 635{
576 u32 reg, prediv, podf; 636 u32 reg, prediv, podf;
@@ -620,6 +680,17 @@ static unsigned long get_ckih2_reference_clock_rate(struct clk *clk)
620 return ckih2_reference; 680 return ckih2_reference;
621} 681}
622 682
683static unsigned long clk_emi_slow_get_rate(struct clk *clk)
684{
685 u32 reg, div;
686
687 reg = __raw_readl(MXC_CCM_CBCDR);
688 div = ((reg & MXC_CCM_CBCDR_EMI_PODF_MASK) >>
689 MXC_CCM_CBCDR_EMI_PODF_OFFSET) + 1;
690
691 return clk_get_rate(clk->parent) / div;
692}
693
623/* External high frequency clock */ 694/* External high frequency clock */
624static struct clk ckih_clk = { 695static struct clk ckih_clk = {
625 .get_rate = get_high_reference_clock_rate, 696 .get_rate = get_high_reference_clock_rate,
@@ -762,45 +833,105 @@ static struct clk kpp_clk = {
762 .id = 0, 833 .id = 0,
763}; 834};
764 835
765#define DEFINE_CLOCK(name, i, er, es, gr, sr, p, s) \ 836static struct clk emi_slow_clk = {
837 .parent = &pll2_sw_clk,
838 .enable_reg = MXC_CCM_CCGR5,
839 .enable_shift = MXC_CCM_CCGRx_CG8_OFFSET,
840 .enable = _clk_ccgr_enable,
841 .disable = _clk_ccgr_disable_inwait,
842 .get_rate = clk_emi_slow_get_rate,
843};
844
845#define DEFINE_CLOCK1(name, i, er, es, pfx, p, s) \
766 static struct clk name = { \ 846 static struct clk name = { \
767 .id = i, \ 847 .id = i, \
768 .enable_reg = er, \ 848 .enable_reg = er, \
769 .enable_shift = es, \ 849 .enable_shift = es, \
770 .get_rate = gr, \ 850 .get_rate = pfx##_get_rate, \
771 .set_rate = sr, \ 851 .set_rate = pfx##_set_rate, \
852 .round_rate = pfx##_round_rate, \
853 .set_parent = pfx##_set_parent, \
772 .enable = _clk_ccgr_enable, \ 854 .enable = _clk_ccgr_enable, \
773 .disable = _clk_ccgr_disable, \ 855 .disable = _clk_ccgr_disable, \
774 .parent = p, \ 856 .parent = p, \
775 .secondary = s, \ 857 .secondary = s, \
776 } 858 }
777 859
778/* DEFINE_CLOCK(name, id, enable_reg, enable_shift, 860/* eCSPI */
779 get_rate, set_rate, parent, secondary); */ 861static unsigned long clk_ecspi_get_rate(struct clk *clk)
862{
863 u32 reg, pred, podf;
864
865 reg = __raw_readl(MXC_CCM_CSCDR2);
866
867 pred = (reg & MXC_CCM_CSCDR2_CSPI_CLK_PRED_MASK) >>
868 MXC_CCM_CSCDR2_CSPI_CLK_PRED_OFFSET;
869 podf = (reg & MXC_CCM_CSCDR2_CSPI_CLK_PODF_MASK) >>
870 MXC_CCM_CSCDR2_CSPI_CLK_PODF_OFFSET;
871
872 return DIV_ROUND_CLOSEST(clk_get_rate(clk->parent),
873 (pred + 1) * (podf + 1));
874}
875
876static int clk_ecspi_set_parent(struct clk *clk, struct clk *parent)
877{
878 u32 reg, mux;
879
880 mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, &pll3_sw_clk,
881 &lp_apm_clk);
882
883 reg = __raw_readl(MXC_CCM_CSCMR1) & ~MXC_CCM_CSCMR1_CSPI_CLK_SEL_MASK;
884 reg |= mux << MXC_CCM_CSCMR1_CSPI_CLK_SEL_OFFSET;
885 __raw_writel(reg, MXC_CCM_CSCMR1);
886
887 return 0;
888}
889
890static struct clk ecspi_main_clk = {
891 .parent = &pll3_sw_clk,
892 .get_rate = clk_ecspi_get_rate,
893 .set_parent = clk_ecspi_set_parent,
894};
895
896#define DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, e, d, p, s) \
897 static struct clk name = { \
898 .id = i, \
899 .enable_reg = er, \
900 .enable_shift = es, \
901 .get_rate = gr, \
902 .set_rate = sr, \
903 .enable = e, \
904 .disable = d, \
905 .parent = p, \
906 .secondary = s, \
907 }
908
909#define DEFINE_CLOCK(name, i, er, es, gr, sr, p, s) \
910 DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, _clk_ccgr_enable, _clk_ccgr_disable, p, s)
780 911
781/* Shared peripheral bus arbiter */ 912/* Shared peripheral bus arbiter */
782DEFINE_CLOCK(spba_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG0_OFFSET, 913DEFINE_CLOCK(spba_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG0_OFFSET,
783 NULL, NULL, &ipg_clk, NULL); 914 NULL, NULL, &ipg_clk, NULL);
784 915
785/* UART */ 916/* UART */
786DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG4_OFFSET,
787 NULL, NULL, &uart_root_clk, NULL);
788DEFINE_CLOCK(uart2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG6_OFFSET,
789 NULL, NULL, &uart_root_clk, NULL);
790DEFINE_CLOCK(uart3_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG8_OFFSET,
791 NULL, NULL, &uart_root_clk, NULL);
792DEFINE_CLOCK(uart1_ipg_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG3_OFFSET, 917DEFINE_CLOCK(uart1_ipg_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG3_OFFSET,
793 NULL, NULL, &ipg_clk, &aips_tz1_clk); 918 NULL, NULL, &ipg_clk, &aips_tz1_clk);
794DEFINE_CLOCK(uart2_ipg_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG5_OFFSET, 919DEFINE_CLOCK(uart2_ipg_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG5_OFFSET,
795 NULL, NULL, &ipg_clk, &aips_tz1_clk); 920 NULL, NULL, &ipg_clk, &aips_tz1_clk);
796DEFINE_CLOCK(uart3_ipg_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG7_OFFSET, 921DEFINE_CLOCK(uart3_ipg_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG7_OFFSET,
797 NULL, NULL, &ipg_clk, &spba_clk); 922 NULL, NULL, &ipg_clk, &spba_clk);
923DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG4_OFFSET,
924 NULL, NULL, &uart_root_clk, &uart1_ipg_clk);
925DEFINE_CLOCK(uart2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG6_OFFSET,
926 NULL, NULL, &uart_root_clk, &uart2_ipg_clk);
927DEFINE_CLOCK(uart3_clk, 2, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG8_OFFSET,
928 NULL, NULL, &uart_root_clk, &uart3_ipg_clk);
798 929
799/* GPT */ 930/* GPT */
800DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
801 NULL, NULL, &ipg_clk, NULL);
802DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET, 931DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET,
803 NULL, NULL, &ipg_clk, NULL); 932 NULL, NULL, &ipg_clk, NULL);
933DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
934 NULL, NULL, &ipg_clk, &gpt_ipg_clk);
804 935
805/* I2C */ 936/* I2C */
806DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET, 937DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET,
@@ -814,6 +945,42 @@ DEFINE_CLOCK(hsi2c_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG11_OFFSET,
814DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET, 945DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET,
815 NULL, NULL, &ipg_clk, NULL); 946 NULL, NULL, &ipg_clk, NULL);
816 947
948/* NFC */
949DEFINE_CLOCK1(nfc_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG10_OFFSET,
950 clk_nfc, &emi_slow_clk, NULL);
951
952/* SSI */
953DEFINE_CLOCK(ssi1_ipg_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG8_OFFSET,
954 NULL, NULL, &ipg_clk, NULL);
955DEFINE_CLOCK(ssi1_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG9_OFFSET,
956 NULL, NULL, &pll3_sw_clk, &ssi1_ipg_clk);
957DEFINE_CLOCK(ssi2_ipg_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG10_OFFSET,
958 NULL, NULL, &ipg_clk, NULL);
959DEFINE_CLOCK(ssi2_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG11_OFFSET,
960 NULL, NULL, &pll3_sw_clk, &ssi2_ipg_clk);
961
962/* eCSPI */
963DEFINE_CLOCK_FULL(ecspi1_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG9_OFFSET,
964 NULL, NULL, _clk_ccgr_enable_inrun, _clk_ccgr_disable,
965 &ipg_clk, &spba_clk);
966DEFINE_CLOCK(ecspi1_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG10_OFFSET,
967 NULL, NULL, &ecspi_main_clk, &ecspi1_ipg_clk);
968DEFINE_CLOCK_FULL(ecspi2_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG11_OFFSET,
969 NULL, NULL, _clk_ccgr_enable_inrun, _clk_ccgr_disable,
970 &ipg_clk, &aips_tz2_clk);
971DEFINE_CLOCK(ecspi2_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG12_OFFSET,
972 NULL, NULL, &ecspi_main_clk, &ecspi2_ipg_clk);
973
974/* CSPI */
975DEFINE_CLOCK(cspi_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG9_OFFSET,
976 NULL, NULL, &ipg_clk, &aips_tz2_clk);
977DEFINE_CLOCK(cspi_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG13_OFFSET,
978 NULL, NULL, &ipg_clk, &cspi_ipg_clk);
979
980/* SDMA */
981DEFINE_CLOCK(sdma_clk, 1, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG15_OFFSET,
982 NULL, NULL, &ahb_clk, NULL);
983
817#define _REGISTER_CLOCK(d, n, c) \ 984#define _REGISTER_CLOCK(d, n, c) \
818 { \ 985 { \
819 .dev_id = d, \ 986 .dev_id = d, \
@@ -837,6 +1004,16 @@ static struct clk_lookup lookups[] = {
837 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) 1004 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk)
838 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) 1005 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk)
839 _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk) 1006 _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk)
1007 _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk)
1008 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1009 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
1010 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk)
1011 _REGISTER_CLOCK(NULL, "ckih", ckih_clk)
1012 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
1013 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
1014 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk)
1015 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk)
1016 _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk)
840}; 1017};
841 1018
842static void clk_tree_init(void) 1019static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
new file mode 100644
index 000000000000..c233379256b8
--- /dev/null
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx51.h>
10#include <mach/devices-common.h>
11
12extern const struct imx_fec_data imx51_fec_data __initconst;
13#define imx51_add_fec(pdata) \
14 imx_add_fec(&imx51_fec_data, pdata)
15
16extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
17#define imx51_add_imx_i2c(id, pdata) \
18 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
19
20extern const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst;
21#define imx51_add_imx_ssi(id, pdata) \
22 imx_add_imx_ssi(&imx51_imx_ssi_data[id], pdata)
23
24extern const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst;
25#define imx51_add_imx_uart(id, pdata) \
26 imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata)
27
28extern const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst;
29#define imx51_add_mxc_nand(pdata) \
30 imx_add_mxc_nand(&imx51_mxc_nand_data, pdata)
31
32extern const struct imx_spi_imx_data imx51_cspi_data __initconst;
33#define imx51_add_cspi(pdata) \
34 imx_add_spi_imx(&imx51_cspi_data, pdata)
35
36extern const struct imx_spi_imx_data imx51_ecspi_data[] __initconst;
37#define imx51_add_ecspi(id, pdata) \
38 imx_add_spi_imx(&imx51_ecspi_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 1920ff4963b2..4c7be87a7c9d 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -17,120 +17,6 @@
17#include <mach/imx-uart.h> 17#include <mach/imx-uart.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19 19
20static struct resource uart0[] = {
21 {
22 .start = MX51_UART1_BASE_ADDR,
23 .end = MX51_UART1_BASE_ADDR + 0xfff,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = MX51_MXC_INT_UART1,
27 .end = MX51_MXC_INT_UART1,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32struct platform_device mxc_uart_device0 = {
33 .name = "imx-uart",
34 .id = 0,
35 .resource = uart0,
36 .num_resources = ARRAY_SIZE(uart0),
37};
38
39static struct resource uart1[] = {
40 {
41 .start = MX51_UART2_BASE_ADDR,
42 .end = MX51_UART2_BASE_ADDR + 0xfff,
43 .flags = IORESOURCE_MEM,
44 }, {
45 .start = MX51_MXC_INT_UART2,
46 .end = MX51_MXC_INT_UART2,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51struct platform_device mxc_uart_device1 = {
52 .name = "imx-uart",
53 .id = 1,
54 .resource = uart1,
55 .num_resources = ARRAY_SIZE(uart1),
56};
57
58static struct resource uart2[] = {
59 {
60 .start = MX51_UART3_BASE_ADDR,
61 .end = MX51_UART3_BASE_ADDR + 0xfff,
62 .flags = IORESOURCE_MEM,
63 }, {
64 .start = MX51_MXC_INT_UART3,
65 .end = MX51_MXC_INT_UART3,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70struct platform_device mxc_uart_device2 = {
71 .name = "imx-uart",
72 .id = 2,
73 .resource = uart2,
74 .num_resources = ARRAY_SIZE(uart2),
75};
76
77static struct resource mxc_fec_resources[] = {
78 {
79 .start = MX51_MXC_FEC_BASE_ADDR,
80 .end = MX51_MXC_FEC_BASE_ADDR + 0xfff,
81 .flags = IORESOURCE_MEM,
82 }, {
83 .start = MX51_MXC_INT_FEC,
84 .end = MX51_MXC_INT_FEC,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device mxc_fec_device = {
90 .name = "fec",
91 .id = 0,
92 .num_resources = ARRAY_SIZE(mxc_fec_resources),
93 .resource = mxc_fec_resources,
94};
95
96static struct resource mxc_i2c0_resources[] = {
97 {
98 .start = MX51_I2C1_BASE_ADDR,
99 .end = MX51_I2C1_BASE_ADDR + SZ_4K - 1,
100 .flags = IORESOURCE_MEM,
101 }, {
102 .start = MX51_MXC_INT_I2C1,
103 .end = MX51_MXC_INT_I2C1,
104 .flags = IORESOURCE_IRQ,
105 },
106};
107
108struct platform_device mxc_i2c_device0 = {
109 .name = "imx-i2c",
110 .id = 0,
111 .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
112 .resource = mxc_i2c0_resources,
113};
114
115static struct resource mxc_i2c1_resources[] = {
116 {
117 .start = MX51_I2C2_BASE_ADDR,
118 .end = MX51_I2C2_BASE_ADDR + SZ_4K - 1,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = MX51_MXC_INT_I2C2,
122 .end = MX51_MXC_INT_I2C2,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127struct platform_device mxc_i2c_device1 = {
128 .name = "imx-i2c",
129 .id = 1,
130 .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
131 .resource = mxc_i2c1_resources,
132};
133
134static struct resource mxc_hsi2c_resources[] = { 20static struct resource mxc_hsi2c_resources[] = {
135 { 21 {
136 .start = MX51_HSI2C_DMA_BASE_ADDR, 22 .start = MX51_HSI2C_DMA_BASE_ADDR,
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index e509cfaad1d4..af1d07c0bbc1 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -1,12 +1,6 @@
1extern struct platform_device mxc_uart_device0;
2extern struct platform_device mxc_uart_device1;
3extern struct platform_device mxc_uart_device2;
4extern struct platform_device mxc_fec_device;
5extern struct platform_device mxc_usbdr_host_device; 1extern struct platform_device mxc_usbdr_host_device;
6extern struct platform_device mxc_usbh1_device; 2extern struct platform_device mxc_usbh1_device;
7extern struct platform_device mxc_usbdr_udc_device; 3extern struct platform_device mxc_usbdr_udc_device;
8extern struct platform_device mxc_wdt; 4extern struct platform_device mxc_wdt;
9extern struct platform_device mxc_i2c_device0;
10extern struct platform_device mxc_i2c_device1;
11extern struct platform_device mxc_hsi2c_device; 5extern struct platform_device mxc_hsi2c_device;
12extern struct platform_device mxc_keypad_device; 6extern struct platform_device mxc_keypad_device;
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
index ffa93d1d6ef8..d0e417ce2c08 100644
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
@@ -30,6 +30,7 @@
30 30
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32 32
33#include "devices-imx51.h"
33#include "devices.h" 34#include "devices.h"
34 35
35#define MBIMX51_TSC2007_GPIO (2*32 + 30) 36#define MBIMX51_TSC2007_GPIO (2*32 + 30)
@@ -114,7 +115,7 @@ static struct pad_desc mbimx51_pads[] = {
114 MX51_PAD_KEY_COL3__KEY_COL3, 115 MX51_PAD_KEY_COL3__KEY_COL3,
115}; 116};
116 117
117static struct imxuart_platform_data uart_pdata = { 118static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS, 119 .flags = IMXUART_HAVE_RTSCTS,
119}; 120};
120 121
@@ -172,8 +173,8 @@ void __init eukrea_mbimx51_baseboard_init(void)
172 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads, 173 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
173 ARRAY_SIZE(mbimx51_pads)); 174 ARRAY_SIZE(mbimx51_pads));
174 175
175 mxc_register_device(&mxc_uart_device1, NULL); 176 imx51_add_imx_uart(1, NULL);
176 mxc_register_device(&mxc_uart_device2, &uart_pdata); 177 imx51_add_imx_uart(2, &uart_pdata);
177 178
178 gpio_request(MBIMX51_LED0, "LED0"); 179 gpio_request(MBIMX51_LED0, "LED0");
179 gpio_direction_output(MBIMX51_LED0, 1); 180 gpio_direction_output(MBIMX51_LED0, 1);