Lines Matching +full:bank +full:- +full:number
1 // SPDX-License-Identifier: GPL-2.0+
4 * (C) Copyright 2010-2012,2015
22 #include <dm/device-internal.h>
23 #include <dt-bindings/gpio/gpio.h>
31 struct gpio_ctlr_bank *bank; member
33 int base_gpio; /* Port number for this port (0, 1,.., n-1) */
36 /* Information about each port at run-time */
38 struct gpio_ctlr_bank *bank; member
39 int base_gpio; /* Port number for this port (0, 1,.., n-1) */
46 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in get_config() local
50 u = readl(&bank->gpio_config[GPIO_PORT(gpio)]); in get_config()
63 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in set_config() local
69 u = readl(&bank->gpio_config[GPIO_PORT(gpio)]); in set_config()
74 writel(u, &bank->gpio_config[GPIO_PORT(gpio)]); in set_config()
77 /* Return GPIO pin 'gpio' direction - 0 = input or 1 = output */
81 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in get_direction() local
85 u = readl(&bank->gpio_dir_out[GPIO_PORT(gpio)]); in get_direction()
98 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in set_direction() local
104 u = readl(&bank->gpio_dir_out[GPIO_PORT(gpio)]); in set_direction()
109 writel(u, &bank->gpio_dir_out[GPIO_PORT(gpio)]); in set_direction()
116 struct gpio_ctlr_bank *bank = &ctlr->gpio_bank[GPIO_BANK(gpio)]; in set_level() local
122 u = readl(&bank->gpio_out[GPIO_PORT(gpio)]); in set_level()
127 writel(u, &bank->gpio_out[GPIO_PORT(gpio)]); in set_level()
140 set_direction(state->base_gpio + offset, DIRECTION_INPUT); in tegra_gpio_direction_input()
143 set_config(state->base_gpio + offset, 1); in tegra_gpio_direction_input()
153 int gpio = state->base_gpio + offset; in tegra_gpio_direction_output()
162 set_config(state->base_gpio + offset, 1); in tegra_gpio_direction_output()
171 int gpio = state->base_gpio + offset; in tegra_gpio_get_value()
178 val = readl(&state->bank->gpio_in[GPIO_PORT(gpio)]); in tegra_gpio_get_value()
180 val = readl(&state->bank->gpio_out[GPIO_PORT(gpio)]); in tegra_gpio_get_value()
189 int gpio = state->base_gpio + offset; in tegra_gpio_set_value()
225 int gpio = state->base_gpio + offset; in tegra_gpio_get_function()
240 gpio = args->args[0]; in tegra_gpio_xlate()
242 ret = device_get_child(dev, port, &desc->dev); in tegra_gpio_xlate()
245 desc->offset = gpio % TEGRA_GPIOS_PER_PORT; in tegra_gpio_xlate()
246 desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0; in tegra_gpio_xlate()
265 * @base_port: Base port number (0, 1..n-1)
285 { .compatible = "nvidia,tegra30-gpio" },
286 { .compatible = "nvidia,tegra20-gpio" },
293 struct tegra_port_info *priv = dev->priv; in gpio_tegra_probe()
294 struct tegra_gpio_platdata *plat = dev->platdata; in gpio_tegra_probe()
300 priv->bank = plat->bank; in gpio_tegra_probe()
301 priv->base_gpio = plat->base_gpio; in gpio_tegra_probe()
303 uc_priv->gpio_count = TEGRA_GPIOS_PER_PORT; in gpio_tegra_probe()
304 uc_priv->bank_name = plat->port_name; in gpio_tegra_probe()
310 * We have a top-level GPIO device with no actual GPIOs. It has a child
315 struct tegra_gpio_platdata *plat = parent->platdata; in gpio_tegra_bind()
318 int bank; in gpio_tegra_bind() local
335 * out the number of GPIO banks in gpio_tegra_bind()
343 return -EINVAL; in gpio_tegra_bind()
346 for (bank = 0; bank < bank_count; bank++) { in gpio_tegra_bind()
356 return -ENOMEM; in gpio_tegra_bind()
357 plat->bank = &ctlr->gpio_bank[bank]; in gpio_tegra_bind()
358 base_port = bank * TEGRA_PORTS_PER_BANK + port; in gpio_tegra_bind()
359 plat->base_gpio = TEGRA_GPIOS_PER_PORT * base_port; in gpio_tegra_bind()
360 plat->port_name = gpio_port_name(base_port); in gpio_tegra_bind()
362 ret = device_bind(parent, parent->driver, in gpio_tegra_bind()
363 plat->port_name, plat, -1, &dev); in gpio_tegra_bind()