diff options
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | board/bds/board.c | 5 | ||||
-rw-r--r-- | board/bds/board.h | 4 | ||||
-rw-r--r-- | board/daisy/board.c | 2 | ||||
-rw-r--r-- | board/daisy/board.h | 22 | ||||
-rw-r--r-- | board/link/board.c | 8 | ||||
-rw-r--r-- | board/link/board.h | 8 | ||||
-rw-r--r-- | board/mccroskey/board.c | 2 | ||||
-rw-r--r-- | board/mccroskey/board.h | 22 | ||||
-rw-r--r-- | board/snow/board.c | 5 | ||||
-rw-r--r-- | board/snow/board.h | 9 | ||||
-rw-r--r-- | board/spring/board.c | 3 | ||||
-rw-r--r-- | board/spring/board.h | 43 | ||||
-rw-r--r-- | common/main.c | 9 | ||||
-rw-r--r-- | include/board_config.h | 35 | ||||
-rw-r--r-- | include/x86_power.h | 6 |
16 files changed, 91 insertions, 97 deletions
@@ -55,11 +55,6 @@ Build Options ASSERTION FAILURE '<expr>' in function() at file:line -- CONFIG_CONFIGURE_BOARD_LATE - - Define this to call configure_board_late() after initial system init - is complete (and after GPIOs are set up). - - CONFIG_AC_POWER_STATUS Monitor the state of the AC power input and drive out a GPIO to diff --git a/board/bds/board.c b/board/bds/board.c index ccbe69b38c..92372437a5 100644 --- a/board/bds/board.c +++ b/board/bds/board.c @@ -46,8 +46,3 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { GPIO_SIGNAL_NOT_IMPLEMENTED("WRITE_PROTECT"), GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"), }; - - -void configure_board(void) -{ -} diff --git a/board/bds/board.h b/board/bds/board.h index aa0d61f197..2250ef6e06 100644 --- a/board/bds/board.h +++ b/board/bds/board.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +/* 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. */ @@ -57,8 +57,6 @@ enum gpio_signal { * enabling the boot loader, simply to prove we can program it. */ #define BOOTCFG_VALUE 0xfffffdfe -void configure_board(void); - #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/daisy/board.c b/board/daisy/board.c index 30930066ab..a0f8cb3bd3 100644 --- a/board/daisy/board.c +++ b/board/daisy/board.c @@ -135,7 +135,7 @@ int board_i2c_host_port(void) } #endif /* CONFIG_I2C_HOST_AUTO */ -void configure_board(void) +void board_config_pre_init(void) { /* Enable all GPIOs clocks * TODO: more fine-grained enabling for power saving diff --git a/board/daisy/board.h b/board/daisy/board.h index c013b602a0..dcf9fb18d1 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -19,17 +19,24 @@ #define CONFIG_ASSERT_HELP /* Optional features */ +#define CONFIG_BOARD_PRE_INIT #define CONFIG_CHIPSET_GAIA #define CONFIG_EXTPOWER_SNOW #define CONFIG_I2C +#define CONFIG_I2C_HOST_AUTO #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_KEYBOARD_SUPPRESS_NOISE +#define CONFIG_PMU_TPS65090 +#define CONFIG_SMART_BATTERY -/* Allow dangerous commands all the time, since we don't have a write protect - * switch. */ -/* TODO: (crosbug.com/p/9986) This is a serious security hole and should be - * removed in mass production. We add this to allow manual firmware update. - * Once we complete the vboot and autoupdate, we should remove this. */ +/* + * Allow dangerous commands all the time, since we don't have a write protect + * switch. + * + * TODO: (crosbug.com/p/9986) This is a serious security hole and should be + * removed in mass production. Acceptable here only because daisy isn't a + * production board. + */ #define CONFIG_SYSTEM_UNLOCKED #ifndef __ASSEMBLER__ @@ -43,9 +50,6 @@ #define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ -#define CONFIG_SMART_BATTERY -#define CONFIG_PMU_TPS65090 -#define CONFIG_I2C_HOST_AUTO #define I2C_PORT_HOST board_i2c_host_port() #define I2C_PORT_BATTERY I2C_PORT_HOST #define I2C_PORT_CHARGER I2C_PORT_HOST @@ -109,8 +113,6 @@ enum gpio_signal { GPIO_COUNT }; -void configure_board(void); - /* Auto detect EC i2c host port */ int board_i2c_host_port(void); diff --git a/board/link/board.c b/board/link/board.c index 9cc74646b0..1d0a517412 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -16,10 +16,6 @@ #include "util.h" #include "x86_power.h" -#ifndef CONFIG_CHIPSET_X86 -#define x86_power_interrupt NULL -#endif - /* GPIO signal list. Must match order from enum gpio_signal. */ const struct gpio_info gpio_list[GPIO_COUNT] = { /* Inputs with interrupt handlers are first for efficiency */ @@ -140,7 +136,3 @@ const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = { {"lightbar", I2C_PORT_LIGHTBAR, 400}, {"thermal", I2C_PORT_THERMAL, 100}, }; - -void configure_board(void) -{ -} diff --git a/board/link/board.h b/board/link/board.h index b789f9c13c..8049358383 100644 --- a/board/link/board.h +++ b/board/link/board.h @@ -9,8 +9,10 @@ #define __BOARD_H /* Debug features */ -#define CONFIG_PANIC_HELP #define CONFIG_ASSERT_HELP +#define CONFIG_CONSOLE_CMDHELP +#define CONFIG_PANIC_HELP +#define CONFIG_TASK_PROFILING /* Optional features */ #define CONFIG_SMART_BATTERY @@ -18,7 +20,6 @@ #define CONFIG_CHARGER #define CONFIG_CHARGER_BQ24725 #define CONFIG_CHIPSET_X86 -#define CONFIG_CONSOLE_CMDHELP #define CONFIG_EXTPOWER_GPIO #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_LID_SWITCH @@ -27,7 +28,6 @@ #define CONFIG_ONEWIRE_LED #define CONFIG_PECI #define CONFIG_PWM -#define CONFIG_TASK_PROFILING #define CONFIG_TEMP_SENSOR #define CONFIG_TMP006 #define CONFIG_USB_CHARGE @@ -225,8 +225,6 @@ enum board_version { }; -void configure_board(void); - #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c index 22457fad3c..5be787edd5 100644 --- a/board/mccroskey/board.c +++ b/board/mccroskey/board.c @@ -97,7 +97,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { #endif }; -void configure_board(void) +void board_config_pre_init(void) { uint32_t val; diff --git a/board/mccroskey/board.h b/board/mccroskey/board.h index 2641885b36..79328181ab 100644 --- a/board/mccroskey/board.h +++ b/board/mccroskey/board.h @@ -9,13 +9,7 @@ #define __BOARD_H /* 48 MHz SYSCLK clock frequency */ -/* - * FIXME(dhendrix): We'll eventually switch to the HSE instead of HSI. - * Also, I2C is limited to 2-36MHz, so for now let's just use 16MHz until - * we're ready to switch to the HSE. FREQ in I2C1 CR2 also must be set - * appropriately. - */ -#define CPU_CLOCK 48000000 /* should be 48000000 */ +#define CPU_CLOCK 48000000 /* Use USART1 as console serial port */ #define CONFIG_CONSOLE_UART 1 @@ -23,21 +17,21 @@ /* Debug features */ #define CONFIG_ASSERT_HELP #define CONFIG_CONSOLE_CMDHELP +#define CONFIG_DEBUG_I2C /* FIXME(dhendrix): remove this eventually */ #define CONFIG_PANIC_HELP #undef CONFIG_TASK_PROFILING #define CONFIG_WATCHDOG_HELP /* Optional features */ +#define CONFIG_BOARD_PRE_INIT #define CONFIG_KEYBOARD_PROTOCOL_MKBP +#define CONFIG_I2C -/* use STOP mode when we have nothing to do */ /* - * FIXME(dhendrix): This causes the UART to drop characters and likely + * TODO(dhendrix): Stop mode causes the UART to drop characters and likely * other bad side-effects. Disable for now. */ -#if 0 -#define CONFIG_LOW_POWER_IDLE -#endif +#undef CONFIG_LOW_POWER_IDLE #ifndef __ASSEMBLER__ @@ -50,10 +44,8 @@ #define KB_OUT_PORT_LIST GPIO_C /* EC is I2C master */ -#define CONFIG_I2C #define I2C_PORT_HOST 0 #define I2C_PORT_SLAVE 0 /* needed for DMAC macros (ugh) */ -#define CONFIG_DEBUG_I2C /* FIXME(dhendrix): remove this eventually */ #define GPIO_I2C2_SCL 0 /* unused, but must be defined anyway */ #define GPIO_I2C2_SDA 0 /* unused, but must be defined anyway */ @@ -117,8 +109,6 @@ enum gpio_signal { GPIO_COUNT }; -void configure_board(void); - #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/snow/board.c b/board/snow/board.c index a7840105cc..86d7bcef83 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -4,6 +4,7 @@ */ /* Snow board-specific configuration */ +#include "board_config.h" #include "chipset.h" #include "common.h" #include "console.h" @@ -91,7 +92,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL}, }; -void configure_board(void) +void board_config_pre_init(void) { uint32_t val; @@ -161,7 +162,7 @@ void board_i2c_post_init(int port) } } -void configure_board_late(void) +void board_config_post_gpio_init(void) { #ifdef CONFIG_AC_POWER_STATUS gpio_set_flags(GPIO_AC_STATUS, GPIO_OUT_HIGH); diff --git a/board/snow/board.h b/board/snow/board.h index c9ab61d305..be883ae373 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -18,13 +18,15 @@ #define CONFIG_ASSERT_HELP #define CONFIG_CONSOLE_CMDHELP #define CONFIG_PANIC_HELP +#undef CONFIG_TASK_PROFILING #define CONFIG_WATCHDOG_HELP /* Optional features */ #define CONFIG_BATTERY_BQ20Z453 +#define CONFIG_BOARD_PRE_INIT +#define CONFIG_BOARD_POST_GPIO_INIT #define CONFIG_CHIPSET_GAIA #define CONFIG_CMD_PMU -#define CONFIG_CONFIGURE_BOARD_LATE #define CONFIG_EXTPOWER_SNOW #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C @@ -35,7 +37,6 @@ #define CONFIG_PMU_HARD_RESET #define CONFIG_PMU_TPS65090 #define CONFIG_SMART_BATTERY -#undef CONFIG_TASK_PROFILING /* use STOP mode when we have nothing to do */ #define CONFIG_LOW_POWER_IDLE @@ -119,10 +120,6 @@ enum gpio_signal { GPIO_COUNT }; -void configure_board(void); - -void configure_board_late(void); - #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/spring/board.c b/board/spring/board.c index e40e3c1e3a..4d80769276 100644 --- a/board/spring/board.c +++ b/board/spring/board.c @@ -5,6 +5,7 @@ /* Spring board-specific configuration */ #include "adc.h" +#include "board_config.h" #include "chipset.h" #include "common.h" #include "console.h" @@ -108,7 +109,7 @@ const struct adc_t adc_channels[ADC_CH_COUNT] = { [ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 3300, 4096, 0, STM32_AIN(4)}, }; -void configure_board(void) +void board_config_pre_init(void) { uint32_t val; diff --git a/board/spring/board.h b/board/spring/board.h index 36775dd6fd..0fef5d2adc 100644 --- a/board/spring/board.h +++ b/board/spring/board.h @@ -22,20 +22,23 @@ #define CONFIG_WATCHDOG_HELP /* Optional features */ +#define CONFIG_ADC +#define CONFIG_BATTERY_BQ20Z453 +#define CONFIG_BOARD_PRE_INIT #define CONFIG_CHIPSET_GAIA +#define CONFIG_CMD_PMU #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C +#define CONFIG_I2C_PASSTHROUGH #define CONFIG_KEYBOARD_PROTOCOL_MKBP +#define CONFIG_LOW_POWER_IDLE /* Use STOP mode when we have nothing to do */ +#define CONFIG_LP5562 +#define CONFIG_PMU_BOARD_INIT +#define CONFIG_PMU_FORCE_FET /* Always enable 3G modem power rail */ #define CONFIG_PMU_HARD_RESET - -/* use STOP mode when we have nothing to do */ -#define CONFIG_LOW_POWER_IDLE - -/* Smart battery and TPSchrome are on a private I2C bus behind the EC */ -#define CONFIG_I2C_PASSTHROUGH - -/* always enable the 3G modem power rail */ -#define CONFIG_PMU_FORCE_FET +#define CONFIG_PMU_TPS65090 +#define CONFIG_SMART_BATTERY +#define CONFIG_TSU6721 #ifndef __ASSEMBLER__ @@ -46,39 +49,24 @@ #define KB_OUT_PORT_LIST GPIO_B, GPIO_C /* Charging */ -#define CONFIG_SMART_BATTERY -#define CONFIG_PMU_TPS65090 -#define CONFIG_PMU_BOARD_INIT #define I2C_PORT_HOST 0 #define I2C_PORT_BATTERY I2C_PORT_HOST #define I2C_PORT_CHARGER I2C_PORT_HOST #define I2C_PORT_SLAVE 1 -#define CONFIG_CMD_PMU - -/* Battery */ -#define CONFIG_BATTERY_BQ20Z453 - /* Low battery threshold. In mAh. */ #define BATTERY_AP_OFF_LEVEL 1 -/* Charger/accessories detection */ -#define CONFIG_TSU6721 - -/* Battery LED driver */ -#define CONFIG_LP5562 - /* Timer selection */ #define TIM_CLOCK_MSB 2 #define TIM_CLOCK_LSB 4 /* ADC signal */ -#define CONFIG_ADC enum adc_channel { ADC_CH_USB_VBUS_SNS = 0, ADC_CH_USB_DP_SNS, ADC_CH_USB_DN_SNS, - + /* Number of ADC channels */ ADC_CH_COUNT }; @@ -144,11 +132,6 @@ enum ilim_config { ILIM_CONFIG_PWM, }; -/* Forward declaration */ -enum charging_state; - -void configure_board(void); - /* Set ILIM pin control type */ void board_ilim_config(enum ilim_config config); diff --git a/common/main.c b/common/main.c index 6ee477931f..2430caac79 100644 --- a/common/main.c +++ b/common/main.c @@ -5,6 +5,7 @@ * Main routine for Chrome EC */ +#include "board_config.h" #include "clock.h" #include "common.h" #include "console.h" @@ -35,14 +36,16 @@ int main(void) * initialization. In particular, modules should NOT enable * interrupts. */ +#ifdef CONFIG_BOARD_PRE_INIT + board_config_pre_init(); +#endif /* Configure the pin multiplexers and GPIOs */ - configure_board(); jtag_pre_init(); gpio_pre_init(); -#ifdef CONFIG_CONFIGURE_BOARD_LATE - configure_board_late(); +#ifdef CONFIG_BOARD_POST_GPIO_INIT + board_config_post_gpio_init(); #endif /* * Initialize interrupts, but don't enable any of them. Note that diff --git a/include/board_config.h b/include/board_config.h new file mode 100644 index 0000000000..0a97b8a181 --- /dev/null +++ b/include/board_config.h @@ -0,0 +1,35 @@ +/* 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. + */ + +#ifndef __CROS_EC_BOARD_CONFIG_H +#define __CROS_EC_BOARD_CONFIG_H + +#include "common.h" + +#ifdef CONFIG_BOARD_PRE_INIT +/** + * Configure board before any inits are called. + * + * Note that this is in general a hacky place to do configuration. Most config + * is actually chip-specific or module-specific and not board-specific, so + * putting it here hides dependencies between module inits and board init. + * Think very hard before putting code here. + */ +void board_config_pre_init(void); +#endif + +#ifdef CONFIG_BOARD_POST_GPIO_INIT +/** + * Configure board after GPIOs are initialized. + * + * Note that this is in general a hacky place to do configuration. Most config + * is actually chip-specific or module-specific and not board-specific, so + * putting it here hides dependencies between module inits and board init. + * Think very hard before putting code here. + */ +void board_config_post_gpio_init(void); +#endif + +#endif /* __CROS_EC_BOARD_CONFIG_H */ diff --git a/include/x86_power.h b/include/x86_power.h index 48744b0786..5693ea3d77 100644 --- a/include/x86_power.h +++ b/include/x86_power.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +/* 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. */ @@ -10,9 +10,13 @@ #include "gpio.h" +#ifdef CONFIG_CHIPSET_X86 /** * Interrupt handler for x86 chipset GPIOs. */ void x86_power_interrupt(enum gpio_signal signal); +#else +#define x86_power_interrupt NULL +#endif #endif /* __CROS_EC_X86_POWER_H */ |