summaryrefslogtreecommitdiff
path: root/board/cr50/usb_spi.c
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2016-06-30 14:18:14 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-14 23:34:38 -0700
commit41f872ed53be4bc33dd1127c33057d884f2fd6c2 (patch)
tree669757ca613271872e0d06cdf2c6d53c3e1d687f /board/cr50/usb_spi.c
parentf6c7abb503f04bd16071534aae7af541ea328d27 (diff)
downloadchrome-ec-41f872ed53be4bc33dd1127c33057d884f2fd6c2.tar.gz
g: tristate spi master pins
Having DIO A4, A8, and A14 connected to the spi master output pads prevents reef from booting. We need to tristate those pins when spi ccd is not in use. This change disconnects those pins from the spi peripheral when spi is disabled and reconnects them when spi is enabled. BUG=chrome-os-partner:53582 BRANCH=none TEST=manual use 'pinmux' to verify DIOA4, DIOA8, and DIOA14 are set have GPIO 7, 8, and 9 as their output sources when not using the usb spi interface. Check the usb spi interface still works. Enable usb spi then disable ccd and check that the pins are connected back to the non-peripheral gpios. Verify the AP on kevin and reef can be flashed using servo. Verify the AP boots successfully on both. Change-Id: I85d70422a30da445076432d2bfc81960aeba8578 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/357883 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'board/cr50/usb_spi.c')
-rw-r--r--board/cr50/usb_spi.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/board/cr50/usb_spi.c b/board/cr50/usb_spi.c
index 441ae94ae6..cb70aa82f4 100644
--- a/board/cr50/usb_spi.c
+++ b/board/cr50/usb_spi.c
@@ -72,6 +72,13 @@ void usb_spi_board_enable(struct usb_spi_config const *config)
return;
}
+ /* Connect DIO A4, A8, and A14 to the SPI peripheral */
+ GWRITE(PINMUX, DIOA4_SEL, 0); /* SPI_MOSI */
+ GWRITE(PINMUX, DIOA8_SEL, 0); /* SPI_CS_L */
+ GWRITE(PINMUX, DIOA14_SEL, 0); /* SPI_CLK */
+ /* Set SPI_CS to be an internal pull up */
+ GWRITE_FIELD(PINMUX, DIOA14_CTL, PU, 1);
+
CPRINTS("usb_spi enable %s",
gpio_get_level(GPIO_AP_FLASH_SELECT) ? "AP" : "EC");
@@ -83,6 +90,19 @@ void usb_spi_board_disable(struct usb_spi_config const *config)
CPRINTS("usb_spi disable");
spi_enable(CONFIG_SPI_FLASH_PORT, 0);
disable_spi();
+
+ /* Disconnect SPI peripheral to tri-state pads */
+ /* Disable internal pull up */
+ GWRITE_FIELD(PINMUX, DIOA14_CTL, PU, 0);
+ /* TODO: Implement way to get the gpio */
+ ASSERT(GREAD(PINMUX, GPIO0_GPIO7_SEL) == GC_PINMUX_DIOA4_SEL);
+ ASSERT(GREAD(PINMUX, GPIO0_GPIO8_SEL) == GC_PINMUX_DIOA8_SEL);
+ ASSERT(GREAD(PINMUX, GPIO0_GPIO9_SEL) == GC_PINMUX_DIOA14_SEL);
+
+ /* Set SPI MOSI, CLK, and CS_L as inputs */
+ GWRITE(PINMUX, DIOA4_SEL, GC_PINMUX_GPIO0_GPIO7_SEL);
+ GWRITE(PINMUX, DIOA8_SEL, GC_PINMUX_GPIO0_GPIO8_SEL);
+ GWRITE(PINMUX, DIOA14_SEL, GC_PINMUX_GPIO0_GPIO9_SEL);
}
int usb_spi_interface(struct usb_spi_config const *config,