From 581dd6a531aee42eade6774721117b110b40aeb8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 21 Aug 2012 17:26:57 +0100 Subject: [PATCH] i2c: Enable arbitration GPIOs only when active Only setup the arbitration GPIOs when CONFIG_ARBITRATE_I2C is set. BUG=chrome-os-partner:13064 BRANCH=snow TEST=manual build and boot on snow On the EC: > pmu 1000 In U-Boot: cros_test i2c See that there are no failures. Change-Id: I8a7724700ff79406527c3db8708833728eb9a978 Signed-off-by: Simon Glass Reviewed-on: https://gerrit.chromium.org/gerrit/31305 --- board/snow/board.c | 10 ++++++---- board/snow/board.h | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/board/snow/board.c b/board/snow/board.c index d4cd99cd16..72f4d3d499 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -55,11 +55,11 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, matrix_interrupt}, /* Other inputs */ {"AC_PWRBTN_L", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL}, - {"SPI1_NSS", GPIO_A, (1<<4), GPIO_PULL_UP, NULL}, + {"SPI1_NSS", GPIO_A, (1<<4), GPIO_DEFAULT, NULL}, /* Outputs */ {"AC_STATUS", GPIO_A, (1<<5), GPIO_DEFAULT, NULL}, - {"SPI1_MISO", GPIO_A, (1<<6), GPIO_OUT_HIGH, NULL}, + {"SPI1_MISO", GPIO_A, (1<<6), GPIO_DEFAULT, 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}, @@ -149,6 +149,10 @@ void configure_board_late(void) #ifdef CONFIG_AC_POWER_STATUS gpio_set_flags(GPIO_AC_STATUS, GPIO_OUT_HIGH); #endif +#ifdef CONFIG_ARBITRATE_I2C + gpio_set_flags(GPIO_AP_CLAIM, GPIO_PULL_UP); + gpio_set_flags(GPIO_EC_CLAIM, GPIO_OUT_HIGH); +#endif } void board_interrupt_host(int active) @@ -205,8 +209,6 @@ enum { }; #ifdef CONFIG_ARBITRATE_I2C -#define GPIO_AP_CLAIM GPIO_SPI1_NSS -#define GPIO_EC_CLAIM GPIO_SPI1_MISO int board_i2c_claim(int port) { diff --git a/board/snow/board.h b/board/snow/board.h index 262fe14890..434304c6bf 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -54,6 +54,9 @@ #define I2C_PORT_SLAVE 1 #define CONFIG_ARBITRATE_I2C I2C_PORT_HOST +#define GPIO_AP_CLAIM GPIO_SPI1_NSS /* AP claims bus */ +#define GPIO_EC_CLAIM GPIO_SPI1_MISO /* EC claims bus */ + #define CONFIG_CMD_PMU /* GPIO signal list */