Define gpio constants rather than using enum.

Fix pull-up and pull-down values of gpio.
According to A10 user manual possible pull register
values are 00 Pull-up/down disable, 01 Pull-up, 10 Pull-down.

Approved by: gonzo@
This commit is contained in:
Ganbold Tsagaankhuu 2013-02-19 02:01:35 +00:00
parent e5ed213082
commit bf4e1ed0bc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246955

View File

@ -66,6 +66,13 @@ __FBSDID("$FreeBSD$");
#define A10_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \
GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
#define A10_GPIO_NONE 0
#define A10_GPIO_PULLUP 1
#define A10_GPIO_PULLDOWN 2
#define A10_GPIO_INPUT 0
#define A10_GPIO_OUTPUT 1
struct a10_gpio_softc {
device_t sc_dev;
struct mtx sc_mtx;
@ -78,17 +85,6 @@ struct a10_gpio_softc {
struct gpio_pin sc_gpio_pins[A10_GPIO_PINS];
};
enum a10_gpio_fsel {
A10_GPIO_INPUT,
A10_GPIO_OUTPUT,
};
enum a10_gpio_pud {
A10_GPIO_NONE,
A10_GPIO_PULLDOWN,
A10_GPIO_PULLUP,
};
#define A10_GPIO_LOCK(_sc) mtx_lock(&_sc->sc_mtx)
#define A10_GPIO_UNLOCK(_sc) mtx_unlock(&_sc->sc_mtx)
#define A10_GPIO_LOCK_ASSERT(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED)