34b940759a8ef3c272b6c4110e174a86841a89d8
[openwrt/svn-archive/archive.git] / target / linux / ar7 / files / include / asm-mips / ar7 / vlynq.h
1 /*
2 * Copyright (C) 2006, 2007 OpenWrt.org
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 #ifndef __VLYNQ_H__
21 #define __VLYNQ_H__
22
23 struct vlynq_mapping {
24 u32 size;
25 u32 offset;
26 } __attribute__ ((packed));
27
28 struct vlynq_device_id {
29 u32 id;
30 };
31
32 struct vlynq_regs;
33 struct vlynq_device {
34 u32 id;
35 int irq;
36 int local_irq;
37 int remote_irq;
38 int clock_div;
39 u32 regs_start, regs_end;
40 u32 mem_start, mem_end;
41 u32 irq_start, irq_end;
42 void *priv;
43 struct vlynq_regs *local;
44 struct vlynq_regs *remote;
45 struct device dev;
46 };
47
48 struct vlynq_driver {
49 char *name;
50 int (*probe)(struct vlynq_device *dev);
51 int (*remove)(struct vlynq_device *dev);
52 struct device_driver driver;
53 };
54
55 #define to_vlynq_driver(drv) container_of(drv, struct vlynq_driver, driver)
56
57 struct plat_vlynq_ops {
58 int (*on)(struct vlynq_device *dev);
59 void (*off)(struct vlynq_device *dev);
60 };
61
62 #define to_vlynq_device(device) container_of(device, struct vlynq_device, dev)
63
64 extern struct bus_type vlynq_bus_type;
65
66 extern int __vlynq_register_driver(struct vlynq_driver *driver,
67 struct module *owner);
68
69 static inline int vlynq_register_driver(struct vlynq_driver *driver)
70 {
71 return __vlynq_register_driver(driver, THIS_MODULE);
72 }
73
74 extern void vlynq_unregister_driver(struct vlynq_driver *driver);
75 extern int vlynq_device_enable(struct vlynq_device *dev);
76 extern void vlynq_device_disable(struct vlynq_device *dev);
77 extern u32 vlynq_remote_id(struct vlynq_device *dev);
78 extern void vlynq_set_local_mapping(struct vlynq_device *dev,
79 u32 tx_offset,
80 struct vlynq_mapping *mapping);
81 extern void vlynq_set_remote_mapping(struct vlynq_device *dev,
82 u32 tx_offset,
83 struct vlynq_mapping *mapping);
84 extern int vlynq_virq_to_irq(struct vlynq_device *dev, int virq);
85 extern int vlynq_irq_to_virq(struct vlynq_device *dev, int irq);
86 extern int vlynq_set_local_irq(struct vlynq_device *dev, int virq);
87 extern int vlynq_set_remote_irq(struct vlynq_device *dev, int virq);
88
89 #endif /* __VLYNQ_H__ */