aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-05-09 05:57:26 -0400
committerOlof Johansson <olof@lixom.net>2012-05-09 05:57:26 -0400
commitafeb36f128e387f8ad2cd7cd94020bae984ea9b4 (patch)
tree8d8b7db74a1d017d4fd166c00d766a0c9047e8ae /arch/arm/mach-imx
parentf1a9fa2381d844bca66cefc842cbb65b263d74dc (diff)
parent53a02d11f1bc9c2c692908d2eda3f3fb34f9bf9d (diff)
Merge tag 'imx-eukrea' of git://git.pengutronix.de/git/imx/linux-2.6 into next/boards
ARM i.MX Eukrea Patches for 3.5 By Eric Bénard (11) and Denis Carikli (1) via Sascha Hauer * tag 'imx-eukrea' of git://git.pengutronix.de/git/imx/linux-2.6: ARM: imx: eukrea_mbimxsd rename to eukrea_mbimxsd51 ARM: imx: eukrea_mbimxsd25: use IMX_GPIO_NR ARM: imx: eukrea_mbimxsd25: don't free twice GPIO_SWITCH1 ARM: imx: eukrea_mbimxsd: add backlight and lcd support ARM: imx: eukrea_cpuimx51sd: support rev2 PCB ARM: imx: eukrea_mbimxsd: add audio support ARM: imx: eukrea_cpuimx51sd: add watchdog support ARM: imx: eukrea-cpuimx51: remove board ARM: imx: eukrea_mbimxsd35: add spi controler and spidev support ARM: imx: eukrea_cpuimx25: add watchdog support ARM: imx: eukrea_mbimxsd25: add spi controler and spidev support ARM: imx: eukrea_cpuimx25: enable workaround ENGcm09152
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/Kconfig35
-rw-r--r--arch/arm/mach-imx/Makefile4
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx51-baseboard.c206
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c51
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c42
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c (renamed from arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c)120
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51.c301
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c50
-rw-r--r--arch/arm/mach-imx/mach-eukrea_cpuimx25.c2
9 files changed, 241 insertions, 570 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 7561eca131b0..18399d10d170 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -163,6 +163,7 @@ config MACH_EUKREA_CPUIMX25SD
163 select SOC_IMX25 163 select SOC_IMX25
164 select IMX_HAVE_PLATFORM_FLEXCAN 164 select IMX_HAVE_PLATFORM_FLEXCAN
165 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 165 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
166 select IMX_HAVE_PLATFORM_IMX2_WDT
166 select IMX_HAVE_PLATFORM_IMXDI_RTC 167 select IMX_HAVE_PLATFORM_IMXDI_RTC
167 select IMX_HAVE_PLATFORM_IMX_FB 168 select IMX_HAVE_PLATFORM_IMX_FB
168 select IMX_HAVE_PLATFORM_IMX_I2C 169 select IMX_HAVE_PLATFORM_IMX_I2C
@@ -181,6 +182,7 @@ config MACH_EUKREA_MBIMXSD25_BASEBOARD
181 bool "Eukrea MBIMXSD development board" 182 bool "Eukrea MBIMXSD development board"
182 select IMX_HAVE_PLATFORM_GPIO_KEYS 183 select IMX_HAVE_PLATFORM_GPIO_KEYS
183 select IMX_HAVE_PLATFORM_IMX_SSI 184 select IMX_HAVE_PLATFORM_IMX_SSI
185 select IMX_HAVE_PLATFORM_SPI_IMX
184 select LEDS_GPIO_REGISTER 186 select LEDS_GPIO_REGISTER
185 help 187 help
186 This adds board specific devices that can be found on Eukrea's 188 This adds board specific devices that can be found on Eukrea's
@@ -606,6 +608,7 @@ config MACH_EUKREA_MBIMXSD35_BASEBOARD
606 select IMX_HAVE_PLATFORM_GPIO_KEYS 608 select IMX_HAVE_PLATFORM_GPIO_KEYS
607 select IMX_HAVE_PLATFORM_IMX_SSI 609 select IMX_HAVE_PLATFORM_IMX_SSI
608 select IMX_HAVE_PLATFORM_IPU_CORE 610 select IMX_HAVE_PLATFORM_IPU_CORE
611 select IMX_HAVE_PLATFORM_SPI_IMX
609 select LEDS_GPIO_REGISTER 612 select LEDS_GPIO_REGISTER
610 help 613 help
611 This adds board specific devices that can be found on Eukrea's 614 This adds board specific devices that can be found on Eukrea's
@@ -682,42 +685,13 @@ config MACH_MX51_3DS
682 Include support for MX51PDK (3DS) platform. This includes specific 685 Include support for MX51PDK (3DS) platform. This includes specific
683 configurations for the board and its peripherals. 686 configurations for the board and its peripherals.
684 687
685config MACH_EUKREA_CPUIMX51
686 bool "Support Eukrea CPUIMX51 module"
687 select SOC_IMX51
688 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
689 select IMX_HAVE_PLATFORM_IMX_I2C
690 select IMX_HAVE_PLATFORM_IMX_UART
691 select IMX_HAVE_PLATFORM_MXC_EHCI
692 select IMX_HAVE_PLATFORM_MXC_NAND
693 select IMX_HAVE_PLATFORM_SPI_IMX
694 help
695 Include support for Eukrea CPUIMX51 platform. This includes
696 specific configurations for the module and its peripherals.
697
698choice
699 prompt "Baseboard"
700 depends on MACH_EUKREA_CPUIMX51
701 default MACH_EUKREA_MBIMX51_BASEBOARD
702
703config MACH_EUKREA_MBIMX51_BASEBOARD
704 prompt "Eukrea MBIMX51 development board"
705 bool
706 select IMX_HAVE_PLATFORM_IMX_KEYPAD
707 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
708 select LEDS_GPIO_REGISTER
709 help
710 This adds board specific devices that can be found on Eukrea's
711 MBIMX51 evaluation board.
712
713endchoice
714
715config MACH_EUKREA_CPUIMX51SD 688config MACH_EUKREA_CPUIMX51SD
716 bool "Support Eukrea CPUIMX51SD module" 689 bool "Support Eukrea CPUIMX51SD module"
717 select SOC_IMX51 690 select SOC_IMX51
718 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 691 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
719 select IMX_HAVE_PLATFORM_IMX_I2C 692 select IMX_HAVE_PLATFORM_IMX_I2C
720 select IMX_HAVE_PLATFORM_IMX_UART 693 select IMX_HAVE_PLATFORM_IMX_UART
694 select IMX_HAVE_PLATFORM_IMX2_WDT
721 select IMX_HAVE_PLATFORM_MXC_EHCI 695 select IMX_HAVE_PLATFORM_MXC_EHCI
722 select IMX_HAVE_PLATFORM_MXC_NAND 696 select IMX_HAVE_PLATFORM_MXC_NAND
723 select IMX_HAVE_PLATFORM_SPI_IMX 697 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -733,6 +707,7 @@ choice
733config MACH_EUKREA_MBIMXSD51_BASEBOARD 707config MACH_EUKREA_MBIMXSD51_BASEBOARD
734 prompt "Eukrea MBIMXSD development board" 708 prompt "Eukrea MBIMXSD development board"
735 bool 709 bool
710 select IMX_HAVE_PLATFORM_IMX_SSI
736 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 711 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
737 select LEDS_GPIO_REGISTER 712 select LEDS_GPIO_REGISTER
738 help 713 help
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index ab939c5046c3..4937c070a57e 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -83,10 +83,8 @@ obj-$(CONFIG_MACH_MX53_EVK) += mach-mx53_evk.o
83obj-$(CONFIG_MACH_MX53_SMD) += mach-mx53_smd.o 83obj-$(CONFIG_MACH_MX53_SMD) += mach-mx53_smd.o
84obj-$(CONFIG_MACH_MX53_LOCO) += mach-mx53_loco.o 84obj-$(CONFIG_MACH_MX53_LOCO) += mach-mx53_loco.o
85obj-$(CONFIG_MACH_MX53_ARD) += mach-mx53_ard.o 85obj-$(CONFIG_MACH_MX53_ARD) += mach-mx53_ard.o
86obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += mach-cpuimx51.o
87obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
88obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o 86obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
89obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o 87obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
90obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o 88obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o
91obj-$(CONFIG_MACH_MX51_EFIKAMX) += mach-mx51_efikamx.o 89obj-$(CONFIG_MACH_MX51_EFIKAMX) += mach-mx51_efikamx.o
92obj-$(CONFIG_MACH_MX51_EFIKASB) += mach-mx51_efikasb.o 90obj-$(CONFIG_MACH_MX51_EFIKASB) += mach-mx51_efikasb.o
diff --git a/arch/arm/mach-imx/eukrea_mbimx51-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx51-baseboard.c
deleted file mode 100644
index a6a3ab8f1b1c..000000000000
--- a/arch/arm/mach-imx/eukrea_mbimx51-baseboard.c
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/serial_8250.h>
16#include <linux/i2c.h>
17#include <linux/gpio.h>
18#include <linux/io.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h>
21#include <linux/i2c/tsc2007.h>
22#include <linux/leds.h>
23
24#include <mach/common.h>
25#include <mach/hardware.h>
26#include <mach/iomux-mx51.h>
27
28#include <asm/mach/arch.h>
29
30#include "devices-imx51.h"
31
32#define MBIMX51_TSC2007_GPIO IMX_GPIO_NR(3, 30)
33#define MBIMX51_LED0 IMX_GPIO_NR(3, 5)
34#define MBIMX51_LED1 IMX_GPIO_NR(3, 6)
35#define MBIMX51_LED2 IMX_GPIO_NR(3, 7)
36#define MBIMX51_LED3 IMX_GPIO_NR(3, 8)
37
38static const struct gpio_led mbimx51_leds[] __initconst = {
39 {
40 .name = "led0",
41 .default_trigger = "heartbeat",
42 .active_low = 1,
43 .gpio = MBIMX51_LED0,
44 },
45 {
46 .name = "led1",
47 .default_trigger = "nand-disk",
48 .active_low = 1,
49 .gpio = MBIMX51_LED1,
50 },
51 {
52 .name = "led2",
53 .default_trigger = "mmc0",
54 .active_low = 1,
55 .gpio = MBIMX51_LED2,
56 },
57 {
58 .name = "led3",
59 .default_trigger = "default-on",
60 .active_low = 1,
61 .gpio = MBIMX51_LED3,
62 },
63};
64
65static const struct gpio_led_platform_data mbimx51_leds_info __initconst = {
66 .leds = mbimx51_leds,
67 .num_leds = ARRAY_SIZE(mbimx51_leds),
68};
69
70static iomux_v3_cfg_t mbimx51_pads[] = {
71 /* UART2 */
72 MX51_PAD_UART2_RXD__UART2_RXD,
73 MX51_PAD_UART2_TXD__UART2_TXD,
74
75 /* UART3 */
76 MX51_PAD_UART3_RXD__UART3_RXD,
77 MX51_PAD_UART3_TXD__UART3_TXD,
78 MX51_PAD_KEY_COL4__UART3_RTS,
79 MX51_PAD_KEY_COL5__UART3_CTS,
80
81 /* TSC2007 IRQ */
82 MX51_PAD_NANDF_D10__GPIO3_30,
83
84 /* LEDS */
85 MX51_PAD_DISPB2_SER_DIN__GPIO3_5,
86 MX51_PAD_DISPB2_SER_DIO__GPIO3_6,
87 MX51_PAD_DISPB2_SER_CLK__GPIO3_7,
88 MX51_PAD_DISPB2_SER_RS__GPIO3_8,
89
90 /* KPP */
91 MX51_PAD_KEY_ROW0__KEY_ROW0,
92 MX51_PAD_KEY_ROW1__KEY_ROW1,
93 MX51_PAD_KEY_ROW2__KEY_ROW2,
94 MX51_PAD_KEY_ROW3__KEY_ROW3,
95 MX51_PAD_KEY_COL0__KEY_COL0,
96 MX51_PAD_KEY_COL1__KEY_COL1,
97 MX51_PAD_KEY_COL2__KEY_COL2,
98 MX51_PAD_KEY_COL3__KEY_COL3,
99
100 /* SD 1 */
101 MX51_PAD_SD1_CMD__SD1_CMD,
102 MX51_PAD_SD1_CLK__SD1_CLK,
103 MX51_PAD_SD1_DATA0__SD1_DATA0,
104 MX51_PAD_SD1_DATA1__SD1_DATA1,
105 MX51_PAD_SD1_DATA2__SD1_DATA2,
106 MX51_PAD_SD1_DATA3__SD1_DATA3,
107
108 /* SD 2 */
109 MX51_PAD_SD2_CMD__SD2_CMD,
110 MX51_PAD_SD2_CLK__SD2_CLK,
111 MX51_PAD_SD2_DATA0__SD2_DATA0,
112 MX51_PAD_SD2_DATA1__SD2_DATA1,
113 MX51_PAD_SD2_DATA2__SD2_DATA2,
114 MX51_PAD_SD2_DATA3__SD2_DATA3,
115};
116
117static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS,
119};
120
121static int mbimx51_keymap[] = {
122 KEY(0, 0, KEY_1),
123 KEY(0, 1, KEY_2),
124 KEY(0, 2, KEY_3),
125 KEY(0, 3, KEY_UP),
126
127 KEY(1, 0, KEY_4),
128 KEY(1, 1, KEY_5),
129 KEY(1, 2, KEY_6),
130 KEY(1, 3, KEY_LEFT),
131
132 KEY(2, 0, KEY_7),
133 KEY(2, 1, KEY_8),
134 KEY(2, 2, KEY_9),
135 KEY(2, 3, KEY_RIGHT),
136
137 KEY(3, 0, KEY_0),
138 KEY(3, 1, KEY_DOWN),
139 KEY(3, 2, KEY_ESC),
140 KEY(3, 3, KEY_ENTER),
141};
142
143static const struct matrix_keymap_data mbimx51_map_data __initconst = {
144 .keymap = mbimx51_keymap,
145 .keymap_size = ARRAY_SIZE(mbimx51_keymap),
146};
147
148static int tsc2007_get_pendown_state(void)
149{
150 return !gpio_get_value(MBIMX51_TSC2007_GPIO);
151}
152
153struct tsc2007_platform_data tsc2007_data = {
154 .model = 2007,
155 .x_plate_ohms = 180,
156 .get_pendown_state = tsc2007_get_pendown_state,
157};
158
159static struct i2c_board_info mbimx51_i2c_devices[] = {
160 {
161 I2C_BOARD_INFO("tsc2007", 0x49),
162 .irq = IMX_GPIO_TO_IRQ(MBIMX51_TSC2007_GPIO),
163 .platform_data = &tsc2007_data,
164 }, {
165 I2C_BOARD_INFO("tlv320aic23", 0x1a),
166 },
167};
168
169/*
170 * baseboard initialization.
171 */
172void __init eukrea_mbimx51_baseboard_init(void)
173{
174 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
175 ARRAY_SIZE(mbimx51_pads));
176
177 imx51_add_imx_uart(1, NULL);
178 imx51_add_imx_uart(2, &uart_pdata);
179
180 gpio_request(MBIMX51_LED0, "LED0");
181 gpio_direction_output(MBIMX51_LED0, 1);
182 gpio_free(MBIMX51_LED0);
183 gpio_request(MBIMX51_LED1, "LED1");
184 gpio_direction_output(MBIMX51_LED1, 1);
185 gpio_free(MBIMX51_LED1);
186 gpio_request(MBIMX51_LED2, "LED2");
187 gpio_direction_output(MBIMX51_LED2, 1);
188 gpio_free(MBIMX51_LED2);
189 gpio_request(MBIMX51_LED3, "LED3");
190 gpio_direction_output(MBIMX51_LED3, 1);
191 gpio_free(MBIMX51_LED3);
192
193 gpio_led_register_device(-1, &mbimx51_leds_info);
194
195 imx51_add_imx_keypad(&mbimx51_map_data);
196
197 gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
198 gpio_direction_input(MBIMX51_TSC2007_GPIO);
199 irq_set_irq_type(gpio_to_irq(MBIMX51_TSC2007_GPIO),
200 IRQF_TRIGGER_FALLING);
201 i2c_register_board_info(1, mbimx51_i2c_devices,
202 ARRAY_SIZE(mbimx51_i2c_devices));
203
204 imx51_add_sdhci_esdhc_imx(0, NULL);
205 imx51_add_sdhci_esdhc_imx(1, NULL);
206}
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index 2cf603e11c4f..dfd2da87c2df 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -23,6 +23,7 @@
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/spi/spi.h>
26#include <video/platform_lcd.h> 27#include <video/platform_lcd.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
@@ -87,12 +88,22 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
87 /* CAN */ 88 /* CAN */
88 MX25_PAD_GPIO_D__CAN2_RX, 89 MX25_PAD_GPIO_D__CAN2_RX,
89 MX25_PAD_GPIO_C__CAN2_TX, 90 MX25_PAD_GPIO_C__CAN2_TX,
91 /* SPI1 */
92 MX25_PAD_CSPI1_MOSI__CSPI1_MOSI,
93 MX25_PAD_CSPI1_MISO__CSPI1_MISO,
94 MX25_PAD_CSPI1_SS0__GPIO_1_16,
95 MX25_PAD_CSPI1_SS1__GPIO_1_17,
96 MX25_PAD_CSPI1_SCLK__CSPI1_SCLK,
97 MX25_PAD_CSPI1_RDY__GPIO_2_22,
90}; 98};
91 99
92#define GPIO_LED1 83 100#define GPIO_LED1 IMX_GPIO_NR(3, 19)
93#define GPIO_SWITCH1 82 101#define GPIO_SWITCH1 IMX_GPIO_NR(3, 18)
94#define GPIO_SD1CD 52 102#define GPIO_SD1CD IMX_GPIO_NR(2, 20)
95#define GPIO_LCDPWR 26 103#define GPIO_LCDPWR IMX_GPIO_NR(1, 26)
104#define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 16)
105#define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 17)
106#define GPIO_SPI1_IRQ IMX_GPIO_NR(2, 22)
96 107
97static struct imx_fb_videomode eukrea_mximxsd_modes[] = { 108static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
98 { 109 {
@@ -228,6 +239,30 @@ static struct esdhc_platform_data sd1_pdata = {
228 .wp_type = ESDHC_WP_NONE, 239 .wp_type = ESDHC_WP_NONE,
229}; 240};
230 241
242static struct spi_board_info eukrea_mbimxsd25_spi_board_info[] __initdata = {
243 {
244 .modalias = "spidev",
245 .max_speed_hz = 20000000,
246 .bus_num = 0,
247 .chip_select = 0,
248 .mode = SPI_MODE_0,
249 },
250 {
251 .modalias = "spidev",
252 .max_speed_hz = 20000000,
253 .bus_num = 0,
254 .chip_select = 1,
255 .mode = SPI_MODE_0,
256 },
257};
258
259static int eukrea_mbimxsd25_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1};
260
261static const struct spi_imx_master eukrea_mbimxsd25_spi0_data __initconst = {
262 .chipselect = eukrea_mbimxsd25_spi_cs,
263 .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd25_spi_cs),
264};
265
231/* 266/*
232 * system init for baseboard usage. Will be called by cpuimx25 init. 267 * system init for baseboard usage. Will be called by cpuimx25 init.
233 * 268 *
@@ -257,11 +292,17 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
257 292
258 gpio_request(GPIO_LCDPWR, "LCDPWR"); 293 gpio_request(GPIO_LCDPWR, "LCDPWR");
259 gpio_direction_output(GPIO_LCDPWR, 1); 294 gpio_direction_output(GPIO_LCDPWR, 1);
260 gpio_free(GPIO_SWITCH1);
261 295
262 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 296 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
263 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 297 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
264 298
299 gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ");
300 gpio_direction_input(GPIO_SPI1_IRQ);
301 gpio_free(GPIO_SPI1_IRQ);
302 imx25_add_spi_imx0(&eukrea_mbimxsd25_spi0_data);
303 spi_register_board_info(eukrea_mbimxsd25_spi_board_info,
304 ARRAY_SIZE(eukrea_mbimxsd25_spi_board_info));
305
265 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 306 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
266 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 307 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
267 imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 308 imx_add_gpio_keys(&eukrea_mbimxsd_button_data);
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index fd8bf8a425a7..557f6c486053 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -27,6 +27,7 @@
27#include <linux/leds.h> 27#include <linux/leds.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/spi/spi.h>
30#include <video/platform_lcd.h> 31#include <video/platform_lcd.h>
31#include <linux/i2c.h> 32#include <linux/i2c.h>
32 33
@@ -158,12 +159,22 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
158 MX35_PAD_SD1_DATA3__ESDHC1_DAT3, 159 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
159 /* SD1 CD */ 160 /* SD1 CD */
160 MX35_PAD_LD18__GPIO3_24, 161 MX35_PAD_LD18__GPIO3_24,
162 /* SPI */
163 MX35_PAD_CSPI1_MOSI__CSPI1_MOSI,
164 MX35_PAD_CSPI1_MISO__CSPI1_MISO,
165 MX35_PAD_CSPI1_SS0__GPIO1_18,
166 MX35_PAD_CSPI1_SS1__GPIO1_19,
167 MX35_PAD_CSPI1_SCLK__CSPI1_SCLK,
168 MX35_PAD_CSPI1_SPI_RDY__GPIO3_5,
161}; 169};
162 170
163#define GPIO_LED1 IMX_GPIO_NR(3, 29) 171#define GPIO_LED1 IMX_GPIO_NR(3, 29)
164#define GPIO_SWITCH1 IMX_GPIO_NR(3, 25) 172#define GPIO_SWITCH1 IMX_GPIO_NR(3, 25)
165#define GPIO_LCDPWR IMX_GPIO_NR(1, 4) 173#define GPIO_LCDPWR IMX_GPIO_NR(1, 4)
166#define GPIO_SD1CD IMX_GPIO_NR(3, 24) 174#define GPIO_SD1CD IMX_GPIO_NR(3, 24)
175#define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 18)
176#define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 19)
177#define GPIO_SPI1_IRQ IMX_GPIO_NR(3, 5)
167 178
168static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, 179static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
169 unsigned int power) 180 unsigned int power)
@@ -239,6 +250,30 @@ static struct esdhc_platform_data sd1_pdata = {
239 .wp_type = ESDHC_WP_NONE, 250 .wp_type = ESDHC_WP_NONE,
240}; 251};
241 252
253static struct spi_board_info eukrea_mbimxsd35_spi_board_info[] __initdata = {
254 {
255 .modalias = "spidev",
256 .max_speed_hz = 20000000,
257 .bus_num = 0,
258 .chip_select = 0,
259 .mode = SPI_MODE_0,
260 },
261 {
262 .modalias = "spidev",
263 .max_speed_hz = 20000000,
264 .bus_num = 0,
265 .chip_select = 1,
266 .mode = SPI_MODE_0,
267 },
268};
269
270static int eukrea_mbimxsd35_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1};
271
272static const struct spi_imx_master eukrea_mbimxsd35_spi0_data __initconst = {
273 .chipselect = eukrea_mbimxsd35_spi_cs,
274 .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd35_spi_cs),
275};
276
242/* 277/*
243 * system init for baseboard usage. Will be called by cpuimx35 init. 278 * system init for baseboard usage. Will be called by cpuimx35 init.
244 * 279 *
@@ -274,6 +309,13 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
274 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 309 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
275 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 310 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
276 311
312 gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ");
313 gpio_direction_input(GPIO_SPI1_IRQ);
314 gpio_free(GPIO_SPI1_IRQ);
315 imx35_add_spi_imx0(&eukrea_mbimxsd35_spi0_data);
316 spi_register_board_info(eukrea_mbimxsd35_spi_board_info,
317 ARRAY_SIZE(eukrea_mbimxsd35_spi_board_info));
318
277 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 319 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
278 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 320 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
279 imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 321 imx_add_gpio_keys(&eukrea_mbimxsd_button_data);
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
index aaa592fdb9ce..96a24b73dc23 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
@@ -28,6 +28,8 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <video/platform_lcd.h>
32#include <linux/backlight.h>
31 33
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
@@ -40,7 +42,7 @@
40 42
41#include "devices-imx51.h" 43#include "devices-imx51.h"
42 44
43static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { 45static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
44 /* LED */ 46 /* LED */
45 MX51_PAD_NANDF_D10__GPIO3_30, 47 MX51_PAD_NANDF_D10__GPIO3_30,
46 /* SWITCH */ 48 /* SWITCH */
@@ -66,12 +68,64 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
66 NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP | 68 NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP |
67 PAD_CTL_PKE | PAD_CTL_SRE_FAST | 69 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
68 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), 70 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
71 /* SSI */
72 MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
73 MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
74 MX51_PAD_AUD3_BB_CK__AUD3_TXC,
75 MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
76 /* LCD Backlight */
77 MX51_PAD_DI1_D1_CS__GPIO3_4,
78 /* LCD RST */
79 MX51_PAD_CSI1_D9__GPIO3_13,
69}; 80};
70 81
71#define GPIO_LED1 IMX_GPIO_NR(3, 30) 82#define GPIO_LED1 IMX_GPIO_NR(3, 30)
72#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31) 83#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)
84#define GPIO_LCDRST IMX_GPIO_NR(3, 13)
85#define GPIO_LCDBL IMX_GPIO_NR(3, 4)
73 86
74static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { 87static void eukrea_mbimxsd51_lcd_power_set(struct plat_lcd_data *pd,
88 unsigned int power)
89{
90 if (power)
91 gpio_direction_output(GPIO_LCDRST, 1);
92 else
93 gpio_direction_output(GPIO_LCDRST, 0);
94}
95
96static struct plat_lcd_data eukrea_mbimxsd51_lcd_power_data = {
97 .set_power = eukrea_mbimxsd51_lcd_power_set,
98};
99
100static struct platform_device eukrea_mbimxsd51_lcd_powerdev = {
101 .name = "platform-lcd",
102 .dev.platform_data = &eukrea_mbimxsd51_lcd_power_data,
103};
104
105static void eukrea_mbimxsd51_bl_set_intensity(int intensity)
106{
107 if (intensity)
108 gpio_direction_output(GPIO_LCDBL, 1);
109 else
110 gpio_direction_output(GPIO_LCDBL, 0);
111}
112
113static struct generic_bl_info eukrea_mbimxsd51_bl_info = {
114 .name = "eukrea_mbimxsd51-bl",
115 .max_intensity = 0xff,
116 .default_intensity = 0xff,
117 .set_bl_intensity = eukrea_mbimxsd51_bl_set_intensity,
118};
119
120static struct platform_device eukrea_mbimxsd51_bl_dev = {
121 .name = "generic-bl",
122 .id = 1,
123 .dev = {
124 .platform_data = &eukrea_mbimxsd51_bl_info,
125 },
126};
127
128static const struct gpio_led eukrea_mbimxsd51_leds[] __initconst = {
75 { 129 {
76 .name = "led1", 130 .name = "led1",
77 .default_trigger = "heartbeat", 131 .default_trigger = "heartbeat",
@@ -81,12 +135,12 @@ static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = {
81}; 135};
82 136
83static const struct gpio_led_platform_data 137static const struct gpio_led_platform_data
84 eukrea_mbimxsd_led_info __initconst = { 138 eukrea_mbimxsd51_led_info __initconst = {
85 .leds = eukrea_mbimxsd_leds, 139 .leds = eukrea_mbimxsd51_leds,
86 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), 140 .num_leds = ARRAY_SIZE(eukrea_mbimxsd51_leds),
87}; 141};
88 142
89static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { 143static struct gpio_keys_button eukrea_mbimxsd51_gpio_buttons[] = {
90 { 144 {
91 .gpio = GPIO_SWITCH1, 145 .gpio = GPIO_SWITCH1,
92 .code = BTN_0, 146 .code = BTN_0,
@@ -97,21 +151,39 @@ static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
97}; 151};
98 152
99static const struct gpio_keys_platform_data 153static const struct gpio_keys_platform_data
100 eukrea_mbimxsd_button_data __initconst = { 154 eukrea_mbimxsd51_button_data __initconst = {
101 .buttons = eukrea_mbimxsd_gpio_buttons, 155 .buttons = eukrea_mbimxsd51_gpio_buttons,
102 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), 156 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd51_gpio_buttons),
103}; 157};
104 158
105static const struct imxuart_platform_data uart_pdata __initconst = { 159static const struct imxuart_platform_data uart_pdata __initconst = {
106 .flags = IMXUART_HAVE_RTSCTS, 160 .flags = IMXUART_HAVE_RTSCTS,
107}; 161};
108 162
109static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = { 163static struct i2c_board_info eukrea_mbimxsd51_i2c_devices[] = {
110 { 164 {
111 I2C_BOARD_INFO("tlv320aic23", 0x1a), 165 I2C_BOARD_INFO("tlv320aic23", 0x1a),
112 }, 166 },
113}; 167};
114 168
169static const
170struct imx_ssi_platform_data eukrea_mbimxsd51_ssi_pdata __initconst = {
171 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
172};
173
174static int screen_type;
175
176static int __init eukrea_mbimxsd51_screen_type(char *options)
177{
178 if (!strcmp(options, "dvi"))
179 screen_type = 1;
180 else if (!strcmp(options, "tft"))
181 screen_type = 0;
182
183 return 0;
184}
185__setup("screen_type=", eukrea_mbimxsd51_screen_type);
186
115/* 187/*
116 * system init for baseboard usage. Will be called by cpuimx51sd init. 188 * system init for baseboard usage. Will be called by cpuimx51sd init.
117 * 189 *
@@ -120,8 +192,8 @@ static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
120 */ 192 */
121void __init eukrea_mbimxsd51_baseboard_init(void) 193void __init eukrea_mbimxsd51_baseboard_init(void)
122{ 194{
123 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, 195 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd51_pads,
124 ARRAY_SIZE(eukrea_mbimxsd_pads))) 196 ARRAY_SIZE(eukrea_mbimxsd51_pads)))
125 printk(KERN_ERR "error setting mbimxsd pads !\n"); 197 printk(KERN_ERR "error setting mbimxsd pads !\n");
126 198
127 imx51_add_imx_uart(1, NULL); 199 imx51_add_imx_uart(1, NULL);
@@ -129,6 +201,8 @@ void __init eukrea_mbimxsd51_baseboard_init(void)
129 201
130 imx51_add_sdhci_esdhc_imx(0, NULL); 202 imx51_add_sdhci_esdhc_imx(0, NULL);
131 203
204 imx51_add_imx_ssi(0, &eukrea_mbimxsd51_ssi_pdata);
205
132 gpio_request(GPIO_LED1, "LED1"); 206 gpio_request(GPIO_LED1, "LED1");
133 gpio_direction_output(GPIO_LED1, 1); 207 gpio_direction_output(GPIO_LED1, 1);
134 gpio_free(GPIO_LED1); 208 gpio_free(GPIO_LED1);
@@ -137,9 +211,21 @@ void __init eukrea_mbimxsd51_baseboard_init(void)
137 gpio_direction_input(GPIO_SWITCH1); 211 gpio_direction_input(GPIO_SWITCH1);
138 gpio_free(GPIO_SWITCH1); 212 gpio_free(GPIO_SWITCH1);
139 213
140 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 214 gpio_request(GPIO_LCDRST, "LCDRST");
141 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 215 gpio_direction_output(GPIO_LCDRST, 0);
142 216 gpio_request(GPIO_LCDBL, "LCDBL");
143 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 217 gpio_direction_output(GPIO_LCDBL, 0);
144 imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 218 if (!screen_type) {
219 platform_device_register(&eukrea_mbimxsd51_bl_dev);
220 platform_device_register(&eukrea_mbimxsd51_lcd_powerdev);
221 } else {
222 gpio_free(GPIO_LCDRST);
223 gpio_free(GPIO_LCDBL);
224 }
225
226 i2c_register_board_info(0, eukrea_mbimxsd51_i2c_devices,
227 ARRAY_SIZE(eukrea_mbimxsd51_i2c_devices));
228
229 gpio_led_register_device(-1, &eukrea_mbimxsd51_led_info);
230 imx_add_gpio_keys(&eukrea_mbimxsd51_button_data);
145} 231}
diff --git a/arch/arm/mach-imx/mach-cpuimx51.c b/arch/arm/mach-imx/mach-cpuimx51.c
deleted file mode 100644
index 944025da8333..000000000000
--- a/arch/arm/mach-imx/mach-cpuimx51.c
+++ /dev/null
@@ -1,301 +0,0 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * based on board-mx51_babbage.c which is
6 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
7 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
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/serial_8250.h>
20#include <linux/i2c.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25
26#include <mach/eukrea-baseboards.h>
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/iomux-mx51.h>
30
31#include <asm/setup.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35
36#include "devices-imx51.h"
37
38#define CPUIMX51_USBH1_STP IMX_GPIO_NR(1, 27)
39#define CPUIMX51_QUARTA_GPIO IMX_GPIO_NR(3, 28)
40#define CPUIMX51_QUARTB_GPIO IMX_GPIO_NR(3, 25)
41#define CPUIMX51_QUARTC_GPIO IMX_GPIO_NR(3, 26)
42#define CPUIMX51_QUARTD_GPIO IMX_GPIO_NR(3, 27)
43#define CPUIMX51_QUART_XTAL 14745600
44#define CPUIMX51_QUART_REGSHIFT 17
45
46/* USB_CTRL_1 */
47#define MX51_USB_CTRL_1_OFFSET 0x10
48#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
49
50#define MX51_USB_PLLDIV_12_MHZ 0x00
51#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
52#define MX51_USB_PLL_DIV_24_MHZ 0x02
53
54static struct plat_serial8250_port serial_platform_data[] = {
55 {
56 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x400000),
57 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTA_GPIO),
58 .irqflags = IRQF_TRIGGER_HIGH,
59 .uartclk = CPUIMX51_QUART_XTAL,
60 .regshift = CPUIMX51_QUART_REGSHIFT,
61 .iotype = UPIO_MEM,
62 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
63 }, {
64 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x800000),
65 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTB_GPIO),
66 .irqflags = IRQF_TRIGGER_HIGH,
67 .uartclk = CPUIMX51_QUART_XTAL,
68 .regshift = CPUIMX51_QUART_REGSHIFT,
69 .iotype = UPIO_MEM,
70 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
71 }, {
72 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x1000000),
73 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTC_GPIO),
74 .irqflags = IRQF_TRIGGER_HIGH,
75 .uartclk = CPUIMX51_QUART_XTAL,
76 .regshift = CPUIMX51_QUART_REGSHIFT,
77 .iotype = UPIO_MEM,
78 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
79 }, {
80 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
81 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTD_GPIO),
82 .irqflags = IRQF_TRIGGER_HIGH,
83 .uartclk = CPUIMX51_QUART_XTAL,
84 .regshift = CPUIMX51_QUART_REGSHIFT,
85 .iotype = UPIO_MEM,
86 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
87 }, {
88 }
89};
90
91static struct platform_device serial_device = {
92 .name = "serial8250",
93 .id = 0,
94 .dev = {
95 .platform_data = serial_platform_data,
96 },
97};
98
99static struct platform_device *devices[] __initdata = {
100 &serial_device,
101};
102
103static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = {
104 /* UART1 */
105 MX51_PAD_UART1_RXD__UART1_RXD,
106 MX51_PAD_UART1_TXD__UART1_TXD,
107 MX51_PAD_UART1_RTS__UART1_RTS,
108 MX51_PAD_UART1_CTS__UART1_CTS,
109
110 /* I2C2 */
111 MX51_PAD_GPIO1_2__I2C2_SCL,
112 MX51_PAD_GPIO1_3__I2C2_SDA,
113 MX51_PAD_NANDF_D10__GPIO3_30,
114
115 /* QUART IRQ */
116 MX51_PAD_NANDF_D15__GPIO3_25,
117 MX51_PAD_NANDF_D14__GPIO3_26,
118 MX51_PAD_NANDF_D13__GPIO3_27,
119 MX51_PAD_NANDF_D12__GPIO3_28,
120
121 /* USB HOST1 */
122 MX51_PAD_USBH1_CLK__USBH1_CLK,
123 MX51_PAD_USBH1_DIR__USBH1_DIR,
124 MX51_PAD_USBH1_NXT__USBH1_NXT,
125 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
126 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
127 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
128 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
129 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
130 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
131 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
132 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
133 MX51_PAD_USBH1_STP__USBH1_STP,
134};
135
136static const struct mxc_nand_platform_data
137 eukrea_cpuimx51_nand_board_info __initconst = {
138 .width = 1,
139 .hw_ecc = 1,
140 .flash_bbt = 1,
141};
142
143static const struct imxuart_platform_data uart_pdata __initconst = {
144 .flags = IMXUART_HAVE_RTSCTS,
145};
146
147static const
148struct imxi2c_platform_data eukrea_cpuimx51_i2c_data __initconst = {
149 .bitrate = 100000,
150};
151
152static struct i2c_board_info eukrea_cpuimx51_i2c_devices[] = {
153 {
154 I2C_BOARD_INFO("pcf8563", 0x51),
155 },
156};
157
158/* This function is board specific as the bit mask for the plldiv will also
159be different for other Freescale SoCs, thus a common bitmask is not
160possible and cannot get place in /plat-mxc/ehci.c.*/
161static int initialize_otg_port(struct platform_device *pdev)
162{
163 u32 v;
164 void __iomem *usb_base;
165 void __iomem *usbother_base;
166
167 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
168 if (!usb_base)
169 return -ENOMEM;
170 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
171
172 /* Set the PHY clock to 19.2MHz */
173 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
174 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
175 v |= MX51_USB_PLL_DIV_19_2_MHZ;
176 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
177 iounmap(usb_base);
178
179 mdelay(10);
180
181 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
182}
183
184static int initialize_usbh1_port(struct platform_device *pdev)
185{
186 u32 v;
187 void __iomem *usb_base;
188 void __iomem *usbother_base;
189
190 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
191 if (!usb_base)
192 return -ENOMEM;
193 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
194
195 /* The clock for the USBH1 ULPI port will come externally from the PHY. */
196 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
197 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
198 iounmap(usb_base);
199
200 mdelay(10);
201
202 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
203 MXC_EHCI_ITC_NO_THRESHOLD);
204}
205
206static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
207 .init = initialize_otg_port,
208 .portsc = MXC_EHCI_UTMI_16BIT,
209};
210
211static const struct fsl_usb2_platform_data usb_pdata __initconst = {
212 .operating_mode = FSL_USB2_DR_DEVICE,
213 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
214};
215
216static const struct mxc_usbh_platform_data usbh1_config __initconst = {
217 .init = initialize_usbh1_port,
218 .portsc = MXC_EHCI_MODE_ULPI,
219};
220
221static int otg_mode_host;
222
223static int __init eukrea_cpuimx51_otg_mode(char *options)
224{
225 if (!strcmp(options, "host"))
226 otg_mode_host = 1;
227 else if (!strcmp(options, "device"))
228 otg_mode_host = 0;
229 else
230 pr_info("otg_mode neither \"host\" nor \"device\". "
231 "Defaulting to device\n");
232 return 0;
233}
234__setup("otg_mode=", eukrea_cpuimx51_otg_mode);
235
236/*
237 * Board specific initialization.
238 */
239static void __init eukrea_cpuimx51_init(void)
240{
241 imx51_soc_init();
242
243 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
244 ARRAY_SIZE(eukrea_cpuimx51_pads));
245
246 imx51_add_imx_uart(0, &uart_pdata);
247 imx51_add_mxc_nand(&eukrea_cpuimx51_nand_board_info);
248
249 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
250 gpio_direction_input(CPUIMX51_QUARTA_GPIO);
251 gpio_free(CPUIMX51_QUARTA_GPIO);
252 gpio_request(CPUIMX51_QUARTB_GPIO, "quartb_irq");
253 gpio_direction_input(CPUIMX51_QUARTB_GPIO);
254 gpio_free(CPUIMX51_QUARTB_GPIO);
255 gpio_request(CPUIMX51_QUARTC_GPIO, "quartc_irq");
256 gpio_direction_input(CPUIMX51_QUARTC_GPIO);
257 gpio_free(CPUIMX51_QUARTC_GPIO);
258 gpio_request(CPUIMX51_QUARTD_GPIO, "quartd_irq");
259 gpio_direction_input(CPUIMX51_QUARTD_GPIO);
260 gpio_free(CPUIMX51_QUARTD_GPIO);
261
262 imx51_add_fec(NULL);
263 platform_add_devices(devices, ARRAY_SIZE(devices));
264
265 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
266 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
267 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
268
269 if (otg_mode_host)
270 imx51_add_mxc_ehci_otg(&dr_utmi_config);
271 else {
272 initialize_otg_port(NULL);
273 imx51_add_fsl_usb2_udc(&usb_pdata);
274 }
275 imx51_add_mxc_ehci_hs(1, &usbh1_config);
276
277#ifdef CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD
278 eukrea_mbimx51_baseboard_init();
279#endif
280}
281
282static void __init eukrea_cpuimx51_timer_init(void)
283{
284 mx51_clocks_init(32768, 24000000, 22579200, 0);
285}
286
287static struct sys_timer mxc_timer = {
288 .init = eukrea_cpuimx51_timer_init,
289};
290
291MACHINE_START(EUKREA_CPUIMX51, "Eukrea CPUIMX51 Module")
292 /* Maintainer: Eric Bénard <eric@eukrea.com> */
293 .atag_offset = 0x100,
294 .map_io = mx51_map_io,
295 .init_early = imx51_init_early,
296 .init_irq = mx51_init_irq,
297 .handle_irq = imx51_handle_irq,
298 .timer = &mxc_timer,
299 .init_machine = eukrea_cpuimx51_init,
300 .restart = mxc_restart,
301MACHINE_END
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
index 9fbe923c8b08..ce341a6874fc 100644
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c
@@ -41,11 +41,13 @@
41 41
42#define USBH1_RST IMX_GPIO_NR(2, 28) 42#define USBH1_RST IMX_GPIO_NR(2, 28)
43#define ETH_RST IMX_GPIO_NR(2, 31) 43#define ETH_RST IMX_GPIO_NR(2, 31)
44#define TSC2007_IRQGPIO IMX_GPIO_NR(3, 12) 44#define TSC2007_IRQGPIO_REV2 IMX_GPIO_NR(3, 12)
45#define TSC2007_IRQGPIO_REV3 IMX_GPIO_NR(4, 0)
45#define CAN_IRQGPIO IMX_GPIO_NR(1, 1) 46#define CAN_IRQGPIO IMX_GPIO_NR(1, 1)
46#define CAN_RST IMX_GPIO_NR(4, 15) 47#define CAN_RST IMX_GPIO_NR(4, 15)
47#define CAN_NCS IMX_GPIO_NR(4, 24) 48#define CAN_NCS IMX_GPIO_NR(4, 24)
48#define CAN_RXOBF IMX_GPIO_NR(1, 4) 49#define CAN_RXOBF_REV2 IMX_GPIO_NR(1, 4)
50#define CAN_RXOBF_REV3 IMX_GPIO_NR(3, 12)
49#define CAN_RX1BF IMX_GPIO_NR(1, 6) 51#define CAN_RX1BF IMX_GPIO_NR(1, 6)
50#define CAN_TXORTS IMX_GPIO_NR(1, 7) 52#define CAN_TXORTS IMX_GPIO_NR(1, 7)
51#define CAN_TX1RTS IMX_GPIO_NR(1, 8) 53#define CAN_TX1RTS IMX_GPIO_NR(1, 8)
@@ -90,6 +92,10 @@ static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
90 MX51_PAD_I2C1_CLK__GPIO4_16, 92 MX51_PAD_I2C1_CLK__GPIO4_16,
91 MX51_PAD_I2C1_DAT__GPIO4_17, 93 MX51_PAD_I2C1_DAT__GPIO4_17,
92 94
95 /* I2C1 */
96 MX51_PAD_SD2_CMD__I2C1_SCL,
97 MX51_PAD_SD2_CLK__I2C1_SDA,
98
93 /* CAN */ 99 /* CAN */
94 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, 100 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
95 MX51_PAD_CSPI1_MISO__ECSPI1_MISO, 101 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
@@ -108,15 +114,27 @@ static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
108 NEW_PAD_CTRL(MX51_PAD_GPIO_NAND__GPIO_NAND, PAD_CTL_PUS_22K_UP | 114 NEW_PAD_CTRL(MX51_PAD_GPIO_NAND__GPIO_NAND, PAD_CTL_PUS_22K_UP |
109 PAD_CTL_PKE | PAD_CTL_SRE_FAST | 115 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
110 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), 116 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
117 NEW_PAD_CTRL(MX51_PAD_NANDF_D8__GPIO4_0, PAD_CTL_PUS_22K_UP |
118 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
119 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
111}; 120};
112 121
113static const struct imxuart_platform_data uart_pdata __initconst = { 122static const struct imxuart_platform_data uart_pdata __initconst = {
114 .flags = IMXUART_HAVE_RTSCTS, 123 .flags = IMXUART_HAVE_RTSCTS,
115}; 124};
116 125
126static int tsc2007_get_pendown_state(void)
127{
128 if (mx51_revision() < IMX_CHIP_REVISION_3_0)
129 return !gpio_get_value(TSC2007_IRQGPIO_REV2);
130 else
131 return !gpio_get_value(TSC2007_IRQGPIO_REV3);
132}
133
117static struct tsc2007_platform_data tsc2007_info = { 134static struct tsc2007_platform_data tsc2007_info = {
118 .model = 2007, 135 .model = 2007,
119 .x_plate_ohms = 180, 136 .x_plate_ohms = 180,
137 .get_pendown_state = tsc2007_get_pendown_state,
120}; 138};
121 139
122static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = { 140static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
@@ -126,7 +144,6 @@ static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
126 I2C_BOARD_INFO("tsc2007", 0x49), 144 I2C_BOARD_INFO("tsc2007", 0x49),
127 .type = "tsc2007", 145 .type = "tsc2007",
128 .platform_data = &tsc2007_info, 146 .platform_data = &tsc2007_info,
129 .irq = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO),
130 }, 147 },
131}; 148};
132 149
@@ -255,10 +272,14 @@ static const struct spi_imx_master cpuimx51sd_ecspi1_pdata __initconst = {
255 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs), 272 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs),
256}; 273};
257 274
258static struct platform_device *platform_devices[] __initdata = { 275static struct platform_device *rev2_platform_devices[] __initdata = {
259 &hsi2c_gpio_device, 276 &hsi2c_gpio_device,
260}; 277};
261 278
279static const struct imxi2c_platform_data cpuimx51sd_i2c_data __initconst = {
280 .bitrate = 100000,
281};
282
262static void __init eukrea_cpuimx51sd_init(void) 283static void __init eukrea_cpuimx51sd_init(void)
263{ 284{
264 imx51_soc_init(); 285 imx51_soc_init();
@@ -272,6 +293,7 @@ static void __init eukrea_cpuimx51sd_init(void)
272 293
273 imx51_add_imx_uart(0, &uart_pdata); 294 imx51_add_imx_uart(0, &uart_pdata);
274 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info); 295 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
296 imx51_add_imx2_wdt(0, NULL);
275 297
276 gpio_request(ETH_RST, "eth_rst"); 298 gpio_request(ETH_RST, "eth_rst");
277 gpio_set_value(ETH_RST, 1); 299 gpio_set_value(ETH_RST, 1);
@@ -291,13 +313,25 @@ static void __init eukrea_cpuimx51sd_init(void)
291 spi_register_board_info(cpuimx51sd_spi_device, 313 spi_register_board_info(cpuimx51sd_spi_device,
292 ARRAY_SIZE(cpuimx51sd_spi_device)); 314 ARRAY_SIZE(cpuimx51sd_spi_device));
293 315
294 gpio_request(TSC2007_IRQGPIO, "tsc2007_irq"); 316 if (mx51_revision() < IMX_CHIP_REVISION_3_0) {
295 gpio_direction_input(TSC2007_IRQGPIO); 317 eukrea_cpuimx51sd_i2c_devices[1].irq =
296 gpio_free(TSC2007_IRQGPIO); 318 gpio_to_irq(TSC2007_IRQGPIO_REV2),
319 platform_add_devices(rev2_platform_devices,
320 ARRAY_SIZE(rev2_platform_devices));
321 gpio_request(TSC2007_IRQGPIO_REV2, "tsc2007_irq");
322 gpio_direction_input(TSC2007_IRQGPIO_REV2);
323 gpio_free(TSC2007_IRQGPIO_REV2);
324 } else {
325 eukrea_cpuimx51sd_i2c_devices[1].irq =
326 gpio_to_irq(TSC2007_IRQGPIO_REV3),
327 imx51_add_imx_i2c(0, &cpuimx51sd_i2c_data);
328 gpio_request(TSC2007_IRQGPIO_REV3, "tsc2007_irq");
329 gpio_direction_input(TSC2007_IRQGPIO_REV3);
330 gpio_free(TSC2007_IRQGPIO_REV3);
331 }
297 332
298 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices, 333 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
299 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices)); 334 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices));
300 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
301 335
302 if (otg_mode_host) 336 if (otg_mode_host)
303 imx51_add_mxc_ehci_otg(&dr_utmi_config); 337 imx51_add_mxc_ehci_otg(&dr_utmi_config);
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
index 76a97a598b9e..d1e04e676e33 100644
--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
@@ -106,6 +106,7 @@ static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
106static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 106static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
107 .operating_mode = FSL_USB2_DR_DEVICE, 107 .operating_mode = FSL_USB2_DR_DEVICE,
108 .phy_mode = FSL_USB2_PHY_UTMI, 108 .phy_mode = FSL_USB2_PHY_UTMI,
109 .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
109}; 110};
110 111
111static int otg_mode_host; 112static int otg_mode_host;
@@ -135,6 +136,7 @@ static void __init eukrea_cpuimx25_init(void)
135 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); 136 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
136 imx25_add_imxdi_rtc(NULL); 137 imx25_add_imxdi_rtc(NULL);
137 imx25_add_fec(&mx25_fec_pdata); 138 imx25_add_fec(&mx25_fec_pdata);
139 imx25_add_imx2_wdt(NULL);
138 140
139 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, 141 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
140 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); 142 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));