[PATCH] mmc: mmci: Improve runtime PM support
ulf.hansson at stericsson.com
Mon Oct 24 05:36:01 EDT 2011
Russell King - ARM Linux wrote:
> On Mon, Oct 24, 2011 at 10:05:30AM +0200, Ulf Hansson wrote:
>> Sebastian Rasmussen wrote:
>>>> Err, no. You're not allowed to power down the card between commands
>>>> unless the card has been removed or been has finished with.
>>>> If you power down the card (which you _are_ doing by writing zero to
>>>> the MMCIPOWER register), then you have to do a full setup of the card
>>>> when you resume.
>>> MCIPower is according to ARM PL180 TRM signalling to an external power
>>> supply to turn on/off (MCIPWR), whether to use open-drain (MCIROD),
>>> what voltage to use (MCIVDD) and whether the card is clocked (MCICLK).
>>> According ST-Ericsson's public PL180 derivative spec it seems to work
>>> roughly in same way (but renaming the register SDI_PWR and the signals
>>> SDIPWR & SDICLK). However, there is no SDIVDD as the derivative can not
>>> signal desired voltage level externally (there are no bits in SDI_PWR for this).
>>> This makes it plausible that SDIPWR may not be routed externally either.
>>> Can you verify this as there are no signal routing diagrams in the spec..?
>> The hole idea with this PM patch is to make sure the vcore regulator and
>> the clock are disabled in runtime_suspend to be able to save a huge
>> amount of current in "idle" mode.
>> Disabling the vcore regulator will sooner or later (depending on your
>> regulator tree) mean that that power to the controller is actually cut,
>> which then means that all registers will be "cleared" including the
>> MCIPWR. So the actual reason for clearing the registers in the
>> runtime_suspend function is because of two reasons.
>> 1. Set the controller in a known state so no "magic" things happens when
>> we are runtime suspended, for example getting an IRQ.
>> 2. Save power by disabling the clock etc. The actual power to the
>> controller does not have to be cut just because we have disabled the
>> vore regulator.
>> If the ARM PL180 TRM prevent us from from doing this kind of operations
>> in runtime_suspend, we must think of an alternative solution which just
>> apply for ST-Ericssons derivative of PL180. THIS IS VERY IMPORTANT to be
>> able to implement a proper power management solution.
>> Please check this Russell, this is VERY IMPORTANT!
> I repeat: if you cut power to the card, you have to re-initialize it.
> Re-initialization takes quite a bit of time to re-detect and setup
> the card. You'd also need to re-configure things like the transfer
> mode and so forth.
Right now host->vcc (vmmc) regulator is controlling the power to card.
Not the MCIPWR register!
It is possible for ARM PL180 trm (not for STE version) to use MCIPWR to
control some external regulator. But right now, this is not used
according the code and it also feels like a very strange setup.
I would be very surprised if any hardware has this kind of setup, that
the PL180 itself controls a regulator.
> The other problem is if you're doing runtime-pm between commands,
> the re-initialization takes multiple commands - we don't want to be
> in the middle of a reinitialization while we're also doing something
> with runtime-pm - nested initialization would not be a nice problem
> to solve.
You do not have to re-init the card as long at is still powered. It is
just a matter of restoring register values. This is really quick. But at
the same time, we do not want to do it for every request thus we use
timeout of 50 ms.
More information about the linux-arm-kernel