Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
6471c003 0e7cd0d2

+26
+5
drivers/staging/greybus/arpc.h
··· 79 79 #define ARPC_TYPE_CPORT_RESET 0x00 80 80 #define ARPC_TYPE_CPORT_CONNECTED 0x01 81 81 #define ARPC_TYPE_CPORT_QUIESCE 0x02 82 + #define ARPC_TYPE_CPORT_CLEAR 0x03 82 83 83 84 struct arpc_cport_reset_req { 84 85 __le16 cport_id; ··· 93 92 __le16 cport_id; 94 93 __le16 peer_space; 95 94 __le16 timeout; 95 + } __packed; 96 + 97 + struct arpc_cport_clear_req { 98 + __le16 cport_id; 96 99 } __packed; 97 100 98 101
+19
drivers/staging/greybus/es2.c
··· 794 794 return 0; 795 795 } 796 796 797 + static int es2_cport_clear(struct gb_host_device *hd, u16 cport_id) 798 + { 799 + struct es2_ap_dev *es2 = hd_to_es2(hd); 800 + struct device *dev = &es2->usb_dev->dev; 801 + struct arpc_cport_clear_req req; 802 + int ret; 803 + 804 + req.cport_id = cpu_to_le16(cport_id); 805 + ret = arpc_sync(es2, ARPC_TYPE_CPORT_CLEAR, &req, sizeof(req), 806 + NULL, ES2_ARPC_CPORT_TIMEOUT); 807 + if (ret) { 808 + dev_err(dev, "failed to clear cport %u: %d\n", cport_id, ret); 809 + return ret; 810 + } 811 + 812 + return 0; 813 + } 814 + 797 815 static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id) 798 816 { 799 817 int retval; ··· 998 980 .cport_disable = cport_disable, 999 981 .cport_connected = es2_cport_connected, 1000 982 .cport_quiesce = es2_cport_quiesce, 983 + .cport_clear = es2_cport_clear, 1001 984 .latency_tag_enable = latency_tag_enable, 1002 985 .latency_tag_disable = latency_tag_disable, 1003 986 .output = output,
+2
drivers/staging/greybus/hd.h
··· 27 27 int (*cport_ping)(struct gb_host_device *hd, u16 cport_id); 28 28 int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id, 29 29 size_t peer_space, unsigned int timeout); 30 + int (*cport_clear)(struct gb_host_device *hd, u16 cport_id); 31 + 30 32 int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id, 31 33 struct gb_message *message, gfp_t gfp_mask); 32 34 void (*message_cancel)(struct gb_message *message);