greybus: sdio: send data block details at command request
authorRui Miguel Silva <rui.silva@linaro.org>
Thu, 15 Oct 2015 22:56:51 +0000 (23:56 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 19 Oct 2015 19:06:44 +0000 (12:06 -0700)
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 <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/sdio.c

index fedb1b1..02ba40f 100644 (file)
@@ -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 {
index b5e4af3..201cfe5 100644 (file)
@@ -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,