[lantiq] adds new lantiq kernel. once the codebase is fully tested and know to be...
[openwrt.git] / target / linux / lantiq / patches / 400-mach-arv45xx.patch
1 --- a/arch/mips/include/asm/mach-lantiq/machine.h
2 +++ b/arch/mips/include/asm/mach-lantiq/machine.h
3 @@ -11,4 +11,7 @@
4         LANTIQ_MACH_EASY4010,           /* Twinpass evalkit */
5         LANTIQ_MACH_EASY50712,          /* Danube evalkit */
6         LANTIQ_MACH_EASY50812,          /* AR9 eval board */
7 +       LANTIQ_MACH_ARV4518,            /* Airties WAV-221, SMC-7908A-ISP */
8 +       LANTIQ_MACH_ARV452,                     /* Airties WAV-281, Arcor EasyboxA800 */
9 +       LANTIQ_MACH_ARV4525,            /* Speedport W502V */
10  };
11 --- a/arch/mips/lantiq/xway/Kconfig
12 +++ b/arch/mips/lantiq/xway/Kconfig
13 @@ -14,6 +14,10 @@
14         bool "Easy4010"
15         default y
16  
17 +config LANTIQ_MACH_ARV45XX
18 +       bool "ARV45XX"
19 +       default y
20 +
21  endmenu
22  
23  endif
24 --- a/arch/mips/lantiq/xway/Makefile
25 +++ b/arch/mips/lantiq/xway/Makefile
26 @@ -3,3 +3,4 @@
27  obj-$(CONFIG_LANTIQ_MACH_EASY50812) += mach-easy50812.o
28  obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
29  obj-$(CONFIG_LANTIQ_MACH_EASY4010) += mach-easy4010.o
30 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
31 --- /dev/null
32 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
33 @@ -0,0 +1,178 @@
34 +/*
35 + *  This program is free software; you can redistribute it and/or modify it
36 + *  under the terms of the GNU General Public License version 2 as published
37 + *  by the Free Software Foundation.
38 + *
39 + *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
40 + */
41 +
42 +#include <linux/init.h>
43 +#include <linux/platform_device.h>
44 +#include <linux/leds.h>
45 +#include <linux/gpio.h>
46 +#include <linux/gpio_buttons.h>
47 +#include <linux/mtd/mtd.h>
48 +#include <linux/mtd/partitions.h>
49 +#include <linux/mtd/physmap.h>
50 +#include <linux/input.h>
51 +#include <linux/etherdevice.h>
52 +
53 +#include <machine.h>
54 +
55 +#include <xway.h>
56 +#include <lantiq_platform.h>
57 +
58 +#include "devices.h"
59 +
60 +#define ARV452_LATCH_SWITCH            (1 << 10)
61 +
62 +#ifdef CONFIG_MTD_PARTITIONS
63 +static struct mtd_partition arv45xx_partitions[] =
64 +{
65 +       {
66 +               .name   = "uboot",
67 +               .offset = 0x0,
68 +               .size   = 0x20000,
69 +       },
70 +       {
71 +               .name   = "uboot_env",
72 +               .offset = 0x20000,
73 +               .size   = 0x10000,
74 +       },
75 +       {
76 +               .name   = "linux",
77 +               .offset = 0x30000,
78 +               .size   = 0x3c0000,
79 +       },
80 +       {
81 +               .name   = "board_config",
82 +               .offset = 0x3f0000,
83 +               .size   = 0x10000,
84 +       },
85 +};
86 +#endif
87 +
88 +static struct physmap_flash_data arv45xx_flash_data = {
89 +#ifdef CONFIG_MTD_PARTITIONS
90 +       .nr_parts       = ARRAY_SIZE(arv45xx_partitions),
91 +       .parts          = arv45xx_partitions,
92 +#endif
93 +};
94 +
95 +static struct lq_pci_data lq_pci_data = {
96 +       .clock      = PCI_CLOCK_EXT,
97 +       .req_mask   = 0xf,
98 +};
99 +
100 +static struct lq_eth_data lq_eth_data = {
101 +       .mii_mode       = REV_MII_MODE,
102 +       .mac            = "\xff\xff\xff\xff\xff\xff",
103 +};
104 +
105 +static struct gpio_led
106 +arv4518_leds_gpio[] __initdata = {
107 +       { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
108 +       { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
109 +       { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
110 +       { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
111 +       { .name = "soc:yello:wps", .gpio = 7, .active_low = 1, },
112 +       { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
113 +       { .name = "soc:blue:voip", .gpio = 32, .active_low = 1, },
114 +       { .name = "soc:blue:fxs1", .gpio = 33, .active_low = 1, },
115 +       { .name = "soc:blue:fxs2", .gpio = 34, .active_low = 1, },
116 +       { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, },
117 +       { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, },
118 +       { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, },
119 +       { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, },
120 +};
121 +
122 +static struct gpio_led
123 +arv452_leds_gpio[] __initdata = {
124 +       { .name = "soc:blue:power", .gpio = 3, .active_low = 1, },
125 +       { .name = "soc:blue:adsl", .gpio = 4, .active_low = 1, },
126 +       { .name = "soc:blue:internet", .gpio = 5, .active_low = 1, },
127 +       { .name = "soc:red:power", .gpio = 6, .active_low = 1, },
128 +       { .name = "soc:yello:wps", .gpio = 7, .active_low = 1, },
129 +       { .name = "soc:red:wps", .gpio = 9, .active_low = 1, },
130 +       { .name = "soc:blue:voip", .gpio = 32, .active_low = 1, },
131 +       { .name = "soc:blue:fxs1", .gpio = 33, .active_low = 1, },
132 +       { .name = "soc:blue:fxs2", .gpio = 34, .active_low = 1, },
133 +       { .name = "soc:blue:fxo", .gpio = 35, .active_low = 1, },
134 +       { .name = "soc:blue:voice", .gpio = 36, .active_low = 1, },
135 +       { .name = "soc:blue:usb", .gpio = 37, .active_low = 1, },
136 +       { .name = "soc:blue:wlan", .gpio = 38, .active_low = 1, },
137 +};
138 +
139 +static struct gpio_led arv4525_leds_gpio[] __initdata = {
140 +       { .name = "soc:green:festnetz", .gpio = 4, .active_low = 1, },
141 +       { .name = "soc:green:internet", .gpio = 5, .active_low = 1, },
142 +       { .name = "soc:green:dsl", .gpio = 6, .active_low = 1, },
143 +       { .name = "soc:green:wlan", .gpio = 8, .active_low = 1, },
144 +       { .name = "soc:green:online", .gpio = 9, .active_low = 1, },
145 +};
146 +
147 +static void
148 +arv45xx_register_ethernet(void)
149 +{
150 +#define ARV45XX_BRN_MAC                        0x3f0016
151 +       memcpy_fromio(lq_eth_data.mac,
152 +               (void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
153 +       lq_register_ethernet(&lq_eth_data);
154 +}
155 +
156 +static void __init
157 +arv4518_init(void)
158 +{
159 +       lq_register_gpio();
160 +       lq_register_gpio_ebu(0);
161 +       lq_register_gpio_leds(arv4518_leds_gpio, ARRAY_SIZE(arv4518_leds_gpio));
162 +       lq_register_asc(0);
163 +       lq_register_asc(1);
164 +       lq_register_nor(&arv45xx_flash_data);
165 +       lq_register_pci(&lq_pci_data);
166 +       lq_register_wdt();
167 +       arv45xx_register_ethernet();
168 +}
169 +
170 +MIPS_MACHINE(LANTIQ_MACH_ARV4518,
171 +                       "ARV4518",
172 +                       "ARV4518 - SMC7908A-ISP",
173 +                       arv4518_init);
174 +
175 +static void __init
176 +arv452_init(void)
177 +{
178 +       lq_register_gpio();
179 +       lq_register_gpio_ebu(ARV452_LATCH_SWITCH);
180 +       lq_register_gpio_leds(arv452_leds_gpio, ARRAY_SIZE(arv452_leds_gpio));
181 +       lq_register_asc(0);
182 +       lq_register_asc(1);
183 +       lq_register_nor(&arv45xx_flash_data);
184 +       lq_register_pci(&lq_pci_data);
185 +       lq_register_wdt();
186 +       arv45xx_register_ethernet();
187 +}
188 +
189 +MIPS_MACHINE(LANTIQ_MACH_ARV452,
190 +                       "ARV452",
191 +                       "ARV452 - Airties WAV-281, Arcor A800",
192 +                       arv452_init);
193 +
194 +static void __init
195 +arv4525_init(void)
196 +{
197 +       lq_register_gpio();
198 +       lq_register_gpio_leds(arv4525_leds_gpio, ARRAY_SIZE(arv4525_leds_gpio));
199 +       lq_register_asc(0);
200 +       lq_register_asc(1);
201 +       lq_register_nor(&arv45xx_flash_data);
202 +       lq_register_pci(&lq_pci_data);
203 +       lq_register_wdt();
204 +       lq_eth_data.mii_mode = MII_MODE;
205 +       arv45xx_register_ethernet();
206 +}
207 +
208 +MIPS_MACHINE(LANTIQ_MACH_ARV4525,
209 +                       "ARV4525",
210 +                       "ARV4525 - Speedport W502V",
211 +                       arv4525_init);