4 * Copyright 2014-2015 Google Inc.
5 * Copyright 2014-2015 Linaro Ltd.
7 * Released under the GPLv2 only.
13 struct gb_host_device;
19 int (*cport_allocate)(struct gb_host_device *hd, int cport_id,
21 void (*cport_release)(struct gb_host_device *hd, u16 cport_id);
22 int (*cport_enable)(struct gb_host_device *hd, u16 cport_id,
24 int (*cport_disable)(struct gb_host_device *hd, u16 cport_id);
25 int (*cport_connected)(struct gb_host_device *hd, u16 cport_id);
26 int (*cport_flush)(struct gb_host_device *hd, u16 cport_id);
27 int (*cport_ping)(struct gb_host_device *hd, u16 cport_id);
28 int (*cport_shutdown)(struct gb_host_device *hd, u16 cport_id,
29 u8 phase, unsigned int timeout);
30 int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id,
31 size_t peer_space, unsigned int timeout);
32 int (*cport_clear)(struct gb_host_device *hd, u16 cport_id);
34 int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id,
35 struct gb_message *message, gfp_t gfp_mask);
36 void (*message_cancel)(struct gb_message *message);
37 int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
38 int (*latency_tag_disable)(struct gb_host_device *hd, u16 cport_id);
39 int (*output)(struct gb_host_device *hd, void *req, u16 size, u8 cmd,
41 int (*cport_features_enable)(struct gb_host_device *hd, u16 cport_id);
42 int (*cport_features_disable)(struct gb_host_device *hd, u16 cport_id);
43 int (*timesync_enable)(struct gb_host_device *hd, u8 count,
44 u64 frame_time, u32 strobe_delay, u32 refclk);
45 int (*timesync_disable)(struct gb_host_device *hd);
46 int (*timesync_authoritative)(struct gb_host_device *hd,
48 int (*timesync_get_last_event)(struct gb_host_device *hd,
52 struct gb_host_device {
55 const struct gb_hd_driver *driver;
57 struct list_head modules;
58 struct list_head connections;
59 struct ida cport_id_map;
61 /* Number of CPorts supported by the UniPro IP */
64 /* Host device buffer constraints */
65 size_t buffer_size_max;
68 /* Private data for the host driver */
69 unsigned long hd_priv[0] __aligned(sizeof(s64));
71 #define to_gb_host_device(d) container_of(d, struct gb_host_device, dev)
73 int gb_hd_cport_reserve(struct gb_host_device *hd, u16 cport_id);
74 void gb_hd_cport_release_reserved(struct gb_host_device *hd, u16 cport_id);
75 int gb_hd_cport_allocate(struct gb_host_device *hd, int cport_id,
77 void gb_hd_cport_release(struct gb_host_device *hd, u16 cport_id);
79 struct gb_host_device *gb_hd_create(struct gb_hd_driver *driver,
80 struct device *parent,
81 size_t buffer_size_max,
83 int gb_hd_add(struct gb_host_device *hd);
84 void gb_hd_del(struct gb_host_device *hd);
85 void gb_hd_shutdown(struct gb_host_device *hd);
86 void gb_hd_put(struct gb_host_device *hd);
87 int gb_hd_output(struct gb_host_device *hd, void *req, u16 size, u8 cmd,
91 void gb_hd_exit(void);