From d36ef6a51df0d9bb840f091adee8b7bf3424b331 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 25 Jul 2014 17:34:42 -0700 Subject: ipq806x: implement GPIO API Add implementation of the GPIO API defined in src/include/gpiolib.h. Also, clean up the GPIO driver, make it use pointers instead of integers for register address. This requires a touch in the SPI driver, where the CS GPIO is toggled and in the board function where it enables USB interface. BUG=chrome-os-partner:30489 TEST=tested with the following patches, observed proto0 properly read the board ID. Original-Change-Id: I0962947c6bb32a854ca300752d259a48e9e7b4eb Original-Signed-off-by: Vadim Bendebury Original-Reviewed-on: https://chromium-review.googlesource.com/210115 Original-Reviewed-by: David Hendricks (cherry picked from commit e951f735001509d135cc61530ed0eecb5fc31a85) Signed-off-by: Marc Jones Change-Id: I8a612dce000931835054086c1b02ebfc43dc57d2 Reviewed-on: http://review.coreboot.org/8718 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer Reviewed-by: Paul Menzel --- src/soc/qualcomm/ipq806x/include/gpio.h | 5 ++--- src/soc/qualcomm/ipq806x/include/iomap.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/soc/qualcomm/ipq806x/include') diff --git a/src/soc/qualcomm/ipq806x/include/gpio.h b/src/soc/qualcomm/ipq806x/include/gpio.h index 1f35aa7061..276022c0af 100644 --- a/src/soc/qualcomm/ipq806x/include/gpio.h +++ b/src/soc/qualcomm/ipq806x/include/gpio.h @@ -64,8 +64,8 @@ #define GPIO_16MA 7 /* GPIO TLMM: Status */ -#define GPIO_ENABLE 0 -#define GPIO_DISABLE 1 +#define GPIO_DISABLE 0 +#define GPIO_ENABLE 1 /* GPIO MAX Valid # */ #define GPIO_MAX_NUM 68 @@ -99,7 +99,6 @@ void gpio_tlmm_config_get(gpio_t gpio, unsigned int *func, unsigned int *enable); void gpio_io_config_set(gpio_t gpio, unsigned int out); -void gpio_io_config_get(gpio_t gpio, unsigned int *in, unsigned int *out); /* Keep this to maintain backwards compatibility with the vendor API. */ static inline void gpio_tlmm_config(unsigned int gpio, unsigned int func, diff --git a/src/soc/qualcomm/ipq806x/include/iomap.h b/src/soc/qualcomm/ipq806x/include/iomap.h index 69744bcd51..c9c8fc413a 100644 --- a/src/soc/qualcomm/ipq806x/include/iomap.h +++ b/src/soc/qualcomm/ipq806x/include/iomap.h @@ -81,9 +81,9 @@ #define DGT_CLEAR DGT_REG(0x000C) #define DGT_CLK_CTL DGT_REG(0x0010) -#define TLMM_BASE_ADDR 0x00800000 +#define TLMM_BASE_ADDR ((char *)0x00800000) #define GPIO_CONFIG_ADDR(x) (TLMM_BASE_ADDR + 0x1000 + (x)*0x10) -#define GPIO_IN_OUT_ADDR(x) (TLMM_BASE_ADDR + 0x1004 + (x)*0x10) +#define GPIO_IN_OUT_ADDR(x) (GPIO_CONFIG_ADDR(x) + 4) /* Yes, this is not a typo... host2 is actually mapped before host1. */ #define USB_HOST2_XHCI_BASE 0x10000000 -- cgit v1.2.3