Page MenuHomeFreeBSD

fdt_pinctrl: Add new methods for gpios
ClosedPublic

Authored by manu on Jan 8 2020, 7:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 6:32 AM
Unknown Object (File)
Oct 23 2024, 1:21 AM
Unknown Object (File)
Oct 3 2024, 7:43 AM
Unknown Object (File)
Sep 30 2024, 6:23 PM
Unknown Object (File)
Sep 23 2024, 8:34 PM
Unknown Object (File)
Sep 12 2024, 7:16 PM
Unknown Object (File)
Sep 7 2024, 6:37 PM
Unknown Object (File)
Sep 2 2024, 11:54 PM
Subscribers

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 - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bcr added a subscriber: bcr.

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

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.

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.

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.