blob: 3f1d19eb35f303d15eacddf2e17243820b126625 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* Greybus GPBridge phy driver
*
* Copyright 2016 Google Inc.
*
* Released under the GPLv2 only.
*/
#ifndef __GPBRIDGE_H
#define __GPBRIDGE_H
struct gpbridge_device {
u32 id;
struct greybus_descriptor_cport *cport_desc;
struct gb_bundle *bundle;
struct list_head list;
struct device dev;
};
#define to_gpbridge_dev(d) container_of(d, struct gpbridge_device, dev)
static inline void *gb_gpbridge_get_data(struct gpbridge_device *gdev)
{
return dev_get_drvdata(&gdev->dev);
}
static inline void gb_gpbridge_set_data(struct gpbridge_device *gdev, void *data)
{
dev_set_drvdata(&gdev->dev, data);
}
struct gpbridge_device_id {
__u8 protocol_id;
};
#define GPBRIDGE_PROTOCOL(p) \
.protocol_id = (p),
struct gpbridge_driver {
const char *name;
int (*probe)(struct gpbridge_device *,
const struct gpbridge_device_id *id);
void (*remove)(struct gpbridge_device *);
const struct gpbridge_device_id *id_table;
struct device_driver driver;
};
#define to_gpbridge_driver(d) container_of(d, struct gpbridge_driver, driver)
int gb_gpbridge_get_version(struct gb_connection *connection);
int gb_gpbridge_register_driver(struct gpbridge_driver *driver,
struct module *owner, const char *mod_name);
void gb_gpbridge_deregister_driver(struct gpbridge_driver *driver);
#define gb_gpbridge_register(driver) \
gb_gpbridge_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
#define gb_gpbridge_deregister(driver) \
gb_gpbridge_deregister_driver(driver)
#define gb_gpbridge_builtin_driver(__driver) \
int __init gb_##__driver##_init(void) \
{ \
return gb_gpbridge_register(&__driver); \
} \
void gb_##__driver##_exit(void) \
{ \
gb_gpbridge_deregister(&__driver); \
}
extern int gb_gpio_driver_init(void);
extern void gb_gpio_driver_exit(void);
extern int gb_pwm_driver_init(void);
extern void gb_pwm_driver_exit(void);
extern int gb_uart_driver_init(void);
extern void gb_uart_driver_exit(void);
extern int gb_sdio_driver_init(void);
extern void gb_sdio_driver_exit(void);
extern int gb_usb_protocol_init(void);
extern void gb_usb_protocol_exit(void);
extern int gb_i2c_driver_init(void);
extern void gb_i2c_driver_exit(void);
extern int gb_spi_protocol_init(void);
extern void gb_spi_protocol_exit(void);
#endif /* __GPBRIDGE_H */
|