[Letux-kernel] GPIOs and driver removal
H. Nikolaus Schaller
hns at goldelico.com
Tue Nov 20 17:56:28 CET 2018
Hi,
> Am 20.11.2018 um 17:14 schrieb Andreas Kemnade <andreas at kemnade.info>:
>
> Hi,
>
> On Tue, 20 Nov 2018 09:56:46 +0100
> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
>
>> Hi,
>>
>> This is IMHO the cleanest way.
>>
> At least the easiest way.
>
>>> Is the gpio behavior really sane? Shouldn't gpios generally be declared as
>>> input, output or both (and not only the inputenable in the pinmux).
>>> Lots of strange things.
>>
>> This is special for omap. Usually one would expect that a gpio is always
>> input and you declare it to be an output.
>>
>> But on OMAP you can only enable the input by pinmux.
>>
>> The reason seems to be that pinmux and gpio-controller are quite independent
>> functions.
>>
> Yes, and here I am talking about gpio-controller function only and how it
> handled by kernel.
> So who is turning that on/off gpio into an input at driver removal? And why?
Ah, now I get it...
If you remove a driver that has set it to output it is magically turned into an input?
Before devm there was besides gpio_direction_output a gpio_free which probably was to
be called explicitly in the remove function. This should be shrink-wrapped into the
devm_gpio(d) now which might have changed the default behaviour on removal...
>
> [...]
>>> Maybe it is a good idea to touch pinmux as little as possible in uboot, so
>>> most things stay in mode 7.
>>> At least we can then ensure that the kernel dtb is pinmux-complete.
>>> For several things, it still depends now on initialisation by uboot.
>>
>> What is missing? IMHO it is no problem to augment the DTS to define the
>> same thing as u-boot already does. Just to be sure and safe.
>>
> I will go through it and create dtb patches.
>
>> ARAIK, u-boot only sets those pins it needs for its operation and to
>> protect hardware from wrong and power consuming states before the kernel
>> overwrites it for its own purposes.
>>
> set_muxconf_regs
> in board/goldelico/gta04/gta04.c
> The MUX_GTA04 is defined in
> board/goldelico/gta04/gta04.h
>
> It is quite complete. 3.7 kernel relied on it.
Indeed. But I think we have most of them already in DTS without assuming too much
about u-boot setup. Or at least a comment that pinmux may be missing.
So let's see what your review reveals.
BR,
Nikolaus
More information about the Letux-kernel
mailing list