aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-mx3/Makefile2
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c36
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c32
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c33
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c162
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31moboard.h2
6 files changed, 233 insertions, 34 deletions
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index 62b60931d87c..5d650fda5d5d 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_MACH_PCM037_EET) += mach-pcm037_eet.o
18obj-$(CONFIG_MACH_MX31_3DS) += mach-mx31_3ds.o 18obj-$(CONFIG_MACH_MX31_3DS) += mach-mx31_3ds.o
19CFLAGS_mach-mx31_3ds.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS 19CFLAGS_mach-mx31_3ds.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
20obj-$(CONFIG_MACH_MX31MOBOARD) += mach-mx31moboard.o mx31moboard-devboard.o \ 20obj-$(CONFIG_MACH_MX31MOBOARD) += mach-mx31moboard.o mx31moboard-devboard.o \
21 mx31moboard-marxbot.o 21 mx31moboard-marxbot.o mx31moboard-smartbot.o
22obj-$(CONFIG_MACH_QONG) += mach-qong.o 22obj-$(CONFIG_MACH_QONG) += mach-qong.o
23obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o 23obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o
24obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o 24obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index c357a72ee406..a7dc5191bf5e 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -96,9 +96,6 @@ static unsigned int moboard_pins[] = {
96 /* LEDs */ 96 /* LEDs */
97 MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1, 97 MX31_PIN_SVEN0__GPIO2_0, MX31_PIN_STX0__GPIO2_1,
98 MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3, 98 MX31_PIN_SRX0__GPIO2_2, MX31_PIN_SIMPD0__GPIO2_3,
99 /* SEL */
100 MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
101 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
102 /* SPI1 */ 99 /* SPI1 */
103 MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO, 100 MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO,
104 MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, 101 MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
@@ -432,34 +429,6 @@ static struct platform_device mx31moboard_leds_device = {
432 }, 429 },
433}; 430};
434 431
435#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
436#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
437#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
438#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
439
440static void mx31moboard_init_sel_gpios(void)
441{
442 if (!gpio_request(SEL0, "sel0")) {
443 gpio_direction_input(SEL0);
444 gpio_export(SEL0, true);
445 }
446
447 if (!gpio_request(SEL1, "sel1")) {
448 gpio_direction_input(SEL1);
449 gpio_export(SEL1, true);
450 }
451
452 if (!gpio_request(SEL2, "sel2")) {
453 gpio_direction_input(SEL2);
454 gpio_export(SEL2, true);
455 }
456
457 if (!gpio_request(SEL3, "sel3")) {
458 gpio_direction_input(SEL3);
459 gpio_export(SEL3, true);
460 }
461}
462
463static struct ipu_platform_data mx3_ipu_data = { 432static struct ipu_platform_data mx3_ipu_data = {
464 .irq_base = MXC_IPU_IRQ_START, 433 .irq_base = MXC_IPU_IRQ_START,
465}; 434};
@@ -519,8 +488,6 @@ static void __init mxc_board_init(void)
519 488
520 mxc_register_device(&mxc_uart_device4, &uart4_pdata); 489 mxc_register_device(&mxc_uart_device4, &uart4_pdata);
521 490
522 mx31moboard_init_sel_gpios();
523
524 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); 491 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
525 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); 492 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
526 493
@@ -553,6 +520,9 @@ static void __init mxc_board_init(void)
553 case MX31MARXBOT: 520 case MX31MARXBOT:
554 mx31moboard_marxbot_init(); 521 mx31moboard_marxbot_init();
555 break; 522 break;
523 case MX31SMARTBOT:
524 mx31moboard_smartbot_init();
525 break;
556 default: 526 default:
557 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", 527 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
558 mx31moboard_baseboard); 528 mx31moboard_baseboard);
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 438428eaf769..9fbad2eb3a49 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -49,6 +49,9 @@ static unsigned int devboard_pins[] = {
49 MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB, 49 MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB,
50 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND, 50 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND,
51 MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12, 51 MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12,
52 /* SEL */
53 MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
54 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
52}; 55};
53 56
54static struct imxuart_platform_data uart_pdata = { 57static struct imxuart_platform_data uart_pdata = {
@@ -108,6 +111,33 @@ static struct imxmmc_platform_data sdhc2_pdata = {
108 .exit = devboard_sdhc2_exit, 111 .exit = devboard_sdhc2_exit,
109}; 112};
110 113
114#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
115#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
116#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
117#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
118
119static void devboard_init_sel_gpios(void)
120{
121 if (!gpio_request(SEL0, "sel0")) {
122 gpio_direction_input(SEL0);
123 gpio_export(SEL0, true);
124 }
125
126 if (!gpio_request(SEL1, "sel1")) {
127 gpio_direction_input(SEL1);
128 gpio_export(SEL1, true);
129 }
130
131 if (!gpio_request(SEL2, "sel2")) {
132 gpio_direction_input(SEL2);
133 gpio_export(SEL2, true);
134 }
135
136 if (!gpio_request(SEL3, "sel3")) {
137 gpio_direction_input(SEL3);
138 gpio_export(SEL3, true);
139 }
140}
111#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ 141#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
112 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) 142 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
113 143
@@ -196,5 +226,7 @@ void __init mx31moboard_devboard_init(void)
196 226
197 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); 227 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
198 228
229 devboard_init_sel_gpios();
230
199 devboard_usbh1_init(); 231 devboard_usbh1_init();
200} 232}
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 7f6f58cddcb1..3958515d75bf 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -66,6 +66,9 @@ static unsigned int marxbot_pins[] = {
66 MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB, 66 MX31_PIN_CSPI1_SS2__USBH1_RCV, MX31_PIN_CSPI1_SCLK__USBH1_OEB,
67 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND, 67 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS, MX31_PIN_SFS6__USBH1_SUSPEND,
68 MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12, 68 MX31_PIN_NFRE_B__GPIO1_11, MX31_PIN_NFALE__GPIO1_12,
69 /* SEL */
70 MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
71 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
69}; 72};
70 73
71#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR) 74#define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
@@ -223,6 +226,34 @@ static int __init marxbot_cam_init(void)
223 return 0; 226 return 0;
224} 227}
225 228
229#define SEL0 IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
230#define SEL1 IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
231#define SEL2 IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
232#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
233
234static void marxbot_init_sel_gpios(void)
235{
236 if (!gpio_request(SEL0, "sel0")) {
237 gpio_direction_input(SEL0);
238 gpio_export(SEL0, true);
239 }
240
241 if (!gpio_request(SEL1, "sel1")) {
242 gpio_direction_input(SEL1);
243 gpio_export(SEL1, true);
244 }
245
246 if (!gpio_request(SEL2, "sel2")) {
247 gpio_direction_input(SEL2);
248 gpio_export(SEL2, true);
249 }
250
251 if (!gpio_request(SEL3, "sel3")) {
252 gpio_direction_input(SEL3);
253 gpio_export(SEL3, true);
254 }
255}
256
226#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ 257#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
227 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) 258 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
228 259
@@ -307,6 +338,8 @@ void __init mx31moboard_marxbot_init(void)
307 mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins), 338 mxc_iomux_setup_multiple_pins(marxbot_pins, ARRAY_SIZE(marxbot_pins),
308 "marxbot"); 339 "marxbot");
309 340
341 marxbot_init_sel_gpios();
342
310 dspics_resets_init(); 343 dspics_resets_init();
311 344
312 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); 345 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
new file mode 100644
index 000000000000..52a69fc8b14f
--- /dev/null
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -0,0 +1,162 @@
1/*
2 * Copyright (C) 2009 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
19#include <linux/delay.h>
20#include <linux/gpio.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/i2c.h>
24#include <linux/platform_device.h>
25#include <linux/types.h>
26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/imx-uart.h>
30#include <mach/iomux-mx3.h>
31
32#include <media/soc_camera.h>
33
34#include "devices.h"
35
36static unsigned int smartbot_pins[] = {
37 /* UART1 */
38 MX31_PIN_CTS2__CTS2, MX31_PIN_RTS2__RTS2,
39 MX31_PIN_TXD2__TXD2, MX31_PIN_RXD2__RXD2,
40 /* CSI */
41 MX31_PIN_CSI_D4__CSI_D4, MX31_PIN_CSI_D5__CSI_D5,
42 MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7,
43 MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9,
44 MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11,
45 MX31_PIN_CSI_D12__CSI_D12, MX31_PIN_CSI_D13__CSI_D13,
46 MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15,
47 MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK,
48 MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC,
49 MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1,
50 /* ENABLES */
51 MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
52 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
53};
54
55static struct imxuart_platform_data uart_pdata = {
56 .flags = IMXUART_HAVE_RTSCTS,
57};
58
59#define CAM_POWER IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)
60#define CAM_RST_B IOMUX_TO_GPIO(MX31_PIN_GPIO3_0)
61
62static int smartbot_cam_power(struct device *dev, int on)
63{
64 gpio_set_value(CAM_POWER, !on);
65 return 0;
66}
67
68static int smartbot_cam_reset(struct device *dev)
69{
70 gpio_set_value(CAM_RST_B, 0);
71 udelay(100);
72 gpio_set_value(CAM_RST_B, 1);
73 return 0;
74}
75
76static struct i2c_board_info smartbot_i2c_devices[] = {
77 {
78 I2C_BOARD_INFO("mt9t031", 0x5d),
79 },
80};
81
82static struct soc_camera_link base_iclink = {
83 .bus_id = 0, /* Must match with the camera ID */
84 .power = smartbot_cam_power,
85 .reset = smartbot_cam_reset,
86 .board_info = &smartbot_i2c_devices[0],
87 .i2c_adapter_id = 0,
88 .module_name = "mt9t031",
89};
90
91static struct platform_device smartbot_camera[] = {
92 {
93 .name = "soc-camera-pdrv",
94 .id = 0,
95 .dev = {
96 .platform_data = &base_iclink,
97 },
98 },
99};
100
101static struct platform_device *smartbot_cameras[] __initdata = {
102 &smartbot_camera[0],
103};
104
105static int __init smartbot_cam_init(void)
106{
107 int ret = gpio_request(CAM_RST_B, "cam-reset");
108 if (ret)
109 return ret;
110 gpio_direction_output(CAM_RST_B, 1);
111 ret = gpio_request(CAM_POWER, "cam-standby");
112 if (ret)
113 return ret;
114 gpio_direction_output(CAM_POWER, 0);
115
116 return 0;
117}
118
119#define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
120#define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
121#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
122#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
123
124static void smartbot_resets_init(void)
125{
126 if (!gpio_request(POWER_EN, "power-enable")) {
127 gpio_direction_output(POWER_EN, 0);
128 gpio_export(POWER_EN, false);
129 }
130
131 if (!gpio_request(DSPIC_RST_B, "dspic-rst")) {
132 gpio_direction_output(DSPIC_RST_B, 0);
133 gpio_export(DSPIC_RST_B, false);
134 }
135
136 if (!gpio_request(TRSLAT_RST_B, "translator-rst")) {
137 gpio_direction_output(TRSLAT_RST_B, 0);
138 gpio_export(TRSLAT_RST_B, false);
139 }
140
141 if (!gpio_request(SEL3, "sel3")) {
142 gpio_direction_input(SEL3);
143 gpio_export(SEL3, true);
144 }
145}
146/*
147 * system init for baseboard usage. Will be called by mx31moboard init.
148 */
149void __init mx31moboard_smartbot_init(void)
150{
151 printk(KERN_INFO "Initializing mx31smartbot peripherals\n");
152
153 mxc_iomux_setup_multiple_pins(smartbot_pins, ARRAY_SIZE(smartbot_pins),
154 "smartbot");
155
156 mxc_register_device(&mxc_uart_device1, &uart_pdata);
157
158 smartbot_resets_init();
159
160 smartbot_cam_init();
161 platform_add_devices(smartbot_cameras, ARRAY_SIZE(smartbot_cameras));
162}
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
index d5be6b5a6acf..fc5fec9b55f0 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
@@ -25,6 +25,7 @@ enum mx31moboard_boards {
25 MX31NOBOARD = 0, 25 MX31NOBOARD = 0,
26 MX31DEVBOARD = 1, 26 MX31DEVBOARD = 1,
27 MX31MARXBOT = 2, 27 MX31MARXBOT = 2,
28 MX31SMARTBOT = 3,
28}; 29};
29 30
30/* 31/*
@@ -34,6 +35,7 @@ enum mx31moboard_boards {
34 35
35extern void mx31moboard_devboard_init(void); 36extern void mx31moboard_devboard_init(void);
36extern void mx31moboard_marxbot_init(void); 37extern void mx31moboard_marxbot_init(void);
38extern void mx31moboard_smartbot_init(void);
37 39
38#endif 40#endif
39 41