diff options
Diffstat (limited to 'arch/arm/mach-mx3/mx31moboard-marxbot.c')
-rw-r--r-- | arch/arm/mach-mx3/mx31moboard-marxbot.c | 86 |
1 files changed, 85 insertions, 1 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c index 6b06faf0cf30..e4e344eceb7c 100644 --- a/arch/arm/mach-mx3/mx31moboard-marxbot.c +++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c | |||
@@ -16,9 +16,11 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/delay.h> | ||
19 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/i2c.h> | ||
22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
23 | #include <linux/types.h> | 25 | #include <linux/types.h> |
24 | 26 | ||
@@ -28,6 +30,8 @@ | |||
28 | #include <mach/iomux-mx3.h> | 30 | #include <mach/iomux-mx3.h> |
29 | #include <mach/mmc.h> | 31 | #include <mach/mmc.h> |
30 | 32 | ||
33 | #include <media/soc_camera.h> | ||
34 | |||
31 | #include "devices.h" | 35 | #include "devices.h" |
32 | 36 | ||
33 | static unsigned int marxbot_pins[] = { | 37 | static unsigned int marxbot_pins[] = { |
@@ -37,7 +41,6 @@ static unsigned int marxbot_pins[] = { | |||
37 | MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, | 41 | MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, |
38 | MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, | 42 | MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, |
39 | /* CSI */ | 43 | /* CSI */ |
40 | MX31_PIN_CSI_D4__CSI_D4, MX31_PIN_CSI_D5__CSI_D5, | ||
41 | MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7, | 44 | MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7, |
42 | MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9, | 45 | MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9, |
43 | MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11, | 46 | MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11, |
@@ -45,6 +48,7 @@ static unsigned int marxbot_pins[] = { | |||
45 | MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15, | 48 | MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15, |
46 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK, | 49 | MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK, |
47 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, | 50 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, |
51 | MX31_PIN_CSI_D4__GPIO3_4, MX31_PIN_CSI_D5__GPIO3_5, | ||
48 | MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, | 52 | MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, |
49 | MX31_PIN_TXD2__GPIO1_28, | 53 | MX31_PIN_TXD2__GPIO1_28, |
50 | /* dsPIC resets */ | 54 | /* dsPIC resets */ |
@@ -122,6 +126,83 @@ static void dspics_resets_init(void) | |||
122 | } | 126 | } |
123 | } | 127 | } |
124 | 128 | ||
129 | #define TURRETCAM_POWER IOMUX_TO_GPIO(MX31_PIN_GPIO3_1) | ||
130 | #define BASECAM_POWER IOMUX_TO_GPIO(MX31_PIN_CSI_D5) | ||
131 | #define TURRETCAM_RST_B IOMUX_TO_GPIO(MX31_PIN_GPIO3_0) | ||
132 | #define BASECAM_RST_B IOMUX_TO_GPIO(MX31_PIN_CSI_D4) | ||
133 | #define CAM_CHOICE IOMUX_TO_GPIO(MX31_PIN_TXD2) | ||
134 | |||
135 | static int marxbot_basecam_power(struct device *dev, int on) | ||
136 | { | ||
137 | gpio_set_value(BASECAM_POWER, !on); | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | static int marxbot_basecam_reset(struct device *dev) | ||
142 | { | ||
143 | gpio_set_value(BASECAM_RST_B, 0); | ||
144 | udelay(100); | ||
145 | gpio_set_value(BASECAM_RST_B, 1); | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static struct i2c_board_info marxbot_i2c_devices[] = { | ||
150 | { | ||
151 | I2C_BOARD_INFO("mt9t031", 0x5d), | ||
152 | }, | ||
153 | }; | ||
154 | |||
155 | static struct soc_camera_link base_iclink = { | ||
156 | .bus_id = 0, /* Must match with the camera ID */ | ||
157 | .power = marxbot_basecam_power, | ||
158 | .reset = marxbot_basecam_reset, | ||
159 | .board_info = &marxbot_i2c_devices[0], | ||
160 | .i2c_adapter_id = 0, | ||
161 | .module_name = "mt9t031", | ||
162 | }; | ||
163 | |||
164 | static struct platform_device marxbot_camera[] = { | ||
165 | { | ||
166 | .name = "soc-camera-pdrv", | ||
167 | .id = 0, | ||
168 | .dev = { | ||
169 | .platform_data = &base_iclink, | ||
170 | }, | ||
171 | }, | ||
172 | }; | ||
173 | |||
174 | static struct platform_device *marxbot_cameras[] __initdata = { | ||
175 | &marxbot_camera[0], | ||
176 | }; | ||
177 | |||
178 | static int __init marxbot_cam_init(void) | ||
179 | { | ||
180 | int ret = gpio_request(CAM_CHOICE, "cam-choice"); | ||
181 | if (ret) | ||
182 | return ret; | ||
183 | gpio_direction_output(CAM_CHOICE, 1); | ||
184 | |||
185 | ret = gpio_request(BASECAM_RST_B, "basecam-reset"); | ||
186 | if (ret) | ||
187 | return ret; | ||
188 | gpio_direction_output(BASECAM_RST_B, 1); | ||
189 | ret = gpio_request(BASECAM_POWER, "basecam-standby"); | ||
190 | if (ret) | ||
191 | return ret; | ||
192 | gpio_direction_output(BASECAM_POWER, 0); | ||
193 | |||
194 | ret = gpio_request(TURRETCAM_RST_B, "turretcam-reset"); | ||
195 | if (ret) | ||
196 | return ret; | ||
197 | gpio_direction_output(TURRETCAM_RST_B, 1); | ||
198 | ret = gpio_request(TURRETCAM_POWER, "turretcam-standby"); | ||
199 | if (ret) | ||
200 | return ret; | ||
201 | gpio_direction_output(TURRETCAM_POWER, 0); | ||
202 | |||
203 | return 0; | ||
204 | } | ||
205 | |||
125 | /* | 206 | /* |
126 | * system init for baseboard usage. Will be called by mx31moboard init. | 207 | * system init for baseboard usage. Will be called by mx31moboard init. |
127 | */ | 208 | */ |
@@ -136,6 +217,9 @@ void __init mx31moboard_marxbot_init(void) | |||
136 | 217 | ||
137 | mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); | 218 | mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); |
138 | 219 | ||
220 | marxbot_cam_init(); | ||
221 | platform_add_devices(marxbot_cameras, ARRAY_SIZE(marxbot_cameras)); | ||
222 | |||
139 | /* battery present pin */ | 223 | /* battery present pin */ |
140 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present"); | 224 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present"); |
141 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); | 225 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); |