[ARM] pxa/income: Add Income SBC support
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-pxa / colibri-pxa270-income.c
blob37f0f3ed7c612d87b8974609da07bcfb4511c4e6
1 /*
2 * linux/arch/arm/mach-pxa/income.c
4 * Support for Income s.r.o. SH-Dmaster PXA270 SBC
6 * Copyright (C) 2010
7 * Marek Vasut <marek.vasut@gmail.com>
8 * Pavel Revak <palo@bielyvlk.sk>
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.
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>
26 #include <asm/irq.h>
27 #include <asm/mach-types.h>
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>
36 #include <plat/i2c.h>
38 #include "devices.h"
39 #include "generic.h"
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)
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 */
62 /* FFUART */
63 GPIO39_FFUART_TXD,
64 GPIO34_FFUART_RXD,
66 /* BFUART */
67 GPIO42_BTUART_RXD,
68 GPIO43_BTUART_TXD,
69 GPIO45_BTUART_RTS,
71 /* STUART */
72 GPIO46_STUART_RXD,
73 GPIO47_STUART_TXD,
75 /* UHC */
76 GPIO88_USBH1_PWR,
77 GPIO89_USBH1_PEN,
79 /* LCD */
80 GPIOxx_LCD_TFT_16BPP,
82 /* PWM */
83 GPIO16_PWM0_OUT,
85 /* I2C */
86 GPIO117_I2C_SCL,
87 GPIO118_I2C_SDA,
89 /* LED */
90 GPIO54_GPIO, /* LED A */
91 GPIO55_GPIO, /* LED B */
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,
106 static void __init income_mmc_init(void)
108 pxa_set_mci_info(&income_mci_platform_data);
110 #else
111 static inline void income_mmc_init(void) {}
112 #endif
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,
123 static void __init income_uhc_init(void)
125 pxa_set_ohci_info(&income_ohci_info);
127 #else
128 static inline void income_uhc_init(void) {}
129 #endif
131 /******************************************************************************
132 * LED
133 ******************************************************************************/
134 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
135 struct gpio_led income_gpio_leds[] = {
137 .name = "income:green:leda",
138 .default_trigger = "none",
139 .gpio = GPIO54_INCOME_LED_A,
140 .active_low = 1,
143 .name = "income:green:ledb",
144 .default_trigger = "none",
145 .gpio = GPIO55_INCOME_LED_B,
146 .active_low = 1,
150 static struct gpio_led_platform_data income_gpio_led_info = {
151 .leds = income_gpio_leds,
152 .num_leds = ARRAY_SIZE(income_gpio_leds),
155 static struct platform_device income_leds = {
156 .name = "leds-gpio",
157 .id = -1,
158 .dev = {
159 .platform_data = &income_gpio_led_info,
163 static void __init income_led_init(void)
165 platform_device_register(&income_leds);
167 #else
168 static inline void income_led_init(void) {}
169 #endif
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[] = {
177 I2C_BOARD_INFO("ds1340", 0x68),
178 }, {
179 I2C_BOARD_INFO("lm75", 0x4f),
183 static void __init income_i2c_init(void)
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));
189 #else
190 static inline void income_i2c_init(void) {}
191 #endif
193 /******************************************************************************
194 * Framebuffer
195 ******************************************************************************/
196 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
197 static struct pxafb_mode_info income_lcd_modes[] = {
199 .pixclock = 144700,
200 .xres = 320,
201 .yres = 240,
202 .bpp = 32,
203 .depth = 18,
205 .left_margin = 10,
206 .right_margin = 10,
207 .upper_margin = 7,
208 .lower_margin = 8,
210 .hsync_len = 20,
211 .vsync_len = 2,
213 .sync = FB_SYNC_VERT_HIGH_ACT,
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,
223 static void __init income_lcd_init(void)
225 set_pxa_fb_info(&income_lcd_screen);
227 #else
228 static inline void income_lcd_init(void) {}
229 #endif
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,
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,
250 static void __init income_pwm_init(void)
252 platform_device_register(&income_backlight);
254 #else
255 static inline void income_pwm_init(void) {}
256 #endif
258 void __init colibri_pxa270_income_boardinit(void)
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);
265 income_mmc_init();
266 income_uhc_init();
267 income_led_init();
268 income_i2c_init();
269 income_lcd_init();
270 income_pwm_init();