Commit a2cf2e59 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: svc: define the version request

Define the SVC version request, which need not need to stay the same as
the legacy version request.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent b1f8bfea
...@@ -781,6 +781,7 @@ struct gb_spi_transfer_response { ...@@ -781,6 +781,7 @@ struct gb_spi_transfer_response {
#define GB_SVC_VERSION_MINOR 0x01 #define GB_SVC_VERSION_MINOR 0x01
/* Greybus SVC request types */ /* Greybus SVC request types */
#define GB_SVC_TYPE_PROTOCOL_VERSION 0x01
#define GB_SVC_TYPE_SVC_HELLO 0x02 #define GB_SVC_TYPE_SVC_HELLO 0x02
#define GB_SVC_TYPE_INTF_DEVICE_ID 0x03 #define GB_SVC_TYPE_INTF_DEVICE_ID 0x03
#define GB_SVC_TYPE_INTF_HOTPLUG 0x04 #define GB_SVC_TYPE_INTF_HOTPLUG 0x04
...@@ -808,10 +809,15 @@ struct gb_spi_transfer_response { ...@@ -808,10 +809,15 @@ struct gb_spi_transfer_response {
#define GB_SVC_TYPE_INTF_ACTIVATE 0x27 #define GB_SVC_TYPE_INTF_ACTIVATE 0x27
#define GB_SVC_TYPE_INTF_MAILBOX_EVENT 0x29 #define GB_SVC_TYPE_INTF_MAILBOX_EVENT 0x29
/* struct gb_svc_version_request {
* SVC version request/response has the same payload as __u8 major;
* gb_protocol_version_request/response. __u8 minor;
*/ } __packed;
struct gb_svc_version_response {
__u8 major;
__u8 minor;
} __packed;
/* SVC protocol hello request */ /* SVC protocol hello request */
struct gb_svc_hello_request { struct gb_svc_hello_request {
......
...@@ -465,8 +465,8 @@ static int gb_svc_version_request(struct gb_operation *op) ...@@ -465,8 +465,8 @@ static int gb_svc_version_request(struct gb_operation *op)
{ {
struct gb_connection *connection = op->connection; struct gb_connection *connection = op->connection;
struct gb_svc *svc = gb_connection_get_data(connection); struct gb_svc *svc = gb_connection_get_data(connection);
struct gb_protocol_version_request *request; struct gb_svc_version_request *request;
struct gb_protocol_version_response *response; struct gb_svc_version_response *response;
if (op->request->payload_size < sizeof(*request)) { if (op->request->payload_size < sizeof(*request)) {
dev_err(&svc->dev, "short version request (%zu < %zu)\n", dev_err(&svc->dev, "short version request (%zu < %zu)\n",
...@@ -1192,7 +1192,7 @@ static int gb_svc_request_handler(struct gb_operation *op) ...@@ -1192,7 +1192,7 @@ static int gb_svc_request_handler(struct gb_operation *op)
* need to protect 'state' for any races. * need to protect 'state' for any races.
*/ */
switch (type) { switch (type) {
case GB_REQUEST_TYPE_PROTOCOL_VERSION: case GB_SVC_TYPE_PROTOCOL_VERSION:
if (svc->state != GB_SVC_STATE_RESET) if (svc->state != GB_SVC_STATE_RESET)
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -1213,7 +1213,7 @@ static int gb_svc_request_handler(struct gb_operation *op) ...@@ -1213,7 +1213,7 @@ static int gb_svc_request_handler(struct gb_operation *op)
} }
switch (type) { switch (type) {
case GB_REQUEST_TYPE_PROTOCOL_VERSION: case GB_SVC_TYPE_PROTOCOL_VERSION:
ret = gb_svc_version_request(op); ret = gb_svc_version_request(op);
if (!ret) if (!ret)
svc->state = GB_SVC_STATE_PROTOCOL_VERSION; svc->state = GB_SVC_STATE_PROTOCOL_VERSION;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment