e2cfe8770c4680349bec25b2aab1600e9037f70b
[openwrt.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 #ifndef __VLYNQ_H__
20 #define __VLYNQ_H__
21
22 #include <linux/device.h>
23 #include <linux/module.h>
24 #include <linux/types.h>
25
26 struct vlynq_mapping {
27 u32 size;
28 u32 offset;
29 } __attribute__ ((packed));
30
31 struct vlynq_device_id {
32 u32 id;
33 };
34
35 enum vlynq_divisor {
36 vlynq_div_auto = 0,
37 vlynq_ldiv1,
38 vlynq_ldiv2,
39 vlynq_ldiv3,
40 vlynq_ldiv4,
41 vlynq_ldiv5,
42 vlynq_ldiv6,
43 vlynq_ldiv7,
44 vlynq_ldiv8,
45 vlynq_rdiv1,
46 vlynq_rdiv2,
47 vlynq_rdiv3,
48 vlynq_rdiv4,
49 vlynq_rdiv5,
50 vlynq_rdiv6,
51 vlynq_rdiv7,
52 vlynq_rdiv8,
53 vlynq_div_external
54 };
55
56 struct vlynq_regs;
57 struct vlynq_device {
58 u32 id;
59 int irq;
60 int local_irq;
61 int remote_irq;
62 enum vlynq_divisor divisor;
63 u32 regs_start, regs_end;
64 u32 mem_start, mem_end;
65 u32 irq_start, irq_end;
66 void *priv;
67 struct vlynq_regs *local;
68 struct vlynq_regs *remote;
69 struct device dev;
70 };
71
72 struct vlynq_driver {
73 char *name;
74 int (*probe)(struct vlynq_device *dev);
75 int (*remove)(struct vlynq_device *dev);
76 struct device_driver driver;
77 };
78
79 #define to_vlynq_driver(drv) container_of(drv, struct vlynq_driver, driver)
80
81 struct plat_vlynq_ops {
82 int (*on)(struct vlynq_device *dev);
83 void (*off)(struct vlynq_device *dev);
84 };
85
86 #define to_vlynq_device(device) container_of(device, struct vlynq_device, dev)
87
88 extern struct bus_type vlynq_bus_type;
89
90 extern int __vlynq_register_driver(struct vlynq_driver *driver,
91 struct module *owner);
92
93 static inline int vlynq_register_driver(struct vlynq_driver *driver)
94 {
95 return __vlynq_register_driver(driver, THIS_MODULE);
96 }
97
98 extern void vlynq_unregister_driver(struct vlynq_driver *driver);
99 extern int vlynq_device_enable(struct vlynq_device *dev);
100 extern void vlynq_device_disable(struct vlynq_device *dev);
101 extern u32 vlynq_remote_id(struct vlynq_device *dev);
102 extern void vlynq_set_local_mapping(struct vlynq_device *dev,
103 u32 tx_offset,
104 struct vlynq_mapping *mapping);
105 extern void vlynq_set_remote_mapping(struct vlynq_device *dev,
106 u32 tx_offset,
107 struct vlynq_mapping *mapping);
108 extern int vlynq_virq_to_irq(struct vlynq_device *dev, int virq);
109 extern int vlynq_irq_to_virq(struct vlynq_device *dev, int irq);
110 extern int vlynq_set_local_irq(struct vlynq_device *dev, int virq);
111 extern int vlynq_set_remote_irq(struct vlynq_device *dev, int virq);
112
113 #endif /* __VLYNQ_H__ */
This page took 0.056836 seconds and 3 git commands to generate.