Skip to content

Commit 77c249f

Browse files
committed
Add low-latency mode to sdcard driver. Disable with sdhci-bcm2708.enable_llm=0. Thanks ddv2005.
1 parent 5c35145 commit 77c249f

4 files changed

Lines changed: 145 additions & 44 deletions

File tree

‎drivers/mmc/host/sdhci-bcm2708.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ static bool allow_highspeed = 1;
135135
static int emmc_clock_freq = BCM2708_EMMC_CLOCK_FREQ;
136136
static bool sync_after_dma = 1;
137137
static bool missing_status = 1;
138+
bool enable_llm = 1;
138139

139140
#if 0
140141
static void hptime_test(void)
@@ -871,12 +872,11 @@ static irqreturn_t sdhci_bcm2708_dma_irq(int irq, void *dev_id)
871872
struct sdhci_host *host = dev_id;
872873
struct sdhci_bcm2708_priv *host_priv = SDHCI_HOST_PRIV(host);
873874
u32 dma_cs; /* control and status register */
874-
unsigned long flags;
875875

876876
BUG_ON(NULL == dev_id);
877877
BUG_ON(NULL == host_priv->dma_chan_base);
878878

879-
spin_lock_irqsave(&host->lock, flags);
879+
sdhci_spin_lock(host);
880880

881881
dma_cs = readl(host_priv->dma_chan_base + BCM2708_DMA_CS);
882882

@@ -917,8 +917,7 @@ static irqreturn_t sdhci_bcm2708_dma_irq(int irq, void *dev_id)
917917

918918
result = IRQ_HANDLED;
919919
}
920-
921-
spin_unlock_irqrestore(&host->lock, flags);
920+
sdhci_spin_unlock(host);
922921

923922
return result;
924923
}
@@ -1193,9 +1192,12 @@ static int sdhci_bcm2708_probe(struct platform_device *pdev)
11931192
sdhci_bcm2708_ops.missing_status = sdhci_bcm2708_missing_status;
11941193
}
11951194

1195+
printk("sdhci: %s low-latency mode\n",enable_llm?"Enable":"Disable");
1196+
11961197
host->hw_name = "BCM2708_Arasan";
11971198
host->ops = &sdhci_bcm2708_ops;
11981199
host->irq = platform_get_irq(pdev, 0);
1200+
host->second_irq = 0;
11991201

12001202
host->quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
12011203
SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
@@ -1256,12 +1258,13 @@ static int sdhci_bcm2708_probe(struct platform_device *pdev)
12561258
}
12571259
host_priv->dma_chan = ret;
12581260

1259-
ret = request_irq(host_priv->dma_irq, sdhci_bcm2708_dma_irq,
1260-
IRQF_SHARED, DRIVER_NAME " (dma)", host);
1261+
ret = request_irq(host_priv->dma_irq, sdhci_bcm2708_dma_irq,0,//IRQF_SHARED,
1262+
DRIVER_NAME " (dma)", host);
12611263
if (ret) {
12621264
dev_err(&pdev->dev, "cannot set DMA IRQ\n");
12631265
goto err_add_dma_irq;
12641266
}
1267+
host->second_irq = host_priv->dma_irq;
12651268
DBG("DMA CBs %p handle %08X DMA%d %p DMA IRQ %d\n",
12661269
host_priv->cb_base, (unsigned)host_priv->cb_handle,
12671270
host_priv->dma_chan, host_priv->dma_chan_base,
@@ -1384,6 +1387,7 @@ module_param(allow_highspeed, bool, 0444);
13841387
module_param(emmc_clock_freq, int, 0444);
13851388
module_param(sync_after_dma, bool, 0444);
13861389
module_param(missing_status, bool, 0444);
1390+
module_param(enable_llm, bool, 0444);
13871391

13881392
MODULE_DESCRIPTION("Secure Digital Host Controller Interface platform driver");
13891393
MODULE_AUTHOR("Broadcom <info@broadcom.com>");
@@ -1394,5 +1398,6 @@ MODULE_PARM_DESC(allow_highspeed, "Allow high speed transfers modes");
13941398
MODULE_PARM_DESC(emmc_clock_freq, "Specify the speed of emmc clock");
13951399
MODULE_PARM_DESC(sync_after_dma, "Block in driver until dma complete");
13961400
MODULE_PARM_DESC(missing_status, "Use the missing status quirk");
1401+
MODULE_PARM_DESC(enable_llm, "Enable low-latency mode");
13971402

13981403

0 commit comments

Comments
 (0)