[PATCH v4] mmc: meson: Add driver for the SD/MMC host found on Amlogic MesonX SoCs

Ulf Hansson ulf.hansson at linaro.org
Wed Feb 3 02:46:06 PST 2016


On 2 February 2016 at 22:54, Carlo Caione <carlo at caione.org> wrote:
> On Tue, Feb 2, 2016 at 12:21 PM, Ulf Hansson <ulf.hansson at linaro.org> wrote:
>> On 1 February 2016 at 23:05, Carlo Caione <carlo at caione.org> wrote:
>>> On Tue, Dec 8, 2015 at 9:35 PM, Ulf Hansson <ulf.hansson at linaro.org> wrote:
>
> [cut]
>
>>> I still fail to see what the correct behaviour should be.
>>> Using the v4 of this driver with a "broken-cd" binding and a timeout
>>> of 10s my SD card takes 30s to be identified as removed after I take
>>> it out from the SD slot.
>>> Also, if I take it out and insert it again, I still have to wait 30s
>>> to be able to access it again. Is this a limitation / bug of my driver
>>> or is this the expected behaviour when we do not have a dedicated GPIO
>>> for card detection?
>>
>> It's *not* an expected a behaviour.
>>
>> Using MMC_CAP_NEEDS_POLL, means that the mmc core will send CMD13
>> commands in a polling manner to find out whether a card has been
>> removed.
>>
>> It seems like when the card is removed, the host driver doesn't get an
>> IRQ which indicates a command timeout. Instead it waits for the 10 s
>> timeout to expire.
>>
>> My question is then; why don't the driver get an IRQ for the command
>> timeout? Is that because of non-correct setup of the IRQ masks or
>> because the controller HW doesn't support this?
>
> I just verified that apparently the HW doesn't support this (no
> register for commands timeout and no IRQ generated).
> Anything wrong with implementing this in software with a timer on
> mrq->data->timeout_ns?

Huh, another broken MMC controller. :-)

In some cases there are no data in the request, it's just a command
being sent. So to deal with this issue, you will have to adjust the
timer depending on the request we send to the controller.

Is there anyway you can find out if there is a card inserted? I
understand you didn't have GPIO, but perhaps you have some internal
mechanism in the controller to for example poll a register to know
this?

Kind regards
Uffe



More information about the linux-arm-kernel mailing list