Lines Matching +full:int +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0+
20 static int bcm2835_gpio_direction_input(struct udevice *dev, unsigned gpio) in bcm2835_gpio_direction_input()
22 struct bcm2835_gpios *gpios = dev_get_priv(dev); in bcm2835_gpio_direction_input() local
25 val = readl(&gpios->reg->gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]); in bcm2835_gpio_direction_input()
28 writel(val, &gpios->reg->gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]); in bcm2835_gpio_direction_input()
33 static int bcm2835_gpio_direction_output(struct udevice *dev, unsigned int gpio, in bcm2835_gpio_direction_output()
34 int value) in bcm2835_gpio_direction_output()
36 struct bcm2835_gpios *gpios = dev_get_priv(dev); in bcm2835_gpio_direction_output() local
41 val = readl(&gpios->reg->gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]); in bcm2835_gpio_direction_output()
44 writel(val, &gpios->reg->gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]); in bcm2835_gpio_direction_output()
49 static int bcm2835_get_value(const struct bcm2835_gpios *gpios, unsigned gpio) in bcm2835_get_value() argument
53 val = readl(&gpios->reg->gplev[BCM2835_GPIO_COMMON_BANK(gpio)]); in bcm2835_get_value()
58 static int bcm2835_gpio_get_value(struct udevice *dev, unsigned gpio) in bcm2835_gpio_get_value()
60 const struct bcm2835_gpios *gpios = dev_get_priv(dev); in bcm2835_gpio_get_value() local
62 return bcm2835_get_value(gpios, gpio); in bcm2835_gpio_get_value()
65 static int bcm2835_gpio_set_value(struct udevice *dev, unsigned gpio, in bcm2835_gpio_set_value()
66 int value) in bcm2835_gpio_set_value()
68 struct bcm2835_gpios *gpios = dev_get_priv(dev); in bcm2835_gpio_set_value() local
69 u32 *output_reg = value ? gpios->reg->gpset : gpios->reg->gpclr; in bcm2835_gpio_set_value()
77 static int bcm2835_gpio_get_function(struct udevice *dev, unsigned offset) in bcm2835_gpio_get_function()
80 int funcid; in bcm2835_gpio_get_function()
82 funcid = pinctrl_get_gpio_mux(priv->pinctrl, 0, offset); in bcm2835_gpio_get_function()
102 static int bcm2835_gpio_probe(struct udevice *dev) in bcm2835_gpio_probe()
104 struct bcm2835_gpios *gpios = dev_get_priv(dev); in bcm2835_gpio_probe() local
108 uc_priv->bank_name = "GPIO"; in bcm2835_gpio_probe()
109 uc_priv->gpio_count = BCM2835_GPIO_COUNT; in bcm2835_gpio_probe()
110 gpios->reg = (struct bcm2835_gpio_regs *)plat->base; in bcm2835_gpio_probe()
113 gpios->pinctrl = dev->parent; in bcm2835_gpio_probe()
119 static int bcm2835_gpio_ofdata_to_platdata(struct udevice *dev) in bcm2835_gpio_ofdata_to_platdata()
126 return -EINVAL; in bcm2835_gpio_ofdata_to_platdata()
128 plat->base = addr; in bcm2835_gpio_ofdata_to_platdata()