94228b371d7f525e12a75fa7c2ee50e400221f2c
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / osbridge / 5gxi.c
1 /*
2 * OSBRiDGE 5GXi/5XLi board support
3 *
4 * Copyright (C) 2009 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 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/gpio.h>
14 #include <linux/irq.h>
15 #include <linux/etherdevice.h>
16
17 #include <asm/mips_machine.h>
18
19 #include <asm/mach-adm5120/adm5120_defs.h>
20 #include <asm/mach-adm5120/adm5120_platform.h>
21 #include <asm/mach-adm5120/adm5120_info.h>
22
23 #ifdef CONFIG_MTD_PARTITIONS
24 static struct mtd_partition osbridge_5gxi_partitions[] = {
25 {
26 .name = "bootloader",
27 .offset = 0,
28 .size = 64*1024,
29 .mask_flags = MTD_WRITEABLE,
30 } , {
31 .name = "boardcfg",
32 .offset = 64*1024,
33 .size = 64*1024,
34 } , {
35 .name = "firmware",
36 .offset = MTDPART_OFS_APPEND,
37 .size = MTDPART_SIZ_FULL,
38 }
39 };
40 #endif /* CONFIG_MTD_PARTITIONS */
41
42 static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = {
43 GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user", NULL),
44 GPIO_LED_INV(ADM5120_GPIO_P0L0, "5gxi:yellow:lan", NULL),
45 };
46
47 static struct adm5120_pci_irq osbridge_5gxi_pci_irqs[] __initdata = {
48 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
49 };
50
51 static u8 osbridge_5gxi_vlans[6] __initdata = {
52 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
53 };
54
55 static void __init osbridge_5gxi_setup(void)
56 {
57 #ifdef CONFIG_MTD_PARTITIONS
58 adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions);
59 adm5120_flash0_data.parts = osbridge_5gxi_partitions;
60 #endif /* CONFIG_MTD_PARTITIONS */
61
62 adm5120_add_device_uart(0);
63 adm5120_add_device_uart(1);
64
65 adm5120_add_device_flash(0);
66
67 adm5120_add_device_switch(1, osbridge_5gxi_vlans);
68 adm5120_add_device_gpio_leds(ARRAY_SIZE(osbridge_5gxi_gpio_leds),
69 osbridge_5gxi_gpio_leds);
70 adm5120_pci_set_irq_map(ARRAY_SIZE(osbridge_5gxi_pci_irqs),
71 osbridge_5gxi_pci_irqs);
72 }
73
74 MIPS_MACHINE(MACH_ADM5120_5GXI, "OSBRiDGE 5GXi/5XLi board",
75 osbridge_5gxi_setup);