mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
GPIO: Remove gpio_alt_funcs table from common header
Now that the cr50 no longer uses this array to store its pinmux config we can move it out of the header file, removing it from the public interface for GPIO code. This allows us to start modifying this struct more easily. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I9b4ca8b678b102bb9b63ccffe23bf2dc87aeb44a Reviewed-on: https://chromium-review.googlesource.com/328824 Commit-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "console.h"
|
||||
#include "gpio.h"
|
||||
#include "host_command.h"
|
||||
#include "registers.h"
|
||||
#include "system.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -58,6 +59,35 @@ static int last_val_changed(int i, int v)
|
||||
}
|
||||
}
|
||||
|
||||
/* GPIO alternate function structure */
|
||||
struct gpio_alt_func {
|
||||
/* Port base address */
|
||||
uint32_t port;
|
||||
|
||||
/* Bitmask on that port (multiple bits allowed) */
|
||||
uint32_t mask;
|
||||
|
||||
/* Alternate function number */
|
||||
uint8_t func;
|
||||
|
||||
/* Module ID (as uint8_t, since enum would be 32-bit) */
|
||||
uint8_t module_id;
|
||||
|
||||
/* Flags (GPIO_*; see above). */
|
||||
uint16_t flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* Construct the gpio_alt_funcs array. This array is used by gpio_config_module
|
||||
* to enable and disable GPIO alternate functions on a module by module basis.
|
||||
*/
|
||||
#define ALTERNATE(pinmask, function, module, flags) \
|
||||
{GPIO_##pinmask, function, module, flags},
|
||||
|
||||
static const struct gpio_alt_func gpio_alt_funcs[] = {
|
||||
#include "gpio.wrap"
|
||||
};
|
||||
|
||||
/*
|
||||
* GPIO_CONFIG_ALL_PORTS signifies a "don't care" for the GPIO port. This is
|
||||
* used in gpio_config_pins(). When the port parameter is set to this, the
|
||||
@@ -74,7 +104,8 @@ static int gpio_config_pins(enum module_id id,
|
||||
int rv = EC_ERROR_INVAL;
|
||||
|
||||
/* Find pins and set to alternate functions */
|
||||
for (af = gpio_alt_funcs; af < gpio_alt_funcs + gpio_alt_funcs_count;
|
||||
for (af = gpio_alt_funcs;
|
||||
af < gpio_alt_funcs + ARRAY_SIZE(gpio_alt_funcs);
|
||||
af++) {
|
||||
if (af->module_id != id)
|
||||
continue; /* Pins for some other module */
|
||||
|
||||
@@ -85,27 +85,6 @@ extern void (* const gpio_irq_handlers[])(enum gpio_signal signal);
|
||||
extern const int gpio_ih_count;
|
||||
#define GPIO_IH_COUNT gpio_ih_count
|
||||
|
||||
/* GPIO alternate function structure, for use by board.c */
|
||||
struct gpio_alt_func {
|
||||
/* Port base address */
|
||||
uint32_t port;
|
||||
|
||||
/* Bitmask on that port (multiple bits allowed) */
|
||||
uint32_t mask;
|
||||
|
||||
/* Alternate function number */
|
||||
uint8_t func;
|
||||
|
||||
/* Module ID (as uint8_t, since enum would be 32-bit) */
|
||||
uint8_t module_id;
|
||||
|
||||
/* Flags (GPIO_*; see above). */
|
||||
uint16_t flags;
|
||||
};
|
||||
|
||||
extern const struct gpio_alt_func gpio_alt_funcs[];
|
||||
extern const int gpio_alt_funcs_count;
|
||||
|
||||
/**
|
||||
* Pre-initialize GPIOs.
|
||||
*
|
||||
|
||||
@@ -21,19 +21,6 @@ const struct gpio_info gpio_list[] = {
|
||||
|
||||
BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
|
||||
|
||||
/*
|
||||
* Construct the gpio_alt_funcs array. This array is used by gpio_config_module
|
||||
* to enable and disable GPIO alternate functions on a module by module basis.
|
||||
*/
|
||||
#define ALTERNATE(pinmask, function, module, flags) \
|
||||
{GPIO_##pinmask, function, module, flags},
|
||||
|
||||
const struct gpio_alt_func gpio_alt_funcs[] = {
|
||||
#include "gpio.wrap"
|
||||
};
|
||||
|
||||
const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
|
||||
|
||||
/* GPIO Interrupt Handlers */
|
||||
#define GPIO_INT(name, pin, flags, signal) signal,
|
||||
void (* const gpio_irq_handlers[])(enum gpio_signal signal) = {
|
||||
|
||||
Reference in New Issue
Block a user