From 10ed1938767ec90a264b73b337ec17a0a674847a Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Thu, 15 Oct 2015 23:56:51 +0100 Subject: [PATCH] greybus: sdio: send data block details at command request If SDIO request include data to be transfer send details (data blocks and block size) in command request, as it seems some controllers need this info prior to set the registers correctly. Signed-off-by: Rui Miguel Silva Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/greybus_protocols.h | 2 ++ drivers/staging/greybus/sdio.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index fedb1b1..02ba40f 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -1088,6 +1088,8 @@ struct gb_sdio_command_request { #define GB_SDIO_CMD_BCR 0x03 __le32 cmd_arg; + __le16 data_blocks; + __le16 data_blksz; } __packed; struct gb_sdio_command_response { diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index b5e4af3..201cfe5 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -373,8 +373,9 @@ out: static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) { - struct gb_sdio_command_request request; + struct gb_sdio_command_request request = {0}; struct gb_sdio_command_response response; + struct mmc_data *data = host->mrq->data; u8 cmd_flags; u8 cmd_type; int i; @@ -427,6 +428,11 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) request.cmd_flags = cmd_flags; request.cmd_type = cmd_type; request.cmd_arg = cpu_to_le32(cmd->arg); + /* some controllers need to know at command time data details */ + if (data) { + request.data_blocks = cpu_to_le16(data->blocks); + request.data_blksz = cpu_to_le16(data->blksz); + } ret = gb_operation_sync(host->connection, GB_SDIO_TYPE_COMMAND, &request, sizeof(request), &response, -- 2.7.4