diff options
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa3xx.c')
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa3xx.c | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c new file mode 100644 index 000000000000..12d0afc54aa5 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa3xx.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/colibri-pxa3xx.c | ||
3 | * | ||
4 | * Common functions for all Toradex PXA3xx modules | ||
5 | * | ||
6 | * Daniel Mack <daniel@caiaq.de> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <asm/mach-types.h> | ||
18 | #include <mach/hardware.h> | ||
19 | #include <asm/sizes.h> | ||
20 | #include <asm/mach/arch.h> | ||
21 | #include <asm/mach/irq.h> | ||
22 | #include <mach/pxa3xx-regs.h> | ||
23 | #include <mach/mfp-pxa300.h> | ||
24 | #include <mach/colibri.h> | ||
25 | #include <mach/mmc.h> | ||
26 | #include <mach/pxafb.h> | ||
27 | |||
28 | #include "generic.h" | ||
29 | #include "devices.h" | ||
30 | |||
31 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
32 | static int mmc_detect_pin; | ||
33 | |||
34 | static int colibri_pxa3xx_mci_init(struct device *dev, | ||
35 | irq_handler_t colibri_mmc_detect_int, | ||
36 | void *data) | ||
37 | { | ||
38 | int ret; | ||
39 | |||
40 | ret = gpio_request(mmc_detect_pin, "mmc card detect"); | ||
41 | if (ret) | ||
42 | return ret; | ||
43 | |||
44 | gpio_direction_input(mmc_detect_pin); | ||
45 | ret = request_irq(gpio_to_irq(mmc_detect_pin), colibri_mmc_detect_int, | ||
46 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
47 | "MMC card detect", data); | ||
48 | if (ret) { | ||
49 | gpio_free(mmc_detect_pin); | ||
50 | return ret; | ||
51 | } | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static void colibri_pxa3xx_mci_exit(struct device *dev, void *data) | ||
57 | { | ||
58 | free_irq(mmc_detect_pin, data); | ||
59 | gpio_free(gpio_to_irq(mmc_detect_pin)); | ||
60 | } | ||
61 | |||
62 | static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = { | ||
63 | .detect_delay = 20, | ||
64 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
65 | .init = colibri_pxa3xx_mci_init, | ||
66 | .exit = colibri_pxa3xx_mci_exit, | ||
67 | }; | ||
68 | |||
69 | void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin) | ||
70 | { | ||
71 | pxa3xx_mfp_config(pins, len); | ||
72 | mmc_detect_pin = detect_pin; | ||
73 | pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data); | ||
74 | } | ||
75 | #endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */ | ||
76 | |||
77 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
78 | static int lcd_bl_pin; | ||
79 | |||
80 | /* | ||
81 | * LCD panel (Sharp LQ043T3DX02) | ||
82 | */ | ||
83 | static void colibri_lcd_backlight(int on) | ||
84 | { | ||
85 | gpio_set_value(lcd_bl_pin, !!on); | ||
86 | } | ||
87 | |||
88 | static struct pxafb_mode_info sharp_lq43_mode = { | ||
89 | .pixclock = 101936, | ||
90 | .xres = 480, | ||
91 | .yres = 272, | ||
92 | .bpp = 32, | ||
93 | .depth = 18, | ||
94 | .hsync_len = 41, | ||
95 | .left_margin = 2, | ||
96 | .right_margin = 2, | ||
97 | .vsync_len = 10, | ||
98 | .upper_margin = 2, | ||
99 | .lower_margin = 2, | ||
100 | .sync = 0, | ||
101 | .cmap_greyscale = 0, | ||
102 | }; | ||
103 | |||
104 | static struct pxafb_mach_info sharp_lq43_info = { | ||
105 | .modes = &sharp_lq43_mode, | ||
106 | .num_modes = 1, | ||
107 | .cmap_inverse = 0, | ||
108 | .cmap_static = 0, | ||
109 | .lcd_conn = LCD_COLOR_TFT_18BPP, | ||
110 | .pxafb_backlight_power = colibri_lcd_backlight, | ||
111 | }; | ||
112 | |||
113 | void __init colibri_pxa3xx_init_lcd(int bl_pin) | ||
114 | { | ||
115 | lcd_bl_pin = bl_pin; | ||
116 | gpio_request(bl_pin, "lcd backlight"); | ||
117 | gpio_direction_output(bl_pin, 0); | ||
118 | set_pxa_fb_info(&sharp_lq43_info); | ||
119 | } | ||
120 | #endif | ||
121 | |||