Lines Matching +full:- +full:gpio +full:- +full:bank
1 // SPDX-License-Identifier: GPL-2.0+
9 #include <asm/gpio.h>
13 static int hi6220_gpio_direction_input(struct udevice *dev, unsigned int gpio) in hi6220_gpio_direction_input() argument
15 struct gpio_bank *bank = dev_get_priv(dev); in hi6220_gpio_direction_input() local
18 data = readb(bank->base + HI6220_GPIO_DIR); in hi6220_gpio_direction_input()
19 data &= ~(1 << gpio); in hi6220_gpio_direction_input()
20 writeb(data, bank->base + HI6220_GPIO_DIR); in hi6220_gpio_direction_input()
25 static int hi6220_gpio_set_value(struct udevice *dev, unsigned gpio, in hi6220_gpio_set_value() argument
28 struct gpio_bank *bank = dev_get_priv(dev); in hi6220_gpio_set_value() local
30 writeb(!!value << gpio, bank->base + (BIT(gpio + 2))); in hi6220_gpio_set_value()
34 static int hi6220_gpio_direction_output(struct udevice *dev, unsigned gpio, in hi6220_gpio_direction_output() argument
37 struct gpio_bank *bank = dev_get_priv(dev); in hi6220_gpio_direction_output() local
40 data = readb(bank->base + HI6220_GPIO_DIR); in hi6220_gpio_direction_output()
41 data |= 1 << gpio; in hi6220_gpio_direction_output()
42 writeb(data, bank->base + HI6220_GPIO_DIR); in hi6220_gpio_direction_output()
44 hi6220_gpio_set_value(dev, gpio, value); in hi6220_gpio_direction_output()
49 static int hi6220_gpio_get_value(struct udevice *dev, unsigned gpio) in hi6220_gpio_get_value() argument
51 struct gpio_bank *bank = dev_get_priv(dev); in hi6220_gpio_get_value() local
53 return !!readb(bank->base + (BIT(gpio + 2))); in hi6220_gpio_get_value()
67 struct gpio_bank *bank = dev_get_priv(dev); in hi6220_gpio_probe() local
69 struct gpio_dev_priv *uc_priv = dev->uclass_priv; in hi6220_gpio_probe()
72 sprintf(name, "GPIO%d_", plat->bank_index); in hi6220_gpio_probe()
76 return -ENOMEM; in hi6220_gpio_probe()
78 uc_priv->bank_name = str; in hi6220_gpio_probe()
79 uc_priv->gpio_count = HI6220_GPIO_PER_BANK; in hi6220_gpio_probe()
81 bank->base = (u8 *)plat->base; in hi6220_gpio_probe()