mmc: tmio_mmc: do not enable card hotplug interrupts, if unused
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 22 Feb 2012 12:16:09 +0000 (13:16 +0100)
committerChris Ball <cjb@laptop.org>
Tue, 27 Mar 2012 16:20:02 +0000 (12:20 -0400)
If TMIO MMC is used in polling mode, or the card is non-removable, or
card-detection is performed, using an external interrupt, there is no
need to enable controller native card hotplug interrupts.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/tmio_mmc_pio.c

index e21988901c367082f9fabb59eccb3b821b4b5843..5444d533322c845cd2e1e10b0d99ba4ae0a30511 100644 (file)
@@ -304,6 +304,7 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
 {
        struct mmc_data *data = host->data;
        int c = cmd->opcode;
+       u32 irq_mask = TMIO_MASK_CMD;
 
        /* Command 12 is handled by hardware */
        if (cmd->opcode == 12 && !cmd->arg) {
@@ -339,7 +340,9 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
                        c |= TRANSFER_READ;
        }
 
-       tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_CMD);
+       if (!host->native_hotplug)
+               irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
+       tmio_mmc_enable_mmc_irqs(host, irq_mask);
 
        /* Fire off the command */
        sd_ctrl_write32(host, CTL_ARG_REG, cmd->arg);
@@ -963,6 +966,8 @@ int __devinit tmio_mmc_host_probe(struct tmio_mmc_host **host,
                irq_mask |= TMIO_MASK_READOP;
        if (!_host->chan_tx)
                irq_mask |= TMIO_MASK_WRITEOP;
+       if (!_host->native_hotplug)
+               irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
 
        tmio_mmc_enable_mmc_irqs(_host, irq_mask);