diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-mx3/mx31moboard.c | 126 |
1 files changed, 125 insertions, 1 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c index ff74fab34c85..f3ab51bcad49 100644 --- a/arch/arm/mach-mx3/mx31moboard.c +++ b/arch/arm/mach-mx3/mx31moboard.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <linux/mtd/physmap.h> | 26 | #include <linux/mtd/physmap.h> |
27 | #include <linux/mtd/partitions.h> | 27 | #include <linux/mtd/partitions.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/regulator/machine.h> | ||
30 | #include <linux/mfd/mc13783.h> | ||
31 | #include <linux/spi/spi.h> | ||
29 | #include <linux/types.h> | 32 | #include <linux/types.h> |
30 | 33 | ||
31 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
@@ -39,7 +42,8 @@ | |||
39 | #include <mach/iomux-mx3.h> | 42 | #include <mach/iomux-mx3.h> |
40 | #include <mach/i2c.h> | 43 | #include <mach/i2c.h> |
41 | #include <mach/mmc.h> | 44 | #include <mach/mmc.h> |
42 | #include <mach/mx31.h> | 45 | #include <mach/mx3_camera.h> |
46 | #include <mach/spi.h> | ||
43 | 47 | ||
44 | #include "devices.h" | 48 | #include "devices.h" |
45 | 49 | ||
@@ -79,6 +83,16 @@ static unsigned int moboard_pins[] = { | |||
79 | /* SEL */ | 83 | /* SEL */ |
80 | MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9, | 84 | MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9, |
81 | MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11, | 85 | MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11, |
86 | /* SPI1 */ | ||
87 | MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO, | ||
88 | MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY, | ||
89 | MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2, | ||
90 | /* Atlas IRQ */ | ||
91 | MX31_PIN_GPIO1_3__GPIO1_3, | ||
92 | /* SPI2 */ | ||
93 | MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO, | ||
94 | MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY, | ||
95 | MX31_PIN_CSPI2_SS1__CSPI3_SS1, | ||
82 | }; | 96 | }; |
83 | 97 | ||
84 | static struct physmap_flash_data mx31moboard_flash_data = { | 98 | static struct physmap_flash_data mx31moboard_flash_data = { |
@@ -124,6 +138,108 @@ static struct imxi2c_platform_data moboard_i2c1_pdata = { | |||
124 | .bitrate = 100000, | 138 | .bitrate = 100000, |
125 | }; | 139 | }; |
126 | 140 | ||
141 | static int moboard_spi1_cs[] = { | ||
142 | MXC_SPI_CS(0), | ||
143 | MXC_SPI_CS(2), | ||
144 | }; | ||
145 | |||
146 | static struct spi_imx_master moboard_spi1_master = { | ||
147 | .chipselect = moboard_spi1_cs, | ||
148 | .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), | ||
149 | }; | ||
150 | |||
151 | static struct regulator_consumer_supply sdhc_consumers[] = { | ||
152 | { | ||
153 | .dev = &mxcsdhc_device0.dev, | ||
154 | .supply = "sdhc0_vcc", | ||
155 | }, | ||
156 | { | ||
157 | .dev = &mxcsdhc_device1.dev, | ||
158 | .supply = "sdhc1_vcc", | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static struct regulator_init_data sdhc_vreg_data = { | ||
163 | .constraints = { | ||
164 | .min_uV = 2700000, | ||
165 | .max_uV = 3000000, | ||
166 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
167 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, | ||
168 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | ||
169 | REGULATOR_MODE_FAST, | ||
170 | .always_on = 0, | ||
171 | .boot_on = 1, | ||
172 | }, | ||
173 | .num_consumer_supplies = ARRAY_SIZE(sdhc_consumers), | ||
174 | .consumer_supplies = sdhc_consumers, | ||
175 | }; | ||
176 | |||
177 | static struct regulator_consumer_supply cam_consumers[] = { | ||
178 | { | ||
179 | .dev = &mx3_camera.dev, | ||
180 | .supply = "cam_vcc", | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | static struct regulator_init_data cam_vreg_data = { | ||
185 | .constraints = { | ||
186 | .min_uV = 2700000, | ||
187 | .max_uV = 3000000, | ||
188 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
189 | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, | ||
190 | .valid_modes_mask = REGULATOR_MODE_NORMAL | | ||
191 | REGULATOR_MODE_FAST, | ||
192 | .always_on = 0, | ||
193 | .boot_on = 1, | ||
194 | }, | ||
195 | .num_consumer_supplies = ARRAY_SIZE(cam_consumers), | ||
196 | .consumer_supplies = cam_consumers, | ||
197 | }; | ||
198 | |||
199 | static struct mc13783_regulator_init_data moboard_regulators[] = { | ||
200 | { | ||
201 | .id = MC13783_REGU_VMMC1, | ||
202 | .init_data = &sdhc_vreg_data, | ||
203 | }, | ||
204 | { | ||
205 | .id = MC13783_REGU_VCAM, | ||
206 | .init_data = &cam_vreg_data, | ||
207 | }, | ||
208 | }; | ||
209 | |||
210 | static struct mc13783_platform_data moboard_pmic = { | ||
211 | .regulators = moboard_regulators, | ||
212 | .num_regulators = ARRAY_SIZE(moboard_regulators), | ||
213 | .flags = MC13783_USE_REGULATOR | MC13783_USE_RTC, | ||
214 | }; | ||
215 | |||
216 | static struct spi_board_info moboard_spi_board_info[] __initdata = { | ||
217 | { | ||
218 | .modalias = "mc13783", | ||
219 | .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3), | ||
220 | .max_speed_hz = 300000, | ||
221 | .bus_num = 1, | ||
222 | .chip_select = 0, | ||
223 | .platform_data = &moboard_pmic, | ||
224 | .mode = SPI_CS_HIGH, | ||
225 | }, | ||
226 | { | ||
227 | .modalias = "spidev", | ||
228 | .max_speed_hz = 300000, | ||
229 | .bus_num = 1, | ||
230 | .chip_select = 1, /* according spi1_cs[] ! */ | ||
231 | }, | ||
232 | }; | ||
233 | |||
234 | static int moboard_spi2_cs[] = { | ||
235 | MXC_SPI_CS(1), | ||
236 | }; | ||
237 | |||
238 | static struct spi_imx_master moboard_spi2_master = { | ||
239 | .chipselect = moboard_spi2_cs, | ||
240 | .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), | ||
241 | }; | ||
242 | |||
127 | #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0) | 243 | #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0) |
128 | #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1) | 244 | #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1) |
129 | 245 | ||
@@ -304,6 +420,14 @@ static void __init mxc_board_init(void) | |||
304 | mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); | 420 | mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); |
305 | mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); | 421 | mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); |
306 | 422 | ||
423 | mxc_register_device(&mxc_spi_device1, &moboard_spi1_master); | ||
424 | mxc_register_device(&mxc_spi_device2, &moboard_spi2_master); | ||
425 | |||
426 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq"); | ||
427 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); | ||
428 | spi_register_board_info(moboard_spi_board_info, | ||
429 | ARRAY_SIZE(moboard_spi_board_info)); | ||
430 | |||
307 | mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata); | 431 | mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata); |
308 | 432 | ||
309 | usb_xcvr_reset(); | 433 | usb_xcvr_reset(); |