blob: 266b265090cd222034bb6cfd3c1feb64f05ed058 [file] [log] [blame]
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +01001/*
2 * Support for Wiliboard WBD-222
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/mdio-gpio.h>
19#include <linux/mtd/mtd.h>
20#include <linux/mtd/partitions.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/time.h>
24
25
26#include "common.h"
27
28static struct gpio_keys_button wbd222_keys[] = {
29 {
30 .code = KEY_SETUP,
31 .gpio = 5,
32 .active_low = 1,
33 .desc = "reset",
34 .type = EV_KEY,
35 },
36};
37
38static struct gpio_keys_platform_data wbd222_keys_data = {
39 .buttons = wbd222_keys,
40 .nbuttons = ARRAY_SIZE(wbd222_keys),
41};
42
43static struct platform_device wbd222_keys_device = {
44 .name = "gpio-keys",
45 .id = -1,
46 .dev = {
47 .platform_data = &wbd222_keys_data,
48 },
49};
50
51static struct gpio_led wbd222_leds[] = {
52 {
53 .name = "L3red",
54 .gpio = 1,
55 },
56 {
57 .name = "L4green",
58 .gpio = 2,
59 },
60 {
61 .name = "L4red",
62 .gpio = 3,
63 },
64 {
65 .name = "L3green",
66 .gpio = 5,
67 },
68};
69
70static struct gpio_led_platform_data wbd222_leds_data = {
71 .num_leds = ARRAY_SIZE(wbd222_leds),
72 .leds = wbd222_leds,
73};
74
75static struct platform_device wbd222_leds_device = {
76 .name = "leds-gpio",
77 .id = -1,
78 .dev = {
79 .platform_data = &wbd222_leds_data,
80 },
81};
82
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +010083static struct mtd_partition wbd222_partitions[] = {
84 {
85 .name = "RedBoot",
86 .offset = 0,
87 .size = 0x020000,
88 .mask_flags = MTD_WRITEABLE,
89 } , {
90 .name = "kernel",
91 .offset = 0x020000,
92 .size = 0x100000,
93 } , {
94 .name = "rootfs",
95 .offset = 0x120000,
96 .size = 0x6a0000,
97 } , {
98 .name = "VCTL",
99 .offset = 0x7c0000,
100 .size = 0x010000,
101 .mask_flags = MTD_WRITEABLE,
102 } , {
103 .name = "cfg",
104 .offset = 0x7d0000,
105 .size = 0x010000,
106 .mask_flags = MTD_WRITEABLE,
107 } , {
108 .name = "FIS",
109 .offset = 0x7e0000,
110 .size = 0x010000,
111 .mask_flags = MTD_WRITEABLE,
112 }
113};
Jamie Ilesc06addd2011-05-23 10:22:48 +0100114#define wbd222_num_partitions ARRAY_SIZE(wbd222_partitions)
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +0100115
116static void __init wbd222_init(void)
117{
118 gemini_gpio_init();
119 platform_register_uart();
120 platform_register_pflash(SZ_8M, wbd222_partitions,
121 wbd222_num_partitions);
122 platform_device_register(&wbd222_leds_device);
123 platform_device_register(&wbd222_keys_device);
Hans Ulli Krollf5126262010-12-26 11:02:29 +0100124 platform_register_rtc();
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +0100125}
126
127MACHINE_START(WBD222, "Wiliboard WBD-222")
Nicolas Pitre2b078cd2011-07-05 22:38:12 -0400128 .atag_offset = 0x100,
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +0100129 .map_io = gemini_map_io,
130 .init_irq = gemini_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700131 .init_time = gemini_timer_init,
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +0100132 .init_machine = wbd222_init,
Arnd Bergmann662146b2013-01-04 13:38:03 +0000133 .restart = gemini_restart,
Hans Ulli Kroll6a5f0d32010-05-13 06:34:29 +0100134MACHINE_END