summaryrefslogtreecommitdiffstats
path: root/drivers/memstick
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2008-03-10 11:43:42 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-10 18:01:18 -0700
commit593672582e71a688cf8c3fc1c59ec7c44d3799e5 (patch)
tree7ce71db28639146c9302bb2b03880638661f417d /drivers/memstick
parent251cc9b9df065cb2c170ea45f566c0d9456186c2 (diff)
downloadlinux-593672582e71a688cf8c3fc1c59ec7c44d3799e5.tar.gz
linux-593672582e71a688cf8c3fc1c59ec7c44d3799e5.tar.bz2
linux-593672582e71a688cf8c3fc1c59ec7c44d3799e5.zip
memstick: try harder to recover from unsuccessful interface mode switch
Signed-off-by: Alex Dubov <oakad@yahoo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/memstick')
-rw-r--r--drivers/memstick/core/mspro_block.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 62b913ba9b97..1d637e4561d3 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -16,6 +16,7 @@
#include <linux/idr.h>
#include <linux/hdreg.h>
#include <linux/kthread.h>
+#include <linux/delay.h>
#include <linux/memstick.h>
#define DRIVER_NAME "mspro_block"
@@ -820,7 +821,7 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card)
struct memstick_host *host = card->host;
struct mspro_block_data *msb = memstick_get_drvdata(card);
struct mspro_param_register param = {
- .system = 0,
+ .system = MEMSTICK_SYS_PAR4,
.data_count = 0,
.data_address = 0,
.tpc_param = 0
@@ -845,8 +846,24 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card)
wait_for_completion(&card->mrq_complete);
if (card->current_mrq.error) {
- msb->system = 0x80;
+ msb->system = MEMSTICK_SYS_SERIAL;
+ host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
+ msleep(1000);
+ host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON);
host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL);
+
+ if (memstick_set_rw_addr(card))
+ return card->current_mrq.error;
+
+ param.system = msb->system;
+
+ card->next_request = h_mspro_block_req_init;
+ msb->mrq_handler = h_mspro_block_default;
+ memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, &param,
+ sizeof(param));
+ memstick_new_req(host);
+ wait_for_completion(&card->mrq_complete);
+
return -EFAULT;
}