adm5120: add 3.18 support
[openwrt.git] / target / linux / adm5120 / files-3.18 / 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 static struct mtd_partition osbridge_5gxi_partitions[] = {
24         {
25                 .name   = "bootloader",
26                 .offset = 0,
27                 .size   = 64*1024,
28                 .mask_flags = MTD_WRITEABLE,
29         } , {
30                 .name   = "boardcfg",
31                 .offset = 64*1024,
32                 .size   = 64*1024,
33         } , {
34                 .name   = "firmware",
35                 .offset = MTDPART_OFS_APPEND,
36                 .size   = MTDPART_SIZ_FULL,
37         }
38 };
39
40 static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = {
41         GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user",      NULL),
42         GPIO_LED_INV(ADM5120_GPIO_P0L0, "5gxi:yellow:lan",      NULL),
43 };
44
45 static struct adm5120_pci_irq osbridge_5gxi_pci_irqs[] __initdata = {
46         PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
47 };
48
49 static u8 osbridge_5gxi_vlans[6] __initdata = {
50         0x41, 0x00, 0x00, 0x00, 0x00, 0x00
51 };
52
53 static void __init osbridge_5gxi_setup(void)
54 {
55         adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions);
56         adm5120_flash0_data.parts = osbridge_5gxi_partitions;
57
58         adm5120_add_device_uart(0);
59         adm5120_add_device_uart(1);
60
61         adm5120_add_device_flash(0);
62
63         adm5120_add_device_switch(1, osbridge_5gxi_vlans);
64         adm5120_add_device_gpio_leds(ARRAY_SIZE(osbridge_5gxi_gpio_leds),
65                                         osbridge_5gxi_gpio_leds);
66         adm5120_pci_set_irq_map(ARRAY_SIZE(osbridge_5gxi_pci_irqs),
67                                 osbridge_5gxi_pci_irqs);
68 }
69
70 MIPS_MACHINE(MACH_ADM5120_5GXI, "5GXi", "OSBRiDGE 5GXi/5XLi board",
71              osbridge_5gxi_setup);