aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmt5.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-08-16 13:42:58 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-08-16 13:42:58 -0400
commite4862f2f6f5653dfb67f3ba2b6f0bc74516ed51a (patch)
tree1db5a0540a4eecfad9b7daee476b985e82ddc810 /arch/arm/mach-pxa/palmt5.c
parentec62dbd7eb8e3dddb221da89ecbcea0fc3dee8c1 (diff)
parentb2c1e07b81a126e5846dfc3d36f559d861df59f4 (diff)
Merge branch 'for-2.6.36' into for-2.6.37
Fairly simple conflicts, the most serious ones are the i.MX ones which I suspect now need another rename. Conflicts: arch/arm/mach-mx2/clock_imx27.c arch/arm/mach-mx2/devices.c arch/arm/mach-omap2/board-rx51-peripherals.c arch/arm/mach-omap2/board-zoom2.c sound/soc/fsl/mpc5200_dma.c sound/soc/fsl/mpc5200_dma.h sound/soc/fsl/mpc8610_hpcd.c sound/soc/pxa/spitz.c
Diffstat (limited to 'arch/arm/mach-pxa/palmt5.c')
-rw-r--r--arch/arm/mach-pxa/palmt5.c284
1 files changed, 35 insertions, 249 deletions
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 5305a3993e6..1c281995f65 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -21,10 +21,11 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/gpio_keys.h> 22#include <linux/gpio_keys.h>
23#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/memblock.h>
24#include <linux/pda_power.h> 25#include <linux/pda_power.h>
25#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
26#include <linux/gpio.h> 27#include <linux/gpio.h>
27#include <linux/wm97xx_batt.h> 28#include <linux/wm97xx.h>
28#include <linux/power_supply.h> 29#include <linux/power_supply.h>
29#include <linux/usb/gpio_vbus.h> 30#include <linux/usb/gpio_vbus.h>
30 31
@@ -41,6 +42,7 @@
41#include <mach/pxa27x_keypad.h> 42#include <mach/pxa27x_keypad.h>
42#include <mach/udc.h> 43#include <mach/udc.h>
43#include <mach/palmasoc.h> 44#include <mach/palmasoc.h>
45#include <mach/palm27x.h>
44 46
45#include "generic.h" 47#include "generic.h"
46#include "devices.h" 48#include "devices.h"
@@ -103,19 +105,9 @@ static unsigned long palmt5_pin_config[] __initdata = {
103}; 105};
104 106
105/****************************************************************************** 107/******************************************************************************
106 * SD/MMC card controller
107 ******************************************************************************/
108static struct pxamci_platform_data palmt5_mci_platform_data = {
109 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
110 .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N,
111 .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY,
112 .gpio_power = GPIO_NR_PALMT5_SD_POWER,
113 .detect_delay_ms = 200,
114};
115
116/******************************************************************************
117 * GPIO keyboard 108 * GPIO keyboard
118 ******************************************************************************/ 109 ******************************************************************************/
110#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
119static unsigned int palmt5_matrix_keys[] = { 111static unsigned int palmt5_matrix_keys[] = {
120 KEY(0, 0, KEY_POWER), 112 KEY(0, 0, KEY_POWER),
121 KEY(0, 1, KEY_F1), 113 KEY(0, 1, KEY_F1),
@@ -141,9 +133,18 @@ static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
141 .debounce_interval = 30, 133 .debounce_interval = 30,
142}; 134};
143 135
136static void __init palmt5_kpc_init(void)
137{
138 pxa_set_keypad_info(&palmt5_keypad_platform_data);
139}
140#else
141static inline void palmt5_kpc_init(void) {}
142#endif
143
144/****************************************************************************** 144/******************************************************************************
145 * GPIO keys 145 * GPIO keys
146 ******************************************************************************/ 146 ******************************************************************************/
147#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
147static struct gpio_keys_button palmt5_pxa_buttons[] = { 148static struct gpio_keys_button palmt5_pxa_buttons[] = {
148 {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" }, 149 {KEY_F8, GPIO_NR_PALMT5_HOTSYNC_BUTTON_N, 1, "HotSync Button" },
149}; 150};
@@ -161,259 +162,43 @@ static struct platform_device palmt5_pxa_keys = {
161 }, 162 },
162}; 163};
163 164
164/****************************************************************************** 165static void __init palmt5_keys_init(void)
165 * Backlight
166 ******************************************************************************/
167static int palmt5_backlight_init(struct device *dev)
168{
169 int ret;
170
171 ret = gpio_request(GPIO_NR_PALMT5_BL_POWER, "BL POWER");
172 if (ret)
173 goto err;
174 ret = gpio_direction_output(GPIO_NR_PALMT5_BL_POWER, 0);
175 if (ret)
176 goto err2;
177 ret = gpio_request(GPIO_NR_PALMT5_LCD_POWER, "LCD POWER");
178 if (ret)
179 goto err2;
180 ret = gpio_direction_output(GPIO_NR_PALMT5_LCD_POWER, 0);
181 if (ret)
182 goto err3;
183
184 return 0;
185err3:
186 gpio_free(GPIO_NR_PALMT5_LCD_POWER);
187err2:
188 gpio_free(GPIO_NR_PALMT5_BL_POWER);
189err:
190 return ret;
191}
192
193static int palmt5_backlight_notify(struct device *dev, int brightness)
194{
195 gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness);
196 gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness);
197 return brightness;
198}
199
200static void palmt5_backlight_exit(struct device *dev)
201{
202 gpio_free(GPIO_NR_PALMT5_BL_POWER);
203 gpio_free(GPIO_NR_PALMT5_LCD_POWER);
204}
205
206static struct platform_pwm_backlight_data palmt5_backlight_data = {
207 .pwm_id = 0,
208 .max_brightness = PALMT5_MAX_INTENSITY,
209 .dft_brightness = PALMT5_MAX_INTENSITY,
210 .pwm_period_ns = PALMT5_PERIOD_NS,
211 .init = palmt5_backlight_init,
212 .notify = palmt5_backlight_notify,
213 .exit = palmt5_backlight_exit,
214};
215
216static struct platform_device palmt5_backlight = {
217 .name = "pwm-backlight",
218 .dev = {
219 .parent = &pxa27x_device_pwm0.dev,
220 .platform_data = &palmt5_backlight_data,
221 },
222};
223
224/******************************************************************************
225 * IrDA
226 ******************************************************************************/
227static struct pxaficp_platform_data palmt5_ficp_platform_data = {
228 .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE,
229 .transceiver_cap = IR_SIRMODE | IR_OFF,
230};
231
232/******************************************************************************
233 * UDC
234 ******************************************************************************/
235static struct gpio_vbus_mach_info palmt5_udc_info = {
236 .gpio_vbus = GPIO_NR_PALMT5_USB_DETECT_N,
237 .gpio_vbus_inverted = 1,
238 .gpio_pullup = GPIO_NR_PALMT5_USB_PULLUP,
239};
240
241static struct platform_device palmt5_gpio_vbus = {
242 .name = "gpio-vbus",
243 .id = -1,
244 .dev = {
245 .platform_data = &palmt5_udc_info,
246 },
247};
248
249/******************************************************************************
250 * Power supply
251 ******************************************************************************/
252static int power_supply_init(struct device *dev)
253{ 166{
254 int ret; 167 platform_device_register(&palmt5_pxa_keys);
255
256 ret = gpio_request(GPIO_NR_PALMT5_POWER_DETECT, "CABLE_STATE_AC");
257 if (ret)
258 goto err1;
259 ret = gpio_direction_input(GPIO_NR_PALMT5_POWER_DETECT);
260 if (ret)
261 goto err2;
262
263 return 0;
264err2:
265 gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
266err1:
267 return ret;
268}
269
270static int palmt5_is_ac_online(void)
271{
272 return gpio_get_value(GPIO_NR_PALMT5_POWER_DETECT);
273}
274
275static void power_supply_exit(struct device *dev)
276{
277 gpio_free(GPIO_NR_PALMT5_POWER_DETECT);
278}
279
280static char *palmt5_supplicants[] = {
281 "main-battery",
282};
283
284static struct pda_power_pdata power_supply_info = {
285 .init = power_supply_init,
286 .is_ac_online = palmt5_is_ac_online,
287 .exit = power_supply_exit,
288 .supplied_to = palmt5_supplicants,
289 .num_supplicants = ARRAY_SIZE(palmt5_supplicants),
290};
291
292static struct platform_device power_supply = {
293 .name = "pda-power",
294 .id = -1,
295 .dev = {
296 .platform_data = &power_supply_info,
297 },
298};
299
300/******************************************************************************
301 * WM97xx battery
302 ******************************************************************************/
303static struct wm97xx_batt_info wm97xx_batt_pdata = {
304 .batt_aux = WM97XX_AUX_ID3,
305 .temp_aux = WM97XX_AUX_ID2,
306 .charge_gpio = -1,
307 .max_voltage = PALMT5_BAT_MAX_VOLTAGE,
308 .min_voltage = PALMT5_BAT_MIN_VOLTAGE,
309 .batt_mult = 1000,
310 .batt_div = 414,
311 .temp_mult = 1,
312 .temp_div = 1,
313 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO,
314 .batt_name = "main-batt",
315};
316
317/******************************************************************************
318 * aSoC audio
319 ******************************************************************************/
320static struct palm27x_asoc_info palmt5_asoc_pdata = {
321 .jack_gpio = GPIO_NR_PALMT5_EARPHONE_DETECT,
322};
323
324static pxa2xx_audio_ops_t palmt5_ac97_pdata = {
325 .reset_gpio = 95,
326};
327
328static struct platform_device palmt5_asoc = {
329 .name = "palm27x-asoc",
330 .id = -1,
331 .dev = {
332 .platform_data = &palmt5_asoc_pdata,
333 },
334};
335
336/******************************************************************************
337 * Framebuffer
338 ******************************************************************************/
339static struct pxafb_mode_info palmt5_lcd_modes[] = {
340{
341 .pixclock = 57692,
342 .xres = 320,
343 .yres = 480,
344 .bpp = 16,
345
346 .left_margin = 32,
347 .right_margin = 1,
348 .upper_margin = 7,
349 .lower_margin = 1,
350
351 .hsync_len = 4,
352 .vsync_len = 1,
353},
354};
355
356static struct pxafb_mach_info palmt5_lcd_screen = {
357 .modes = palmt5_lcd_modes,
358 .num_modes = ARRAY_SIZE(palmt5_lcd_modes),
359 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
360};
361
362/******************************************************************************
363 * Power management - standby
364 ******************************************************************************/
365static void __init palmt5_pm_init(void)
366{
367 static u32 resume[] = {
368 0xe3a00101, /* mov r0, #0x40000000 */
369 0xe380060f, /* orr r0, r0, #0x00f00000 */
370 0xe590f008, /* ldr pc, [r0, #0x08] */
371 };
372
373 /* copy the bootloader */
374 memcpy(phys_to_virt(PALMT5_STR_BASE), resume, sizeof(resume));
375} 168}
169#else
170static inline void palmt5_keys_init(void) {}
171#endif
376 172
377/****************************************************************************** 173/******************************************************************************
378 * Machine init 174 * Machine init
379 ******************************************************************************/ 175 ******************************************************************************/
380static struct platform_device *devices[] __initdata = { 176static void __init palmt5_reserve(void)
381#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
382 &palmt5_pxa_keys,
383#endif
384 &palmt5_backlight,
385 &power_supply,
386 &palmt5_asoc,
387 &palmt5_gpio_vbus,
388};
389
390/* setup udc GPIOs initial state */
391static void __init palmt5_udc_init(void)
392{ 177{
393 if (!gpio_request(GPIO_NR_PALMT5_USB_PULLUP, "UDC Vbus")) { 178 memblock_reserve(0xa0200000, 0x1000);
394 gpio_direction_output(GPIO_NR_PALMT5_USB_PULLUP, 1);
395 gpio_free(GPIO_NR_PALMT5_USB_PULLUP);
396 }
397} 179}
398 180
399static void __init palmt5_init(void) 181static void __init palmt5_init(void)
400{ 182{
401 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); 183 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
402
403 pxa_set_ffuart_info(NULL); 184 pxa_set_ffuart_info(NULL);
404 pxa_set_btuart_info(NULL); 185 pxa_set_btuart_info(NULL);
405 pxa_set_stuart_info(NULL); 186 pxa_set_stuart_info(NULL);
406 187
407 palmt5_pm_init(); 188 palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
408 set_pxa_fb_info(&palmt5_lcd_screen); 189 GPIO_NR_PALMT5_SD_POWER, 0);
409 pxa_set_mci_info(&palmt5_mci_platform_data); 190 palm27x_pm_init(PALMT5_STR_BASE);
410 palmt5_udc_init(); 191 palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
411 pxa_set_ac97_info(&palmt5_ac97_pdata); 192 palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
412 pxa_set_ficp_info(&palmt5_ficp_platform_data); 193 GPIO_NR_PALMT5_USB_PULLUP, 1);
413 pxa_set_keypad_info(&palmt5_keypad_platform_data); 194 palm27x_irda_init(GPIO_NR_PALMT5_IR_DISABLE);
414 wm97xx_bat_set_pdata(&wm97xx_batt_pdata); 195 palm27x_ac97_init(PALMT5_BAT_MIN_VOLTAGE, PALMT5_BAT_MAX_VOLTAGE,
415 196 GPIO_NR_PALMT5_EARPHONE_DETECT, 95);
416 platform_add_devices(devices, ARRAY_SIZE(devices)); 197 palm27x_pwm_init(GPIO_NR_PALMT5_BL_POWER, GPIO_NR_PALMT5_LCD_POWER);
198 palm27x_power_init(GPIO_NR_PALMT5_POWER_DETECT, -1);
199 palm27x_pmic_init();
200 palmt5_kpc_init();
201 palmt5_keys_init();
417} 202}
418 203
419MACHINE_START(PALMT5, "Palm Tungsten|T5") 204MACHINE_START(PALMT5, "Palm Tungsten|T5")
@@ -421,6 +206,7 @@ MACHINE_START(PALMT5, "Palm Tungsten|T5")
421 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 206 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
422 .boot_params = 0xa0000100, 207 .boot_params = 0xa0000100,
423 .map_io = pxa_map_io, 208 .map_io = pxa_map_io,
209 .reserve = palmt5_reserve,
424 .init_irq = pxa27x_init_irq, 210 .init_irq = pxa27x_init_irq,
425 .timer = &pxa_timer, 211 .timer = &pxa_timer,
426 .init_machine = palmt5_init 212 .init_machine = palmt5_init