blob: 2c9ea5f6181616d9f9f3c73e3f2f27757ec4cad1 [file] [log] [blame]
Valentin Longchamp988d2d42008-11-23 17:35:08 +01001/*
2 * Copyright (C) 2008 Valentin Longchamp, EPFL Mobots group
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
Valentin Longchampb23f1532009-08-10 18:33:11 +020019#include <linux/delay.h>
Valentin Longchamp04ea3c82009-11-03 18:09:51 +010020#include <linux/dma-mapping.h>
Valentin Longchamp88b05642009-08-10 18:33:12 +020021#include <linux/fsl_devices.h>
Valentin Longchamp45b131a2009-04-21 10:24:56 +020022#include <linux/gpio.h>
Valentin Longchamp988d2d42008-11-23 17:35:08 +010023#include <linux/init.h>
Valentin Longchamp45b131a2009-04-21 10:24:56 +020024#include <linux/interrupt.h>
Valentin Longchamp77aa5612009-08-12 11:29:19 +020025#include <linux/leds.h>
Valentin Longchamp220bbce2009-04-17 15:20:25 +020026#include <linux/memory.h>
Valentin Longchamp988d2d42008-11-23 17:35:08 +010027#include <linux/mtd/physmap.h>
28#include <linux/mtd/partitions.h>
Valentin Longchamp220bbce2009-04-17 15:20:25 +020029#include <linux/platform_device.h>
Valentin Longchamp65da9792009-11-03 18:09:49 +010030#include <linux/regulator/machine.h>
31#include <linux/mfd/mc13783.h>
32#include <linux/spi/spi.h>
Valentin Longchamp220bbce2009-04-17 15:20:25 +020033#include <linux/types.h>
Valentin Longchamp988d2d42008-11-23 17:35:08 +010034
Valentin Longchamp988d2d42008-11-23 17:35:08 +010035#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38#include <asm/mach/map.h>
Valentin Longchamp220bbce2009-04-17 15:20:25 +020039#include <mach/board-mx31moboard.h>
Valentin Longchamp988d2d42008-11-23 17:35:08 +010040#include <mach/common.h>
Valentin Longchamp220bbce2009-04-17 15:20:25 +020041#include <mach/hardware.h>
Valentin Longchamp988d2d42008-11-23 17:35:08 +010042#include <mach/imx-uart.h>
43#include <mach/iomux-mx3.h>
Valentin Longchamp4dd71292009-11-03 18:09:50 +010044#include <mach/ipu.h>
Valentin Longchamp4ec6ecc2009-04-21 10:24:22 +020045#include <mach/i2c.h>
Valentin Longchamp45b131a2009-04-21 10:24:56 +020046#include <mach/mmc.h>
Valentin Longchamp65da9792009-11-03 18:09:49 +010047#include <mach/mx3_camera.h>
48#include <mach/spi.h>
Valentin Longchamp988d2d42008-11-23 17:35:08 +010049
50#include "devices.h"
51
Valentin Longchamp220bbce2009-04-17 15:20:25 +020052static unsigned int moboard_pins[] = {
53 /* UART0 */
Valentin Longchamp220bbce2009-04-17 15:20:25 +020054 MX31_PIN_TXD1__TXD1, MX31_PIN_RXD1__RXD1,
Valentin Longchamp421bf822009-11-03 18:09:47 +010055 MX31_PIN_CTS1__GPIO2_7,
Valentin Longchamp220bbce2009-04-17 15:20:25 +020056 /* UART4 */
57 MX31_PIN_PC_RST__CTS5, MX31_PIN_PC_VS2__RTS5,
58 MX31_PIN_PC_BVD2__TXD5, MX31_PIN_PC_BVD1__RXD5,
Valentin Longchamp56c7a452009-04-22 10:55:50 +020059 /* I2C0 */
60 MX31_PIN_I2C_DAT__I2C1_SDA, MX31_PIN_I2C_CLK__I2C1_SCL,
61 /* I2C1 */
62 MX31_PIN_DCD_DTE1__I2C2_SDA, MX31_PIN_RI_DTE1__I2C2_SCL,
63 /* SDHC1 */
64 MX31_PIN_SD1_DATA3__SD1_DATA3, MX31_PIN_SD1_DATA2__SD1_DATA2,
65 MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0,
66 MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD,
67 MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27,
Valentin Longchampb23f1532009-08-10 18:33:11 +020068 /* USB reset */
69 MX31_PIN_GPIO1_0__GPIO1_0,
Valentin Longchamp88b05642009-08-10 18:33:12 +020070 /* USB OTG */
71 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
72 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
73 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
74 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
75 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
76 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
77 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
78 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
79 MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR,
80 MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP,
81 MX31_PIN_USB_OC__GPIO1_30,
Valentin Longchamp77aa5612009-08-12 11:29:19 +020082 /* LEDs */
83 MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1,
84 MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3,
Valentin Longchamp8b1a5402009-08-12 11:29:20 +020085 /* SEL */
86 MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
87 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
Valentin Longchamp65da9792009-11-03 18:09:49 +010088 /* SPI1 */
89 MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO,
90 MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
91 MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2,
92 /* Atlas IRQ */
93 MX31_PIN_GPIO1_3__GPIO1_3,
94 /* SPI2 */
95 MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO,
96 MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY,
97 MX31_PIN_CSPI2_SS1__CSPI3_SS1,
Valentin Longchamp220bbce2009-04-17 15:20:25 +020098};
99
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100100static struct physmap_flash_data mx31moboard_flash_data = {
101 .width = 2,
102};
103
104static struct resource mx31moboard_flash_resource = {
105 .start = 0xa0000000,
106 .end = 0xa1ffffff,
107 .flags = IORESOURCE_MEM,
108};
109
110static struct platform_device mx31moboard_flash = {
111 .name = "physmap-flash",
112 .id = 0,
113 .dev = {
114 .platform_data = &mx31moboard_flash_data,
115 },
116 .resource = &mx31moboard_flash_resource,
117 .num_resources = 1,
118};
119
Valentin Longchamp421bf822009-11-03 18:09:47 +0100120static int moboard_uart0_init(struct platform_device *pdev)
121{
122 gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
123 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
124 return 0;
125}
126
127static struct imxuart_platform_data uart0_pdata = {
128 .init = moboard_uart0_init,
129};
130
131static struct imxuart_platform_data uart4_pdata = {
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100132 .flags = IMXUART_HAVE_RTSCTS,
133};
134
Valentin Longchamp4ec6ecc2009-04-21 10:24:22 +0200135static struct imxi2c_platform_data moboard_i2c0_pdata = {
136 .bitrate = 400000,
137};
138
139static struct imxi2c_platform_data moboard_i2c1_pdata = {
140 .bitrate = 100000,
141};
142
Valentin Longchamp65da9792009-11-03 18:09:49 +0100143static int moboard_spi1_cs[] = {
144 MXC_SPI_CS(0),
145 MXC_SPI_CS(2),
146};
147
148static struct spi_imx_master moboard_spi1_master = {
149 .chipselect = moboard_spi1_cs,
150 .num_chipselect = ARRAY_SIZE(moboard_spi1_cs),
151};
152
153static struct regulator_consumer_supply sdhc_consumers[] = {
154 {
155 .dev = &mxcsdhc_device0.dev,
156 .supply = "sdhc0_vcc",
157 },
158 {
159 .dev = &mxcsdhc_device1.dev,
160 .supply = "sdhc1_vcc",
161 },
162};
163
164static struct regulator_init_data sdhc_vreg_data = {
165 .constraints = {
166 .min_uV = 2700000,
167 .max_uV = 3000000,
168 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
169 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
170 .valid_modes_mask = REGULATOR_MODE_NORMAL |
171 REGULATOR_MODE_FAST,
172 .always_on = 0,
173 .boot_on = 1,
174 },
175 .num_consumer_supplies = ARRAY_SIZE(sdhc_consumers),
176 .consumer_supplies = sdhc_consumers,
177};
178
179static struct regulator_consumer_supply cam_consumers[] = {
180 {
181 .dev = &mx3_camera.dev,
182 .supply = "cam_vcc",
183 },
184};
185
186static struct regulator_init_data cam_vreg_data = {
187 .constraints = {
188 .min_uV = 2700000,
189 .max_uV = 3000000,
190 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
191 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
192 .valid_modes_mask = REGULATOR_MODE_NORMAL |
193 REGULATOR_MODE_FAST,
194 .always_on = 0,
195 .boot_on = 1,
196 },
197 .num_consumer_supplies = ARRAY_SIZE(cam_consumers),
198 .consumer_supplies = cam_consumers,
199};
200
201static struct mc13783_regulator_init_data moboard_regulators[] = {
202 {
203 .id = MC13783_REGU_VMMC1,
204 .init_data = &sdhc_vreg_data,
205 },
206 {
207 .id = MC13783_REGU_VCAM,
208 .init_data = &cam_vreg_data,
209 },
210};
211
212static struct mc13783_platform_data moboard_pmic = {
213 .regulators = moboard_regulators,
214 .num_regulators = ARRAY_SIZE(moboard_regulators),
215 .flags = MC13783_USE_REGULATOR | MC13783_USE_RTC,
Valentin Longchamp33c4d912009-11-23 19:16:36 +0100216 MC13783_USE_ADC,
Valentin Longchamp65da9792009-11-03 18:09:49 +0100217};
218
219static struct spi_board_info moboard_spi_board_info[] __initdata = {
220 {
221 .modalias = "mc13783",
222 .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
223 .max_speed_hz = 300000,
224 .bus_num = 1,
225 .chip_select = 0,
226 .platform_data = &moboard_pmic,
227 .mode = SPI_CS_HIGH,
228 },
Valentin Longchamp65da9792009-11-03 18:09:49 +0100229};
230
231static int moboard_spi2_cs[] = {
232 MXC_SPI_CS(1),
233};
234
235static struct spi_imx_master moboard_spi2_master = {
236 .chipselect = moboard_spi2_cs,
237 .num_chipselect = ARRAY_SIZE(moboard_spi2_cs),
238};
239
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200240#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
241#define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
242
243static int moboard_sdhc1_get_ro(struct device *dev)
244{
Valentin Longchamp563abb42009-08-11 17:29:21 +0200245 return !gpio_get_value(SDHC1_WP);
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200246}
247
248static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
249 void *data)
250{
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200251 int ret;
252
253 ret = gpio_request(SDHC1_CD, "sdhc-detect");
254 if (ret)
255 return ret;
256
257 gpio_direction_input(SDHC1_CD);
258
259 ret = gpio_request(SDHC1_WP, "sdhc-wp");
260 if (ret)
261 goto err_gpio_free;
262 gpio_direction_input(SDHC1_WP);
263
264 ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200265 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
266 "sdhc1-card-detect", data);
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200267 if (ret)
268 goto err_gpio_free_2;
269
270 return 0;
271
272err_gpio_free_2:
273 gpio_free(SDHC1_WP);
274err_gpio_free:
275 gpio_free(SDHC1_CD);
276
277 return ret;
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200278}
279
280static void moboard_sdhc1_exit(struct device *dev, void *data)
281{
282 free_irq(gpio_to_irq(SDHC1_CD), data);
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200283 gpio_free(SDHC1_WP);
284 gpio_free(SDHC1_CD);
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200285}
286
287static struct imxmmc_platform_data sdhc1_pdata = {
288 .get_ro = moboard_sdhc1_get_ro,
289 .init = moboard_sdhc1_init,
290 .exit = moboard_sdhc1_exit,
291};
292
Valentin Longchampb23f1532009-08-10 18:33:11 +0200293/*
294 * this pin is dedicated for all mx31moboard systems, so we do it here
295 */
296#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
297
298static void usb_xcvr_reset(void)
299{
300 gpio_request(USB_RESET_B, "usb-reset");
301 gpio_direction_output(USB_RESET_B, 0);
302 mdelay(1);
303 gpio_set_value(USB_RESET_B, 1);
304}
305
Valentin Longchamp88b05642009-08-10 18:33:12 +0200306#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
307 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
308
309#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
310
311static void moboard_usbotg_init(void)
312{
313 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
314 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
315 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
316 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
317 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
318 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
319 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
320 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
321 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
322 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
323 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
324 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
325
326 gpio_request(OTG_EN_B, "usb-udc-en");
327 gpio_direction_output(OTG_EN_B, 0);
328}
329
330static struct fsl_usb2_platform_data usb_pdata = {
331 .operating_mode = FSL_USB2_DR_DEVICE,
332 .phy_mode = FSL_USB2_PHY_ULPI,
333};
334
Valentin Longchamp77aa5612009-08-12 11:29:19 +0200335static struct gpio_led mx31moboard_leds[] = {
336 {
337 .name = "coreboard-led-0:red:running",
338 .default_trigger = "heartbeat",
339 .gpio = IOMUX_TO_GPIO(MX31_PIN_SVEN0),
340 }, {
341 .name = "coreboard-led-1:red",
342 .gpio = IOMUX_TO_GPIO(MX31_PIN_STX0),
343 }, {
344 .name = "coreboard-led-2:red",
345 .gpio = IOMUX_TO_GPIO(MX31_PIN_SRX0),
346 }, {
347 .name = "coreboard-led-3:red",
348 .gpio = IOMUX_TO_GPIO(MX31_PIN_SIMPD0),
349 },
350};
351
352static struct gpio_led_platform_data mx31moboard_led_pdata = {
353 .num_leds = ARRAY_SIZE(mx31moboard_leds),
354 .leds = mx31moboard_leds,
355};
356
357static struct platform_device mx31moboard_leds_device = {
358 .name = "leds-gpio",
359 .id = -1,
360 .dev = {
361 .platform_data = &mx31moboard_led_pdata,
362 },
363};
364
Valentin Longchamp8b1a5402009-08-12 11:29:20 +0200365#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
366#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
367#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
368#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
369
370static void mx31moboard_init_sel_gpios(void)
371{
372 if (!gpio_request(SEL0, "sel0")) {
373 gpio_direction_input(SEL0);
374 gpio_export(SEL0, true);
375 }
376
377 if (!gpio_request(SEL1, "sel1")) {
378 gpio_direction_input(SEL1);
379 gpio_export(SEL1, true);
380 }
381
382 if (!gpio_request(SEL2, "sel2")) {
383 gpio_direction_input(SEL2);
384 gpio_export(SEL2, true);
385 }
386
387 if (!gpio_request(SEL3, "sel3")) {
388 gpio_direction_input(SEL3);
389 gpio_export(SEL3, true);
390 }
391}
392
Valentin Longchamp4dd71292009-11-03 18:09:50 +0100393static struct ipu_platform_data mx3_ipu_data = {
394 .irq_base = MXC_IPU_IRQ_START,
395};
396
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100397static struct platform_device *devices[] __initdata = {
398 &mx31moboard_flash,
Valentin Longchamp77aa5612009-08-12 11:29:19 +0200399 &mx31moboard_leds_device,
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100400};
401
Valentin Longchamp04ea3c82009-11-03 18:09:51 +0100402static struct mx3_camera_pdata camera_pdata = {
403 .dma_dev = &mx3_ipu.dev,
404 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
405 .mclk_10khz = 4800,
406};
407
408#define CAMERA_BUF_SIZE (4*1024*1024)
409
410static int __init mx31moboard_cam_alloc_dma(const size_t buf_size)
411{
412 dma_addr_t dma_handle;
413 void *buf;
414 int dma;
415
416 if (buf_size < 2 * 1024 * 1024)
417 return -EINVAL;
418
419 buf = dma_alloc_coherent(NULL, buf_size, &dma_handle, GFP_KERNEL);
420 if (!buf) {
421 pr_err("%s: cannot allocate camera buffer-memory\n", __func__);
422 return -ENOMEM;
423 }
424
425 memset(buf, 0, buf_size);
426
427 dma = dma_declare_coherent_memory(&mx3_camera.dev,
428 dma_handle, dma_handle, buf_size,
429 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
430
431 /* The way we call dma_declare_coherent_memory only a malloc can fail */
432 return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
433}
434
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100435static int mx31moboard_baseboard;
436core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
437
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100438/*
439 * Board specific initialization.
440 */
441static void __init mxc_board_init(void)
442{
Valentin Longchamp220bbce2009-04-17 15:20:25 +0200443 mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins),
444 "moboard");
445
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100446 platform_add_devices(devices, ARRAY_SIZE(devices));
447
Valentin Longchamp421bf822009-11-03 18:09:47 +0100448 mxc_register_device(&mxc_uart_device0, &uart0_pdata);
449
450 mxc_register_device(&mxc_uart_device4, &uart4_pdata);
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100451
Valentin Longchamp8b1a5402009-08-12 11:29:20 +0200452 mx31moboard_init_sel_gpios();
453
Valentin Longchamp4ec6ecc2009-04-21 10:24:22 +0200454 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
455 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
456
Valentin Longchamp65da9792009-11-03 18:09:49 +0100457 mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
458 mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
459
460 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
461 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
462 spi_register_board_info(moboard_spi_board_info,
463 ARRAY_SIZE(moboard_spi_board_info));
464
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200465 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
466
Valentin Longchamp4dd71292009-11-03 18:09:50 +0100467 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
Valentin Longchamp04ea3c82009-11-03 18:09:51 +0100468 if (!mx31moboard_cam_alloc_dma(CAMERA_BUF_SIZE))
469 mxc_register_device(&mx3_camera, &camera_pdata);
Valentin Longchamp4dd71292009-11-03 18:09:50 +0100470
Valentin Longchampb23f1532009-08-10 18:33:11 +0200471 usb_xcvr_reset();
472
Valentin Longchamp88b05642009-08-10 18:33:12 +0200473 moboard_usbotg_init();
474 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
475
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100476 switch (mx31moboard_baseboard) {
477 case MX31NOBOARD:
478 break;
479 case MX31DEVBOARD:
480 mx31moboard_devboard_init();
481 break;
482 case MX31MARXBOT:
483 mx31moboard_marxbot_init();
484 break;
485 default:
Valentin Longchamp220bbce2009-04-17 15:20:25 +0200486 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
487 mx31moboard_baseboard);
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100488 }
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100489}
490
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100491static void __init mx31moboard_timer_init(void)
492{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100493 mx31_clocks_init(26000000);
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100494}
495
496struct sys_timer mx31moboard_timer = {
497 .init = mx31moboard_timer_init,
498};
499
500MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
501 /* Maintainer: Valentin Longchamp, EPFL Mobots group */
502 .phys_io = AIPS1_BASE_ADDR,
503 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
504 .boot_params = PHYS_OFFSET + 0x100,
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200505 .map_io = mx31_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200506 .init_irq = mx31_init_irq,
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100507 .init_machine = mxc_board_init,
508 .timer = &mx31moboard_timer,
509MACHINE_END
510