adm5120: convert to use the new mips multimachine stuff
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / compex / np28g.c
1 /*
2 * Compex NP28G board support
3 *
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 */
11
12 #include "compex.h"
13
14 static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = {
15 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
16 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0),
17 PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1),
18 PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
19 };
20
21 static struct gpio_led np28g_gpio_leds[] __initdata = {
22 GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL),
23 GPIO_LED_INV(ADM5120_GPIO_PIN3, "power", NULL),
24 GPIO_LED_INV(ADM5120_GPIO_PIN6, "wan_cond", NULL),
25 GPIO_LED_INV(ADM5120_GPIO_PIN7, "wifi", NULL),
26 GPIO_LED_INV(ADM5120_GPIO_P0L2, "usb1", NULL),
27 GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1", NULL),
28 GPIO_LED_INV(ADM5120_GPIO_P1L2, "usb2", NULL),
29 GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL),
30 GPIO_LED_INV(ADM5120_GPIO_P2L2, "usb3", NULL),
31 GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3", NULL),
32 GPIO_LED_INV(ADM5120_GPIO_P3L2, "usb4", NULL),
33 GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL),
34 };
35
36 static u8 np28g_vlans[6] __initdata = {
37 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
38 };
39
40 static void np28g_reset(void)
41 {
42 gpio_set_value(ADM5120_GPIO_PIN4, 0);
43 }
44
45 static void __init np28g_setup(void)
46 {
47 compex_generic_setup();
48
49 /* setup reset line */
50 gpio_request(ADM5120_GPIO_PIN4, NULL);
51 gpio_direction_output(ADM5120_GPIO_PIN4, 1);
52 adm5120_board_reset = np28g_reset;
53
54 adm5120_add_device_switch(4, np28g_vlans);
55 adm5120_add_device_usb();
56
57 adm5120_add_device_gpio_leds(ARRAY_SIZE(np28g_gpio_leds),
58 np28g_gpio_leds);
59
60 adm5120_pci_set_irq_map(ARRAY_SIZE(np28g_pci_irqs), np28g_pci_irqs);
61 }
62
63 MIPS_MACHINE(MACH_ADM5120_NP28G, "NP28G", "Compex NetPassage 28G", np28g_setup);