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 <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26139
This commit is contained in:
Simon Glass
2012-06-26 14:02:21 -07:00
parent b38e3405ea
commit 7d465e6d55
4 changed files with 6 additions and 17 deletions

View File

@@ -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

View File

@@ -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 */

View File

@@ -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},

View File

@@ -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 */