Skip to content

Commit af9b4a5

Browse files
Prathamesh SheteBartosz Golaszewski
authored andcommitted
gpio: tegra186: Add support for Tegra264
Extend the existing Tegra186 GPIO controller driver with support for the GPIO controller found on Tegra264. Use the "wakeup-parent" phandle from the GPIO device tree node to ensure the GPIO driver associates with the intended PMC device. Relying only on compatible-based lookup can select an unexpected PMC node, so fall back to compatible-based lookup when the phandle is not present. Signed-off-by: Prathamesh Shete <pshete@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Link: https://patch.msgid.link/20260128085114.1137725-2-pshete@nvidia.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent b565717 commit af9b4a5

1 file changed

Lines changed: 88 additions & 2 deletions

File tree

drivers/gpio/gpio-tegra186.c

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (c) 2016-2025 NVIDIA Corporation
3+
* Copyright (c) 2016-2026 NVIDIA Corporation
44
*
55
* Author: Thierry Reding <treding@nvidia.com>
66
* Dipen Patel <dpatel@nvidia.com>
@@ -21,6 +21,7 @@
2121
#include <dt-bindings/gpio/tegra234-gpio.h>
2222
#include <dt-bindings/gpio/tegra241-gpio.h>
2323
#include <dt-bindings/gpio/tegra256-gpio.h>
24+
#include <dt-bindings/gpio/nvidia,tegra264-gpio.h>
2425

2526
/* security registers */
2627
#define TEGRA186_GPIO_CTL_SCR 0x0c
@@ -1001,7 +1002,9 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
10011002
if (gpio->soc->num_irqs_per_bank > 1)
10021003
tegra186_gpio_init_route_mapping(gpio);
10031004

1004-
np = of_find_matching_node(NULL, tegra186_pmc_of_match);
1005+
np = of_parse_phandle(pdev->dev.of_node, "wakeup-parent", 0);
1006+
if (!np)
1007+
np = of_find_matching_node(NULL, tegra186_pmc_of_match);
10051008
if (np) {
10061009
if (of_device_is_available(np)) {
10071010
irq->parent_domain = irq_find_host(np);
@@ -1277,6 +1280,80 @@ static const struct tegra_gpio_soc tegra241_aon_soc = {
12771280
.has_vm_support = false,
12781281
};
12791282

1283+
#define TEGRA264_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
1284+
TEGRA_GPIO_PORT(TEGRA264_MAIN, _name, _bank, _port, _pins)
1285+
1286+
static const struct tegra_gpio_port tegra264_main_ports[] = {
1287+
TEGRA264_MAIN_GPIO_PORT(F, 3, 0, 8),
1288+
TEGRA264_MAIN_GPIO_PORT(G, 3, 1, 5),
1289+
TEGRA264_MAIN_GPIO_PORT(H, 1, 0, 8),
1290+
TEGRA264_MAIN_GPIO_PORT(J, 1, 1, 8),
1291+
TEGRA264_MAIN_GPIO_PORT(K, 1, 2, 8),
1292+
TEGRA264_MAIN_GPIO_PORT(L, 1, 3, 8),
1293+
TEGRA264_MAIN_GPIO_PORT(M, 1, 4, 6),
1294+
TEGRA264_MAIN_GPIO_PORT(P, 2, 0, 8),
1295+
TEGRA264_MAIN_GPIO_PORT(Q, 2, 1, 8),
1296+
TEGRA264_MAIN_GPIO_PORT(R, 2, 2, 8),
1297+
TEGRA264_MAIN_GPIO_PORT(S, 2, 3, 2),
1298+
TEGRA264_MAIN_GPIO_PORT(T, 0, 0, 7),
1299+
TEGRA264_MAIN_GPIO_PORT(U, 0, 1, 8),
1300+
TEGRA264_MAIN_GPIO_PORT(V, 0, 2, 8),
1301+
TEGRA264_MAIN_GPIO_PORT(W, 0, 3, 8),
1302+
TEGRA264_MAIN_GPIO_PORT(X, 0, 7, 6),
1303+
TEGRA264_MAIN_GPIO_PORT(Y, 0, 5, 8),
1304+
TEGRA264_MAIN_GPIO_PORT(Z, 0, 6, 8),
1305+
TEGRA264_MAIN_GPIO_PORT(AL, 0, 4, 3),
1306+
};
1307+
1308+
static const struct tegra_gpio_soc tegra264_main_soc = {
1309+
.num_ports = ARRAY_SIZE(tegra264_main_ports),
1310+
.ports = tegra264_main_ports,
1311+
.name = "tegra264-gpio",
1312+
.instance = 0,
1313+
.num_irqs_per_bank = 8,
1314+
.has_vm_support = true,
1315+
};
1316+
1317+
#define TEGRA264_AON_GPIO_PORT(_name, _bank, _port, _pins) \
1318+
TEGRA_GPIO_PORT(TEGRA264_AON, _name, _bank, _port, _pins)
1319+
1320+
static const struct tegra_gpio_port tegra264_aon_ports[] = {
1321+
TEGRA264_AON_GPIO_PORT(AA, 0, 0, 8),
1322+
TEGRA264_AON_GPIO_PORT(BB, 0, 1, 2),
1323+
TEGRA264_AON_GPIO_PORT(CC, 0, 2, 8),
1324+
TEGRA264_AON_GPIO_PORT(DD, 0, 3, 8),
1325+
TEGRA264_AON_GPIO_PORT(EE, 0, 4, 4)
1326+
};
1327+
1328+
static const struct tegra_gpio_soc tegra264_aon_soc = {
1329+
.num_ports = ARRAY_SIZE(tegra264_aon_ports),
1330+
.ports = tegra264_aon_ports,
1331+
.name = "tegra264-gpio-aon",
1332+
.instance = 1,
1333+
.num_irqs_per_bank = 8,
1334+
.has_vm_support = true,
1335+
};
1336+
1337+
#define TEGRA264_UPHY_GPIO_PORT(_name, _bank, _port, _pins) \
1338+
TEGRA_GPIO_PORT(TEGRA264_UPHY, _name, _bank, _port, _pins)
1339+
1340+
static const struct tegra_gpio_port tegra264_uphy_ports[] = {
1341+
TEGRA264_UPHY_GPIO_PORT(A, 0, 0, 6),
1342+
TEGRA264_UPHY_GPIO_PORT(B, 0, 1, 8),
1343+
TEGRA264_UPHY_GPIO_PORT(C, 0, 2, 3),
1344+
TEGRA264_UPHY_GPIO_PORT(D, 1, 0, 8),
1345+
TEGRA264_UPHY_GPIO_PORT(E, 1, 1, 4),
1346+
};
1347+
1348+
static const struct tegra_gpio_soc tegra264_uphy_soc = {
1349+
.num_ports = ARRAY_SIZE(tegra264_uphy_ports),
1350+
.ports = tegra264_uphy_ports,
1351+
.name = "tegra264-gpio-uphy",
1352+
.instance = 2,
1353+
.num_irqs_per_bank = 8,
1354+
.has_vm_support = true,
1355+
};
1356+
12801357
#define TEGRA256_MAIN_GPIO_PORT(_name, _bank, _port, _pins) \
12811358
TEGRA_GPIO_PORT(TEGRA256_MAIN, _name, _bank, _port, _pins)
12821359

@@ -1368,6 +1445,15 @@ static const struct of_device_id tegra186_gpio_of_match[] = {
13681445
}, {
13691446
.compatible = "nvidia,tegra256-gpio",
13701447
.data = &tegra256_main_soc
1448+
}, {
1449+
.compatible = "nvidia,tegra264-gpio",
1450+
.data = &tegra264_main_soc
1451+
}, {
1452+
.compatible = "nvidia,tegra264-gpio-aon",
1453+
.data = &tegra264_aon_soc
1454+
}, {
1455+
.compatible = "nvidia,tegra264-gpio-uphy",
1456+
.data = &tegra264_uphy_soc
13711457
}, {
13721458
/* sentinel */
13731459
}

0 commit comments

Comments
 (0)