diff options
Diffstat (limited to 'drivers/memstick/core')
| -rw-r--r-- | drivers/memstick/core/memstick.c | 10 | ||||
| -rw-r--r-- | drivers/memstick/core/mspro_block.c | 33 |
2 files changed, 30 insertions, 13 deletions
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index a38005008a2..cea46906408 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
| @@ -185,7 +185,7 @@ static void memstick_free(struct device *dev) | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | static struct class memstick_host_class = { | 187 | static struct class memstick_host_class = { |
| 188 | .name = "memstick_host", | 188 | .name = "memstick_host", |
| 189 | .dev_release = memstick_free | 189 | .dev_release = memstick_free |
| 190 | }; | 190 | }; |
| 191 | 191 | ||
| @@ -264,7 +264,7 @@ EXPORT_SYMBOL(memstick_new_req); | |||
| 264 | * @sg - TPC argument | 264 | * @sg - TPC argument |
| 265 | */ | 265 | */ |
| 266 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | 266 | void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, |
| 267 | struct scatterlist *sg) | 267 | const struct scatterlist *sg) |
| 268 | { | 268 | { |
| 269 | mrq->tpc = tpc; | 269 | mrq->tpc = tpc; |
| 270 | if (tpc & 8) | 270 | if (tpc & 8) |
| @@ -294,7 +294,7 @@ EXPORT_SYMBOL(memstick_init_req_sg); | |||
| 294 | * user supplied buffer. | 294 | * user supplied buffer. |
| 295 | */ | 295 | */ |
| 296 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | 296 | void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, |
| 297 | void *buf, size_t length) | 297 | const void *buf, size_t length) |
| 298 | { | 298 | { |
| 299 | mrq->tpc = tpc; | 299 | mrq->tpc = tpc; |
| 300 | if (tpc & 8) | 300 | if (tpc & 8) |
| @@ -439,7 +439,7 @@ static void memstick_check(struct work_struct *work) | |||
| 439 | if (!host->card) { | 439 | if (!host->card) { |
| 440 | if (memstick_power_on(host)) | 440 | if (memstick_power_on(host)) |
| 441 | goto out_power_off; | 441 | goto out_power_off; |
| 442 | } else | 442 | } else if (host->card->stop) |
| 443 | host->card->stop(host->card); | 443 | host->card->stop(host->card); |
| 444 | 444 | ||
| 445 | card = memstick_alloc_card(host); | 445 | card = memstick_alloc_card(host); |
| @@ -458,7 +458,7 @@ static void memstick_check(struct work_struct *work) | |||
| 458 | || !(host->card->check(host->card))) { | 458 | || !(host->card->check(host->card))) { |
| 459 | device_unregister(&host->card->dev); | 459 | device_unregister(&host->card->dev); |
| 460 | host->card = NULL; | 460 | host->card = NULL; |
| 461 | } else | 461 | } else if (host->card->start) |
| 462 | host->card->start(host->card); | 462 | host->card->start(host->card); |
| 463 | } | 463 | } |
| 464 | 464 | ||
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 44b1817f2f2..d2d2318dafa 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
| @@ -30,6 +30,8 @@ module_param(major, int, 0644); | |||
| 30 | #define MSPRO_BLOCK_SIGNATURE 0xa5c3 | 30 | #define MSPRO_BLOCK_SIGNATURE 0xa5c3 |
| 31 | #define MSPRO_BLOCK_MAX_ATTRIBUTES 41 | 31 | #define MSPRO_BLOCK_MAX_ATTRIBUTES 41 |
| 32 | 32 | ||
| 33 | #define MSPRO_BLOCK_PART_SHIFT 3 | ||
| 34 | |||
| 33 | enum { | 35 | enum { |
| 34 | MSPRO_BLOCK_ID_SYSINFO = 0x10, | 36 | MSPRO_BLOCK_ID_SYSINFO = 0x10, |
| 35 | MSPRO_BLOCK_ID_MODELNAME = 0x15, | 37 | MSPRO_BLOCK_ID_MODELNAME = 0x15, |
| @@ -195,7 +197,7 @@ static int mspro_block_bd_open(struct inode *inode, struct file *filp) | |||
| 195 | static int mspro_block_disk_release(struct gendisk *disk) | 197 | static int mspro_block_disk_release(struct gendisk *disk) |
| 196 | { | 198 | { |
| 197 | struct mspro_block_data *msb = disk->private_data; | 199 | struct mspro_block_data *msb = disk->private_data; |
| 198 | int disk_id = disk->first_minor >> MEMSTICK_PART_SHIFT; | 200 | int disk_id = disk->first_minor >> MSPRO_BLOCK_PART_SHIFT; |
| 199 | 201 | ||
| 200 | mutex_lock(&mspro_block_disk_lock); | 202 | mutex_lock(&mspro_block_disk_lock); |
| 201 | 203 | ||
| @@ -877,6 +879,7 @@ static int mspro_block_switch_interface(struct memstick_dev *card) | |||
| 877 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 879 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
| 878 | int rc = 0; | 880 | int rc = 0; |
| 879 | 881 | ||
| 882 | try_again: | ||
| 880 | if (msb->caps & MEMSTICK_CAP_PAR4) | 883 | if (msb->caps & MEMSTICK_CAP_PAR4) |
| 881 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); | 884 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); |
| 882 | else | 885 | else |
| @@ -930,6 +933,18 @@ static int mspro_block_switch_interface(struct memstick_dev *card) | |||
| 930 | rc = memstick_set_rw_addr(card); | 933 | rc = memstick_set_rw_addr(card); |
| 931 | if (!rc) | 934 | if (!rc) |
| 932 | rc = mspro_block_set_interface(card, msb->system); | 935 | rc = mspro_block_set_interface(card, msb->system); |
| 936 | |||
| 937 | if (!rc) { | ||
| 938 | msleep(150); | ||
| 939 | rc = mspro_block_wait_for_ced(card); | ||
| 940 | if (rc) | ||
| 941 | return rc; | ||
| 942 | |||
| 943 | if (msb->caps & MEMSTICK_CAP_PAR8) { | ||
| 944 | msb->caps &= ~MEMSTICK_CAP_PAR8; | ||
| 945 | goto try_again; | ||
| 946 | } | ||
| 947 | } | ||
| 933 | } | 948 | } |
| 934 | return rc; | 949 | return rc; |
| 935 | } | 950 | } |
| @@ -1117,14 +1132,16 @@ static int mspro_block_init_card(struct memstick_dev *card) | |||
| 1117 | return -EIO; | 1132 | return -EIO; |
| 1118 | 1133 | ||
| 1119 | msb->caps = host->caps; | 1134 | msb->caps = host->caps; |
| 1120 | rc = mspro_block_switch_interface(card); | 1135 | |
| 1136 | msleep(150); | ||
| 1137 | rc = mspro_block_wait_for_ced(card); | ||
| 1121 | if (rc) | 1138 | if (rc) |
| 1122 | return rc; | 1139 | return rc; |
| 1123 | 1140 | ||
| 1124 | msleep(200); | 1141 | rc = mspro_block_switch_interface(card); |
| 1125 | rc = mspro_block_wait_for_ced(card); | ||
| 1126 | if (rc) | 1142 | if (rc) |
| 1127 | return rc; | 1143 | return rc; |
| 1144 | |||
| 1128 | dev_dbg(&card->dev, "card activated\n"); | 1145 | dev_dbg(&card->dev, "card activated\n"); |
| 1129 | if (msb->system != MEMSTICK_SYS_SERIAL) | 1146 | if (msb->system != MEMSTICK_SYS_SERIAL) |
| 1130 | msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; | 1147 | msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; |
| @@ -1192,12 +1209,12 @@ static int mspro_block_init_disk(struct memstick_dev *card) | |||
| 1192 | if (rc) | 1209 | if (rc) |
| 1193 | return rc; | 1210 | return rc; |
| 1194 | 1211 | ||
| 1195 | if ((disk_id << MEMSTICK_PART_SHIFT) > 255) { | 1212 | if ((disk_id << MSPRO_BLOCK_PART_SHIFT) > 255) { |
| 1196 | rc = -ENOSPC; | 1213 | rc = -ENOSPC; |
| 1197 | goto out_release_id; | 1214 | goto out_release_id; |
| 1198 | } | 1215 | } |
| 1199 | 1216 | ||
| 1200 | msb->disk = alloc_disk(1 << MEMSTICK_PART_SHIFT); | 1217 | msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT); |
| 1201 | if (!msb->disk) { | 1218 | if (!msb->disk) { |
| 1202 | rc = -ENOMEM; | 1219 | rc = -ENOMEM; |
| 1203 | goto out_release_id; | 1220 | goto out_release_id; |
| @@ -1220,7 +1237,7 @@ static int mspro_block_init_disk(struct memstick_dev *card) | |||
| 1220 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); | 1237 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); |
| 1221 | 1238 | ||
| 1222 | msb->disk->major = major; | 1239 | msb->disk->major = major; |
| 1223 | msb->disk->first_minor = disk_id << MEMSTICK_PART_SHIFT; | 1240 | msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT; |
| 1224 | msb->disk->fops = &ms_block_bdops; | 1241 | msb->disk->fops = &ms_block_bdops; |
| 1225 | msb->usage_count = 1; | 1242 | msb->usage_count = 1; |
| 1226 | msb->disk->private_data = msb; | 1243 | msb->disk->private_data = msb; |
| @@ -1416,7 +1433,7 @@ out_unlock: | |||
| 1416 | 1433 | ||
| 1417 | static struct memstick_device_id mspro_block_id_tbl[] = { | 1434 | static struct memstick_device_id mspro_block_id_tbl[] = { |
| 1418 | {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO, | 1435 | {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO, |
| 1419 | MEMSTICK_CLASS_GENERIC_DUO}, | 1436 | MEMSTICK_CLASS_DUO}, |
| 1420 | {} | 1437 | {} |
| 1421 | }; | 1438 | }; |
| 1422 | 1439 | ||
