[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1287791637-10329-12-git-send-email-maximlevitsky@gmail.com>
Date: Sat, 23 Oct 2010 01:53:39 +0200
From: Maxim Levitsky <maximlevitsky@...il.com>
To: Alex Dubov <oakad@...oo.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Maxim Levitsky <maximlevitsky@...il.com>
Subject: [PATCH 11/29] memstick: mspro: use MS_TPC_EX_SET_CMD
This little optimization done by Sony for
PRO variant of the cards allows to bundle the param register
with the command and therefore send one TPC less.
This increases IO throughput somewhat.
(4.4 -> 4.8 MB/s on Jmicron for example)
Signed-off-by: Maxim Levitsky <maximlevitsky@...il.com>
---
drivers/memstick/core/mspro_block.c | 35 +++++++++++++----------------------
drivers/memstick/core/mspro_block.h | 3 +--
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 0d8b30b..e54d467 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -438,35 +438,28 @@ static int h_mspro_block_transfer_data(struct memstick_dev *card,
if (!msb->io_error) {
msb->io_error = (*mrq)->error;
- card->state = 6;
+ card->state = 5;
}
}
again:
switch (card->state) {
case 0: /* send read/write command + args */
- if (!memstick_write_regs(card,
- offsetof(struct mspro_register, param),
- sizeof(struct mspro_param_register),
- (unsigned char *)&msb->arg, *mrq))
- return 0;
- break;
- case 1:
- memstick_init_req(*mrq, MS_TPC_SET_CMD,
- &msb->transfer_cmd, 1);
+ memstick_init_req(*mrq, MS_TPC_EX_SET_CMD,
+ &msb->arg, sizeof(msb->arg));
break;
- case 2: /* read the INT register */
+ case 1: /* read the INT register */
if (memstick_read_int_reg(card, *mrq, -1))
break;
card->state++;
- case 3: /* process the int register */
+ case 2: /* process the int register */
intreg = (*mrq)->data[0];
if (intreg & (MEMSTICK_INT_CMDNAK | MEMSTICK_INT_ERR)) {
dbg(card, "IO: card I/O error");
- card->state = 6;
+ card->state = 5;
msb->io_error = -EIO;
goto again;
}
@@ -479,7 +472,7 @@ again:
}
memstick_read_int_reg_cleanup(card);
- card->state = 7;
+ card->state = 6;
goto again;
}
@@ -492,7 +485,7 @@ again:
memstick_read_int_reg_cleanup(card);
card->state++;
- case 4: /* init transfer of the data */
+ case 3: /* init transfer of the data */
t_offset = msb->current_sg->offset + msb->current_sg_offset;
sg_init_table(&t_sg, 1);
@@ -505,7 +498,7 @@ again:
(*mrq)->need_card_int = 1;
break;
- case 5: /* switch to next page */
+ case 4: /* switch to next page */
msb->current_sg_offset += msb->page_size;
msb->data_transferred += msb->page_size;
@@ -514,15 +507,15 @@ again:
msb->current_sg = sg_next(msb->current_sg);
}
- card->state = 2;
+ card->state = 1;
goto again;
- case 6: /* after a error send STOP command */
+ case 5: /* after a error send STOP command */
command = MSPRO_CMD_STOP;
memstick_init_req(*mrq, MS_TPC_SET_CMD, &command, 1);
break;
- case 7: /* request complete - get next one*/
+ case 6: /* request complete - get next one*/
spin_lock_irqsave(&msb->q_lock, flags);
if (msb->io_error)
@@ -572,9 +565,7 @@ static int mspro_block_setup_io(struct memstick_dev *card, int direction,
msb->data_transferred = 0;
msb->io_error = 0;
- msb->transfer_cmd = command;
-
- msb->arg.system = msb->system;
+ msb->arg.command = command;
msb->arg.data_count = cpu_to_be16(pages);
msb->arg.data_address = cpu_to_be32(sector);
msb->data_dir = direction;
diff --git a/drivers/memstick/core/mspro_block.h b/drivers/memstick/core/mspro_block.h
index ba9f78c..82ae2fe 100644
--- a/drivers/memstick/core/mspro_block.h
+++ b/drivers/memstick/core/mspro_block.h
@@ -151,8 +151,7 @@ struct mspro_block_data {
/* Handlers state */
unsigned char system;
- unsigned char transfer_cmd;
- struct mspro_param_register arg;
+ struct mspro_cmdex_argument arg;
struct scatterlist *current_sg;
unsigned int current_sg_offset;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists