diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-3430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-3430sdp.c | 155 |
1 files changed, 25 insertions, 130 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 9afd087cc29c..ae2963a98041 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/input.h> | 19 | #include <linux/input.h> |
20 | #include <linux/input/matrix_keypad.h> | 20 | #include <linux/input/matrix_keypad.h> |
21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
22 | #include <linux/spi/ads7846.h> | ||
23 | #include <linux/i2c/twl.h> | 22 | #include <linux/i2c/twl.h> |
24 | #include <linux/regulator/machine.h> | 23 | #include <linux/regulator/machine.h> |
25 | #include <linux/io.h> | 24 | #include <linux/io.h> |
@@ -37,8 +36,8 @@ | |||
37 | #include <plat/common.h> | 36 | #include <plat/common.h> |
38 | #include <plat/dma.h> | 37 | #include <plat/dma.h> |
39 | #include <plat/gpmc.h> | 38 | #include <plat/gpmc.h> |
40 | #include <plat/display.h> | 39 | #include <video/omapdss.h> |
41 | #include <plat/panel-generic-dpi.h> | 40 | #include <video/omap-panel-generic-dpi.h> |
42 | 41 | ||
43 | #include <plat/gpmc-smc91x.h> | 42 | #include <plat/gpmc-smc91x.h> |
44 | 43 | ||
@@ -48,6 +47,7 @@ | |||
48 | #include "hsmmc.h" | 47 | #include "hsmmc.h" |
49 | #include "pm.h" | 48 | #include "pm.h" |
50 | #include "control.h" | 49 | #include "control.h" |
50 | #include "common-board-devices.h" | ||
51 | 51 | ||
52 | #define CONFIG_DISABLE_HFCLK 1 | 52 | #define CONFIG_DISABLE_HFCLK 1 |
53 | 53 | ||
@@ -59,24 +59,6 @@ | |||
59 | 59 | ||
60 | #define TWL4030_MSECURE_GPIO 22 | 60 | #define TWL4030_MSECURE_GPIO 22 |
61 | 61 | ||
62 | /* FIXME: These values need to be updated based on more profiling on 3430sdp*/ | ||
63 | static struct cpuidle_params omap3_cpuidle_params_table[] = { | ||
64 | /* C1 */ | ||
65 | {1, 2, 2, 5}, | ||
66 | /* C2 */ | ||
67 | {1, 10, 10, 30}, | ||
68 | /* C3 */ | ||
69 | {1, 50, 50, 300}, | ||
70 | /* C4 */ | ||
71 | {1, 1500, 1800, 4000}, | ||
72 | /* C5 */ | ||
73 | {1, 2500, 7500, 12000}, | ||
74 | /* C6 */ | ||
75 | {1, 3000, 8500, 15000}, | ||
76 | /* C7 */ | ||
77 | {1, 10000, 30000, 300000}, | ||
78 | }; | ||
79 | |||
80 | static uint32_t board_keymap[] = { | 62 | static uint32_t board_keymap[] = { |
81 | KEY(0, 0, KEY_LEFT), | 63 | KEY(0, 0, KEY_LEFT), |
82 | KEY(0, 1, KEY_RIGHT), | 64 | KEY(0, 1, KEY_RIGHT), |
@@ -123,63 +105,14 @@ static struct twl4030_keypad_data sdp3430_kp_data = { | |||
123 | .rep = 1, | 105 | .rep = 1, |
124 | }; | 106 | }; |
125 | 107 | ||
126 | static int ts_gpio; /* Needed for ads7846_get_pendown_state */ | ||
127 | |||
128 | /** | ||
129 | * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq | ||
130 | * | ||
131 | * @return - void. If request gpio fails then Flag KERN_ERR. | ||
132 | */ | ||
133 | static void ads7846_dev_init(void) | ||
134 | { | ||
135 | if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) { | ||
136 | printk(KERN_ERR "can't get ads746 pen down GPIO\n"); | ||
137 | return; | ||
138 | } | ||
139 | |||
140 | gpio_direction_input(ts_gpio); | ||
141 | gpio_set_debounce(ts_gpio, 310); | ||
142 | } | ||
143 | |||
144 | static int ads7846_get_pendown_state(void) | ||
145 | { | ||
146 | return !gpio_get_value(ts_gpio); | ||
147 | } | ||
148 | |||
149 | static struct ads7846_platform_data tsc2046_config __initdata = { | ||
150 | .get_pendown_state = ads7846_get_pendown_state, | ||
151 | .keep_vref_on = 1, | ||
152 | .wakeup = true, | ||
153 | }; | ||
154 | |||
155 | |||
156 | static struct omap2_mcspi_device_config tsc2046_mcspi_config = { | ||
157 | .turbo_mode = 0, | ||
158 | .single_channel = 1, /* 0: slave, 1: master */ | ||
159 | }; | ||
160 | |||
161 | static struct spi_board_info sdp3430_spi_board_info[] __initdata = { | ||
162 | [0] = { | ||
163 | /* | ||
164 | * TSC2046 operates at a max freqency of 2MHz, so | ||
165 | * operate slightly below at 1.5MHz | ||
166 | */ | ||
167 | .modalias = "ads7846", | ||
168 | .bus_num = 1, | ||
169 | .chip_select = 0, | ||
170 | .max_speed_hz = 1500000, | ||
171 | .controller_data = &tsc2046_mcspi_config, | ||
172 | .irq = 0, | ||
173 | .platform_data = &tsc2046_config, | ||
174 | }, | ||
175 | }; | ||
176 | |||
177 | |||
178 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 | 108 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 |
179 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 | 109 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 |
180 | 110 | ||
181 | static unsigned backlight_gpio; | 111 | static struct gpio sdp3430_dss_gpios[] __initdata = { |
182 | static unsigned enable_gpio; | 112 | {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" }, |
113 | {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, | ||
114 | }; | ||
115 | |||
183 | static int lcd_enabled; | 116 | static int lcd_enabled; |
184 | static int dvi_enabled; | 117 | static int dvi_enabled; |
185 | 118 | ||
@@ -187,29 +120,11 @@ static void __init sdp3430_display_init(void) | |||
187 | { | 120 | { |
188 | int r; | 121 | int r; |
189 | 122 | ||
190 | enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; | 123 | r = gpio_request_array(sdp3430_dss_gpios, |
191 | backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; | 124 | ARRAY_SIZE(sdp3430_dss_gpios)); |
192 | 125 | if (r) | |
193 | r = gpio_request(enable_gpio, "LCD reset"); | 126 | printk(KERN_ERR "failed to get LCD control GPIOs\n"); |
194 | if (r) { | ||
195 | printk(KERN_ERR "failed to get LCD reset GPIO\n"); | ||
196 | goto err0; | ||
197 | } | ||
198 | |||
199 | r = gpio_request(backlight_gpio, "LCD Backlight"); | ||
200 | if (r) { | ||
201 | printk(KERN_ERR "failed to get LCD backlight GPIO\n"); | ||
202 | goto err1; | ||
203 | } | ||
204 | |||
205 | gpio_direction_output(enable_gpio, 0); | ||
206 | gpio_direction_output(backlight_gpio, 0); | ||
207 | 127 | ||
208 | return; | ||
209 | err1: | ||
210 | gpio_free(enable_gpio); | ||
211 | err0: | ||
212 | return; | ||
213 | } | 128 | } |
214 | 129 | ||
215 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | 130 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) |
@@ -219,8 +134,8 @@ static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | |||
219 | return -EINVAL; | 134 | return -EINVAL; |
220 | } | 135 | } |
221 | 136 | ||
222 | gpio_direction_output(enable_gpio, 1); | 137 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); |
223 | gpio_direction_output(backlight_gpio, 1); | 138 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); |
224 | 139 | ||
225 | lcd_enabled = 1; | 140 | lcd_enabled = 1; |
226 | 141 | ||
@@ -231,8 +146,8 @@ static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
231 | { | 146 | { |
232 | lcd_enabled = 0; | 147 | lcd_enabled = 0; |
233 | 148 | ||
234 | gpio_direction_output(enable_gpio, 0); | 149 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); |
235 | gpio_direction_output(backlight_gpio, 0); | 150 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); |
236 | } | 151 | } |
237 | 152 | ||
238 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) | 153 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -360,12 +275,10 @@ static int sdp3430_twl_gpio_setup(struct device *dev, | |||
360 | omap2_hsmmc_init(mmc); | 275 | omap2_hsmmc_init(mmc); |
361 | 276 | ||
362 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ | 277 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ |
363 | gpio_request(gpio + 7, "sub_lcd_en_bkl"); | 278 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl"); |
364 | gpio_direction_output(gpio + 7, 0); | ||
365 | 279 | ||
366 | /* gpio + 15 is "sub_lcd_nRST" (output) */ | 280 | /* gpio + 15 is "sub_lcd_nRST" (output) */ |
367 | gpio_request(gpio + 15, "sub_lcd_nRST"); | 281 | gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST"); |
368 | gpio_direction_output(gpio + 15, 0); | ||
369 | 282 | ||
370 | return 0; | 283 | return 0; |
371 | } | 284 | } |
@@ -580,20 +493,10 @@ static struct twl4030_platform_data sdp3430_twldata = { | |||
580 | .vpll2 = &sdp3430_vpll2, | 493 | .vpll2 = &sdp3430_vpll2, |
581 | }; | 494 | }; |
582 | 495 | ||
583 | static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { | ||
584 | { | ||
585 | I2C_BOARD_INFO("twl4030", 0x48), | ||
586 | .flags = I2C_CLIENT_WAKE, | ||
587 | .irq = INT_34XX_SYS_NIRQ, | ||
588 | .platform_data = &sdp3430_twldata, | ||
589 | }, | ||
590 | }; | ||
591 | |||
592 | static int __init omap3430_i2c_init(void) | 496 | static int __init omap3430_i2c_init(void) |
593 | { | 497 | { |
594 | /* i2c1 for PMIC only */ | 498 | /* i2c1 for PMIC only */ |
595 | omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo, | 499 | omap3_pmic_init("twl4030", &sdp3430_twldata); |
596 | ARRAY_SIZE(sdp3430_i2c_boardinfo)); | ||
597 | /* i2c2 on camera connector (for sensor control) and optional isp1301 */ | 500 | /* i2c2 on camera connector (for sensor control) and optional isp1301 */ |
598 | omap_register_i2c_bus(2, 400, NULL, 0); | 501 | omap_register_i2c_bus(2, 400, NULL, 0); |
599 | /* i2c3 on display connector (for DVI, tfp410) */ | 502 | /* i2c3 on display connector (for DVI, tfp410) */ |
@@ -872,30 +775,22 @@ static struct flash_partitions sdp_flash_partitions[] = { | |||
872 | }, | 775 | }, |
873 | }; | 776 | }; |
874 | 777 | ||
875 | static struct omap_musb_board_data musb_board_data = { | ||
876 | .interface_type = MUSB_INTERFACE_ULPI, | ||
877 | .mode = MUSB_OTG, | ||
878 | .power = 100, | ||
879 | }; | ||
880 | |||
881 | static void __init omap_3430sdp_init(void) | 778 | static void __init omap_3430sdp_init(void) |
882 | { | 779 | { |
780 | int gpio_pendown; | ||
781 | |||
883 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 782 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
884 | omap_board_config = sdp3430_config; | 783 | omap_board_config = sdp3430_config; |
885 | omap_board_config_size = ARRAY_SIZE(sdp3430_config); | 784 | omap_board_config_size = ARRAY_SIZE(sdp3430_config); |
886 | omap3_pm_init_cpuidle(omap3_cpuidle_params_table); | ||
887 | omap3430_i2c_init(); | 785 | omap3430_i2c_init(); |
888 | omap_display_init(&sdp3430_dss_data); | 786 | omap_display_init(&sdp3430_dss_data); |
889 | if (omap_rev() > OMAP3430_REV_ES1_0) | 787 | if (omap_rev() > OMAP3430_REV_ES1_0) |
890 | ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2; | 788 | gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2; |
891 | else | 789 | else |
892 | ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1; | 790 | gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1; |
893 | sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio); | 791 | omap_ads7846_init(1, gpio_pendown, 310, NULL); |
894 | spi_register_board_info(sdp3430_spi_board_info, | ||
895 | ARRAY_SIZE(sdp3430_spi_board_info)); | ||
896 | ads7846_dev_init(); | ||
897 | board_serial_init(); | 792 | board_serial_init(); |
898 | usb_musb_init(&musb_board_data); | 793 | usb_musb_init(NULL); |
899 | board_smc91x_init(); | 794 | board_smc91x_init(); |
900 | board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); | 795 | board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); |
901 | sdp3430_display_init(); | 796 | sdp3430_display_init(); |