Page MenuHomeFreeBSD

fdt_pinctrl: Add new methods for gpios
ClosedPublic

Authored by manu on Jan 8 2020, 7:26 PM.

Details

Summary

Most of the gpio controller cannot configure or get the configuration
of the pin muxing as it's usually handled in the pinctrl driver.
But they can know what is the pinmuxing driver either because they are
child of it or via the gpio-range property.
Add some new methods to fdt_pinctrl that a pin controller can implement.
Some methods are :
fdt_pinctrl_is_gpio: Use to know if the pin in the gpio mode
fdt_pinctrl_set_flags: Set the flags of the pin (pullup/pulldown etc ...)
fdt_pinctrl_get_flags: Get the flags of the pin (pullup/pulldown etc ...)

The defaults method returns EOPNOTSUPP.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

manu created this revision.Jan 8 2020, 7:26 PM
bcr accepted this revision as: manpages.Jan 8 2020, 9:19 PM
bcr added a subscriber: bcr.

OK from manpages (can't say much about the actual code).

ian added a comment.Jan 14 2020, 4:41 AM

What kind of flags go into the flags arg? I suspect the quick answer is GPIO flags. The more complete answer is probably "some subset of gpio flags which differs from one device to another". That leads to the question of what to do on an attempt to set multiple flags where some are supported and some aren't.

manu added a comment.Jan 14 2020, 10:02 AM
In D23093#507777, @ian wrote:

What kind of flags go into the flags arg? I suspect the quick answer is GPIO flags. The more complete answer is probably "some subset of gpio flags which differs from one device to another". That leads to the question of what to do on an attempt to set multiple flags where some are supported and some aren't.

gpiobus removes the unsupported caps silently using what GPIO_GET_CAPS returns so we could do the same by adding a fdt_pinctrl_get_caps method, or just silently ignore unsupported caps in the fdt_pinctrl_set_flags method.

ian accepted this revision.Jan 16 2020, 8:55 PM

After some discussion on irc we realized we don't need a get-capabilities interface between gpio and pinctrl, because both are soc-specific drivers, and the gpio driver already "knows" what capabilities the soc has.

Responsibility for error checking of supported flags is hand-wavingly dismissed as a problem to be solved at higher layers than this (probably gpiobus common code).

This revision is now accepted and ready to land.Jan 16 2020, 8:55 PM
This revision was automatically updated to reflect the committed changes.