From 7d465e6d5574e66764d6bd59ca8f06aa6fc84c45 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 26 Jun 2012 14:02:21 -0700 Subject: [PATCH] stm32: Use SPI ports for i2c arbitration We plan to use two of the SPI ports (NSS and MISO) for arbitration on the i2c host interface. In preparation for this, add the extra GPIO to the table, and change NSS to a pull-up. BUG=chrome-os-partner:10888 TEST=manual: build for all boards boot on snow Change-Id: I70962b25f371a4ca54f0ce67dcf0bc33b1cc8c47 Signed-off-by: Simon Glass Reviewed-on: https://gerrit.chromium.org/gerrit/26139 --- board/daisy/board.c | 18 ++---------------- board/daisy/board.h | 1 + board/snow/board.c | 3 ++- board/snow/board.h | 1 + 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/board/daisy/board.c b/board/daisy/board.c index 8f20fdb18f..82a1440665 100644 --- a/board/daisy/board.c +++ b/board/daisy/board.c @@ -60,9 +60,10 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, matrix_interrupt}, {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt}, /* Other inputs */ - {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_RISING, NULL}, + {"SPI1_NSS", GPIO_A, (1<<4), GPIO_PULL_UP, NULL}, /* Outputs */ + {"SPI1_MISO", GPIO_A, (1<<6), GPIO_OUT_HIGH, NULL}, {"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL}, {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, @@ -142,21 +143,6 @@ void configure_board(void) /* Enable SPI */ STM32_RCC_APB2ENR |= (1<<12); - /* SPI1 on pins PA4-7 (push-pull, no pullup/down, 10MHz) */ - STM32_GPIO_PUPDR_OFF(GPIO_A) &= ~((2 << (7 * 2)) | - (2 << (6 * 2)) | - (2 << (5 * 2)) | - (2 << (4 * 2))); - STM32_GPIO_OTYPER_OFF(GPIO_A) &= ~((1 << 7) | - (1 << 6) | - (1 << 5) | - (1 << 4)); - gpio_set_alternate_function(GPIO_A, (1<<7) | - (1<<6) | - (1<<5) | - (1<<4), GPIO_ALT_SPI); - STM32_GPIO_OSPEEDR_OFF(GPIO_A) |= 0xff00; - /* * I2C SCL/SDA on PB10-11 and PB6-7, bi-directional, no pull-up/down, * initialized as hi-Z until alt. function is set diff --git a/board/daisy/board.h b/board/daisy/board.h index 9a772ddc8c..cc0d1eec10 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -64,6 +64,7 @@ enum gpio_signal { /* Other inputs */ GPIO_SPI1_NSS, /* Outputs */ + GPIO_SPI1_MISO, GPIO_EN_PP1350, /* DDR 1.35v rail enable */ GPIO_EN_PP5000, /* 5.0v rail enable */ GPIO_EN_PP3300, /* 3.3v rail enable */ diff --git a/board/snow/board.c b/board/snow/board.c index 1825870ec3..b536ff3eda 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -46,9 +46,10 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, matrix_interrupt}, {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt}, /* Other inputs */ - {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_RISING, NULL}, + {"SPI1_NSS", GPIO_A, (1<<4), GPIO_PULL_UP, NULL}, /* Outputs */ + {"SPI1_MISO", GPIO_A, (1<<6), GPIO_OUT_HIGH, NULL}, {"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL}, {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, diff --git a/board/snow/board.h b/board/snow/board.h index b09d0238d8..605a9f93bb 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -71,6 +71,7 @@ enum gpio_signal { /* Other inputs */ GPIO_SPI1_NSS, /* Outputs */ + GPIO_SPI1_MISO, GPIO_EN_PP1350, /* DDR 1.35v rail enable */ GPIO_EN_PP5000, /* 5.0v rail enable */ GPIO_EN_PP3300, /* 3.3v rail enable */