summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/lm4/chip_temp_sensor.c7
-rw-r--r--chip/lm4/lpc.c3
-rw-r--r--chip/lm4/system.c13
-rw-r--r--chip/stm32l/system.c14
-rw-r--r--common/charger_bq24725.c9
-rw-r--r--common/main.c13
-rw-r--r--common/port80.c14
-rw-r--r--common/temp_sensor.c7
-rw-r--r--include/charger.h3
-rw-r--r--include/chip_temp_sensor.h8
-rw-r--r--include/port80.h5
-rw-r--r--include/system.h3
-rw-r--r--include/temp_sensor.h7
13 files changed, 22 insertions, 84 deletions
diff --git a/chip/lm4/chip_temp_sensor.c b/chip/lm4/chip_temp_sensor.c
index 89cac21765..657f582275 100644
--- a/chip/lm4/chip_temp_sensor.c
+++ b/chip/lm4/chip_temp_sensor.c
@@ -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;
-}
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 18fac5b7ac..647ed67e7d 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -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;
}
diff --git a/chip/lm4/system.c b/chip/lm4/system.c
index 56d0525c0a..f3bcf85a62 100644
--- a/chip/lm4/system.c
+++ b/chip/lm4/system.c
@@ -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
diff --git a/chip/stm32l/system.c b/chip/stm32l/system.c
index aaa05253bd..e045114ee1 100644
--- a/chip/stm32l/system.c
+++ b/chip/stm32l/system.c
@@ -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
diff --git a/common/charger_bq24725.c b/common/charger_bq24725.c
index bd52e2e854..5df2cc7803 100644
--- a/common/charger_bq24725.c
+++ b/common/charger_bq24725.c
@@ -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);
}
diff --git a/common/main.c b/common/main.c
index 1b72d9f9ab..606a04d830 100644
--- a/common/main.c
+++ b/common/main.c
@@ -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
diff --git a/common/port80.c b/common/port80.c
index 9e6ba40c1f..77ff6fa471 100644
--- a/common/port80.c
+++ b/common/port80.c
@@ -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;
-}
diff --git a/common/temp_sensor.c b/common/temp_sensor.c
index 40d245bc0c..36c24632cb 100644
--- a/common/temp_sensor.c
+++ b/common/temp_sensor.c
@@ -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;
-}
diff --git a/include/charger.h b/include/charger.h
index 65ba8c1b48..899dbd4883 100644
--- a/include/charger.h
+++ b/include/charger.h
@@ -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);
diff --git a/include/chip_temp_sensor.h b/include/chip_temp_sensor.h
index 08417cd3d8..867733d2db 100644
--- a/include/chip_temp_sensor.h
+++ b/include/chip_temp_sensor.h
@@ -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 */
diff --git a/include/port80.h b/include/port80.h
index 060ee7bbd8..787af8c169 100644
--- a/include/port80.h
+++ b/include/port80.h
@@ -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);
diff --git a/include/system.h b/include/system.h
index 799d324998..36a8998b35 100644
--- a/include/system.h
+++ b/include/system.h
@@ -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);
diff --git a/include/temp_sensor.h b/include/temp_sensor.h
index d3ce646a19..158868b66c 100644
--- a/include/temp_sensor.h
+++ b/include/temp_sensor.h
@@ -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);