Lines Matching +full:bank +full:- +full:name
3 * (C) Copyright 2010-2012,2015
6 * SPDX-License-Identifier: GPL-2.0+
23 #include <dm/device-internal.h>
24 #include <dt-bindings/gpio/gpio.h>
34 struct gpio_ctlr_bank *bank; member
35 const char *port_name; /* Name of port, e.g. "B" */
36 int base_gpio; /* Port number for this port (0, 1,.., n-1) */
39 /* Information about each port at run-time */
41 struct gpio_ctlr_bank *bank; member
42 int base_gpio; /* Port number for this port (0, 1,.., n-1) */
49 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in get_config() local
53 u = readl(&bank->gpio_config[GPIO_PORT(gpio)]); in get_config()
66 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in set_config() local
72 u = readl(&bank->gpio_config[GPIO_PORT(gpio)]); in set_config()
77 writel(u, &bank->gpio_config[GPIO_PORT(gpio)]); in set_config()
80 /* Return GPIO pin 'gpio' direction - 0 = input or 1 = output */
84 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in get_direction() local
88 u = readl(&bank->gpio_dir_out[GPIO_PORT(gpio)]); in get_direction()
101 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in set_direction() local
107 u = readl(&bank->gpio_dir_out[GPIO_PORT(gpio)]); in set_direction()
112 writel(u, &bank->gpio_dir_out[GPIO_PORT(gpio)]); in set_direction()
119 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in set_level() local
125 u = readl(&bank->gpio_out[GPIO_PORT(gpio)]); in set_level()
130 writel(u, &bank->gpio_out[GPIO_PORT(gpio)]); in set_level()
143 set_direction(state->base_gpio + offset, DIRECTION_INPUT); in tegra_gpio_direction_input()
146 set_config(state->base_gpio + offset, 1); in tegra_gpio_direction_input()
156 int gpio = state->base_gpio + offset; in tegra_gpio_direction_output()
165 set_config(state->base_gpio + offset, 1); in tegra_gpio_direction_output()
174 int gpio = state->base_gpio + offset; in tegra_gpio_get_value()
181 val = readl(&state->bank->gpio_in[GPIO_PORT(gpio)]); in tegra_gpio_get_value()
183 val = readl(&state->bank->gpio_out[GPIO_PORT(gpio)]); in tegra_gpio_get_value()
192 int gpio = state->base_gpio + offset; in tegra_gpio_set_value()
228 int gpio = state->base_gpio + offset; in tegra_gpio_get_function()
243 gpio = args->args[0]; in tegra_gpio_xlate()
245 ret = device_get_child(dev, port, &desc->dev); in tegra_gpio_xlate()
248 desc->offset = gpio % TEGRA_GPIOS_PER_PORT; in tegra_gpio_xlate()
249 desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0; in tegra_gpio_xlate()
264 * Returns the name of a GPIO port
268 * @base_port: Base port number (0, 1..n-1)
269 * @return allocated string containing the name
273 char *name, *s; in gpio_port_name() local
275 name = malloc(3); in gpio_port_name()
276 if (name) { in gpio_port_name()
277 s = name; in gpio_port_name()
280 *s++ = *name; in gpio_port_name()
284 return name; in gpio_port_name()
288 { .compatible = "nvidia,tegra30-gpio" },
289 { .compatible = "nvidia,tegra20-gpio" },
296 struct tegra_port_info *priv = dev->priv; in gpio_tegra_probe()
297 struct tegra_gpio_platdata *plat = dev->platdata; in gpio_tegra_probe()
303 priv->bank = plat->bank; in gpio_tegra_probe()
304 priv->base_gpio = plat->base_gpio; in gpio_tegra_probe()
306 uc_priv->gpio_count = TEGRA_GPIOS_PER_PORT; in gpio_tegra_probe()
307 uc_priv->bank_name = plat->port_name; in gpio_tegra_probe()
313 * We have a top-level GPIO device with no actual GPIOs. It has a child
318 struct tegra_gpio_platdata *plat = parent->platdata; in gpio_tegra_bind()
321 int bank; in gpio_tegra_bind() local
346 return -EINVAL; in gpio_tegra_bind()
349 for (bank = 0; bank < bank_count; bank++) { in gpio_tegra_bind()
359 return -ENOMEM; in gpio_tegra_bind()
360 plat->bank = &ctlr->gpio_bank[bank]; in gpio_tegra_bind()
361 base_port = bank * TEGRA_PORTS_PER_BANK + port; in gpio_tegra_bind()
362 plat->base_gpio = TEGRA_GPIOS_PER_PORT * base_port; in gpio_tegra_bind()
363 plat->port_name = gpio_port_name(base_port); in gpio_tegra_bind()
365 ret = device_bind(parent, parent->driver, in gpio_tegra_bind()
366 plat->port_name, plat, -1, &dev); in gpio_tegra_bind()
377 .name = "gpio_tegra",