20327743a91c8277a38b352be2bbc9a4706459e7
[openwrt.git] / target / linux / mx2 / files / arch / arm / mach-mx2 / mach-vp6500.c
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>
6
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>
17
18 #include "devices.h"
19
20 #include <linux/input.h>
21 #include <linux/input/matrix_keypad.h>
22
23 static unsigned int vp6500_pins[] = {
24
25         /* UART1 */
26         PE12_PF_UART1_TXD,
27         PE13_PF_UART1_RXD,
28
29 #if 0
30         /* LCDC */
31         PA5_PF_LSCLK,
32         PA6_PF_LD0,
33         PA7_PF_LD1,
34         PA8_PF_LD2,
35         PA9_PF_LD3,
36         PA10_PF_LD4,
37         PA11_PF_LD5,
38         PA12_PF_LD6,
39         PA13_PF_LD7,
40         PA14_PF_LD8,
41         PA15_PF_LD9,
42         PA16_PF_LD10,
43         PA17_PF_LD11,
44         PA18_PF_LD12,
45         PA19_PF_LD13,
46         PA20_PF_LD14,
47         PA21_PF_LD15,
48         PA22_PF_LD16,
49         PA28_PF_HSYNC,
50         PA29_PF_VSYNC,
51         PA30_PF_CONTRAST,
52         PA31_PF_OE_ACD,
53 #endif
54 };
55
56 static struct physmap_flash_data vp6500_flash_data = {
57         .width = 2,
58 };
59
60 static struct resource vp6500_flash_resource = {
61         .start = MX21_CS0_BASE_ADDR,
62         .end = MX21_CS0_BASE_ADDR + SZ_64M - 1,
63         .flags = IORESOURCE_MEM,
64 };
65
66 static struct platform_device vp6500_nor_mtd_device = {
67         .name = "physmap-flash",
68         .id = -1,
69         .dev = {
70                 .platform_data = &vp6500_flash_data,
71         },
72         .num_resources = 1,
73         .resource = &vp6500_flash_resource,
74 };
75
76 static struct gpio_led vp6500_leds[] = {
77         {
78                 .name = "vp6500:orange:keypad",
79                 .gpio = VP6500_GPIO_KEYPAD_LEDS,
80         },
81 };
82
83 static struct gpio_led_platform_data vp6500_leds_data = {
84         .leds           = vp6500_leds,
85         .num_leds       = ARRAY_SIZE(vp6500_leds),
86 };
87
88 static struct platform_device vp6500_leds_device = {
89         .name = "leds-gpio",
90         .id = -1,
91         .dev = {
92                 .platform_data = &vp6500_leds_data,
93         },
94 };
95
96 static struct platform_device *platform_devices[] __initdata = {
97         &vp6500_nor_mtd_device,
98         &vp6500_leds_device,
99 };
100
101 static void __init vp6500_board_init(void)
102 {
103         mxc_gpio_setup_multiple_pins(vp6500_pins, ARRAY_SIZE(vp6500_pins),
104                         "vp6500");
105
106         mxc_register_device(&mxc_uart_device0, NULL);
107
108         platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
109 }
110
111 static void __init vp6500_timer_init(void)
112 {
113         mx21_clocks_init(32768, 26000000);
114 }
115
116 static struct sys_timer vp6500_timer = {
117         .init   = vp6500_timer_init,
118 };
119
120 MACHINE_START(VP6500, "Phillips VP6500")
121         .phys_io        = MX21_AIPI_BASE_ADDR,
122         .io_pg_offst    = ((MX21_AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
123         .boot_params    = MX21_PHYS_OFFSET + 0x100,
124         .map_io         = mx21_map_io,
125         .init_irq       = mx21_init_irq,
126         .init_machine   = vp6500_board_init,
127         .timer          = &vp6500_timer,
128 MACHINE_END