Re: [PATCH] mmc: tmio: Don't access hardware registers after stopping clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Laurent,

[CC Rafael]

On Tue, Jun 12, 2012 at 9:57 PM, Laurent Pinchart
<laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:
> The tmio_mmc_set_ios() function configures the MMC power, clock and bus
> width. When the MMC controller gets powered off, runtime PM switches the
> MSTP clock off. Writing to to CTL_SD_MEM_CARD_OPT register afterwards
> fails and prints an error message to the kernel log.
>
> As configuring the bus width is pointless when the interface gets
> powered down, skip the operation when power is off.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

First of all, thanks for reporting this issue and coming up with a fix!

Can you please explain a bit more about when this triggers? Is this
related to suspend-to-ram perhaps? Which hardware platform? Is
CONFIG_PM_RUNTIME=y set?

I suspect that this may be a side effect of the current PM code used
on the A1 SoC (which is hooked up on the armadillo board).

In short, the A1 SoC does not yet make use of PM domains, but AP4 and
the mackerel board (sh7372 based) is using PM domains. This difference
may result in different state of clocks at suspend-to-ram timing. So
the SDHI driver may work just fine on the mackerel board, but not on
the armadillo board. If that's the case then perhaps we shouldn't fix
the driver, but instead look at the platform level.

> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 9a7996a..de1226d 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -816,13 +816,15 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>                tmio_mmc_clk_stop(host);
>        }
>
> -       switch (ios->bus_width) {
> -       case MMC_BUS_WIDTH_1:
> -               sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
> -       break;
> -       case MMC_BUS_WIDTH_4:
> -               sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
> -       break;
> +       if (host->power) {
> +               switch (ios->bus_width) {
> +               case MMC_BUS_WIDTH_1:
> +                       sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
> +               break;
> +               case MMC_BUS_WIDTH_4:
> +                       sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
> +               break;
> +               }
>        }
>
>        /* Let things settle. delay taken from winCE driver */
> --
> 1.7.3.4

Is it possible that you get here through tmio_mmc_host_suspend() and
mmc_suspend_host()?

Just guessing. =)

Thanks,

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux