adm5120: add 3.18 support
[openwrt.git] / target / linux / adm5120 / files-3.18 / arch / mips / include / asm / mach-adm5120 / adm5120_platform.h
1 /*
2  *  ADM5120 specific platform definitions
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 #ifndef _ASM_MIPS_MACH_ADM5120_PLATFORM_H
13 #define _ASM_MIPS_MACH_ADM5120_PLATFORM_H
14
15 #include <linux/device.h>
16 #include <linux/platform_device.h>
17 #include <linux/input.h>
18 #include <linux/leds.h>
19 #include <linux/mtd/mtd.h>
20 #include <linux/mtd/map.h>
21 #include <linux/mtd/partitions.h>
22 #include <linux/mtd/nand.h>
23 #include <linux/input.h>
24 #include <linux/gpio_keys.h>
25 #include <linux/amba/bus.h>
26 #include <linux/amba/serial.h>
27
28 struct adm5120_flash_platform_data {
29         void                    (*set_vpp)(struct map_info *, int);
30         void                    (*switch_bank)(unsigned);
31         u32                     window_size;
32         unsigned int            nr_parts;
33         struct mtd_partition    *parts;
34 };
35
36 struct adm5120_switch_platform_data {
37         /* TODO: not yet implemented */
38 };
39
40 struct adm5120_pci_irq {
41         u8      slot;
42         u8      func;
43         u8      pin;
44         unsigned irq;
45 };
46
47 #define PCIIRQ(s, f, p, i) {.slot = (s), .func = (f), .pin  = (p), .irq  = (i)}
48
49 #ifdef CONFIG_PCI
50 extern void adm5120_pci_set_irq_map(unsigned int nr_irqs,
51                 struct adm5120_pci_irq *map) __init;
52 #else
53 static inline void adm5120_pci_set_irq_map(unsigned int nr_irqs,
54                 struct adm5120_pci_irq *map)
55 {
56 }
57 #endif
58
59 extern void adm5120_setup_eth_macs(u8 *mac_base) __init;
60
61 extern struct adm5120_flash_platform_data adm5120_flash0_data;
62 extern struct adm5120_flash_platform_data adm5120_flash1_data;
63
64 extern void adm5120_add_device_flash(unsigned id) __init;
65 extern void adm5120_add_device_usb(void) __init;
66 extern void adm5120_add_device_uart(unsigned id) __init;
67 extern void adm5120_add_device_nand(struct platform_nand_data *pdata) __init;
68 extern void adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) __init;
69 extern void adm5120_register_gpio_buttons(int id,
70                                           unsigned poll_interval,
71                                           unsigned nbuttons,
72                                           struct gpio_keys_button *buttons);
73
74 #define GPIO_LED_DEF(g, n, t, a) {      \
75         .name = (n),                    \
76         .default_trigger = (t),         \
77         .gpio = (g),                    \
78         .active_low = (a)               \
79 }
80
81 #define GPIO_LED_STD(g, n, t)   GPIO_LED_DEF((g), (n), (t), 0)
82 #define GPIO_LED_INV(g, n, t)   GPIO_LED_DEF((g), (n), (t), 1)
83
84 extern void adm5120_add_device_gpio_leds(unsigned num_leds,
85                                         struct gpio_led *leds) __init;
86
87 #endif /* _ASM_MIPS_MACH_ADM5120_PLATFORM_H */