summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEwout van Bekkum <ewout@google.com>2016-01-22 15:41:55 -0800
committerNadim Taha <ntaha@chromium.org>2016-01-28 21:45:53 +0000
commit747a9f078611f3e7d9a497e5feab0ced98ff66d6 (patch)
tree5eb89d58cddb295247f76413288f5947438a9d34
parent99f62cb3a994c93c5cc8d616c0db78ff6a1be1a4 (diff)
downloadchrome-ec-747a9f078611f3e7d9a497e5feab0ced98ff66d6.tar.gz
cr50: adds the ability to configure muxed inout peripherals
Adds the the code necessary to support muxed inout peripherals on cr50 like SPS and SPI0 by adding a new signnal to pin connection flag. Note these are for direct wired peripherals where no muxing is necessary, the input pads just need to be enabled. BRANCH=none BUG=none TEST=verified pinmux registers through m3 Change-Id: I1a375a3a14fb44fc4f9ced764fd2c54bb2b91e22 Signed-off-by: Ewout van Bekkum <ewout@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/323848 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/g/gpio.c6
-rw-r--r--chip/g/registers.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/chip/g/gpio.c b/chip/g/gpio.c
index 95b2a79385..ff2e05890c 100644
--- a/chip/g/gpio.c
+++ b/chip/g/gpio.c
@@ -87,7 +87,11 @@ void gpio_set_alternate_function(uint32_t port, uint32_t mask, int func)
static void connect_pinmux(uint32_t signal, uint32_t dio, uint16_t flags)
{
- if (FIELD_IS_FUNC(signal)) {
+ if (flags & DIO_ENABLE_DIRECT_INPUT) {
+ /* enable digital input for direct wired peripheral */
+ REG_WRITE_MLV(DIO_CTL_REG(dio), DIO_CTL_IE_MASK,
+ DIO_CTL_IE_LSB, 1);
+ } else if (FIELD_IS_FUNC(signal)) {
/* Connect peripheral function to DIO */
if (flags & DIO_OUTPUT) {
/* drive DIO from peripheral */
diff --git a/chip/g/registers.h b/chip/g/registers.h
index a7ab14e67c..566bf063b3 100644
--- a/chip/g/registers.h
+++ b/chip/g/registers.h
@@ -185,6 +185,7 @@ static inline int x_uart_addr(int ch, int offset)
/* Flags to indicate the direction of the signal-to-pin connection */
#define DIO_INPUT 0x0001
#define DIO_OUTPUT 0x0002
+#define DIO_ENABLE_DIRECT_INPUT 0x0004
/*
* To store a pinmux DIO in the struct gpio_alt_func's mask field, we use: