]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: svc: implement connection_quiescing call
authorJeffrey Carlyle <jcarlyle@google.com>
Tue, 7 Jun 2016 15:22:22 +0000 (08:22 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 8 Jun 2016 04:10:13 +0000 (21:10 -0700)
Implement Greybus remote call to connection_quiescing operation. This
operation disables flow contorl for the connection and resets associated
attributes.

Testing done: tested along with required NuttX firmware changes, booted
EVT2, inserted module, removed module, inserted module. Verified module
was functioning as expected.

Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/svc.c

index 82075c703f333762c98b7f7415e3f0aefe6391c4..8125fb7140d84f94ea0a24c82938a052e7a4773d 100644 (file)
@@ -904,6 +904,7 @@ struct gb_spi_transfer_response {
 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_ACQUIRE 0x18
 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_RELEASE 0x19
 #define GB_SVC_TYPE_TIMESYNC_PING              0x1a
+#define GB_SVC_TYPE_CONN_QUIESCING             0x1e
 #define GB_SVC_TYPE_MODULE_INSERTED            0x1f
 #define GB_SVC_TYPE_MODULE_REMOVED             0x20
 #define GB_SVC_TYPE_INTF_VSYS_ENABLE           0x21
@@ -1215,6 +1216,17 @@ struct gb_svc_intf_mailbox_event_request {
 } __packed;
 /* intf_mailbox_event response has no payload */
 
+struct gb_svc_conn_quiescing_request {
+       __u8    intf1_id;
+       __le16  cport1_id;
+       __u8    intf2_id;
+       __le16  cport2_id;
+} __packed;
+
+struct gb_svc_conn_quiescing_response {
+       __u8    status;
+} __packed;
+
 
 /* RAW */
 
index d7458c53b889454c7d8f978ed0f56674ac2e1b62..bfdd0ce376238fd0db09009f266b79c571ff68bb 100644 (file)
@@ -441,10 +441,31 @@ EXPORT_SYMBOL_GPL(gb_svc_connection_create);
 void gb_svc_connection_quiescing(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
                                        u8 intf2_id, u16 cport2_id)
 {
-       /* FIXME: implement */
+       struct gb_svc_conn_quiescing_request request;
+       struct gb_svc_conn_quiescing_response response;
+       int ret;
 
        dev_dbg(&svc->dev, "%s - (%u:%u %u:%u)\n", __func__,
                                intf1_id, cport1_id, intf2_id, cport2_id);
+
+       request.intf1_id = intf1_id;
+       request.cport1_id = cpu_to_le16(cport1_id);
+       request.intf2_id = intf2_id;
+       request.cport2_id = cpu_to_le16(cport2_id);
+
+       ret = gb_operation_sync(svc->connection, GB_SVC_TYPE_CONN_QUIESCING,
+                                &request, sizeof(request),
+                                &response, sizeof(response));
+       if (ret < 0)
+               return;
+       if (response.status != GB_SVC_OP_SUCCESS) {
+               dev_err(&svc->dev, "quiescing connection failed (%u:%u %u:%u): %u\n",
+                               intf1_id, cport1_id, intf2_id, cport2_id,
+                               response.status);
+               return;
+       }
+
+       return;
 }
 EXPORT_SYMBOL_GPL(gb_svc_connection_quiescing);