mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
GPIO: Add gpio_reset function
The gpio_reset function returns a GPIO to its initialy configured state. Using it removes a few more uses of gpio_list. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: Ie24e8e8a96d0ff50f521a918e80ed2b379f8c1a9 Reviewed-on: https://chromium-review.googlesource.com/321951 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -243,8 +243,7 @@ void uart_enter_dsleep(void)
|
||||
* Set the UART0 RX pin to be a generic GPIO with the flags defined
|
||||
* in the board.c file.
|
||||
*/
|
||||
gpio_set_flags_by_mask(g.port, g.mask, g.flags);
|
||||
gpio_set_alternate_function(g.port, g.mask, -1);
|
||||
gpio_reset(GPIO_UART0_RX);
|
||||
|
||||
/* Clear any pending GPIO interrupts on the UART0 RX pin. */
|
||||
LM4_GPIO_ICR(g.port) = g.mask;
|
||||
|
||||
@@ -172,8 +172,6 @@ void uart_init(void)
|
||||
#ifdef CONFIG_LOW_POWER_IDLE
|
||||
void uart_enter_dsleep(void)
|
||||
{
|
||||
const struct gpio_info g = gpio_list[GPIO_UART0_RX];
|
||||
|
||||
/* Disable the UART interrupt. */
|
||||
task_disable_irq(MEC1322_IRQ_UART); /* NVIC interrupt for UART=13 */
|
||||
|
||||
@@ -181,8 +179,7 @@ void uart_enter_dsleep(void)
|
||||
* Set the UART0 RX pin to be a GPIO-162(fixed pin) interrupt
|
||||
* with the flags defined in the gpio.inc file.
|
||||
*/
|
||||
gpio_set_flags_by_mask(g.port, g.mask, g.flags);
|
||||
gpio_set_alternate_function(g.port, g.mask, -1);
|
||||
gpio_reset(GPIO_UART0_RX);
|
||||
|
||||
/* power-down/de-activate UART0 */
|
||||
MEC1322_UART_ACT &= ~(1 << 0);
|
||||
|
||||
@@ -114,6 +114,14 @@ void gpio_set_flags(enum gpio_signal signal, int flags)
|
||||
gpio_set_flags_by_mask(g->port, g->mask, flags);
|
||||
}
|
||||
|
||||
void gpio_reset(enum gpio_signal signal)
|
||||
{
|
||||
const struct gpio_info *g = gpio_list + signal;
|
||||
|
||||
gpio_set_flags_by_mask(g->port, g->mask, g->flags);
|
||||
gpio_set_alternate_function(g->port, g->mask, -1);
|
||||
}
|
||||
|
||||
const char *gpio_get_name(enum gpio_signal signal)
|
||||
{
|
||||
return gpio_list[signal].name;
|
||||
|
||||
@@ -191,6 +191,17 @@ void gpio_set_flags(enum gpio_signal signal, int flags);
|
||||
* @param value New value for signal (0 = low, != high */
|
||||
void gpio_set_level(enum gpio_signal signal, int value);
|
||||
|
||||
/**
|
||||
* Reset the GPIO flags and alternate function state
|
||||
*
|
||||
* This returns the GPIO to it's default state of being a GPIO (not
|
||||
* configured as an alternate function) with its default flags (those
|
||||
* specified in gpio.inc when it was defined).
|
||||
*
|
||||
* @param signal Signal to reset
|
||||
*/
|
||||
void gpio_reset(enum gpio_signal signal);
|
||||
|
||||
/**
|
||||
* Enable interrupts for the signal.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user