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