1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* This file is part of the coreboot project.
*
* Copyright 2014 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __SOC_NVIDIA_TEGRA132_PAD_CFG_H
#define __SOC_NVIDIA_TEGRA132_PAD_CFG_H
#include <stdint.h>
#include <soc/nvidia/tegra132/pinmux.h>
struct pad_config {
uint8_t pinmux_flags; /* PU/PU, OD, INPUT, SFIO, etc */
uint8_t gpio_index; /* bank, port, index */
uint16_t pinmux_index:9;
uint16_t unused:1;
uint16_t sfio:1;
uint16_t gpio_out0:1;
uint16_t gpio_out1:1;
uint16_t pad_has_gpio:1;
uint16_t por_pullup:1;
};
#define PAD_CFG_GPIO_INPUT(ball_, pinmux_flgs_) \
{ \
.pinmux_flags = pinmux_flgs_ | PINMUX_INPUT_ENABLE, \
.gpio_index = PAD_TO_GPIO_##ball_, \
.pinmux_index = PINMUX_##ball_##_INDEX, \
.sfio = 0, \
.pad_has_gpio = PAD_HAS_GPIO_##ball_, \
}
#define PAD_CFG_GPIO_OUT0(ball_, pinmux_flgs_) \
{ \
.pinmux_flags = pinmux_flgs_, \
.gpio_index = PAD_TO_GPIO_##ball_, \
.pinmux_index = PINMUX_##ball_##_INDEX, \
.sfio = 0, \
.gpio_out0 = 1, \
.pad_has_gpio = PAD_HAS_GPIO_##ball_, \
}
#define PAD_CFG_GPIO_OUT1(ball_, pinmux_flgs_) \
{ \
.pinmux_flags = pinmux_flgs_, \
.gpio_index = PAD_TO_GPIO_##ball_, \
.pinmux_index = PINMUX_##ball_##_INDEX, \
.sfio = 0, \
.gpio_out1 = 1, \
.pad_has_gpio = PAD_HAS_GPIO_##ball_, \
}
#define PAD_CFG_SFIO(ball_, pinmux_flgs_, sfio_) \
{ \
.pinmux_flags = pinmux_flgs_ | \
PINMUX_##ball_##_FUNC_##sfio_, \
.gpio_index = PAD_TO_GPIO_##ball_, \
.pinmux_index = PINMUX_##ball_##_INDEX, \
.sfio = 1, \
.pad_has_gpio = PAD_HAS_GPIO_##ball_, \
}
#define PAD_CFG_UNUSED(ball_) \
{ \
.gpio_index = PAD_TO_GPIO_##ball_, \
.pinmux_index = PINMUX_##ball_##_INDEX, \
.unused = 1, \
.pad_has_gpio = PAD_HAS_GPIO_##ball_, \
}
/*
* Configure the pads associated with entry according to the configuration.
*/
void soc_configure_pads(const struct pad_config * const entries, size_t num);
/* I2C6 requires special init as its pad lives int the SOR/DPAUX block */
void soc_configure_i2c6pad(void);
#endif /* __SOC_NVIDIA_TEGRA132_PAD_CFG_H */
|