platform/chrome: wilco_ec: Remove 256 byte transfers
The 0xF6 command, intended to send and receive 256 byte payloads to and from the EC, is not needed. The 0xF5 command for 32 byte payloads is sufficient. This patch removes support for the 0xF6 command and 256 byte payloads. Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
This commit is contained in:

committed by
Enric Balletbo i Serra

parent
4c1ca625c6
commit
2ad1f7a914
@@ -52,9 +52,7 @@ static int wilco_ec_probe(struct platform_device *pdev)
|
||||
ec->dev = dev;
|
||||
mutex_init(&ec->mailbox_lock);
|
||||
|
||||
/* Largest data buffer size requirement is extended data response */
|
||||
ec->data_size = sizeof(struct wilco_ec_response) +
|
||||
EC_MAILBOX_DATA_SIZE_EXTENDED;
|
||||
ec->data_size = sizeof(struct wilco_ec_response) + EC_MAILBOX_DATA_SIZE;
|
||||
ec->data_buffer = devm_kzalloc(dev, ec->data_size, GFP_KERNEL);
|
||||
if (!ec->data_buffer)
|
||||
return -ENOMEM;
|
||||
|
@@ -17,13 +17,13 @@
|
||||
#define DRV_NAME "wilco-ec-debugfs"
|
||||
|
||||
/* The 256 raw bytes will take up more space when represented as a hex string */
|
||||
#define FORMATTED_BUFFER_SIZE (EC_MAILBOX_DATA_SIZE_EXTENDED * 4)
|
||||
#define FORMATTED_BUFFER_SIZE (EC_MAILBOX_DATA_SIZE * 4)
|
||||
|
||||
struct wilco_ec_debugfs {
|
||||
struct wilco_ec_device *ec;
|
||||
struct dentry *dir;
|
||||
size_t response_size;
|
||||
u8 raw_data[EC_MAILBOX_DATA_SIZE_EXTENDED];
|
||||
u8 raw_data[EC_MAILBOX_DATA_SIZE];
|
||||
u8 formatted_data[FORMATTED_BUFFER_SIZE];
|
||||
};
|
||||
static struct wilco_ec_debugfs *debug_info;
|
||||
@@ -124,12 +124,6 @@ static ssize_t raw_write(struct file *file, const char __user *user_buf,
|
||||
msg.response_data = debug_info->raw_data;
|
||||
msg.response_size = EC_MAILBOX_DATA_SIZE;
|
||||
|
||||
/* Telemetry commands use extended response data */
|
||||
if (msg.type == WILCO_EC_MSG_TELEMETRY_LONG) {
|
||||
msg.flags |= WILCO_EC_FLAG_EXTENDED_DATA;
|
||||
msg.response_size = EC_MAILBOX_DATA_SIZE_EXTENDED;
|
||||
}
|
||||
|
||||
ret = wilco_ec_mailbox(debug_info->ec, &msg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@@ -119,7 +119,6 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec,
|
||||
struct wilco_ec_response *rs;
|
||||
u8 checksum;
|
||||
u8 flag;
|
||||
size_t size;
|
||||
|
||||
/* Write request header, then data */
|
||||
cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE, 0, sizeof(*rq), (u8 *)rq);
|
||||
@@ -148,21 +147,11 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec,
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* The EC always returns either EC_MAILBOX_DATA_SIZE or
|
||||
* EC_MAILBOX_DATA_SIZE_EXTENDED bytes of data, so we need to
|
||||
* calculate the checksum on **all** of this data, even if we
|
||||
* won't use all of it.
|
||||
*/
|
||||
if (msg->flags & WILCO_EC_FLAG_EXTENDED_DATA)
|
||||
size = EC_MAILBOX_DATA_SIZE_EXTENDED;
|
||||
else
|
||||
size = EC_MAILBOX_DATA_SIZE;
|
||||
|
||||
/* Read back response */
|
||||
rs = ec->data_buffer;
|
||||
checksum = cros_ec_lpc_io_bytes_mec(MEC_IO_READ, 0,
|
||||
sizeof(*rs) + size, (u8 *)rs);
|
||||
sizeof(*rs) + EC_MAILBOX_DATA_SIZE,
|
||||
(u8 *)rs);
|
||||
if (checksum) {
|
||||
dev_dbg(ec->dev, "bad packet checksum 0x%02x\n", rs->checksum);
|
||||
return -EBADMSG;
|
||||
@@ -173,9 +162,9 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec,
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (rs->data_size != size) {
|
||||
dev_dbg(ec->dev, "unexpected packet size (%u != %zu)",
|
||||
rs->data_size, size);
|
||||
if (rs->data_size != EC_MAILBOX_DATA_SIZE) {
|
||||
dev_dbg(ec->dev, "unexpected packet size (%u != %u)",
|
||||
rs->data_size, EC_MAILBOX_DATA_SIZE);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user