2014-10-01 20:54:14 -06:00
|
|
|
/*
|
|
|
|
* Greybus connections
|
|
|
|
*
|
|
|
|
* Copyright 2014 Google Inc.
|
2014-12-12 11:08:42 -07:00
|
|
|
* Copyright 2014 Linaro Ltd.
|
2014-10-01 20:54:14 -06:00
|
|
|
*
|
|
|
|
* Released under the GPLv2 only.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CONNECTION_H
|
|
|
|
#define __CONNECTION_H
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
2014-10-22 01:04:30 -06:00
|
|
|
enum gb_connection_state {
|
|
|
|
GB_CONNECTION_STATE_INVALID = 0,
|
|
|
|
GB_CONNECTION_STATE_DISABLED = 1,
|
|
|
|
GB_CONNECTION_STATE_ENABLED = 2,
|
|
|
|
GB_CONNECTION_STATE_ERROR = 3,
|
|
|
|
GB_CONNECTION_STATE_DESTROYING = 4,
|
|
|
|
};
|
|
|
|
|
2014-10-01 20:54:14 -06:00
|
|
|
struct gb_connection {
|
|
|
|
struct greybus_host_device *hd;
|
2014-12-12 15:10:17 -07:00
|
|
|
struct gb_bundle *bundle;
|
2014-10-24 03:34:46 -06:00
|
|
|
struct device dev;
|
2014-10-02 11:30:05 -06:00
|
|
|
u16 hd_cport_id;
|
2015-06-03 22:48:01 -06:00
|
|
|
u16 intf_cport_id;
|
2014-10-01 20:54:14 -06:00
|
|
|
|
2014-11-17 07:08:44 -07:00
|
|
|
struct list_head hd_links;
|
2014-12-12 15:10:17 -07:00
|
|
|
struct list_head bundle_links;
|
2014-10-28 18:36:00 -06:00
|
|
|
|
|
|
|
struct gb_protocol *protocol;
|
2014-12-23 16:16:53 -07:00
|
|
|
u8 protocol_id;
|
|
|
|
u8 major;
|
|
|
|
u8 minor;
|
2014-10-28 18:35:59 -06:00
|
|
|
|
2014-10-22 01:04:30 -06:00
|
|
|
enum gb_connection_state state;
|
2014-10-01 20:54:15 -06:00
|
|
|
|
2014-12-03 07:35:08 -07:00
|
|
|
atomic_t op_cycle;
|
2014-10-01 20:54:15 -06:00
|
|
|
struct list_head operations;
|
2014-10-03 14:05:21 -06:00
|
|
|
|
|
|
|
void *private;
|
2014-10-01 20:54:14 -06:00
|
|
|
};
|
2014-10-24 03:34:46 -06:00
|
|
|
#define to_gb_connection(d) container_of(d, struct gb_connection, dev)
|
2014-10-01 20:54:14 -06:00
|
|
|
|
2014-12-12 15:10:17 -07:00
|
|
|
struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
|
2014-10-28 18:35:59 -06:00
|
|
|
u16 cport_id, u8 protocol_id);
|
2014-10-02 11:30:01 -06:00
|
|
|
void gb_connection_destroy(struct gb_connection *connection);
|
2014-10-01 20:54:14 -06:00
|
|
|
|
2014-10-16 05:35:35 -06:00
|
|
|
int gb_connection_init(struct gb_connection *connection);
|
2014-10-20 22:01:04 -06:00
|
|
|
void gb_connection_exit(struct gb_connection *connection);
|
2015-07-08 23:26:30 -06:00
|
|
|
void gb_hd_connections_exit(struct greybus_host_device *hd);
|
2014-10-16 05:35:35 -06:00
|
|
|
|
2014-11-20 15:09:18 -07:00
|
|
|
void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
|
2014-11-17 17:08:37 -07:00
|
|
|
u8 *data, size_t length);
|
2014-10-03 14:05:22 -06:00
|
|
|
|
2014-12-23 16:16:53 -07:00
|
|
|
void gb_connection_bind_protocol(struct gb_connection *connection);
|
|
|
|
|
2014-10-01 20:54:14 -06:00
|
|
|
#endif /* __CONNECTION_H */
|