summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/greybus_protocols.h
diff options
context:
space:
mode:
authorAlexandre Bailon <abailon@baylibre.com>2016-07-07 07:41:00 -0500
committerAlex Elder <elder@linaro.org>2016-07-11 15:54:17 -0500
commitc14118a8411c4d7ad1dd6dd501beb33ae1268b08 (patch)
tree13e1d5d7c583f3419bf3c9e790ba416d299d6792 /drivers/staging/greybus/greybus_protocols.h
parent9d9d3777a9db5c0773d270e51b65c1252856d95e (diff)
greybus: es2: Implement APBridgeA RPC (ARPC)
Implement ARPC. In first time, we are going to use it to implement new request but the goal is to update all existing vendor request to use ARPC. In addition, Convert the current USB Vendor request for CPort Reset to ARPC so that we can be sure that the port has been fully reset by the time the request completes. Testing Done: AP can reset APBA Cports by using the ARPC command. In addition, tested with a hacked firmware that cause error during the Cport reset, and Greybus printed the error "failed to reset cport". Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging/greybus/greybus_protocols.h')
-rw-r--r--drivers/staging/greybus/greybus_protocols.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h
index 1a12531944e9..e9f3d2cfd973 100644
--- a/drivers/staging/greybus/greybus_protocols.h
+++ b/drivers/staging/greybus/greybus_protocols.h
@@ -268,12 +268,44 @@ struct gb_control_intf_pm_response {
/* requests to set Greybus CPort flags */
#define GB_APB_REQUEST_CPORT_FLAGS 0x11
+/* ARPC command */
+#define APBA_REQUEST_ARPC_RUN 0x12
+
struct gb_apb_request_cport_flags {
u32 flags;
#define GB_APB_CPORT_FLAG_CONTROL 0x01
#define GB_APB_CPORT_FLAG_HIGH_PRIO 0x02
} __packed;
+/* APBridgeA RPC (ARPC) */
+
+enum arpc_result {
+ ARPC_SUCCESS = 0x00,
+ ARPC_NO_MEMORY = 0x01,
+ ARPC_INVALID = 0x02,
+ ARPC_TIMEOUT = 0x03,
+ ARPC_UNKNOWN_ERROR = 0xff,
+};
+
+/* ARPC request */
+struct arpc_request_message {
+ __le16 id; /* RPC unique id */
+ __le16 size; /* Size in bytes of header + payload */
+ __u8 type; /* RPC type */
+ __u8 data[0]; /* ARPC data */
+} __packed;
+
+/* ARPC response */
+struct arpc_response_message {
+ __le16 id; /* RPC unique id */
+ __u8 result; /* Result of RPC */
+} __packed;
+
+#define ARPC_CPORT_RESET 0x00
+
+struct arpc_cport_reset {
+ __le16 cport_id;
+} __packed;
/* Firmware Download Protocol */