Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/fdt/fdt_pinctrl_if.m
Show All 30 Lines | |||||
#include <dev/ofw/openfirm.h> | #include <dev/ofw/openfirm.h> | ||||
# | # | ||||
# This is the interface that fdt_pinctrl drivers provide to other drivers. | # This is the interface that fdt_pinctrl drivers provide to other drivers. | ||||
# | # | ||||
INTERFACE fdt_pinctrl; | 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 | # Needed for timestamping device probe/attach calls | ||||
HEADER { | HEADER { | ||||
#include <sys/tslog.h> | #include <sys/tslog.h> | ||||
} | } | ||||
# | # | ||||
# Set pins to the specified configuration. The cfgxref arg is an xref phandle | # Set pins to the specified configuration. The cfgxref arg is an xref phandle | ||||
# to a descendent node (child, grandchild, ...) of the pinctrl device node. | # to a descendent node (child, grandchild, ...) of the pinctrl device node. | ||||
# Returns 0 on success or a standard errno value. | # Returns 0 on success or a standard errno value. | ||||
# | # | ||||
PROLOG { | PROLOG { | ||||
TSENTER2(device_get_name(pinctrl)); | TSENTER2(device_get_name(pinctrl)); | ||||
} | } | ||||
EPILOG { | EPILOG { | ||||
TSEXIT2(device_get_name(pinctrl)); | TSEXIT2(device_get_name(pinctrl)); | ||||
} | } | ||||
METHOD int configure { | METHOD int configure { | ||||
device_t pinctrl; | device_t pinctrl; | ||||
phandle_t cfgxref; | 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; |