greybus: hd: fix svc-connection handling
[linux-block.git] / drivers / staging / greybus / svc.h
1 /*
2  * Greybus SVC code
3  *
4  * Copyright 2015 Google Inc.
5  * Copyright 2015 Linaro Ltd.
6  *
7  * Released under the GPLv2 only.
8  */
9
10 #ifndef __SVC_H
11 #define __SVC_H
12
13 enum gb_svc_state {
14         GB_SVC_STATE_RESET,
15         GB_SVC_STATE_PROTOCOL_VERSION,
16         GB_SVC_STATE_SVC_HELLO,
17 };
18
19 struct gb_svc {
20         struct device           dev;
21
22         struct gb_connection    *connection;
23         enum gb_svc_state       state;
24         struct ida              device_id_map;
25
26         u16 endo_id;
27         u8 ap_intf_id;
28 };
29 #define to_gb_svc(d) container_of(d, struct gb_svc, d)
30
31 int gb_svc_intf_reset(struct gb_svc *svc, u8 intf_id);
32 int gb_svc_connection_create(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
33                              u8 intf2_id, u16 cport2_id, bool boot_over_unipro);
34 void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
35                                u8 intf2_id, u16 cport2_id);
36 int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
37                         u32 *value);
38 int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
39                         u32 value);
40
41 int gb_svc_protocol_init(void);
42 void gb_svc_protocol_exit(void);
43
44 #endif /* __SVC_H */