aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2007-11-14 07:55:36 -0500
committerPierre Ossman <drzeus@drzeus.cx>2007-11-21 12:42:45 -0500
commitb37a05069b9ab9fb1e52393a3448d710c50c54d5 (patch)
tree04de6bb95d9835e96c9b2c269348206570160ce4 /drivers/mmc/host
parentd198f101989d9bb950327f0d043f6203bb862343 (diff)
tifm_sd: handle non-power-of-2 block sizes
It is possible to handle arbitrary block sizes with tifm card reader by conditionally switching to PIO in case such block has to be delivered. At the beginning of each request, DMA is either disabled (non-power-of-2 block size) or set to load time user preference. Signed-off-by: Alex Dubov <oakad@yahoo.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/tifm_sd.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index c11a3d256051..20d5c7bd940a 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -16,7 +16,6 @@
16#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/scatterlist.h> 18#include <linux/scatterlist.h>
19#include <linux/log2.h>
20#include <asm/io.h> 19#include <asm/io.h>
21 20
22#define DRIVER_NAME "tifm_sd" 21#define DRIVER_NAME "tifm_sd"
@@ -638,17 +637,15 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
638 goto err_out; 637 goto err_out;
639 } 638 }
640 639
641 if (mrq->data && !is_power_of_2(mrq->data->blksz)) {
642 printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n",
643 sock->dev.bus_id, mrq->data->blksz);
644 mrq->cmd->error = -EINVAL;
645 goto err_out;
646 }
647
648 host->cmd_flags = 0; 640 host->cmd_flags = 0;
649 host->block_pos = 0; 641 host->block_pos = 0;
650 host->sg_pos = 0; 642 host->sg_pos = 0;
651 643
644 if (mrq->data && !is_power_of_2(mrq->data->blksz))
645 host->no_dma = 1;
646 else
647 host->no_dma = no_dma ? 1 : 0;
648
652 if (r_data) { 649 if (r_data) {
653 tifm_sd_set_data_timeout(host, r_data); 650 tifm_sd_set_data_timeout(host, r_data);
654 651
@@ -676,7 +673,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
676 : PCI_DMA_FROMDEVICE)) { 673 : PCI_DMA_FROMDEVICE)) {
677 printk(KERN_ERR "%s : scatterlist map failed\n", 674 printk(KERN_ERR "%s : scatterlist map failed\n",
678 sock->dev.bus_id); 675 sock->dev.bus_id);
679 spin_unlock_irqrestore(&sock->lock, flags); 676 mrq->cmd->error = -ENOMEM;
680 goto err_out; 677 goto err_out;
681 } 678 }
682 host->sg_len = tifm_map_sg(sock, r_data->sg, 679 host->sg_len = tifm_map_sg(sock, r_data->sg,
@@ -692,7 +689,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
692 r_data->flags & MMC_DATA_WRITE 689 r_data->flags & MMC_DATA_WRITE
693 ? PCI_DMA_TODEVICE 690 ? PCI_DMA_TODEVICE
694 : PCI_DMA_FROMDEVICE); 691 : PCI_DMA_FROMDEVICE);
695 spin_unlock_irqrestore(&sock->lock, flags); 692 mrq->cmd->error = -ENOMEM;
696 goto err_out; 693 goto err_out;
697 } 694 }
698 695
@@ -966,7 +963,6 @@ static int tifm_sd_probe(struct tifm_dev *sock)
966 return -ENOMEM; 963 return -ENOMEM;
967 964
968 host = mmc_priv(mmc); 965 host = mmc_priv(mmc);
969 host->no_dma = no_dma;
970 tifm_set_drvdata(sock, mmc); 966 tifm_set_drvdata(sock, mmc);
971 host->dev = sock; 967 host->dev = sock;
972 host->timeout_jiffies = msecs_to_jiffies(1000); 968 host->timeout_jiffies = msecs_to_jiffies(1000);