Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ properties:
- nvidia,tegra194-gpio-aon
- nvidia,tegra234-gpio
- nvidia,tegra234-gpio-aon
- nvidia,tegra256-gpio

reg-names:
items:
Expand Down Expand Up @@ -155,6 +156,7 @@ allOf:
- nvidia,tegra186-gpio
- nvidia,tegra194-gpio
- nvidia,tegra234-gpio
- nvidia,tegra256-gpio
then:
properties:
interrupts:
Expand Down
34 changes: 32 additions & 2 deletions drivers/gpio/gpio-tegra186.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <dt-bindings/gpio/tegra194-gpio.h>
#include <dt-bindings/gpio/tegra234-gpio.h>
#include <dt-bindings/gpio/tegra241-gpio.h>
#include <dt-bindings/gpio/tegra256-gpio.h>

/* security registers */
#define TEGRA186_GPIO_CTL_SCR 0x0c
Expand Down Expand Up @@ -108,6 +109,7 @@ struct tegra_gpio_soc {
const struct tegra_gpio_port *ports;
unsigned int num_ports;
const char *name;
const char *prefix;
unsigned int instance;

unsigned int num_irqs_per_bank;
Expand Down Expand Up @@ -939,8 +941,12 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
char *name;

for (j = 0; j < port->pins; j++) {
name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL,
"P%s.%02x", port->name, j);
if (gpio->soc->prefix)
name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "%s-P%s.%02x",
gpio->soc->prefix, port->name, j);
else
name = devm_kasprintf(gpio->gpio.parent, GFP_KERNEL, "P%s.%02x",
port->name, j);
if (!name)
return -ENOMEM;

Expand Down Expand Up @@ -1271,6 +1277,25 @@ static const struct tegra_gpio_soc tegra241_aon_soc = {
.has_vm_support = false,
};

#define TEGRA256_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
TEGRA_GPIO_PORT(TEGRA256_MAIN, _name, _bank, _port, _pins)

static const struct tegra_gpio_port tegra256_main_ports[] = {
TEGRA256_MAIN_GPIO_PORT(A, 0, 0, 8),
TEGRA256_MAIN_GPIO_PORT(B, 0, 1, 8),
TEGRA256_MAIN_GPIO_PORT(C, 0, 2, 8),
TEGRA256_MAIN_GPIO_PORT(D, 0, 3, 8),
};

static const struct tegra_gpio_soc tegra256_main_soc = {
.num_ports = ARRAY_SIZE(tegra256_main_ports),
.ports = tegra256_main_ports,
.name = "tegra256-gpio-main",
.instance = 1,
.num_irqs_per_bank = 8,
.has_vm_support = true,
};

#define TEGRA410_COMPUTE_GPIO_PORT(_name, _bank, _port, _pins) \
TEGRA_GPIO_PORT(TEGRA410_COMPUTE, _name, _bank, _port, _pins)

Expand All @@ -1286,6 +1311,7 @@ static const struct tegra_gpio_soc tegra410_compute_soc = {
.num_ports = ARRAY_SIZE(tegra410_compute_ports),
.ports = tegra410_compute_ports,
.name = "tegra410-gpio-compute",
.prefix = "COMPUTE",
.num_irqs_per_bank = 8,
.instance = 0,
};
Expand Down Expand Up @@ -1315,6 +1341,7 @@ static const struct tegra_gpio_soc tegra410_system_soc = {
.num_ports = ARRAY_SIZE(tegra410_system_ports),
.ports = tegra410_system_ports,
.name = "tegra410-gpio-system",
.prefix = "SYSTEM",
.num_irqs_per_bank = 8,
.instance = 0,
};
Expand All @@ -1338,6 +1365,9 @@ static const struct of_device_id tegra186_gpio_of_match[] = {
}, {
.compatible = "nvidia,tegra234-gpio-aon",
.data = &tegra234_aon_soc
}, {
.compatible = "nvidia,tegra256-gpio",
.data = &tegra256_main_soc
}, {
/* sentinel */
}
Expand Down
28 changes: 28 additions & 0 deletions include/dt-bindings/gpio/tegra256-gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. */

/*
* This header provides constants for the nvidia,tegra256-gpio DT binding.
*
* The first cell in Tegra's GPIO specifier is the GPIO ID.
* The macros below provide names for this.
*
* The second cell contains standard flag values specified in gpio.h.
*/

#ifndef _DT_BINDINGS_GPIO_TEGRA256_GPIO_H
#define _DT_BINDINGS_GPIO_TEGRA256_GPIO_H

#include <dt-bindings/gpio/gpio.h>

/* GPIOs implemented by main GPIO controller */
#define TEGRA256_MAIN_GPIO_PORT_A 0
#define TEGRA256_MAIN_GPIO_PORT_B 1
#define TEGRA256_MAIN_GPIO_PORT_C 2
#define TEGRA256_MAIN_GPIO_PORT_D 3

#define TEGRA256_MAIN_GPIO(port, offset) \
((TEGRA256_MAIN_GPIO_PORT_##port * 8) + (offset))

#endif