summaryrefslogtreecommitdiff
path: root/src/soc/nvidia/tegra132/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-07-31 14:54:12 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-03-24 15:27:40 +0100
commit401b3b6ea66731c3d665659d869ed06008db19e6 (patch)
tree4829aa08420e52d0956e1e10531324f054d1c9f7 /src/soc/nvidia/tegra132/include
parentaee84263363e4fdc2b7e4762f0b4c7c68a48bea1 (diff)
downloadcoreboot-401b3b6ea66731c3d665659d869ed06008db19e6.tar.xz
tegra132: provide pad configuration interface
Instead of sprinkling the pad configuration and pinmux selection throughout the code allow for a data-driven initialization sequence. Most of the calls in the original pinmux functions require 12 bytes per pad plus the support code. This implementation allows for 4 bytes per pad in addition to the support code. BUG=chrome-os-partner:29981 TEST=Built and booted into depthcharge on rush. Change-Id: I22c243a5f9891a97e14b78d8c8064e36adaf50b8 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 9329c17bbadcaab803b38842e38e1704d262817d Original-Change-Id: I3a119b4068e880b74a0a1597f143d7c4e108a6c1 Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/210833 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/8875 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/nvidia/tegra132/include')
-rw-r--r--src/soc/nvidia/tegra132/include/soc/padconfig.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/soc/nvidia/tegra132/include/soc/padconfig.h b/src/soc/nvidia/tegra132/include/soc/padconfig.h
new file mode 100644
index 0000000000..f7cf629ce2
--- /dev/null
+++ b/src/soc/nvidia/tegra132/include/soc/padconfig.h
@@ -0,0 +1,89 @@
+/*
+ * 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_, \
+ .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);
+
+#endif /* __SOC_NVIDIA_TEGRA132_PAD_CFG_H */