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)
Fri, Apr 5, 9:52 PM
Unknown Object (File)
Thu, Mar 28, 10:40 PM
Unknown Object (File)
Feb 23 2024, 10:10 PM
Unknown Object (File)
Jan 19 2024, 10:18 PM
Unknown Object (File)
Jan 13 2024, 11:21 AM
Unknown Object (File)
Jan 7 2024, 9:36 PM
Unknown Object (File)
Nov 30 2023, 8:40 AM
Unknown Object (File)
Nov 6 2023, 12:35 AM
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.