3552ad06c3a00730539f2eca965a9101481a0e97
[openwrt/svn-archive/archive.git] / target / linux / gemini / patches / 002-wbd111_support.patch
1 --- /dev/null
2 +++ b/arch/arm/mach-gemini/board-wbd111.c
3 @@ -0,0 +1,123 @@
4 +/*
5 + * Support for Wiliboard WBD-111
6 + *
7 + * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
8 + *
9 + * This program is free software; you can redistribute it and/or modify
10 + * it under the terms of the GNU General Public License as published by
11 + * the Free Software Foundation; either version 2 of the License, or
12 + * (at your option) any later version.
13 + */
14 +#include <linux/kernel.h>
15 +#include <linux/init.h>
16 +#include <linux/platform_device.h>
17 +#include <linux/leds.h>
18 +#include <linux/input.h>
19 +#include <linux/gpio_keys.h>
20 +#include <linux/mdio-gpio.h>
21 +#include <asm/mach-types.h>
22 +#include <asm/mach/arch.h>
23 +#include <asm/mach/time.h>
24 +
25 +#include <mach/gmac.h>
26 +
27 +#include "common.h"
28 +
29 +static struct mdio_gpio_platform_data wbd111_mdio = {
30 + .mdc = 22,
31 + .mdio = 21,
32 + .phy_mask = ~(1 << 1),
33 +};
34 +
35 +static struct platform_device wbd111_phy_device = {
36 + .name = "mdio-gpio",
37 + .id = 0,
38 + .dev = {
39 + .platform_data = &wbd111_mdio,
40 + },
41 +};
42 +
43 +static struct gemini_gmac_platform_data gmac_data = {
44 + .bus_id[0] = "0:01",
45 + .interface[0] = PHY_INTERFACE_MODE_MII,
46 +};
47 +
48 +static struct gpio_keys_button wbd111_keys[] = {
49 + {
50 + .code = KEY_SETUP,
51 + .gpio = 5,
52 + .active_low = 1,
53 + .desc = "reset",
54 + .type = EV_KEY,
55 + },
56 +};
57 +
58 +static struct gpio_keys_platform_data wbd111_keys_data = {
59 + .buttons = wbd111_keys,
60 + .nbuttons = ARRAY_SIZE(wbd111_keys),
61 +};
62 +
63 +static struct platform_device wbd111_keys_device = {
64 + .name = "gpio-keys",
65 + .id = -1,
66 + .dev = {
67 + .platform_data = &wbd111_keys_data,
68 + },
69 +};
70 +
71 +static struct gpio_led wbd111_leds[] = {
72 + {
73 + .name = "L3red",
74 + .gpio = 1,
75 + },
76 + {
77 + .name = "L4green",
78 + .gpio = 2,
79 + },
80 + {
81 + .name = "L4red",
82 + .gpio = 3,
83 + },
84 + {
85 + .name = "L3green",
86 + .gpio = 5,
87 + },
88 +};
89 +
90 +static struct gpio_led_platform_data wbd111_leds_data = {
91 + .num_leds = ARRAY_SIZE(wbd111_leds),
92 + .leds = wbd111_leds,
93 +};
94 +
95 +static struct platform_device wbd111_leds_device = {
96 + .name = "leds-gpio",
97 + .id = -1,
98 + .dev = {
99 + .platform_data = &wbd111_leds_data,
100 + },
101 +};
102 +
103 +static struct sys_timer wbd111_timer = {
104 + .init = gemini_timer_init,
105 +};
106 +
107 +static void __init wbd111_init(void)
108 +{
109 + gemini_gpio_init();
110 + platform_register_uart();
111 + platform_register_pflash(SZ_8M, NULL, 0);
112 + platform_device_register(&wbd111_leds_device);
113 + platform_device_register(&wbd111_keys_device);
114 + platform_device_register(&wbd111_phy_device);
115 + platform_register_ethernet(&gmac_data);
116 +}
117 +
118 +MACHINE_START(WBD111, "Wiliboard WBD-111")
119 + .phys_io = 0x7fffc000,
120 + .io_pg_offst = ((0xffffc000) >> 18) & 0xfffc,
121 + .boot_params = 0x100,
122 + .map_io = gemini_map_io,
123 + .init_irq = gemini_init_irq,
124 + .timer = &wbd111_timer,
125 + .init_machine = wbd111_init,
126 +MACHINE_END
127 --- a/arch/arm/mach-gemini/Kconfig
128 +++ b/arch/arm/mach-gemini/Kconfig
129 @@ -16,6 +16,13 @@ config MACH_RUT100
130 Say Y here if you intend to run this kernel on a
131 Teltonika 3G Router RUT100.
132
133 +config MACH_WBD111
134 + bool "Wiliboard WBD-111"
135 + select GEMINI_MEM_SWAP
136 + help
137 + Say Y here if you intend to run this kernel on a
138 + Wiliboard WBD-111.
139 +
140 endmenu
141
142 config GEMINI_MEM_SWAP
143 --- a/arch/arm/mach-gemini/Makefile
144 +++ b/arch/arm/mach-gemini/Makefile
145 @@ -11,3 +11,4 @@ obj-$(CONFIG_PCI) += pci.o
146 # Board-specific support
147 obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o
148 obj-$(CONFIG_MACH_RUT100) += board-rut1xx.o
149 +obj-$(CONFIG_MACH_WBD111) += board-wbd111.o