summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-22 12:24:59 -0700
committerGerrit <chrome-bot@google.com>2012-07-22 13:17:03 -0700
commitfbfc353cefa63b75a3e47e703b2eb47bac32d8f4 (patch)
tree681da47b3d26e3f0ec23c82289db40e99d27bd3c
parent7143c4544c4076a6b8f6d65d79d6524d34dea7b7 (diff)
downloadchrome-ec-fbfc353cefa63b75a3e47e703b2eb47bac32d8f4.tar.gz
Revert "i2c: Support command version numbers"
This reverts commit b983290238458f88a897ce3cfb06faae9ec79a40 Dependent on reverted change. Change-Id: I3bb4c6acf4ff327f956ee5e1b6deefcd84dc8fbb Reviewed-on: https://gerrit.chromium.org/gerrit/28138 Commit-Ready: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/i2c.c59
-rw-r--r--include/ec_commands.h12
-rw-r--r--include/host_command.h1
3 files changed, 15 insertions, 57 deletions
diff --git a/chip/stm32/i2c.c b/chip/stm32/i2c.c
index 7e7bafefc6..31c5174c55 100644
--- a/chip/stm32/i2c.c
+++ b/chip/stm32/i2c.c
@@ -41,8 +41,8 @@
static uint16_t i2c_sr1[NUM_PORTS];
static struct mutex i2c_mutex;
-/* buffer for host commands (including version, error code and checksum) */
-static uint8_t host_buffer[EC_HOST_PARAM_SIZE + 4];
+/* buffer for host commands (including error code and checksum) */
+static uint8_t host_buffer[EC_HOST_PARAM_SIZE + 2];
static struct host_cmd_handler_args host_cmd_args;
/* current position in host buffer for reception */
@@ -127,14 +127,10 @@ static void i2c_send_response(struct host_cmd_handler_args *args)
const uint8_t *data = args->response;
int size = args->response_size;
uint8_t *out = host_buffer;
- int sum = 0, i;
+ int sum, i;
*out++ = args->result;
- if (!args->i2c_old_response) {
- *out++ = size;
- sum = args->result + size;
- }
- for (i = 0; i < size; i++, data++, out++) {
+ for (i = 0, sum = 0; i < size; i++, data++, out++) {
if (data != out)
*out = *data;
sum += *data;
@@ -148,43 +144,18 @@ static void i2c_send_response(struct host_cmd_handler_args *args)
/* Process the command in the i2c host buffer */
static void i2c_process_command(void)
{
- struct host_cmd_handler_args *args = &host_cmd_args;
- char *buff = host_buffer;
-
- args->command = *buff;
- args->result = EC_RES_SUCCESS;
- if (args->command >= EC_CMD_VERSION0) {
- int csum, i;
-
- /* Read version and data size */
- args->version = args->command - EC_CMD_VERSION0;
- args->command = buff[1];
- args->params_size = buff[2];
-
- /* Verify checksum */
- for (csum = i = 0; i < args->params_size + 3; i++)
- csum += buff[i];
- if ((uint8_t)csum != buff[i])
- args->result = EC_RES_INVALID_CHECKSUM;
-
- buff += 3;
- args->i2c_old_response = 0;
- } else {
- /* Old style command */
- args->version = 0;
- args->params_size = EC_HOST_PARAM_SIZE; /* unknown */
- buff++;
- args->i2c_old_response = 1;
- }
-
/* we have an available command : execute it */
- args->send_response = i2c_send_response;
- args->params = buff;
- /* skip room for error code, arglen */
- args->response = host_buffer + 2;
- args->response_max = EC_HOST_PARAM_SIZE;
- args->response_size = 0;
- host_command_received(args);
+ host_cmd_args.command = host_buffer[0];
+ host_cmd_args.result = EC_RES_SUCCESS;
+ host_cmd_args.send_response = i2c_send_response;
+ host_cmd_args.version = 0;
+ host_cmd_args.params = host_buffer + 1;
+ host_cmd_args.params_size = EC_HOST_PARAM_SIZE;
+ /* skip room for error code */
+ host_cmd_args.response = host_buffer + 1;
+ host_cmd_args.response_max = EC_HOST_PARAM_SIZE;
+ host_cmd_args.response_size = 0;
+ host_command_received(&host_cmd_args);
}
static void i2c_event_handler(int port)
diff --git a/include/ec_commands.h b/include/ec_commands.h
index d6337a20ae..d53c267af6 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -942,18 +942,6 @@ struct ec_params_reboot_ec {
*/
#define EC_CMD_REBOOT 0xd1 /* Think "die" */
-/*
- * This header byte on a command indicate version 0. Any header byte less
- * than this means that we are talking to an old EC which doesn't support
- * versioning. In that case, we assume version 0.
- *
- * Header bytes greater than this indicate a later version. For example,
- * EC_CMD_VERSION0 + 1 means we are using version 1.
- *
- * The old EC interface must not use commands 0dc or higher.
- */
-#define EC_CMD_VERSION0 0xdc
-
#endif /* !__ACPI__ */
#endif /* __CROS_EC_COMMANDS_H */
diff --git a/include/host_command.h b/include/host_command.h
index 135f493737..a88761a6e2 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -22,7 +22,6 @@ struct host_cmd_handler_args {
uint8_t command; /* Command (e.g., EC_CMD_FLASH_GET_INFO) */
uint8_t version; /* Version of command (0-31) */
uint8_t params_size; /* Size of input parameters in bytes */
- uint8_t i2c_old_response; /* (for I2C) send an old-style response */
const uint8_t *params; /* Input parameters */
/*
* Pointer to output response data buffer. On input to the handler,