aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-cm-t35.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-cm-t35.c')
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c236
1 files changed, 39 insertions, 197 deletions
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 9340f6a06f4..c63115bc153 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -54,6 +54,7 @@
54#include "mux.h" 54#include "mux.h"
55#include "sdram-micron-mt46h32m32lf-6.h" 55#include "sdram-micron-mt46h32m32lf-6.h"
56#include "hsmmc.h" 56#include "hsmmc.h"
57#include "common-board-devices.h"
57 58
58#define CM_T35_GPIO_PENDOWN 57 59#define CM_T35_GPIO_PENDOWN 57
59 60
@@ -66,86 +67,28 @@
66 67
67#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 68#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
68#include <linux/smsc911x.h> 69#include <linux/smsc911x.h>
70#include <plat/gpmc-smsc911x.h>
69 71
70static struct smsc911x_platform_config cm_t35_smsc911x_config = { 72static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
71 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
72 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
73 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
74 .phy_interface = PHY_INTERFACE_MODE_MII,
75};
76
77static struct resource cm_t35_smsc911x_resources[] = {
78 {
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
83 .end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO),
84 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
85 },
86};
87
88static struct platform_device cm_t35_smsc911x_device = {
89 .name = "smsc911x",
90 .id = 0, 73 .id = 0,
91 .num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources), 74 .cs = CM_T35_SMSC911X_CS,
92 .resource = cm_t35_smsc911x_resources, 75 .gpio_irq = CM_T35_SMSC911X_GPIO,
93 .dev = { 76 .gpio_reset = -EINVAL,
94 .platform_data = &cm_t35_smsc911x_config, 77 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
95 },
96};
97
98static struct resource sb_t35_smsc911x_resources[] = {
99 {
100 .flags = IORESOURCE_MEM,
101 },
102 {
103 .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
104 .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO),
105 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
106 },
107}; 78};
108 79
109static struct platform_device sb_t35_smsc911x_device = { 80static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
110 .name = "smsc911x",
111 .id = 1, 81 .id = 1,
112 .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources), 82 .cs = SB_T35_SMSC911X_CS,
113 .resource = sb_t35_smsc911x_resources, 83 .gpio_irq = SB_T35_SMSC911X_GPIO,
114 .dev = { 84 .gpio_reset = -EINVAL,
115 .platform_data = &cm_t35_smsc911x_config, 85 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
116 },
117}; 86};
118 87
119static void __init cm_t35_init_smsc911x(struct platform_device *dev,
120 int cs, int irq_gpio)
121{
122 unsigned long cs_mem_base;
123
124 if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) {
125 pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n");
126 return;
127 }
128
129 dev->resource[0].start = cs_mem_base + 0x0;
130 dev->resource[0].end = cs_mem_base + 0xff;
131
132 if ((gpio_request(irq_gpio, "ETH IRQ") == 0) &&
133 (gpio_direction_input(irq_gpio) == 0)) {
134 gpio_export(irq_gpio, 0);
135 } else {
136 pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n");
137 return;
138 }
139
140 platform_device_register(dev);
141}
142
143static void __init cm_t35_init_ethernet(void) 88static void __init cm_t35_init_ethernet(void)
144{ 89{
145 cm_t35_init_smsc911x(&cm_t35_smsc911x_device, 90 gpmc_smsc911x_init(&cm_t35_smsc911x_cfg);
146 CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO); 91 gpmc_smsc911x_init(&sb_t35_smsc911x_cfg);
147 cm_t35_init_smsc911x(&sb_t35_smsc911x_device,
148 SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO);
149} 92}
150#else 93#else
151static inline void __init cm_t35_init_ethernet(void) { return; } 94static inline void __init cm_t35_init_ethernet(void) { return; }
@@ -235,69 +178,10 @@ static void __init cm_t35_init_nand(void)
235static inline void cm_t35_init_nand(void) {} 178static inline void cm_t35_init_nand(void) {}
236#endif 179#endif
237 180
238#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
239 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
240#include <linux/spi/ads7846.h>
241
242static struct omap2_mcspi_device_config ads7846_mcspi_config = {
243 .turbo_mode = 0,
244 .single_channel = 1, /* 0: slave, 1: master */
245};
246
247static int ads7846_get_pendown_state(void)
248{
249 return !gpio_get_value(CM_T35_GPIO_PENDOWN);
250}
251
252static struct ads7846_platform_data ads7846_config = {
253 .x_max = 0x0fff,
254 .y_max = 0x0fff,
255 .x_plate_ohms = 180,
256 .pressure_max = 255,
257 .debounce_max = 10,
258 .debounce_tol = 3,
259 .debounce_rep = 1,
260 .get_pendown_state = ads7846_get_pendown_state,
261 .keep_vref_on = 1,
262};
263
264static struct spi_board_info cm_t35_spi_board_info[] __initdata = {
265 {
266 .modalias = "ads7846",
267 .bus_num = 1,
268 .chip_select = 0,
269 .max_speed_hz = 1500000,
270 .controller_data = &ads7846_mcspi_config,
271 .irq = OMAP_GPIO_IRQ(CM_T35_GPIO_PENDOWN),
272 .platform_data = &ads7846_config,
273 },
274};
275
276static void __init cm_t35_init_ads7846(void)
277{
278 if ((gpio_request(CM_T35_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
279 (gpio_direction_input(CM_T35_GPIO_PENDOWN) == 0)) {
280 gpio_export(CM_T35_GPIO_PENDOWN, 0);
281 } else {
282 pr_err("CM-T35: could not obtain gpio for ADS7846_PENDOWN\n");
283 return;
284 }
285
286 spi_register_board_info(cm_t35_spi_board_info,
287 ARRAY_SIZE(cm_t35_spi_board_info));
288}
289#else
290static inline void cm_t35_init_ads7846(void) {}
291#endif
292
293#define CM_T35_LCD_EN_GPIO 157 181#define CM_T35_LCD_EN_GPIO 157
294#define CM_T35_LCD_BL_GPIO 58 182#define CM_T35_LCD_BL_GPIO 58
295#define CM_T35_DVI_EN_GPIO 54 183#define CM_T35_DVI_EN_GPIO 54
296 184
297static int lcd_bl_gpio;
298static int lcd_en_gpio;
299static int dvi_en_gpio;
300
301static int lcd_enabled; 185static int lcd_enabled;
302static int dvi_enabled; 186static int dvi_enabled;
303 187
@@ -308,8 +192,8 @@ static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev)
308 return -EINVAL; 192 return -EINVAL;
309 } 193 }
310 194
311 gpio_set_value(lcd_en_gpio, 1); 195 gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
312 gpio_set_value(lcd_bl_gpio, 1); 196 gpio_set_value(CM_T35_LCD_BL_GPIO, 1);
313 197
314 lcd_enabled = 1; 198 lcd_enabled = 1;
315 199
@@ -320,8 +204,8 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
320{ 204{
321 lcd_enabled = 0; 205 lcd_enabled = 0;
322 206
323 gpio_set_value(lcd_bl_gpio, 0); 207 gpio_set_value(CM_T35_LCD_BL_GPIO, 0);
324 gpio_set_value(lcd_en_gpio, 0); 208 gpio_set_value(CM_T35_LCD_EN_GPIO, 0);
325} 209}
326 210
327static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) 211static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
@@ -331,7 +215,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
331 return -EINVAL; 215 return -EINVAL;
332 } 216 }
333 217
334 gpio_set_value(dvi_en_gpio, 0); 218 gpio_set_value(CM_T35_DVI_EN_GPIO, 0);
335 dvi_enabled = 1; 219 dvi_enabled = 1;
336 220
337 return 0; 221 return 0;
@@ -339,7 +223,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
339 223
340static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) 224static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
341{ 225{
342 gpio_set_value(dvi_en_gpio, 1); 226 gpio_set_value(CM_T35_DVI_EN_GPIO, 1);
343 dvi_enabled = 0; 227 dvi_enabled = 0;
344} 228}
345 229
@@ -421,62 +305,38 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
421 }, 305 },
422}; 306};
423 307
308static struct gpio cm_t35_dss_gpios[] __initdata = {
309 { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" },
310 { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" },
311 { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" },
312};
313
424static void __init cm_t35_init_display(void) 314static void __init cm_t35_init_display(void)
425{ 315{
426 int err; 316 int err;
427 317
428 lcd_en_gpio = CM_T35_LCD_EN_GPIO;
429 lcd_bl_gpio = CM_T35_LCD_BL_GPIO;
430 dvi_en_gpio = CM_T35_DVI_EN_GPIO;
431
432 spi_register_board_info(cm_t35_lcd_spi_board_info, 318 spi_register_board_info(cm_t35_lcd_spi_board_info,
433 ARRAY_SIZE(cm_t35_lcd_spi_board_info)); 319 ARRAY_SIZE(cm_t35_lcd_spi_board_info));
434 320
435 err = gpio_request(lcd_en_gpio, "LCD RST"); 321 err = gpio_request_array(cm_t35_dss_gpios,
436 if (err) { 322 ARRAY_SIZE(cm_t35_dss_gpios));
437 pr_err("CM-T35: failed to get LCD reset GPIO\n");
438 goto out;
439 }
440
441 err = gpio_request(lcd_bl_gpio, "LCD BL");
442 if (err) { 323 if (err) {
443 pr_err("CM-T35: failed to get LCD backlight control GPIO\n"); 324 pr_err("CM-T35: failed to request DSS control GPIOs\n");
444 goto err_lcd_bl; 325 return;
445 }
446
447 err = gpio_request(dvi_en_gpio, "DVI EN");
448 if (err) {
449 pr_err("CM-T35: failed to get DVI reset GPIO\n");
450 goto err_dvi_en;
451 } 326 }
452 327
453 gpio_export(lcd_en_gpio, 0); 328 gpio_export(CM_T35_LCD_EN_GPIO, 0);
454 gpio_export(lcd_bl_gpio, 0); 329 gpio_export(CM_T35_LCD_BL_GPIO, 0);
455 gpio_export(dvi_en_gpio, 0); 330 gpio_export(CM_T35_DVI_EN_GPIO, 0);
456 gpio_direction_output(lcd_en_gpio, 0);
457 gpio_direction_output(lcd_bl_gpio, 0);
458 gpio_direction_output(dvi_en_gpio, 1);
459 331
460 msleep(50); 332 msleep(50);
461 gpio_set_value(lcd_en_gpio, 1); 333 gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
462 334
463 err = omap_display_init(&cm_t35_dss_data); 335 err = omap_display_init(&cm_t35_dss_data);
464 if (err) { 336 if (err) {
465 pr_err("CM-T35: failed to register DSS device\n"); 337 pr_err("CM-T35: failed to register DSS device\n");
466 goto err_dev_reg; 338 gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios));
467 } 339 }
468
469 return;
470
471err_dev_reg:
472 gpio_free(dvi_en_gpio);
473err_dvi_en:
474 gpio_free(lcd_bl_gpio);
475err_lcd_bl:
476 gpio_free(lcd_en_gpio);
477out:
478
479 return;
480} 340}
481 341
482static struct regulator_consumer_supply cm_t35_vmmc1_supply = { 342static struct regulator_consumer_supply cm_t35_vmmc1_supply = {
@@ -609,10 +469,8 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
609{ 469{
610 int wlan_rst = gpio + 2; 470 int wlan_rst = gpio + 2;
611 471
612 if ((gpio_request(wlan_rst, "WLAN RST") == 0) && 472 if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) {
613 (gpio_direction_output(wlan_rst, 1) == 0)) {
614 gpio_export(wlan_rst, 0); 473 gpio_export(wlan_rst, 0);
615
616 udelay(10); 474 udelay(10);
617 gpio_set_value(wlan_rst, 0); 475 gpio_set_value(wlan_rst, 0);
618 udelay(10); 476 udelay(10);
@@ -653,19 +511,9 @@ static struct twl4030_platform_data cm_t35_twldata = {
653 .vpll2 = &cm_t35_vpll2, 511 .vpll2 = &cm_t35_vpll2,
654}; 512};
655 513
656static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
657 {
658 I2C_BOARD_INFO("tps65930", 0x48),
659 .flags = I2C_CLIENT_WAKE,
660 .irq = INT_34XX_SYS_NIRQ,
661 .platform_data = &cm_t35_twldata,
662 },
663};
664
665static void __init cm_t35_init_i2c(void) 514static void __init cm_t35_init_i2c(void)
666{ 515{
667 omap_register_i2c_bus(1, 2600, cm_t35_i2c_boardinfo, 516 omap3_pmic_init("tps65930", &cm_t35_twldata);
668 ARRAY_SIZE(cm_t35_i2c_boardinfo));
669} 517}
670 518
671static void __init cm_t35_init_early(void) 519static void __init cm_t35_init_early(void)
@@ -775,12 +623,6 @@ static struct omap_board_mux board_mux[] __initdata = {
775}; 623};
776#endif 624#endif
777 625
778static struct omap_musb_board_data musb_board_data = {
779 .interface_type = MUSB_INTERFACE_ULPI,
780 .mode = MUSB_OTG,
781 .power = 100,
782};
783
784static struct omap_board_config_kernel cm_t35_config[] __initdata = { 626static struct omap_board_config_kernel cm_t35_config[] __initdata = {
785}; 627};
786 628
@@ -792,12 +634,12 @@ static void __init cm_t35_init(void)
792 omap_serial_init(); 634 omap_serial_init();
793 cm_t35_init_i2c(); 635 cm_t35_init_i2c();
794 cm_t35_init_nand(); 636 cm_t35_init_nand();
795 cm_t35_init_ads7846(); 637 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
796 cm_t35_init_ethernet(); 638 cm_t35_init_ethernet();
797 cm_t35_init_led(); 639 cm_t35_init_led();
798 cm_t35_init_display(); 640 cm_t35_init_display();
799 641
800 usb_musb_init(&musb_board_data); 642 usb_musb_init(NULL);
801 usbhs_init(&usbhs_bdata); 643 usbhs_init(&usbhs_bdata);
802} 644}
803 645