Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / include / linux / superhyway.h
1 /*
2  * include/linux/superhyway.h
3  *
4  * SuperHyway Bus definitions
5  *
6  * Copyright (C) 2004, 2005  Paul Mundt <lethal@linux-sh.org>
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  */
12 #ifndef __LINUX_SUPERHYWAY_H
13 #define __LINUX_SUPERHYWAY_H
14
15 #include <linux/device.h>
16
17 /*
18  * SuperHyway IDs
19  */
20 #define SUPERHYWAY_DEVICE_ID_SH5_DMAC   0x0183
21
22 struct vcr_info {
23         u8      perr_flags;     /* P-port Error flags */
24         u8      merr_flags;     /* Module Error flags */
25         u16     mod_vers;       /* Module Version */
26         u16     mod_id;         /* Module ID */
27         u8      bot_mb;         /* Bottom Memory block */
28         u8      top_mb;         /* Top Memory block */
29 };
30
31 struct superhyway_device_id {
32         unsigned int id;
33         unsigned long driver_data;
34 };
35
36 struct superhyway_device;
37 extern struct bus_type superhyway_bus_type;
38
39 struct superhyway_driver {
40         char *name;
41
42         const struct superhyway_device_id *id_table;
43         struct device_driver drv;
44
45         int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id);
46         void (*remove)(struct superhyway_device *dev);
47 };
48
49 #define to_superhyway_driver(d) container_of((d), struct superhyway_driver, drv)
50
51 struct superhyway_device {
52         char name[32];
53
54         struct device dev;
55
56         struct superhyway_device_id id;
57         struct superhyway_driver *drv;
58
59         struct resource resource;
60         struct vcr_info vcr;
61 };
62
63 #define to_superhyway_device(d) container_of((d), struct superhyway_device, dev)
64
65 #define superhyway_get_drvdata(d)       dev_get_drvdata(&(d)->dev)
66 #define superhyway_set_drvdata(d,p)     dev_set_drvdata(&(d)->dev, (p))
67
68 extern int superhyway_scan_bus(void);
69
70 /* drivers/sh/superhyway/superhyway.c */
71 int superhyway_register_driver(struct superhyway_driver *);
72 void superhyway_unregister_driver(struct superhyway_driver *);
73 int superhyway_add_device(unsigned int, unsigned long, unsigned long long);
74
75 /* drivers/sh/superhyway/superhyway-sysfs.c */
76 extern struct device_attribute superhyway_dev_attrs[];
77
78 #endif /* __LINUX_SUPERHYWAY_H */
79