mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 01:50:53 +00:00
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>
157 lines
4.0 KiB
C
157 lines
4.0 KiB
C
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* Main routine for Chrome EC
|
|
*/
|
|
|
|
#include "board_config.h"
|
|
#include "clock.h"
|
|
#include "common.h"
|
|
#include "console.h"
|
|
#include "cpu.h"
|
|
#include "dma.h"
|
|
#include "eeprom.h"
|
|
#include "eoption.h"
|
|
#include "flash.h"
|
|
#include "gpio.h"
|
|
#include "hooks.h"
|
|
#include "jtag.h"
|
|
#include "keyboard_scan.h"
|
|
#ifdef CONFIG_MPU
|
|
#include "mpu.h"
|
|
#endif
|
|
#include "system.h"
|
|
#include "task.h"
|
|
#include "timer.h"
|
|
#include "uart.h"
|
|
#include "watchdog.h"
|
|
|
|
/* Console output macros */
|
|
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
|
|
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
|
|
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
|
|
|
|
test_mockable int main(void)
|
|
{
|
|
/*
|
|
* Pre-initialization (pre-verified boot) stage. Initialization at
|
|
* this level should do as little as possible, because verified boot
|
|
* may need to jump to another image, which will repeat this
|
|
* initialization. In particular, modules should NOT enable
|
|
* interrupts.
|
|
*/
|
|
#ifdef CONFIG_BOARD_PRE_INIT
|
|
board_config_pre_init();
|
|
#endif
|
|
|
|
#ifdef CONFIG_MPU
|
|
mpu_pre_init();
|
|
#endif
|
|
|
|
/* Configure the pin multiplexers and GPIOs */
|
|
jtag_pre_init();
|
|
gpio_pre_init();
|
|
|
|
#ifdef CONFIG_BOARD_POST_GPIO_INIT
|
|
board_config_post_gpio_init();
|
|
#endif
|
|
/*
|
|
* Initialize interrupts, but don't enable any of them. Note that
|
|
* task scheduling is not enabled until task_start() below.
|
|
*/
|
|
task_pre_init();
|
|
|
|
/*
|
|
* Initialize the system module. This enables the hibernate clock
|
|
* source we need to calibrate the internal oscillator.
|
|
*/
|
|
system_pre_init();
|
|
system_common_pre_init();
|
|
|
|
#ifdef CONFIG_FLASH
|
|
/*
|
|
* Initialize flash and apply write protect if necessary. Requires
|
|
* the reset flags calculated by system initialization.
|
|
*/
|
|
flash_pre_init();
|
|
#endif
|
|
|
|
/* Set the CPU clocks / PLLs. System is now running at full speed. */
|
|
clock_init();
|
|
|
|
/*
|
|
* Initialize timer. Everything after this can be benchmarked.
|
|
* get_time() and udelay() may now be used. usleep() requires task
|
|
* scheduling, so cannot be used yet. Note that interrupts declared
|
|
* via DECLARE_IRQ() call timer routines when profiling is enabled, so
|
|
* timer init() must be before uart_init().
|
|
*/
|
|
timer_init();
|
|
|
|
/* Main initialization stage. Modules may enable interrupts here. */
|
|
cpu_init();
|
|
|
|
#ifdef CONFIG_DMA
|
|
/* Initialize DMA. Must be before UART. */
|
|
dma_init();
|
|
#endif
|
|
|
|
/* Initialize UART. Console output functions may now be used. */
|
|
uart_init();
|
|
|
|
if (system_jumped_to_this_image()) {
|
|
CPRINTS("UART initialized after sysjump");
|
|
} else {
|
|
CPUTS("\n\n--- UART initialized after reboot ---\n");
|
|
CPUTS("[Reset cause: ");
|
|
system_print_reset_flags();
|
|
CPUTS("]\n");
|
|
}
|
|
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
|
|
* task_start() must periodically call watchdog_reload() to avoid
|
|
* triggering a watchdog reboot. (This pretty much applies only to
|
|
* verified boot, because all *other* lengthy operations should be done
|
|
* by tasks.)
|
|
*/
|
|
watchdog_init();
|
|
#endif
|
|
|
|
/*
|
|
* Verified boot needs to read the initial keyboard state and EEPROM
|
|
* contents. EEPROM must be up first, so keyboard_scan can toggle
|
|
* debugging settings via keys held at boot.
|
|
*/
|
|
#ifdef CONFIG_EEPROM
|
|
eeprom_init();
|
|
#endif
|
|
#ifdef CONFIG_EOPTION
|
|
eoption_init();
|
|
#endif
|
|
#ifdef HAS_TASK_KEYSCAN
|
|
keyboard_scan_init();
|
|
#endif
|
|
|
|
/* Initialize the hook library. This calls HOOK_INIT hooks. */
|
|
hook_init();
|
|
|
|
/*
|
|
* Print the init time. Not completely accurate because it can't take
|
|
* into account the time before timer_init(), but it'll at least catch
|
|
* the majority of the time.
|
|
*/
|
|
CPRINTS("Inits done");
|
|
|
|
/* Launch task scheduling (never returns) */
|
|
return task_start();
|
|
}
|