aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Bénard <eric@eukrea.com>2010-06-08 05:03:01 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-07-26 08:18:14 -0400
commit6f1fa706fc06dac9ba088e884ec8110475e42704 (patch)
treeb8b1bff0eeb5d93416084c7fb1c5c3641f9da01f
parent8402ed30e16c65ad8560ba3293c7cf9c259712eb (diff)
i.MX25: add cpuimx25 module and its baseboard
* cpuimx25 integrates i.MX25, RAM, NAND, Ethernet, I2C RTC, USB Host and USB OTG * mbimxsd provides access to LCD, Audio, LED, Switch button, UART ... Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-mx25/Kconfig18
-rw-r--r--arch/arm/mach-mx25/Makefile2
-rw-r--r--arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c260
-rw-r--r--arch/arm/mach-mx25/mach-cpuimx25.c172
-rw-r--r--arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx25.h40
5 files changed, 492 insertions, 0 deletions
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig
index 54d217314ee..3a6668eebf9 100644
--- a/arch/arm/mach-mx25/Kconfig
+++ b/arch/arm/mach-mx25/Kconfig
@@ -5,4 +5,22 @@ comment "MX25 platforms:"
5config MACH_MX25_3DS 5config MACH_MX25_3DS
6 bool "Support MX25PDK (3DS) Platform" 6 bool "Support MX25PDK (3DS) Platform"
7 7
8config MACH_EUKREA_CPUIMX25
9 bool "Support Eukrea CPUIMX25 Platform"
10 select MXC_ULPI if USB_ULPI
11
12choice
13 prompt "Baseboard"
14 depends on MACH_EUKREA_CPUIMX25
15 default MACH_EUKREA_MBIMXSD_BASEBOARD
16
17config MACH_EUKREA_MBIMXSD_BASEBOARD
18 prompt "Eukrea MBIMXSD development board"
19 bool
20 help
21 This adds board specific devices that can be found on Eukrea's
22 MBIMXSD evaluation board.
23
24endchoice
25
8endif 26endif
diff --git a/arch/arm/mach-mx25/Makefile b/arch/arm/mach-mx25/Makefile
index 10cebc5ced8..83ab5d80510 100644
--- a/arch/arm/mach-mx25/Makefile
+++ b/arch/arm/mach-mx25/Makefile
@@ -1,3 +1,5 @@
1obj-y := mm.o devices.o 1obj-y := mm.o devices.o
2obj-$(CONFIG_ARCH_MX25) += clock.o 2obj-$(CONFIG_ARCH_MX25) += clock.o
3obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25pdk.o 3obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25pdk.o
4obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += mach-cpuimx25.o
5obj-$(CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD) += eukrea_mbimxsd-baseboard.o
diff --git a/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
new file mode 100644
index 00000000000..e0f0dfda4d0
--- /dev/null
+++ b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
@@ -0,0 +1,260 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/gpio.h>
23#include <linux/leds.h>
24#include <linux/platform_device.h>
25#include <linux/gpio_keys.h>
26#include <linux/input.h>
27#include <video/platform_lcd.h>
28
29#include <mach/board-eukrea_cpuimx25.h>
30#include <mach/hardware.h>
31#include <mach/iomux-mx25.h>
32#include <mach/common.h>
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35#include <mach/mx25.h>
36#include <mach/imx-uart.h>
37#include <mach/imxfb.h>
38#include <mach/ssi.h>
39#include <mach/audmux.h>
40
41#include "devices.h"
42
43static struct pad_desc eukrea_mbimxsd_pads[] = {
44 /* LCD */
45 MX25_PAD_LD0__LD0,
46 MX25_PAD_LD1__LD1,
47 MX25_PAD_LD2__LD2,
48 MX25_PAD_LD3__LD3,
49 MX25_PAD_LD4__LD4,
50 MX25_PAD_LD5__LD5,
51 MX25_PAD_LD6__LD6,
52 MX25_PAD_LD7__LD7,
53 MX25_PAD_LD8__LD8,
54 MX25_PAD_LD9__LD9,
55 MX25_PAD_LD10__LD10,
56 MX25_PAD_LD11__LD11,
57 MX25_PAD_LD12__LD12,
58 MX25_PAD_LD13__LD13,
59 MX25_PAD_LD14__LD14,
60 MX25_PAD_LD15__LD15,
61 MX25_PAD_GPIO_E__LD16,
62 MX25_PAD_GPIO_F__LD17,
63 MX25_PAD_HSYNC__HSYNC,
64 MX25_PAD_VSYNC__VSYNC,
65 MX25_PAD_LSCLK__LSCLK,
66 MX25_PAD_OE_ACD__OE_ACD,
67 MX25_PAD_CONTRAST__CONTRAST,
68 /* LCD_PWR */
69 MX25_PAD_PWM__GPIO_1_26,
70 /* LED */
71 MX25_PAD_POWER_FAIL__GPIO_3_19,
72 /* SWITCH */
73 MX25_PAD_VSTBY_ACK__GPIO_3_18,
74 /* UART2 */
75 MX25_PAD_UART2_RTS__UART2_RTS,
76 MX25_PAD_UART2_CTS__UART2_CTS,
77 MX25_PAD_UART2_TXD__UART2_TXD,
78 MX25_PAD_UART2_RXD__UART2_RXD,
79 /* SD1 */
80 MX25_PAD_SD1_CMD__SD1_CMD,
81 MX25_PAD_SD1_CLK__SD1_CLK,
82 MX25_PAD_SD1_DATA0__SD1_DATA0,
83 MX25_PAD_SD1_DATA1__SD1_DATA1,
84 MX25_PAD_SD1_DATA2__SD1_DATA2,
85 MX25_PAD_SD1_DATA3__SD1_DATA3,
86 /* SD1 CD */
87 MX25_PAD_DE_B__GPIO_2_20,
88 /* I2S */
89 MX25_PAD_KPP_COL3__AUD5_TXFS,
90 MX25_PAD_KPP_COL2__AUD5_TXC,
91 MX25_PAD_KPP_COL1__AUD5_RXD,
92 MX25_PAD_KPP_COL0__AUD5_TXD,
93};
94
95#define GPIO_LED1 83
96#define GPIO_SWITCH1 82
97#define GPIO_SD1CD 52
98#define GPIO_LCDPWR 26
99
100static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
101 {
102 .mode = {
103 .name = "CMO-QVGA",
104 .refresh = 60,
105 .xres = 320,
106 .yres = 240,
107 .pixclock = KHZ2PICOS(6500),
108 .left_margin = 30,
109 .right_margin = 38,
110 .upper_margin = 20,
111 .lower_margin = 3,
112 .hsync_len = 15,
113 .vsync_len = 4,
114 },
115 .bpp = 16,
116 .pcr = 0xCAD08B80,
117 },
118};
119
120static struct imx_fb_platform_data eukrea_mximxsd_fb_pdata = {
121 .mode = eukrea_mximxsd_modes,
122 .num_modes = ARRAY_SIZE(eukrea_mximxsd_modes),
123 .pwmr = 0x00A903FF,
124 .lscr1 = 0x00120300,
125 .dmacr = 0x00040060,
126};
127
128static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
129 unsigned int power)
130{
131 if (power)
132 gpio_direction_output(GPIO_LCDPWR, 1);
133 else
134 gpio_direction_output(GPIO_LCDPWR, 0);
135}
136
137static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = {
138 .set_power = eukrea_mbimxsd_lcd_power_set,
139};
140
141static struct platform_device eukrea_mbimxsd_lcd_powerdev = {
142 .name = "platform-lcd",
143 .dev.platform_data = &eukrea_mbimxsd_lcd_power_data,
144};
145
146static struct gpio_led eukrea_mbimxsd_leds[] = {
147 {
148 .name = "led1",
149 .default_trigger = "heartbeat",
150 .active_low = 1,
151 .gpio = GPIO_LED1,
152 },
153};
154
155static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {
156 .leds = eukrea_mbimxsd_leds,
157 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
158};
159
160static struct platform_device eukrea_mbimxsd_leds_gpio = {
161 .name = "leds-gpio",
162 .id = -1,
163 .dev = {
164 .platform_data = &eukrea_mbimxsd_led_info,
165 },
166};
167
168static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
169 {
170 .gpio = GPIO_SWITCH1,
171 .code = BTN_0,
172 .desc = "BP1",
173 .active_low = 1,
174 .wakeup = 1,
175 },
176};
177
178static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = {
179 .buttons = eukrea_mbimxsd_gpio_buttons,
180 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
181};
182
183static struct platform_device eukrea_mbimxsd_button_device = {
184 .name = "gpio-keys",
185 .id = -1,
186 .num_resources = 0,
187 .dev = {
188 .platform_data = &eukrea_mbimxsd_button_data,
189 }
190};
191
192static struct platform_device *platform_devices[] __initdata = {
193 &eukrea_mbimxsd_leds_gpio,
194 &eukrea_mbimxsd_button_device,
195 &eukrea_mbimxsd_lcd_powerdev,
196};
197
198static struct imxuart_platform_data uart_pdata = {
199 .flags = IMXUART_HAVE_RTSCTS,
200};
201
202static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
203 {
204 I2C_BOARD_INFO("tlv320aic23", 0x1a),
205 },
206};
207
208struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
209 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
210};
211
212/*
213 * system init for baseboard usage. Will be called by cpuimx25 init.
214 *
215 * Add platform devices present on this baseboard and init
216 * them from CPU side as far as required to use them later on
217 */
218void __init eukrea_mbimxsd_baseboard_init(void)
219{
220 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
221 ARRAY_SIZE(eukrea_mbimxsd_pads)))
222 printk(KERN_ERR "error setting mbimxsd pads !\n");
223
224#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
225 /* SSI unit master I2S codec connected to SSI_AUD5*/
226 mxc_audmux_v2_configure_port(0,
227 MXC_AUDMUX_V2_PTCR_SYN |
228 MXC_AUDMUX_V2_PTCR_TFSDIR |
229 MXC_AUDMUX_V2_PTCR_TFSEL(4) |
230 MXC_AUDMUX_V2_PTCR_TCLKDIR |
231 MXC_AUDMUX_V2_PTCR_TCSEL(4),
232 MXC_AUDMUX_V2_PDCR_RXDSEL(4)
233 );
234 mxc_audmux_v2_configure_port(4,
235 MXC_AUDMUX_V2_PTCR_SYN,
236 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
237 );
238#endif
239
240 mxc_register_device(&mxc_uart_device1, &uart_pdata);
241 mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
242 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
243
244 gpio_request(GPIO_LED1, "LED1");
245 gpio_direction_output(GPIO_LED1, 1);
246 gpio_free(GPIO_LED1);
247
248 gpio_request(GPIO_SWITCH1, "SWITCH1");
249 gpio_direction_input(GPIO_SWITCH1);
250 gpio_free(GPIO_SWITCH1);
251
252 gpio_request(GPIO_LCDPWR, "LCDPWR");
253 gpio_direction_output(GPIO_LCDPWR, 1);
254 gpio_free(GPIO_SWITCH1);
255
256 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
257 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
258
259 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
260}
diff --git a/arch/arm/mach-mx25/mach-cpuimx25.c b/arch/arm/mach-mx25/mach-cpuimx25.c
new file mode 100644
index 00000000000..4796484830a
--- /dev/null
+++ b/arch/arm/mach-mx25/mach-cpuimx25.c
@@ -0,0 +1,172 @@
1/*
2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3 * Copyright 2010 Eric Bénard - Eukréa Electromatique, <eric@eukrea.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include <linux/types.h>
21#include <linux/init.h>
22#include <linux/delay.h>
23#include <linux/clk.h>
24#include <linux/irq.h>
25#include <linux/gpio.h>
26#include <linux/fec.h>
27#include <linux/platform_device.h>
28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h>
30#include <linux/fsl_devices.h>
31
32#include <mach/board-eukrea_cpuimx25.h>
33#include <mach/hardware.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/memory.h>
38#include <asm/mach/map.h>
39#include <mach/common.h>
40#include <mach/imx-uart.h>
41#include <mach/i2c.h>
42#include <mach/mx25.h>
43#include <mach/mxc_nand.h>
44#include <mach/imxfb.h>
45#include <mach/mxc_ehci.h>
46#include <mach/ulpi.h>
47
48#include "devices.h"
49#include <mach/iomux-mx25.h>
50
51static struct imxuart_platform_data uart_pdata = {
52 .flags = IMXUART_HAVE_RTSCTS,
53};
54
55static struct pad_desc eukrea_cpuimx25_pads[] = {
56 /* FEC - RMII */
57 MX25_PAD_FEC_MDC__FEC_MDC,
58 MX25_PAD_FEC_MDIO__FEC_MDIO,
59 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
60 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
61 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
62 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
63 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
64 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
65 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
66 /* I2C1 */
67 MX25_PAD_I2C1_CLK__I2C1_CLK,
68 MX25_PAD_I2C1_DAT__I2C1_DAT,
69};
70
71static struct fec_platform_data mx25_fec_pdata = {
72 .phy = PHY_INTERFACE_MODE_RMII,
73};
74
75static struct mxc_nand_platform_data eukrea_cpuimx25_nand_board_info = {
76 .width = 1,
77 .hw_ecc = 1,
78 .flash_bbt = 1,
79};
80
81static struct imxi2c_platform_data eukrea_cpuimx25_i2c_1_data = {
82 .bitrate = 100000,
83};
84
85static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
86 {
87 I2C_BOARD_INFO("pcf8563", 0x51),
88 },
89};
90
91static struct mxc_usbh_platform_data otg_pdata = {
92 .portsc = MXC_EHCI_MODE_UTMI,
93 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
94};
95
96static struct mxc_usbh_platform_data usbh2_pdata = {
97 .portsc = MXC_EHCI_MODE_SERIAL,
98 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
99 MXC_EHCI_IPPUE_DOWN,
100};
101
102static struct fsl_usb2_platform_data otg_device_pdata = {
103 .operating_mode = FSL_USB2_DR_DEVICE,
104 .phy_mode = FSL_USB2_PHY_UTMI,
105};
106
107static int otg_mode_host;
108
109static int __init eukrea_cpuimx25_otg_mode(char *options)
110{
111 if (!strcmp(options, "host"))
112 otg_mode_host = 1;
113 else if (!strcmp(options, "device"))
114 otg_mode_host = 0;
115 else
116 pr_info("otg_mode neither \"host\" nor \"device\". "
117 "Defaulting to device\n");
118 return 0;
119}
120__setup("otg_mode=", eukrea_cpuimx25_otg_mode);
121
122static void __init eukrea_cpuimx25_init(void)
123{
124 if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
125 ARRAY_SIZE(eukrea_cpuimx25_pads)))
126 printk(KERN_ERR "error setting cpuimx25 pads !\n");
127
128 mxc_register_device(&mxc_uart_device0, &uart_pdata);
129 mxc_register_device(&mxc_nand_device, &eukrea_cpuimx25_nand_board_info);
130 mxc_register_device(&mx25_rtc_device, NULL);
131 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
132
133 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
134 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
135 mxc_register_device(&mxc_i2c_device0, &eukrea_cpuimx25_i2c_1_data);
136
137#if defined(CONFIG_USB_ULPI)
138 if (otg_mode_host) {
139 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
140 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
141
142 mxc_register_device(&mxc_otg, &otg_pdata);
143 }
144 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
145#endif
146 if (!otg_mode_host)
147 mxc_register_device(&otg_udc_device, &otg_device_pdata);
148
149#ifdef CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD
150 eukrea_mbimxsd_baseboard_init();
151#endif
152}
153
154static void __init eukrea_cpuimx25_timer_init(void)
155{
156 mx25_clocks_init();
157}
158
159static struct sys_timer eukrea_cpuimx25_timer = {
160 .init = eukrea_cpuimx25_timer_init,
161};
162
163MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25")
164 /* Maintainer: Eukrea Electromatique */
165 .phys_io = MX25_AIPS1_BASE_ADDR,
166 .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
167 .boot_params = MX25_PHYS_OFFSET + 0x100,
168 .map_io = mx25_map_io,
169 .init_irq = mx25_init_irq,
170 .init_machine = eukrea_cpuimx25_init,
171 .timer = &eukrea_cpuimx25_timer,
172MACHINE_END
diff --git a/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx25.h b/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx25.h
new file mode 100644
index 00000000000..5c9901e7d8d
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx25.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on board-pcm038.h which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#ifndef __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX25_H__
23#define __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX25_H__
24
25#ifndef __ASSEMBLY__
26/*
27 * This CPU module needs a baseboard to work. After basic initializing
28 * its own devices, it calls baseboard's init function.
29 * TODO: Add your own baseboard init function and call it from
30 * inside eukrea_cpuimx25_init().
31 *
32 * This example here is for the development board. Refer
33 * eukrea_mbimx25-baseboard.c
34 */
35
36extern void eukrea_mbimxsd_baseboard_init(void);
37
38#endif
39
40#endif /* __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX25_H__ */