]> git.sur5r.net Git - u-boot/commitdiff
cros_ec: Drop old EC version support from EC driver
authorVadim Bendebury <vbendeb@chromium.org>
Thu, 27 Feb 2014 20:26:04 +0000 (13:26 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Mar 2014 02:05:46 +0000 (20:05 -0600)
There is no need to support old style EC moving forward. Ultimately we
should get rid of the check_version() API. For now just return error
in case the EC does not seem to support the new API.

Reviewed-by: Vadim Bendebury <vbendeb@google.com>
Tested-by: Vadim Bendebury <vbendeb@google.com>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/misc/cros_ec.c
drivers/misc/cros_ec_lpc.c

index 1998653754bdb0e075396a3985851e40e755a943..f95bfe73900f9a418061bcadd0eef2fbc918402b 100644 (file)
@@ -132,10 +132,6 @@ static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd,
        uint8_t *din;
        int len;
 
-       if (cmd_version != 0 && !dev->cmd_version_is_supported) {
-               debug("%s: Command version >0 unsupported\n", __func__);
-               return -1;
-       }
        len = send_command(dev, cmd, cmd_version, dout, dout_len,
                                &din, din_len);
 
@@ -510,14 +506,9 @@ static int cros_ec_check_version(struct cros_ec_dev *dev)
                /* It appears to understand new version commands */
                dev->cmd_version_is_supported = 1;
        } else {
-               dev->cmd_version_is_supported = 0;
-               if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req,
-                             sizeof(req), (uint8_t **)&resp,
-                             sizeof(*resp)) < 0) {
-                       debug("%s: Failed both old and new command style\n",
-                               __func__);
-                       return -1;
-               }
+               printf("%s: ERROR: old EC interface not supported\n",
+                      __func__);
+               return -1;
        }
 
        return 0;
index 725747693d507faac0bc25d5c5fd3c091443f834..0e02671c93d46652864d9e83bf4a7d3d9f658e2e 100644 (file)
@@ -40,71 +40,6 @@ static int wait_for_sync(struct cros_ec_dev *dev)
        return 0;
 }
 
-/**
- * Send a command to a LPC CROS_EC device and return the reply.
- *
- * The device's internal input/output buffers are used.
- *
- * @param dev          CROS_EC device
- * @param cmd          Command to send (EC_CMD_...)
- * @param cmd_version  Version of command to send (EC_VER_...)
- * @param dout          Output data (may be NULL If dout_len=0)
- * @param dout_len      Size of output data in bytes
- * @param dinp          Place to put pointer to response data
- * @param din_len       Maximum size of response in bytes
- * @return number of bytes in response, or -1 on error
- */
-static int old_lpc_command(struct cros_ec_dev *dev, uint8_t cmd,
-                    const uint8_t *dout, int dout_len,
-                    uint8_t **dinp, int din_len)
-{
-       int ret, i;
-
-       if (dout_len > EC_OLD_PARAM_SIZE) {
-               debug("%s: Cannot send %d bytes\n", __func__, dout_len);
-               return -1;
-       }
-
-       if (din_len > EC_OLD_PARAM_SIZE) {
-               debug("%s: Cannot receive %d bytes\n", __func__, din_len);
-               return -1;
-       }
-
-       if (wait_for_sync(dev)) {
-               debug("%s: Timeout waiting ready\n", __func__);
-               return -1;
-       }
-
-       debug_trace("cmd: %02x, ", cmd);
-       for (i = 0; i < dout_len; i++) {
-               debug_trace("%02x ", dout[i]);
-               outb(dout[i], EC_LPC_ADDR_OLD_PARAM + i);
-       }
-       outb(cmd, EC_LPC_ADDR_HOST_CMD);
-       debug_trace("\n");
-
-       if (wait_for_sync(dev)) {
-               debug("%s: Timeout waiting ready\n", __func__);
-               return -1;
-       }
-
-       ret = inb(EC_LPC_ADDR_HOST_DATA);
-       if (ret) {
-               debug("%s: CROS_EC result code %d\n", __func__, ret);
-               return -ret;
-       }
-
-       debug_trace("resp: %02x, ", ret);
-       for (i = 0; i < din_len; i++) {
-               dev->din[i] = inb(EC_LPC_ADDR_OLD_PARAM + i);
-               debug_trace("%02x ", dev->din[i]);
-       }
-       debug_trace("\n");
-       *dinp = dev->din;
-
-       return din_len;
-}
-
 int cros_ec_lpc_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
                     const uint8_t *dout, int dout_len,
                     uint8_t **dinp, int din_len)
@@ -119,11 +54,6 @@ int cros_ec_lpc_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
        int csum;
        int i;
 
-       /* Fall back to old-style command interface if args aren't supported */
-       if (!dev->cmd_version_is_supported)
-               return old_lpc_command(dev, cmd, dout, dout_len, dinp,
-                                      din_len);
-
        if (dout_len > EC_HOST_PARAM_SIZE) {
                debug("%s: Cannot send %d bytes\n", __func__, dout_len);
                return -1;
@@ -256,13 +186,9 @@ int cros_ec_lpc_check_version(struct cros_ec_dev *dev)
                        (inb(EC_LPC_ADDR_MEMMAP +
                                EC_MEMMAP_HOST_CMD_FLAGS) &
                                EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED)) {
-               dev->cmd_version_is_supported = 1;
-       } else {
-               /* We are going to use the old IO ports */
-               dev->cmd_version_is_supported = 0;
+               return 0;
        }
-       debug("lpc: version %s\n", dev->cmd_version_is_supported ?
-                       "new" : "old");
 
-       return 0;
+       printf("%s: ERROR: old EC interface not supported\n", __func__);
+       return -1;
 }