summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold2016-08-10 12:58:44 +0200
committerGreg Kroah-Hartman2016-08-11 14:13:07 +0200
commit6471c0039cd2fa92bb7df1262c57cb5190eb4311 (patch)
tree49132fb017e0d7ac3c11a423fabfa4cb3e56355f
parentgreybus: hd/es2: add cport_quiesce callback and ARPC (diff)
downloadkernel-qcow2-linux-6471c0039cd2fa92bb7df1262c57cb5190eb4311.tar.gz
kernel-qcow2-linux-6471c0039cd2fa92bb7df1262c57cb5190eb4311.tar.xz
kernel-qcow2-linux-6471c0039cd2fa92bb7df1262c57cb5190eb4311.zip
greybus: hd/es2: add cport_clear callback and ARPC
Add a host-device cport_clear callback, which will be called as part of the new connection tear-down sequence to reset the CPort state. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r--drivers/staging/greybus/arpc.h5
-rw-r--r--drivers/staging/greybus/es2.c19
-rw-r--r--drivers/staging/greybus/hd.h2
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/staging/greybus/arpc.h b/drivers/staging/greybus/arpc.h
index 9fb1608a35a0..6d277695e01d 100644
--- a/drivers/staging/greybus/arpc.h
+++ b/drivers/staging/greybus/arpc.h
@@ -79,6 +79,7 @@ struct arpc_response_message {
#define ARPC_TYPE_CPORT_RESET 0x00
#define ARPC_TYPE_CPORT_CONNECTED 0x01
#define ARPC_TYPE_CPORT_QUIESCE 0x02
+#define ARPC_TYPE_CPORT_CLEAR 0x03
struct arpc_cport_reset_req {
__le16 cport_id;
@@ -94,5 +95,9 @@ struct arpc_cport_quiesce_req {
__le16 timeout;
} __packed;
+struct arpc_cport_clear_req {
+ __le16 cport_id;
+} __packed;
+
#endif /* __ARPC_H */
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 42f248362b35..7f46f2a91833 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -794,6 +794,24 @@ static int es2_cport_quiesce(struct gb_host_device *hd, u16 cport_id,
return 0;
}
+static int es2_cport_clear(struct gb_host_device *hd, u16 cport_id)
+{
+ struct es2_ap_dev *es2 = hd_to_es2(hd);
+ struct device *dev = &es2->usb_dev->dev;
+ struct arpc_cport_clear_req req;
+ int ret;
+
+ req.cport_id = cpu_to_le16(cport_id);
+ ret = arpc_sync(es2, ARPC_TYPE_CPORT_CLEAR, &req, sizeof(req),
+ NULL, ES2_ARPC_CPORT_TIMEOUT);
+ if (ret) {
+ dev_err(dev, "failed to clear cport %u: %d\n", cport_id, ret);
+ return ret;
+ }
+
+ return 0;
+}
+
static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
@@ -980,6 +998,7 @@ static struct gb_hd_driver es2_driver = {
.cport_disable = cport_disable,
.cport_connected = es2_cport_connected,
.cport_quiesce = es2_cport_quiesce,
+ .cport_clear = es2_cport_clear,
.latency_tag_enable = latency_tag_enable,
.latency_tag_disable = latency_tag_disable,
.output = output,
diff --git a/drivers/staging/greybus/hd.h b/drivers/staging/greybus/hd.h
index feaba0171786..67f4f3c7a8e6 100644
--- a/drivers/staging/greybus/hd.h
+++ b/drivers/staging/greybus/hd.h
@@ -27,6 +27,8 @@ struct gb_hd_driver {
int (*cport_ping)(struct gb_host_device *hd, u16 cport_id);
int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id,
size_t peer_space, unsigned int timeout);
+ int (*cport_clear)(struct gb_host_device *hd, u16 cport_id);
+
int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id,
struct gb_message *message, gfp_t gfp_mask);
void (*message_cancel)(struct gb_message *message);