diff options
Diffstat (limited to 'arch/arm/mach-pxa/colibri-pxa270-income.c')
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa270-income.c | 272 |
1 files changed, 272 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa270-income.c b/arch/arm/mach-pxa/colibri-pxa270-income.c new file mode 100644 index 000000000000..37f0f3ed7c61 --- /dev/null +++ b/arch/arm/mach-pxa/colibri-pxa270-income.c | |||
@@ -0,0 +1,272 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/income.c | ||
3 | * | ||
4 | * Support for Income s.r.o. SH-Dmaster PXA270 SBC | ||
5 | * | ||
6 | * Copyright (C) 2010 | ||
7 | * Marek Vasut <marek.vasut@gmail.com> | ||
8 | * Pavel Revak <palo@bielyvlk.sk> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/bitops.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/pwm_backlight.h> | ||
24 | #include <linux/sysdev.h> | ||
25 | |||
26 | #include <asm/irq.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/mmc.h> | ||
31 | #include <mach/ohci.h> | ||
32 | #include <mach/pxa27x.h> | ||
33 | #include <mach/pxa27x-udc.h> | ||
34 | #include <mach/pxafb.h> | ||
35 | |||
36 | #include <plat/i2c.h> | ||
37 | |||
38 | #include "devices.h" | ||
39 | #include "generic.h" | ||
40 | |||
41 | #define GPIO114_INCOME_ETH_IRQ (114) | ||
42 | #define GPIO0_INCOME_SD_DETECT (0) | ||
43 | #define GPIO0_INCOME_SD_RO (1) | ||
44 | #define GPIO54_INCOME_LED_A (54) | ||
45 | #define GPIO55_INCOME_LED_B (55) | ||
46 | #define GPIO113_INCOME_TS_IRQ (113) | ||
47 | |||
48 | /****************************************************************************** | ||
49 | * Pin configuration | ||
50 | ******************************************************************************/ | ||
51 | static mfp_cfg_t income_pin_config[] __initdata = { | ||
52 | /* MMC */ | ||
53 | GPIO32_MMC_CLK, | ||
54 | GPIO92_MMC_DAT_0, | ||
55 | GPIO109_MMC_DAT_1, | ||
56 | GPIO110_MMC_DAT_2, | ||
57 | GPIO111_MMC_DAT_3, | ||
58 | GPIO112_MMC_CMD, | ||
59 | GPIO0_GPIO, /* SD detect */ | ||
60 | GPIO1_GPIO, /* SD read-only */ | ||
61 | |||
62 | /* FFUART */ | ||
63 | GPIO39_FFUART_TXD, | ||
64 | GPIO34_FFUART_RXD, | ||
65 | |||
66 | /* BFUART */ | ||
67 | GPIO42_BTUART_RXD, | ||
68 | GPIO43_BTUART_TXD, | ||
69 | GPIO45_BTUART_RTS, | ||
70 | |||
71 | /* STUART */ | ||
72 | GPIO46_STUART_RXD, | ||
73 | GPIO47_STUART_TXD, | ||
74 | |||
75 | /* UHC */ | ||
76 | GPIO88_USBH1_PWR, | ||
77 | GPIO89_USBH1_PEN, | ||
78 | |||
79 | /* LCD */ | ||
80 | GPIOxx_LCD_TFT_16BPP, | ||
81 | |||
82 | /* PWM */ | ||
83 | GPIO16_PWM0_OUT, | ||
84 | |||
85 | /* I2C */ | ||
86 | GPIO117_I2C_SCL, | ||
87 | GPIO118_I2C_SDA, | ||
88 | |||
89 | /* LED */ | ||
90 | GPIO54_GPIO, /* LED A */ | ||
91 | GPIO55_GPIO, /* LED B */ | ||
92 | }; | ||
93 | |||
94 | /****************************************************************************** | ||
95 | * SD/MMC card controller | ||
96 | ******************************************************************************/ | ||
97 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
98 | static struct pxamci_platform_data income_mci_platform_data = { | ||
99 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
100 | .gpio_power = -1, | ||
101 | .gpio_card_detect = GPIO0_INCOME_SD_DETECT, | ||
102 | .gpio_card_ro = GPIO0_INCOME_SD_RO, | ||
103 | .detect_delay_ms = 200, | ||
104 | }; | ||
105 | |||
106 | static void __init income_mmc_init(void) | ||
107 | { | ||
108 | pxa_set_mci_info(&income_mci_platform_data); | ||
109 | } | ||
110 | #else | ||
111 | static inline void income_mmc_init(void) {} | ||
112 | #endif | ||
113 | |||
114 | /****************************************************************************** | ||
115 | * USB Host | ||
116 | ******************************************************************************/ | ||
117 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | ||
118 | static struct pxaohci_platform_data income_ohci_info = { | ||
119 | .port_mode = PMM_PERPORT_MODE, | ||
120 | .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, | ||
121 | }; | ||
122 | |||
123 | static void __init income_uhc_init(void) | ||
124 | { | ||
125 | pxa_set_ohci_info(&income_ohci_info); | ||
126 | } | ||
127 | #else | ||
128 | static inline void income_uhc_init(void) {} | ||
129 | #endif | ||
130 | |||
131 | /****************************************************************************** | ||
132 | * LED | ||
133 | ******************************************************************************/ | ||
134 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
135 | struct gpio_led income_gpio_leds[] = { | ||
136 | { | ||
137 | .name = "income:green:leda", | ||
138 | .default_trigger = "none", | ||
139 | .gpio = GPIO54_INCOME_LED_A, | ||
140 | .active_low = 1, | ||
141 | }, | ||
142 | { | ||
143 | .name = "income:green:ledb", | ||
144 | .default_trigger = "none", | ||
145 | .gpio = GPIO55_INCOME_LED_B, | ||
146 | .active_low = 1, | ||
147 | } | ||
148 | }; | ||
149 | |||
150 | static struct gpio_led_platform_data income_gpio_led_info = { | ||
151 | .leds = income_gpio_leds, | ||
152 | .num_leds = ARRAY_SIZE(income_gpio_leds), | ||
153 | }; | ||
154 | |||
155 | static struct platform_device income_leds = { | ||
156 | .name = "leds-gpio", | ||
157 | .id = -1, | ||
158 | .dev = { | ||
159 | .platform_data = &income_gpio_led_info, | ||
160 | } | ||
161 | }; | ||
162 | |||
163 | static void __init income_led_init(void) | ||
164 | { | ||
165 | platform_device_register(&income_leds); | ||
166 | } | ||
167 | #else | ||
168 | static inline void income_led_init(void) {} | ||
169 | #endif | ||
170 | |||
171 | /****************************************************************************** | ||
172 | * I2C | ||
173 | ******************************************************************************/ | ||
174 | #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE) | ||
175 | static struct i2c_board_info __initdata income_i2c_devs[] = { | ||
176 | { | ||
177 | I2C_BOARD_INFO("ds1340", 0x68), | ||
178 | }, { | ||
179 | I2C_BOARD_INFO("lm75", 0x4f), | ||
180 | }, | ||
181 | }; | ||
182 | |||
183 | static void __init income_i2c_init(void) | ||
184 | { | ||
185 | pxa_set_i2c_info(NULL); | ||
186 | pxa27x_set_i2c_power_info(NULL); | ||
187 | i2c_register_board_info(0, ARRAY_AND_SIZE(income_i2c_devs)); | ||
188 | } | ||
189 | #else | ||
190 | static inline void income_i2c_init(void) {} | ||
191 | #endif | ||
192 | |||
193 | /****************************************************************************** | ||
194 | * Framebuffer | ||
195 | ******************************************************************************/ | ||
196 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
197 | static struct pxafb_mode_info income_lcd_modes[] = { | ||
198 | { | ||
199 | .pixclock = 144700, | ||
200 | .xres = 320, | ||
201 | .yres = 240, | ||
202 | .bpp = 32, | ||
203 | .depth = 18, | ||
204 | |||
205 | .left_margin = 10, | ||
206 | .right_margin = 10, | ||
207 | .upper_margin = 7, | ||
208 | .lower_margin = 8, | ||
209 | |||
210 | .hsync_len = 20, | ||
211 | .vsync_len = 2, | ||
212 | |||
213 | .sync = FB_SYNC_VERT_HIGH_ACT, | ||
214 | }, | ||
215 | }; | ||
216 | |||
217 | static struct pxafb_mach_info income_lcd_screen = { | ||
218 | .modes = income_lcd_modes, | ||
219 | .num_modes = ARRAY_SIZE(income_lcd_modes), | ||
220 | .lcd_conn = LCD_COLOR_TFT_18BPP | LCD_PCLK_EDGE_FALL, | ||
221 | }; | ||
222 | |||
223 | static void __init income_lcd_init(void) | ||
224 | { | ||
225 | set_pxa_fb_info(&income_lcd_screen); | ||
226 | } | ||
227 | #else | ||
228 | static inline void income_lcd_init(void) {} | ||
229 | #endif | ||
230 | |||
231 | /****************************************************************************** | ||
232 | * Backlight | ||
233 | ******************************************************************************/ | ||
234 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM__MODULE) | ||
235 | static struct platform_pwm_backlight_data income_backlight_data = { | ||
236 | .pwm_id = 0, | ||
237 | .max_brightness = 0x3ff, | ||
238 | .dft_brightness = 0x1ff, | ||
239 | .pwm_period_ns = 1000000, | ||
240 | }; | ||
241 | |||
242 | static struct platform_device income_backlight = { | ||
243 | .name = "pwm-backlight", | ||
244 | .dev = { | ||
245 | .parent = &pxa27x_device_pwm0.dev, | ||
246 | .platform_data = &income_backlight_data, | ||
247 | }, | ||
248 | }; | ||
249 | |||
250 | static void __init income_pwm_init(void) | ||
251 | { | ||
252 | platform_device_register(&income_backlight); | ||
253 | } | ||
254 | #else | ||
255 | static inline void income_pwm_init(void) {} | ||
256 | #endif | ||
257 | |||
258 | void __init colibri_pxa270_income_boardinit(void) | ||
259 | { | ||
260 | pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config)); | ||
261 | pxa_set_ffuart_info(NULL); | ||
262 | pxa_set_btuart_info(NULL); | ||
263 | pxa_set_stuart_info(NULL); | ||
264 | |||
265 | income_mmc_init(); | ||
266 | income_uhc_init(); | ||
267 | income_led_init(); | ||
268 | income_i2c_init(); | ||
269 | income_lcd_init(); | ||
270 | income_pwm_init(); | ||
271 | } | ||
272 | |||