aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memstick/host
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2008-03-10 14:43:37 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-10 21:01:18 -0400
commite1f19995f55294fbb00ea22ba85d7b0d80ba3813 (patch)
tree0369d9e9a142000964d3204cb128c826986c94af /drivers/memstick/host
parentb614ce8b3c697947d75685f0b9f2059307dde715 (diff)
memstick: introduce correct definitions in the header
Thanks to some input from kind people at JMicron it is now possible to have more correct definitions of protocol structures and bit field semantics. 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/host')
-rw-r--r--drivers/memstick/host/tifm_ms.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index 4fb24215bd95..5b5bd61b3a4a 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -209,7 +209,7 @@ static int tifm_ms_issue_cmd(struct tifm_ms *host)
209 209
210 host->cmd_flags = 0; 210 host->cmd_flags = 0;
211 211
212 if (host->req->io_type == MEMSTICK_IO_SG) { 212 if (host->req->long_data) {
213 if (!host->no_dma) { 213 if (!host->no_dma) {
214 if (1 != tifm_map_sg(sock, &host->req->sg, 1, 214 if (1 != tifm_map_sg(sock, &host->req->sg, 1,
215 host->req->data_dir == READ 215 host->req->data_dir == READ
@@ -248,7 +248,7 @@ static int tifm_ms_issue_cmd(struct tifm_ms *host)
248 cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM); 248 cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM);
249 cmd_mask |= TIFM_MS_SYS_DATA | TIFM_MS_SYS_NOT_RDY; 249 cmd_mask |= TIFM_MS_SYS_DATA | TIFM_MS_SYS_NOT_RDY;
250 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); 250 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM);
251 } else if (host->req->io_type == MEMSTICK_IO_VAL) { 251 } else {
252 data = host->req->data; 252 data = host->req->data;
253 data_len = host->req->data_len; 253 data_len = host->req->data_len;
254 254
@@ -294,8 +294,7 @@ static int tifm_ms_issue_cmd(struct tifm_ms *host)
294 cmd_mask |= TIFM_MS_SYS_NOT_RDY; 294 cmd_mask |= TIFM_MS_SYS_NOT_RDY;
295 dev_dbg(&sock->dev, "mask %x\n", cmd_mask); 295 dev_dbg(&sock->dev, "mask %x\n", cmd_mask);
296 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); 296 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM);
297 } else 297 }
298 BUG();
299 298
300 mod_timer(&host->timer, jiffies + host->timeout_jiffies); 299 mod_timer(&host->timer, jiffies + host->timeout_jiffies);
301 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL), 300 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL),
@@ -319,13 +318,13 @@ static void tifm_ms_complete_cmd(struct tifm_ms *host)
319 int rc; 318 int rc;
320 319
321 del_timer(&host->timer); 320 del_timer(&host->timer);
322 if (host->req->io_type == MEMSTICK_IO_SG) { 321 if (host->req->long_data) {
323 if (!host->no_dma) 322 if (!host->no_dma)
324 tifm_unmap_sg(sock, &host->req->sg, 1, 323 tifm_unmap_sg(sock, &host->req->sg, 1,
325 host->req->data_dir == READ 324 host->req->data_dir == READ
326 ? PCI_DMA_FROMDEVICE 325 ? PCI_DMA_FROMDEVICE
327 : PCI_DMA_TODEVICE); 326 : PCI_DMA_TODEVICE);
328 } else if (host->req->io_type == MEMSTICK_IO_VAL) { 327 } else {
329 writel(~TIFM_MS_SYS_DATA & readl(sock->addr + SOCK_MS_SYSTEM), 328 writel(~TIFM_MS_SYS_DATA & readl(sock->addr + SOCK_MS_SYSTEM),
330 sock->addr + SOCK_MS_SYSTEM); 329 sock->addr + SOCK_MS_SYSTEM);
331 330
@@ -365,7 +364,7 @@ static int tifm_ms_check_status(struct tifm_ms *host)
365 if (!host->req->error) { 364 if (!host->req->error) {
366 if (!(host->cmd_flags & CMD_READY)) 365 if (!(host->cmd_flags & CMD_READY))
367 return 1; 366 return 1;
368 if ((host->req->io_type == MEMSTICK_IO_SG) 367 if (host->req->long_data
369 && !(host->cmd_flags & FIFO_READY)) 368 && !(host->cmd_flags & FIFO_READY))
370 return 1; 369 return 1;
371 if (host->req->need_card_int 370 if (host->req->need_card_int
@@ -505,7 +504,7 @@ static void tifm_ms_set_param(struct memstick_host *msh,
505 writel((~TIFM_CTRL_FAST_CLK) 504 writel((~TIFM_CTRL_FAST_CLK)
506 & readl(sock->addr + SOCK_CONTROL), 505 & readl(sock->addr + SOCK_CONTROL),
507 sock->addr + SOCK_CONTROL); 506 sock->addr + SOCK_CONTROL);
508 } else if (value == MEMSTICK_PARALLEL) { 507 } else if (value == MEMSTICK_PAR4) {
509 host->mode_mask = 0; 508 host->mode_mask = 0;
510 writel(TIFM_CTRL_FAST_CLK 509 writel(TIFM_CTRL_FAST_CLK
511 | readl(sock->addr + SOCK_CONTROL), 510 | readl(sock->addr + SOCK_CONTROL),
@@ -542,7 +541,7 @@ static int tifm_ms_initialize_host(struct tifm_ms *host)
542 writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM); 541 writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM);
543 writel(0xffffffff, sock->addr + SOCK_MS_STATUS); 542 writel(0xffffffff, sock->addr + SOCK_MS_STATUS);
544 if (tifm_has_ms_pif(sock)) 543 if (tifm_has_ms_pif(sock))
545 msh->caps |= MEMSTICK_CAP_PARALLEL; 544 msh->caps |= MEMSTICK_CAP_PAR4;
546 545
547 return 0; 546 return 0;
548} 547}
@@ -601,7 +600,7 @@ static void tifm_ms_remove(struct tifm_dev *sock)
601 writel(TIFM_FIFO_INT_SETALL, 600 writel(TIFM_FIFO_INT_SETALL,
602 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); 601 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
603 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); 602 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
604 if ((host->req->io_type == MEMSTICK_IO_SG) && !host->no_dma) 603 if (host->req->long_data && !host->no_dma)
605 tifm_unmap_sg(sock, &host->req->sg, 1, 604 tifm_unmap_sg(sock, &host->req->sg, 1,
606 host->req->data_dir == READ 605 host->req->data_dir == READ
607 ? PCI_DMA_TODEVICE 606 ? PCI_DMA_TODEVICE