summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuresh Mangipudi <smangipudi@nvidia.com>2016-12-23 05:24:57 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-12 06:13:50 -0500
commitcd7c4178bae9abf4d6723bf36dc3dcf91daec078 (patch)
treea82d073212c2534f798e6079462e26ea67077706
parent1e0e87278fec2c4739bc59161c83b52482ae7bef (diff)
tegra: GPIO: Add support for T194 GPIO
Add T194 GPIO tables for AON and MAIN GPIO's Add new compatible strings for T194 to support AON and MAIN GPIO's Bug 1842952 Change-Id: I8a90b9067165d348388e558ed2cc9e5517634133 Signed-off-by: Suresh Mangipudi <smangipudi@nvidia.com> Reviewed-on: http://git-master/r/1276130 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
-rw-r--r--drivers/gpio/gpio-tegra186.c78
-rw-r--r--include/dt-bindings/gpio/tegra194-gpio.h101
2 files changed, 178 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
index 8abbb1bac..86f37f7c2 100644
--- a/drivers/gpio/gpio-tegra186.c
+++ b/drivers/gpio/gpio-tegra186.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GPIO driver for NVIDIA Tegra186 2 * GPIO driver for NVIDIA Tegra186
3 * 3 *
4 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * Author: Suresh Mangipudi <smangipudi@nvidia.com> 6 * Author: Suresh Mangipudi <smangipudi@nvidia.com>
7 * 7 *
@@ -29,6 +29,7 @@
29#include <linux/irqchip/tegra.h> 29#include <linux/irqchip/tegra.h>
30#include <linux/version.h> 30#include <linux/version.h>
31#include <dt-bindings/gpio/tegra186-gpio.h> 31#include <dt-bindings/gpio/tegra186-gpio.h>
32#include <dt-bindings/gpio/tegra194-gpio.h>
32 33
33/* GPIO control registers */ 34/* GPIO control registers */
34#define GPIO_ENB_CONFIG_REG 0x00 35#define GPIO_ENB_CONFIG_REG 0x00
@@ -349,6 +350,65 @@ static struct tegra_gpio_port_soc_info tegra_aon_gpio_cinfo[] = {
349 TEGRA_AON_GPIO_PORT_INFO(FF, 0, 0, 5), 350 TEGRA_AON_GPIO_PORT_INFO(FF, 0, 0, 5),
350}; 351};
351 352
353#define TEGRA194_MAIN_GPIO_PORT_INFO(port, cid, cind, npins) \
354[TEGRA194_MAIN_GPIO_PORT_##port] = { \
355 .port_name = #port, \
356 .cont_id = cid, \
357 .port_index = cind, \
358 .valid_pins = npins, \
359 .reg_index = 0, \
360 .scr_offset = cid * 0x1000 + cind * 0x40, \
361 .reg_offset = cid * 0x1000 + cind * 0x200, \
362}
363
364#define TEGRA194_AON_GPIO_PORT_INFO(port, cid, cind, npins) \
365[TEGRA194_AON_GPIO_PORT_##port] = { \
366 .port_name = #port, \
367 .cont_id = cid, \
368 .port_index = cind, \
369 .valid_pins = npins, \
370 .reg_index = 1, \
371 .scr_offset = cind * 0x40, \
372 .reg_offset = cind * 0x200, \
373}
374
375static struct tegra_gpio_port_soc_info tegra194_gpio_cinfo[] = {
376 TEGRA194_MAIN_GPIO_PORT_INFO(A, 0, 3, 8),
377 TEGRA194_MAIN_GPIO_PORT_INFO(B, 0, 4, 2),
378 TEGRA194_MAIN_GPIO_PORT_INFO(C, 4, 3, 8),
379 TEGRA194_MAIN_GPIO_PORT_INFO(D, 4, 4, 4),
380 TEGRA194_MAIN_GPIO_PORT_INFO(E, 4, 5, 4),
381 TEGRA194_MAIN_GPIO_PORT_INFO(F, 4, 6, 6),
382 TEGRA194_MAIN_GPIO_PORT_INFO(G, 4, 0, 8),
383 TEGRA194_MAIN_GPIO_PORT_INFO(H, 4, 1, 8),
384 TEGRA194_MAIN_GPIO_PORT_INFO(I, 4, 2, 5),
385 TEGRA194_MAIN_GPIO_PORT_INFO(J, 5, 1, 6),
386 TEGRA194_MAIN_GPIO_PORT_INFO(K, 3, 0, 8),
387 TEGRA194_MAIN_GPIO_PORT_INFO(L, 3, 1, 8),
388 TEGRA194_MAIN_GPIO_PORT_INFO(M, 2, 3, 8),
389 TEGRA194_MAIN_GPIO_PORT_INFO(N, 2, 4, 3),
390 TEGRA194_MAIN_GPIO_PORT_INFO(O, 5, 0, 6),
391 TEGRA194_MAIN_GPIO_PORT_INFO(P, 0, 0, 8),
392 TEGRA194_MAIN_GPIO_PORT_INFO(Q, 0, 1, 8),
393 TEGRA194_MAIN_GPIO_PORT_INFO(R, 0, 2, 6),
394 TEGRA194_MAIN_GPIO_PORT_INFO(S, 3, 2, 8),
395 TEGRA194_MAIN_GPIO_PORT_INFO(T, 3, 3, 8),
396 TEGRA194_MAIN_GPIO_PORT_INFO(U, 3, 4, 1),
397 TEGRA194_MAIN_GPIO_PORT_INFO(V, 1, 0, 8),
398 TEGRA194_MAIN_GPIO_PORT_INFO(W, 1, 1, 2),
399 TEGRA194_MAIN_GPIO_PORT_INFO(X, 2, 0, 8),
400 TEGRA194_MAIN_GPIO_PORT_INFO(Y, 2, 1, 8),
401 TEGRA194_MAIN_GPIO_PORT_INFO(Z, 2, 2, 8),
402};
403
404static struct tegra_gpio_port_soc_info tegra194_aon_gpio_cinfo[] = {
405 TEGRA194_AON_GPIO_PORT_INFO(AA, 0, 3, 8),
406 TEGRA194_AON_GPIO_PORT_INFO(BB, 0, 4, 4),
407 TEGRA194_AON_GPIO_PORT_INFO(CC, 0, 1, 8),
408 TEGRA194_AON_GPIO_PORT_INFO(DD, 0, 2, 3),
409 TEGRA194_AON_GPIO_PORT_INFO(EE, 0, 0, 7),
410};
411
352struct tegra_gpio_info; 412struct tegra_gpio_info;
353 413
354struct tegra_gpio_soc_info { 414struct tegra_gpio_soc_info {
@@ -937,9 +997,25 @@ static const struct tegra_gpio_soc_info t186_aon_gpio_soc = {
937 .nwakes = ARRAY_SIZE(tegra186_aon_gpio_wakes), 997 .nwakes = ARRAY_SIZE(tegra186_aon_gpio_wakes),
938}; 998};
939 999
1000static const struct tegra_gpio_soc_info t194_gpio_soc = {
1001 .name = "tegra-gpio",
1002 .debug_fs_name = "tegra_gpio",
1003 .port = tegra194_gpio_cinfo,
1004 .nports = ARRAY_SIZE(tegra194_gpio_cinfo),
1005};
1006
1007static const struct tegra_gpio_soc_info t194_aon_gpio_soc = {
1008 .name = "tegra-gpio-aon",
1009 .debug_fs_name = "tegra-gpio-aon",
1010 .port = tegra194_aon_gpio_cinfo,
1011 .nports = ARRAY_SIZE(tegra194_aon_gpio_cinfo),
1012};
1013
940static struct of_device_id tegra_gpio_of_match[] = { 1014static struct of_device_id tegra_gpio_of_match[] = {
941 { .compatible = "nvidia,tegra186-gpio", .data = &t186_gpio_soc}, 1015 { .compatible = "nvidia,tegra186-gpio", .data = &t186_gpio_soc},
942 { .compatible = "nvidia,tegra186-gpio-aon", .data = &t186_aon_gpio_soc}, 1016 { .compatible = "nvidia,tegra186-gpio-aon", .data = &t186_aon_gpio_soc},
1017 { .compatible = "nvidia,tegra194-gpio", .data = &t194_gpio_soc},
1018 { .compatible = "nvidia,tegra194-gpio-aon", .data = &t194_aon_gpio_soc},
943 { }, 1019 { },
944}; 1020};
945 1021
diff --git a/include/dt-bindings/gpio/tegra194-gpio.h b/include/dt-bindings/gpio/tegra194-gpio.h
new file mode 100644
index 000000000..5d4a481d3
--- /dev/null
+++ b/include/dt-bindings/gpio/tegra194-gpio.h
@@ -0,0 +1,101 @@
1/*
2 * This header provides constants for binding nvidia,tegra1i94-gpio*.
3 *
4 * The first cell in Tegra's GPIO specifier is the GPIO ID. The macros below
5 * provide names for this.
6 *
7 * The second cell contains standard flag values specified in gpio.h.
8 */
9
10#ifndef _DT_BINDINGS_GPIO_TEGRA194_GPIO_H
11#define _DT_BINDINGS_GPIO_TEGRA194_GPIO_H
12
13#include <dt-bindings/gpio/gpio.h>
14
15/* GPIOs implemented by main GPIO controller */
16#define TEGRA194_MAIN_GPIO_PORT_A 0
17#define TEGRA194_MAIN_GPIO_PORT_B 1
18#define TEGRA194_MAIN_GPIO_PORT_C 2
19#define TEGRA194_MAIN_GPIO_PORT_D 3
20#define TEGRA194_MAIN_GPIO_PORT_E 4
21#define TEGRA194_MAIN_GPIO_PORT_F 5
22#define TEGRA194_MAIN_GPIO_PORT_G 6
23#define TEGRA194_MAIN_GPIO_PORT_H 7
24#define TEGRA194_MAIN_GPIO_PORT_I 8
25#define TEGRA194_MAIN_GPIO_PORT_J 9
26#define TEGRA194_MAIN_GPIO_PORT_K 10
27#define TEGRA194_MAIN_GPIO_PORT_L 11
28#define TEGRA194_MAIN_GPIO_PORT_M 12
29#define TEGRA194_MAIN_GPIO_PORT_N 13
30#define TEGRA194_MAIN_GPIO_PORT_O 14
31#define TEGRA194_MAIN_GPIO_PORT_P 15
32#define TEGRA194_MAIN_GPIO_PORT_Q 16
33#define TEGRA194_MAIN_GPIO_PORT_R 17
34#define TEGRA194_MAIN_GPIO_PORT_S 18
35#define TEGRA194_MAIN_GPIO_PORT_T 19
36#define TEGRA194_MAIN_GPIO_PORT_U 20
37#define TEGRA194_MAIN_GPIO_PORT_V 21
38#define TEGRA194_MAIN_GPIO_PORT_W 22
39#define TEGRA194_MAIN_GPIO_PORT_X 23
40#define TEGRA194_MAIN_GPIO_PORT_Y 24
41#define TEGRA194_MAIN_GPIO_PORT_Z 25
42
43#define TEGRA194_MAIN_GPIO(port, offset) \
44 ((TEGRA194_MAIN_GPIO_PORT_##port * 8) + offset)
45
46/* GPIOs implemented by AON GPIO controller */
47#define TEGRA194_AON_GPIO_PORT_AA 0
48#define TEGRA194_AON_GPIO_PORT_BB 1
49#define TEGRA194_AON_GPIO_PORT_CC 2
50#define TEGRA194_AON_GPIO_PORT_DD 3
51#define TEGRA194_AON_GPIO_PORT_EE 4
52#define TEGRA194_AON_GPIO_PORT_FF 5
53
54#define TEGRA194_AON_GPIO(port, offset) \
55 ((TEGRA194_AON_GPIO_PORT_##port * 8) + offset)
56
57/* All pins */
58#define TEGRA_PIN_BASE_ID_A 0
59#define TEGRA_PIN_BASE_ID_B 1
60#define TEGRA_PIN_BASE_ID_C 2
61#define TEGRA_PIN_BASE_ID_D 3
62#define TEGRA_PIN_BASE_ID_E 4
63#define TEGRA_PIN_BASE_ID_F 5
64#define TEGRA_PIN_BASE_ID_G 6
65#define TEGRA_PIN_BASE_ID_H 7
66#define TEGRA_PIN_BASE_ID_I 8
67#define TEGRA_PIN_BASE_ID_J 9
68#define TEGRA_PIN_BASE_ID_K 10
69#define TEGRA_PIN_BASE_ID_L 11
70#define TEGRA_PIN_BASE_ID_M 12
71#define TEGRA_PIN_BASE_ID_N 13
72#define TEGRA_PIN_BASE_ID_O 14
73#define TEGRA_PIN_BASE_ID_P 15
74#define TEGRA_PIN_BASE_ID_Q 16
75#define TEGRA_PIN_BASE_ID_R 17
76#define TEGRA_PIN_BASE_ID_S 18
77#define TEGRA_PIN_BASE_ID_T 19
78#define TEGRA_PIN_BASE_ID_U 20
79#define TEGRA_PIN_BASE_ID_V 21
80#define TEGRA_PIN_BASE_ID_W 22
81#define TEGRA_PIN_BASE_ID_X 23
82#define TEGRA_PIN_BASE_ID_Y 24
83#define TEGRA_PIN_BASE_ID_Z 25
84#define TEGRA_PIN_BASE_ID_AA 26
85#define TEGRA_PIN_BASE_ID_BB 27
86#define TEGRA_PIN_BASE_ID_CC 28
87#define TEGRA_PIN_BASE_ID_DD 29
88#define TEGRA_PIN_BASE_ID_EE 30
89#define TEGRA_PIN_BASE_ID_FF 31
90
91#define TEGRA_PIN_BASE(port) (TEGRA_PIN_BASE_ID_##port * 8)
92
93#define TEGRA194_MAIN_GPIO_RANGE(st, end) \
94 ((TEGRA194_MAIN_GPIO_PORT_##end - TEGRA194_MAIN_GPIO_PORT_##st + 1) * 8)
95#define TEGRA194_MAIN_GPIO_BASE(port) (TEGRA194_MAIN_GPIO_PORT_##port * 8)
96
97#define TEGRA194_AON_GPIO_RANGE(st, end) \
98 ((TEGRA194_AON_GPIO_PORT_##end - TEGRA194_AON_GPIO_PORT_##st + 1) * 8)
99#define TEGRA194_AON_GPIO_BASE(port) (TEGRA194_AON_GPIO_PORT_##port * 8)
100
101#endif