Clean up and document PMU config options

No functional changes, just documenting and renaming.

All boards which use the PMU must provide pmu_board_init().  This was
already true - except that Daisy's pmu_board_init() was implemented as
part of pmu_init() instead of its code living in board.c; I've moved
the code there now.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I85ad06dc3b6287ad917fe13acf83182f24a8f23d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62906
Reviewed-by: Vic Yang <victoryang@chromium.org>
This commit is contained in:
Randall Spangler
2013-07-19 16:26:36 -07:00
committed by ChromeBot
parent 4288e45815
commit 64e38af781
13 changed files with 59 additions and 46 deletions

10
README
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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