diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-07-28 11:25:46 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-07-28 11:25:46 -0400 |
commit | 6124a4e430b64d1577438c8648c59e996d02e73e (patch) | |
tree | 49cfafad785d1c9e403a5b0d755298b9af2c260f /arch/arm/mach-imx/mach-mx27_3ds.c | |
parent | 8e267f3da5f117d2f1316cf6ddf740f93f1c73aa (diff) | |
parent | 580975d7f48d7d047e22bb0f42adf7557801d8d4 (diff) |
Merge branch 'imx/dt' into next/dt
Diffstat (limited to 'arch/arm/mach-imx/mach-mx27_3ds.c')
-rw-r--r-- | arch/arm/mach-imx/mach-mx27_3ds.c | 137 |
1 files changed, 124 insertions, 13 deletions
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 117ce0a50f4e..6fa6934ab150 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mfd/mc13783.h> | 29 | #include <linux/mfd/mc13783.h> |
30 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
31 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/spi/l4f00242t03.h> | ||
32 | 33 | ||
33 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
34 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
@@ -42,10 +43,15 @@ | |||
42 | 43 | ||
43 | #include "devices-imx27.h" | 44 | #include "devices-imx27.h" |
44 | 45 | ||
45 | #define SD1_EN_GPIO (GPIO_PORTB + 25) | 46 | #define SD1_EN_GPIO IMX_GPIO_NR(2, 25) |
46 | #define OTG_PHY_RESET_GPIO (GPIO_PORTB + 23) | 47 | #define OTG_PHY_RESET_GPIO IMX_GPIO_NR(2, 23) |
47 | #define SPI2_SS0 (GPIO_PORTD + 21) | 48 | #define SPI2_SS0 IMX_GPIO_NR(4, 21) |
48 | #define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTC + 28) | 49 | #define EXPIO_PARENT_INT gpio_to_irq(IMX_GPIO_NR(3, 28)) |
50 | #define PMIC_INT IMX_GPIO_NR(3, 14) | ||
51 | #define SPI1_SS0 IMX_GPIO_NR(4, 28) | ||
52 | #define SD1_CD IMX_GPIO_NR(2, 26) | ||
53 | #define LCD_RESET IMX_GPIO_NR(1, 3) | ||
54 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) | ||
49 | 55 | ||
50 | static const int mx27pdk_pins[] __initconst = { | 56 | static const int mx27pdk_pins[] __initconst = { |
51 | /* UART1 */ | 57 | /* UART1 */ |
@@ -94,13 +100,47 @@ static const int mx27pdk_pins[] __initconst = { | |||
94 | PE2_PF_USBOTG_DIR, | 100 | PE2_PF_USBOTG_DIR, |
95 | PE24_PF_USBOTG_CLK, | 101 | PE24_PF_USBOTG_CLK, |
96 | PE25_PF_USBOTG_DATA7, | 102 | PE25_PF_USBOTG_DATA7, |
103 | /* CSPI1 */ | ||
104 | PD31_PF_CSPI1_MOSI, | ||
105 | PD30_PF_CSPI1_MISO, | ||
106 | PD29_PF_CSPI1_SCLK, | ||
107 | PD25_PF_CSPI1_RDY, | ||
108 | SPI1_SS0 | GPIO_GPIO | GPIO_OUT, | ||
97 | /* CSPI2 */ | 109 | /* CSPI2 */ |
98 | PD22_PF_CSPI2_SCLK, | 110 | PD22_PF_CSPI2_SCLK, |
99 | PD23_PF_CSPI2_MISO, | 111 | PD23_PF_CSPI2_MISO, |
100 | PD24_PF_CSPI2_MOSI, | 112 | PD24_PF_CSPI2_MOSI, |
113 | SPI2_SS0 | GPIO_GPIO | GPIO_OUT, | ||
101 | /* I2C1 */ | 114 | /* I2C1 */ |
102 | PD17_PF_I2C_DATA, | 115 | PD17_PF_I2C_DATA, |
103 | PD18_PF_I2C_CLK, | 116 | PD18_PF_I2C_CLK, |
117 | /* PMIC INT */ | ||
118 | PMIC_INT | GPIO_GPIO | GPIO_IN, | ||
119 | /* LCD */ | ||
120 | PA5_PF_LSCLK, | ||
121 | PA6_PF_LD0, | ||
122 | PA7_PF_LD1, | ||
123 | PA8_PF_LD2, | ||
124 | PA9_PF_LD3, | ||
125 | PA10_PF_LD4, | ||
126 | PA11_PF_LD5, | ||
127 | PA12_PF_LD6, | ||
128 | PA13_PF_LD7, | ||
129 | PA14_PF_LD8, | ||
130 | PA15_PF_LD9, | ||
131 | PA16_PF_LD10, | ||
132 | PA17_PF_LD11, | ||
133 | PA18_PF_LD12, | ||
134 | PA19_PF_LD13, | ||
135 | PA20_PF_LD14, | ||
136 | PA21_PF_LD15, | ||
137 | PA22_PF_LD16, | ||
138 | PA23_PF_LD17, | ||
139 | PA28_PF_HSYNC, | ||
140 | PA29_PF_VSYNC, | ||
141 | PA30_PF_CONTRAST, | ||
142 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, | ||
143 | LCD_RESET | GPIO_GPIO | GPIO_OUT, | ||
104 | }; | 144 | }; |
105 | 145 | ||
106 | static const struct imxuart_platform_data uart_pdata __initconst = { | 146 | static const struct imxuart_platform_data uart_pdata __initconst = { |
@@ -131,13 +171,13 @@ static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = { | |||
131 | static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq, | 171 | static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq, |
132 | void *data) | 172 | void *data) |
133 | { | 173 | { |
134 | return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING | | 174 | return request_irq(gpio_to_irq(SD1_CD), detect_irq, |
135 | IRQF_TRIGGER_RISING, "sdhc1-card-detect", data); | 175 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "sdhc1-card-detect", data); |
136 | } | 176 | } |
137 | 177 | ||
138 | static void mx27_3ds_sdhc1_exit(struct device *dev, void *data) | 178 | static void mx27_3ds_sdhc1_exit(struct device *dev, void *data) |
139 | { | 179 | { |
140 | free_irq(IRQ_GPIOB(26), data); | 180 | free_irq(gpio_to_irq(SD1_CD), data); |
141 | } | 181 | } |
142 | 182 | ||
143 | static const struct imxmmc_platform_data sdhc1_pdata __initconst = { | 183 | static const struct imxmmc_platform_data sdhc1_pdata __initconst = { |
@@ -193,6 +233,13 @@ static int __init mx27_3ds_otg_mode(char *options) | |||
193 | __setup("otg_mode=", mx27_3ds_otg_mode); | 233 | __setup("otg_mode=", mx27_3ds_otg_mode); |
194 | 234 | ||
195 | /* Regulators */ | 235 | /* Regulators */ |
236 | static struct regulator_init_data gpo_init = { | ||
237 | .constraints = { | ||
238 | .boot_on = 1, | ||
239 | .always_on = 1, | ||
240 | } | ||
241 | }; | ||
242 | |||
196 | static struct regulator_consumer_supply vmmc1_consumers[] = { | 243 | static struct regulator_consumer_supply vmmc1_consumers[] = { |
197 | REGULATOR_SUPPLY("lcd_2v8", NULL), | 244 | REGULATOR_SUPPLY("lcd_2v8", NULL), |
198 | }; | 245 | }; |
@@ -201,7 +248,9 @@ static struct regulator_init_data vmmc1_init = { | |||
201 | .constraints = { | 248 | .constraints = { |
202 | .min_uV = 2800000, | 249 | .min_uV = 2800000, |
203 | .max_uV = 2800000, | 250 | .max_uV = 2800000, |
204 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | 251 | .apply_uV = 1, |
252 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
253 | REGULATOR_CHANGE_STATUS, | ||
205 | }, | 254 | }, |
206 | .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers), | 255 | .num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers), |
207 | .consumer_supplies = vmmc1_consumers, | 256 | .consumer_supplies = vmmc1_consumers, |
@@ -228,6 +277,12 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | |||
228 | }, { | 277 | }, { |
229 | .id = MC13783_REG_VGEN, | 278 | .id = MC13783_REG_VGEN, |
230 | .init_data = &vgen_init, | 279 | .init_data = &vgen_init, |
280 | }, { | ||
281 | .id = MC13783_REG_GPO1, /* Turn on 1.8V */ | ||
282 | .init_data = &gpo_init, | ||
283 | }, { | ||
284 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ | ||
285 | .init_data = &gpo_init, | ||
231 | }, | 286 | }, |
232 | }; | 287 | }; |
233 | 288 | ||
@@ -238,15 +293,63 @@ static struct mc13xxx_platform_data mc13783_pdata = { | |||
238 | .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), | 293 | .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), |
239 | 294 | ||
240 | }, | 295 | }, |
241 | .flags = MC13783_USE_REGULATOR, | 296 | .flags = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN | |
297 | MC13783_USE_RTC, | ||
242 | }; | 298 | }; |
243 | 299 | ||
244 | /* SPI */ | 300 | /* SPI */ |
245 | static int spi2_internal_chipselect[] = {SPI2_SS0}; | 301 | static int spi1_chipselect[] = {SPI1_SS0}; |
302 | |||
303 | static const struct spi_imx_master spi1_pdata __initconst = { | ||
304 | .chipselect = spi1_chipselect, | ||
305 | .num_chipselect = ARRAY_SIZE(spi1_chipselect), | ||
306 | }; | ||
307 | |||
308 | static int spi2_chipselect[] = {SPI2_SS0}; | ||
246 | 309 | ||
247 | static const struct spi_imx_master spi2_pdata __initconst = { | 310 | static const struct spi_imx_master spi2_pdata __initconst = { |
248 | .chipselect = spi2_internal_chipselect, | 311 | .chipselect = spi2_chipselect, |
249 | .num_chipselect = ARRAY_SIZE(spi2_internal_chipselect), | 312 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), |
313 | }; | ||
314 | |||
315 | static struct imx_fb_videomode mx27_3ds_modes[] = { | ||
316 | { /* 480x640 @ 60 Hz */ | ||
317 | .mode = { | ||
318 | .name = "Epson-VGA", | ||
319 | .refresh = 60, | ||
320 | .xres = 480, | ||
321 | .yres = 640, | ||
322 | .pixclock = 41701, | ||
323 | .left_margin = 20, | ||
324 | .right_margin = 41, | ||
325 | .upper_margin = 10, | ||
326 | .lower_margin = 5, | ||
327 | .hsync_len = 20, | ||
328 | .vsync_len = 10, | ||
329 | .sync = FB_SYNC_OE_ACT_HIGH | | ||
330 | FB_SYNC_CLK_INVERT, | ||
331 | .vmode = FB_VMODE_NONINTERLACED, | ||
332 | .flag = 0, | ||
333 | }, | ||
334 | .bpp = 16, | ||
335 | .pcr = 0xFAC08B82, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | static const struct imx_fb_platform_data mx27_3ds_fb_data __initconst = { | ||
340 | .mode = mx27_3ds_modes, | ||
341 | .num_modes = ARRAY_SIZE(mx27_3ds_modes), | ||
342 | .pwmr = 0x00A903FF, | ||
343 | .lscr1 = 0x00120300, | ||
344 | .dmacr = 0x00020010, | ||
345 | }; | ||
346 | |||
347 | /* LCD */ | ||
348 | static struct l4f00242t03_pdata mx27_3ds_lcd_pdata = { | ||
349 | .reset_gpio = LCD_RESET, | ||
350 | .data_enable_gpio = LCD_ENABLE, | ||
351 | .core_supply = "lcd_2v8", | ||
352 | .io_supply = "vdd_lcdio", | ||
250 | }; | 353 | }; |
251 | 354 | ||
252 | static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { | 355 | static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { |
@@ -256,8 +359,14 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { | |||
256 | .bus_num = 1, | 359 | .bus_num = 1, |
257 | .chip_select = 0, /* SS0 */ | 360 | .chip_select = 0, /* SS0 */ |
258 | .platform_data = &mc13783_pdata, | 361 | .platform_data = &mc13783_pdata, |
259 | .irq = IRQ_GPIOC(14), | 362 | .irq = gpio_to_irq(PMIC_INT), |
260 | .mode = SPI_CS_HIGH, | 363 | .mode = SPI_CS_HIGH, |
364 | }, { | ||
365 | .modalias = "l4f00242t03", | ||
366 | .max_speed_hz = 5000000, | ||
367 | .bus_num = 0, | ||
368 | .chip_select = 0, /* SS0 */ | ||
369 | .platform_data = &mx27_3ds_lcd_pdata, | ||
261 | }, | 370 | }, |
262 | }; | 371 | }; |
263 | 372 | ||
@@ -291,12 +400,14 @@ static void __init mx27pdk_init(void) | |||
291 | imx27_add_fsl_usb2_udc(&otg_device_pdata); | 400 | imx27_add_fsl_usb2_udc(&otg_device_pdata); |
292 | 401 | ||
293 | imx27_add_spi_imx1(&spi2_pdata); | 402 | imx27_add_spi_imx1(&spi2_pdata); |
403 | imx27_add_spi_imx0(&spi1_pdata); | ||
294 | spi_register_board_info(mx27_3ds_spi_devs, | 404 | spi_register_board_info(mx27_3ds_spi_devs, |
295 | ARRAY_SIZE(mx27_3ds_spi_devs)); | 405 | ARRAY_SIZE(mx27_3ds_spi_devs)); |
296 | 406 | ||
297 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) | 407 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
298 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); | 408 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); |
299 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); | 409 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); |
410 | imx27_add_imx_fb(&mx27_3ds_fb_data); | ||
300 | } | 411 | } |
301 | 412 | ||
302 | static void __init mx27pdk_timer_init(void) | 413 | static void __init mx27pdk_timer_init(void) |