blob: b167f131f7c084175640f2e322fb1b83ab77fa0b [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 Longchamp4ec6ecc72009-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 Longchamp4ec6ecc72009-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,
216};
217
218static struct spi_board_info moboard_spi_board_info[] __initdata = {
219 {
220 .modalias = "mc13783",
221 .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
222 .max_speed_hz = 300000,
223 .bus_num = 1,
224 .chip_select = 0,
225 .platform_data = &moboard_pmic,
226 .mode = SPI_CS_HIGH,
227 },
228 {
229 .modalias = "spidev",
230 .max_speed_hz = 300000,
231 .bus_num = 1,
232 .chip_select = 1, /* according spi1_cs[] ! */
233 },
234};
235
236static int moboard_spi2_cs[] = {
237 MXC_SPI_CS(1),
238};
239
240static struct spi_imx_master moboard_spi2_master = {
241 .chipselect = moboard_spi2_cs,
242 .num_chipselect = ARRAY_SIZE(moboard_spi2_cs),
243};
244
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200245#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
246#define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
247
248static int moboard_sdhc1_get_ro(struct device *dev)
249{
Valentin Longchamp563abb42009-08-11 17:29:21 +0200250 return !gpio_get_value(SDHC1_WP);
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200251}
252
253static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
254 void *data)
255{
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200256 int ret;
257
258 ret = gpio_request(SDHC1_CD, "sdhc-detect");
259 if (ret)
260 return ret;
261
262 gpio_direction_input(SDHC1_CD);
263
264 ret = gpio_request(SDHC1_WP, "sdhc-wp");
265 if (ret)
266 goto err_gpio_free;
267 gpio_direction_input(SDHC1_WP);
268
269 ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200270 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
271 "sdhc1-card-detect", data);
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200272 if (ret)
273 goto err_gpio_free_2;
274
275 return 0;
276
277err_gpio_free_2:
278 gpio_free(SDHC1_WP);
279err_gpio_free:
280 gpio_free(SDHC1_CD);
281
282 return ret;
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200283}
284
285static void moboard_sdhc1_exit(struct device *dev, void *data)
286{
287 free_irq(gpio_to_irq(SDHC1_CD), data);
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200288 gpio_free(SDHC1_WP);
289 gpio_free(SDHC1_CD);
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200290}
291
292static struct imxmmc_platform_data sdhc1_pdata = {
293 .get_ro = moboard_sdhc1_get_ro,
294 .init = moboard_sdhc1_init,
295 .exit = moboard_sdhc1_exit,
296};
297
Valentin Longchampb23f1532009-08-10 18:33:11 +0200298/*
299 * this pin is dedicated for all mx31moboard systems, so we do it here
300 */
301#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
302
303static void usb_xcvr_reset(void)
304{
305 gpio_request(USB_RESET_B, "usb-reset");
306 gpio_direction_output(USB_RESET_B, 0);
307 mdelay(1);
308 gpio_set_value(USB_RESET_B, 1);
309}
310
Valentin Longchamp88b05642009-08-10 18:33:12 +0200311#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
312 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
313
314#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
315
316static void moboard_usbotg_init(void)
317{
318 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
319 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
320 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
321 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
322 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
323 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
324 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
325 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
326 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
327 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
328 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
329 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
330
331 gpio_request(OTG_EN_B, "usb-udc-en");
332 gpio_direction_output(OTG_EN_B, 0);
333}
334
335static struct fsl_usb2_platform_data usb_pdata = {
336 .operating_mode = FSL_USB2_DR_DEVICE,
337 .phy_mode = FSL_USB2_PHY_ULPI,
338};
339
Valentin Longchamp77aa5612009-08-12 11:29:19 +0200340static struct gpio_led mx31moboard_leds[] = {
341 {
342 .name = "coreboard-led-0:red:running",
343 .default_trigger = "heartbeat",
344 .gpio = IOMUX_TO_GPIO(MX31_PIN_SVEN0),
345 }, {
346 .name = "coreboard-led-1:red",
347 .gpio = IOMUX_TO_GPIO(MX31_PIN_STX0),
348 }, {
349 .name = "coreboard-led-2:red",
350 .gpio = IOMUX_TO_GPIO(MX31_PIN_SRX0),
351 }, {
352 .name = "coreboard-led-3:red",
353 .gpio = IOMUX_TO_GPIO(MX31_PIN_SIMPD0),
354 },
355};
356
357static struct gpio_led_platform_data mx31moboard_led_pdata = {
358 .num_leds = ARRAY_SIZE(mx31moboard_leds),
359 .leds = mx31moboard_leds,
360};
361
362static struct platform_device mx31moboard_leds_device = {
363 .name = "leds-gpio",
364 .id = -1,
365 .dev = {
366 .platform_data = &mx31moboard_led_pdata,
367 },
368};
369
Valentin Longchamp8b1a5402009-08-12 11:29:20 +0200370#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
371#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
372#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
373#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
374
375static void mx31moboard_init_sel_gpios(void)
376{
377 if (!gpio_request(SEL0, "sel0")) {
378 gpio_direction_input(SEL0);
379 gpio_export(SEL0, true);
380 }
381
382 if (!gpio_request(SEL1, "sel1")) {
383 gpio_direction_input(SEL1);
384 gpio_export(SEL1, true);
385 }
386
387 if (!gpio_request(SEL2, "sel2")) {
388 gpio_direction_input(SEL2);
389 gpio_export(SEL2, true);
390 }
391
392 if (!gpio_request(SEL3, "sel3")) {
393 gpio_direction_input(SEL3);
394 gpio_export(SEL3, true);
395 }
396}
397
Valentin Longchamp4dd71292009-11-03 18:09:50 +0100398static struct ipu_platform_data mx3_ipu_data = {
399 .irq_base = MXC_IPU_IRQ_START,
400};
401
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100402static struct platform_device *devices[] __initdata = {
403 &mx31moboard_flash,
Valentin Longchamp77aa5612009-08-12 11:29:19 +0200404 &mx31moboard_leds_device,
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100405};
406
Valentin Longchamp04ea3c82009-11-03 18:09:51 +0100407static struct mx3_camera_pdata camera_pdata = {
408 .dma_dev = &mx3_ipu.dev,
409 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
410 .mclk_10khz = 4800,
411};
412
413#define CAMERA_BUF_SIZE (4*1024*1024)
414
415static int __init mx31moboard_cam_alloc_dma(const size_t buf_size)
416{
417 dma_addr_t dma_handle;
418 void *buf;
419 int dma;
420
421 if (buf_size < 2 * 1024 * 1024)
422 return -EINVAL;
423
424 buf = dma_alloc_coherent(NULL, buf_size, &dma_handle, GFP_KERNEL);
425 if (!buf) {
426 pr_err("%s: cannot allocate camera buffer-memory\n", __func__);
427 return -ENOMEM;
428 }
429
430 memset(buf, 0, buf_size);
431
432 dma = dma_declare_coherent_memory(&mx3_camera.dev,
433 dma_handle, dma_handle, buf_size,
434 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
435
436 /* The way we call dma_declare_coherent_memory only a malloc can fail */
437 return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
438}
439
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100440static int mx31moboard_baseboard;
441core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
442
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100443/*
444 * Board specific initialization.
445 */
446static void __init mxc_board_init(void)
447{
Valentin Longchamp220bbce2009-04-17 15:20:25 +0200448 mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins),
449 "moboard");
450
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100451 platform_add_devices(devices, ARRAY_SIZE(devices));
452
Valentin Longchamp421bf822009-11-03 18:09:47 +0100453 mxc_register_device(&mxc_uart_device0, &uart0_pdata);
454
455 mxc_register_device(&mxc_uart_device4, &uart4_pdata);
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100456
Valentin Longchamp8b1a5402009-08-12 11:29:20 +0200457 mx31moboard_init_sel_gpios();
458
Valentin Longchamp4ec6ecc72009-04-21 10:24:22 +0200459 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
460 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
461
Valentin Longchamp65da9792009-11-03 18:09:49 +0100462 mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
463 mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
464
465 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
466 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
467 spi_register_board_info(moboard_spi_board_info,
468 ARRAY_SIZE(moboard_spi_board_info));
469
Valentin Longchamp45b131a2009-04-21 10:24:56 +0200470 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
471
Valentin Longchamp4dd71292009-11-03 18:09:50 +0100472 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
Valentin Longchamp04ea3c82009-11-03 18:09:51 +0100473 if (!mx31moboard_cam_alloc_dma(CAMERA_BUF_SIZE))
474 mxc_register_device(&mx3_camera, &camera_pdata);
Valentin Longchamp4dd71292009-11-03 18:09:50 +0100475
Valentin Longchampb23f1532009-08-10 18:33:11 +0200476 usb_xcvr_reset();
477
Valentin Longchamp88b05642009-08-10 18:33:12 +0200478 moboard_usbotg_init();
479 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
480
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100481 switch (mx31moboard_baseboard) {
482 case MX31NOBOARD:
483 break;
484 case MX31DEVBOARD:
485 mx31moboard_devboard_init();
486 break;
487 case MX31MARXBOT:
488 mx31moboard_marxbot_init();
489 break;
490 default:
Valentin Longchamp220bbce2009-04-17 15:20:25 +0200491 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
492 mx31moboard_baseboard);
Valentin Longchampe00f0b42009-02-16 12:47:51 +0100493 }
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100494}
495
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100496static void __init mx31moboard_timer_init(void)
497{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100498 mx31_clocks_init(26000000);
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100499}
500
501struct sys_timer mx31moboard_timer = {
502 .init = mx31moboard_timer_init,
503};
504
505MACHINE_START(MX31MOBOARD, "EPFL Mobots mx31moboard")
506 /* Maintainer: Valentin Longchamp, EPFL Mobots group */
507 .phys_io = AIPS1_BASE_ADDR,
508 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
509 .boot_params = PHYS_OFFSET + 0x100,
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200510 .map_io = mx31_map_io,
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200511 .init_irq = mx31_init_irq,
Valentin Longchamp988d2d42008-11-23 17:35:08 +0100512 .init_machine = mxc_board_init,
513 .timer = &mx31moboard_timer,
514MACHINE_END
515