diff options
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | board/daisy/board.c | 29 | ||||
-rw-r--r-- | board/pit/board.c | 2 | ||||
-rw-r--r-- | board/pit/board.h | 1 | ||||
-rw-r--r-- | board/puppy/board.c | 2 | ||||
-rw-r--r-- | board/puppy/board.h | 1 | ||||
-rw-r--r-- | board/snow/board.c | 2 | ||||
-rw-r--r-- | board/snow/board.h | 1 | ||||
-rw-r--r-- | board/spring/board.c | 2 | ||||
-rw-r--r-- | board/spring/board.h | 1 | ||||
-rw-r--r-- | common/pmu_tps65090.c | 22 | ||||
-rw-r--r-- | include/config.h | 25 | ||||
-rw-r--r-- | include/pmu_tpschrome.h | 7 |
13 files changed, 59 insertions, 46 deletions
@@ -28,6 +28,9 @@ by Google. See below diagram for architecture. Build Options ============= +NOTE: see include/config.h for the current list. The information +below will be moved there over time. + - CONFIG_WATCHDOG_HELP Try to detect a watchdog that is about to fire, and print a trace. @@ -62,13 +65,6 @@ Build Options AC power is not connected, and high when it is connected. This uses GPIO_AC_STATUS for this purpose. -- CONFIG_PMU_FORCE_FET - - Force switching on and off the FETs on the PMU controlling various - power rails during AP startup and shutdown sequences. - This is mainly useful for bringup when we don't have the corresponding - sequences in the AP code. - - CONFIG_KEYBOARD_TEST Turn on keyboard testing functionality. This enables a message which diff --git a/board/daisy/board.c b/board/daisy/board.c index dbd27ed0ef..d9a384983d 100644 --- a/board/daisy/board.c +++ b/board/daisy/board.c @@ -163,3 +163,32 @@ void keyboard_suppress_noise(void) gpio_set_level(GPIO_CODEC_INT, 0); gpio_set_level(GPIO_CODEC_INT, 1); } + +/** + * Board-specific PMU init. + */ + +#define CG_CTRL0 0x04 +#define CG_CTRL3 0x07 + +int pmu_board_init(void) +{ + int failure = 0; + + /* Init configuration + * Fast charge timer : 2 hours + * Charger : disable + * External pin control : enable + * + * TODO: move settings to battery pack specific init + */ + if (!failure) + failure = pmu_write(CG_CTRL0, 2); + /* Limit full charge current to 50% + * TODO: remove this temporary hack. + */ + if (!failure) + failure = pmu_write(CG_CTRL3, 0xbb); + + return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; +} diff --git a/board/pit/board.c b/board/pit/board.c index 5ba14e3439..018fbbf0f8 100644 --- a/board/pit/board.c +++ b/board/pit/board.c @@ -100,7 +100,6 @@ void board_config_post_gpio_init(void) gpio_set_alternate_function(GPIO_B, (1 << 3), GPIO_ALT_TIM2); } -#ifdef CONFIG_PMU_BOARD_INIT int pmu_board_init(void) { int ver, failure = 0; @@ -162,4 +161,3 @@ int pmu_board_init(void) return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; } -#endif /* CONFIG_BOARD_PMU_INIT */ diff --git a/board/pit/board.h b/board/pit/board.h index 2877c030c7..7ef77aa2e2 100644 --- a/board/pit/board.h +++ b/board/pit/board.h @@ -34,7 +34,6 @@ #define CONFIG_I2C #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_LID_SWITCH -#define CONFIG_PMU_BOARD_INIT #define CONFIG_PMU_HARD_RESET #define CONFIG_PMU_TPS65090 #define CONFIG_SPI diff --git a/board/puppy/board.c b/board/puppy/board.c index 0835305c91..1d288d6848 100644 --- a/board/puppy/board.c +++ b/board/puppy/board.c @@ -97,7 +97,6 @@ void board_config_post_gpio_init(void) GPIO_ALT_USART); } -#ifdef CONFIG_PMU_BOARD_INIT int pmu_board_init(void) { int ver, failure = 0; @@ -159,4 +158,3 @@ int pmu_board_init(void) return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; } -#endif /* CONFIG_BOARD_PMU_INIT */ diff --git a/board/puppy/board.h b/board/puppy/board.h index 9059447155..f4f3b9a90d 100644 --- a/board/puppy/board.h +++ b/board/puppy/board.h @@ -34,7 +34,6 @@ #define CONFIG_I2C #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_LID_SWITCH -#define CONFIG_PMU_BOARD_INIT #define CONFIG_PMU_HARD_RESET #define CONFIG_PMU_TPS65090 #define CONFIG_SPI diff --git a/board/snow/board.c b/board/snow/board.c index 4b9c0cdcc8..ef5f8488c8 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -195,7 +195,6 @@ static void board_shutdown_hook(void) } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT); -#ifdef CONFIG_PMU_BOARD_INIT int pmu_board_init(void) { int ver, failure = 0; @@ -257,4 +256,3 @@ int pmu_board_init(void) return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; } -#endif /* CONFIG_BOARD_PMU_INIT */ diff --git a/board/snow/board.h b/board/snow/board.h index d80fd28892..add3a9a8ef 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -38,7 +38,6 @@ #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_KEYBOARD_SUPPRESS_NOISE #define CONFIG_LID_SWITCH -#define CONFIG_PMU_BOARD_INIT #define CONFIG_PMU_HARD_RESET #define CONFIG_PMU_TPS65090 diff --git a/board/spring/board.c b/board/spring/board.c index ff7c0fe5b3..98ffe3882e 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -203,7 +203,6 @@ static void board_shutdown_hook(void) } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT); -#ifdef CONFIG_PMU_BOARD_INIT int pmu_board_init(void) { int failure = 0; @@ -239,4 +238,3 @@ int pmu_board_init(void) return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; } -#endif /* CONFIG_BOARD_PMU_INIT */ diff --git a/board/spring/board.h b/board/spring/board.h index be759987fe..eda82603c8 100644 --- a/board/spring/board.h +++ b/board/spring/board.h @@ -40,7 +40,6 @@ #define CONFIG_LID_SWITCH #define CONFIG_LOW_POWER_IDLE /* Use STOP mode when we have nothing to do */ #define CONFIG_LED_DRIVER_LP5562 -#define CONFIG_PMU_BOARD_INIT #define CONFIG_PMU_FORCE_FET /* Always enable 3G modem power rail */ #define CONFIG_PMU_HARD_RESET #define CONFIG_PMU_TPS65090 diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c index 431b22ac06..c797919da2 100644 --- a/common/pmu_tps65090.c +++ b/common/pmu_tps65090.c @@ -587,26 +587,8 @@ void pmu_init(void) int failure = 0, retries_remaining = 3; while (--retries_remaining >= 0) { - failure = 0; -#ifdef CONFIG_PMU_BOARD_INIT - if (!failure) - failure = pmu_board_init(); -#else - /* Init configuration - * Fast charge timer : 2 hours - * Charger : disable - * External pin control : enable - * - * TODO: move settings to battery pack specific init - */ - if (!failure) - failure = pmu_write(CG_CTRL0, 2); - /* Limit full charge current to 50% - * TODO: remove this temporary hack. - */ - if (!failure) - failure = pmu_write(CG_CTRL3, 0xbb); -#endif + failure = pmu_board_init(); + /* Enable interrupts */ if (!failure) { failure = pmu_write(IRQ1MASK, diff --git a/include/config.h b/include/config.h index 3e7e6ad1a2..d86c6381d2 100644 --- a/include/config.h +++ b/include/config.h @@ -63,7 +63,6 @@ /*****************************************************************************/ -#undef CONFIG_BOARD_PMU_INIT #undef CONFIG_BOARD_POST_GPIO_INIT #undef CONFIG_BOARD_PRE_INIT #undef CONFIG_BOARD_VERSION @@ -108,6 +107,7 @@ #undef CONFIG_CHIPSET_IVYBRIDGE #undef CONFIG_CMD_COMXTEST +#undef CONFIG_CMD_DISCHARGE_ON_AC /* TODO(rspangler): poorly named */ #undef CONFIG_CMD_ECTEMP #undef CONFIG_CMD_PLL #undef CONFIG_CMD_PMU @@ -193,11 +193,31 @@ #undef CONFIG_PANIC_HELP #undef CONFIG_PECI -#undef CONFIG_PMU_BOARD_INIT +/*****************************************************************************/ +/* PMU config */ + +/* + * Force switching on and off the FETs on the PMU controlling various power + * rails during AP startup and shutdown sequences. This is mainly useful for + * bringup when we don't have the corresponding sequences in the AP code. + * + * Currently supported only on spring platform. + */ #undef CONFIG_PMU_FORCE_FET + +/* + * Enable hard-resetting the PMU from the EC. The implementation is rather + * hacky; it simply shorts out the 3.3V rail to force the PMIC to panic. We + * need this unfortunate hack because it's the only way to reset the I2C engine + * inside the PMU. + */ #undef CONFIG_PMU_HARD_RESET + +/* Compile support for TPS65090 PMU */ #undef CONFIG_PMU_TPS65090 +/*****************************************************************************/ + #undef CONFIG_POWER_BUTTON #undef CONFIG_POWER_BUTTON_X86 #undef CONFIG_PSTATE_AT_END @@ -207,7 +227,6 @@ #undef CONFIG_RAM_BASE #undef CONFIG_RAM_SIZE #undef CONFIG_SAVE_VBOOT_HASH -#undef CONFIG_SOMETHING #undef CONFIG_SPI #undef CONFIG_STACK_SIZE #undef CONFIG_SWITCH diff --git a/include/pmu_tpschrome.h b/include/pmu_tpschrome.h index fc25fd345c..7c610a01b6 100644 --- a/include/pmu_tpschrome.h +++ b/include/pmu_tpschrome.h @@ -286,15 +286,14 @@ enum charging_state charge_get_state(void); */ int charge_keep_power_off(void); -#ifdef CONFIG_PMU_BOARD_INIT /** * Initialize PMU registers using board settings. * - * Boards may supply this function if needed. This will be called from - * pmu_init(). + * Boards must supply this function. This will be called from pmu_init(). + * + * @return EC_SUCCESS, or non-zero if error. */ int pmu_board_init(void); -#endif #endif /* __CROS_EC_TPSCHROME_H */ |