1 // SPDX-License-Identifier: GPL-2.0+
3 * Pinctrl data for the NVIDIA Tegra194 pinmux
5 * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 #include <linux/init.h>
19 #include <linux/platform_device.h>
20 #include <linux/pinctrl/pinctrl.h>
21 #include <linux/pinctrl/pinmux.h>
23 #include "pinctrl-tegra.h"
25 /* Define unique ID for each pins */
27 TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0
= 256,
28 TEGRA_PIN_PEX_L5_RST_N_PGG1
= 257,
29 TEGRA_PIN_NUM_GPIOS
= 258,
32 /* Table for pin descriptor */
33 static const struct pinctrl_pin_desc tegra194_pins
[] = {
34 PINCTRL_PIN(TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0
,
35 "TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0"),
36 PINCTRL_PIN(TEGRA_PIN_PEX_L5_RST_N_PGG1
,
37 "TEGRA_PIN_PEX_L5_RST_N_PGG1"),
40 static const unsigned int pex_l5_clkreq_n_pgg0_pins
[] = {
41 TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0
,
44 static const unsigned int pex_l5_rst_n_pgg1_pins
[] = {
45 TEGRA_PIN_PEX_L5_RST_N_PGG1
,
48 /* Define unique ID for each function */
57 /* Make list of each function name */
58 #define TEGRA_PIN_FUNCTION(lid) \
62 static struct tegra_function tegra194_functions
[] = {
63 TEGRA_PIN_FUNCTION(rsvd0
),
64 TEGRA_PIN_FUNCTION(rsvd1
),
65 TEGRA_PIN_FUNCTION(rsvd2
),
66 TEGRA_PIN_FUNCTION(rsvd3
),
67 TEGRA_PIN_FUNCTION(pe5
),
70 #define DRV_PINGROUP_ENTRY_Y(r, drvdn_b, drvdn_w, drvup_b, \
71 drvup_w, slwr_b, slwr_w, slwf_b, \
75 .drvdn_bit = drvdn_b, \
76 .drvdn_width = drvdn_w, \
77 .drvup_bit = drvup_b, \
78 .drvup_width = drvup_w, \
80 .slwr_width = slwr_w, \
84 #define PIN_PINGROUP_ENTRY_Y(r, bank, pupd, e_lpbk, e_input, \
85 e_od, schmitt_b, drvtype) \
98 .einput_bit = e_input, \
100 .schmitt_bit = schmitt_b, \
105 #define drive_pex_l5_clkreq_n_pgg0 \
106 DRV_PINGROUP_ENTRY_Y(0x14004, 12, 5, 20, 5, -1, -1, -1, -1, 0)
107 #define drive_pex_l5_rst_n_pgg1 \
108 DRV_PINGROUP_ENTRY_Y(0x1400c, 12, 5, 20, 5, -1, -1, -1, -1, 0)
110 #define PINGROUP(pg_name, f0, f1, f2, f3, r, bank, pupd, e_lpbk, \
111 e_input, e_lpdr, e_od, schmitt_b, drvtype, io_rail) \
114 .pins = pg_name##_pins, \
115 .npins = ARRAY_SIZE(pg_name##_pins), \
122 PIN_PINGROUP_ENTRY_Y(r, bank, pupd, e_lpbk, \
124 schmitt_b, drvtype), \
128 static const struct tegra_pingroup tegra194_groups
[] = {
129 PINGROUP(pex_l5_clkreq_n_pgg0
, PE5
, RSVD1
, RSVD2
, RSVD3
, 0x14000, 0,
130 Y
, -1, 6, 8, 11, 12, N
, "vddio_pex_ctl_2"),
131 PINGROUP(pex_l5_rst_n_pgg1
, PE5
, RSVD1
, RSVD2
, RSVD3
, 0x14008, 0,
132 Y
, -1, 6, 8, 11, 12, N
, "vddio_pex_ctl_2"),
135 static const struct tegra_pinctrl_soc_data tegra194_pinctrl
= {
136 .ngpios
= TEGRA_PIN_NUM_GPIOS
,
137 .pins
= tegra194_pins
,
138 .npins
= ARRAY_SIZE(tegra194_pins
),
139 .functions
= tegra194_functions
,
140 .nfunctions
= ARRAY_SIZE(tegra194_functions
),
141 .groups
= tegra194_groups
,
142 .ngroups
= ARRAY_SIZE(tegra194_groups
),
144 .schmitt_in_mux
= true,
145 .drvtype_in_mux
= true,
148 static int tegra194_pinctrl_probe(struct platform_device
*pdev
)
150 return tegra_pinctrl_probe(pdev
, &tegra194_pinctrl
);
153 static const struct of_device_id tegra194_pinctrl_of_match
[] = {
154 { .compatible
= "nvidia,tegra194-pinmux", },
158 static struct platform_driver tegra194_pinctrl_driver
= {
160 .name
= "tegra194-pinctrl",
161 .of_match_table
= tegra194_pinctrl_of_match
,
163 .probe
= tegra194_pinctrl_probe
,
166 static int __init
tegra194_pinctrl_init(void)
168 return platform_driver_register(&tegra194_pinctrl_driver
);
170 arch_initcall(tegra194_pinctrl_init
);