GNU Linux-libre 4.4.299-gnu1
[releases.git] / arch / arm / mach-gemini / board-wbd111.c
1 /*
2  *  Support for Wiliboard WBD-111
3  *
4  *  Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/leds.h>
15 #include <linux/input.h>
16 #include <linux/skbuff.h>
17 #include <linux/gpio_keys.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/partitions.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/time.h>
23
24
25 #include "common.h"
26
27 static struct gpio_keys_button wbd111_keys[] = {
28         {
29                 .code           = KEY_SETUP,
30                 .gpio           = 5,
31                 .active_low     = 1,
32                 .desc           = "reset",
33                 .type           = EV_KEY,
34         },
35 };
36
37 static struct gpio_keys_platform_data wbd111_keys_data = {
38         .buttons        = wbd111_keys,
39         .nbuttons       = ARRAY_SIZE(wbd111_keys),
40 };
41
42 static struct platform_device wbd111_keys_device = {
43         .name   = "gpio-keys",
44         .id     = -1,
45         .dev    = {
46                 .platform_data = &wbd111_keys_data,
47         },
48 };
49
50 static struct gpio_led wbd111_leds[] = {
51         {
52                 .name                   = "L3red",
53                 .gpio                   = 1,
54         },
55         {
56                 .name                   = "L4green",
57                 .gpio                   = 2,
58         },
59         {
60                 .name                   = "L4red",
61                 .gpio                   = 3,
62         },
63         {
64                 .name                   = "L3green",
65                 .gpio                   = 5,
66         },
67 };
68
69 static struct gpio_led_platform_data wbd111_leds_data = {
70         .num_leds       = ARRAY_SIZE(wbd111_leds),
71         .leds           = wbd111_leds,
72 };
73
74 static struct platform_device wbd111_leds_device = {
75         .name   = "leds-gpio",
76         .id     = -1,
77         .dev    = {
78                 .platform_data = &wbd111_leds_data,
79         },
80 };
81
82 static struct mtd_partition wbd111_partitions[] = {
83         {
84                 .name           = "RedBoot",
85                 .offset         = 0,
86                 .size           = 0x020000,
87                 .mask_flags     = MTD_WRITEABLE,
88         } , {
89                 .name           = "kernel",
90                 .offset         = 0x020000,
91                 .size           = 0x100000,
92         } , {
93                 .name           = "rootfs",
94                 .offset         = 0x120000,
95                 .size           = 0x6a0000,
96         } , {
97                 .name           = "VCTL",
98                 .offset         = 0x7c0000,
99                 .size           = 0x010000,
100                 .mask_flags     = MTD_WRITEABLE,
101         } , {
102                 .name           = "cfg",
103                 .offset         = 0x7d0000,
104                 .size           = 0x010000,
105                 .mask_flags     = MTD_WRITEABLE,
106         } , {
107                 .name           = "FIS",
108                 .offset         = 0x7e0000,
109                 .size           = 0x010000,
110                 .mask_flags     = MTD_WRITEABLE,
111         }
112 };
113 #define wbd111_num_partitions  ARRAY_SIZE(wbd111_partitions)
114
115 static void __init wbd111_init(void)
116 {
117         gemini_gpio_init();
118         platform_register_uart();
119         platform_register_pflash(SZ_8M, wbd111_partitions,
120                                  wbd111_num_partitions);
121         platform_device_register(&wbd111_leds_device);
122         platform_device_register(&wbd111_keys_device);
123         platform_register_rtc();
124 }
125
126 MACHINE_START(WBD111, "Wiliboard WBD-111")
127         .atag_offset    = 0x100,
128         .map_io         = gemini_map_io,
129         .init_irq       = gemini_init_irq,
130         .init_time      = gemini_timer_init,
131         .init_machine   = wbd111_init,
132         .restart        = gemini_restart,
133 MACHINE_END