writeback: split writeback_inodes_wb
[linux-2.6/next.git] / include / linux / superhyway.h
blob17ea468fa3621a9246a2e5717a99c94ca0b01ddc
1 /*
2 * include/linux/superhyway.h
4 * SuperHyway Bus definitions
6 * Copyright (C) 2004, 2005 Paul Mundt <lethal@linux-sh.org>
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.
12 #ifndef __LINUX_SUPERHYWAY_H
13 #define __LINUX_SUPERHYWAY_H
15 #include <linux/device.h>
18 * SuperHyway IDs
20 #define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183
22 struct superhyway_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 */
31 struct superhyway_ops {
32 int (*read_vcr)(unsigned long base, struct superhyway_vcr_info *vcr);
33 int (*write_vcr)(unsigned long base, struct superhyway_vcr_info vcr);
36 struct superhyway_bus {
37 struct superhyway_ops *ops;
40 extern struct superhyway_bus superhyway_channels[];
42 struct superhyway_device_id {
43 unsigned int id;
44 unsigned long driver_data;
47 struct superhyway_device;
48 extern struct bus_type superhyway_bus_type;
50 struct superhyway_driver {
51 char *name;
53 const struct superhyway_device_id *id_table;
54 struct device_driver drv;
56 int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id);
57 void (*remove)(struct superhyway_device *dev);
60 #define to_superhyway_driver(d) container_of((d), struct superhyway_driver, drv)
62 struct superhyway_device {
63 char name[32];
65 struct device dev;
67 struct superhyway_device_id id;
68 struct superhyway_driver *drv;
69 struct superhyway_bus *bus;
71 int num_resources;
72 struct resource *resource;
73 struct superhyway_vcr_info vcr;
76 #define to_superhyway_device(d) container_of((d), struct superhyway_device, dev)
78 #define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev)
79 #define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
81 static inline int
82 superhyway_read_vcr(struct superhyway_device *dev, unsigned long base,
83 struct superhyway_vcr_info *vcr)
85 return dev->bus->ops->read_vcr(base, vcr);
88 static inline int
89 superhyway_write_vcr(struct superhyway_device *dev, unsigned long base,
90 struct superhyway_vcr_info vcr)
92 return dev->bus->ops->write_vcr(base, vcr);
95 extern int superhyway_scan_bus(struct superhyway_bus *);
97 /* drivers/sh/superhyway/superhyway.c */
98 int superhyway_register_driver(struct superhyway_driver *);
99 void superhyway_unregister_driver(struct superhyway_driver *);
100 int superhyway_add_device(unsigned long base, struct superhyway_device *, struct superhyway_bus *);
101 int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices);
103 /* drivers/sh/superhyway/superhyway-sysfs.c */
104 extern struct device_attribute superhyway_dev_attrs[];
106 #endif /* __LINUX_SUPERHYWAY_H */