4 * Copyright 2014 Google Inc.
5 * Copyright 2014 Linaro Ltd.
7 * Released under the GPLv2 only.
10 #ifndef __CONNECTION_H
11 #define __CONNECTION_H
13 #include <linux/list.h>
15 enum gb_connection_state {
16 GB_CONNECTION_STATE_INVALID = 0,
17 GB_CONNECTION_STATE_DISABLED = 1,
18 GB_CONNECTION_STATE_ENABLED = 2,
19 GB_CONNECTION_STATE_ERROR = 3,
20 GB_CONNECTION_STATE_DESTROYING = 4,
23 struct gb_connection {
24 struct greybus_host_device *hd;
25 struct gb_bundle *bundle;
30 struct list_head hd_links;
31 struct list_head bundle_links;
33 struct gb_protocol *protocol;
41 enum gb_connection_state state;
42 struct list_head operations;
44 struct workqueue_struct *wq;
50 #define to_gb_connection(d) container_of(d, struct gb_connection, dev)
52 int svc_update_connection(struct gb_interface *intf,
53 struct gb_connection *connection);
54 struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
55 u16 cport_id, u8 protocol_id);
56 struct gb_connection *gb_connection_create_range(struct greybus_host_device *hd,
57 struct gb_bundle *bundle, struct device *parent,
58 u16 cport_id, u8 protocol_id, u32 ida_start,
60 void gb_connection_destroy(struct gb_connection *connection);
62 int gb_connection_init(struct gb_connection *connection);
63 void gb_connection_exit(struct gb_connection *connection);
64 void gb_hd_connections_exit(struct greybus_host_device *hd);
66 void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
67 u8 *data, size_t length);
69 void gb_connection_bind_protocol(struct gb_connection *connection);
71 #endif /* __CONNECTION_H */