greybus: svc: add route create operation

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>
This commit is contained in:
Perry Hung 2015-07-24 19:02:31 -04:00 committed by Greg Kroah-Hartman
parent 0af7268882
commit 4de9b5679a
2 changed files with 29 additions and 0 deletions

View 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 */

View 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;