add support for more lantiq AR9 boards
[openwrt/openwrt.git] / target / linux / lantiq / patches-2.6.39 / 602-wbmr.patch
1 --- a/arch/mips/lantiq/machtypes.h
2 +++ b/arch/mips/lantiq/machtypes.h
3 @@ -40,6 +40,9 @@
4
5 /* Gigaset */
6 LANTIQ_MACH_GIGASX76X, /* Gigaset SX76x */
7 +
8 + /* Buffalo */
9 + LANTIQ_MACH_WBMR, /* WBMR-HP-G300H */
10 };
11
12 #endif
13 --- a/arch/mips/lantiq/xway/Kconfig
14 +++ b/arch/mips/lantiq/xway/Kconfig
15 @@ -19,6 +19,11 @@
16 select LTQ_DEV_GPIO_BUTTONS
17 default y
18
19 +config LANTIQ_MACH_WBMR
20 + bool "WBMR-HP-G300H"
21 + select LTQ_DEV_GPIO_BUTTONS
22 + default y
23 +
24 endmenu
25
26 endif
27 --- a/arch/mips/lantiq/xway/Makefile
28 +++ b/arch/mips/lantiq/xway/Makefile
29 @@ -8,4 +8,5 @@
30 obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
31 obj-$(CONFIG_LANTIQ_MACH_NETGEAR) += mach-netgear.o
32 obj-$(CONFIG_LANTIQ_MACH_GIGASX76X) += mach-gigasx76x.o
33 +obj-$(CONFIG_LANTIQ_MACH_WBMR) += mach-wbmr.o
34 obj-y += dev-dwc_otg.o
35 --- /dev/null
36 +++ b/arch/mips/lantiq/xway/mach-wbmr.c
37 @@ -0,0 +1,120 @@
38 +/*
39 + * This program is free software; you can redistribute it and/or modify it
40 + * under the terms of the GNU General Public License version 2 as published
41 + * by the Free Software Foundation.
42 + *
43 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
44 + */
45 +
46 +#include <linux/init.h>
47 +#include <linux/platform_device.h>
48 +#include <linux/leds.h>
49 +#include <linux/gpio.h>
50 +#include <linux/gpio_buttons.h>
51 +#include <linux/mtd/mtd.h>
52 +#include <linux/mtd/partitions.h>
53 +#include <linux/mtd/physmap.h>
54 +#include <linux/input.h>
55 +
56 +#include <lantiq_soc.h>
57 +#include <irq.h>
58 +
59 +#include "../machtypes.h"
60 +#include "devices.h"
61 +#include "dev-leds-gpio.h"
62 +#include "dev-dwc_otg.h"
63 +#include "../dev-gpio-buttons.h"
64 +
65 +static struct mtd_partition wbmr_partitions[] =
66 +{
67 + {
68 + .name = "uboot",
69 + .offset = 0x0,
70 + .size = 0x40000,
71 + },
72 + {
73 + .name = "uboot-env",
74 + .offset = 0x40000,
75 + .size = 0x20000,
76 + },
77 + {
78 + .name = "linux",
79 + .offset = 0x60000,
80 + .size = 0x1f20000,
81 + },
82 + {
83 + .name = "calibration",
84 + .offset = 0x1fe0000,
85 + .size = 0x20000,
86 + },
87 +};
88 +
89 +static struct physmap_flash_data wbmr_flash_data = {
90 + .nr_parts = ARRAY_SIZE(wbmr_partitions),
91 + .parts = wbmr_partitions,
92 +};
93 +
94 +static struct gpio_led
95 +wbmr_leds_gpio[] __initdata = {
96 + { .name = "soc:blue:movie", .gpio = 20, .active_low = 1, },
97 + { .name = "soc:red:internet", .gpio = 18, .active_low = 1, },
98 + { .name = "soc:green:internet", .gpio = 17, .active_low = 1, },
99 + { .name = "soc:green:adsl", .gpio = 16, .active_low = 1, },
100 + { .name = "soc:green:wlan", .gpio = 15, .active_low = 1, },
101 + { .name = "soc:red:security", .gpio = 14, .active_low = 1, },
102 + { .name = "soc:green:power", .gpio = 1, .active_low = 1, },
103 + { .name = "soc:red:power", .gpio = 5, .active_low = 1, },
104 + { .name = "soc:green:usb", .gpio = 28, .active_low = 1, },
105 +};
106 +
107 +static struct gpio_keys_button
108 +wbmr_gpio_keys[] __initdata = {
109 + {
110 + .desc = "aoss",
111 + .type = EV_KEY,
112 + .code = BTN_0,
113 + .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
114 + .gpio = 0,
115 + .active_low = 1,
116 + },
117 + {
118 + .desc = "reset",
119 + .type = EV_KEY,
120 + .code = BTN_1,
121 + .debounce_interval = LTQ_KEYS_DEBOUNCE_INTERVAL,
122 + .gpio = 37,
123 + .active_low = 1,
124 + },
125 +};
126 +
127 +static struct ltq_pci_data ltq_pci_data = {
128 + .clock = PCI_CLOCK_INT,
129 + .gpio = PCI_GNT1 | PCI_REQ1,
130 + .irq = {
131 + [14] = INT_NUM_IM0_IRL0 + 22,
132 + },
133 +};
134 +
135 +static struct ltq_eth_data ltq_eth_data = {
136 + .mii_mode = PHY_INTERFACE_MODE_MII,
137 +};
138 +
139 +static void __init
140 +wbmr_init(void)
141 +{
142 +#define WMBR_BRN_MAC 0x1fd0024
143 +
144 + ltq_add_device_leds_gpio(-1, ARRAY_SIZE(wbmr_leds_gpio), wbmr_leds_gpio);
145 + ltq_register_gpio_keys_polled(-1, LTQ_KEYS_POLL_INTERVAL, ARRAY_SIZE(wbmr_gpio_keys), wbmr_gpio_keys);
146 + ltq_register_nor(&wbmr_flash_data);
147 + ltq_register_pci(&ltq_pci_data);
148 + memcpy_fromio(&ltq_eth_data.mac.sa_data,
149 + (void *)KSEG1ADDR(LTQ_FLASH_START + WMBR_BRN_MAC), 6);
150 + ltq_register_etop(&ltq_eth_data);
151 + xway_register_dwc(36);
152 +}
153 +
154 +MIPS_MACHINE(LANTIQ_MACH_WBMR,
155 + "WBMR",
156 + "WBMR",
157 + wbmr_init);