470ef254de77596ab872e535e201848b744c1352
[librecmc/librecmc.git] / target / linux / adm5120 / files / include / asm-mips / mach-adm5120 / adm5120_platform.h
1 /*
2  *  $Id$
3  *
4  *  ADM5120 specific platform definitions
5  *
6  *  Copyright (C) 2007-2008 OpenWrt.org
7  *  Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org>
8  *
9  *  This program is free software; you can redistribute it and/or modify it
10  *  under the terms of the GNU General Public License version 2 as published
11  *  by the Free Software Foundation.
12  *
13  */
14
15 #ifndef _ADM5120_PLATFORM_H_
16 #define _ADM5120_PLATFORM_H_
17
18 #include <linux/device.h>
19 #include <linux/platform_device.h>
20
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/map.h>
23 #include <linux/mtd/partitions.h>
24 #include <linux/mtd/nand.h>
25
26 #include <linux/input.h>
27 #include <linux/gpio_buttons.h>
28
29 #include <linux/amba/bus.h>
30 #include <linux/amba/serial.h>
31
32 struct adm5120_flash_platform_data {
33         void                    (*set_vpp)(struct map_info *, int);
34         void                    (*switch_bank)(unsigned);
35         u32                     window_size;
36 #ifdef CONFIG_MTD_PARTITIONS
37         unsigned int            nr_parts;
38         struct mtd_partition    *parts;
39 #endif
40 };
41
42 struct adm5120_switch_platform_data {
43         /* TODO: not yet implemented */
44 };
45
46 struct adm5120_pci_irq {
47         u8      slot;
48         u8      func;
49         u8      pin;
50         unsigned irq;
51 };
52
53 #define PCIIRQ(s,f,p,i) {.slot = (s), .func = (f), .pin  = (p), .irq  = (i)}
54
55 #ifdef CONFIG_PCI
56 extern void adm5120_pci_set_irq_map(unsigned int nr_irqs,
57                 struct adm5120_pci_irq *map) __init;
58 #else
59 static inline void adm5120_pci_set_irq_map(unsigned int nr_irqs,
60                 struct adm5120_pci_irq *map)
61 {
62 }
63 #endif
64
65 #define ADM5120_NUM_BUTTONS     5
66
67 extern struct adm5120_flash_platform_data adm5120_flash0_data;
68 extern struct adm5120_flash_platform_data adm5120_flash1_data;
69 extern struct platform_nand_data adm5120_nand_data;
70 extern struct adm5120_switch_platform_data adm5120_switch_data;
71 extern struct gpio_button adm5120_buttons[ADM5120_NUM_BUTTONS];
72 extern struct gpio_buttons_platform_data adm5120_buttons_data;
73 extern struct amba_pl010_data adm5120_uart0_data;
74 extern struct amba_pl010_data adm5120_uart1_data;
75
76 extern struct platform_device adm5120_flash0_device;
77 extern struct platform_device adm5120_flash1_device;
78 extern struct platform_device adm5120_nand_device;
79 extern struct platform_device adm5120_hcd_device;
80 extern struct platform_device adm5120_switch_device;
81 extern struct platform_device adm5120_buttons_device;
82 extern struct amba_device adm5120_uart0_device;
83 extern struct amba_device adm5120_uart1_device;
84
85 extern void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
86                 unsigned int mctrl);
87
88 extern void adm5120_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
89                 unsigned int ctrl);
90 extern int adm5120_nand_ready(struct mtd_info *mtd);
91
92 #endif /* _ADM5120_PLATFORM_H_ */