Re: [PATCH v4 1/4] mmc: dw_mmc: Invalidate cache of current_speedafter suspend/resume

From: Doug Anderson
Date: Thu Aug 22 2013 - 12:26:01 EST


Seungwon,

On Wed, Aug 21, 2013 at 5:54 PM, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>> Doug, your analysis is right.
>> But, let me suggest another approach.
>> After step #1, core layer actually call mmc_power_off because slot is empthy(get_cd() is '0').
>> Then, set_ios is requested with 'ios->clock'.
>> However, because current implementation doesn't update current_speed in case ios->clock is '0'.
>> It causes current_speed has invalid clock rate in resume of dw-mmc.
>>
>> So, if we can update slot->clock properly, it will be fixed.
>>
>> -static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
>> +static void dw_mci_setup_bus(struct dw_mci_slot *slot)
>> {
>> struct dw_mci *host = slot->host;
>> u32 div;
>> u32 clk_en_a;
>>
>> - if (slot->clock != host->current_speed || force_clkinit) {
>> + if (slot->clock && (slot->clock != host->current_speed)) {
>>
>>
>> @@ -807,13 +807,11 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>
>> mci_writel(slot->host, UHS_REG, regs);
>>
>> - if (ios->clock) {
>> - /*
>> - * Use mirror of ios->clock to prevent race with mmc
>> - * core ios update when finding the minimum.
>> - */
>> - slot->clock = ios->clock;
>> - }
>> + /*
>> + * Use mirror of ios->clock to prevent race with mmc
>> + * core ios update when finding the minimum.
>> + */
>> + slot->clock = ios->clock;
>
> So this scares me a little bit but you're correct that it's probably
> the right thing. Mostly it scares me to remove code that someone
> clearly added on purpose without understanding why they originally
> added it and why that reason is not valid (or is no longer valid due
> to other changes).

OK, I posted up a new patch series. Hopefully this looks good to you.
I did a suspend/resume stress test last night on our chromeos-3.8
branch and things worked well.


> I've come up with a new patch that's a little bit more than just your
> patch. It actually does something in the case of a zero clock (it
> turns the clock off). My patch seems to work OK on my 3.8 branch but
> I want to do a little more testing tomorrow. ...but booting on ToT
> linux seems broken now on the ARM chromebook (it fails in several
> different ways and sometimes works). Sigh.

Somehow this morning ToT linux (same revision) was working much better
on exynos5250-snow. I was able to boot reliably and even
suspend/resume reliably. I think there may be a few niggling issues
that we'll have to track down before too long, though...

-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/