aboutsummaryrefslogtreecommitdiff
path: root/src/soc/nvidia/tegra/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/nvidia/tegra/gpio.c')
-rw-r--r--src/soc/nvidia/tegra/gpio.c68
1 files changed, 16 insertions, 52 deletions
diff --git a/src/soc/nvidia/tegra/gpio.c b/src/soc/nvidia/tegra/gpio.c
index b10cded12d..17b90aa1d9 100644
--- a/src/soc/nvidia/tegra/gpio.c
+++ b/src/soc/nvidia/tegra/gpio.c
@@ -23,6 +23,7 @@
#include <stddef.h>
#include <stdint.h>
#include <delay.h>
+#include <gpiolib.h>
#include "gpio.h"
#include "pinmux.h"
@@ -175,58 +176,6 @@ int gpio_get_in_value(gpio_t gpio)
return (port & (1 << bit)) != 0;
}
-int gpio_get_in_tristate_values(gpio_t gpio[], int num_gpio, int value[])
-{
- /*
- * GPIOs which are tied to stronger external pull up or pull down
- * will stay there regardless of the internal pull up or pull
- * down setting.
- *
- * GPIOs which are floating will go to whatever level they're
- * internally pulled to.
- */
-
- int temp;
- int index;
-
- /* Enable internal pull up */
- for (index = 0; index < num_gpio; ++index)
- gpio_input_pullup(gpio[index]);
-
- /* Wait until signals become stable */
- udelay(10);
-
- /* Get gpio values at internal pull up */
- for (index = 0; index < num_gpio; ++index)
- value[index] = gpio_get_in_value(gpio[index]);
-
- /* Enable internal pull down */
- for (index = 0; index < num_gpio; ++index)
- gpio_input_pulldown(gpio[index]);
-
- /* Wait until signals become stable */
- udelay(10);
-
- /*
- * Get gpio values at internal pull down.
- * Compare with gpio pull up value and then
- * determine a gpio final value/state:
- * 0: pull down
- * 1: pull up
- * 2: floating
- */
- for (index = 0; index < num_gpio; ++index) {
- temp = gpio_get_in_value(gpio[index]);
- value[index] = ((value[index] ^ temp) << 1) | temp;
- }
-
- /* Disable pull up / pull down to conserve power */
- for (index = 0; index < num_gpio; ++index)
- gpio_input(gpio[index]);
-
- return 0;
-}
-
int gpio_get_int_status(gpio_t gpio)
{
int bit = gpio % GPIO_GPIOS_PER_PORT;
@@ -279,3 +228,18 @@ void gpio_set_int_clear(gpio_t gpio)
offsetof(struct gpio_bank, int_clear),
1 << bit, 1 << bit);
}
+
+void gpio_input_pulldown(gpio_t gpio)
+{
+ __gpio_input(gpio, PINMUX_PULL_DOWN);
+}
+
+void gpio_input_pullup(gpio_t gpio)
+{
+ __gpio_input(gpio, PINMUX_PULL_UP);
+}
+
+void gpio_input(gpio_t gpio)
+{
+ __gpio_input(gpio, PINMUX_PULL_NONE);
+}