greybus: svc: add route create operation
authorPerry Hung <perry@leaflabs.com>
Fri, 24 Jul 2015 23:02:31 +0000 (19:02 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 27 Jul 2015 21:13:00 +0000 (14:13 -0700)
Implement the SVC Protocol Route Create Operation.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/svc.c

index 9708e934242fde57bbb48462abd872f5566f92cf..5b97073f410039874253afca3d036dbd9a8bbd7b 100644 (file)
@@ -563,6 +563,7 @@ struct gb_spi_transfer_response {
 #define GB_SVC_TYPE_INTF_RESET         0x06
 #define GB_SVC_TYPE_CONN_CREATE                0x07
 #define GB_SVC_TYPE_CONN_DESTROY       0x08
+#define GB_SVC_TYPE_ROUTE_CREATE       0x0b
 
 /* SVC version request/response have same payload as gb_protocol_version_response */
 
@@ -616,6 +617,13 @@ struct gb_svc_conn_destroy_request {
 };
 /* connection destroy response has no payload */
 
+struct gb_svc_route_create_request {
+       __u8    intf1_id;
+       __u8    dev1_id;
+       __u8    intf2_id;
+       __u8    dev2_id;
+};
+
 /* UART */
 
 /* Version of the Greybus UART protocol we support */
index 5f2b2b43b939cd0bd1565ca2441ec3764b0caaaa..f3321296db8a711516e286aff64f67ecd4c13008 100644 (file)
@@ -118,6 +118,20 @@ static int connection_destroy_operation(struct gb_svc *svc,
                                 &request, sizeof(request), NULL, 0);
 }
 
+static int route_create_operation(struct gb_svc *svc, u8 intf1_id, u8 dev1_id,
+                                 u8 intf2_id, u8 dev2_id)
+{
+       struct gb_svc_route_create_request request;
+
+       request.intf1_id = intf1_id;
+       request.dev1_id = dev1_id;
+       request.intf2_id = intf2_id;
+       request.dev2_id = dev2_id;
+
+       return gb_operation_sync(svc->connection, GB_SVC_TYPE_ROUTE_CREATE,
+                                &request, sizeof(request), NULL, 0);
+}
+
 int gb_svc_intf_device_id(struct gb_svc *svc, u8 intf_id, u8 device_id)
 {
        return intf_device_id_operation(svc, intf_id, device_id);
@@ -148,6 +162,13 @@ int gb_svc_connection_destroy(struct gb_svc *svc,
 }
 EXPORT_SYMBOL_GPL(gb_svc_connection_destroy);
 
+int gb_svc_route_create(struct gb_svc *svc, u8 intf1_id, u8 dev1_id,
+                       u8 intf2_id, u8 dev2_id) {
+       return route_create_operation(svc, intf1_id, dev1_id,
+                                     intf2_id, dev2_id);
+}
+EXPORT_SYMBOL_GPL(gb_svc_route_create);
+
 static int gb_svc_version_request(struct gb_operation *op)
 {
        struct gb_connection *connection = op->connection;