Skip to content

Commit b043787

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
bcm2835-mmc/sdhost: Remove ARCH_BCM2835 differences
The bcm2835-mmc driver (and -sdhost driver that copied from it) contains code to handle SDIO interrupts in a threaded interrupt handler rather than waking the MMC framework thread. The change follows a patch from Russell King that adds the facility as the preferred way of working. However, the new code path is only present in ARCH_BCM2835 builds, which I have taken to be a way of testing the waters rather than making the change across the board; I can't see any technical reason why it wouldn't be enabled for MACH_BCM270X builds. So this patch standardises on the ARCH_BCM2835 code, removing the old code paths.
1 parent e03e81f commit b043787

File tree

2 files changed

+5
-43
lines changed

2 files changed

+5
-43
lines changed

drivers/mmc/host/bcm2835-mmc.c

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -684,12 +684,10 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd
684684
}
685685

686686
timeout = jiffies;
687-
#ifdef CONFIG_ARCH_BCM2835
688687
if (!cmd->data && cmd->busy_timeout > 9000)
689688
timeout += DIV_ROUND_UP(cmd->busy_timeout, 1000) * HZ + HZ;
690689
else
691-
#endif
692-
timeout += 10 * HZ;
690+
timeout += 10 * HZ;
693691
mod_timer(&host->timer, timeout);
694692

695693
host->cmd = cmd;
@@ -984,9 +982,6 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id)
984982
struct bcm2835_host *host = dev_id;
985983
u32 intmask, mask, unexpected = 0;
986984
int max_loops = 16;
987-
#ifndef CONFIG_ARCH_BCM2835
988-
int cardint = 0;
989-
#endif
990985

991986
spin_lock(&host->lock);
992987

@@ -1015,13 +1010,9 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id)
10151010
mmc_hostname(host->mmc));
10161011

10171012
if (intmask & SDHCI_INT_CARD_INT) {
1018-
#ifndef CONFIG_ARCH_BCM2835
1019-
cardint = 1;
1020-
#else
10211013
bcm2835_mmc_enable_sdio_irq_nolock(host, false);
10221014
host->thread_isr |= SDHCI_INT_CARD_INT;
10231015
result = IRQ_WAKE_THREAD;
1024-
#endif
10251016
}
10261017

10271018
intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE |
@@ -1048,15 +1039,9 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id)
10481039
bcm2835_mmc_dumpregs(host);
10491040
}
10501041

1051-
#ifndef CONFIG_ARCH_BCM2835
1052-
if (cardint)
1053-
mmc_signal_sdio_irq(host->mmc);
1054-
#endif
1055-
10561042
return result;
10571043
}
10581044

1059-
#ifdef CONFIG_ARCH_BCM2835
10601045
static irqreturn_t bcm2835_mmc_thread_irq(int irq, void *dev_id)
10611046
{
10621047
struct bcm2835_host *host = dev_id;
@@ -1079,7 +1064,6 @@ static irqreturn_t bcm2835_mmc_thread_irq(int irq, void *dev_id)
10791064

10801065
return isr ? IRQ_HANDLED : IRQ_NONE;
10811066
}
1082-
#endif
10831067

10841068

10851069

@@ -1323,13 +1307,14 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host)
13231307

13241308
/* SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK */
13251309
host->timeout_clk = mmc->f_max / 1000;
1326-
#ifdef CONFIG_ARCH_BCM2835
13271310
mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
1328-
#endif
1311+
13291312
/* host controller capabilities */
13301313
mmc->caps = MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | MMC_CAP_SDIO_IRQ |
13311314
MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA;
13321315

1316+
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
1317+
13331318
host->flags = SDHCI_AUTO_CMD23;
13341319

13351320
dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2);
@@ -1377,14 +1362,9 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host)
13771362
init_waitqueue_head(&host->buf_ready_int);
13781363

13791364
bcm2835_mmc_init(host, 0);
1380-
#ifndef CONFIG_ARCH_BCM2835
1381-
ret = devm_request_irq(dev, host->irq, bcm2835_mmc_irq, 0,
1382-
mmc_hostname(mmc), host);
1383-
#else
13841365
ret = devm_request_threaded_irq(dev, host->irq, bcm2835_mmc_irq,
13851366
bcm2835_mmc_thread_irq, IRQF_SHARED,
13861367
mmc_hostname(mmc), host);
1387-
#endif
13881368
if (ret) {
13891369
dev_err(dev, "Failed to request IRQ %d: %d\n", host->irq, ret);
13901370
goto untasklet;

drivers/mmc/host/bcm2835-sdhost.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,9 +1283,7 @@ static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id)
12831283
struct bcm2835_host *host = dev_id;
12841284
u32 unexpected = 0, early = 0;
12851285
int loops = 0;
1286-
#ifndef CONFIG_ARCH_BCM2835
1287-
int cardint = 0;
1288-
#endif
1286+
12891287
spin_lock(&host->lock);
12901288

12911289
for (loops = 0; loops < 1; loops++) {
@@ -1331,13 +1329,9 @@ static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id)
13311329
handled |= bcm2835_sdhost_block_irq(host, intmask);
13321330

13331331
if (intmask & SDHSTS_SDIO_IRPT) {
1334-
#ifndef CONFIG_ARCH_BCM2835
1335-
cardint = 1;
1336-
#else
13371332
bcm2835_sdhost_enable_sdio_irq_nolock(host, false);
13381333
host->thread_isr |= SDHSTS_SDIO_IRPT;
13391334
result = IRQ_WAKE_THREAD;
1340-
#endif
13411335
}
13421336

13431337
unexpected |= (intmask & ~handled);
@@ -1357,15 +1351,9 @@ static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id)
13571351
bcm2835_sdhost_dumpregs(host);
13581352
}
13591353

1360-
#ifndef CONFIG_ARCH_BCM2835
1361-
if (cardint)
1362-
mmc_signal_sdio_irq(host->mmc);
1363-
#endif
1364-
13651354
return result;
13661355
}
13671356

1368-
#ifdef CONFIG_ARCH_BCM2835
13691357
static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id)
13701358
{
13711359
struct bcm2835_host *host = dev_id;
@@ -1390,7 +1378,6 @@ static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id)
13901378

13911379
return isr ? IRQ_HANDLED : IRQ_NONE;
13921380
}
1393-
#endif
13941381

13951382

13961383

@@ -1734,14 +1721,9 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
17341721
(unsigned long)host);
17351722

17361723
bcm2835_sdhost_init(host, 0);
1737-
#ifndef CONFIG_ARCH_BCM2835
1738-
ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/,
1739-
mmc_hostname(mmc), host);
1740-
#else
17411724
ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq,
17421725
bcm2835_sdhost_thread_irq,
17431726
IRQF_SHARED, mmc_hostname(mmc), host);
1744-
#endif
17451727
if (ret) {
17461728
pr_err("%s: failed to request IRQ %d: %d\n",
17471729
mmc_hostname(mmc), host->irq, ret);

0 commit comments

Comments
 (0)