first ar531x support for 2.4, thx Mile Albon, some addons from me for mips big endian...
[openwrt/svn-archive/archive.git] / openwrt / target / linux / linux-2.4 / patches / ar531x / 000-atheros-support.patch
1 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xdbg_io.c linux-2.4.32.new/arch/mips/ar531x/ar531xdbg_io.c
2 --- linux-2.4.32/arch/mips/ar531x/ar531xdbg_io.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xdbg_io.c 2005-12-24 20:29:42.102311328 +0000
4 @@ -0,0 +1,217 @@
5 +/*
6 + * This file is subject to the terms and conditions of the GNU General Public
7 + * License. See the file "COPYING" in the main directory of this archive
8 + * for more details.
9 + *
10 + * Copyright MontaVista Software Inc
11 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
12 + */
13 +
14 +/*
15 + * Basic support for polled character input/output
16 + * using the AR531X's serial port.
17 + */
18 +
19 +#include <linux/config.h>
20 +#include <linux/init.h>
21 +#include <linux/delay.h>
22 +#include <linux/irq.h>
23 +#include <linux/interrupt.h>
24 +#include <linux/serial.h>
25 +#include <linux/types.h>
26 +#include <linux/string.h>
27 +
28 +#include <asm/reboot.h>
29 +#include <asm/io.h>
30 +#include <asm/time.h>
31 +#include <asm/pgtable.h>
32 +#include <asm/processor.h>
33 +#include <asm/reboot.h>
34 +#include <asm/system.h>
35 +#include <asm/serial.h>
36 +#include <asm/gdb-stub.h>
37 +
38 +#include "ar531xlnx.h"
39 +
40 +#if CONFIG_EARLY_PRINTK_HACK || CONFIG_KGDB
41 +/* base addr of uart and clock timing */
42 +#define BASE 0xbc000003
43 +
44 +/* distance in bytes between two serial registers */
45 +#define REG_OFFSET 4
46 +
47 +/*
48 + * 0 - we need to do serial init
49 + * 1 - skip serial init
50 + */
51 +static int serialPortInitialized = 0;
52 +
53 +/*
54 + * * the default baud rate *if* we do serial init
55 + * */
56 +#define BAUD_DEFAULT UART16550_BAUD_9600
57 +
58 +/* === END OF CONFIG === */
59 +
60 +#define UART16550_BAUD_2400 2400
61 +#define UART16550_BAUD_4800 4800
62 +#define UART16550_BAUD_9600 9600
63 +#define UART16550_BAUD_19200 19200
64 +#define UART16550_BAUD_38400 38400
65 +#define UART16550_BAUD_57600 57600
66 +#define UART16550_BAUD_115200 115200
67 +
68 +#define UART16550_PARITY_NONE 0
69 +#define UART16550_PARITY_ODD 0x08
70 +#define UART16550_PARITY_EVEN 0x18
71 +#define UART16550_PARITY_MARK 0x28
72 +#define UART16550_PARITY_SPACE 0x38
73 +
74 +#define UART16550_DATA_5BIT 0x0
75 +#define UART16550_DATA_6BIT 0x1
76 +#define UART16550_DATA_7BIT 0x2
77 +#define UART16550_DATA_8BIT 0x3
78 +
79 +#define UART16550_STOP_1BIT 0x0
80 +#define UART16550_STOP_2BIT 0x4
81 +
82 +/* register offset */
83 +#define OFS_RCV_BUFFER (0*REG_OFFSET)
84 +#define OFS_TRANS_HOLD (0*REG_OFFSET)
85 +#define OFS_SEND_BUFFER (0*REG_OFFSET)
86 +#define OFS_INTR_ENABLE (1*REG_OFFSET)
87 +#define OFS_INTR_ID (2*REG_OFFSET)
88 +#define OFS_DATA_FORMAT (3*REG_OFFSET)
89 +#define OFS_LINE_CONTROL (3*REG_OFFSET)
90 +#define OFS_MODEM_CONTROL (4*REG_OFFSET)
91 +#define OFS_RS232_OUTPUT (4*REG_OFFSET)
92 +#define OFS_LINE_STATUS (5*REG_OFFSET)
93 +#define OFS_MODEM_STATUS (6*REG_OFFSET)
94 +#define OFS_RS232_INPUT (6*REG_OFFSET)
95 +#define OFS_SCRATCH_PAD (7*REG_OFFSET)
96 +
97 +#define OFS_DIVISOR_LSB (0*REG_OFFSET)
98 +#define OFS_DIVISOR_MSB (1*REG_OFFSET)
99 +
100 +
101 +/* memory-mapped read/write of the port */
102 +#define UART16550_READ(y) (*((volatile u8*)(BASE + y)))
103 +#define UART16550_WRITE(y, z) ((*((volatile u8*)(BASE + y))) = z)
104 +
105 +void
106 +debugPortInit(u32 baud, u8 data, u8 parity, u8 stop)
107 +{
108 + /* Pull UART out of reset */
109 + sysRegWrite(AR531X_RESET,
110 + sysRegRead(AR531X_RESET) & ~(AR531X_RESET_UART0));
111 +
112 + /* disable interrupts */
113 + UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
114 + UART16550_WRITE(OFS_INTR_ENABLE, 0);
115 +
116 + /* set up buad rate */
117 + {
118 + u32 divisor;
119 + u32 uart_clock_rate = ar531x_cpu_frequency() / 4;
120 + u32 base_baud = uart_clock_rate / 16;
121 +
122 + /* set DIAB bit */
123 + UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
124 +
125 + /* set divisor */
126 + divisor = base_baud / baud;
127 + UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
128 + UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00)>>8);
129 +
130 + /* clear DIAB bit */
131 + UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
132 + }
133 +
134 + /* set data format */
135 + UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
136 +}
137 +
138 +u8
139 +getDebugChar(void)
140 +{
141 + if (!serialPortInitialized) {
142 + serialPortInitialized = 1;
143 + debugPortInit(BAUD_DEFAULT,
144 + UART16550_DATA_8BIT,
145 + UART16550_PARITY_NONE, UART16550_STOP_1BIT);
146 + }
147 +
148 + while((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
149 + return UART16550_READ(OFS_RCV_BUFFER);
150 +}
151 +
152 +#if CONFIG_KGDB
153 +/*
154 + * Peek at the most recently received character.
155 + * Don't wait for a new character to be received.
156 + */
157 +u8
158 +peekDebugChar(void)
159 +{
160 + return UART16550_READ(OFS_RCV_BUFFER);
161 +}
162 +
163 +static int kgdbInitialized = 0;
164 +
165 +void
166 +kgdbInit(void)
167 +{
168 + sysRegWrite(AR531X_WD_CTRL, AR531X_WD_CTRL_IGNORE_EXPIRATION);
169 +
170 + if (!kgdbInitialized) {
171 + printk("Setting debug traps - please connect the remote debugger.\n");
172 + set_debug_traps();
173 + kgdbInitialized = 1;
174 + }
175 + breakpoint();
176 +}
177 +
178 +int
179 +kgdbEnabled(void)
180 +{
181 + return kgdbInitialized;
182 +}
183 +
184 +#define DEBUG_CHAR '\001';
185 +
186 +int
187 +kgdbInterrupt(void)
188 +{
189 + if (!kgdbInitialized) {
190 + return 0;
191 + }
192 +
193 + /*
194 + * Try to avoid swallowing too much input: Only consume
195 + * a character if nothing new has arrived. Yes, there's
196 + * still a small hole here, and we may lose an input
197 + * character now and then.
198 + */
199 + if (UART16550_READ(OFS_LINE_STATUS) & 1) {
200 + return 0;
201 + } else {
202 + return UART16550_READ(OFS_RCV_BUFFER) == DEBUG_CHAR;
203 + }
204 +}
205 +#endif
206 +
207 +
208 +void
209 +putDebugChar(char byte)
210 +{
211 + if (!serialPortInitialized) {
212 + serialPortInitialized = 1;
213 + debugPortInit(BAUD_DEFAULT,
214 + UART16550_DATA_8BIT,
215 + UART16550_PARITY_NONE, UART16550_STOP_1BIT);
216 + }
217 +
218 + while ((UART16550_READ(OFS_LINE_STATUS) &0x20) == 0);
219 + UART16550_WRITE(OFS_SEND_BUFFER, byte);
220 + }
221 +#endif /* CONFIG_EARLY_PRINTK_HACK || CONFIG_KGDB */
222 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xgpio.c linux-2.4.32.new/arch/mips/ar531x/ar531xgpio.c
223 --- linux-2.4.32/arch/mips/ar531x/ar531xgpio.c 1970-01-01 01:00:00.000000000 +0100
224 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xgpio.c 2005-12-24 20:29:42.102311328 +0000
225 @@ -0,0 +1,141 @@
226 +/*
227 + * This file is subject to the terms and conditions of the GNU General Public
228 + * License. See the file "COPYING" in the main directory of this archive
229 + * for more details.
230 + *
231 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
232 + */
233 +
234 +/*
235 + * Support for GPIO -- General Purpose Input/Output Pins
236 + */
237 +
238 +#include <linux/config.h>
239 +#include <linux/kernel.h>
240 +#include <linux/signal.h>
241 +#include <linux/interrupt.h>
242 +#include <linux/irq.h>
243 +
244 +#include "ar531xlnx.h"
245 +
246 +/* GPIO Interrupt Support */
247 +
248 +/* Turn on the specified AR531X_GPIO_IRQ interrupt */
249 +static unsigned int
250 +ar531x_gpio_intr_startup(unsigned int irq)
251 +{
252 + ar531x_gpio_intr_enable(irq);
253 + return 0;
254 +}
255 +
256 +/* Turn off the specified AR531X_GPIO_IRQ interrupt */
257 +static void
258 +ar531x_gpio_intr_shutdown(unsigned int irq)
259 +{
260 + ar531x_gpio_intr_disable(irq);
261 +}
262 +
263 +u32 gpioIntMask = 0;
264 +
265 +/* Enable the specified AR531X_GPIO_IRQ interrupt */
266 +void
267 +ar531x_gpio_intr_enable(unsigned int irq)
268 +{
269 + u32 reg;
270 + int gpio;
271 +
272 + gpio = irq - AR531X_GPIO_IRQ_BASE;
273 + gpioIntMask |= gpio;
274 +
275 + reg = sysRegRead(AR531X_GPIO_CR);
276 + reg &= ~(GPIO_CR_M(gpio) | GPIO_CR_UART(gpio) | GPIO_CR_INT(gpio));
277 + reg |= GPIO_CR_I(gpio);
278 + reg |= GPIO_CR_INT(gpio);
279 +
280 + sysRegWrite(AR531X_GPIO_CR, reg);
281 + (void)sysRegRead(AR531X_GPIO_CR); /* flush to hardware */
282 +}
283 +
284 +/* Disable the specified AR531X_GPIO_IRQ interrupt */
285 +void
286 +ar531x_gpio_intr_disable(unsigned int irq)
287 +{
288 + u32 reg;
289 + int gpio;
290 +
291 + gpio = irq - AR531X_GPIO_IRQ_BASE;
292 +
293 + reg = sysRegRead(AR531X_GPIO_CR);
294 + reg &= ~(GPIO_CR_M(gpio) | GPIO_CR_UART(gpio) | GPIO_CR_INT(gpio));
295 + reg |= GPIO_CR_I(gpio);
296 + /* No GPIO_CR_INT bit */
297 +
298 + sysRegWrite(AR531X_GPIO_CR, reg);
299 + (void)sysRegRead(AR531X_GPIO_CR); /* flush to hardware */
300 +
301 + gpioIntMask &= ~gpio;
302 +}
303 +
304 +static void
305 +ar531x_gpio_intr_ack(unsigned int irq)
306 +{
307 + ar531x_gpio_intr_disable(irq);
308 +}
309 +
310 +static void
311 +ar531x_gpio_intr_end(unsigned int irq)
312 +{
313 + if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
314 + ar531x_gpio_intr_enable(irq);
315 +}
316 +
317 +static void
318 +ar531x_gpio_intr_set_affinity(unsigned int irq, unsigned long mask)
319 +{
320 + /* Only 1 CPU; ignore affinity request */
321 +}
322 +
323 +int ar531x_gpio_irq_base;
324 +
325 +struct hw_interrupt_type ar531x_gpio_intr_controller = {
326 + "AR531X GPIO",
327 + ar531x_gpio_intr_startup,
328 + ar531x_gpio_intr_shutdown,
329 + ar531x_gpio_intr_enable,
330 + ar531x_gpio_intr_disable,
331 + ar531x_gpio_intr_ack,
332 + ar531x_gpio_intr_end,
333 + ar531x_gpio_intr_set_affinity,
334 +};
335 +
336 +void
337 +ar531x_gpio_intr_init(int irq_base)
338 +{
339 + int i;
340 +
341 + for (i = irq_base; i < irq_base + AR531X_GPIO_IRQ_COUNT; i++) {
342 + irq_desc[i].status = IRQ_DISABLED;
343 + irq_desc[i].action = NULL;
344 + irq_desc[i].depth = 1;
345 + irq_desc[i].handler = &ar531x_gpio_intr_controller;
346 + }
347 +
348 + ar531x_gpio_irq_base = irq_base;
349 +}
350 +
351 +/* ARGSUSED */
352 +void
353 +spurious_gpio_handler(int cpl, void *dev_id, struct pt_regs *regs)
354 +{
355 + u32 gpioDataIn;
356 +
357 + gpioDataIn = sysRegRead(AR531X_GPIO_DI) & gpioIntMask;
358 +
359 + printk("spurious_gpio_handler: 0x%x di=0x%8.8x gpioIntMask=0x%8.8x\n",
360 + cpl, gpioDataIn, gpioIntMask);
361 +}
362 +
363 +struct irqaction spurious_gpio =
364 + {spurious_gpio_handler, SA_INTERRUPT, 0, "spurious_gpio",
365 + NULL, NULL};
366 +
367 diff -urN linux-2.4.32/arch/mips/ar531x/ar531x.h linux-2.4.32.new/arch/mips/ar531x/ar531x.h
368 --- linux-2.4.32/arch/mips/ar531x/ar531x.h 1970-01-01 01:00:00.000000000 +0100
369 +++ linux-2.4.32.new/arch/mips/ar531x/ar531x.h 2005-12-24 20:29:42.102311328 +0000
370 @@ -0,0 +1,280 @@
371 +/*
372 + * This file is subject to the terms and conditions of the GNU General Public
373 + * License. See the file "COPYING" in the main directory of this archive
374 + * for more details.
375 + *
376 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
377 + */
378 +
379 +#ifndef AR531X_H
380 +#define AR531X_H 1
381 +
382 +#include <asm/addrspace.h>
383 +
384 +/* Address Map */
385 +#define AR531X_WLAN0 0x18000000
386 +#define AR531X_WLAN1 0x18500000
387 +#define AR531X_ENET0 0x18100000
388 +#define AR531X_ENET1 0x18200000
389 +#define AR531X_SDRAMCTL 0x18300000
390 +#define AR531X_FLASHCTL 0x18400000
391 +#define AR531X_APBBASE 0x1c000000
392 +#define AR531X_FLASH 0x1e000000
393 +
394 +/*
395 + * AR531X_NUM_ENET_MAC defines the number of ethernet MACs that
396 + * should be considered available. The AR5312 supports 2 enet MACS,
397 + * even though many reference boards only actually use 1 of them
398 + * (i.e. Only MAC 0 is actually connected to an enet PHY or PHY switch.
399 + * The AR2312 supports 1 enet MAC.
400 + */
401 +#define AR531X_NUM_ENET_MAC 2
402 +
403 +/*
404 + * Need these defines to determine true number of ethernet MACs
405 + */
406 +#define AR5212_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */
407 +#define AR5212_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */
408 +#define AR5212_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */
409 +#define AR531X_RADIO_MASK_OFF 0xc8
410 +#define AR531X_RADIO0_MASK 0x0003
411 +#define AR531X_RADIO1_MASK 0x000c
412 +#define AR531X_RADIO1_S 2
413 +
414 +/*
415 + * AR531X_NUM_WMAC defines the number of Wireless MACs that\
416 + * should be considered available.
417 + */
418 +#define AR531X_NUM_WMAC 2
419 +
420 +/* Reset/Timer Block Address Map */
421 +#define AR531X_RESETTMR (AR531X_APBBASE + 0x3000)
422 +#define AR531X_TIMER (AR531X_RESETTMR + 0x0000) /* countdown timer */
423 +#define AR531X_WD_CTRL (AR531X_RESETTMR + 0x0008) /* watchdog cntrl */
424 +#define AR531X_WD_TIMER (AR531X_RESETTMR + 0x000c) /* watchdog timer */
425 +#define AR531X_ISR (AR531X_RESETTMR + 0x0010) /* Intr Status Reg */
426 +#define AR531X_IMR (AR531X_RESETTMR + 0x0014) /* Intr Mask Reg */
427 +#define AR531X_RESET (AR531X_RESETTMR + 0x0020)
428 +#define AR5312_CLOCKCTL1 (AR531X_RESETTMR + 0x0064)
429 +#define AR5312_SCRATCH (AR531X_RESETTMR + 0x006c)
430 +#define AR531X_PROCADDR (AR531X_RESETTMR + 0x0070)
431 +#define AR531X_PROC1 (AR531X_RESETTMR + 0x0074)
432 +#define AR531X_DMAADDR (AR531X_RESETTMR + 0x0078)
433 +#define AR531X_DMA1 (AR531X_RESETTMR + 0x007c)
434 +#define AR531X_ENABLE (AR531X_RESETTMR + 0x0080) /* interface enb */
435 +#define AR531X_REV (AR531X_RESETTMR + 0x0090) /* revision */
436 +
437 +/* AR531X_WD_CTRL register bit field definitions */
438 +#define AR531X_WD_CTRL_IGNORE_EXPIRATION 0x0000
439 +#define AR531X_WD_CTRL_NMI 0x0001
440 +#define AR531X_WD_CTRL_RESET 0x0002
441 +
442 +/* AR531X_ISR register bit field definitions */
443 +#define AR531X_ISR_NONE 0x0000
444 +#define AR531X_ISR_TIMER 0x0001
445 +#define AR531X_ISR_AHBPROC 0x0002
446 +#define AR531X_ISR_AHBDMA 0x0004
447 +#define AR531X_ISR_GPIO 0x0008
448 +#define AR531X_ISR_UART0 0x0010
449 +#define AR531X_ISR_UART0DMA 0x0020
450 +#define AR531X_ISR_WD 0x0040
451 +#define AR531X_ISR_LOCAL 0x0080
452 +
453 +/* AR531X_RESET register bit field definitions */
454 +#define AR531X_RESET_SYSTEM 0x00000001 /* cold reset full system */
455 +#define AR531X_RESET_PROC 0x00000002 /* cold reset MIPS core */
456 +#define AR531X_RESET_WLAN0 0x00000004 /* cold reset WLAN MAC and BB */
457 +#define AR531X_RESET_EPHY0 0x00000008 /* cold reset ENET0 phy */
458 +#define AR531X_RESET_EPHY1 0x00000010 /* cold reset ENET1 phy */
459 +#define AR531X_RESET_ENET0 0x00000020 /* cold reset ENET0 mac */
460 +#define AR531X_RESET_ENET1 0x00000040 /* cold reset ENET1 mac */
461 +#define AR531X_RESET_UART0 0x00000100 /* cold reset UART0 (high speed) */
462 +#define AR531X_RESET_WLAN1 0x00000200 /* cold reset WLAN MAC/BB */
463 +#define AR531X_RESET_APB 0x00000400 /* cold reset APB (ar5312) */
464 +#define AR531X_RESET_WARM_PROC 0x00001000 /* warm reset MIPS core */
465 +#define AR531X_RESET_WARM_WLAN0_MAC 0x00002000 /* warm reset WLAN0 MAC */
466 +#define AR531X_RESET_WARM_WLAN0_BB 0x00004000 /* warm reset WLAN0 BaseBand */
467 +#define AR531X_RESET_NMI 0x00010000 /* send an NMI to the processor */
468 +#define AR531X_RESET_WARM_WLAN1_MAC 0x00020000 /* warm reset WLAN1 mac */
469 +#define AR531X_RESET_WARM_WLAN1_BB 0x00040000 /* warm reset WLAN1 baseband */
470 +#define AR531X_RESET_LOCAL_BUS 0x00080000 /* reset local bus */
471 +#define AR531X_RESET_WDOG 0x00100000 /* last reset was a watchdog */
472 +
473 +#define AR531X_RESET_WMAC0_BITS \
474 + AR531X_RESET_WLAN0 |\
475 + AR531X_RESET_WARM_WLAN0_MAC |\
476 + AR531X_RESET_WARM_WLAN0_BB
477 +
478 +#define AR531X_RESERT_WMAC1_BITS \
479 + AR531X_RESET_WLAN1 |\
480 + AR531X_RESET_WARM_WLAN1_MAC |\
481 + AR531X_RESET_WARM_WLAN1_BB
482 +
483 +/* AR5312_CLOCKCTL1 register bit field definitions */
484 +#define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030
485 +#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4
486 +#define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00
487 +#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8
488 +#define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000
489 +
490 +/* Valid for AR5312 and AR2312 */
491 +#define AR5312_CLOCKCTL1_PREDIVIDE_MASK 0x00000030
492 +#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT 4
493 +#define AR5312_CLOCKCTL1_MULTIPLIER_MASK 0x00001f00
494 +#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT 8
495 +#define AR5312_CLOCKCTL1_DOUBLER_MASK 0x00010000
496 +
497 +/* Valid for AR2313 */
498 +#define AR2313_CLOCKCTL1_PREDIVIDE_MASK 0x00003000
499 +#define AR2313_CLOCKCTL1_PREDIVIDE_SHIFT 12
500 +#define AR2313_CLOCKCTL1_MULTIPLIER_MASK 0x001f0000
501 +#define AR2313_CLOCKCTL1_MULTIPLIER_SHIFT 16
502 +#define AR2313_CLOCKCTL1_DOUBLER_MASK 0x00000000
503 +
504 +
505 +/* AR531X_ENABLE register bit field definitions */
506 +#define AR531X_ENABLE_WLAN0 0x0001
507 +#define AR531X_ENABLE_ENET0 0x0002
508 +#define AR531X_ENABLE_ENET1 0x0004
509 +#define AR531X_ENABLE_UART_AND_WLAN1_PIO 0x0008 /* UART, and WLAN1 PIOs */
510 +#define AR531X_ENABLE_WLAN1_DMA 0x0010 /* WLAN1 DMAs */
511 +#define AR531X_ENABLE_WLAN1 \
512 + (AR531X_ENABLE_UART_AND_WLAN1_PIO | AR531X_ENABLE_WLAN1_DMA)
513 +
514 +/* AR531X_REV register bit field definitions */
515 +#define AR531X_REV_WMAC_MAJ 0xf000
516 +#define AR531X_REV_WMAC_MAJ_S 12
517 +#define AR531X_REV_WMAC_MIN 0x0f00
518 +#define AR531X_REV_WMAC_MIN_S 8
519 +#define AR531X_REV_MAJ 0x00f0
520 +#define AR531X_REV_MAJ_S 4
521 +#define AR531X_REV_MIN 0x000f
522 +#define AR531X_REV_MIN_S 0
523 +#define AR531X_REV_CHIP (REV_MAJ|REV_MIN)
524 +
525 +/* Major revision numbers, bits 7..4 of Revision ID register */
526 +#define AR531X_REV_MAJ_AR5312 0x4
527 +#define AR531X_REV_MAJ_AR2313 0x5
528 +
529 +/* Minor revision numbers, bits 3..0 of Revision ID register */
530 +#define AR5312_REV_MIN_DUAL 0x0 /* Dual WLAN version */
531 +#define AR5312_REV_MIN_SINGLE 0x1 /* Single WLAN version */
532 +
533 +/* AR531X_FLASHCTL register bit field definitions */
534 +#define FLASHCTL_IDCY 0x0000000f /* Idle cycle turn around time */
535 +#define FLASHCTL_IDCY_S 0
536 +#define FLASHCTL_WST1 0x000003e0 /* Wait state 1 */
537 +#define FLASHCTL_WST1_S 5
538 +#define FLASHCTL_RBLE 0x00000400 /* Read byte lane enable */
539 +#define FLASHCTL_WST2 0x0000f800 /* Wait state 2 */
540 +#define FLASHCTL_WST2_S 11
541 +#define FLASHCTL_AC 0x00070000 /* Flash address check (added) */
542 +#define FLASHCTL_AC_S 16
543 +#define FLASHCTL_AC_128K 0x00000000
544 +#define FLASHCTL_AC_256K 0x00010000
545 +#define FLASHCTL_AC_512K 0x00020000
546 +#define FLASHCTL_AC_1M 0x00030000
547 +#define FLASHCTL_AC_2M 0x00040000
548 +#define FLASHCTL_AC_4M 0x00050000
549 +#define FLASHCTL_AC_8M 0x00060000
550 +#define FLASHCTL_AC_RES 0x00070000 /* 16MB is not supported */
551 +#define FLASHCTL_E 0x00080000 /* Flash bank enable (added) */
552 +#define FLASHCTL_BUSERR 0x01000000 /* Bus transfer error status flag */
553 +#define FLASHCTL_WPERR 0x02000000 /* Write protect error status flag */
554 +#define FLASHCTL_WP 0x04000000 /* Write protect */
555 +#define FLASHCTL_BM 0x08000000 /* Burst mode */
556 +#define FLASHCTL_MW 0x30000000 /* Memory width */
557 +#define FLASHCTL_MWx8 0x00000000 /* Memory width x8 */
558 +#define FLASHCTL_MWx16 0x10000000 /* Memory width x16 */
559 +#define FLASHCTL_MWx32 0x20000000 /* Memory width x32 (not supported) */
560 +#define FLASHCTL_ATNR 0x00000000 /* Access type == no retry */
561 +#define FLASHCTL_ATR 0x80000000 /* Access type == retry every */
562 +#define FLASHCTL_ATR4 0xc0000000 /* Access type == retry every 4 */
563 +
564 +/* ARM Flash Controller -- 3 flash banks with either x8 or x16 devices. */
565 +#define AR531X_FLASHCTL0 (AR531X_FLASHCTL + 0x00)
566 +#define AR531X_FLASHCTL1 (AR531X_FLASHCTL + 0x04)
567 +#define AR531X_FLASHCTL2 (AR531X_FLASHCTL + 0x08)
568 +
569 +/* ARM SDRAM Controller -- just enough to determine memory size */
570 +#define AR531X_MEM_CFG1 (AR531X_SDRAMCTL + 0x04)
571 +#define MEM_CFG1_AC0 0x00000700 /* bank 0: SDRAM addr check (added) */
572 +#define MEM_CFG1_AC0_S 8
573 +#define MEM_CFG1_AC1 0x00007000 /* bank 1: SDRAM addr check (added) */
574 +#define MEM_CFG1_AC1_S 12
575 +
576 +/* GPIO Address Map */
577 +#define AR531X_GPIO (AR531X_APBBASE + 0x2000)
578 +#define AR531X_GPIO_DO (AR531X_GPIO + 0x00) /* output register */
579 +#define AR531X_GPIO_DI (AR531X_GPIO + 0x04) /* intput register */
580 +#define AR531X_GPIO_CR (AR531X_GPIO + 0x08) /* control register */
581 +
582 +/* GPIO Control Register bit field definitions */
583 +#define GPIO_CR_M(x) (1 << (x)) /* mask for i/o */
584 +#define GPIO_CR_O(x) (0 << (x)) /* mask for output */
585 +#define GPIO_CR_I(x) (1 << (x)) /* mask for input */
586 +#define GPIO_CR_INT(x) (1 << ((x)+8)) /* mask for interrupt */
587 +#define GPIO_CR_UART(x) (1 << ((x)+16)) /* uart multiplex */
588 +
589 +
590 +typedef unsigned int AR531X_REG;
591 +
592 +#define sysRegRead(phys) \
593 + (*(volatile AR531X_REG *)PHYS_TO_K1(phys))
594 +
595 +#define sysRegWrite(phys, val) \
596 + ((*(volatile AR531X_REG *)PHYS_TO_K1(phys)) = (val))
597 +
598 +
599 +/*
600 + * This is board-specific data that is stored in a "fixed" location in flash.
601 + * It is shared across operating systems, so it should not be changed lightly.
602 + * The main reason we need it is in order to extract the ethernet MAC
603 + * address(es).
604 + */
605 +struct ar531x_boarddata {
606 + u32 magic; /* board data is valid */
607 +#define AR531X_BD_MAGIC 0x35333131 /* "5311", for all 531x platforms */
608 + u16 cksum; /* checksum (starting with BD_REV 2) */
609 + u16 rev; /* revision of this struct */
610 +#define BD_REV 4
611 + char boardName[64]; /* Name of board */
612 + u16 major; /* Board major number */
613 + u16 minor; /* Board minor number */
614 + u32 config; /* Board configuration */
615 +#define BD_ENET0 0x00000001 /* ENET0 is stuffed */
616 +#define BD_ENET1 0x00000002 /* ENET1 is stuffed */
617 +#define BD_UART1 0x00000004 /* UART1 is stuffed */
618 +#define BD_UART0 0x00000008 /* UART0 is stuffed (dma) */
619 +#define BD_RSTFACTORY 0x00000010 /* Reset factory defaults stuffed */
620 +#define BD_SYSLED 0x00000020 /* System LED stuffed */
621 +#define BD_EXTUARTCLK 0x00000040 /* External UART clock */
622 +#define BD_CPUFREQ 0x00000080 /* cpu freq is valid in nvram */
623 +#define BD_SYSFREQ 0x00000100 /* sys freq is set in nvram */
624 +#define BD_WLAN0 0x00000200 /* Enable WLAN0 */
625 +#define BD_MEMCAP 0x00000400 /* CAP SDRAM @ memCap for testing */
626 +#define BD_DISWATCHDOG 0x00000800 /* disable system watchdog */
627 +#define BD_WLAN1 0x00001000 /* Enable WLAN1 (ar5212) */
628 +#define BD_ISCASPER 0x00002000 /* FLAG for AR2312 */
629 +#define BD_WLAN0_2G_EN 0x00004000 /* FLAG for radio0_2G */
630 +#define BD_WLAN0_5G_EN 0x00008000 /* FLAG for radio0_2G */
631 +#define BD_WLAN1_2G_EN 0x00020000 /* FLAG for radio0_2G */
632 +#define BD_WLAN1_5G_EN 0x00040000 /* FLAG for radio0_2G */
633 + u16 resetConfigGpio; /* Reset factory GPIO pin */
634 + u16 sysLedGpio; /* System LED GPIO pin */
635 +
636 + u32 cpuFreq; /* CPU core frequency in Hz */
637 + u32 sysFreq; /* System frequency in Hz */
638 + u32 cntFreq; /* Calculated C0_COUNT frequency */
639 +
640 + u8 wlan0Mac[6];
641 + u8 enet0Mac[6];
642 + u8 enet1Mac[6];
643 +
644 + u16 pciId; /* Pseudo PCIID for common code */
645 + u16 memCap; /* cap bank1 in MB */
646 +
647 + /* version 3 */
648 + u8 wlan1Mac[6]; /* (ar5212) */
649 +};
650 +#endif /* AR531X_H */
651 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xintr.S linux-2.4.32.new/arch/mips/ar531x/ar531xintr.S
652 --- linux-2.4.32/arch/mips/ar531x/ar531xintr.S 1970-01-01 01:00:00.000000000 +0100
653 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xintr.S 2005-12-24 20:29:42.103311176 +0000
654 @@ -0,0 +1,30 @@
655 +/*
656 + * This file is subject to the terms and conditions of the GNU General Public
657 + * License. See the file "COPYING" in the main directory of this archive
658 + * for more details.
659 + *
660 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
661 + */
662 +
663 +#include <asm/asm.h>
664 +#include <asm/mipsregs.h>
665 +#include <asm/regdef.h>
666 +#include <asm/stackframe.h>
667 +
668 +/*
669 + * Glue code to save registers and get us to the interrupt dispatcher
670 + */
671 + .text
672 + .set noat
673 + .align 5
674 +NESTED(ar531x_interrupt_receive, PT_SIZE, sp)
675 + SAVE_ALL
676 + CLI
677 + .set at
678 +
679 + move a0, sp
680 + jal ar531x_irq_dispatch
681 +
682 + j ret_from_irq
683 +
684 + END(ar531x_interrupt_receive)
685 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xirq.c linux-2.4.32.new/arch/mips/ar531x/ar531xirq.c
686 --- linux-2.4.32/arch/mips/ar531x/ar531xirq.c 1970-01-01 01:00:00.000000000 +0100
687 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xirq.c 2005-12-24 20:29:42.132306768 +0000
688 @@ -0,0 +1,292 @@
689 +/*
690 + * This file is subject to the terms and conditions of the GNU General Public
691 + * License. See the file "COPYING" in the main directory of this archive
692 + * for more details.
693 + *
694 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
695 + */
696 +
697 +/*
698 + * Interrupt support for AR531X WiSOC.
699 + */
700 +
701 +#include <linux/config.h>
702 +#include <linux/init.h>
703 +#include <linux/kernel_stat.h>
704 +#include <linux/signal.h>
705 +#include <linux/sched.h>
706 +#include <linux/interrupt.h>
707 +#include <linux/slab.h>
708 +#include <linux/random.h>
709 +#include <linux/pm.h>
710 +#include <linux/delay.h>
711 +#include <linux/reboot.h>
712 +
713 +#include <asm/irq.h>
714 +#include <asm/mipsregs.h>
715 +#include <asm/gdb-stub.h>
716 +
717 +#include "ar531xlnx.h"
718 +#include <asm/irq_cpu.h>
719 +
720 +extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
721 +
722 +static void ar531x_misc_intr_enable(unsigned int irq);
723 +static void ar531x_misc_intr_disable(unsigned int irq);
724 +
725 +/* Turn on the specified AR531X_MISC_IRQ interrupt */
726 +static unsigned int
727 +ar531x_misc_intr_startup(unsigned int irq)
728 +{
729 + ar531x_misc_intr_enable(irq);
730 + return 0;
731 +}
732 +
733 +/* Turn off the specified AR531X_MISC_IRQ interrupt */
734 +static void
735 +ar531x_misc_intr_shutdown(unsigned int irq)
736 +{
737 + ar531x_misc_intr_disable(irq);
738 +}
739 +
740 +/* Enable the specified AR531X_MISC_IRQ interrupt */
741 +static void
742 +ar531x_misc_intr_enable(unsigned int irq)
743 +{
744 + unsigned int imr;
745 +
746 + imr = sysRegRead(AR531X_IMR);
747 + imr |= (1 << (irq - AR531X_MISC_IRQ_BASE - 1));
748 + sysRegWrite(AR531X_IMR, imr);
749 + sysRegRead(AR531X_IMR); /* flush write buffer */
750 +}
751 +
752 +/* Disable the specified AR531X_MISC_IRQ interrupt */
753 +static void
754 +ar531x_misc_intr_disable(unsigned int irq)
755 +{
756 + unsigned int imr;
757 +
758 + imr = sysRegRead(AR531X_IMR);
759 + imr &= ~(1 << (irq - AR531X_MISC_IRQ_BASE - 1));
760 + sysRegWrite(AR531X_IMR, imr);
761 + sysRegRead(AR531X_IMR); /* flush write buffer */
762 +}
763 +
764 +static void
765 +ar531x_misc_intr_ack(unsigned int irq)
766 +{
767 + ar531x_misc_intr_disable(irq);
768 +}
769 +
770 +static void
771 +ar531x_misc_intr_end(unsigned int irq)
772 +{
773 + if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
774 + ar531x_misc_intr_enable(irq);
775 +}
776 +
777 +static void
778 +ar531x_misc_intr_set_affinity(unsigned int irq, unsigned long mask)
779 +{
780 + /* Only 1 CPU; ignore affinity request */
781 +}
782 +
783 +struct hw_interrupt_type ar531x_misc_intr_controller = {
784 + "AR531X MISC",
785 + ar531x_misc_intr_startup,
786 + ar531x_misc_intr_shutdown,
787 + ar531x_misc_intr_enable,
788 + ar531x_misc_intr_disable,
789 + ar531x_misc_intr_ack,
790 + ar531x_misc_intr_end,
791 + ar531x_misc_intr_set_affinity,
792 +};
793 +
794 +int ar531x_misc_irq_base;
795 +
796 +/*
797 + * Determine interrupt source among interrupts that use IP6
798 + */
799 +void
800 +ar531x_misc_intr_init(int irq_base)
801 +{
802 + int i;
803 +
804 + for (i = irq_base; i < irq_base + AR531X_MISC_IRQ_COUNT; i++) {
805 + irq_desc[i].status = IRQ_DISABLED;
806 + irq_desc[i].action = NULL;
807 + irq_desc[i].depth = 1;
808 + irq_desc[i].handler = &ar531x_misc_intr_controller;
809 + }
810 +
811 + ar531x_misc_irq_base = irq_base;
812 +}
813 +
814 +/* ARGSUSED */
815 +void
816 +spurious_irq_handler(int cpl, void *dev_id, struct pt_regs *regs)
817 +{
818 + /*
819 + printk("spurious_irq_handler: %d cause=0x%8.8x status=0x%8.8x\n",
820 + cpl, cause_intrs, status_intrs);
821 + */
822 +}
823 +
824 +/* ARGSUSED */
825 +void
826 +spurious_misc_handler(int cpl, void *dev_id, struct pt_regs *regs)
827 +{
828 + /*
829 + printk("spurious_misc_handler: 0x%x isr=0x%8.8x imr=0x%8.8x\n",
830 + cpl, ar531x_isr, ar531x_imr);
831 + */
832 +}
833 +
834 +void
835 +ar531x_timer_handler(int cpl, void *dev_id, struct pt_regs *regs)
836 +{
837 + (void)sysRegRead(AR531X_TIMER); /* clear interrupt */
838 +}
839 +
840 +void
841 +ar531x_ahb_proc_handler(int cpl, void *dev_id, struct pt_regs *regs)
842 +{
843 + u32 procAddr;
844 + u32 proc1;
845 + u32 dmaAddr;
846 + u32 dma1;
847 +
848 + proc1 = sysRegRead(AR531X_PROC1);
849 + procAddr = sysRegRead(AR531X_PROCADDR); /* clears error state */
850 + dma1 = sysRegRead(AR531X_DMA1);
851 + dmaAddr = sysRegRead(AR531X_DMAADDR); /* clears error state */
852 +
853 + printk("AHB interrupt: PROCADDR=0x%8.8x PROC1=0x%8.8x DMAADDR=0x%8.8x DMA1=0x%8.8x\n",
854 + procAddr, proc1, dmaAddr, dma1);
855 +
856 + machine_restart("AHB error"); /* Catastrophic failure */
857 +}
858 +
859 +static struct irqaction cascade =
860 + {no_action, SA_INTERRUPT, 0, "cascade",
861 + NULL, NULL};
862 +
863 +static struct irqaction spurious_irq =
864 + {spurious_irq_handler, SA_INTERRUPT, 0, "spurious_irq",
865 + NULL, NULL};
866 +
867 +static struct irqaction spurious_misc =
868 + {spurious_misc_handler, SA_INTERRUPT, 0, "spurious_misc",
869 + NULL, NULL};
870 +
871 +static struct irqaction ar531x_timer_interrupt =
872 + {ar531x_timer_handler, SA_INTERRUPT, 0, "ar531x_timer_interrupt",
873 + NULL, NULL};
874 +
875 +static struct irqaction ar531x_ahb_proc_interrupt =
876 + {ar531x_ahb_proc_handler, SA_INTERRUPT, 0, "ar531x_ahb_proc_interrupt",
877 + NULL, NULL};
878 +
879 +extern asmlinkage void ar531x_interrupt_receive(void);
880 +
881 +/*
882 + * Called when an interrupt is received, this function
883 + * determines exactly which interrupt it was, and it
884 + * invokes the appropriate handler.
885 + *
886 + * Implicitly, we also define interrupt priority by
887 + * choosing which to dispatch first.
888 + */
889 +void
890 +ar531x_irq_dispatch(struct pt_regs *regs)
891 +{
892 + int cause_intrs = regs->cp0_cause;
893 + int status_intrs = regs->cp0_status;
894 + int pending = cause_intrs & status_intrs;
895 +
896 + if (pending & CAUSEF_IP2) {
897 + do_IRQ(AR531X_IRQ_WLAN0_INTRS, regs);
898 + }
899 + else if (pending & CAUSEF_IP3) {
900 + do_IRQ(AR531X_IRQ_ENET0_INTRS, regs);
901 + }
902 + else if (pending & CAUSEF_IP4) {
903 + do_IRQ(AR531X_IRQ_ENET1_INTRS, regs);
904 + }
905 + else if (pending & CAUSEF_IP5) {
906 + do_IRQ(AR531X_IRQ_WLAN1_INTRS, regs);
907 + }
908 + else if (pending & CAUSEF_IP6) {
909 + AR531X_REG ar531x_isr = sysRegRead(AR531X_ISR);
910 + AR531X_REG ar531x_imr = sysRegRead(AR531X_IMR);
911 + unsigned int ar531x_misc_intrs = ar531x_isr & ar531x_imr;
912 +
913 + if (ar531x_misc_intrs & AR531X_ISR_TIMER)
914 + do_IRQ(AR531X_MISC_IRQ_TIMER, regs);
915 + else if (ar531x_misc_intrs & AR531X_ISR_AHBPROC)
916 + do_IRQ(AR531X_MISC_IRQ_AHB_PROC, regs);
917 + else if (ar531x_misc_intrs & AR531X_ISR_AHBDMA)
918 + do_IRQ(AR531X_MISC_IRQ_AHB_DMA, regs);
919 + else if (ar531x_misc_intrs & AR531X_ISR_GPIO)
920 + {
921 + int i;
922 + u32 gpioIntPending;
923 +
924 + gpioIntPending = sysRegRead(AR531X_GPIO_DI) & gpioIntMask;
925 + for (i=0; i<AR531X_GPIO_IRQ_COUNT; i++) {
926 + if (gpioIntPending & (1 << i))
927 + do_IRQ(AR531X_GPIO_IRQ(i), regs);
928 + }
929 + }
930 + else if ((ar531x_misc_intrs & AR531X_ISR_UART0) ||
931 + (ar531x_misc_intrs & AR531X_ISR_UART0DMA)) {
932 + do_IRQ(AR531X_MISC_IRQ_UART0, regs);
933 +#if CONFIG_KGDB
934 + if (kgdbInterrupt()) {
935 + if (!user_mode(regs))
936 + set_async_breakpoint((unsigned long *)&regs->cp0_epc);
937 + }
938 +#endif /* CONFIG_KGDB */
939 + }
940 + else if (ar531x_misc_intrs & AR531X_ISR_WD)
941 + do_IRQ(AR531X_MISC_IRQ_WATCHDOG, regs);
942 + else if (ar531x_misc_intrs & AR531X_ISR_LOCAL)
943 + do_IRQ(AR531X_MISC_IRQ_LOCAL, regs);
944 + else
945 + do_IRQ(AR531X_MISC_IRQ_NONE, regs);
946 + } else if (pending & CAUSEF_IP7)
947 + do_IRQ(AR531X_IRQ_CPU_CLOCK, regs);
948 + else
949 + do_IRQ(AR531X_IRQ_NONE, regs);
950 +}
951 +
952 +void __init init_IRQ(void)
953 +{
954 + init_generic_irq();
955 + set_except_vector(0, ar531x_interrupt_receive);
956 +
957 + /* Initialize interrupt controllers */
958 + mips_cpu_irq_init(MIPS_CPU_IRQ_BASE);
959 + ar531x_misc_intr_init(AR531X_MISC_IRQ_BASE);
960 + ar531x_gpio_intr_init(AR531X_GPIO_IRQ_BASE);
961 + setup_irq(AR531X_IRQ_MISC_INTRS, &cascade);
962 + /*
963 + * AR531X_IRQ_CPU_CLOCK is setup by ar531x_timer_setup.
964 + */
965 +
966 + /* Default "spurious interrupt" handlers */
967 + setup_irq(AR531X_IRQ_NONE, &spurious_irq);
968 + setup_irq(AR531X_MISC_IRQ_NONE, &spurious_misc);
969 + setup_irq(AR531X_GPIO_IRQ_NONE, &spurious_gpio);
970 +
971 + setup_irq(AR531X_MISC_IRQ_TIMER, &ar531x_timer_interrupt);
972 + setup_irq(AR531X_MISC_IRQ_AHB_PROC, &ar531x_ahb_proc_interrupt);
973 + setup_irq(AR531X_MISC_IRQ_GPIO, &cascade);
974 +
975 +#ifdef CONFIG_KGDB
976 +#if CONFIG_EARLY_STOP
977 + kgdbInit();
978 +#endif
979 +#endif
980 +}
981 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xksyms.c linux-2.4.32.new/arch/mips/ar531x/ar531xksyms.c
982 --- linux-2.4.32/arch/mips/ar531x/ar531xksyms.c 1970-01-01 01:00:00.000000000 +0100
983 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xksyms.c 2005-12-24 20:29:42.132306768 +0000
984 @@ -0,0 +1,16 @@
985 +/*
986 + * This file is subject to the terms and conditions of the GNU General Public
987 + * License. See the file "COPYING" in the main directory of this archive
988 + * for more details.
989 + *
990 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
991 + */
992 +
993 +#include <linux/module.h>
994 +#include "asm/atheros/ar531xbsp.h"
995 +
996 +#if CONFIG_KGDB
997 +EXPORT_SYMBOL(kgdbInit);
998 +EXPORT_SYMBOL(kgdbEnabled);
999 +#endif
1000 +EXPORT_SYMBOL(ar531x_sys_frequency);
1001 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xlnx.h linux-2.4.32.new/arch/mips/ar531x/ar531xlnx.h
1002 --- linux-2.4.32/arch/mips/ar531x/ar531xlnx.h 1970-01-01 01:00:00.000000000 +0100
1003 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xlnx.h 2005-12-24 20:29:42.133306616 +0000
1004 @@ -0,0 +1,122 @@
1005 +/*
1006 + * This file is subject to the terms and conditions of the GNU General Public
1007 + * License. See the file "COPYING" in the main directory of this archive
1008 + * for more details.
1009 + *
1010 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
1011 + */
1012 +
1013 +/*
1014 + * This file contains definitions needed in order to compile
1015 + * AR531X products for linux. Definitions that are largely
1016 + * AR531X-specific and independent of operating system belong
1017 + * in ar531x.h rather than this file.
1018 + */
1019 +#include "ar531x.h"
1020 +
1021 +#define MIPS_CPU_IRQ_BASE 0x00
1022 +#define AR531X_HIGH_PRIO 0x10
1023 +#define AR531X_MISC_IRQ_BASE 0x20
1024 +#define AR531X_GPIO_IRQ_BASE 0x30
1025 +
1026 +/* Software's idea of interrupts handled by "CPU Interrupt Controller" */
1027 +#define AR531X_IRQ_NONE MIPS_CPU_IRQ_BASE+0
1028 +#define AR531X_IRQ_WLAN0_INTRS MIPS_CPU_IRQ_BASE+2 /* C0_CAUSE: 0x0400 */
1029 +#define AR531X_IRQ_ENET0_INTRS MIPS_CPU_IRQ_BASE+3 /* C0_CAUSE: 0x0800 */
1030 +#define AR531X_IRQ_ENET1_INTRS MIPS_CPU_IRQ_BASE+4 /* C0_CAUSE: 0x1000 */
1031 +#define AR531X_IRQ_WLAN1_INTRS MIPS_CPU_IRQ_BASE+5 /* C0_CAUSE: 0x2000 */
1032 +#define AR531X_IRQ_MISC_INTRS MIPS_CPU_IRQ_BASE+6 /* C0_CAUSE: 0x4000 */
1033 +#define AR531X_IRQ_CPU_CLOCK MIPS_CPU_IRQ_BASE+7 /* C0_CAUSE: 0x8000 */
1034 +
1035 +/* Miscellaneous interrupts, which share IP6 */
1036 +#define AR531X_MISC_IRQ_NONE AR531X_MISC_IRQ_BASE+0
1037 +#define AR531X_MISC_IRQ_TIMER AR531X_MISC_IRQ_BASE+1
1038 +#define AR531X_MISC_IRQ_AHB_PROC AR531X_MISC_IRQ_BASE+2
1039 +#define AR531X_MISC_IRQ_AHB_DMA AR531X_MISC_IRQ_BASE+3
1040 +#define AR531X_MISC_IRQ_GPIO AR531X_MISC_IRQ_BASE+4
1041 +#define AR531X_MISC_IRQ_UART0 AR531X_MISC_IRQ_BASE+5
1042 +#define AR531X_MISC_IRQ_UART0_DMA AR531X_MISC_IRQ_BASE+6
1043 +#define AR531X_MISC_IRQ_WATCHDOG AR531X_MISC_IRQ_BASE+7
1044 +#define AR531X_MISC_IRQ_LOCAL AR531X_MISC_IRQ_BASE+8
1045 +#define AR531X_MISC_IRQ_COUNT 9
1046 +
1047 +/* GPIO Interrupts [0..7], share AR531X_MISC_IRQ_GPIO */
1048 +#define AR531X_GPIO_IRQ_NONE AR531X_MISC_IRQ_BASE+0
1049 +#define AR531X_GPIO_IRQ(n) AR531X_MISC_IRQ_BASE+(n)+1
1050 +#define AR531X_GPIO_IRQ_COUNT 9
1051 +
1052 +#define PHYS_TO_K1(physaddr) KSEG1ADDR(physaddr)
1053 +#define PHYS_TO_K0(physaddr) KSEG0ADDR(physaddr)
1054 +#define UNMAPPED_TO_PHYS(vaddr) PHYSADDR(vaddr)
1055 +#define IS_UNMAPPED_VADDR(vaddr) \
1056 + ((KSEGX(vaddr) == KSEG0) || (KSEGX(vaddr) == KSEG1))
1057 +
1058 +/* IOCTL commands for /proc/ar531x */
1059 +#define AR531X_CTRL_DO_BREAKPOINT 1
1060 +#define AR531X_CTRL_DO_MADWIFI 2
1061 +
1062 +/*
1063 + * Definitions for operating system portability.
1064 + * These are vxWorks-->Linux translations.
1065 + */
1066 +#define LOCAL static
1067 +#define BOOL int
1068 +#define TRUE 1
1069 +#define FALSE 0
1070 +#define UINT8 u8
1071 +#define UINT16 u16
1072 +#define UINT32 u32
1073 +#define PRINTF printk
1074 +#if /* DEBUG */ 1
1075 +#define DEBUG_PRINTF printk
1076 +#define INLINE
1077 +#else
1078 +DEBUG_PRINTF while (0) printk
1079 +#define INLINE inline
1080 +#endif
1081 +#define sysUDelay(usecs) udelay(usecs)
1082 +#define sysMsDelay(msecs) mdelay(msecs)
1083 +typedef volatile UINT8 *VIRT_ADDR;
1084 +#define MALLOC(sz) kmalloc(sz, GFP_KERNEL)
1085 +#define MALLOC_NOSLEEP(sz) kmalloc(sz, GFP_ATOMIC)
1086 +#define FREE(ptr) kfree((void *)ptr)
1087 +#define BSP_BUG() do { printk("kernel BSP BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0)
1088 +#define BSP_BUG_ON(condition) do { if (unlikely((condition)!=0)) BSP_BUG(); } while(0)
1089 +#define ASSERT(x) BSP_BUG_ON(!(x))
1090 +
1091 +extern struct ar531x_boarddata *ar531x_board_configuration;
1092 +extern char *ar531x_radio_configuration;
1093 +extern char *enet_mac_address_get(int MACUnit);
1094 +
1095 +extern void kgdbInit(void);
1096 +extern int kgdbEnabled(void);
1097 +extern void breakpoint(void);
1098 +extern int kgdbInterrupt(void);
1099 +extern unsigned int ar531x_cpu_frequency(void);
1100 +extern unsigned int ar531x_sys_frequency(void);
1101 +
1102 +/* GPIO support */
1103 +extern struct irqaction spurious_gpio;
1104 +extern unsigned int gpioIntMask;
1105 +extern void ar531x_gpio_intr_init(int irq_base);
1106 +extern void ar531x_gpio_ctrl_output(int gpio);
1107 +extern void ar531x_gpio_ctrl_input(int gpio);
1108 +extern void ar531x_gpio_set(int gpio, int val);
1109 +extern int ar531x_gpio_get(int gpio);
1110 +extern void ar531x_gpio_intr_enable(unsigned int irq);
1111 +extern void ar531x_gpio_intr_disable(unsigned int irq);
1112 +
1113 +/* Watchdog Timer support */
1114 +extern int watchdog_start(unsigned int milliseconds);
1115 +extern int watchdog_stop(void);
1116 +extern int watchdog_is_enabled(void);
1117 +extern unsigned int watchdog_min_timer_reached(void);
1118 +extern void watchdog_notify_alive(void);
1119 +
1120 +#define A_DATA_CACHE_INVAL(start, length) \
1121 + dma_cache_inv((UINT32)(start),(length))
1122 +
1123 +#define sysWbFlush() mb()
1124 +
1125 +#define intDisable(x) cli()
1126 +#define intEnable(x) sti()
1127 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xprom.c linux-2.4.32.new/arch/mips/ar531x/ar531xprom.c
1128 --- linux-2.4.32/arch/mips/ar531x/ar531xprom.c 1970-01-01 01:00:00.000000000 +0100
1129 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xprom.c 2005-12-24 20:29:42.133306616 +0000
1130 @@ -0,0 +1,84 @@
1131 +/*
1132 + * This file is subject to the terms and conditions of the GNU General Public
1133 + * License. See the file "COPYING" in the main directory of this archive
1134 + * for more details.
1135 + *
1136 + * Copyright MontaVista Software Inc
1137 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
1138 + */
1139 +
1140 +/*
1141 + * Prom setup file for ar531x
1142 + */
1143 +
1144 +#include <linux/init.h>
1145 +#include <linux/config.h>
1146 +#include <linux/kernel.h>
1147 +#include <linux/string.h>
1148 +#include <linux/mm.h>
1149 +#include <linux/bootmem.h>
1150 +
1151 +#include <asm/bootinfo.h>
1152 +#include <asm/addrspace.h>
1153 +
1154 +#include "ar531xlnx.h"
1155 +
1156 +#define COMMAND_LINE_SIZE 512
1157 +
1158 +char arcs_cmdline[COMMAND_LINE_SIZE];
1159 +
1160 +void __init prom_init(int argc, char *argv[])
1161 +{
1162 + int i;
1163 + unsigned int memcfg1;
1164 + int bank0AC, bank1AC;
1165 + int memsz_in_mb;
1166 +
1167 + strcpy(arcs_cmdline, "console=ttyS0,9600");
1168 + for (i=0; i<argc; i++) {
1169 + strcat(arcs_cmdline, " ");
1170 + strcat(arcs_cmdline, argv[i]);
1171 + }
1172 +
1173 + mips_machgroup = MACH_GROUP_AR531X;
1174 +#ifdef CONFIG_APUNUSED
1175 + mips_machtype = MACH_ATHEROS_UNUSED;
1176 +#endif
1177 +#ifdef CONFIG_AP30
1178 + mips_machtype = MACH_ATHEROS_AP30;
1179 +#endif
1180 +#ifdef CONFIG_AP33
1181 + mips_machtype = MACH_ATHEROS_AP33;
1182 +#endif
1183 +#ifdef CONFIG_AP38
1184 + mips_machtype = MACH_ATHEROS_AP38;
1185 +#endif
1186 +#ifdef CONFIG_AP43
1187 + mips_machtype = MACH_ATHEROS_AP43;
1188 +#endif
1189 +#ifdef CONFIG_AP48
1190 + mips_machtype = MACH_ATHEROS_AP48;
1191 +#endif
1192 +#ifdef CONFIG_PB32
1193 + mips_machtype = MACH_ATHEROS_PB32;
1194 +#endif
1195 +
1196 +
1197 + /* Determine SDRAM size based on Address Checks done at startup */
1198 + memcfg1 = sysRegRead(AR531X_MEM_CFG1);
1199 + bank0AC = (memcfg1 & MEM_CFG1_AC0) >> MEM_CFG1_AC0_S;
1200 + bank1AC = (memcfg1 & MEM_CFG1_AC1) >> MEM_CFG1_AC1_S;
1201 + memsz_in_mb = (bank0AC ? (1 << (bank0AC+1)) : 0)
1202 + + (bank1AC ? (1 << (bank1AC+1)) : 0);
1203 +
1204 + /*
1205 + * By default, use all available memory. You can override this
1206 + * to use, say, 8MB by specifying "mem=8M" as an argument on the
1207 + * linux bootup command line.
1208 + */
1209 + add_memory_region(0, memsz_in_mb << 20, BOOT_MEM_RAM);
1210 +}
1211 +
1212 +void __init prom_free_prom_memory(void)
1213 +{
1214 +}
1215 diff -urN linux-2.4.32/arch/mips/ar531x/ar531xsetup.c linux-2.4.32.new/arch/mips/ar531x/ar531xsetup.c
1216 --- linux-2.4.32/arch/mips/ar531x/ar531xsetup.c 1970-01-01 01:00:00.000000000 +0100
1217 +++ linux-2.4.32.new/arch/mips/ar531x/ar531xsetup.c 2005-12-24 20:29:42.133306616 +0000
1218 @@ -0,0 +1,240 @@
1219 +/*
1220 + * This file is subject to the terms and conditions of the GNU General Public
1221 + * License. See the file "COPYING" in the main directory of this archive
1222 + * for more details.
1223 + *
1224 + * Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
1225 + */
1226 +
1227 +/*
1228 + * Initialization for ar531x SOC.
1229 + */
1230 +
1231 +#include <linux/config.h>
1232 +#include <linux/init.h>
1233 +#include <linux/delay.h>
1234 +#include <linux/irq.h>
1235 +#include <linux/interrupt.h>
1236 +#include <linux/serial.h>
1237 +#include <linux/types.h>
1238 +#include <linux/string.h>
1239 +
1240 +#include <asm/reboot.h>
1241 +#include <asm/io.h>
1242 +#include <asm/time.h>
1243 +#include <asm/pgtable.h>
1244 +#include <asm/processor.h>
1245 +#include <asm/reboot.h>
1246 +#include <asm/system.h>
1247 +#include <asm/serial.h>
1248 +
1249 +#include "ar531xlnx.h"
1250 +
1251 +void
1252 +ar531x_restart(char *command)
1253 +{
1254 + for(;;) {
1255 + sysRegWrite(AR531X_RESET, AR531X_RESET_SYSTEM);
1256 + }
1257 +}
1258 +
1259 +void
1260 +ar531x_halt(void)
1261 +{
1262 + printk(KERN_NOTICE "\n** You can safely turn off the power\n");
1263 + while (1);
1264 +}
1265 +
1266 +void
1267 +ar531x_power_off(void)
1268 +{
1269 + ar531x_halt();
1270 +}
1271 +
1272 +const char *
1273 +get_system_type(void)
1274 +{
1275 + return "Atheros AR531X";
1276 +}
1277 +
1278 +/*
1279 + * This table is indexed by bits 5..4 of the CLOCKCTL1 register
1280 + * to determine the predevisor value.
1281 + */
1282 +static int CLOCKCTL1_PREDIVIDE_TABLE[4] = {
1283 + 1,
1284 + 2,
1285 + 4,
1286 + 5
1287 +};
1288 +
1289 +unsigned int
1290 +ar531x_cpu_frequency(void)
1291 +{
1292 + static unsigned int ar531x_calculated_cpu_freq;
1293 + unsigned int clockctl1_predivide_mask;
1294 + unsigned int clockctl1_predivide_shift;
1295 + unsigned int clockctl1_multiplier_mask;
1296 + unsigned int clockctl1_multiplier_shift;
1297 + unsigned int clockctl1_doubler_mask;
1298 + int wisoc_revision;
1299 +
1300 + /*
1301 + * Trust the bootrom's idea of cpu frequency.
1302 + */
1303 + ar531x_calculated_cpu_freq = sysRegRead(AR5312_SCRATCH);
1304 + if (ar531x_calculated_cpu_freq)
1305 + return ar531x_calculated_cpu_freq;
1306 +
1307 + wisoc_revision = (sysRegRead(AR531X_REV) & AR531X_REV_MAJ) >> AR531X_REV_MAJ_S;
1308 + if (wisoc_revision == AR531X_REV_MAJ_AR2313) {
1309 + clockctl1_predivide_mask = AR2313_CLOCKCTL1_PREDIVIDE_MASK;
1310 + clockctl1_predivide_shift = AR2313_CLOCKCTL1_PREDIVIDE_SHIFT;
1311 + clockctl1_multiplier_mask = AR2313_CLOCKCTL1_MULTIPLIER_MASK;
1312 + clockctl1_multiplier_shift = AR2313_CLOCKCTL1_MULTIPLIER_SHIFT;
1313 + clockctl1_doubler_mask = AR2313_CLOCKCTL1_DOUBLER_MASK;
1314 + } else { /* AR5312 and AR2312 */
1315 + clockctl1_predivide_mask = AR5312_CLOCKCTL1_PREDIVIDE_MASK;
1316 + clockctl1_predivide_shift = AR5312_CLOCKCTL1_PREDIVIDE_SHIFT;
1317 + clockctl1_multiplier_mask = AR5312_CLOCKCTL1_MULTIPLIER_MASK;
1318 + clockctl1_multiplier_shift = AR5312_CLOCKCTL1_MULTIPLIER_SHIFT;
1319 + clockctl1_doubler_mask = AR5312_CLOCKCTL1_DOUBLER_MASK;
1320 + }
1321 +
1322 + /*
1323 + * Clocking is derived from a fixed 40MHz input clock.
1324 + * cpuFreq = InputClock * MULT (where MULT is PLL multiplier)
1325 + *
1326 + * sysFreq = cpuFreq / 4 (used for APB clock, serial,
1327 + * flash, Timer, Watchdog Timer)
1328 + *
1329 + * cntFreq = cpuFreq / 2 (use for CPU count/compare)
1330 + *
1331 + * So, for example, with a PLL multiplier of 5, we have
1332 + * cpuFrez = 200MHz
1333 + * sysFreq = 50MHz
1334 + * cntFreq = 100MHz
1335 + *
1336 + * We compute the CPU frequency, based on PLL settings.
1337 + */
1338 + if (ar531x_calculated_cpu_freq == 0) {
1339 + unsigned int clockCtl1 = sysRegRead(AR5312_CLOCKCTL1);
1340 +
1341 + int preDivideSelect = (clockCtl1 & clockctl1_predivide_mask) >>
1342 + clockctl1_predivide_shift;
1343 +
1344 + int preDivisor = CLOCKCTL1_PREDIVIDE_TABLE[preDivideSelect];
1345 +
1346 + int multiplier = (clockCtl1 & clockctl1_multiplier_mask) >>
1347 + clockctl1_multiplier_shift;
1348 +
1349 + if (clockCtl1 & clockctl1_doubler_mask) {
1350 + multiplier = multiplier << 1;
1351 + }
1352 +
1353 + ar531x_calculated_cpu_freq = (40000000 / preDivisor) * multiplier;
1354 + }
1355 +
1356 + return ar531x_calculated_cpu_freq;
1357 +}
1358 +
1359 +unsigned int
1360 +ar531x_sys_frequency(void)
1361 +{
1362 + static unsigned int ar531x_calculated_sys_freq = 0;
1363 +
1364 + if (ar531x_calculated_sys_freq == 0) {
1365 + ar531x_calculated_sys_freq = ar531x_cpu_frequency() / 4;
1366 + }
1367 +
1368 + return ar531x_calculated_sys_freq;
1369 +}
1370 +
1371 +static void __init
1372 +flash_setup(void)
1373 +{
1374 + UINT32 flash_ctl;
1375 +
1376 + /* Configure flash bank 0 */
1377 + flash_ctl = FLASHCTL_E |
1378 + FLASHCTL_AC_8M |
1379 + FLASHCTL_RBLE |
1380 + (0x01 << FLASHCTL_IDCY_S) |
1381 + (0x07 << FLASHCTL_WST1_S) |
1382 + (0x07 << FLASHCTL_WST2_S) |
1383 + (sysRegRead(AR531X_FLASHCTL0) & FLASHCTL_MW);
1384 +
1385 + sysRegWrite(AR531X_FLASHCTL0, flash_ctl);
1386 +
1387 + /* Disable other flash banks */
1388 + sysRegWrite(AR531X_FLASHCTL1,
1389 + sysRegRead(AR531X_FLASHCTL1) & ~(FLASHCTL_E | FLASHCTL_AC));
1390 +
1391 + sysRegWrite(AR531X_FLASHCTL2,
1392 + sysRegRead(AR531X_FLASHCTL2) & ~(FLASHCTL_E | FLASHCTL_AC));
1393 +}
1394 +
1395 +
1396 +
1397 +void __init
1398 +serial_setup(void)
1399 +{
1400 + struct serial_struct s;
1401 +
1402 + memset(&s, 0, sizeof(s));
1403 +
1404 + s.flags = STD_COM_FLAGS;
1405 + s.io_type = SERIAL_IO_MEM;
1406 + s.baud_base = ar531x_sys_frequency()/16;
1407 + s.irq = AR531X_MISC_IRQ_UART0;
1408 + s.iomem_reg_shift = 2;
1409 + s.iomem_base = (u8 *)0xbc000003;
1410 +
1411 + if (early_serial_setup(&s) != 0)
1412 + printk(KERN_ERR "early_serial_setup failed\n");
1413 +}
1414 +
1415 +extern int setup_irq(unsigned int irq, struct irqaction *irqaction);
1416 +static void __init
1417 +ar531x_timer_setup(struct irqaction *irq)
1418 +{
1419 + unsigned int count;
1420 +
1421 + /* Usually irq is timer_irqaction (timer_interrupt) */
1422 + setup_irq(AR531X_IRQ_CPU_CLOCK, irq);
1423 +
1424 + /* to generate the first CPU timer interrupt */
1425 + count = read_c0_count();
1426 + write_c0_compare(count + 1000);
1427 +}
1428 +
1429 +extern void (*board_time_init)(void);
1430 +
1431 +static void __init
1432 +ar531x_time_init(void)
1433 +{
1434 + mips_hpt_frequency = ar531x_cpu_frequency() / 2;
1435 +}
1436 +
1437 +void __init
1438 +ar531x_setup(void)
1439 +{
1440 + /* Clear any lingering AHB errors */
1441 + sysRegRead(AR531X_PROCADDR);
1442 + sysRegRead(AR531X_DMAADDR);
1443 +
1444 + sysRegWrite(AR531X_WD_CTRL, AR531X_WD_CTRL_IGNORE_EXPIRATION);
1445 +
1446 + /* Disable data watchpoints */
1447 + write_c0_watchlo0(0);
1448 +
1449 + board_time_init = ar531x_time_init;
1450 + board_timer_setup = ar531x_timer_setup;
1451 +
1452 + _machine_restart = ar531x_restart;
1453 + _machine_halt = ar531x_halt;
1454 + _machine_power_off = ar531x_power_off;
1455 +
1456 + flash_setup();
1457 + serial_setup();
1458 +}
1459 diff -urN linux-2.4.32/arch/mips/ar531x/Makefile linux-2.4.32.new/arch/mips/ar531x/Makefile
1460 --- linux-2.4.32/arch/mips/ar531x/Makefile 1970-01-01 01:00:00.000000000 +0100
1461 +++ linux-2.4.32.new/arch/mips/ar531x/Makefile 2005-12-24 20:29:42.010325312 +0000
1462 @@ -0,0 +1,33 @@
1463 +#
1464 +# This file is subject to the terms and conditions of the GNU General Public
1465 +# License. See the file "COPYING" in the main directory of this archive
1466 +# for more details.
1467 +#
1468 +# Copyright © 2003 Atheros Communications, Inc., All Rights Reserved.
1469 +#
1470 +
1471 +# Makefile for Atheros ar531x boards
1472 +#
1473 +# Note! Dependencies are done automagically by 'make dep', which also
1474 +# removes any old dependencies. DON'T put your own dependencies here
1475 +# unless it's something special (ie not a .c file).
1476 +#
1477 +
1478 +.S.s:
1479 + $(CPP) $(CFLAGS) $< -o $*.s
1480 +.S.o:
1481 + $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $*.o
1482 +
1483 +O_TARGET:= ar531x.o
1484 +
1485 +export-objs = ar531xksyms.o
1486 +
1487 +obj-y := ar531xdbg_io.o \
1488 + ar531xsetup.o \
1489 + ar531xprom.o \
1490 + ar531xirq.o \
1491 + ar531xintr.o \
1492 + ar531xgpio.o \
1493 + ar531xksyms.o
1494 +
1495 +include $(TOPDIR)/Rules.make
1496 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/backup-busybox.links linux-2.4.32.new/arch/mips/ar531x/RAMDISK/backup-busybox.links
1497 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/backup-busybox.links 1970-01-01 01:00:00.000000000 +0100
1498 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/backup-busybox.links 2005-12-24 20:29:42.011325160 +0000
1499 @@ -0,0 +1,33 @@
1500 +/usr/bin/[
1501 +/sbin/brctl
1502 +/bin/cat
1503 +/bin/chmod
1504 +/bin/cp
1505 +/bin/df
1506 +/bin/echo
1507 +/bin/false
1508 +/sbin/ifconfig
1509 +/sbin/init
1510 +/sbin/insmod
1511 +/bin/kill
1512 +/bin/ls
1513 +/sbin/lsmod
1514 +/bin/mkdir
1515 +/sbin/modprobe
1516 +/bin/mount
1517 +/bin/msh
1518 +/bin/mv
1519 +/bin/ping
1520 +/bin/ps
1521 +/bin/pwd
1522 +/sbin/reboot
1523 +/bin/rm
1524 +/bin/rmdir
1525 +/sbin/rmmod
1526 +/sbin/route
1527 +/bin/sh
1528 +/usr/bin/test
1529 +/usr/bin/top
1530 +/bin/true
1531 +/bin/umount
1532 +/usr/bin/wget
1533 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/busybox.links linux-2.4.32.new/arch/mips/ar531x/RAMDISK/busybox.links
1534 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/busybox.links 1970-01-01 01:00:00.000000000 +0100
1535 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/busybox.links 2005-12-24 20:29:42.011325160 +0000
1536 @@ -0,0 +1,33 @@
1537 +/usr/bin/[
1538 +/sbin/brctl
1539 +/bin/cat
1540 +/bin/chmod
1541 +/bin/cp
1542 +/bin/df
1543 +/bin/echo
1544 +/bin/false
1545 +/sbin/ifconfig
1546 +/sbin/init
1547 +/sbin/insmod
1548 +/bin/kill
1549 +/bin/ls
1550 +/sbin/lsmod
1551 +/bin/mkdir
1552 +/sbin/modprobe
1553 +/bin/mount
1554 +/bin/msh
1555 +/bin/mv
1556 +/bin/ping
1557 +/bin/ps
1558 +/bin/pwd
1559 +/sbin/reboot
1560 +/bin/rm
1561 +/bin/rmdir
1562 +/sbin/rmmod
1563 +/sbin/route
1564 +/bin/sh
1565 +/usr/bin/test
1566 +/bin/true
1567 +/bin/umount
1568 +/bin/uname
1569 +/usr/bin/wget
1570 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/Makefile linux-2.4.32.new/arch/mips/ar531x/RAMDISK/Makefile
1571 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/Makefile 1970-01-01 01:00:00.000000000 +0100
1572 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/Makefile 2005-12-24 20:29:42.011325160 +0000
1573 @@ -0,0 +1,53 @@
1574 +KERNEL_SOURCE=../../../..
1575 +
1576 +# The value for INITRDSIZE is extracted from linux/.config,
1577 +# if it exists; otherwise, a default value is used.
1578 +
1579 +CONFIG_FILE = $(KERNEL_SOURCE)/.config
1580 +
1581 +ifeq ($(CONFIG_FILE),$(wildcard $(CONFIG_FILE)))
1582 +
1583 +include $(CONFIG_FILE)
1584 +ifdef CONFIG_BLK_DEV_RAM_SIZE
1585 +INITRDSIZE := $(shell echo $(CONFIG_BLK_DEV_RAM_SIZE))
1586 +else
1587 +INITRDSIZE := 8192
1588 +endif
1589 +
1590 +else
1591 +INITRDSIZE := 8192
1592 +endif
1593 +
1594 +MOUNTPT = /mnt/xtmp
1595 +
1596 +ramdisk.gz: ramdisk
1597 + gzip -f ramdisk
1598 +
1599 +ramdisk:
1600 + ./makelinks
1601 + @echo "CREATING RAMDISK OF SIZE $(INITRDSIZE) on $@"
1602 + dd if=/dev/zero of=$@ bs=1k count=$(INITRDSIZE)
1603 + /sbin/mke2fs -vFm0 $@ $(INITRDSIZE)
1604 + if [ \! -e $(MOUNTPT) ]; then mkdir -p $(MOUNTPT) ; fi
1605 + mount -o loop $@ $(MOUNTPT)
1606 + @df $(MOUNTPT)
1607 + (cd rootdir; tar cf - . ) | (cd $(MOUNTPT) && tar xf - )
1608 + (cd $(MOUNTPT) ; chown -R root.root . )
1609 + @df $(MOUNTPT)
1610 + umount $(MOUNTPT)
1611 +
1612 +install:
1613 + @(if [ -d $(KERNEL_SOURCE)/arch/mips/ramdisk ]; \
1614 + then \
1615 + if [ -f ramdisk.gz ]; \
1616 + then \
1617 + cp ramdisk.gz $(KERNEL_SOURCE)/arch/mips/ramdisk/; \
1618 + else \
1619 + echo "No ramdisk.gz image"; \
1620 + fi; \
1621 + else \
1622 + echo "No ramdisk directory. Check KERNEL_SOURCE variable."; \
1623 + fi)
1624 +
1625 +clean:
1626 + rm -f ramdisk.gz ramdisk
1627 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/makelinks linux-2.4.32.new/arch/mips/ar531x/RAMDISK/makelinks
1628 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/makelinks 1970-01-01 01:00:00.000000000 +0100
1629 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/makelinks 2005-12-24 20:29:42.012325008 +0000
1630 @@ -0,0 +1,65 @@
1631 +#!/bin/sh
1632 +
1633 +if [ -f busybox.links ]
1634 +then
1635 + cat busybox.links | sed 's/\//ln -s -f \/bin\/busybox rootdir\//' | /bin/sh
1636 +fi
1637 +
1638 +cons=" root tty 622"
1639 +disk=" root disk 660"
1640 +mtd=" root root 640"
1641 +makedev () { # usage: makedev name [bcu] major minor owner group mode
1642 + if [ "$opt_v" ]
1643 + then if [ "$opt_d" ]
1644 + then echo "rm -f $1"
1645 + else echo "$1 = $2 $3 $4 $5:$6 $7"
1646 + fi
1647 + fi
1648 + [ ! "$opt_n" ] && rm -f $1 &&
1649 + [ ! "$opt_d" ] && mknod $1 $2 $3 $4 &&
1650 + chown $5:$6 $1 &&
1651 + chmod $7 $1
1652 +}
1653 +
1654 +makedev rootdir/dev/console c 5 1 $cons
1655 +makedev rootdir/dev/ram b 1 1 $disk
1656 +makedev rootdir/dev/ram0 b 1 0 $disk
1657 +makedev rootdir/dev/ram1 b 1 1 $disk
1658 +makedev rootdir/dev/ram2 b 1 2 $disk
1659 +makedev rootdir/dev/ram3 b 1 3 $disk
1660 +makedev rootdir/dev/ram4 b 1 4 $disk
1661 +makedev rootdir/dev/ram5 b 1 5 $disk
1662 +makedev rootdir/dev/ram6 b 1 6 $disk
1663 +makedev rootdir/dev/ram7 b 1 7 $disk
1664 +makedev rootdir/dev/ram8 b 1 8 $disk
1665 +makedev rootdir/dev/ram9 b 1 9 $disk
1666 +makedev rootdir/dev/ram10 b 1 10 $disk
1667 +makedev rootdir/dev/ram11 b 1 11 $disk
1668 +makedev rootdir/dev/ram12 b 1 12 $disk
1669 +makedev rootdir/dev/ram13 b 1 13 $disk
1670 +makedev rootdir/dev/ram14 b 1 14 $disk
1671 +makedev rootdir/dev/ram15 b 1 15 $disk
1672 +
1673 +makedev rootdir/dev/mtd0 c 90 0 $mtd
1674 +makedev rootdir/dev/mtd1 c 90 2 $mtd
1675 +makedev rootdir/dev/mtd2 c 90 4 $mtd
1676 +makedev rootdir/dev/mtd3 c 90 6 $mtd
1677 +makedev rootdir/dev/mtd4 c 90 8 $mtd
1678 +makedev rootdir/dev/mtd5 c 90 10 $mtd
1679 +makedev rootdir/dev/mtd6 c 90 12 $mtd
1680 +makedev rootdir/dev/mtdblock0 b 31 0 $mtd
1681 +makedev rootdir/dev/mtdblock1 b 31 1 $mtd
1682 +makedev rootdir/dev/mtdblock2 b 31 2 $mtd
1683 +makedev rootdir/dev/mtdblock3 b 31 3 $mtd
1684 +makedev rootdir/dev/mtdblock4 b 31 4 $mtd
1685 +makedev rootdir/dev/mtdblock5 b 31 5 $mtd
1686 +makedev rootdir/dev/mtdblock6 b 31 6 $mtd
1687 +makedev rootdir/dev/mtdr0 c 90 1 $mtd
1688 +makedev rootdir/dev/mtdr1 c 90 3 $mtd
1689 +makedev rootdir/dev/mtdr2 c 90 5 $mtd
1690 +makedev rootdir/dev/mtdr3 c 90 7 $mtd
1691 +makedev rootdir/dev/mtdr4 c 90 9 $mtd
1692 +makedev rootdir/dev/mtdr5 c 90 11 $mtd
1693 +makedev rootdir/dev/mtdr6 c 90 13 $mtd
1694 +
1695 +cd rootdir/dev;ln -sf ram1 ram
1696 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/README linux-2.4.32.new/arch/mips/ar531x/RAMDISK/README
1697 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/README 1970-01-01 01:00:00.000000000 +0100
1698 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/README 2005-12-24 20:29:42.011325160 +0000
1699 @@ -0,0 +1,40 @@
1700 +How to build a ramdisk image for use as a root filesystem with AR531X
1701 +
1702 +Overview:
1703 +In order to boot from a ramdisk root file system image, you will
1704 +first create a root directory structure in the "rootdir" directory.
1705 +Then run "make" to create a compressed root file system image in
1706 +ramdisk.gz. Finally, copy this image into your kernel source tree
1707 +and remake the kernel. The ramdisk image is then built into the
1708 +kernel. When the kernel starts, it is uncompressed into RAM, and
1709 +used as a root file system.
1710 +
1711 +If you'd like to use a pre-built ramdisk.gz rather than build
1712 +one yourself:
1713 + cp arch/mips/ar531x/RAMDISK/ramdisk.gz arch/mips/ramdisk/ramdisk.gz
1714 +
1715 +Here are the detailed steps to build your own:
1716 +
1717 +1) Modify Makefile to point KERNEL_SOURCE at your linux source tree.
1718 +
1719 +2) Copy whatever additional files/directories/links you'd like to
1720 + under rootdir. Note that you're limited to CONFIG_BLK_DEV_RAM_SIZE
1721 + 1KB blocks, as specified in your linux/.config file.
1722 + Examples:
1723 + Copy busybox to rootdir/bin/
1724 + [NOTE: Copy busybox.links to this directory to
1725 + cause the makelinks script to automatically
1726 + set up all of the necessary busybox command links
1727 + in the rootdir/bin directory].
1728 +
1729 + Copy any wireless driver modules into rootdir tree
1730 +
1731 + You might want to make a copy of the rootdir directory
1732 + before you modify it, just in case you want to get back
1733 + to the original.
1734 +
1735 +3) LOGIN AS ROOT (e.g. "su") and type "make"
1736 +
1737 +4) Copy the resulting ramdisk.gz to your linux source tree under
1738 + arch/mips/ramdisk/ramdisk.gz
1739 + (or "make install" will do this step for you)
1740 Binary files linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/bin/busybox and linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/bin/busybox differ
1741 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/fstab linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/fstab
1742 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/fstab 1970-01-01 01:00:00.000000000 +0100
1743 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/fstab 2005-12-24 20:29:42.063317256 +0000
1744 @@ -0,0 +1 @@
1745 +/proc /proc proc defaults 0 0
1746 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/group linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/group
1747 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/group 1970-01-01 01:00:00.000000000 +0100
1748 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/group 2005-12-24 20:29:42.064317104 +0000
1749 @@ -0,0 +1,18 @@
1750 +root:x:0:
1751 +wheel:x:10:
1752 +bin:x:1:bin,daemon
1753 +daemon:x:2:bin,daemon
1754 +sys:x:3:bin,adm
1755 +adm:x:4:adm,daemon
1756 +tty:x:5:
1757 +disk:x:6:
1758 +lp:x:7:daemon,lp
1759 +mem:x:8:
1760 +kmem:x:9:
1761 +operator:x:11:
1762 +uucp:x:14:uucp
1763 +dip:x:40:
1764 +utmp:x:45:
1765 +www:x:63:
1766 +nobody:x:65534:
1767 +users:x:100:
1768 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/host.conf linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/host.conf
1769 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/host.conf 1970-01-01 01:00:00.000000000 +0100
1770 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/host.conf 2005-12-24 20:29:42.064317104 +0000
1771 @@ -0,0 +1,2 @@
1772 +order hosts,bind
1773 +multi on
1774 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/inittab linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/inittab
1775 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/inittab 1970-01-01 01:00:00.000000000 +0100
1776 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/inittab 2005-12-24 20:29:42.064317104 +0000
1777 @@ -0,0 +1,2 @@
1778 +::sysinit:/etc/rc.d/rcS
1779 +::respawn:/bin/sh
1780 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/nsswitch.conf linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/nsswitch.conf
1781 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/nsswitch.conf 1970-01-01 01:00:00.000000000 +0100
1782 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/nsswitch.conf 2005-12-24 20:29:42.065316952 +0000
1783 @@ -0,0 +1,16 @@
1784 +# /etc/nsswitch.conf
1785 +#
1786 +# Name Service Switch configuration file.
1787 +#
1788 +
1789 +passwd: compat
1790 +shadow: compat
1791 +group: compat
1792 +
1793 +hosts: files dns
1794 +networks: files dns
1795 +
1796 +ethers: files
1797 +protocols: files
1798 +rpc: files
1799 +services: files
1800 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/passwd linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/passwd
1801 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/passwd 1970-01-01 01:00:00.000000000 +0100
1802 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/passwd 2005-12-24 20:29:42.065316952 +0000
1803 @@ -0,0 +1,11 @@
1804 +root:x:0:0:root:/root:/bin/ash
1805 +bin:x:1:1:bin:/bin:/bin/sh
1806 +daemon:x:2:2:daemon:/usr/sbin:/bin/sh
1807 +adm:x:3:4:adm:/adm:/bin/sh
1808 +lp:x:4:7:lp:/var/spool/lpd:/bin/sh
1809 +sync:x:5:0:sync:/bin:/bin/sync
1810 +shutdown:x:6:11:shutdown:/sbin:/sbin/shutdown
1811 +halt:x:7:0:halt:/sbin:/sbin/halt
1812 +uucp:x:10:14:uucp:/var/spool/uucp:/bin/sh
1813 +operator:x:11:0:Operator:/var:/bin/sh
1814 +nobody:x:65534:65534:nobody:/home:/bin/sh
1815 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/rc.d/rcS linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/rc.d/rcS
1816 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/rc.d/rcS 1970-01-01 01:00:00.000000000 +0100
1817 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/rc.d/rcS 2005-12-24 20:29:42.066316800 +0000
1818 @@ -0,0 +1,17 @@
1819 +#!/bin/sh
1820 +
1821 +mount -a
1822 +mount -t jffs2 -o remount +w /
1823 +# mount -t ramfs /dev/ram /ramdisk
1824 +
1825 +echo Load MADWiFi wlan module
1826 +insmod ../../lib/modules/2.4.25/net/wlan.o
1827 +
1828 +echo Load MADWiFi Atheros HAL module
1829 +insmod ../../lib/modules/2.4.25/net/ath_hal.o
1830 +
1831 +echo Load MADWiFi Atheros Driver module
1832 +insmod ../../lib/modules/2.4.25/net/ath_lbus.o
1833 +
1834 +exit
1835 +
1836 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/resolv.conf linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/resolv.conf
1837 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/resolv.conf 1970-01-01 01:00:00.000000000 +0100
1838 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/resolv.conf 2005-12-24 20:29:42.066316800 +0000
1839 @@ -0,0 +1,18 @@
1840 +# /etc/resolv.conf - DNS setup file
1841 +#
1842 +# possible entries are:
1843 +#
1844 +# domain <domain> Local domain name. If not present, the
1845 +# gethostbyname syscall is used to
1846 +# determine the local domain name.
1847 +#
1848 +# search <list_of_domains> Search list for hostname lookup.
1849 +# The search list is normally determined
1850 +# from the local domain name but it
1851 +# can be set to a list of domains.
1852 +#
1853 +# nameserver <ip_addr> Define which server to contact
1854 +# for DNS lookups. If there are
1855 +# multiple nameserver lines (Max=3),
1856 +# they are queried in the listed order.
1857 +#
1858 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/securetty linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/securetty
1859 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/securetty 1970-01-01 01:00:00.000000000 +0100
1860 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/securetty 2005-12-24 20:29:42.066316800 +0000
1861 @@ -0,0 +1,12 @@
1862 +tty1
1863 +tty2
1864 +tty3
1865 +tty4
1866 +tty5
1867 +tty6
1868 +tty7
1869 +tty8
1870 +ttyS0
1871 +ttyS1
1872 +ttyS2
1873 +ttyS3
1874 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/services linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/services
1875 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/services 1970-01-01 01:00:00.000000000 +0100
1876 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/services 2005-12-24 20:29:42.066316800 +0000
1877 @@ -0,0 +1,193 @@
1878 +# $NetBSD: services,v 1.18 1996/03/26 00:07:58 mrg Exp $
1879 +#
1880 +# Network services, Internet style
1881 +#
1882 +# Note that it is presently the policy of IANA to assign a single well-known
1883 +# port number for both TCP and UDP; hence, most entries here have two entries
1884 +# even if the protocol doesn't support UDP operations.
1885 +# Updated from RFC 1340, ``Assigned Numbers'' (July 1992). Not all ports
1886 +# are included, only the more common ones.
1887 +#
1888 +# from: @(#)services 5.8 (Berkeley) 5/9/91
1889 +#
1890 +tcpmux 1/tcp # TCP port service multiplexer
1891 +echo 7/tcp
1892 +echo 7/udp
1893 +discard 9/tcp sink null
1894 +discard 9/udp sink null
1895 +systat 11/tcp users
1896 +daytime 13/tcp
1897 +daytime 13/udp
1898 +netstat 15/tcp
1899 +qotd 17/tcp quote
1900 +msp 18/tcp # message send protocol
1901 +msp 18/udp # message send protocol
1902 +chargen 19/tcp ttytst source
1903 +chargen 19/udp ttytst source
1904 +ftp-data 20/tcp # default ftp data port
1905 +ftp 21/tcp
1906 +ssh 22/tcp
1907 +ssh 22/udp
1908 +telnet 23/tcp
1909 +# 24 - private
1910 +smtp 25/tcp mail
1911 +# 26 - unassigned
1912 +time 37/tcp timserver
1913 +time 37/udp timserver
1914 +rlp 39/udp resource # resource location
1915 +nameserver 42/tcp name # IEN 116
1916 +whois 43/tcp nicname
1917 +domain 53/tcp nameserver # name-domain server
1918 +domain 53/udp nameserver
1919 +mtp 57/tcp # deprecated
1920 +bootps 67/tcp # BOOTP server
1921 +bootps 67/udp
1922 +bootpc 68/tcp # BOOTP client
1923 +bootpc 68/udp
1924 +tftp 69/udp
1925 +gopher 70/tcp # Internet Gopher
1926 +gopher 70/udp
1927 +rje 77/tcp netrjs
1928 +finger 79/tcp
1929 +www 80/tcp http # WorldWideWeb HTTP
1930 +www 80/udp # HyperText Transfer Protocol
1931 +link 87/tcp ttylink
1932 +kerberos 88/tcp krb5 # Kerberos v5
1933 +kerberos 88/udp
1934 +supdup 95/tcp
1935 +# 100 - reserved
1936 +hostnames 101/tcp hostname # usually from sri-nic
1937 +iso-tsap 102/tcp tsap # part of ISODE.
1938 +csnet-ns 105/tcp cso-ns # also used by CSO name server
1939 +csnet-ns 105/udp cso-ns
1940 +rtelnet 107/tcp # Remote Telnet
1941 +rtelnet 107/udp
1942 +pop2 109/tcp pop-2 postoffice # POP version 2
1943 +pop2 109/udp
1944 +pop3 110/tcp pop-3 # POP version 3
1945 +pop3 110/udp
1946 +sunrpc 111/tcp
1947 +sunrpc 111/udp
1948 +auth 113/tcp authentication tap ident
1949 +sftp 115/tcp
1950 +uucp-path 117/tcp
1951 +nntp 119/tcp readnews untp # USENET News Transfer Protocol
1952 +ntp 123/tcp
1953 +ntp 123/udp # Network Time Protocol
1954 +netbios-ns 137/tcp # NETBIOS Name Service
1955 +netbios-ns 137/udp
1956 +netbios-dgm 138/tcp # NETBIOS Datagram Service
1957 +netbios-dgm 138/udp
1958 +netbios-ssn 139/tcp # NETBIOS session service
1959 +netbios-ssn 139/udp
1960 +imap2 143/tcp imap # Interim Mail Access Proto v2
1961 +imap2 143/udp
1962 +snmp 161/udp # Simple Net Mgmt Proto
1963 +snmp-trap 162/udp snmptrap # Traps for SNMP
1964 +cmip-man 163/tcp # ISO mgmt over IP (CMOT)
1965 +cmip-man 163/udp
1966 +cmip-agent 164/tcp
1967 +cmip-agent 164/udp
1968 +xdmcp 177/tcp # X Display Mgr. Control Proto
1969 +xdmcp 177/udp
1970 +nextstep 178/tcp NeXTStep NextStep # NeXTStep window
1971 +nextstep 178/udp NeXTStep NextStep # server
1972 +bgp 179/tcp # Border Gateway Proto.
1973 +bgp 179/udp
1974 +prospero 191/tcp # Cliff Neuman's Prospero
1975 +prospero 191/udp
1976 +irc 194/tcp # Internet Relay Chat
1977 +irc 194/udp
1978 +smux 199/tcp # SNMP Unix Multiplexer
1979 +smux 199/udp
1980 +at-rtmp 201/tcp # AppleTalk routing
1981 +at-rtmp 201/udp
1982 +at-nbp 202/tcp # AppleTalk name binding
1983 +at-nbp 202/udp
1984 +at-echo 204/tcp # AppleTalk echo
1985 +at-echo 204/udp
1986 +at-zis 206/tcp # AppleTalk zone information
1987 +at-zis 206/udp
1988 +z3950 210/tcp wais # NISO Z39.50 database
1989 +z3950 210/udp wais
1990 +ipx 213/tcp # IPX
1991 +ipx 213/udp
1992 +imap3 220/tcp # Interactive Mail Access
1993 +imap3 220/udp # Protocol v3
1994 +ulistserv 372/tcp # UNIX Listserv
1995 +ulistserv 372/udp
1996 +#
1997 +# UNIX specific services
1998 +#
1999 +exec 512/tcp
2000 +biff 512/udp comsat
2001 +login 513/tcp
2002 +who 513/udp whod
2003 +shell 514/tcp cmd # no passwords used
2004 +syslog 514/udp
2005 +printer 515/tcp spooler # line printer spooler
2006 +talk 517/udp
2007 +ntalk 518/udp
2008 +route 520/udp router routed # RIP
2009 +timed 525/udp timeserver
2010 +tempo 526/tcp newdate
2011 +courier 530/tcp rpc
2012 +conference 531/tcp chat
2013 +netnews 532/tcp readnews
2014 +netwall 533/udp # -for emergency broadcasts
2015 +uucp 540/tcp uucpd # uucp daemon
2016 +remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
2017 +#
2018 +webster 765/tcp # Network dictionary
2019 +webster 765/udp
2020 +# temporary entry (not officially registered by the Samba Team!)
2021 +swat 901/tcp # Samba Web Administration Tool
2022 +#
2023 +# From ``Assigned Numbers'':
2024 +#
2025 +#> The Registered Ports are not controlled by the IANA and on most systems
2026 +#> can be used by ordinary user processes or programs executed by ordinary
2027 +#> users.
2028 +#
2029 +#> Ports are used in the TCP [45,106] to name the ends of logical
2030 +#> connections which carry long term conversations. For the purpose of
2031 +#> providing services to unknown callers, a service contact port is
2032 +#> defined. This list specifies the port used by the server process as its
2033 +#> contact port. While the IANA can not control uses of these ports it
2034 +#> does register or list uses of these ports as a convienence to the
2035 +#> community.
2036 +#
2037 +ingreslock 1524/tcp
2038 +ingreslock 1524/udp
2039 +prospero-np 1525/tcp # Prospero non-privileged
2040 +prospero-np 1525/udp
2041 +rfe 5002/tcp # Radio Free Ethernet
2042 +rfe 5002/udp # Actually uses UDP only
2043 +#
2044 +#
2045 +# Kerberos (Project Athena/MIT) services
2046 +# Note that these are for Kerberos v4, and are unofficial.
2047 +#
2048 +klogin 543/tcp # Kerberos `rlogin'
2049 +kshell 544/tcp krcmd # Kerberos `rsh'
2050 +kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
2051 +kerberos4 750/udp kdc # Kerberos (server) udp
2052 +kerberos4 750/tcp kdc # Kerberos (server) tcp
2053 +kerberos-master 751/udp # Kerberos admin server udp
2054 +kerberos-master 751/tcp # Kerberos admin server tcp
2055 +krbupdate 760/tcp kreg # BSD Kerberos registration
2056 +kpasswd 761/tcp kpwd # BSD Kerberos `passwd'
2057 +eklogin 2105/tcp # Kerberos encrypted `rlogin'
2058 +#
2059 +# Unofficial but necessary (for NetBSD) services
2060 +#
2061 +supfilesrv 871/tcp # SUP server
2062 +supfiledbg 1127/tcp # SUP debugging
2063 +#
2064 +# AppleTalk DDP entries (DDP: Datagram Delivery Protocol)
2065 +#
2066 +rtmp 1/ddp # Routing Table Maintenance Protocol
2067 +nbp 2/ddp # Name Binding Protocol
2068 +echo 4/ddp # AppleTalk Echo Protocol
2069 +zip 6/ddp # Zone Information Protocol
2070 +
2071 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/shadow linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/shadow
2072 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/etc/shadow 1970-01-01 01:00:00.000000000 +0100
2073 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/etc/shadow 2005-12-24 20:29:42.067316648 +0000
2074 @@ -0,0 +1,11 @@
2075 +root::10933:0:99999:7:::
2076 +bin:*:10933:0:99999:7:::
2077 +daemon:*:10933:0:99999:7:::
2078 +adm:*:10933:0:99999:7:::
2079 +lp:*:10933:0:99999:7:::
2080 +sync:*:10933:0:99999:7:::
2081 +shutdown:*:10933:0:99999:7:::
2082 +halt:*:10933:0:99999:7:::
2083 +uucp:*:10933:0:99999:7:::
2084 +operator:*:10933:0:99999:7:::
2085 +nobody:*:10933:0:99999:7:::
2086 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.generic_string linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.generic_string
2087 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.generic_string 1970-01-01 01:00:00.000000000 +0100
2088 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.generic_string 2005-12-24 20:29:42.071316040 +0000
2089 @@ -0,0 +1 @@
2090 +# module id=string
2091 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.ieee1394map linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.ieee1394map
2092 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.ieee1394map 1970-01-01 01:00:00.000000000 +0100
2093 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.ieee1394map 2005-12-24 20:29:42.071316040 +0000
2094 @@ -0,0 +1 @@
2095 +# ieee1394 module match_flags vendor_id model_id specifier_id version
2096 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.isapnpmap linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.isapnpmap
2097 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.isapnpmap 1970-01-01 01:00:00.000000000 +0100
2098 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.isapnpmap 2005-12-24 20:29:42.079314824 +0000
2099 @@ -0,0 +1 @@
2100 +# isapnp module cardvendor carddevice driver_data vendor function ...
2101 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.parportmap linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.parportmap
2102 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.parportmap 1970-01-01 01:00:00.000000000 +0100
2103 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.parportmap 2005-12-24 20:29:42.079314824 +0000
2104 @@ -0,0 +1 @@
2105 +# module pattern
2106 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pcimap linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pcimap
2107 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pcimap 1970-01-01 01:00:00.000000000 +0100
2108 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pcimap 2005-12-24 20:29:42.080314672 +0000
2109 @@ -0,0 +1 @@
2110 +# pci module vendor device subvendor subdevice class class_mask driver_data
2111 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pnpbiosmap linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pnpbiosmap
2112 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pnpbiosmap 1970-01-01 01:00:00.000000000 +0100
2113 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.pnpbiosmap 2005-12-24 20:29:42.080314672 +0000
2114 @@ -0,0 +1 @@
2115 +# module id
2116 diff -urN linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.usbmap linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.usbmap
2117 --- linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.usbmap 1970-01-01 01:00:00.000000000 +0100
2118 +++ linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/lib/modules/2.4.25/modules.usbmap 2005-12-24 20:29:42.080314672 +0000
2119 @@ -0,0 +1 @@
2120 +# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
2121 Binary files linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/sbin/iwconfig and linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/sbin/iwconfig differ
2122 Binary files linux-2.4.32/arch/mips/ar531x/RAMDISK/rootdir/sbin/iwpriv and linux-2.4.32.new/arch/mips/ar531x/RAMDISK/rootdir/sbin/iwpriv differ
2123 diff -urN linux-2.4.32/arch/mips/ar531x/README linux-2.4.32.new/arch/mips/ar531x/README
2124 --- linux-2.4.32/arch/mips/ar531x/README 1970-01-01 01:00:00.000000000 +0100
2125 +++ linux-2.4.32.new/arch/mips/ar531x/README 2005-12-24 20:29:42.101311480 +0000
2126 @@ -0,0 +1,68 @@
2127 +Basic information for the AR531X Board Support Package
2128 +
2129 +This directory contains the "LBSP" -- Linux Board Support Package --
2130 +for Linux on the Atheros AR531X Wireless System-On-a-Chip. It is intended
2131 +primarily as a building block for wireless products. At this time, the
2132 +AR531X Linux BSP is experimental code, and is actively UNDER CONSTRUCTION.
2133 +
2134 +Some components that are supported by this LBSP along with a standard 2.4
2135 +Linux MIPS kernel include
2136 + R4Kc CPU
2137 + instruction and data caches
2138 + SDRAM
2139 + flash (Macronix, AMD, STS, etc.)
2140 + 16550 serial port
2141 + ethernet MACs
2142 + ethernet PHY or PHY Switch (RealTek, Kendin, Marvell)
2143 + General-Purpose I/O pins
2144 + kernel debugging with kgdb
2145 +
2146 +This LBSP code does NOT include drivers for the wireless components of the
2147 +chip/boards! Drivers for those components may be distributed separately.
2148 +In particular, the MADWiFi project under SourceForge supports (not yet!)
2149 +wireless functions on the AR531X chipset. See
2150 + http://www.sourceforge.net/projects/madwifi
2151 +
2152 +Files included in this BSP:
2153 +ae531xlnx.c - Linux-specific portions of the ethernet driver
2154 +ae531xmac.c - OS-independent AR531X ethernet MAC code
2155 +ae531xmac.h - OS-independent AR531X ethernet MAC software definitions
2156 +ae531xreg.h - OS-independent AR531X ethernet MAC hardware definitions
2157 +ar531x.h - OS-independent AR531X system hardware definitions
2158 +ar531xlnx.h - Linux-specific AR531X system definitions and externs
2159 +defconfig-ar531x - Default Linux configuration file
2160 +intr_recv.S - Linux interrupt "glue" code
2161 +ar531xirq.c - Linux Interrupt Request management
2162 +Makefile - Linux makefile
2163 +mvPhy.c - OS-independent ethernet PHY code for Marvell Switch
2164 +mvPhy.h - OS-independent ethernet PHY definitions for Marvell Switch
2165 +ar531xprom.c - Linux prom "glue" code
2166 +ar531xsetup.c - Linux startup code
2167 +ar531xdbg_io.c - Support for kgdb-based debugging and for EARLY_PRINTK_HACK
2168 +ar531xproc.c - Pseudo-device driver for /proc/ar531x device
2169 +ar531xgpio.c - Support for General Purpose I/O pins
2170 +ar531xwmacsl.c - Wireless MAC Support Layer
2171 +
2172 +Additional files, distributed with the BSP:
2173 +README - This file
2174 +README.BUILD - Instructions for building a linux kernel from source
2175 +README.EXECUTE - Instructions for testing your linux kernel
2176 +README.RAMDISK - Instructions for building a root ramdisk image
2177 +
2178 +ramdisk.gz - A binary ramdisk image, suitable for use with AR531X.
2179 +DIFFS - Directory that contains "patch" files (See README.BUILD)
2180 +
2181 +
2182 +There are several ways to boot a vmlinux image on an AR531X board:
2183 + -You can boot in over ethernet from the vxWorks bootrom, which is preloaded
2184 + on all Atheros boards
2185 + -You can use an ICE (e.g. VisionICE) to load the vmlinux image. You will
2186 + need appropriate register initialization (e.g. AP30.ini file)
2187 + -You can use the eCos RedBoot bootrom loader. This is a full-featured
2188 + bootrom which as been ported to AR531x. It can boot vmlinux over ethernet
2189 + or from flash. Source code is available from Atheros.
2190 +
2191 +Please send comments, corrections, complaints, criticisms, suggestions,
2192 +enhancements, requests, or any other reasonable communications regarding
2193 +this effort, to "linux@atheros.com". Your email will be received by a
2194 +couple of engineers, and redirected as appropriate.
2195 diff -urN linux-2.4.32/arch/mips/ar531x/README.BUILD linux-2.4.32.new/arch/mips/ar531x/README.BUILD
2196 --- linux-2.4.32/arch/mips/ar531x/README.BUILD 1970-01-01 01:00:00.000000000 +0100
2197 +++ linux-2.4.32.new/arch/mips/ar531x/README.BUILD 2005-12-24 20:29:42.101311480 +0000
2198 @@ -0,0 +1,47 @@
2199 + How to BUILD a linux kernel for an AR531X system
2200 +
2201 +It is expected that you will build Linux on an existing Linux system, which
2202 +has all of the standard Linux tools.
2203 +
2204 +01) Obtain a MIPS BigEndian ELF gcc-compatible toolchain. For example,
2205 + if you're cross-compiling on a x86 Linux system, you could use:
2206 + ftp://ftp.mips.com/pub/tools/software/sde-for-linux/sdelinux-5.01-4eb.i386.rpm
2207 +
2208 +02) Obtain the latest working MIPS Linux kernel
2209 + cvs -d :pserver:cvs@ftp.linux-mips.org:/home/cvs login (password "cvs")
2210 + cvs -d :pserver:cvs@ftp.linux-mips.org:/home/cvs co -r linux_2_4 linux
2211 +
2212 + Now "cd linux". The remainder of these instructions assume
2213 + that you are in the linux directory.
2214 +
2215 +03) Place the contents of this directory at arch/mips/ar531x.
2216 +
2217 +04) Use the patch command to patch generic linux files according
2218 + to the DIFFS directory
2219 + for i in arch/mips/ar531x/DIFFS/*.diff
2220 + do
2221 + patch -p1 < $i
2222 + done
2223 + NOTE: This version of the AR531X Linux BSP was tested with
2224 + MIPS Linux 2.4.22 as of 11/14/03. If you use a different
2225 + (e.g. more recent) version of Linux source, you may need to
2226 + resolve some minor patch and compilation issues.
2227 +
2228 +05) Set up a RAMDISK image.
2229 + See the instructions in README.RAMDISK.
2230 +
2231 +06) Set up a linux configuration using ar531x/defconfig-ar531x.
2232 + cp arch/mips/ar531x/defconfig-ar531x .config
2233 + make oldconfig (answer all questions that are asked)
2234 + NOTE: For development/debug purposes, you may want to
2235 + enable CONFIG_RUNTIME_DEBUG and CONFIG_KGDB.
2236 +
2237 +07) Make dependencies.
2238 + make dep
2239 +
2240 +08) Build the linux kernel
2241 + make
2242 +
2243 +09) The linux image you just built is in vmlinux.
2244 + See instructions in README.EXECUTE to run your vmlinux
2245 + image on an AP531X-based board.
2246 diff -urN linux-2.4.32/arch/mips/ar531x/README.EXECUTE linux-2.4.32.new/arch/mips/ar531x/README.EXECUTE
2247 --- linux-2.4.32/arch/mips/ar531x/README.EXECUTE 1970-01-01 01:00:00.000000000 +0100
2248 +++ linux-2.4.32.new/arch/mips/ar531x/README.EXECUTE 2005-12-24 20:29:42.101311480 +0000
2249 @@ -0,0 +1,23 @@
2250 + How to EXECUTE a linux image on an AR531X system
2251 +
2252 +There are currently three ways to run you vmlinux image:
2253 + 1) Load it using the vxWorks bootrom that is supplied with the board.
2254 + You can load it over ethernet or from the TFFS file system, if you
2255 + have sufficient flash to store the image.
2256 + 2) Load it using an ICE (e.g. VisionICE).
2257 + 3) Use a bootrom loader, such as eCos RedBoot.
2258 +
2259 +After you have booted linux:
2260 + By default, the root filesystem on ramdisk is read-only.
2261 + To make it writable, use "mount -o remount w /".
2262 +
2263 + The user-level commands are slightly non-standard, as they
2264 + are based on "busybox".
2265 +
2266 + The "wget" command is included. You can use wget to fetch
2267 + files from any ftp server. So, for instance, you can fetch
2268 + a kernel module and then "insmod" it.
2269 +
2270 +Note that the standard source-level kernel debugger, kgdb, works well
2271 +over the serial line with this port. We use kgdb and the kgdb_demux perl
2272 +script -- available over the www -- for debugging.
2273 diff -urN linux-2.4.32/arch/mips/ar531x/README.VERSION linux-2.4.32.new/arch/mips/ar531x/README.VERSION
2274 --- linux-2.4.32/arch/mips/ar531x/README.VERSION 1970-01-01 01:00:00.000000000 +0100
2275 +++ linux-2.4.32.new/arch/mips/ar531x/README.VERSION 2005-12-24 20:29:42.101311480 +0000
2276 @@ -0,0 +1 @@
2277 +Source release last modified: 12/16/03
2278 diff -urN linux-2.4.32/arch/mips/config-shared.in linux-2.4.32.new/arch/mips/config-shared.in
2279 --- linux-2.4.32/arch/mips/config-shared.in 2005-12-24 16:11:21.000000000 +0000
2280 +++ linux-2.4.32.new/arch/mips/config-shared.in 2005-12-24 21:33:42.804435856 +0000
2281 @@ -31,6 +31,7 @@
2282 dep_bool 'Support for Alchemy PB1000 board' CONFIG_MIPS_PB1000 $CONFIG_MIPS32
2283 dep_bool 'Support for Alchemy PB1100 board' CONFIG_MIPS_PB1100 $CONFIG_MIPS32
2284 dep_bool 'Support for Alchemy PB1500 board' CONFIG_MIPS_PB1500 $CONFIG_MIPS32
2285 +dep_bool 'Support for Atheros AR5312/AR2312 WiSoC (EXPERIMENTAL)' CONFIG_AR531X $CONFIG_AR531X $CONFIG_EXPERIMENTAL
2286 dep_bool 'Support for Alchemy PB1550 board' CONFIG_MIPS_PB1550 $CONFIG_MIPS32
2287 dep_bool 'Support for Alchemy PB1200 board' CONFIG_MIPS_PB1200 $CONFIG_MIPS32
2288 dep_bool 'Support for Alchemy Hydrogen3 board' CONFIG_MIPS_HYDROGEN3 $CONFIG_MIPS32
2289 @@ -196,7 +197,7 @@
2290 bool ' Support for ZBbus profiling' CONFIG_SIBYTE_TBPROF
2291
2292 if [ "$CONFIG_SIBYTE_SWARM" = "y" -o \
2293 - "$CONFIG_SIBYTE_LITTLESUR" = "y" -o \
2294 +O5B "$CONFIG_SIBYTE_LITTLESUR" = "y" -o \
2295 "$CONFIG_SIBYTE_PTSWARM" = "y" -o \
2296 "$CONFIG_SIBYTE_CARMEL" = "y" ]; then
2297 define_bool CONFIG_SIBYTE_GENBUS_IDE y
2298 @@ -239,6 +240,43 @@
2299 define_bool CONFIG_NONCOHERENT_IO y
2300 define_bool CONFIG_PC_KEYB y
2301 fi
2302 +if [ "$CONFIG_AR531X" = "y" ]; then
2303 + define_bool CONFIG_IRQ_CPU y
2304 + define_bool CONFIG_CPU_VR4100 y
2305 + define_bool CONFIG_SERIAL y
2306 + define_bool CONFIG_NEW_IRQ y
2307 + define_bool CONFIG_NEW_TIME_C y
2308 + define_bool CONFIG_AR5312
2309 + define_bool CONFIG_NONCOHERENT_IO y
2310 + bool 'Enable early printk hack' CONFIG_EARLY_PRINTK_HACK
2311 + define_bool CONFIG_SCSI n
2312 + mainmenu_option next_comment
2313 + comment 'Board selection'
2314 + choice 'Board type' \
2315 + "UNKNOWN CONFIG_APUNKNOWN \
2316 + AP30 CONFIG_AP30 \
2317 + AP31 CONFIG_AP31 \
2318 + AP33 CONFIG_AP33 \
2319 + AP38 CONFIG_AP38 \
2320 + AP43 CONFIG_AP43 \
2321 + AP48 CONFIG_AP48" AP30
2322 + if [ "$CONFIG_AP30" = "y" ]; then
2323 + define_int CONFIG_MTD_PHYSMAP_BUSWIDTH 2
2324 + fi
2325 + if [ "$CONFIG_AP33" = "y" ]; then
2326 + define_int CONFIG_MTD_PHYSMAP_BUSWIDTH 1
2327 + fi
2328 + if [ "$CONFIG_AP38" = "y" ]; then
2329 + define_int CONFIG_MTD_PHYSMAP_BUSWIDTH 1
2330 + fi
2331 + if [ "$CONFIG_AP43" = "y" ]; then
2332 + define_int CONFIG_MTD_PHYSMAP_BUSWIDTH 1
2333 + fi
2334 + if [ "$CONFIG_AP48" = "y" ]; then
2335 + define_int CONFIG_MTD_PHYSMAP_BUSWIDTH 1
2336 + fi
2337 + endmenu
2338 +fi
2339 if [ "$CONFIG_CASIO_E55" = "y" ]; then
2340 define_bool CONFIG_IRQ_CPU y
2341 define_bool CONFIG_NONCOHERENT_IO y
2342 diff -urN linux-2.4.32/arch/mips/kernel/setup.c linux-2.4.32.new/arch/mips/kernel/setup.c
2343 --- linux-2.4.32/arch/mips/kernel/setup.c 2005-12-24 16:08:53.000000000 +0000
2344 +++ linux-2.4.32.new/arch/mips/kernel/setup.c 2005-12-24 21:28:51.779678344 +0000
2345 @@ -494,6 +494,7 @@
2346 void hp_setup(void);
2347 void au1x00_setup(void);
2348 void frame_info_init(void);
2349 + void ar531x_setup(void);
2350
2351 frame_info_init();
2352 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
2353 @@ -691,6 +692,12 @@
2354 pmc_yosemite_setup();
2355 break;
2356 #endif
2357 +
2358 +#ifdef CONFIG_AR531X
2359 + case MACH_GROUP_AR531X:
2360 + ar531x_setup();
2361 + break;
2362 +#endif
2363 default:
2364 panic("Unsupported architecture");
2365 }
2366 diff -urN linux-2.4.32/arch/mips/Makefile linux-2.4.32.new/arch/mips/Makefile
2367 --- linux-2.4.32/arch/mips/Makefile 2005-12-24 16:09:51.000000000 +0000
2368 +++ linux-2.4.32.new/arch/mips/Makefile 2005-12-24 21:28:51.780678192 +0000
2369 @@ -725,6 +725,12 @@
2370 LOADADDR += 0x80020000
2371 endif
2372
2373 +ifdef CONFIG_AR531X
2374 +SUBDIRS += arch/mips/ar531x
2375 +LIBS += arch/mips/ar531x/ar531x.o
2376 +LOADADDR += 0x80002000
2377 +endif
2378 +
2379 #
2380 # Choosing incompatible machines durings configuration will result in
2381 # error messages during linking. Select a default linkscript if
2382 diff -urN linux-2.4.32/drivers/mtd/chips/cfi_cmdset_0002.c linux-2.4.32.new/drivers/mtd/chips/cfi_cmdset_0002.c
2383 --- linux-2.4.32/drivers/mtd/chips/cfi_cmdset_0002.c 2004-11-17 11:54:21.000000000 +0000
2384 +++ linux-2.4.32.new/drivers/mtd/chips/cfi_cmdset_0002.c 2005-12-24 21:28:51.795675912 +0000
2385 @@ -510,7 +510,7 @@
2386 or tells us why it failed. */
2387 dq6 = CMD(1<<6);
2388 dq5 = CMD(1<<5);
2389 - timeo = jiffies + (HZ/1000); /* setting timeout to 1ms for now */
2390 + timeo = jiffies + (HZ/1000) + 1; /* setting timeout to 1ms for now */
2391
2392 oldstatus = cfi_read(map, adr);
2393 status = cfi_read(map, adr);
2394 @@ -535,12 +535,14 @@
2395 if( (status & dq5) == dq5 ) {
2396 /* When DQ5 raises, we must check once again
2397 if DQ6 is toggling. If not, the erase has been
2398 - completed OK. If not, reset chip. */
2399 + completed OK. But if so, reset chip. */
2400 oldstatus = cfi_read(map, adr);
2401 status = cfi_read(map, adr);
2402
2403 if ( (oldstatus & 0x00FF) == (status & 0x00FF) ) {
2404 +#if 0
2405 printk(KERN_WARNING "Warning: DQ5 raised while program operation was in progress, however operation completed OK\n" );
2406 +#endif
2407 } else {
2408 /* DQ5 is active so we can do a reset and stop the erase */
2409 cfi_write(map, CMD(0xF0), chip->start);
2410 diff -urN linux-2.4.32/drivers/mtd/chips/jedec_probe.c linux-2.4.32.new/drivers/mtd/chips/jedec_probe.c
2411 --- linux-2.4.32/drivers/mtd/chips/jedec_probe.c 2003-06-13 15:51:34.000000000 +0100
2412 +++ linux-2.4.32.new/drivers/mtd/chips/jedec_probe.c 2005-12-24 21:28:51.797675608 +0000
2413 @@ -900,7 +900,16 @@
2414 NumEraseRegions: 1,
2415 regions: {ERASEINFO(0x01000,256),
2416 }
2417 - }
2418 + }, {
2419 + mfr_id: MANUFACTURER_SST,
2420 + dev_id: SST39LF160,
2421 + name: "SST 39LF160",
2422 + DevSize: SIZE_2MiB,
2423 + CmdSet: P_ID_AMD_STD,
2424 + NumEraseRegions: 1,
2425 + regions: {ERASEINFO(0x01000,512),
2426 + }
2427 + }
2428 };
2429
2430
2431 diff -urN linux-2.4.32/drivers/mtd/Config.in linux-2.4.32.new/drivers/mtd/Config.in
2432 --- linux-2.4.32/drivers/mtd/Config.in 2003-06-13 15:51:34.000000000 +0100
2433 +++ linux-2.4.32.new/drivers/mtd/Config.in 2005-12-24 21:28:51.803674696 +0000
2434 @@ -14,6 +14,9 @@
2435 dep_tristate ' MTD partitioning support' CONFIG_MTD_PARTITIONS $CONFIG_MTD
2436 dep_tristate ' MTD concatenating support' CONFIG_MTD_CONCAT $CONFIG_MTD
2437 dep_tristate ' RedBoot partition table parsing' CONFIG_MTD_REDBOOT_PARTS $CONFIG_MTD_PARTITIONS
2438 + if [ "$CONFIG_MTD_END_RESERVED" != "" ]; then
2439 + define_int CONFIG_MTD_END_RESERVED $CONFIG_MTD_END_RESERVED
2440 + fi
2441 dep_tristate ' Command line partition table parsing' CONFIG_MTD_CMDLINE_PARTS $CONFIG_MTD_PARTITIONS
2442 if [ "$CONFIG_ARM" = "y" ]; then
2443 dep_tristate ' ARM Firmware Suite partition parsing' CONFIG_MTD_AFS_PARTS $CONFIG_MTD_PARTITIONS
2444 diff -urN linux-2.4.32/drivers/mtd/maps/physmap.c linux-2.4.32.new/drivers/mtd/maps/physmap.c
2445 --- linux-2.4.32/drivers/mtd/maps/physmap.c 2003-06-13 15:51:34.000000000 +0100
2446 +++ linux-2.4.32.new/drivers/mtd/maps/physmap.c 2005-12-24 21:28:51.811673480 +0000
2447 @@ -80,12 +80,18 @@
2448 };
2449
2450 #ifdef CONFIG_MTD_PARTITIONS
2451 -#ifdef CONFIG_MTD_CMDLINE_PARTS
2452 +#if defined(CONFIG_MTD_CMDLINE_PARTS) || defined(CONFIG_MTD_REDBOOT_PARTS)
2453 static struct mtd_partition *mtd_parts = 0;
2454 static int mtd_parts_nb = 0;
2455 #else
2456 static struct mtd_partition physmap_partitions[] = {
2457 /* Put your own partition definitions here */
2458 + {
2459 + name: "rootfs",
2460 + size: 0x000e0000,
2461 + offset: 0x000f0000,
2462 + /* Allow file system to be mounted for writing */
2463 + }
2464 #if 0
2465 {
2466 name: "bootROM",
2467 @@ -138,6 +144,22 @@
2468
2469 add_mtd_device(mymtd);
2470 #ifdef CONFIG_MTD_PARTITIONS
2471 +#ifdef CONFIG_MTD_REDBOOT_PARTS
2472 + {
2473 + extern int parse_redboot_partitions(struct mtd_info *master,
2474 + struct mtd_partition **pparts);
2475 +
2476 + struct mtd_partition *rb_parts = 0;
2477 + int rb_parts_nb = 0;
2478 +
2479 + rb_parts_nb = parse_redboot_partitions(mymtd, &rb_parts);
2480 + if (rb_parts_nb > 0) {
2481 + printk(KERN_NOTICE
2482 + "Using redboot flash partitioning");
2483 + add_mtd_partitions (mymtd, rb_parts, rb_parts_nb);
2484 + }
2485 + }
2486 +#endif
2487 #ifdef CONFIG_MTD_CMDLINE_PARTS
2488 mtd_parts_nb = parse_cmdline_partitions(mymtd, &mtd_parts,
2489 "phys");
2490 @@ -147,7 +169,8 @@
2491 "Using command line partition definition\n");
2492 add_mtd_partitions (mymtd, mtd_parts, mtd_parts_nb);
2493 }
2494 -#else
2495 +#endif
2496 +#if !defined(CONFIG_MTD_CMDLINE_PARTS) && !defined(CONFIG_MTD_REDBOOT_PARTS)
2497 if (NUM_PARTITIONS != 0)
2498 {
2499 printk(KERN_NOTICE
2500 diff -urN linux-2.4.32/drivers/mtd/redboot.c linux-2.4.32.new/drivers/mtd/redboot.c
2501 --- linux-2.4.32/drivers/mtd/redboot.c 2001-11-09 22:01:22.000000000 +0000
2502 +++ linux-2.4.32.new/drivers/mtd/redboot.c 2005-12-24 21:28:51.821671960 +0000
2503 @@ -51,8 +51,14 @@
2504 return -ENOMEM;
2505
2506 /* Read the start of the last erase block */
2507 - ret = master->read(master, master->size - master->erasesize,
2508 + {
2509 + u_int32_t part_table_start = master->size - master->erasesize;
2510 +#if defined(CONFIG_MTD_END_RESERVED)
2511 + part_table_start -= CONFIG_MTD_END_RESERVED;
2512 +#endif
2513 + ret = master->read(master, part_table_start,
2514 PAGE_SIZE, &retlen, (void *)buf);
2515 + }
2516
2517 if (ret)
2518 goto out;
2519 diff -urN linux-2.4.32/drivers/net/Config.in linux-2.4.32.new/drivers/net/Config.in
2520 --- linux-2.4.32/drivers/net/Config.in 2005-12-24 16:16:53.000000000 +0000
2521 +++ linux-2.4.32.new/drivers/net/Config.in 2005-12-24 21:28:51.856666640 +0000
2522 @@ -30,6 +30,8 @@
2523 comment 'Ethernet (10 or 100Mbit)'
2524 bool 'Ethernet (10 or 100Mbit)' CONFIG_NET_ETHERNET
2525 if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
2526 + define_bool CONFIG_VENETDEV n
2527 + define_bool CONFIG_MARVELL_ENET_PHY y
2528 if [ "$CONFIG_ARM" = "y" ]; then
2529 dep_bool ' ARM EBSA110 AM79C961A support' CONFIG_ARM_AM79C961A $CONFIG_ARCH_EBSA110
2530 tristate ' Cirrus Logic CS8900A support' CONFIG_ARM_CIRRUS
2531 diff -urN linux-2.4.32/drivers/net/wireless/Config.in linux-2.4.32.new/drivers/net/wireless/Config.in
2532 --- linux-2.4.32/drivers/net/wireless/Config.in 2004-11-17 11:54:21.000000000 +0000
2533 +++ linux-2.4.32.new/drivers/net/wireless/Config.in 2005-12-24 21:28:51.898660256 +0000
2534 @@ -38,7 +38,8 @@
2535
2536 # yes, this works even when no drivers are selected
2537 if [ "$CONFIG_ISA" = "y" -o "$CONFIG_PCI" = "y" -o \
2538 - "$CONFIG_ALL_PPC" = "y" -o "$CONFIG_PCMCIA" != "n" ]; then
2539 + "$CONFIG_ALL_PPC" = "y" -o "$CONFIG_PCMCIA" != "n" -o \
2540 + "$CONFIG_NET_WIRELESS" = "y" ]; then
2541 define_bool CONFIG_NET_WIRELESS y
2542 else
2543 define_bool CONFIG_NET_WIRELESS n
2544 diff -urN linux-2.4.32/include/asm-mips/atheros/ar531xbsp.h linux-2.4.32.new/include/asm-mips/atheros/ar531xbsp.h
2545 --- linux-2.4.32/include/asm-mips/atheros/ar531xbsp.h 1970-01-01 01:00:00.000000000 +0100
2546 +++ linux-2.4.32.new/include/asm-mips/atheros/ar531xbsp.h 2005-12-24 20:29:06.898663096 +0000
2547 @@ -0,0 +1,16 @@
2548 +#ifndef __ASM_ATHEROS_BSP_SUPPORT_H
2549 +#define __ASM_ATHEROS_BSP_SUPPORT_H
2550 +/*
2551 + * These are definitions and functions provided by the bsp to support the
2552 + * AR5312 WiSoC running LSDK. For different BSP implementations, different
2553 + * BSP functions will be needed.
2554 + */
2555 +
2556 +extern unsigned int ar531x_sys_frequency(void);
2557 +
2558 +#ifdef CONFIG_KGDB
2559 +extern void kgdbInit(void);
2560 +extern int kgdbEnabled(void);
2561 +#endif
2562 +
2563 +#endif /* __ASM_ATHEROS_BSP_SUPPORT_H */
2564 diff -urN linux-2.4.32/include/asm-mips/bootinfo.h linux-2.4.32.new/include/asm-mips/bootinfo.h
2565 --- linux-2.4.32/include/asm-mips/bootinfo.h 2005-12-24 16:08:53.000000000 +0000
2566 +++ linux-2.4.32.new/include/asm-mips/bootinfo.h 2005-12-24 21:28:51.899660104 +0000
2567 @@ -37,6 +37,7 @@
2568 #define MACH_GROUP_HP_LJ 20 /* Hewlett Packard LaserJet */
2569 #define MACH_GROUP_LASAT 21
2570 #define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
2571 +#define MACH_GROUP_AR531X 23 /* Atheros AR531X */
2572
2573 /*
2574 * Valid machtype values for group unknown (low order halfword of mips_machtype)
2575 @@ -201,6 +202,17 @@
2576 */
2577 #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
2578
2579 +/*
2580 + * Valid machtype for group MACH_GROUP_AR5312
2581 + */
2582 +#define MACH_ATHEROS_UNUSED 0
2583 +#define MACH_ATHEROS_AP30 1 /* AP30 */
2584 +#define MACH_ATHEROS_AP33 2 /* AP33 */
2585 +#define MACH_ATHEROS_AP38 3 /* AP38 */
2586 +#define MACH_ATHEROS_AP43 4 /* AP43 */
2587 +#define MACH_ATHEROS_AP48 5 /* AP48 */
2588 +#define MACH_ATHEROS_PB32 6 /* PB32 */
2589 +
2590 #define CL_SIZE (256)
2591
2592 const char *get_system_type(void);
2593 diff -urN linux-2.4.32/include/asm-mips/serial.h linux-2.4.32.new/include/asm-mips/serial.h
2594 --- linux-2.4.32/include/asm-mips/serial.h 2005-01-19 14:10:12.000000000 +0000
2595 +++ linux-2.4.32.new/include/asm-mips/serial.h 2005-12-24 21:28:51.901659800 +0000
2596 @@ -467,6 +467,11 @@
2597 #define DDB5477_SERIAL_PORT_DEFNS
2598 #endif
2599
2600 +#if defined(CONFIG_AR531X)
2601 +#undef RS_TABLE_SIZE
2602 +#define RS_TABLE_SIZE 1
2603 +#endif
2604 +
2605 #define SERIAL_PORT_DFNS \
2606 ATLAS_SERIAL_PORT_DEFNS \
2607 AU1000_SERIAL_PORT_DEFNS \
2608 diff -urN linux-2.4.32/kernel/printk.c linux-2.4.32.new/kernel/printk.c
2609 --- linux-2.4.32/kernel/printk.c 2004-11-17 11:54:22.000000000 +0000
2610 +++ linux-2.4.32.new/kernel/printk.c 2005-12-24 21:28:51.929655544 +0000
2611 @@ -384,6 +384,18 @@
2612 _call_console_drivers(start_print, end, msg_level);
2613 }
2614
2615 +#if CONFIG_EARLY_PRINTK_HACK
2616 +void putDebugChar(char byte);
2617 +static void emit_log_char(char c)
2618 +{
2619 + if (c == '\n') {
2620 + putDebugChar('\r');
2621 + putDebugChar('\n');
2622 + } else {
2623 + putDebugChar(c);
2624 + }
2625 +}
2626 +#else
2627 static void emit_log_char(char c)
2628 {
2629 LOG_BUF(log_end) = c;
2630 @@ -395,6 +407,7 @@
2631 if (logged_chars < LOG_BUF_LEN)
2632 logged_chars++;
2633 }
2634 +#endif
2635
2636 /*
2637 * This is printk. It can be called from any context. We want it to work.
2638 @@ -700,3 +713,4 @@
2639 tty->driver.write(tty, 0, msg, strlen(msg));
2640 return;
2641 }
2642 +