mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 09:01:35 +00:00
Add CONFIG_BRINGUP option to help debug signals for bringup
When this option is configured, two changes take place.
First, the AP doesn't power on by default when the EC reboots. To boot it,
you can run the "powerbtn" command, or poke the power button manually, or
any of the normal things.
Second, we watch for power-related signal changes (anything that's connected
to the power_signal_interrupt() function) and keep track of them as they
happen. After a second with no further changes, we print the time and value
of each change. For example:
[19.939212 Port 80: 0x29]
[19.967971 HC 0x23]
[19.976236 Port 80: 0x3a]
[19.995700 HC 0x87]
[20.567884 Port 80: 0x73]
11 signal changes:
19.638241 +0.000000 PCH_SLP_SUS_L => 1
19.654378 +0.016137 PCH_SLP_S5_L => 1
19.654457 +0.000079 PCH_SLP_A_L => 1
19.654535 +0.000078 PCH_SLP_S3_L => 1
19.654587 +0.000052 PCH_SLP_S4_L => 1
19.659630 +0.005043 PGOOD_1_5V_DDR => 1
19.663199 +0.003569 PGOOD_1_5V_PCH => 1
19.664751 +0.001552 PGOOD_1_8VS => 1
19.668735 +0.003984 PGOOD_VCCP => 1
19.671883 +0.003148 PGOOD_VCCSA => 1
19.868406 +0.196523 PGOOD_CPU_CORE => 1
[21.908551 Port 80: 0xf0]
[21.908855 HC 0x48]
BUG=none
BRANCH=ToT
TEST=manual
Build with CONFIG_BRINGUP, notice those two changes.
Change-Id: I55fd2021a0eae7dbfd1aaf5d93971f65bf2367b9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/202574
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
1732ba691e
commit
565f1cb5ae
@@ -111,6 +111,10 @@ test_mockable int main(void)
|
||||
CPRINTF("[Image: %s, %s]\n",
|
||||
system_get_image_copy_string(), system_get_build_info());
|
||||
|
||||
#ifdef CONFIG_BRINGUP
|
||||
ccprintf("\n\nWARNING: BRINGUP BUILD\n\n\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
/*
|
||||
* Intialize watchdog timer. All lengthy operations between now and
|
||||
|
||||
@@ -214,8 +214,13 @@ static void set_initial_pwrbtn_state(void)
|
||||
* All other EC reset conditions power on the main processor so
|
||||
* it can verify the EC.
|
||||
*/
|
||||
#ifdef CONFIG_BRINGUP
|
||||
CPRINTS("PB idle");
|
||||
pwrbtn_state = PWRBTN_STATE_IDLE;
|
||||
#else
|
||||
CPRINTS("PB init-on");
|
||||
pwrbtn_state = PWRBTN_STATE_INIT_ON;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,10 @@
|
||||
/* Permanent LM4 boot configuration */
|
||||
#undef CONFIG_BOOTCFG_VALUE
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Modify the default behavior to make system bringup easier. */
|
||||
#undef CONFIG_BRINGUP
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
/* Console output macros */
|
||||
#define CPUTS(outstr) cputs(CC_CHIPSET, outstr)
|
||||
#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
|
||||
#define CPRINTF(format, args...) cprintf(CC_SWITCH, format, ## args)
|
||||
|
||||
/*
|
||||
* Default timeout in us; if we've been waiting this long for an input
|
||||
@@ -332,8 +333,73 @@ DECLARE_HOOK(HOOK_AC_CHANGE, power_ac_change, HOOK_PRIO_DEFAULT);
|
||||
/*****************************************************************************/
|
||||
/* Interrupts */
|
||||
|
||||
#ifdef CONFIG_BRINGUP
|
||||
#define MAX_SIGLOG_ENTRIES 24
|
||||
|
||||
static unsigned int siglog_entries;
|
||||
static unsigned int siglog_truncated;
|
||||
|
||||
static struct {
|
||||
timestamp_t time;
|
||||
enum gpio_signal signal;
|
||||
int level;
|
||||
} siglog[MAX_SIGLOG_ENTRIES];
|
||||
|
||||
static void siglog_deferred(void)
|
||||
{
|
||||
const struct gpio_info *g = gpio_list;
|
||||
unsigned int i;
|
||||
timestamp_t tdiff = {.val = 0};
|
||||
|
||||
/* Disable interrupts for input signals while we print stuff.*/
|
||||
for (i = 0; i < POWER_SIGNAL_COUNT; i++)
|
||||
gpio_disable_interrupt(power_signal_list[i].gpio);
|
||||
|
||||
CPRINTF("%d signal changes:\n", siglog_entries);
|
||||
for (i = 0; i < siglog_entries; i++) {
|
||||
if (i)
|
||||
tdiff.val = siglog[i].time.val - siglog[i-1].time.val;
|
||||
CPRINTF(" %.6ld +%.6ld %s => %d\n",
|
||||
siglog[i].time.val, tdiff.val,
|
||||
g[siglog[i].signal].name,
|
||||
siglog[i].level);
|
||||
}
|
||||
if (siglog_truncated)
|
||||
CPRINTF(" SIGNAL LOG TRUNCATED...\n");
|
||||
siglog_entries = siglog_truncated = 0;
|
||||
|
||||
/* Okay, turn 'em on again. */
|
||||
for (i = 0; i < POWER_SIGNAL_COUNT; i++)
|
||||
gpio_enable_interrupt(power_signal_list[i].gpio);
|
||||
}
|
||||
DECLARE_DEFERRED(siglog_deferred);
|
||||
|
||||
static void siglog_add(enum gpio_signal signal)
|
||||
{
|
||||
if (siglog_entries >= MAX_SIGLOG_ENTRIES) {
|
||||
siglog_truncated = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
siglog[siglog_entries].time = get_time();
|
||||
siglog[siglog_entries].signal = signal;
|
||||
siglog[siglog_entries].level = gpio_get_level(signal);
|
||||
siglog_entries++;
|
||||
|
||||
hook_call_deferred(siglog_deferred, SECOND);
|
||||
}
|
||||
|
||||
#define SIGLOG(S) siglog_add(S)
|
||||
|
||||
#else
|
||||
#define SIGLOG(S)
|
||||
#endif /* CONFIG_BRINGUP */
|
||||
|
||||
|
||||
void power_signal_interrupt(enum gpio_signal signal)
|
||||
{
|
||||
SIGLOG(signal);
|
||||
|
||||
/* Shadow signals and compare with our desired signal state. */
|
||||
power_update_signals();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user