summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Carlyle2016-05-11 10:08:55 -0700
committerJeffrey Carlyle2016-05-12 18:20:34 -0700
commit03fba180ae4cc3bad27bd792e53dbb7ed2a9f7e7 (patch)
treefebbbf5d9efc36ea5264c25a39a54b3224a035a7
parentc77bac08eca8b7dff3f76662cc8d439c111b8d0f (diff)
greybus: svc: support status in svc_intf_activate response
Update per Greybus spec. Status attribute added to activate response to return more detailed information about errors during activate. If the Greybus response is GB_OP_SUCCESS, the caller must also check the status attribute in the response to determine if any other errors occurred. Testing done: along with matchine firmware change, verified that modules were detected and enumerated as expected. Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r--drivers/staging/greybus/greybus_protocols.h19
-rw-r--r--drivers/staging/greybus/svc.c5
2 files changed, 24 insertions, 0 deletions
diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h
index c77fb25bbb48..ca5eb3b580aa 100644
--- a/drivers/staging/greybus/greybus_protocols.h
+++ b/drivers/staging/greybus/greybus_protocols.h
@@ -849,6 +849,24 @@ struct gb_spi_transfer_response {
#define GB_SVC_TYPE_INTF_ACTIVATE 0x27
#define GB_SVC_TYPE_INTF_MAILBOX_EVENT 0x29
+/* Greybus SVC protocol status values */
+#define GB_SVC_OP_SUCCESS 0x00
+#define GB_SVC_OP_UNKNOWN_ERROR 0x01
+#define GB_SVC_INTF_NOT_DETECTED 0x02
+#define GB_SVC_INTF_NO_UPRO_LINK 0x03
+#define GB_SVC_INTF_UPRO_NOT_DOWN 0x04
+#define GB_SVC_INTF_UPRO_NOT_HIBERNATED 0x05
+#define GB_SVC_INTF_NO_V_SYS 0x06
+#define GB_SVC_INTF_V_CHG 0x07
+#define GB_SVC_INTF_WAKE_BUSY 0x08
+#define GB_SVC_INTF_NO_REFCLK 0x09
+#define GB_SVC_INTF_RELEASING 0x0a
+#define GB_SVC_INTF_NO_ORDER 0x0b
+#define GB_SVC_INTF_MBOX_SET 0x0c
+#define GB_SVC_INTF_BAD_MBOX 0x0d
+#define GB_SVC_INTF_OP_TIMEOUT 0x0e
+#define GB_SVC_PWRMON_OP_NOT_PRESENT 0x0f
+
struct gb_svc_version_request {
__u8 major;
__u8 minor;
@@ -1133,6 +1151,7 @@ struct gb_svc_intf_activate_request {
#define GB_SVC_INTF_TYPE_GREYBUS 0x03
struct gb_svc_intf_activate_response {
+ __u8 status;
__u8 intf_type;
} __packed;
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
index a98593c0a39b..3bdf778d6d5d 100644
--- a/drivers/staging/greybus/svc.c
+++ b/drivers/staging/greybus/svc.c
@@ -340,6 +340,11 @@ int gb_svc_intf_activate(struct gb_svc *svc, u8 intf_id, u8 *intf_type)
SVC_INTF_ACTIVATE_TIMEOUT);
if (ret < 0)
return ret;
+ if (response.status != GB_SVC_OP_SUCCESS) {
+ dev_err(&svc->dev, "failed to activate interface %u: %u\n",
+ intf_id, response.status);
+ return -EREMOTEIO;
+ }
*intf_type = response.intf_type;