Lines Matching +full:gpio +full:- +full:bank
4 * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/dt-bindings/pinctrl/ene-kb1200-pinctrl.h>
15 #include <reg/gpio.h>
18 * PINMUX_FUNC_A : GPIO Function
24 * GPIO Alternate Output Function Selection
42 * b[7:5] = pin bank
43 * b[4:0] = pin position in bank
60 static int kb1200_config_pin(uint32_t gpio, uint32_t conf, uint32_t func) in kb1200_config_pin() argument
62 uint32_t port = ENE_KB1200_PINMUX_PORT(gpio); in kb1200_config_pin()
63 uint32_t pin = (uint32_t)ENE_KB1200_PINMUX_PIN(gpio); in kb1200_config_pin()
68 return -EINVAL; in kb1200_config_pin()
71 if (func == PINMUX_FUNC_GPIO) { /* only GPIO function */ in kb1200_config_pin()
72 WRITE_BIT(gpio_regs->GPIOFS, pin, 0); in kb1200_config_pin()
74 func -= 1; /*for change to GPIOALT setting value*/ in kb1200_config_pin()
75 switch (gpio) { in kb1200_config_pin()
77 WRITE_BIT(gcfg_regs->GPIOALT, 0, func); in kb1200_config_pin()
80 gcfg_regs->GPIOMUX = (gcfg_regs->GPIOMUX & ~(3 << 9)) | (func << 9); in kb1200_config_pin()
83 gcfg_regs->GPIOMUX = (gcfg_regs->GPIOMUX & ~(3 << 9)) | (func << 9); in kb1200_config_pin()
86 WRITE_BIT(gcfg_regs->GPIOALT, 1, func); in kb1200_config_pin()
89 WRITE_BIT(gcfg_regs->GPIOALT, 2, func); in kb1200_config_pin()
92 WRITE_BIT(gcfg_regs->GPIOALT, 3, func); in kb1200_config_pin()
95 WRITE_BIT(gcfg_regs->GPIOALT, 4, func); in kb1200_config_pin()
98 WRITE_BIT(gcfg_regs->GPIOALT, 5, func); in kb1200_config_pin()
101 WRITE_BIT(gcfg_regs->GPIOALT, 6, func); in kb1200_config_pin()
104 WRITE_BIT(gcfg_regs->GPIOALT, 7, func); in kb1200_config_pin()
107 WRITE_BIT(gcfg_regs->GPIOALT, 8, func); in kb1200_config_pin()
110 WRITE_BIT(gcfg_regs->GPIOALT, 9, func); in kb1200_config_pin()
113 WRITE_BIT(gpio_regs->GPIOFS, pin, 1); in kb1200_config_pin()
116 WRITE_BIT(gpio_regs->GPIOIE, pin, 1); in kb1200_config_pin()
119 WRITE_BIT(gpio_regs->GPIOPU, pin, 0); in kb1200_config_pin()
120 WRITE_BIT(gpio_regs->GPIOPD, pin, 0); in kb1200_config_pin()
123 WRITE_BIT(gpio_regs->GPIOPU, pin, 1); in kb1200_config_pin()
126 WRITE_BIT(gpio_regs->GPIOPD, pin, 1); in kb1200_config_pin()
130 WRITE_BIT(gpio_regs->GPIOOE, pin, 0); in kb1200_config_pin()
133 WRITE_BIT(gpio_regs->GPIOOE, pin, 1); in kb1200_config_pin()
137 WRITE_BIT(gpio_regs->GPIOD, pin, 0); in kb1200_config_pin()
140 WRITE_BIT(gpio_regs->GPIOD, pin, 1); in kb1200_config_pin()
144 WRITE_BIT(gpio_regs->GPIOOD, pin, 0); in kb1200_config_pin()
147 WRITE_BIT(gpio_regs->GPIOOD, pin, 1); in kb1200_config_pin()
151 WRITE_BIT(gpio_regs->GPIOLV, pin, 1); in kb1200_config_pin()
169 return -EINVAL; in pinctrl_configure_pins()