Merge "Clean up inits"

This commit is contained in:
Gerrit
2012-04-19 11:47:46 -07:00
committed by Gerrit Code Review
13 changed files with 22 additions and 84 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
/* Copyright (c) 2012 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.
*/
@@ -22,8 +22,3 @@ int chip_temp_sensor_get_val(int idx)
{
return last_val;
}
int chip_temp_sensor_init(void)
{
return EC_SUCCESS;
}

View File

@@ -195,6 +195,9 @@ int lpc_init(void)
/* Enable LPC interrupt */
task_enable_irq(LM4_IRQ_LPC);
/* Enable COMx UART */
uart_comx_enable();
return EC_SUCCESS;
}

View File

@@ -29,8 +29,9 @@ static void check_reset_cause(void)
enum system_reset_cause_t reset_cause = SYSTEM_RESET_UNKNOWN;
uint32_t raw_reset_cause;
/* Read the raw reset cause */
/* Read and clear the raw reset cause */
raw_reset_cause = LM4_SYSTEM_RESC;
LM4_SYSTEM_RESC = 0;
if (hib_status & 0x0d) {
/* the hibernation module wakes up the system */
@@ -132,16 +133,6 @@ int system_pre_init(void)
}
int system_init(void)
{
/* Clear the hardware reset cause, now that we've committed to running
* this image. */
LM4_SYSTEM_RESC = 0;
return EC_SUCCESS;
}
int system_reset(int is_cold)
{
/* TODO: (crosbug.com/p/7470) support cold boot; this is a

View File

@@ -16,6 +16,9 @@ static void check_reset_cause(void)
enum system_reset_cause_t reset_cause = SYSTEM_RESET_UNKNOWN;
uint32_t raw_cause = STM32L_RCC_CSR;
/* Clear the hardware reset cause by setting the RMVF bit */
STM32L_RCC_CSR |= 1 << 24;
if (copy == SYSTEM_IMAGE_RW_A || copy == SYSTEM_IMAGE_RW_B) {
/* If we're in image A or B, the only way we can get there is
* via a warm reset. */
@@ -72,17 +75,6 @@ int system_pre_init(void)
}
int system_init(void)
{
/* Clear the hardware reset cause by setting the RMVF bit,
* now that we've committed to running this image.
*/
STM32L_RCC_CSR |= 1 << 24;
return EC_SUCCESS;
}
int system_reset(int is_cold)
{
/* TODO: (crosbug.com/p/7470) support cold boot; this is a

View File

@@ -160,8 +160,8 @@ int charger_set_voltage(int voltage)
return sbc_write(SB_CHARGING_VOLTAGE, voltage);
}
/* Initialization */
int charger_init(void)
/* Charging power state initialization */
int charger_post_init(void)
{
/* bq24725 power on reset state:
* watch dog timer = 175 sec
@@ -169,12 +169,7 @@ int charger_init(void)
* charging voltage = 0 mV
* charging current = 0 mA
*/
return EC_SUCCESS;
}
/* Charging power state initialization */
int charger_post_init(void)
{
/* Set charger input current limit */
return charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT);
}

View File

@@ -114,13 +114,13 @@ int main(void)
* RO image and once in the RW image. */
vboot_init();
system_init();
/* Initialize driver modules. These can occur in any order. State
* machines are initialized in their task functions, not here. */
gpio_init();
#ifdef CONFIG_LPC
port_80_init();
lpc_init();
uart_comx_enable();
#endif
#ifdef CONFIG_SPI
spi_init();
@@ -131,10 +131,6 @@ int main(void)
#ifdef CONFIG_I2C
i2c_init();
#endif
#ifdef CONFIG_TASK_TEMPSENSOR
temp_sensor_init();
chip_temp_sensor_init();
#endif
#ifdef CONFIG_TASK_POWERBTN
power_button_init();
#endif
@@ -144,9 +140,6 @@ int main(void)
#ifdef CONFIG_ONEWIRE
onewire_init();
#endif
#ifdef CONFIG_CHARGER
charger_init();
#endif
#ifdef CONFIG_PECI
peci_init();
#endif

View File

@@ -14,8 +14,8 @@
#define HISTORY_LEN 16
static uint8_t history[HISTORY_LEN];
static int head = 0; /* Next index to use / oldest previous entry */
static int scroll = 0;
static int head; /* Next index to use / oldest previous entry */
static int scroll;
void port_80_write(int data)
@@ -30,7 +30,6 @@ void port_80_write(int data)
head = (head + 1) & (HISTORY_LEN - 1);
}
/*****************************************************************************/
/* Console commands */
@@ -58,12 +57,3 @@ static int command_port80(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(port80, command_port80);
/*****************************************************************************/
/* Initialization */
int port_80_init(void)
{
memset(history, 0, sizeof(history));
return EC_SUCCESS;
}

View File

@@ -127,10 +127,3 @@ static int command_temps(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(temps, command_temps);
/*****************************************************************************/
/* Initialization */
int temp_sensor_init(void)
{
return EC_SUCCESS;
}

View File

@@ -27,9 +27,6 @@ struct charger_info {
uint16_t input_current_step;
};
/* Initializes the charger */
int charger_init(void);
/* Power state machine post init */
int charger_post_init(void);

View File

@@ -5,8 +5,8 @@
/* Temperature sensor module for LM4 chip */
#ifndef __CHIP_TEMP_SENSOR_H
#define __CHIP_TEMP_SENSOR_H
#ifndef __CROS_EC_CHIP_TEMP_SENSOR_H
#define __CROS_EC_CHIP_TEMP_SENSOR_H
struct temp_sensor_t;
@@ -16,6 +16,4 @@ int chip_temp_sensor_poll(void);
/* Temperature reading function. Return temperature in K. */
int chip_temp_sensor_get_val(int idx);
int chip_temp_sensor_init(void);
#endif /* __CHIP_TEMP_SENSOR_H */
#endif /* __CROS_EC_CHIP_TEMP_SENSOR_H */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
/* Copyright (c) 2012 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.
*/
@@ -10,9 +10,6 @@
#include "common.h"
/* Initializes the module. */
int port_80_init(void);
/* Called by LPC module when a byte of data is written to port 80. */
void port_80_write(int data);

View File

@@ -53,9 +53,6 @@ int system_pre_init(void);
* system_pre_init(). */
int system_common_pre_init(void);
/* Initializes the system module. */
int system_init(void);
/* Returns the cause of the last reset, or SYSTEM_RESET_UNKNOWN if
* the cause is not known. */
enum system_reset_cause_t system_get_reset_cause(void);

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
/* Copyright (c) 2012 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.
*/
@@ -42,10 +42,7 @@ struct temp_sensor_t {
int idx;
};
/* Initializes the module. */
int temp_sensor_init(void);
/* Returns the most recently measured temperature for the sensor in K,
/* Return the most recently measured temperature for the sensor in K,
* or -1 if error. */
int temp_sensor_read(enum temp_sensor_id id);