diff options
Diffstat (limited to 'drivers/mmc/imxmmc.c')
-rw-r--r-- | drivers/mmc/imxmmc.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c index 5c62f4e6ad06..1b79dd271aae 100644 --- a/drivers/mmc/imxmmc.c +++ b/drivers/mmc/imxmmc.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * deficiencies | 25 | * deficiencies |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | #include <linux/config.h> | ||
29 | 28 | ||
30 | #ifdef CONFIG_MMC_DEBUG | 29 | #ifdef CONFIG_MMC_DEBUG |
31 | #define DEBUG | 30 | #define DEBUG |
@@ -92,6 +91,8 @@ struct imxmci_host { | |||
92 | int dma_allocated; | 91 | int dma_allocated; |
93 | 92 | ||
94 | unsigned char actual_bus_width; | 93 | unsigned char actual_bus_width; |
94 | |||
95 | int prev_cmd_code; | ||
95 | }; | 96 | }; |
96 | 97 | ||
97 | #define IMXMCI_PEND_IRQ_b 0 | 98 | #define IMXMCI_PEND_IRQ_b 0 |
@@ -249,16 +250,14 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data) | |||
249 | * partial FIFO fills and reads. The length has to be rounded up to burst size multiple. | 250 | * partial FIFO fills and reads. The length has to be rounded up to burst size multiple. |
250 | * This is required for SCR read at least. | 251 | * This is required for SCR read at least. |
251 | */ | 252 | */ |
252 | if (datasz < 64) { | 253 | if (datasz < 512) { |
253 | host->dma_size = datasz; | 254 | host->dma_size = datasz; |
254 | if (data->flags & MMC_DATA_READ) { | 255 | if (data->flags & MMC_DATA_READ) { |
255 | host->dma_dir = DMA_FROM_DEVICE; | 256 | host->dma_dir = DMA_FROM_DEVICE; |
256 | 257 | ||
257 | /* Hack to enable read SCR */ | 258 | /* Hack to enable read SCR */ |
258 | if(datasz < 16) { | 259 | MMC_NOB = 1; |
259 | MMC_NOB = 1; | 260 | MMC_BLK_LEN = 512; |
260 | MMC_BLK_LEN = 16; | ||
261 | } | ||
262 | } else { | 261 | } else { |
263 | host->dma_dir = DMA_TO_DEVICE; | 262 | host->dma_dir = DMA_TO_DEVICE; |
264 | } | 263 | } |
@@ -410,6 +409,9 @@ static void imxmci_finish_request(struct imxmci_host *host, struct mmc_request * | |||
410 | 409 | ||
411 | spin_unlock_irqrestore(&host->lock, flags); | 410 | spin_unlock_irqrestore(&host->lock, flags); |
412 | 411 | ||
412 | if(req && req->cmd) | ||
413 | host->prev_cmd_code = req->cmd->opcode; | ||
414 | |||
413 | host->req = NULL; | 415 | host->req = NULL; |
414 | host->cmd = NULL; | 416 | host->cmd = NULL; |
415 | host->data = NULL; | 417 | host->data = NULL; |
@@ -554,7 +556,6 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
554 | { | 556 | { |
555 | int i; | 557 | int i; |
556 | int burst_len; | 558 | int burst_len; |
557 | int flush_len; | ||
558 | int trans_done = 0; | 559 | int trans_done = 0; |
559 | unsigned int stat = *pstat; | 560 | unsigned int stat = *pstat; |
560 | 561 | ||
@@ -567,44 +568,43 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
567 | dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data running STATUS = 0x%x\n", | 568 | dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data running STATUS = 0x%x\n", |
568 | stat); | 569 | stat); |
569 | 570 | ||
571 | udelay(20); /* required for clocks < 8MHz*/ | ||
572 | |||
570 | if(host->dma_dir == DMA_FROM_DEVICE) { | 573 | if(host->dma_dir == DMA_FROM_DEVICE) { |
571 | imxmci_busy_wait_for_status(host, &stat, | 574 | imxmci_busy_wait_for_status(host, &stat, |
572 | STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE, | 575 | STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE, |
573 | 20, "imxmci_cpu_driven_data read"); | 576 | 50, "imxmci_cpu_driven_data read"); |
574 | 577 | ||
575 | while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) && | 578 | while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) && |
576 | (host->data_cnt < host->dma_size)) { | 579 | (host->data_cnt < 512)) { |
577 | if(burst_len >= host->dma_size - host->data_cnt) { | 580 | |
578 | flush_len = burst_len; | 581 | udelay(20); /* required for clocks < 8MHz*/ |
579 | burst_len = host->dma_size - host->data_cnt; | ||
580 | flush_len -= burst_len; | ||
581 | host->data_cnt = host->dma_size; | ||
582 | trans_done = 1; | ||
583 | } else { | ||
584 | flush_len = 0; | ||
585 | host->data_cnt += burst_len; | ||
586 | } | ||
587 | 582 | ||
588 | for(i = burst_len; i>=2 ; i-=2) { | 583 | for(i = burst_len; i>=2 ; i-=2) { |
589 | *(host->data_ptr++) = MMC_BUFFER_ACCESS; | 584 | u16 data; |
590 | udelay(20); /* required for clocks < 8MHz*/ | 585 | data = MMC_BUFFER_ACCESS; |
586 | udelay(10); /* required for clocks < 8MHz*/ | ||
587 | if(host->data_cnt+2 <= host->dma_size) { | ||
588 | *(host->data_ptr++) = data; | ||
589 | } else { | ||
590 | if(host->data_cnt < host->dma_size) | ||
591 | *(u8*)(host->data_ptr) = data; | ||
592 | } | ||
593 | host->data_cnt += 2; | ||
591 | } | 594 | } |
592 | 595 | ||
593 | if(i == 1) | ||
594 | *(u8*)(host->data_ptr) = MMC_BUFFER_ACCESS; | ||
595 | |||
596 | stat = MMC_STATUS; | 596 | stat = MMC_STATUS; |
597 | 597 | ||
598 | /* Flush extra bytes from FIFO */ | 598 | dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data read %d burst %d STATUS = 0x%x\n", |
599 | while(flush_len && !(stat & STATUS_DATA_TRANS_DONE)){ | 599 | host->data_cnt, burst_len, stat); |
600 | i = MMC_BUFFER_ACCESS; | ||
601 | stat = MMC_STATUS; | ||
602 | stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */ | ||
603 | } | ||
604 | |||
605 | dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data read burst %d STATUS = 0x%x\n", | ||
606 | burst_len, stat); | ||
607 | } | 600 | } |
601 | |||
602 | if((stat & STATUS_DATA_TRANS_DONE) && (host->data_cnt >= 512)) | ||
603 | trans_done = 1; | ||
604 | |||
605 | if(host->dma_size & 0x1ff) | ||
606 | stat &= ~STATUS_CRC_READ_ERR; | ||
607 | |||
608 | } else { | 608 | } else { |
609 | imxmci_busy_wait_for_status(host, &stat, | 609 | imxmci_busy_wait_for_status(host, &stat, |
610 | STATUS_APPL_BUFF_FE, | 610 | STATUS_APPL_BUFF_FE, |
@@ -693,8 +693,8 @@ static void imxmci_tasklet_fnc(unsigned long data) | |||
693 | what, stat, MMC_INT_MASK); | 693 | what, stat, MMC_INT_MASK); |
694 | dev_err(mmc_dev(host->mmc), "CMD_DAT_CONT = 0x%04x, MMC_BLK_LEN = 0x%04x, MMC_NOB = 0x%04x, DMA_CCR = 0x%08x\n", | 694 | dev_err(mmc_dev(host->mmc), "CMD_DAT_CONT = 0x%04x, MMC_BLK_LEN = 0x%04x, MMC_NOB = 0x%04x, DMA_CCR = 0x%08x\n", |
695 | MMC_CMD_DAT_CONT, MMC_BLK_LEN, MMC_NOB, CCR(host->dma)); | 695 | MMC_CMD_DAT_CONT, MMC_BLK_LEN, MMC_NOB, CCR(host->dma)); |
696 | dev_err(mmc_dev(host->mmc), "CMD%d, bus %d-bit, dma_size = 0x%x\n", | 696 | dev_err(mmc_dev(host->mmc), "CMD%d, prevCMD%d, bus %d-bit, dma_size = 0x%x\n", |
697 | host->cmd?host->cmd->opcode:0, 1<<host->actual_bus_width, host->dma_size); | 697 | host->cmd?host->cmd->opcode:0, host->prev_cmd_code, 1<<host->actual_bus_width, host->dma_size); |
698 | } | 698 | } |
699 | 699 | ||
700 | if(!host->present || timeout) | 700 | if(!host->present || timeout) |
@@ -956,7 +956,7 @@ static int imxmci_probe(struct platform_device *pdev) | |||
956 | mmc->f_min = 150000; | 956 | mmc->f_min = 150000; |
957 | mmc->f_max = CLK_RATE/2; | 957 | mmc->f_max = CLK_RATE/2; |
958 | mmc->ocr_avail = MMC_VDD_32_33; | 958 | mmc->ocr_avail = MMC_VDD_32_33; |
959 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 959 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_BYTEBLOCK; |
960 | 960 | ||
961 | /* MMC core transfer sizes tunable parameters */ | 961 | /* MMC core transfer sizes tunable parameters */ |
962 | mmc->max_hw_segs = 64; | 962 | mmc->max_hw_segs = 64; |