aboutsummaryrefslogtreecommitdiff
path: root/src/ec/google/wilco/ec.h
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2018-10-15 02:00:39 +0000
committerDuncan Laurie <dlaurie@chromium.org>2018-10-31 18:29:00 +0000
commit21dde8b25f610c02a8c71341a6579e9f850b690b (patch)
tree04e4d427411a4a0f0ccc58119ffb5e404ca6614f /src/ec/google/wilco/ec.h
parent370123e1a3cd3992ba4fb21813d3b96f6ce0376d (diff)
ec/google/wilco: Add Wilco EC mailbox interface
The Google "Wilco" Embedded Controller is a new embedded controller that will be used in some future devices. The mailbox interface is simliar to the existing Chromium EC protocol version 3, but not close enough that it was convenient to re-use the full Chrome EC driver. This commit adds the basic mailbox interface for ramstage which will be used by future commits to send varous mailbox commands during the boot process. The IO base addresses for the mailbox interface are defined in Kconfig so they can be changed by the mainboard if needed. Change-Id: I8520dadfa982c9d14357cf2aa644e255cef425c2 Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/29113 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/ec/google/wilco/ec.h')
-rw-r--r--src/ec/google/wilco/ec.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/ec/google/wilco/ec.h b/src/ec/google/wilco/ec.h
new file mode 100644
index 0000000000..0ce6166322
--- /dev/null
+++ b/src/ec/google/wilco/ec.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef EC_GOOGLE_WILCO_EC_H
+#define EC_GOOGLE_WILCO_EC_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* Different supported message types */
+enum wilco_ec_msg_type {
+ WILCO_EC_MSG_RAW, /* Raw message, do not skip any data */
+ WILCO_EC_MSG_DEFAULT, /* Skip 1 byte of response data */
+ WILCO_EC_MSG_NO_RESPONSE, /* EC does not respond to command */
+};
+
+/**
+ * wilco_ec_mailbox
+ *
+ * Send a command request to the EC mailbox and receive the response.
+ *
+ * @type: Mailbox message type, see enum above
+ * @command: Command to execute
+ * @request_data: Request data buffer
+ * @request_size: Number of bytes in request data buffer (max 32)
+ * @response_data: Response data buffer
+ * @response_size: Number of bytes in response data buffer (max 32)
+ *
+ * @return number of bytes received, negative error code on failure
+ */
+int wilco_ec_mailbox(enum wilco_ec_msg_type type, uint8_t command,
+ const void *request_data, size_t request_size,
+ void *response_data, size_t response_size);
+
+#endif /* EC_GOOGLE_WILCO_EC_H */