Lines Matching +full:gpio +full:- +full:config
1 // SPDX-License-Identifier: GPL-2.0
5 * Based on drivers/pinctrl/mvebu/pinctrl-mvebu.c and
6 * drivers/gpio/bcm2835_gpio.c
8 * This driver gets instantiated by the GPIO driver, because both devices
14 #include <config.h>
19 #include <dm/device-internal.h>
23 #include <asm/gpio.h>
31 static void bcm2835_gpio_set_func_id(struct udevice *dev, unsigned int gpio, in bcm2835_gpio_set_func_id() argument
38 reg_offset = BCM2835_GPIO_FSEL_BANK(gpio); in bcm2835_gpio_set_func_id()
39 field_offset = BCM2835_GPIO_FSEL_SHIFT(gpio); in bcm2835_gpio_set_func_id()
41 clrsetbits_le32(&priv->base_reg[reg_offset], in bcm2835_gpio_set_func_id()
46 static int bcm2835_gpio_get_func_id(struct udevice *dev, unsigned int gpio) in bcm2835_gpio_get_func_id() argument
51 val = readl(&priv->base_reg[BCM2835_GPIO_FSEL_BANK(gpio)]); in bcm2835_gpio_get_func_id()
53 return (val >> BCM2835_GPIO_FSEL_SHIFT(gpio) & BCM2835_GPIO_FSEL_MASK); in bcm2835_gpio_get_func_id()
59 * @config: the state to be configured.
62 int bcm283x_pinctrl_set_state(struct udevice *dev, struct udevice *config) in bcm283x_pinctrl_set_state() argument
68 if (!dev_read_prop(config, "brcm,pins", &len) || !len || in bcm283x_pinctrl_set_state()
69 len & 0x3 || dev_read_u32_array(config, "brcm,pins", pin_arr, in bcm283x_pinctrl_set_state()
72 config->name, len); in bcm283x_pinctrl_set_state()
73 return -EINVAL; in bcm283x_pinctrl_set_state()
78 function = dev_read_u32_default(config, "brcm,function", -1); in bcm283x_pinctrl_set_state()
81 config->name, function); in bcm283x_pinctrl_set_state()
82 return -EINVAL; in bcm283x_pinctrl_set_state()
95 return -EINVAL; in bcm283x_pinctrl_get_gpio_mux()
101 {.compatible = "brcm,bcm2835-gpio"},
114 return -EINVAL; in bcm283x_pinctl_probe()
117 priv->base_reg = dev_read_addr_ptr(dev); in bcm283x_pinctl_probe()
118 if (priv->base_reg == (void *)FDT_ADDR_T_NONE) { in bcm283x_pinctl_probe()
120 return -EINVAL; in bcm283x_pinctl_probe()
123 /* Create GPIO device as well */ in bcm283x_pinctl_probe()
129 * devices go where they should go, the GPIO controller is in bcm283x_pinctl_probe()
133 printf("Failed to bind GPIO driver\n"); in bcm283x_pinctl_probe()