gpio: tegra186: Add support for Tegra241
Subsystems (3)
cover gpio: tegra186: Add support for Tegra241
From: Thierry Reding <[email protected]>
Hi,
this is another extension of the Tegra186 GPIO driver, this time for the upcoming Tegra241 (Grace) chip. Note that while this adds the DT binding header, it doesn't actually define a new DT compatible string because it is unlikely that the Tegra241 will ever boot using DT but will use ACPI instead.
The pin definitions are still in the "DT binding" header for consistency with previous chips. Just wanted to highlight this to preempt questions as to why I haven't Cc'ed Rob or the devicetree mailing list.
Thierry
Akhil R (2):
dt-bindings: gpio: Add Tegra241 support
gpio: tegra186: Add support for Tegra241
drivers/gpio/gpio-tegra186.c | 52 ++++++++++++++++++++++++ include/dt-bindings/gpio/tegra241-gpio.h | 42 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 include/dt-bindings/gpio/tegra241-gpio.h
Signature · 1 line
2.34.1
PATCH 1/2 dt-bindings: gpio: Add Tegra241 support
From: Akhil R <[email protected]>
Add the port definitions for the main and AON GPIO controllers found on Tegra241 (Grace).
--- include/dt-bindings/gpio/tegra241-gpio.h | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 include/dt-bindings/gpio/tegra241-gpio.h
include/dt-bindings/gpio/tegra241-gpio.h new file +42 -0
@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. */ + +/* +* This header provides constants for the nvidia,tegra241-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_TEGRA241_GPIO_H +#define _DT_BINDINGS_GPIO_TEGRA241_GPIO_H + +#include <dt-bindings/gpio/gpio.h> + +/* GPIOs implemented by main GPIO controller */ +#define TEGRA241_MAIN_GPIO_PORT_A 0 +#define TEGRA241_MAIN_GPIO_PORT_B 1 +#define TEGRA241_MAIN_GPIO_PORT_C 2 +#define TEGRA241_MAIN_GPIO_PORT_D 3 +#define TEGRA241_MAIN_GPIO_PORT_E 4 +#define TEGRA241_MAIN_GPIO_PORT_F 5 +#define TEGRA241_MAIN_GPIO_PORT_G 6 +#define TEGRA241_MAIN_GPIO_PORT_H 7 +#define TEGRA241_MAIN_GPIO_PORT_I 8 +#define TEGRA241_MAIN_GPIO_PORT_J 9 +#define TEGRA241_MAIN_GPIO_PORT_K 10 +#define TEGRA241_MAIN_GPIO_PORT_L 11 + +#define TEGRA241_MAIN_GPIO (port, offset) \ + ((TEGRA241_MAIN_GPIO_PORT_##port * 8) + (offset)) + +/* GPIOs implemented by AON GPIO controller */ +#define TEGRA241_AON_GPIO_PORT_AA 0 +#define TEGRA241_AON_GPIO_PORT_BB 1 + +#define TEGRA241_AON_GPIO (port, offset) \ + ((TEGRA241_AON_GPIO_PORT_##port * 8) + (offset)) + +#endif
Signature · 1 line
2.34.1
PATCH 2/2 gpio: tegra186: Add support for Tegra241
In reply to Thierry RedingFrom: Akhil R <[email protected]>
Extend the existing Tegra186 GPIO controller driver with support for the GPIO controller found on Tegra241 (Grace). While the programming model remains the same, the number of pins has slightly changed.
--- drivers/gpio/gpio-tegra186.c | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
drivers/gpio/gpio-tegra186.c +52 -0
@@ -15,6 +15,7 @@#include <dt-bindings/gpio/tegra186-gpio.h> #include <dt-bindings/gpio/tegra194-gpio.h> #include <dt-bindings/gpio/tegra234-gpio.h> +#include <dt-bindings/gpio/tegra241-gpio.h> /* security registers */ #define TEGRA186_GPIO_CTL_SCR 0x0c
@@ -1042,6 +1043,55 @@ static const struct tegra_gpio_soc tegra234_aon_soc = { .num_irqs_per_bank = 8, }; +#define TEGRA241_MAIN_GPIO_PORT (_name, _bank, _port, _pins) \ + [TEGRA241_MAIN_GPIO_PORT_##_name] = { \ + .name = #_name, \ + .bank = _bank, \ + .port = _port, \ + .pins = _pins, \ + } + +static const struct tegra_gpio_port tegra241_main_ports[] = { +TEGRA241_MAIN_GPIO_PORT (A ,0 ,0 ,8 ), +TEGRA241_MAIN_GPIO_PORT (B ,0 ,1 ,8 ), +TEGRA241_MAIN_GPIO_PORT (C ,0 ,2 ,2 ), +TEGRA241_MAIN_GPIO_PORT (D ,0 ,3 ,6 ), +TEGRA241_MAIN_GPIO_PORT (E ,0 ,4 ,8 ), +TEGRA241_MAIN_GPIO_PORT (F ,1 ,0 ,8 ), +TEGRA241_MAIN_GPIO_PORT (G ,1 ,1 ,8 ), +TEGRA241_MAIN_GPIO_PORT (H ,1 ,2 ,8 ), +TEGRA241_MAIN_GPIO_PORT (J ,1 ,3 ,8 ), +TEGRA241_MAIN_GPIO_PORT (K ,1 ,4 ,4 ), +TEGRA241_MAIN_GPIO_PORT (L ,1 ,5 ,6 ), +}; + +static const struct tegra_gpio_soc tegra241_main_soc = { + .num_ports =ARRAY_SIZE (tegra241_main_ports), + .ports = tegra241_main_ports, + .name ="tegra241-gpio" , + .instance =0 , +}; + +#define TEGRA241_AON_GPIO_PORT (_name, _bank, _port, _pins) \ + [TEGRA241_AON_GPIO_PORT_##_name] = { \ + .name = #_name, \ + .bank = _bank, \ + .port = _port, \ + .pins = _pins, \ + } + +static const struct tegra_gpio_port tegra241_aon_ports[] = { +TEGRA241_AON_GPIO_PORT (AA ,0 ,0 ,8 ), +TEGRA241_AON_GPIO_PORT (BB ,0 ,0 ,4 ), +}; + +static const struct tegra_gpio_soc tegra241_aon_soc = { + .num_ports =ARRAY_SIZE (tegra241_aon_ports), + .ports = tegra241_aon_ports, + .name ="tegra241-gpio-aon" , + .instance =1 , +}; +static const struct of_device_id tegra186_gpio_of_match[] = { { .compatible ="nvidia,tegra186-gpio" ,
@@ -1072,6 +1122,8 @@ static const struct acpi_device_id tegra186_gpio_acpi_match[] = { { .id = "NVDA0208", .driver_data = (kernel_ulong_t)&tegra186_aon_soc }, { .id = "NVDA0308", .driver_data = (kernel_ulong_t)&tegra194_main_soc }, { .id = "NVDA0408", .driver_data = (kernel_ulong_t)&tegra194_aon_soc }, + { .id = "NVDA0508", .driver_data = (kernel_ulong_t)&tegra241_main_soc }, + { .id = "NVDA0608", .driver_data = (kernel_ulong_t)&tegra241_aon_soc }, {} };MODULE_DEVICE_TABLE (acpi, tegra186_gpio_acpi_match);
Signature · 1 line
2.34.1
Quoted 21 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Hi,
this is another extension of the Tegra186 GPIO driver, this time for the upcoming Tegra241 (Grace) chip. Note that while this adds the DT binding header, it doesn't actually define a new DT compatible string because it is unlikely that the Tegra241 will ever boot using DT but will use ACPI instead.
The pin definitions are still in the "DT binding" header for consistency with previous chips. Just wanted to highlight this to preempt questions as to why I haven't Cc'ed Rob or the devicetree mailing list.
Thierry
Akhil R (2):
dt-bindings: gpio: Add Tegra241 support
gpio: tegra186: Add support for Tegra241
Quoted 8 lines
drivers/gpio/gpio-tegra186.c | 52 ++++++++++++++++++++++++ include/dt-bindings/gpio/tegra241-gpio.h | 42 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 include/dt-bindings/gpio/tegra241-gpio.h--
2.34.1
Sounds good, applied, thanks!
Bart