1 #include <linux/platform_device.h>
2 #include <linux/mtd/mtd.h>
3 #include <linux/mtd/physmap.h>
4 #include <linux/gpio.h>
5 #include <linux/leds.h>
7 #include <mach/common.h>
8 #include <mach/hardware.h>
9 #include <asm/mach-types.h>
10 #include <asm/mach/arch.h>
11 #include <asm/mach/time.h>
12 #include <asm/mach/map.h>
13 #include <mach/imx-uart.h>
14 #include <mach/imxfb.h>
15 #include <mach/iomux-mx21.h>
16 #include <mach/board-vp6500.h>
20 #include <linux/input.h>
21 #include <linux/input/matrix_keypad.h>
22 #include <linux/gpio_keys.h>
23 #include <linux/pwm_backlight.h>
25 static unsigned int vp6500_pins
[] = {
58 VP6500_GPIO_BACKLIGHT_EN
| GPIO_GPIO
| GPIO_OUT
,
63 static struct physmap_flash_data vp6500_flash_data
= {
67 static struct resource vp6500_flash_resource
= {
68 .start
= MX21_CS0_BASE_ADDR
,
69 .end
= MX21_CS0_BASE_ADDR
+ SZ_64M
- 1,
70 .flags
= IORESOURCE_MEM
,
73 static struct platform_device vp6500_nor_mtd_device
= {
74 .name
= "physmap-flash",
77 .platform_data
= &vp6500_flash_data
,
80 .resource
= &vp6500_flash_resource
,
85 static struct gpio_led vp6500_leds
[] = {
87 .name
= "vp6500:orange:keypad",
88 .gpio
= VP6500_GPIO_LED_KEYPAD
,
91 .name
= "vp6500:green:",
92 .gpio
= VP6500_GPIO_LED_GREEN
,
94 .default_state
= LEDS_GPIO_DEFSTATE_ON
,
97 .name
= "vp6500:red:",
98 .gpio
= VP6500_GPIO_LED_RED
,
101 .name
= "vp6500:red:camera",
102 .gpio
= VP6500_GPIO_LED_CAMERA
,
106 static struct gpio_led_platform_data vp6500_leds_data
= {
108 .num_leds
= ARRAY_SIZE(vp6500_leds
),
111 static struct platform_device vp6500_leds_device
= {
115 .platform_data
= &vp6500_leds_data
,
121 static const uint32_t vp6500_keypad_keys
[] = {
123 KEY(0, 4, KEY_RIGHT
),
125 KEY(1, 1, KEY_NUMERIC_POUND
),
127 KEY(1, 3, KEY_ENTER
),
134 KEY(3, 0, KEY_CAMERA
),
135 KEY(3, 1, KEY_NUMERIC_STAR
),
146 static struct matrix_keymap_data vp6500_keypad_data
= {
147 .keymap
= vp6500_keypad_keys
,
148 .keymap_size
= ARRAY_SIZE(vp6500_keypad_keys
),
151 static struct resource vp6500_keypad_resources
[] = {
153 .start
= MX21_KPP_BASE_ADDR
,
154 .end
= MX21_KPP_BASE_ADDR
+ 0x10 - 1,
155 .flags
= IORESOURCE_MEM
,
158 .start
= MX21_INT_KPP
,
159 .flags
= IORESOURCE_IRQ
,
163 static struct platform_device vp6500_keypad_device
= {
164 .name
= "imx-keypad",
167 .platform_data
= &vp6500_keypad_data
,
169 .resource
= vp6500_keypad_resources
,
170 .num_resources
= ARRAY_SIZE(vp6500_keypad_resources
),
173 static struct gpio_keys_button vp6500_keys
= {
174 .gpio
= VP6500_GPIO_POWER_KEY
,
176 .desc
= "Power button",
180 static struct gpio_keys_platform_data vp6500_key_data
= {
181 .buttons
= &vp6500_keys
,
185 static struct platform_device vp6500_key_device
= {
189 .platform_data
= &vp6500_key_data
,
195 static int vp6500_backlight_notify(struct device
*dev
, int brightness
)
197 gpio_set_value(VP6500_GPIO_BACKLIGHT_EN
, !!brightness
);
202 static struct platform_pwm_backlight_data vp6500_backlight_data
= {
203 .max_brightness
= 255,
204 .dft_brightness
= 100,
205 .pwm_period_ns
= 15000000,
206 .notify
= vp6500_backlight_notify
,
209 static struct platform_device vp6500_backlight_device
= {
210 .name
= "pwm-backlight",
213 .parent
= &mxc_pwm_device
.dev
,
214 .platform_data
= &vp6500_backlight_data
,
219 static struct platform_device
*platform_devices
[] __initdata
= {
220 &vp6500_nor_mtd_device
,
222 &vp6500_keypad_device
,
224 &vp6500_backlight_device
,
227 static void __init
vp6500_board_init(void)
229 mxc_gpio_setup_multiple_pins(vp6500_pins
, ARRAY_SIZE(vp6500_pins
),
232 mxc_register_device(&mxc_uart_device0
, NULL
);
233 mxc_register_device(&mxc_pwm_device
, NULL
);
235 platform_add_devices(platform_devices
, ARRAY_SIZE(platform_devices
));
238 static void __init
vp6500_timer_init(void)
240 mx21_clocks_init(32768, 26000000);
243 static struct sys_timer vp6500_timer
= {
244 .init
= vp6500_timer_init
,
247 MACHINE_START(VP6500
, "Phillips VP6500")
248 .phys_io
= MX21_AIPI_BASE_ADDR
,
249 .io_pg_offst
= ((MX21_AIPI_BASE_ADDR_VIRT
) >> 18) & 0xfffc,
250 .boot_params
= MX21_PHYS_OFFSET
+ 0x100,
251 .map_io
= mx21_map_io
,
252 .init_irq
= mx21_init_irq
,
253 .init_machine
= vp6500_board_init
,
254 .timer
= &vp6500_timer
,