x86: Add PCAL9535A support

This patch adds gpio-pcal9535a.c and gpio-pcal9535a.h files,
which support access to I2C-based PCAL9535A GPIO controller
configuration register through a function interface.

The PCAL9535A is a low-voltage 16-bit GPIO expander with interrupt
and reset for I2C-bus/SMBus applications. It contains the PCA9535
register set of four pairs of 8-bit Configuration, Input, Output,
and Polarity Inversion registers, and additionally, the PCAL9535A has
Agile I/O, which are additional features specifically designed to
enhance the I/O. More about PCAL9535A can be found in its datasheet[1].

This driver is needed in order to configure Galileo pinmux.

[1] - http://www.nxp.com/documents/data_sheet/PCAL9535A.pdf
This commit is contained in:
Ricardo de Almeida Gonzaga 2015-10-08 10:16:53 -03:00 committed by Jesus Sanchez-Palencia
parent 7dfd753b21
commit 495dcd659a
4 changed files with 429 additions and 11 deletions

View file

@ -35,15 +35,24 @@
#include "pci.h"
#define QUARKX1000_GPIO_IN (0 << 0)
#define QUARKX1000_GPIO_OUT (1 << 0)
#define QUARKX1000_GPIO_INT (1 << 1)
#define QUARKX1000_GPIO_ACTIVE_LOW (0 << 2)
#define QUARKX1000_GPIO_ACTIVE_HIGH (1 << 2)
#define QUARKX1000_GPIO_LEVEL (0 << 3)
#define QUARKX1000_GPIO_EDGE (1 << 3)
#define QUARKX1000_GPIO_DEBOUNCE (1 << 4)
#define QUARKX1000_GPIO_CLOCK_SYNC (1 << 5)
#define QUARKX1000_GPIO_IN (0 << 0)
#define QUARKX1000_GPIO_OUT (1 << 0)
#define QUARKX1000_GPIO_INT (1 << 1)
#define QUARKX1000_GPIO_ACTIVE_LOW (0 << 2)
#define QUARKX1000_GPIO_ACTIVE_HIGH (1 << 2)
#define QUARKX1000_GPIO_LEVEL (0 << 3)
#define QUARKX1000_GPIO_EDGE (1 << 3)
#define QUARKX1000_GPIO_DEBOUNCE (1 << 4)
#define QUARKX1000_GPIO_CLOCK_SYNC (1 << 5)
#define QUARKX1000_GPIO_POL_NORMAL (0 << 6)
#define QUARKX1000_GPIO_POL_INV (1 << 6)
#define QUARKX1000_GPIO_PUD_NORMAL (0 << 7)
#define QUARKX1000_GPIO_PUD_PULL_UP (1 << 7)
#define QUARKX1000_GPIO_PUD_PULL_DOWN (2 << 7)
#define QUARKX1000_GPIO_DIR_MASK (1 << 0)
#define QUARKX1000_GPIO_POL_MASK (1 << 6)
#define QUARKX1000_GPIO_PUD_MASK (3 << 7)
int quarkX1000_gpio_init(void);