0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __LINUX_SUPERHYWAY_H
0013 #define __LINUX_SUPERHYWAY_H
0014
0015 #include <linux/device.h>
0016
0017
0018
0019
0020 #define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183
0021
0022 struct superhyway_vcr_info {
0023 u8 perr_flags;
0024 u8 merr_flags;
0025 u16 mod_vers;
0026 u16 mod_id;
0027 u8 bot_mb;
0028 u8 top_mb;
0029 };
0030
0031 struct superhyway_ops {
0032 int (*read_vcr)(unsigned long base, struct superhyway_vcr_info *vcr);
0033 int (*write_vcr)(unsigned long base, struct superhyway_vcr_info vcr);
0034 };
0035
0036 struct superhyway_bus {
0037 struct superhyway_ops *ops;
0038 };
0039
0040 extern struct superhyway_bus superhyway_channels[];
0041
0042 struct superhyway_device_id {
0043 unsigned int id;
0044 unsigned long driver_data;
0045 };
0046
0047 struct superhyway_device;
0048 extern struct bus_type superhyway_bus_type;
0049
0050 struct superhyway_driver {
0051 char *name;
0052
0053 const struct superhyway_device_id *id_table;
0054 struct device_driver drv;
0055
0056 int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id);
0057 void (*remove)(struct superhyway_device *dev);
0058 };
0059
0060 #define to_superhyway_driver(d) container_of((d), struct superhyway_driver, drv)
0061
0062 struct superhyway_device {
0063 char name[32];
0064
0065 struct device dev;
0066
0067 struct superhyway_device_id id;
0068 struct superhyway_driver *drv;
0069 struct superhyway_bus *bus;
0070
0071 int num_resources;
0072 struct resource *resource;
0073 struct superhyway_vcr_info vcr;
0074 };
0075
0076 #define to_superhyway_device(d) container_of((d), struct superhyway_device, dev)
0077
0078 #define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev)
0079 #define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
0080
0081 static inline int
0082 superhyway_read_vcr(struct superhyway_device *dev, unsigned long base,
0083 struct superhyway_vcr_info *vcr)
0084 {
0085 return dev->bus->ops->read_vcr(base, vcr);
0086 }
0087
0088 static inline int
0089 superhyway_write_vcr(struct superhyway_device *dev, unsigned long base,
0090 struct superhyway_vcr_info vcr)
0091 {
0092 return dev->bus->ops->write_vcr(base, vcr);
0093 }
0094
0095 extern int superhyway_scan_bus(struct superhyway_bus *);
0096
0097
0098 int superhyway_register_driver(struct superhyway_driver *);
0099 void superhyway_unregister_driver(struct superhyway_driver *);
0100 int superhyway_add_device(unsigned long base, struct superhyway_device *, struct superhyway_bus *);
0101 int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices);
0102
0103
0104 extern const struct attribute_group *superhyway_dev_groups[];
0105
0106 #endif
0107