]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/superhyway.h
rhashtable: Mark internal/private inline functions as such
[mirror_ubuntu-bionic-kernel.git] / include / linux / superhyway.h
CommitLineData
1da177e4
LT
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
055a2512 22struct superhyway_vcr_info {
1da177e4
LT
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
055a2512
PM
31struct 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);
34};
35
36struct superhyway_bus {
37 struct superhyway_ops *ops;
38};
39
40extern struct superhyway_bus superhyway_channels[];
41
1da177e4
LT
42struct superhyway_device_id {
43 unsigned int id;
44 unsigned long driver_data;
45};
46
47struct superhyway_device;
48extern struct bus_type superhyway_bus_type;
49
50struct superhyway_driver {
51 char *name;
52
53 const struct superhyway_device_id *id_table;
54 struct device_driver drv;
55
56 int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id);
57 void (*remove)(struct superhyway_device *dev);
58};
59
60#define to_superhyway_driver(d) container_of((d), struct superhyway_driver, drv)
61
62struct superhyway_device {
63 char name[32];
64
65 struct device dev;
66
67 struct superhyway_device_id id;
68 struct superhyway_driver *drv;
055a2512 69 struct superhyway_bus *bus;
1da177e4 70
055a2512
PM
71 int num_resources;
72 struct resource *resource;
73 struct superhyway_vcr_info vcr;
1da177e4
LT
74};
75
76#define to_superhyway_device(d) container_of((d), struct superhyway_device, dev)
77
78#define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev)
79#define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
80
055a2512
PM
81static inline int
82superhyway_read_vcr(struct superhyway_device *dev, unsigned long base,
83 struct superhyway_vcr_info *vcr)
84{
85 return dev->bus->ops->read_vcr(base, vcr);
86}
87
88static inline int
89superhyway_write_vcr(struct superhyway_device *dev, unsigned long base,
90 struct superhyway_vcr_info vcr)
91{
92 return dev->bus->ops->write_vcr(base, vcr);
93}
94
95extern int superhyway_scan_bus(struct superhyway_bus *);
1da177e4
LT
96
97/* drivers/sh/superhyway/superhyway.c */
98int superhyway_register_driver(struct superhyway_driver *);
99void superhyway_unregister_driver(struct superhyway_driver *);
055a2512
PM
100int superhyway_add_device(unsigned long base, struct superhyway_device *, struct superhyway_bus *);
101int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices);
1da177e4
LT
102
103/* drivers/sh/superhyway/superhyway-sysfs.c */
104extern struct device_attribute superhyway_dev_attrs[];
105
106#endif /* __LINUX_SUPERHYWAY_H */
107