Re: [PATCH 3/4 v2] mmc: host: switch OF parser to use gpio descriptors

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

 



On Tue, Sep 30, 2014 at 1:30 PM, Javier Martinez Canillas
<javier@xxxxxxxxxxxx> wrote:
> On Wed, Aug 27, 2014 at 1:00 PM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:

>> This switches the central MMC OF parser to use gpio descriptors
>> instead of grabbing GPIOs explicitly from the device tree.
>> This strips out an unecessary use of the integer-based GPIO
>> API that we want to get rid of, cuts down on code as the
>> gpio descriptor code will handle active low flags.
>>
>> Acked-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
>> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> Card detection is failing in some boards because this patch changes
> some semantics. I tried to come up with a fix but I didn't find an
> obvious way to do it (more on that below).

I think some of this may be weird semantics: the CAP flags in the
MMC subsystem, MMC_CAP2_CD_ACTIVE_HIGH and
MMC_CAP2_RO_ACTIVE_HIGH are somewhat confusing since
the GPIO subsystem nowadays has its own concept of a line
active high or low.

The MMC caps make a lot of sense if the host has dedicated lines
to read CD and WP, and does not use a GPIO for this.

When a GPIO descriptor is in use, the thing gets a bit convoluted:
what if both the GPIO *and* the CAP flag is set to inversion?

So the old code did this with XOR:

        if (explicit_inv_cd ^ gpio_inv_cd)
            host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;

Meaning double inversion -> no inversion.

I guess I was sort of hoping that nobody did this crazy thing.
Turns out I was wrong, so have to restore the old semantics...

I'm sending a patch for you to test.

Yours,
Linus Walleij
--
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