Index: head/share/man/man9/fdt_pinctrl.9 =================================================================== --- head/share/man/man9/fdt_pinctrl.9 +++ head/share/man/man9/fdt_pinctrl.9 @@ -125,6 +125,36 @@ } static int +foo_is_gpio(device_t dev, device_t gpiodev, bool *is_gpio) +{ + return (foo_is_pin_func_gpio(is_gpio)); +} + +static int +foo_set_flags(device_t dev, device_t gpiodev, uint32_t pin, uint32_t flags) +{ + int rv; + + rv = foo_is_pin_func_gpio(is_gpio); + if (rv != 0) + return (rv); + foo_set_flags(pin, flags); + return (0); +} + +static int +foo_get_flags(device_t dev, device_t gpiodev, uint32_t pin, uint32_t *flags) +{ + int rv; + + rv = foo_is_pin_func_gpio(is_gpio); + if (rv != 0) + return (rv); + foo_get_flags(pin, flags); + return (0); +} + +static int foo_attach(device_t dev) { ... @@ -144,6 +174,9 @@ /* fdt_pinctrl interface */ DEVMETHOD(fdt_pinctrl_configure, foo_configure_pins), + DEVMETHOD(fdt_pinctrl_is_gpio, foo_is_gpio), + DEVMETHOD(fdt_pinctrl_set_flags, foo_set_flags), + DEVMETHOD(fdt_pinctrl_get_flags, foo_get_flags), /* Terminate method list */ DEVMETHOD_END Index: head/sys/dev/fdt/fdt_pinctrl_if.m =================================================================== --- head/sys/dev/fdt/fdt_pinctrl_if.m +++ head/sys/dev/fdt/fdt_pinctrl_if.m @@ -36,6 +36,31 @@ INTERFACE fdt_pinctrl; +CODE { + static int + fdt_pinctrl_default_is_gpio(device_t pinctrl, device_t gpio, bool *is_gpio) + { + + return (EOPNOTSUPP); + } + + static int + fdt_pinctrl_default_set_flags(device_t pinctrl, device_t gpio, uint32_t pin, + uint32_t flags) + { + + return (EOPNOTSUPP); + } + + static int + fdt_pinctrl_default_get_flags(device_t pinctrl, device_t gpio, uint32_t pin, + uint32_t *flags) + { + + return (EOPNOTSUPP); + } +}; + # Needed for timestamping device probe/attach calls HEADER { #include @@ -57,3 +82,36 @@ phandle_t cfgxref; }; + +# +# Test if the pin is in gpio mode +# Called from a gpio device +# +METHOD int is_gpio { + device_t pinctrl; + device_t gpio; + uint32_t pin; + bool *is_gpio; +} DEFAULT fdt_pinctrl_default_is_gpio; + +# +# Set the flags of a pin +# Called from a gpio device +# +METHOD int set_flags { + device_t pinctrl; + device_t gpio; + uint32_t pin; + uint32_t flags; +} DEFAULT fdt_pinctrl_default_set_flags; + +# +# Get the flags of a pin +# Called from a gpio device +# +METHOD int get_flags { + device_t pinctrl; + device_t gpio; + uint32_t pin; + uint32_t *flags; +} DEFAULT fdt_pinctrl_default_get_flags;