diff options
author | ChromeOS Developer <dparker@chromium.org> | 2014-01-10 17:31:24 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-01-13 21:19:23 +0000 |
commit | 58433ed1c93438022e80cc5953a91d1c4816564c (patch) | |
tree | 34564d7b422700ac7bbdec7464a8eee1a97c3525 | |
parent | 76a5c5c587d7594bd90e80c1de9a41411630d58d (diff) | |
download | chrome-ec-58433ed1c93438022e80cc5953a91d1c4816564c.tar.gz |
Clapper: Remove boards other than bds, clapper, host, rambi
This should make handling conficts when cherry picking easier
and speed up running "make buildall".
BUG=None
BRANCH=None
TEST=make buildall
Change-Id: I6fb9c9d1a950a8d0abb3168f0e39e80fc8ff8fff
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182245
Reviewed-by: Randall Spangler <rspangler@chromium.org>
70 files changed, 1 insertions, 6699 deletions
diff --git a/board/discovery/board.c b/board/discovery/board.c deleted file mode 100644 index f900acf015..0000000000 --- a/board/discovery/board.c +++ /dev/null @@ -1,43 +0,0 @@ -/* 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. - */ -/* STM32L-discovery board configuration */ - -#include "common.h" -#include "gpio.h" -#include "hooks.h" -#include "registers.h" -#include "task.h" -#include "util.h" - -void button_event(enum gpio_signal signal) -{ -} - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"USER_BUTTON", GPIO_A, (1<<0), GPIO_INT_BOTH, button_event}, - /* Outputs */ - {"LED_BLUE", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL}, - {"LED_GREEN", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL}, - - /* Unimplemented signals which we need to emulate for now */ - GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"), - GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"), -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Initialize board. */ -static void board_init(void) -{ - gpio_enable_interrupt(GPIO_USER_BUTTON); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x0600, GPIO_ALT_USART, MODULE_UART}, -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); diff --git a/board/discovery/board.h b/board/discovery/board.h deleted file mode 100644 index 0ef0ff18a7..0000000000 --- a/board/discovery/board.h +++ /dev/null @@ -1,43 +0,0 @@ -/* 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. - */ - -/* STM32L-discovery board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#undef CONFIG_WATCHDOG_HELP -#undef CONFIG_LID_SWITCH - -/* - * Allow dangerous commands all the time, since we don't have a write protect - * switch. - */ -#define CONFIG_SYSTEM_UNLOCKED - -#ifndef __ASSEMBLER__ - -/* Timer selection */ -#define TIM_CLOCK_MSB 3 -#define TIM_CLOCK_LSB 4 - -/* GPIO signal list */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_USER_BUTTON = 0, - /* Outputs */ - GPIO_LED_BLUE, - GPIO_LED_GREEN, - /* Unimplemented signals we emulate */ - GPIO_ENTERING_RW, - GPIO_WP_L, - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/discovery/build.mk b/board/discovery/build.mk deleted file mode 100644 index a09942b84e..0000000000 --- a/board/discovery/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -# the IC is STmicro STM32L152RCT6 -CHIP:=stm32 -CHIP_FAMILY:=stm32l -CHIP_VARIANT:=stm32l15x - -board-y=board.o diff --git a/board/discovery/ec.tasklist b/board/discovery/ec.tasklist deleted file mode 100644 index d3ac489b42..0000000000 --- a/board/discovery/ec.tasklist +++ /dev/null @@ -1,21 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/board/falco/battery.c b/board/falco/battery.c deleted file mode 100644 index b2dd7fc00d..0000000000 --- a/board/falco/battery.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" -#include "host_command.h" - -#define SB_SHIP_MODE_DATA 0x0010 - -static const struct battery_info info = { - - .voltage_max = 8400, - .voltage_normal = 7400, - .voltage_min = 6000, - - /* Pre-charge values. */ - .precharge_current = 256, /* mA */ - - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -int battery_command_cut_off(struct host_cmd_handler_args *args) -{ - int rv; - - /* Ship mode command must be sent twice. */ - rv = sb_write(SB_MANUFACTURER_ACCESS, SB_SHIP_MODE_DATA); - if (rv != EC_SUCCESS) - return rv; - rv = sb_write(SB_MANUFACTURER_ACCESS, SB_SHIP_MODE_DATA); - return rv; -} -DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off, - EC_VER_MASK(0)); diff --git a/board/falco/board.c b/board/falco/board.c deleted file mode 100644 index 54143cc6ce..0000000000 --- a/board/falco/board.c +++ /dev/null @@ -1,271 +0,0 @@ -/* 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. - */ -/* EC for Falco board configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "backlight.h" -#include "board.h" -#include "common.h" -#include "driver/charger/bq24738.h" -#include "driver/temp_sensor/g781.h" -#include "extpower.h" -#include "fan.h" -#include "gpio.h" -#include "host_command.h" -#include "i2c.h" -#include "jtag.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "peci.h" -#include "power.h" -#include "power_button.h" -#include "registers.h" -#include "switch.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "thermal.h" -#include "timer.h" -#include "uart.h" -#include "util.h" - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP, - power_button_interrupt}, - {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP, - lid_interrupt}, - {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP, - extpower_interrupt}, - {"PCH_BKLTEN", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH, - backlight_interrupt}, - {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP, - power_signal_interrupt}, - {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP, - power_signal_interrupt}, - {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1350_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_EDP_VDD_EN", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH, - lcdvcc_interrupt}, - {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH, - switch_interrupt}, - {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH, - switch_interrupt}, - {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT, - jtag_interrupt}, - {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_PULL_UP| - GPIO_INT_BOTH_DSLEEP, - uart_deepsleep_interrupt}, - - /* Other inputs */ - {"FAN_ALERT_L", LM4_GPIO_B, (1<<0), GPIO_INPUT, NULL}, - {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, NULL}, - {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL}, - {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL}, - {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL}, - {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL}, - {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL}, - - /* Outputs; all unasserted by default except for reset signals */ - {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL}, - {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP3300_DSW_GATED_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL}, - {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL}, - {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL}, - {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL}, - {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL}, - {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL}, - {"CHARGE_L", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL}, - - {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL}, - {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL}, - {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL}, - /* - * HDA_SDO is technically an output, but we need to leave it as an - * input until we drive it high. So can't use open-drain (HI_Z). - */ - {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL}, - {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_OUT_HIGH, NULL}, - {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, - /* - * PL6 is one of 4 pins on the EC which can't be used in open-drain - * mode. To work around this PCH_RCIN_L is set to an input. It will - * only be set to an output when it needs to be driven to 0. - */ - {"PCH_RCIN_L", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL}, - {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL}, - {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL}, - {"EC_EDP_VDD_EN", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL}, - - {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, - {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL}, - - {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL}, - {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL}, - {"PCH_SRTCRST_L", LM4_GPIO_F, (1<<7), GPIO_ODR_HIGH, NULL}, - - {"PWR_LED_L", LM4_GPIO_N, (1<<6), GPIO_OUT_HIGH, NULL}, - {"KB_LED_EN", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL}, - {"BAT_LED0", LM4_GPIO_D, (1<<0), GPIO_OUT_LOW, NULL}, - {"BAT_LED1", LM4_GPIO_D, (1<<1), GPIO_OUT_LOW, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART, GPIO_PULL_UP}, /* UART0 */ - {GPIO_A, 0x40, 3, MODULE_I2C}, /* I2C1 SCL */ - {GPIO_A, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C1 SDA */ - {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */ - {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */ - {GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_G, 0x30, 1, MODULE_UART}, /* UART2 */ - {GPIO_J, 0x40, 1, MODULE_PECI}, /* PECI Tx */ - {GPIO_J, 0x80, 0, MODULE_PECI, GPIO_ANALOG}, /* PECI Rx */ - {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0x33, 15, MODULE_LPC}, /* LPC */ - {GPIO_N, 0x0c, 1, MODULE_PWM_FAN}, /* FAN0PWM2 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_PP5000_PGOOD, 1, "PGOOD_PP5000"}, - {GPIO_PP1350_PGOOD, 1, "PGOOD_PP1350"}, - {GPIO_PP1050_PGOOD, 1, "PGOOD_PP1050"}, - {GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"}, - {GPIO_PCH_SLP_S0_L, 1, "SLP_S0#_DEASSERTED"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S5_L, 1, "SLP_S5#_DEASSERTED"}, - {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS#_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -/* ADC channels. Must be in the exactly same order as in enum adc_channel. */ -const struct adc_t adc_channels[] = { - /* EC internal temperature is calculated by - * 273 + (295 - 450 * ADC_VALUE / ADC_READ_MAX) / 2 - * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 - */ - {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - - /* IOUT == ICMNT is on PE3/AIN0 */ - /* We have 0.01-ohm resistors, and IOUT is 20X the differential - * voltage, so 1000mA ==> 200mV. - * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured). - * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 200 - */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 2, 0, - LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, - - /* AC Adapter ID voltage (mv) */ - {"AdapterIDVoltage", LM4_ADC_SEQ2, 3300, ADC_READ_MAX, 0, - LM4_AIN(11), 0x06 /* IE0 | END0 */, LM4_GPIO_B, (1<<5)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_max = 5050, - .ch = 2, - .pgood_gpio = GPIO_PP5000_PGOOD, - .enable_gpio = -1, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", 0, 100}, - {"lvds", 1, 100}, - {"thermal", 5, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[] = { - {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, - {"G781Internal", TEMP_SENSOR_TYPE_BOARD, g781_get_val, - G781_IDX_INTERNAL, 4}, - {"G781External", TEMP_SENSOR_TYPE_BOARD, g781_get_val, - G781_IDX_EXTERNAL, 4}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in - * same order as enum temp_sensor_id. To always ignore any temp, use 0. - */ -struct ec_thermal_config thermal_params[] = { - /* Only the AP affects the thermal limits and fan speed. */ - { {C_TO_K(95), C_TO_K(97), C_TO_K(99)}, C_TO_K(55), C_TO_K(85)}, - { {0, 0, 0}, 0, 0}, - { {0, 0, 0}, 0, 0}, - { {0, 0, 0}, 0, 0}, -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -struct keyboard_scan_config keyscan_config = { - .output_settle_us = 40, - .debounce_down_us = 6 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 1500, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = SECOND, - .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, - 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ - }, -}; - -/** - * Discharge battery when on AC power for factory test. - */ -int board_discharge_on_ac(int enable) -{ - return charger_discharge_on_ac(enable); -} - -/* - * Take a nice smooth ramp and make it all chunky. - * And never turn it off. Bah. That'll do wonders for battery life. - */ -#ifdef CONFIG_FAN_RPM_CUSTOM -int fan_percent_to_rpm(int fan, int pct) -{ - const int FAN_MAX = fans[fan].rpm_max; - const int FAN_MIN = fans[fan].rpm_min; - const int NUM_STEPS = 7; - const int m = 100 * 100 / NUM_STEPS; - const int m0 = m / 200; - - int chunky = 100 * (pct + m0) / m; - return FAN_MIN + (FAN_MAX - FAN_MIN) * m * chunky / 10000; -} -#endif /* CONFIG_FAN_RPM_CUSTOM */ diff --git a/board/falco/board.h b/board/falco/board.h deleted file mode 100644 index 347da3b0e2..0000000000 --- a/board/falco/board.h +++ /dev/null @@ -1,197 +0,0 @@ -/* 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. - */ - -/* Configuration for Falco mainboard */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BKLTEN -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_VERSION -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24738 -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHIPSET_CAN_THROTTLE -#define CONFIG_CHIPSET_HASWELL -#define CONFIG_CHIPSET_X86 -#define CONFIG_CMD_GSV -#define CONFIG_EXTPOWER_FALCO -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_FANS 1 -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_LOW_POWER_IDLE -#define CONFIG_PECI_TJMAX 100 -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_SWITCH_DEDICATED_RECOVERY -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_G781 -#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_PP3300_DX_EN -#define CONFIG_UART_HOST 2 -#define CONFIG_USB_PORT_POWER_DUMB -#define CONFIG_WIRELESS - -#ifndef __ASSEMBLER__ - -/* I2C ports */ -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#define I2C_PORT_LVDS 1 -#define I2C_PORT_THERMAL 5 - -/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */ -#define KB_SCAN_ROW_IRQ LM4_IRQ_GPIOK -#define KB_SCAN_ROW_GPIO LM4_GPIO_K - -/* Host connects to keyboard controller module via LPC */ -#define HOST_KB_BUS_LPC - -/* USB ports */ -#define USB_PORT_COUNT 2 - -/* GPIO signal definitions. */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, /* Power button */ - GPIO_LID_OPEN, /* Lid switch */ - GPIO_AC_PRESENT, /* AC power present */ - GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */ - GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */ - GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */ - GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */ - GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */ - GPIO_PP1050_PGOOD, /* Power good on 1.05V */ - GPIO_PP1350_PGOOD, /* Power good on 1.35V (DRAM) */ - GPIO_PP5000_PGOOD, /* Power good on 5V */ - GPIO_VCORE_PGOOD, /* Power good on core VR */ - GPIO_PCH_EDP_VDD_EN, /* PCH wants EDP enabled */ - GPIO_RECOVERY_L, /* Recovery signal from servo */ - GPIO_WP_L, /* Write protect input */ - GPIO_JTAG_TCK, /* JTAG clock input */ - GPIO_UART0_RX, /* UART0 RX input */ - - /* Other inputs */ - GPIO_FAN_ALERT_L, /* From thermal sensor */ - GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */ - GPIO_USB1_OC_L, /* USB port overcurrent warning */ - GPIO_USB2_OC_L, /* USB port overcurrent warning */ - GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */ - GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ - GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ - GPIO_CPU_PGOOD, /* Power good to the CPU */ - - /* Outputs */ - GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ - GPIO_PP1350_EN, /* Enable 1.35V supply */ - GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */ - GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ - GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ - GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ - GPIO_VCORE_EN, /* Stuffing option - not connected */ - GPIO_PP5000_EN, /* Enable 5V supply */ - GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi radio */ - GPIO_CHARGE_L, /* Allow battery to charge when on AC */ - - GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ - GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ - GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ - GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */ - - GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME - * ignores security descriptor */ - GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */ - GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */ - GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ - GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */ - GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */ - GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */ - GPIO_PCH_SMI_L, /* System management interrupt to PCH */ - GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ - GPIO_EC_EDP_VDD_EN, /* Enable EDP (passthru from PCH) */ - GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */ - - GPIO_USB1_ENABLE, /* USB port 1 output power enable */ - GPIO_USB2_ENABLE, /* USB port 2 output power enable */ - - GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */ - GPIO_PCH_RTCRST_L, /* Not supposed to be here */ - GPIO_PCH_SRTCRST_L, /* Not supposed to be here */ - - GPIO_PWR_LED_L, /* Power LED */ - GPIO_KB_LED_EN, /* Keyboard LED */ - GPIO_BAT_LED0, /* Battery charger status */ - GPIO_BAT_LED1, /* Battery charger status */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -/* power signal definitions */ -enum power_signal { - X86_PGOOD_PP5000 = 0, - X86_PGOOD_PP1350, - X86_PGOOD_PP1050, - X86_PGOOD_VCORE, - X86_SLP_S0_DEASSERTED, - X86_SLP_S3_DEASSERTED, - X86_SLP_S5_DEASSERTED, - X86_SLP_SUS_DEASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -/* Charger module */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input sensor resistor, mOhm */ -#define CONFIG_CHARGER_INPUT_CURRENT 4032 /* mA, about half max */ -#define CONFIG_CHARGER_TIMEOUT_HOURS 10 /* Max time to charge battery, hours */ - -enum adc_channel { - /* EC internal die temperature in degrees K. */ - ADC_CH_EC_TEMP = 0, - - /* Charger current in mA. */ - ADC_CH_CHARGER_CURRENT, - - /* AC Adapter ID voltage in mV */ - ADC_AC_ADAPTER_ID_VOLTAGE, - - ADC_CH_COUNT -}; - -enum temp_sensor_id { - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI = 0, - /* EC internal temperature sensor */ - TEMP_SENSOR_EC_INTERNAL, - /* G781 internal and external sensors */ - TEMP_SENSOR_I2C_G781_INTERNAL, - TEMP_SENSOR_I2C_G781_EXTERNAL, - - TEMP_SENSOR_COUNT -}; - -/** - * LCD VCC enable interrupt. - */ -void lcdvcc_interrupt(enum gpio_signal signal); - -/* Wireless signals */ -#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L -#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN -#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN - -/* Discharge battery when on AC power for factory test. */ -int board_discharge_on_ac(int enable); - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/falco/build.mk b/board/falco/build.mk deleted file mode 100644 index e8bbc36cbd..0000000000 --- a/board/falco/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build -# - -# the IC is TI Stellaris LM4 -CHIP:=lm4 - -board-y=board.o battery.o led.o panel.o diff --git a/board/falco/ec.tasklist b/board/falco/ec.tasklist deleted file mode 100644 index 8666f7db09..0000000000 --- a/board/falco/ec.tasklist +++ /dev/null @@ -1,28 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' is the name of the task - * 'r' is the main routine of the task - * 'd' is an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/falco/led.c b/board/falco/led.c deleted file mode 100644 index c0d7c5f3ef..0000000000 --- a/board/falco/led.c +++ /dev/null @@ -1,103 +0,0 @@ -/* 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. - * - * Power and battery LED control for Falco. - */ - -#include "battery.h" -#include "charge_state.h" -#include "chipset.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" - -enum led_color { - LED_OFF = 0, - LED_WHITE, - LED_AMBER, - LED_COLOR_COUNT /* Number of colors, not a color itself */ -}; - -static int bat_led_set_color(enum led_color color) -{ - switch (color) { - case LED_OFF: - gpio_set_level(GPIO_BAT_LED0, 1); - gpio_set_level(GPIO_BAT_LED1, 1); - break; - case LED_WHITE: - gpio_set_level(GPIO_BAT_LED0, 1); - gpio_set_level(GPIO_BAT_LED1, 0); - break; - case LED_AMBER: - gpio_set_level(GPIO_BAT_LED0, 0); - gpio_set_level(GPIO_BAT_LED1, 1); - break; - default: - return EC_ERROR_UNKNOWN; - } - return EC_SUCCESS; -} - -static int pwr_led_set_color(enum led_color color) -{ - switch (color) { - case LED_OFF: - gpio_set_level(GPIO_PWR_LED_L, 1); - break; - case LED_WHITE: - gpio_set_level(GPIO_PWR_LED_L, 0); - break; - default: - return EC_ERROR_UNKNOWN; - } - return EC_SUCCESS; -} - -/* Called by hook task every 250mSec */ -static void led_tick(void) -{ - static int ticks; - uint32_t chflags = charge_get_flags(); - - ticks++; - - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - pwr_led_set_color(LED_OFF); - else if (chipset_in_state(CHIPSET_STATE_ON)) - pwr_led_set_color(LED_WHITE); - else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) - pwr_led_set_color((ticks & 0x4) ? LED_WHITE : LED_OFF); - - /* Battery LED is solid white if AC connected, unless the battery is - * is charging or there is an error. */ - bat_led_set_color(extpower_is_present() ? LED_WHITE : LED_OFF); - - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - bat_led_set_color(LED_AMBER); - break; - case PWR_STATE_DISCHARGE: - /* See crosbug.com/p/22159. There's a 3% difference - * between the battery level seen by the kernel and what's - * really going on, so if they want to see 12%, we use 15%. - * Hard code this number here, because this only affects the - * LED color, not the battery charge state. */ - if (charge_get_percent() < 15) - bat_led_set_color((ticks & 0x4) ? LED_WHITE : LED_OFF); - break; - case PWR_STATE_ERROR: - bat_led_set_color((ticks & 0x2) ? LED_WHITE : LED_OFF); - break; - case PWR_STATE_IDLE: - if (chflags & CHARGE_FLAG_FORCE_IDLE) - bat_led_set_color((ticks & 0x4) ? LED_AMBER : LED_OFF); - break; - default: - /* Other states don't alter LED behavior */ - break; - } -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); - diff --git a/board/falco/panel.c b/board/falco/panel.c deleted file mode 100644 index 33154620f2..0000000000 --- a/board/falco/panel.c +++ /dev/null @@ -1,131 +0,0 @@ -/* 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. - */ - -#include "common.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "lid_switch.h" - -/* - * Falco needs a 420ms delay for a 0->1 transition of the PCH's backlight - * enable signal. The reason is that Falco has a LVDS bridge which controls - * all the other signals for the panel except the backlight. In order to - * meet the penel power sequencing requirements a delay needs to be added. - * - * Additionally the LCDVCC needs to be delayed on a 0->1 transition of the - * PCH's EDP VDD enable signal to meet the panel specification. - */ - -#define BL_ENABLE_DELAY_US 420000 /* 420 ms delay */ -#define LCDVCC_ENABLE_DELAY_US 270000 /* 270 ms delay */ - -static int backlight_deferred_value; - -static void set_backlight_value(void) -{ - gpio_set_level(GPIO_ENABLE_BACKLIGHT, backlight_deferred_value); -} -DECLARE_DEFERRED(set_backlight_value); - -/** - * Update backlight state. - */ -static void update_backlight(void) -{ - int pch_value; - - pch_value = gpio_get_level(GPIO_PCH_BKLTEN); - - /* Immediately disable the backlight when the lid is closed or the PCH - * is instructing the backlight to be disabled. */ - if (!lid_is_open() || !pch_value) { - /* If there was a scheduled callback pending make sure it picks - * up the disabled value. */ - backlight_deferred_value = 0; - gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0); - /* Cancel pending hook */ - hook_call_deferred(&set_backlight_value, -1); - return; - } - /* Handle a 0->1 transition by calling a deferred hook. */ - if (pch_value && !backlight_deferred_value) { - backlight_deferred_value = 1; - hook_call_deferred(&set_backlight_value, BL_ENABLE_DELAY_US); - } -} -DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT); - -void backlight_interrupt(enum gpio_signal signal) -{ - update_backlight(); -} - -/** - * Host command to toggle backlight. - */ -static int switch_command_enable_backlight(struct host_cmd_handler_args *args) -{ - const struct ec_params_switch_enable_backlight *p = args->params; - gpio_set_level(GPIO_ENABLE_BACKLIGHT, p->enabled); - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_SWITCH_ENABLE_BKLIGHT, - switch_command_enable_backlight, 0); - - -static int lcdvcc_en_deferred_value; - -static void set_lcdvcc_en_value(void) -{ - gpio_set_level(GPIO_EC_EDP_VDD_EN, lcdvcc_en_deferred_value); -} -DECLARE_DEFERRED(set_lcdvcc_en_value); - -void lcdvcc_interrupt(enum gpio_signal signal) -{ - int pch_value; - - pch_value = gpio_get_level(GPIO_PCH_EDP_VDD_EN); - - /* Immediately disable the LCDVCC when the PCH indicates as such. */ - if (!pch_value) { - /* If there was a scheduled callback pending make sure it picks - * up the disabled value. */ - lcdvcc_en_deferred_value = 0; - gpio_set_level(GPIO_EC_EDP_VDD_EN, 0); - /* Cancel pending hook */ - hook_call_deferred(&set_lcdvcc_en_value, -1); - return; - } - /* Handle a 0->1 transition by calling a deferred hook. */ - if (pch_value && !lcdvcc_en_deferred_value) { - lcdvcc_en_deferred_value = 1; - hook_call_deferred(&set_lcdvcc_en_value, - LCDVCC_ENABLE_DELAY_US); - } -} - -/** - * Initialize panel module. - */ -static void panel_init(void) -{ - /* Set initial deferred value and signal to the current PCH signal. */ - backlight_deferred_value = gpio_get_level(GPIO_PCH_BKLTEN); - set_backlight_value(); - - update_backlight(); - - gpio_enable_interrupt(GPIO_PCH_BKLTEN); - - /* The interrupt is enabled for the GPIO_PCH_EDP_VDD_EN in the - * chipset_haswell.c compilation unit. Initially set the value - * to whatever it current is reading. */ - lcdvcc_en_deferred_value = gpio_get_level(GPIO_PCH_EDP_VDD_EN); - set_lcdvcc_en_value(); -} -DECLARE_HOOK(HOOK_INIT, panel_init, HOOK_PRIO_DEFAULT); - diff --git a/board/it8380dev/board.c b/board/it8380dev/board.c deleted file mode 100644 index adad1d73a8..0000000000 --- a/board/it8380dev/board.c +++ /dev/null @@ -1,106 +0,0 @@ -/* 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. - */ -/* IT8380 development board configuration */ - -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "registers.h" -#include "task.h" -#include "util.h" - -/* Test GPIO interrupt function that toggles one LED. */ -void test_interrupt(enum gpio_signal signal) -{ - static int busy_state; - - /* toggle LED */ - busy_state = !busy_state; - gpio_set_level(GPIO_BUSY_LED, busy_state); -} - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - {"H_LED0", GPIO_A, (1<<0), GPIO_ODR_HIGH}, - {"H_LED1", GPIO_A, (1<<1), GPIO_ODR_HIGH}, - {"H_LED2", GPIO_A, (1<<2), GPIO_ODR_HIGH}, - {"H_LED3", GPIO_A, (1<<3), GPIO_ODR_HIGH}, - {"H_LED4", GPIO_A, (1<<4), GPIO_ODR_HIGH}, - {"H_LED5", GPIO_A, (1<<5), GPIO_ODR_HIGH}, - {"H_LED6", GPIO_A, (1<<6), GPIO_ODR_HIGH}, - {"L_LED0", GPIO_I, (1<<0), GPIO_ODR_HIGH}, - {"L_LED1", GPIO_I, (1<<1), GPIO_ODR_HIGH}, - {"L_LED2", GPIO_I, (1<<2), GPIO_ODR_HIGH}, - {"L_LED3", GPIO_I, (1<<3), GPIO_ODR_HIGH}, - {"L_LED4", GPIO_I, (1<<4), GPIO_ODR_HIGH}, - {"L_LED5", GPIO_I, (1<<5), GPIO_ODR_HIGH}, - {"L_LED6", GPIO_I, (1<<6), GPIO_ODR_HIGH}, - {"BUSY_LED", GPIO_J, (1<<0), GPIO_OUT_LOW}, - {"GOOD_LED", GPIO_J, (1<<1), GPIO_OUT_HIGH}, - {"FAIL_LED", GPIO_J, (1<<2), GPIO_OUT_LOW}, - {"SW0", GPIO_E, (1<<0), GPIO_INPUT}, - {"SW1", GPIO_E, (1<<1), GPIO_INPUT | GPIO_PULL_DOWN}, - {"SW2", GPIO_E, (1<<2), GPIO_INPUT | GPIO_PULL_DOWN}, - {"SW3", GPIO_E, (1<<3), GPIO_INPUT | GPIO_PULL_DOWN}, - {"START_SW", GPIO_E, (1<<4), GPIO_INT_FALLING, test_interrupt}, - /* Unimplemented signals which we need to emulate for now */ - GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"), -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_B, 0x03, 1, MODULE_UART, GPIO_PULL_UP}, /* UART0 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* Initialize board. */ -static void board_init(void) -{ - gpio_enable_interrupt(GPIO_START_SW); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -/*****************************************************************************/ -/* Console commands */ - -void display_7seg(uint8_t val) -{ - int i; - static const uint8_t digits[16] = { - 0xc0, 0xf9, 0xa8, 0xb0, - 0x99, 0x92, 0x82, 0xf8, - 0x80, 0x98, 0x88, 0x83, - 0xc6, 0xa1, 0x86, 0x8e, - }; - - for (i = 0; i < 7; i++) - gpio_set_level(GPIO_H_LED0 + i, digits[val >> 4] & (1 << i)); - for (i = 0; i < 7; i++) - gpio_set_level(GPIO_L_LED0 + i, digits[val & 0xf] & (1 << i)); -} - -static int command_7seg(int argc, char **argv) -{ - uint8_t val; - char *e; - - if (argc != 2) - return EC_ERROR_PARAM_COUNT; - - val = strtoi(argv[1], &e, 16); - if (*e) - return EC_ERROR_PARAM1; - - ccprintf("display 0x%02x\n", val); - display_7seg(val); - - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(seg7, command_7seg, - "<hex>", - "Print 8-bit value on 7-segment display", - NULL); diff --git a/board/it8380dev/board.h b/board/it8380dev/board.h deleted file mode 100644 index dc1fe01187..0000000000 --- a/board/it8380dev/board.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - */ - -/* IT8380 development board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -#ifndef __ASSEMBLER__ - -/* stubbed features */ -#undef CONFIG_LID_SWITCH - -enum gpio_signal { - GPIO_H_LED0, - GPIO_H_LED1, - GPIO_H_LED2, - GPIO_H_LED3, - GPIO_H_LED4, - GPIO_H_LED5, - GPIO_H_LED6, - GPIO_L_LED0, - GPIO_L_LED1, - GPIO_L_LED2, - GPIO_L_LED3, - GPIO_L_LED4, - GPIO_L_LED5, - GPIO_L_LED6, - GPIO_BUSY_LED, - GPIO_GOOD_LED, - GPIO_FAIL_LED, - GPIO_SW1, - GPIO_SW2, - GPIO_SW3, - GPIO_SW4, - GPIO_START_SW, - /* Unimplemented GPIOs */ - GPIO_ENTERING_RW, - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -#endif /* !__ASSEMBLER__ */ -#endif /* __BOARD_H */ diff --git a/board/it8380dev/build.mk b/board/it8380dev/build.mk deleted file mode 100644 index 83f36b09b1..0000000000 --- a/board/it8380dev/build.mk +++ /dev/null @@ -1,11 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -# the IC is ITE 8380 -CHIP:=it83xx - -board-y=board.o diff --git a/board/it8380dev/ec.tasklist b/board/it8380dev/ec.tasklist deleted file mode 100644 index d3ac489b42..0000000000 --- a/board/it8380dev/ec.tasklist +++ /dev/null @@ -1,21 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/board/link/board.c b/board/link/board.c deleted file mode 100644 index 9faadcbfce..0000000000 --- a/board/link/board.c +++ /dev/null @@ -1,272 +0,0 @@ -/* 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. - */ -/* EC for Link board configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "backlight.h" -#include "chipset.h" -#include "common.h" -#include "driver/temp_sensor/tmp006.h" -#include "extpower.h" -#include "fan.h" -#include "gpio.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "peci.h" -#include "power.h" -#include "power_button.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "switch.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "timer.h" -#include "thermal.h" -#include "util.h" - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", LM4_GPIO_K, (1<<7), GPIO_INT_BOTH, - power_button_interrupt}, - {"LID_OPEN", LM4_GPIO_K, (1<<5), GPIO_INT_BOTH, - lid_interrupt}, - /* Other inputs */ - {"THERMAL_DATA_READY_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL}, - {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH, - extpower_interrupt}, - {"BOARD_VERSION1", LM4_GPIO_H, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION2", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION3", LM4_GPIO_L, (1<<7), GPIO_INPUT, NULL}, - {"ONEWIRE", LM4_GPIO_H, (1<<2), GPIO_INPUT, NULL}, - {"PCH_BKLTEN", LM4_GPIO_J, (1<<3), GPIO_INT_BOTH, - backlight_interrupt}, - {"PCH_SLP_A_L", LM4_GPIO_G, (1<<5), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_ME_CSW_DEV_L", LM4_GPIO_G, (1<<4), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S3_L", LM4_GPIO_J, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S4_L", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S5_L", LM4_GPIO_J, (1<<2), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, - power_interrupt}, - {"PGOOD_1_5V_DDR", LM4_GPIO_K, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_1_5V_PCH", LM4_GPIO_K, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_1_8VS", LM4_GPIO_K, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_5VALW", LM4_GPIO_H, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_CPU_CORE", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_VCCP", LM4_GPIO_K, (1<<2), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_VCCSA", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PGOOD_VGFX_CORE", LM4_GPIO_D, (1<<2), GPIO_INT_BOTH, - power_signal_interrupt}, - {"RECOVERY_L", LM4_GPIO_H, (1<<7), GPIO_INT_BOTH, - switch_interrupt}, - {"USB1_STATUS_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL}, - {"USB2_STATUS_L", LM4_GPIO_E, (1<<1), GPIO_INPUT, NULL}, - {"WP", LM4_GPIO_J, (1<<4), GPIO_INT_BOTH, - switch_interrupt}, - /* Outputs; all unasserted by default except for reset signals */ - {"CPU_PROCHOT", LM4_GPIO_F, (1<<2), GPIO_OUT_LOW, NULL}, - {"ENABLE_1_5V_DDR", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL}, - {"ENABLE_5VALW", LM4_GPIO_K, (1<<4), GPIO_OUT_HIGH, NULL}, - {"ENABLE_BACKLIGHT", LM4_GPIO_H, (1<<4), GPIO_OUT_LOW, NULL}, - {"ENABLE_TOUCHPAD", LM4_GPIO_C, (1<<6), GPIO_OUT_LOW, NULL}, - {"ENABLE_VCORE", LM4_GPIO_F, (1<<7), GPIO_OUT_LOW, NULL}, - {"ENABLE_VS", LM4_GPIO_G, (1<<6), GPIO_OUT_LOW, NULL}, - {"ENABLE_WLAN", LM4_GPIO_Q, (1<<5), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL}, - {"LIGHTBAR_RESET_L", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_A20GATE", LM4_GPIO_Q, (1<<6), GPIO_OUT_LOW, NULL}, - {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL}, - /* - * HDA_SDO is technically an output, but we need to leave it as an - * input until we drive it high. So can't use open-drain (HI_Z). - */ - {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL}, - {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_NMI_L", LM4_GPIO_M, (1<<2), GPIO_OUT_HIGH, NULL}, - {"PCH_PWRBTN_L", LM4_GPIO_G, (1<<7), GPIO_OUT_HIGH, NULL}, - {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, - {"PCH_RCIN_L", LM4_GPIO_Q, (1<<7), GPIO_ODR_HIGH, NULL}, - {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL}, - {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_OUT_HIGH, NULL}, - {"PCH_SRTCRST_L", LM4_GPIO_C, (1<<7), GPIO_ODR_HIGH, NULL}, - {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL}, - {"RADIO_ENABLE_WLAN", LM4_GPIO_D, (1<<0), GPIO_OUT_LOW, NULL}, - {"RADIO_ENABLE_BT", LM4_GPIO_D, (1<<1), GPIO_OUT_LOW, NULL}, - {"SPI_CS_L", LM4_GPIO_A, (1<<3), GPIO_ODR_HIGH, NULL}, - {"TOUCHSCREEN_RESET_L", LM4_GPIO_B, (1<<0), GPIO_OUT_LOW, NULL}, - {"USB1_CTL1", LM4_GPIO_E, (1<<2), GPIO_OUT_LOW, NULL}, - {"USB1_CTL2", LM4_GPIO_E, (1<<3), GPIO_OUT_LOW, NULL}, - {"USB1_CTL3", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB1_ENABLE", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL}, - {"USB1_ILIM_SEL", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL}, - {"USB2_CTL1", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB2_CTL2", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL}, - {"USB2_CTL3", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL}, - {"USB2_ENABLE", LM4_GPIO_D, (1<<7), GPIO_OUT_LOW, NULL}, - {"USB2_ILIM_SEL", LM4_GPIO_E, (1<<0), GPIO_OUT_LOW, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */ - {GPIO_A, 0x40, 3, MODULE_I2C}, /* I2C1 SCL */ - {GPIO_A, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C1 SDA */ - {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */ - {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */ - {GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_C, 0x30, 2, MODULE_UART}, /* UART1 */ - {GPIO_J, 0x40, 1, MODULE_PECI}, /* PECI Tx */ - {GPIO_J, 0x80, 0, MODULE_PECI, GPIO_ANALOG}, /* PECI Rx */ - {GPIO_K, 0x40, 1, MODULE_PWM_KBLIGHT}, /* FAN0PWM1 */ - {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0x33, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0xc0, 1, MODULE_PWM_FAN}, /* FAN0PWM0 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_PGOOD_5VALW, 1, "PGOOD_5VALW"}, - {GPIO_PGOOD_1_5V_DDR, 1, "PGOOD_1_5V_DDR"}, - {GPIO_PGOOD_1_5V_PCH, 1, "PGOOD_1_5V_PCH"}, - {GPIO_PGOOD_1_8VS, 1, "PGOOD_1_8VS"}, - {GPIO_PGOOD_VCCP, 1, "PGOOD_VCCP"}, - {GPIO_PGOOD_VCCSA, 1, "PGOOD_VCCSA"}, - {GPIO_PGOOD_CPU_CORE, 1, "PGOOD_CPU_CORE"}, - {GPIO_PGOOD_VGFX_CORE, 1, "PGOOD_VGFX_CORE"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S4_L, 1, "SLP_S4#_DEASSERTED"}, - {GPIO_PCH_SLP_S5_L, 1, "SLP_S5#_DEASSERTED"}, - {GPIO_PCH_SLP_A_L, 1, "SLP_A#_DEASSERTED"}, - {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS#_DEASSERTED"}, - {GPIO_PCH_SLP_ME_CSW_DEV_L, 1, "SLP_ME#_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -/* ADC channels. Must be in the exactly same order as in enum adc_channel. */ -const struct adc_t adc_channels[] = { - /* EC internal temperature is calculated by - * 273 + (295 - 450 * ADC_VALUE / ADC_READ_MAX) / 2 - * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 - */ - {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - - /* Charger current is mapped from 0~4000mA to 0~1.6V. - * And ADC maps 0~3.3V to ADC_READ_MAX. - */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33 * 4000, ADC_READ_MAX * 16, 0, - LM4_AIN(11), 0x06 /* IE0 | END0 */, LM4_GPIO_B, (1<<5)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {1, 0}, -}; -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -/* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1500, - .rpm_max = 9300, - .ch = 0, - .pgood_gpio = GPIO_PGOOD_5VALW, - .enable_gpio = -1, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", 0, 100}, - {"lightbar", 1, 400}, - {"thermal", 5, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -#define TEMP_PCH_REG_ADDR ((0x41 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_CHARGER_REG_ADDR ((0x43 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_USB_REG_ADDR ((0x46 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_HINGE_REG_ADDR ((0x44 << 1) | I2C_FLAG_BIG_ENDIAN) - -#define TEMP_PCH_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_PCH_REG_ADDR) -#define TEMP_CHARGER_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_CHARGER_REG_ADDR) -#define TEMP_USB_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_USB_REG_ADDR) -#define TEMP_HINGE_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_HINGE_REG_ADDR) - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[] = { - {"I2C-USB C-Die", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 0, 7}, - {"I2C-USB C-Object", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 1, 7}, - {"I2C-PCH D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 2, 7}, - {"I2C-PCH D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 3, 7}, - {"I2C-Hinge C-Die", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 4, 7}, - {"I2C-Hinge C-Object", TEMP_SENSOR_TYPE_IGNORED, tmp006_get_val, 5, 7}, - {"I2C-Charger D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 6, 7}, - {"I2C-Charger D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 7, 7}, - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, - {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in - * same order as enum temp_sensor_id. To always ignore any temp, use 0. - */ -struct ec_thermal_config thermal_params[] = { - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - /* Only the AP affects the thermal limits and fan speed. */ - {{C_TO_K(100), C_TO_K(102), C_TO_K(104)}, C_TO_K(60), C_TO_K(90)}, -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -const struct tmp006_t tmp006_sensors[TMP006_COUNT] = { - {"USB C", TEMP_USB_ADDR}, - {"PCH D", TEMP_PCH_ADDR}, - {"Hinge C", TEMP_HINGE_ADDR}, - {"Charger D", TEMP_CHARGER_ADDR}, -}; - -struct keyboard_scan_config keyscan_config = { - .output_settle_us = 40, - .debounce_down_us = 6 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 1500, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = SECOND, - .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, - 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ - }, -}; diff --git a/board/link/board.h b/board/link/board.h deleted file mode 100644 index 743f77a72c..0000000000 --- a/board/link/board.h +++ /dev/null @@ -1,211 +0,0 @@ -/* 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. - */ - -/* Configuration for Link mainboard */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_AP_HANG_DETECT -#define CONFIG_BACKLIGHT_LID -#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BKLTEN -#define CONFIG_BATTERY_LINK -#define CONFIG_BATTERY_SMART -#define CONFIG_BATTERY_VENDOR_PARAMS -#define CONFIG_BOARD_VERSION -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24725 -#define CONFIG_CHIPSET_CAN_THROTTLE -#define CONFIG_CHIPSET_IVYBRIDGE -#define CONFIG_CHIPSET_X86 -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_FANS 1 -#define CONFIG_I2C_PASSTHRU_RESTRICTED -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_LED_DRIVER_DS2413 -#define CONFIG_ONEWIRE -#define CONFIG_PECI_TJMAX 105 -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_PWM -#define CONFIG_PWM_KBLIGHT -#define CONFIG_SWITCH_DEDICATED_RECOVERY -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_PGOOD_1_8VS -#define CONFIG_TEMP_SENSOR_TMP006 -#define CONFIG_UART_HOST 1 -#define CONFIG_USB_PORT_POWER_SMART -#define CONFIG_WIRELESS -#define CONFIG_WP_ACTIVE_HIGH - -#ifndef __ASSEMBLER__ - -enum adc_channel { - /* EC internal die temperature in degrees K. */ - ADC_CH_EC_TEMP = 0, - /* Charger current in mA. */ - ADC_CH_CHARGER_CURRENT, - - ADC_CH_COUNT -}; - -enum pwm_channel { - PWM_CH_KBLIGHT, - - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -/* Charger module */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 /* Input sensor resistor, mOhm */ -#define CONFIG_CHARGER_INPUT_CURRENT 4032 /* mA, based on Link HW design */ -#define CONFIG_CHARGER_CURRENT_LIMIT 3000 /* PL102 inductor 3.0A(3.8A) */ - -/* I2C ports */ -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 /* Note: proto0 used port 1 */ -#define I2C_PORT_THERMAL 5 -#define I2C_PORT_LIGHTBAR 1 -#define I2C_PORT_REGULATOR 0 - -/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */ -#define KB_SCAN_ROW_IRQ LM4_IRQ_GPION -#define KB_SCAN_ROW_GPIO LM4_GPIO_N - -/* Host connects to keyboard controller module via LPC */ -#define HOST_KB_BUS_LPC - -/* GPIO signal definitions. */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, /* Power button */ - GPIO_LID_OPEN, /* Lid switch */ - GPIO_THERMAL_DATA_READY_L, /* Data ready from I2C thermal sensor */ - /* Other inputs */ - GPIO_AC_PRESENT, /* AC power present */ - GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */ - GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ - GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ - GPIO_ONEWIRE, /* One-wire bus to adapter LED */ - GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */ - GPIO_PCH_SLP_A_L, /* SLP_A# signal from PCH */ - GPIO_PCH_SLP_ME_CSW_DEV_L, /* SLP_ME_CSW_DEV# signal from PCH */ - GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */ - GPIO_PCH_SLP_S4_L, /* SLP_S4# signal from PCH */ - GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */ - GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */ - GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */ - GPIO_PGOOD_1_5V_DDR, /* Power good on +1.5V_DDR */ - GPIO_PGOOD_1_5V_PCH, /* Power good on +1.5V_PCH */ - GPIO_PGOOD_1_8VS, /* Power good on +1.8VS */ - GPIO_PGOOD_5VALW, /* Power good on +5VALW */ - GPIO_PGOOD_CPU_CORE, /* Power good on +CPU_CORE */ - GPIO_PGOOD_VCCP, /* Power good on +VCCP */ - GPIO_PGOOD_VCCSA, /* Power good on +VCCSA */ - GPIO_PGOOD_VGFX_CORE, /* Power good on +VGFX_CORE */ - GPIO_RECOVERY_L, /* Recovery signal from servo */ - GPIO_USB1_STATUS_L, /* USB charger port 1 status output */ - GPIO_USB2_STATUS_L, /* USB charger port 2 status output */ - GPIO_WP, /* Write protect input */ - /* Outputs */ - GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ - GPIO_ENABLE_1_5V_DDR, /* Enable +1.5V_DDR supply */ - GPIO_ENABLE_5VALW, /* Enable +5V always on rail */ - GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ - GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ - GPIO_ENABLE_VCORE, /* Enable +CPU_CORE and +VGFX_CORE */ - GPIO_ENABLE_VS, /* Enable VS power supplies */ - GPIO_ENABLE_WLAN, /* Enable WLAN module power (+3VS_WLAN) */ - GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ - GPIO_LIGHTBAR_RESET_L, /* Reset lightbar controllers */ - GPIO_PCH_A20GATE, /* A20GATE signal to PCH */ - GPIO_PCH_DPWROK, /* DPWROK signal to PCH */ - GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME - * ignores security descriptor */ - GPIO_PCH_WAKE_L, /* Wake signal output to PCH */ - GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */ - GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ - GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */ - GPIO_PCH_RCIN_L, /* RCIN# signal to PCH */ - GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */ - GPIO_PCH_RTCRST_L, /* Reset PCH RTC well */ - GPIO_PCH_SMI_L, /* System management interrupt to PCH */ - GPIO_PCH_SRTCRST_L, /* Reset PCH ME RTC well */ - GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */ - GPIO_RADIO_ENABLE_WLAN, /* Enable WLAN radio */ - GPIO_RADIO_ENABLE_BT, /* Enable bluetooth radio */ - GPIO_SPI_CS_L, /* SPI chip select */ - GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ - GPIO_USB1_CTL1, /* USB charger port 1 CTL1 output */ - GPIO_USB1_CTL2, /* USB charger port 1 CTL2 output */ - GPIO_USB1_CTL3, /* USB charger port 1 CTL3 output */ - GPIO_USB1_ENABLE, /* USB charger port 1 enable */ - GPIO_USB1_ILIM_SEL, /* USB charger port 1 ILIM_SEL output */ - GPIO_USB2_CTL1, /* USB charger port 2 CTL1 output */ - GPIO_USB2_CTL2, /* USB charger port 2 CTL2 output */ - GPIO_USB2_CTL3, /* USB charger port 2 CTL3 output */ - GPIO_USB2_ENABLE, /* USB charger port 2 enable */ - GPIO_USB2_ILIM_SEL, /* USB charger port 2 ILIM_SEL output */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -/* x86 signal definitions */ -enum x86_signal { - X86_PGOOD_5VALW = 0, - X86_PGOOD_1_5V_DDR, - X86_PGOOD_1_5V_PCH, - X86_PGOOD_1_8VS, - X86_PGOOD_VCCP, - X86_PGOOD_VCCSA, - X86_PGOOD_CPU_CORE, - X86_PGOOD_VGFX_CORE, - X86_SLP_S3_DEASSERTED, - X86_SLP_S4_DEASSERTED, - X86_SLP_S5_DEASSERTED, - X86_SLP_A_DEASSERTED, - X86_SLP_SUS_DEASSERTED, - X86_SLP_ME_DEASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -enum temp_sensor_id { - /* TMP006 U20, die/object temperature near Mini-DP / USB connectors */ - TEMP_SENSOR_I2C_U20_DIE = 0, - TEMP_SENSOR_I2C_U20_OBJECT, - /* TMP006 U11, die/object temperature near PCH */ - TEMP_SENSOR_I2C_U11_DIE, - TEMP_SENSOR_I2C_U11_OBJECT, - /* TMP006 U27, die/object temperature near hinge */ - TEMP_SENSOR_I2C_U27_DIE, - TEMP_SENSOR_I2C_U27_OBJECT, - /* TMP006 U14, die/object temperature near battery charger */ - TEMP_SENSOR_I2C_U14_DIE, - TEMP_SENSOR_I2C_U14_OBJECT, - /* EC internal temperature sensor */ - TEMP_SENSOR_EC_INTERNAL, - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI, - - TEMP_SENSOR_COUNT -}; - -/* The number of TMP006 sensor chips on the board. */ -#define TMP006_COUNT 4 - -/* Wireless signals */ -#define WIRELESS_GPIO_WLAN GPIO_RADIO_ENABLE_WLAN -#define WIRELESS_GPIO_BLUETOOTH GPIO_RADIO_ENABLE_BT -#define WIRELESS_GPIO_WLAN_POWER GPIO_ENABLE_WLAN - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/link/build.mk b/board/link/build.mk deleted file mode 100644 index 1843369ed4..0000000000 --- a/board/link/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build -# - -# the IC is TI Stellaris LM4 -CHIP:=lm4 - -board-y=board.o diff --git a/board/link/ec.tasklist b/board/link/ec.tasklist deleted file mode 100644 index 3f3d9b5015..0000000000 --- a/board/link/ec.tasklist +++ /dev/null @@ -1,29 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' is the name of the task - * 'r' is the main routine of the task - * 'd' is an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(LIGHTBAR, lightbar_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/link/userspace/README b/board/link/userspace/README deleted file mode 100644 index 204b9a4522..0000000000 --- a/board/link/userspace/README +++ /dev/null @@ -1,3 +0,0 @@ -Sometimes we need to perform some run-time tweaks of the EC from the AP's -userspace. This directory holds those tweaks. They're picked up by the -ec-utils ebuild. diff --git a/board/link/userspace/etc/init/ec.conf b/board/link/userspace/etc/init/ec.conf deleted file mode 100644 index 738cb8b2b8..0000000000 --- a/board/link/userspace/etc/init/ec.conf +++ /dev/null @@ -1,13 +0,0 @@ -# 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. - -description "Overrides lightbar params to tweak appearance" -author "chromium-os-dev@chromium.org" - -start on startup - -script - PARAMS=/usr/share/ec/lightbar_params.txt - [ -f "$PARAMS" ] && ectool lightbar params "$PARAMS" >/dev/null 2>&1 -end script diff --git a/board/link/userspace/usr/share/ec/lightbar_params.txt b/board/link/userspace/usr/share/ec/lightbar_params.txt deleted file mode 100644 index fc845478b6..0000000000 --- a/board/link/userspace/usr/share/ec/lightbar_params.txt +++ /dev/null @@ -1,31 +0,0 @@ -2500 # .google_ramp_up -10000 # .google_ramp_down -2000 # .s3s0_ramp_up -45000 # .s0_tick_delay (battery) -30000 # .s0_tick_delay (AC) -5000 # .s0a_tick_delay (battery) -3000 # .s0a_tick_delay (AC) -2000 # .s0s3_ramp_down -5000000 # .s3_sleep_for -2500 # .s3_ramp_up -10000 # .s3_ramp_down -1 # .new_s0 -0x60 0x60 # .osc_min (battery, AC) -0xd0 0xd0 # .osc_max (battery, AC) -24 24 # .w_ofs (battery, AC) -0xcc 0xff # .bright_bl_off_fixed (battery, AC) -0xcc 0xff # .bright_bl_on_min (battery, AC) -0xcc 0xff # .bright_bl_on_max (battery, AC) -14 40 99 # .battery_threshold -5 4 4 4 # .s0_idx[] (battery) -4 4 4 4 # .s0_idx[] (AC) -5 255 255 255 # .s3_idx[] (battery) -255 255 255 255 # .s3_idx[] (AC) -0x33 0x69 0xe8 # color[0] -0xd5 0x0f 0x25 # color[1] -0xee 0xb2 0x11 # color[2] -0x00 0x99 0x25 # color[3] -0x00 0x00 0xff # color[4] -0xff 0x00 0x00 # color[5] -0xff 0xff 0x00 # color[6] -0x00 0xff 0x00 # color[7] diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c deleted file mode 100644 index d0d839c57d..0000000000 --- a/board/mccroskey/board.c +++ /dev/null @@ -1,169 +0,0 @@ -/* 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. - */ -/* McCroskey board-specific configuration */ - -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "i2c.h" -#include "keyboard_raw.h" -#include "registers.h" -#include "spi.h" -#include "task.h" -#include "timer.h" -#include "util.h" - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) -#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_OUT_LOW) - -#define HARD_RESET_TIMEOUT_MS 5 - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"KB_IN00", GPIO_B, (1<<8), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN01", GPIO_B, (1<<9), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN02", GPIO_B, (1<<10), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN03", GPIO_B, (1<<11), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN04", GPIO_B, (1<<12), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN05", GPIO_B, (1<<13), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN06", GPIO_B, (1<<14), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN07", GPIO_B, (1<<15), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - /* TODO(crosbug.com/p/23494): interrupt handler for power button */ - {"KBD_PWR_BUTTON", GPIO_B, (1<<2), GPIO_INPUT, NULL}, - - {"OMZO_RDY_L", GPIO_A, (1<<0), GPIO_INPUT, NULL}, /* PA0_WKUP */ - {"OZMO_RST_L", GPIO_A, (1<<2), GPIO_ODR_HIGH, NULL}, - {"VBUS_UP_DET", GPIO_A, (1<<3), GPIO_INPUT, NULL}, - {"OZMO_REQ_L", GPIO_A, (1<<8), GPIO_INPUT, NULL}, - {"CHARGE_ZERO", GPIO_B, (1<<0), GPIO_INPUT, NULL}, - {"CHARGE_SHUNT", GPIO_B, (1<<1), GPIO_INPUT, NULL}, - {"PMIC_INT_L", GPIO_B, (1<<5), GPIO_INPUT, NULL}, - - /* - * I2C pins should be configured as inputs until I2C module is - * initialized. This will avoid driving the lines unintentionally. - */ - {"I2C1_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL}, - {"I2C1_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL}, - - {"KB_OUT00", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT01", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT02", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT03", GPIO_C, (1<<3), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT04", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT05", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT06", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT07", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT08", GPIO_C, (1<<8), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT09", GPIO_C, (1<<9), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT10", GPIO_C, (1<<10), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT11", GPIO_C, (1<<11), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT12", GPIO_C, (1<<12), GPIO_KB_OUTPUT, NULL}, - {"USB_VBUS_CTRL", GPIO_C, (1<<13), GPIO_OUT_LOW, NULL}, - {"HUB_RESET", GPIO_C, (1<<14), GPIO_ODR_HIGH, NULL}, - {"WP_L", GPIO_D, (1<<2), GPIO_INPUT, NULL}, - - /* TODO(crosbug.com/p/23494): make this an alternate function */ - {"BL_PWM", GPIO_A, (1<<1), GPIO_OUTPUT, NULL}, - - /* Unimplemented signals which we need to emulate for now */ - GPIO_SIGNAL_NOT_IMPLEMENTED("EC_INT"), - GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"), - -#if 0 - /* Other GPIOs (probably need to be set up below as alt. function) */ - {"STM_USBDM", GPIO_A, (1<<11), GPIO_DEFAULT, NULL}, - {"STM_USBDP", GPIO_A, (1<<12), GPIO_DEFAULT, NULL}, - {"JTMS_SWDIO", GPIO_A, (1<<13), GPIO_DEFAULT, NULL}, - {"JTCK_SWCLK", GPIO_A, (1<<14), GPIO_DEFAULT, NULL}, - {"JTDI", GPIO_A, (1<<15), GPIO_DEFAULT, NULL}, - {"JTDO", GPIO_B, (1<<3), GPIO_DEFAULT, NULL}, - {"JNTRST", GPIO_B, (1<<4), GPIO_DEFAULT, NULL}, - {"OSC32_OUT", GPIO_C, (1<<15), GPIO_DEFAULT, NULL}, -#endif -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - /* - * TODO(crosbug.com/p/23494): Use this instead of hard-coded register - * writes in board_config_pre_init(). - */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -void board_config_pre_init(void) -{ - uint32_t val; - - /* Enable all GPIOs clocks. - * - * TODO(crosbug.com/p/23494): more fine-grained enabling for power - * saving. - */ - STM32_RCC_APB2ENR |= 0x1fd; - -#ifdef CONFIG_SPI - /* - * SPI1 on pins PA4-7 (alt. function push-pull, 10MHz). - * - * TODO(crosbug.com/p/23494): Connected device SPI freq is fxo/2 in - * master mode, fxo/4 in slave mode. fxo ranges from 12-40MHz. - */ - val = STM32_GPIO_CRL(GPIO_A) & ~0xffff0000; - val |= 0x99990000; - STM32_GPIO_CRL(GPIO_A) = val; -#endif - - /* remap OSC_IN/OSC_OUT to PD0/PD1 */ - STM32_GPIO_AFIO_MAPR |= 1 << 15; - - /* use PB3 as a GPIO, so disable JTAG and keep only SWD */ - STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x7 << 24)) - | (2 << 24); - - /* remap TIM2_CH2 to PB3 */ - STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x3 << 8)) - | (1 << 8); - - /* - * Set alternate function for USART1. For alt. function input - * the port is configured in either floating or pull-up/down - * input mode (ref. section 7.1.4 in datasheet RM0041): - * PA9: Tx, alt. function output - * PA10: Rx, input with pull-down - * - * note: see crosbug.com/p/12223 for more info - */ - val = STM32_GPIO_CRH(GPIO_A) & ~0x00000ff0; - val |= 0x00000890; - STM32_GPIO_CRH(GPIO_A) = val; -} - -/* GPIO configuration to be done after I2C module init */ -void board_i2c_post_init(int port) -{ - uint32_t val; - - /* enable alt. function (open-drain) */ - if (port == STM32_I2C1_PORT) { - /* I2C1 is on PB6-7 */ - val = STM32_GPIO_CRL(GPIO_B) & ~0xff000000; - val |= 0xdd000000; - STM32_GPIO_CRL(GPIO_B) = val; - } -} diff --git a/board/mccroskey/board.h b/board/mccroskey/board.h deleted file mode 100644 index 7d4eefba2a..0000000000 --- a/board/mccroskey/board.h +++ /dev/null @@ -1,110 +0,0 @@ -/* 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. - */ - -/* McCroskey board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* 48 MHz SYSCLK clock frequency */ -#define CPU_CLOCK 48000000 - -/* Debug features */ -/* TODO(crosbug.com/p/23494): turn off extra I2C debugging when it works */ -#define CONFIG_I2C_DEBUG -#undef CONFIG_TASK_PROFILING - -/* Features not present on this reference board */ -#undef CONFIG_LID_SWITCH - -/* Optional features */ -#define CONFIG_BOARD_PRE_INIT -#define CONFIG_KEYBOARD_PROTOCOL_MKBP - -/* - * TODO(crosbug.com/p/23494): Stop mode causes the UART to drop characters and - * likely other bad side-effects. Disable for now. - */ -#undef CONFIG_LOW_POWER_IDLE - -#ifndef __ASSEMBLER__ - -/* Keyboard output ports */ -#define KB_OUT_PORT_LIST GPIO_C - -/* EC is I2C master */ -#define I2C_PORT_MASTER 0 -#define I2C_PORT_SLAVE 0 /* needed for DMAC macros (ugh) */ -#define GPIO_I2C2_SCL 0 /* unused, but must be defined anyway */ -#define GPIO_I2C2_SDA 0 /* unused, but must be defined anyway */ - -/* Timer selection */ -#define TIM_CLOCK_MSB 3 -#define TIM_CLOCK_LSB 4 -#define TIM_WATCHDOG 1 - -/* GPIO signal list */ -enum gpio_signal { - GPIO_KB_IN00, - GPIO_KB_IN01, - GPIO_KB_IN02, - GPIO_KB_IN03, - GPIO_KB_IN04, - GPIO_KB_IN05, - GPIO_KB_IN06, - GPIO_KB_IN07, - GPIO_KBD_PWR_BUTTON, - GPIO_OMZO_RDY_L, - GPIO_OZMO_RST_L, - GPIO_VBUS_UP_DET, - GPIO_OZMO_REQ_L, - GPIO_CHARGE_ZERO, - GPIO_CHARGE_SHUNT, - GPIO_PMIC_INT_L, - GPIO_I2C1_SCL, - GPIO_I2C1_SDA, - GPIO_KB_OUT00, - GPIO_KB_OUT01, - GPIO_KB_OUT02, - GPIO_KB_OUT03, - GPIO_KB_OUT04, - GPIO_KB_OUT05, - GPIO_KB_OUT06, - GPIO_KB_OUT07, - GPIO_KB_OUT08, - GPIO_KB_OUT09, - GPIO_KB_OUT10, - GPIO_KB_OUT11, - GPIO_KB_OUT12, - GPIO_USB_VBUS_CTRL, - GPIO_HUB_RESET, - GPIO_WP_L, - - /* - * TODO(crosbug.com/p/23494): This will be an alternate function GPIO, - * so remove it from here. - */ - GPIO_BL_PWM, - - /* Unimplemented GPIOs */ - GPIO_EC_INT, - GPIO_ENTERING_RW, - -#if 0 - GPIO_STM_USBDM, - GPIO_STM_USBDP, - GPIO_JTMS_SWDIO, - GPIO_JTCK_SWCLK, - GPIO_JTDI, - GPIO_JTDO, - GPIO_JNTRST, - GPIO_OSC32_OUT, -#endif - GPIO_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/mccroskey/build.mk b/board/mccroskey/build.mk deleted file mode 100644 index b3956b1645..0000000000 --- a/board/mccroskey/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -# the IC is STmicro STM32F102R8 -CHIP:=stm32 -CHIP_FAMILY:=stm32f -CHIP_VARIANT:=stm32f10x - -board-y=board.o diff --git a/board/mccroskey/ec.tasklist b/board/mccroskey/ec.tasklist deleted file mode 100644 index 2777d7484b..0000000000 --- a/board/mccroskey/ec.tasklist +++ /dev/null @@ -1,23 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, 360) diff --git a/board/mec1322_evb/board.c b/board/mec1322_evb/board.c deleted file mode 100644 index f363baf788..0000000000 --- a/board/mec1322_evb/board.c +++ /dev/null @@ -1,78 +0,0 @@ -/* 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. - */ -/* MEC1322 eval board-specific configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "fan.h" -#include "gpio.h" -#include "i2c.h" -#include "registers.h" -#include "util.h" - -#define GPIO_KB_INPUT GPIO_INPUT -#define GPIO_KB_OUTPUT (GPIO_ODR_HIGH | GPIO_PULL_UP) - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - {"LED1", GPIO_PORT(15), (1 << 4), GPIO_ODR_LOW, NULL}, - {"LED2", GPIO_PORT(15), (1 << 5), GPIO_ODR_HIGH, NULL}, - {"LED3", GPIO_PORT(15), (1 << 6), GPIO_ODR_LOW, NULL}, - {"PCH_SMI_L", GPIO_PORT(4), (1 << 4), GPIO_ODR_HIGH, NULL}, - {"PCH_SCI_L", GPIO_PORT(2), (1 << 6), GPIO_ODR_HIGH, NULL}, - {"PCH_WAKE_L", GPIO_PORT(20), (1 << 0), GPIO_ODR_HIGH, NULL}, - /* Unimplemented signals which we need to emulate for now */ - GPIO_SIGNAL_NOT_IMPLEMENTED("RECOVERY_L"), - GPIO_SIGNAL_NOT_IMPLEMENTED("WP"), - GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"), -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_PORT(16), 0x24, 1, MODULE_UART}, /* UART0 */ - {GPIO_PORT(3), (1 << 4), 3, MODULE_PWM_FAN}, - {GPIO_PORT(14), (1 << 0), 3, MODULE_PWM_FAN}, - /* - * I2C0: External pull-up resistors on EVB are too weak. Let's - * also enable internal pull-up here. - */ - {GPIO_PORT(1), 0x60, 2, MODULE_I2C, GPIO_PULL_UP}, - {GPIO_PORT(0), 0xfe, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT}, - {GPIO_PORT(1), 0x03, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT}, - {GPIO_PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT}, - {GPIO_PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT}, - {GPIO_PORT(10), 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT}, - {GPIO_PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT}, - {GPIO_PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT}, -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* ADC channels */ -const struct adc_t adc_channels[] = { - [ADC_CH_1] = {"ADC1", 1, 1, 0, MEC1322_ADC_CH(1)}, - [ADC_CH_2] = {"ADC2", 1, 1, 0, MEC1322_ADC_CH(2)}, - [ADC_CH_3] = {"ADC3", 1, 1, 0, MEC1322_ADC_CH(3)}, - [ADC_CH_4] = {"ADC4", 1, 1, 0, MEC1322_ADC_CH(4)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1500, - .rpm_max = 8000, - .ch = 0, - .pgood_gpio = -1, - .enable_gpio = -1, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"port0", 0, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/mec1322_evb/board.h b/board/mec1322_evb/board.h deleted file mode 100644 index a4142a9fdc..0000000000 --- a/board/mec1322_evb/board.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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. - */ - -/* MEC1322 eval board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */ -#define CONFIG_WATCHDOG_HELP -#define CONFIG_FANS 1 -#define CONFIG_ADC - -/* Modules we want to exclude */ -#undef CONFIG_EEPROM -#undef CONFIG_EOPTION -#undef CONFIG_PSTORE -#undef CONFIG_LID_SWITCH -#undef CONFIG_PECI -#undef CONFIG_SWITCH - -#ifndef __ASSEMBLER__ - -enum adc_channel { - ADC_CH_1 = 0, - ADC_CH_2, - ADC_CH_3, - ADC_CH_4, - - ADC_CH_COUNT -}; - -/* GPIO signal list */ -enum gpio_signal { - GPIO_LED1 = 0, - GPIO_LED2, - GPIO_LED3, - GPIO_PCH_SMI_L, /* SMI output */ - GPIO_PCH_SCI_L, /* SCI output */ - GPIO_PCH_WAKE_L, /* PCH wake pin */ - /* - * Signals which aren't implemented on MEC1322 eval board but we'll - * emulate anyway, to make it more convenient to debug other code. - */ - GPIO_RECOVERY_L, /* Recovery signal from DOWN button */ - GPIO_WP, /* Write protect input */ - GPIO_ENTERING_RW, /* EC entering RW code */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/mec1322_evb/build.mk b/board/mec1322_evb/build.mk deleted file mode 100644 index 5f03511802..0000000000 --- a/board/mec1322_evb/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build -# - -# the IC is SMSC MEC1322 -CHIP:=mec1322 - -board-y=board.o diff --git a/board/mec1322_evb/ec.tasklist b/board/mec1322_evb/ec.tasklist deleted file mode 100644 index 09bcb6e06c..0000000000 --- a/board/mec1322_evb/ec.tasklist +++ /dev/null @@ -1,22 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/board/nyan/battery.c b/board/nyan/battery.c deleted file mode 100644 index 7c0058c1d6..0000000000 --- a/board/nyan/battery.c +++ /dev/null @@ -1,253 +0,0 @@ -/* 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. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" -#include "gpio.h" -#include "host_command.h" -#include "util.h" -#include "console.h" - -/* Console output macros */ -#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args) - -/* These 2 defines are for cut_off command for 3S battery */ -#define SB_SHIP_MODE_ADDR 0x3a -#define SB_SHIP_MODE_DATA 0xc574 - -static struct battery_info *battery_info; -static int battery_cut_off; - -struct battery_device { - char manuf[9]; - char device[9]; - int design_mv; - struct battery_info *battery_info; - int support_cut_off; -}; - -static struct battery_info info_2s = { - /* - * Design voltage - * max = 8.4V - * normal = 7.4V - * min = 6.0V - */ - .voltage_max = 8400, - .voltage_normal = 7400, - .voltage_min = 6000, - - /* Pre-charge current: I <= 0.01C */ - .precharge_current = 64, /* mA */ - - /* - * Operational temperature range - * 0 <= T_charge <= 50 deg C - * -20 <= T_discharge <= 60 deg C - */ - .start_charging_min_c = 0, - .start_charging_max_c = 50, - .charging_min_c = 0, - .charging_max_c = 50, - .discharging_min_c = -20, - .discharging_max_c = 60, -}; - -static struct battery_info info_3s = { - - .voltage_max = 12600, - .voltage_normal = 11100, /* Average of max & min */ - .voltage_min = 9000, - - /* Pre-charge values. */ - .precharge_current = 392, /* mA */ - - .start_charging_min_c = 0, - .start_charging_max_c = 60, - .charging_min_c = 0, - .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 50, -}; - -static struct battery_device support_batteries[] = { - { - .manuf = "NVT", - .device = "ARROW", - .design_mv = 7400, - .battery_info = &info_2s, - .support_cut_off = 0, - }, - { - .manuf = "SANYO", - .device = "AP13J3K", - .design_mv = 11250, - .battery_info = &info_3s, - .support_cut_off = 1, - }, - { - .manuf = "SONYCorp", - .device = "AP13J4K", - .design_mv = 11400, - .battery_info = &info_3s, - .support_cut_off = 1, - } -}; - -#ifdef CONFIG_BATTERY_VENDOR_PARAMS -/* - * The following parameters are for 2S battery. - * There is no corresponding params for 3S battery. - */ -enum { - TEMP_RANGE_10, - TEMP_RANGE_23, - TEMP_RANGE_35, - TEMP_RANGE_45, - TEMP_RANGE_50, - TEMP_RANGE_MAX -}; - -enum { - VOLT_RANGE_7200, - VOLT_RANGE_8000, - VOLT_RANGE_8400, - VOLT_RANGE_MAX -}; - -/* - * Vendor provided charging method - * temp : < 7.2V, 7.2V ~ 8.0V, 8.0V ~ 8.4V - * - 0 ~ 10 : 0.8A 1.6A 0.8A - * - 10 ~ 23 : 1.6A 4.0A 1.6A - * - 23 ~ 35 : 4.0A 4.0A 4.0A - * - 35 ~ 45 : 1.6A 4.0A 1.6A - * - 45 ~ 50 : 0.8A 1.6A 0.8A - */ -static const int const current_limit[TEMP_RANGE_MAX][VOLT_RANGE_MAX] = { - { 800, 1600, 800}, - {1600, 4000, 1600}, - {4000, 4000, 4000}, - {1600, 4000, 1600}, - { 800, 1600, 800}, -}; - -static inline void limit_value(int *val, int limit) -{ - if (*val > limit) - *val = limit; -} - -void battery_vendor_params(struct batt_params *batt) -{ - int *desired_current = &batt->desired_current; - int temp_range, volt_range; - int bat_temp_c = DECI_KELVIN_TO_CELSIUS(batt->temperature); - - if (battery_info == NULL) - return; - - /* Return if the battery is not a 2S battery */ - if (battery_info->voltage_max != info_2s.voltage_max) - return; - - /* Limit charging voltage */ - if (batt->desired_voltage > battery_info->voltage_max) - batt->desired_voltage = battery_info->voltage_max; - - /* Don't charge if outside of allowable temperature range */ - if (bat_temp_c >= battery_info->charging_max_c || - bat_temp_c < battery_info->charging_min_c) { - batt->desired_voltage = 0; - batt->desired_current = 0; - batt->flags &= ~BATT_FLAG_WANT_CHARGE; - return; - } - - if (bat_temp_c <= 10) - temp_range = TEMP_RANGE_10; - else if (bat_temp_c <= 23) - temp_range = TEMP_RANGE_23; - else if (bat_temp_c <= 35) - temp_range = TEMP_RANGE_35; - else if (bat_temp_c <= 45) - temp_range = TEMP_RANGE_45; - else - temp_range = TEMP_RANGE_50; - - if (batt->voltage < 7200) - volt_range = VOLT_RANGE_7200; - else if (batt->voltage < 8000) - volt_range = VOLT_RANGE_8000; - else - volt_range = VOLT_RANGE_8400; - - limit_value(desired_current, current_limit[temp_range][volt_range]); - - /* If battery wants current, give it at least the precharge current */ - if (*desired_current > 0 && - *desired_current < battery_info->precharge_current) - *desired_current = battery_info->precharge_current; -} -#endif /* CONFIG_BATTERY_VENDOR_PARAMS */ - -const struct battery_info *battery_get_info(void) -{ - int i; - char manuf[9]; - char device[9]; - int design_mv; - - if (battery_manufacturer_name(manuf, sizeof(manuf))) { - CPRINTF("[%T Failed to get MANUF name]\n"); - return NULL; - } - - if (battery_device_name(device, sizeof(device))) { - CPRINTF("[%T Failed to get DEVICE name]\n"); - return NULL; - } - if (battery_design_voltage((int *)&design_mv)) { - CPRINTF("[%T Failed to get DESIGN_VOLTAGE]\n"); - return NULL; - } - - for (i = 0; i < ARRAY_SIZE(support_batteries); ++i) { - if ((strcasecmp(support_batteries[i].manuf, manuf) == 0) && - (strcasecmp(support_batteries[i].device, device) == 0) && - (support_batteries[i].design_mv == design_mv)) { - CPRINTF("[%T battery Manuf:%s, Device=%s, design=%u]\n", - manuf, device, design_mv); - battery_cut_off = support_batteries[i].support_cut_off; - battery_info = support_batteries[i].battery_info; - return battery_info; - } - } - - return NULL; -} - -int battery_command_cut_off(struct host_cmd_handler_args *args) -{ - if (battery_cut_off) - return sb_write(SB_SHIP_MODE_ADDR, SB_SHIP_MODE_DATA); - else - return EC_RES_INVALID_COMMAND; -} -DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off, - EC_VER_MASK(0)); - - -#ifdef CONFIG_BATTERY_CHECK_CONNECTED -/** - * Physical detection of battery connection. - */ -int battery_is_connected(void) -{ - return (gpio_get_level(GPIO_BAT_DETECT_L) == 0); -} -#endif /* CONFIG_BATTERY_CHECK_CONNECTED */ diff --git a/board/nyan/board.c b/board/nyan/board.c deleted file mode 100644 index 0daa122fe9..0000000000 --- a/board/nyan/board.c +++ /dev/null @@ -1,114 +0,0 @@ -/* 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. - */ -/* Nyan board-specific configuration */ - -#include "battery.h" -#include "chipset.h" -#include "common.h" -#include "extpower.h" -#include "gpio.h" -#include "i2c.h" -#include "keyboard_raw.h" -#include "lid_switch.h" -#include "pmu_tpschrome.h" -#include "power_button.h" -#include "power.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "spi.h" -#include "task.h" -#include "util.h" -#include "timer.h" - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) -#define GPIO_KB_OUTPUT GPIO_ODR_HIGH - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", GPIO_B, (1<<5), GPIO_INT_BOTH, - power_button_interrupt}, - {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt}, - {"SUSPEND_L", GPIO_C, (1<<7), GPIO_KB_INPUT, - power_signal_interrupt}, - {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_BOTH | GPIO_PULL_UP, - spi_event}, - {"AC_PRESENT", GPIO_A, (1<<0), GPIO_INT_BOTH, extpower_interrupt}, - {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - /* Other inputs */ - {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL}, - /* Outputs */ - {"AP_RESET_L", GPIO_B, (1<<3), GPIO_ODR_HIGH, NULL}, - {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL}, - {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL}, - {"ENTERING_RW", GPIO_H, (1<<0), GPIO_OUT_LOW, NULL}, - {"I2C1_SCL", GPIO_B, (1<<6), GPIO_ODR_HIGH, NULL}, - {"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL}, - {"I2C2_SCL", GPIO_B, (1<<10), GPIO_ODR_HIGH, NULL}, - {"I2C2_SDA", GPIO_B, (1<<11), GPIO_ODR_HIGH, NULL}, - {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL}, /* PWR_LED1 */ - {"PMIC_PWRON_L", GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL}, - {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL}, - {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT11", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL}, - {"PWR_LED0", GPIO_B, (1<<10), GPIO_OUT_LOW, NULL}, - {"BAT_LED0", GPIO_B, (1<<11), GPIO_OUT_LOW, NULL}, - {"BAT_LED1", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, - {"CHARGING", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, - {"EC_BL_OVERRIDE", GPIO_H, (1<<1), GPIO_ODR_HIGH, NULL}, - {"PMIC_THERM_L", GPIO_A, (1<<1), GPIO_ODR_HIGH, NULL}, - {"PMIC_WARM_RESET_L", GPIO_C, (1<<3), GPIO_ODR_HIGH, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI, GPIO_DEFAULT}, - {GPIO_A, 0x0600, GPIO_ALT_USART, MODULE_UART, GPIO_DEFAULT}, - {GPIO_B, 0x00c0, GPIO_ALT_I2C, MODULE_I2C, GPIO_DEFAULT}, -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"master", I2C_PORT_MASTER, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {STM32_TIM(2), STM32_TIM_CH(3), - PWM_CONFIG_ACTIVE_LOW, GPIO_LED_POWER_L}, -}; -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); diff --git a/board/nyan/board.h b/board/nyan/board.h deleted file mode 100644 index 52c9e80933..0000000000 --- a/board/nyan/board.h +++ /dev/null @@ -1,112 +0,0 @@ -/* 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. - */ - -/* Nyan board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_AP_HANG_DETECT -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24725 -#define CONFIG_CHIPSET_TEGRA -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_HOST_COMMAND_STATUS -#define CONFIG_I2C -#define CONFIG_KEYBOARD_PROTOCOL_MKBP -#define CONFIG_SPI -#define CONFIG_PWM -#define CONFIG_POWER_BUTTON - -#ifndef __ASSEMBLER__ - -/* Keyboard output port list */ -#define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C - -/* Single I2C port, where the EC is the master. */ -#define I2C_PORT_MASTER 0 -#define I2C_PORT_BATTERY I2C_PORT_MASTER -#define I2C_PORT_CHARGER I2C_PORT_MASTER - -/* Timer selection */ -#define TIM_CLOCK_MSB 3 -#define TIM_CLOCK_LSB 9 -#define TIM_POWER_LED 2 -#define TIM_WATCHDOG 4 - -/* GPIO signal list */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, - GPIO_SOC1V8_XPSHOLD, - GPIO_LID_OPEN, - GPIO_SUSPEND_L, - GPIO_SPI1_NSS, - GPIO_AC_PRESENT, - /* Keyboard inputs */ - GPIO_KB_IN00, - GPIO_KB_IN01, - GPIO_KB_IN02, - GPIO_KB_IN03, - GPIO_KB_IN04, - GPIO_KB_IN05, - GPIO_KB_IN06, - GPIO_KB_IN07, - /* Other inputs */ - GPIO_WP_L, - /* Outputs */ - GPIO_AP_RESET_L, - GPIO_CHARGER_EN, - GPIO_EC_INT, - GPIO_ENTERING_RW, - GPIO_I2C1_SCL, - GPIO_I2C1_SDA, - GPIO_I2C2_SCL, - GPIO_I2C2_SDA, - GPIO_LED_POWER_L, /* alias to GPIO_PWR_LED1 */ - GPIO_PMIC_PWRON_L, - GPIO_PMIC_RESET, - GPIO_KB_OUT00, - GPIO_KB_OUT01, - GPIO_KB_OUT02, - GPIO_KB_OUT03, - GPIO_KB_OUT04, - GPIO_KB_OUT05, - GPIO_KB_OUT06, - GPIO_KB_OUT07, - GPIO_KB_OUT08, - GPIO_KB_OUT09, - GPIO_KB_OUT10, - GPIO_KB_OUT11, - GPIO_KB_OUT12, - GPIO_PWR_LED0, - GPIO_BAT_LED0, - GPIO_BAT_LED1, - GPIO_CHARGING, - GPIO_EC_BL_OVERRIDE, - GPIO_PMIC_THERM_L, - GPIO_PMIC_WARM_RESET_L, - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - - -enum pwm_channel { - PWM_CH_POWER_LED = 0, - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -/* Charger module */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 /* Input sensor resistor, mOhm */ -#define CONFIG_CHARGER_INPUT_CURRENT 4032 /* mA, based on Link HW design */ -#define CONFIG_CHARGER_CURRENT_LIMIT 3000 /* PL102 inductor 3.0A(3.8A) */ - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/nyan/build.mk b/board/nyan/build.mk deleted file mode 100644 index c950c382d6..0000000000 --- a/board/nyan/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -# the IC is STmicro STM32L100RBT6 -CHIP:=stm32 -CHIP_FAMILY:=stm32l -CHIP_VARIANT:=stm32l100 - -board-y=board.o battery.o diff --git a/board/nyan/ec.tasklist b/board/nyan/ec.tasklist deleted file mode 100644 index 448879d105..0000000000 --- a/board/nyan/ec.tasklist +++ /dev/null @@ -1,25 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK(n, r, d, s) where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(POWERLED, power_led_task, NULL, 256) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/peppy/battery.c b/board/peppy/battery.c deleted file mode 100644 index 3d5856ef30..0000000000 --- a/board/peppy/battery.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" -#include "gpio.h" -#include "host_command.h" - -#define SB_SHIP_MODE_ADDR 0x3a -#define SB_SHIP_MODE_DATA 0xc574 - -/* Values for 54Wh 3UPF656790-1-T1001 battery */ -static const struct battery_info info = { - - .voltage_max = 12600, - .voltage_normal = 11100, /* Average of max & min */ - .voltage_min = 9000, - - /* Pre-charge values. */ - .precharge_current = 392, /* mA */ - - .start_charging_min_c = 0, - .start_charging_max_c = 60, - .charging_min_c = 0, - .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 50, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -int battery_command_cut_off(struct host_cmd_handler_args *args) -{ - return sb_write(SB_SHIP_MODE_ADDR, SB_SHIP_MODE_DATA); -} -DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off, - EC_VER_MASK(0)); - -/** - * Physical detection of battery connection. - */ -int battery_is_connected(void) -{ - return (gpio_get_level(GPIO_BAT_DETECT_L) == 0); -} diff --git a/board/peppy/board.c b/board/peppy/board.c deleted file mode 100644 index 72e98278bd..0000000000 --- a/board/peppy/board.c +++ /dev/null @@ -1,250 +0,0 @@ -/* 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. - */ -/* EC for Peppy board configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "backlight.h" -#include "chipset.h" -#include "common.h" -#include "driver/temp_sensor/g781.h" -#include "extpower.h" -#include "fan.h" -#include "gpio.h" -#include "host_command.h" -#include "i2c.h" -#include "jtag.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "peci.h" -#include "power.h" -#include "power_button.h" -#include "registers.h" -#include "switch.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "thermal.h" -#include "timer.h" -#include "uart.h" -#include "util.h" - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP, - power_button_interrupt}, - {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP, - lid_interrupt}, - {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP, - extpower_interrupt}, - {"PCH_BKLTEN", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH, - backlight_interrupt}, - {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP, - power_signal_interrupt}, - {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP, - power_signal_interrupt}, - {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1350_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_EDP_VDD_EN", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH, - power_interrupt}, - {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH, - switch_interrupt}, - {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH, - switch_interrupt}, - {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT, - jtag_interrupt}, - {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_PULL_UP| - GPIO_INT_BOTH_DSLEEP, - uart_deepsleep_interrupt}, - - /* Other inputs */ - {"FAN_ALERT_L", LM4_GPIO_B, (1<<0), GPIO_INPUT, NULL}, - {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, NULL}, - {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL}, - {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL}, - {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL}, - {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL}, - {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL}, - {"BAT_DETECT_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL}, - - /* Outputs; all unasserted by default except for reset signals */ - {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL}, - {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL}, - {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL}, - {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL}, - {"PP5000_FAN_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL}, - {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL}, - {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL}, - {"CHARGE_L", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL}, - - {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL}, - {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL}, - {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL}, - /* - * HDA_SDO is technically an output, but we need to leave it as an - * input until we drive it high. So can't use open-drain (HI_Z). - */ - {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL}, - {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_OUT_HIGH, NULL}, - {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, - /* - * PL6 is one of 4 pins on the EC which can't be used in open-drain - * mode. To work around this PCH_RCIN_L is set to an input. It will - * only be set to an output when it needs to be driven to 0. - */ - {"PCH_RCIN_L", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL}, - {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL}, - {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL}, - {"EC_EDP_VDD_EN", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL}, - - {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, - {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL}, - - {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL}, - {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL}, - {"PCH_SRTCRST_L", LM4_GPIO_F, (1<<7), GPIO_ODR_HIGH, NULL}, - - {"BAT_LED0_L", LM4_GPIO_D, (1<<0), GPIO_ODR_HIGH, NULL}, - {"BAT_LED1_L", LM4_GPIO_N, (1<<4), GPIO_ODR_HIGH, NULL}, - {"PWR_LED0_L", LM4_GPIO_D, (1<<1), GPIO_ODR_HIGH, NULL}, - {"PWR_LED1_L", LM4_GPIO_N, (1<<6), GPIO_ODR_HIGH, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART, GPIO_PULL_UP}, /* UART0 */ - {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */ - {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */ - {GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_G, 0x30, 1, MODULE_UART}, /* UART2 */ - {GPIO_J, 0x40, 1, MODULE_PECI}, /* PECI Tx */ - {GPIO_J, 0x80, 0, MODULE_PECI, GPIO_ANALOG}, /* PECI Rx */ - {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0x33, 15, MODULE_LPC}, /* LPC */ - {GPIO_N, 0x0c, 1, MODULE_PWM_FAN}, /* FAN0PWM2 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_PP5000_PGOOD, 1, "PGOOD_PP5000"}, - {GPIO_PP1350_PGOOD, 1, "PGOOD_PP1350"}, - {GPIO_PP1050_PGOOD, 1, "PGOOD_PP1050"}, - {GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"}, - {GPIO_PCH_SLP_S0_L, 1, "SLP_S0#_DEASSERTED"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S5_L, 1, "SLP_S5#_DEASSERTED"}, - {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS#_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -/* ADC channels. Must be in the exactly same order as in enum adc_channel. */ -const struct adc_t adc_channels[] = { - /* EC internal temperature is calculated by - * 273 + (295 - 450 * ADC_VALUE / ADC_READ_MAX) / 2 - * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 - */ - {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - - /* IOUT == ICMNT is on PE3/AIN0 */ - /* We have 0.01-ohm resistors, and IOUT is 20X the differential - * voltage, so 1000mA ==> 200mV. - * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured). - * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 200 - */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 2, 0, - LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_max = 5050, - .ch = 2, - .pgood_gpio = GPIO_PP5000_PGOOD, - .enable_gpio = GPIO_PP5000_FAN_EN, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", 0, 100}, - {"thermal", 5, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[] = { - {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, - {"G781Internal", TEMP_SENSOR_TYPE_BOARD, g781_get_val, - G781_IDX_INTERNAL, 4}, - {"G781External", TEMP_SENSOR_TYPE_BOARD, g781_get_val, - G781_IDX_EXTERNAL, 4}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in - * same order as enum temp_sensor_id. To always ignore any temp, use 0. - */ -struct ec_thermal_config thermal_params[] = { - /* Only the AP affects the thermal limits and fan speed. */ - {{C_TO_K(95), C_TO_K(97), C_TO_K(99)}, C_TO_K(55), C_TO_K(85)}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -struct keyboard_scan_config keyscan_config = { - .output_settle_us = 40, - .debounce_down_us = 6 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 1500, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = SECOND, - .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, - 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xca /* full set */ - }, -}; - -/** - * Discharge battery when on AC power for factory test. - */ -int board_discharge_on_ac(int enable) -{ - if (enable) - gpio_set_level(GPIO_CHARGE_L, 1); - else - gpio_set_level(GPIO_CHARGE_L, 0); - return EC_SUCCESS; -} diff --git a/board/peppy/board.h b/board/peppy/board.h deleted file mode 100644 index c4ceaf93ee..0000000000 --- a/board/peppy/board.h +++ /dev/null @@ -1,190 +0,0 @@ -/* 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. - */ - -/* Configuration for Peppy mainboard */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_BACKLIGHT_LID -#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BKLTEN -#define CONFIG_BATTERY_CHECK_CONNECTED -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_VERSION -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24707A -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHIPSET_CAN_THROTTLE -#define CONFIG_CHIPSET_HASWELL -#define CONFIG_CHIPSET_X86 -#define CONFIG_CMD_GSV -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_FANS 1 -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_LED_COMMON -#define CONFIG_LOW_POWER_IDLE -#define CONFIG_PECI_TJMAX 100 -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_SWITCH_DEDICATED_RECOVERY -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_G781 -#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_PP3300_DX_EN -#define CONFIG_UART_HOST 2 -#define CONFIG_USB_PORT_POWER_DUMB -#define CONFIG_WIRELESS - -#ifndef __ASSEMBLER__ - -/* I2C ports */ -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#define I2C_PORT_THERMAL 5 - -/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */ -#define KB_SCAN_ROW_IRQ LM4_IRQ_GPIOK -#define KB_SCAN_ROW_GPIO LM4_GPIO_K - -/* Host connects to keyboard controller module via LPC */ -#define HOST_KB_BUS_LPC - -/* USB ports */ -#define USB_PORT_COUNT 2 - -/* GPIO signal definitions. */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, /* Power button */ - GPIO_LID_OPEN, /* Lid switch */ - GPIO_AC_PRESENT, /* AC power present */ - GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */ - GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */ - GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */ - GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */ - GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */ - GPIO_PP1050_PGOOD, /* Power good on 1.05V */ - GPIO_PP1350_PGOOD, /* Power good on 1.35V (DRAM) */ - GPIO_PP5000_PGOOD, /* Power good on 5V */ - GPIO_VCORE_PGOOD, /* Power good on core VR */ - GPIO_PCH_EDP_VDD_EN, /* PCH wants EDP enabled */ - GPIO_RECOVERY_L, /* Recovery signal from servo */ - GPIO_WP_L, /* Write protect input */ - GPIO_JTAG_TCK, /* JTAG clock input */ - GPIO_UART0_RX, /* UART0 RX input */ - - /* Other inputs */ - GPIO_FAN_ALERT_L, /* From thermal sensor */ - GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */ - GPIO_USB1_OC_L, /* USB port overcurrent warning */ - GPIO_USB2_OC_L, /* USB port overcurrent warning */ - GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */ - GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ - GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ - GPIO_CPU_PGOOD, /* Power good to the CPU */ - GPIO_BAT_DETECT_L, /* Battery detect. Repurposed BAT_TEMP */ - - /* Outputs */ - GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ - GPIO_PP1350_EN, /* Enable 1.35V supply */ - GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ - GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ - GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ - GPIO_VCORE_EN, /* Stuffing option - not connected */ - GPIO_PP5000_EN, /* Enable 5V supply */ - GPIO_PP5000_FAN_EN, /* Enable fan power rail */ - GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi radio */ - GPIO_CHARGE_L, /* Allow battery to charge when on AC */ - - GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ - GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ - GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ - GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */ - - GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME - * ignores security descriptor */ - GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */ - GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */ - GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ - GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */ - GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */ - GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */ - GPIO_PCH_SMI_L, /* System management interrupt to PCH */ - GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ - GPIO_EC_EDP_VDD_EN, /* Enable EDP (passthru from PCH) */ - GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */ - - GPIO_USB1_ENABLE, /* USB port 1 output power enable */ - GPIO_USB2_ENABLE, /* USB port 2 output power enable */ - - GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */ - GPIO_PCH_RTCRST_L, /* Not supposed to be here */ - GPIO_PCH_SRTCRST_L, /* Not supposed to be here */ - - GPIO_BAT_LED0_L, /* Battery charging LED - blue */ - GPIO_BAT_LED1_L, /* Battery charging LED - orange */ - GPIO_PWR_LED0_L, /* Power LED - blue */ - GPIO_PWR_LED1_L, /* Power LED - orange */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -/* power signal definitions */ -enum power_signal { - X86_PGOOD_PP5000 = 0, - X86_PGOOD_PP1350, - X86_PGOOD_PP1050, - X86_PGOOD_VCORE, - X86_SLP_S0_DEASSERTED, - X86_SLP_S3_DEASSERTED, - X86_SLP_S5_DEASSERTED, - X86_SLP_SUS_DEASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -/* Charger module */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input sensor resistor, mOhm */ -#define CONFIG_CHARGER_INPUT_CURRENT 3078 /* mA, 90% of power supply rating */ - -enum adc_channel { - /* EC internal die temperature in degrees K. */ - ADC_CH_EC_TEMP = 0, - - /* Charger current in mA. */ - ADC_CH_CHARGER_CURRENT, - - ADC_CH_COUNT -}; - -enum temp_sensor_id { - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI = 0, - /* EC internal temperature sensor */ - TEMP_SENSOR_EC_INTERNAL, - /* G781 internal and external sensors */ - TEMP_SENSOR_I2C_G781_INTERNAL, - TEMP_SENSOR_I2C_G781_EXTERNAL, - - TEMP_SENSOR_COUNT -}; - -/* Wireless signals */ -#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L -#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN -#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN - -/* Discharge battery when on AC power for factory test. */ -int board_discharge_on_ac(int enable); - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/peppy/build.mk b/board/peppy/build.mk deleted file mode 100644 index 2eb0db0bc6..0000000000 --- a/board/peppy/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build -# - -# the IC is TI Stellaris LM4 -CHIP:=lm4 - -board-y=board.o battery.o led.o diff --git a/board/peppy/ec.tasklist b/board/peppy/ec.tasklist deleted file mode 100644 index 8666f7db09..0000000000 --- a/board/peppy/ec.tasklist +++ /dev/null @@ -1,28 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' is the name of the task - * 'r' is the main routine of the task - * 'd' is an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/peppy/led.c b/board/peppy/led.c deleted file mode 100644 index ffdcdb8359..0000000000 --- a/board/peppy/led.c +++ /dev/null @@ -1,186 +0,0 @@ -/* 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. - * - * Power and battery LED control for Peppy. - */ - -#include "battery.h" -#include "charge_state.h" -#include "chipset.h" -#include "ec_commands.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "led_common.h" -#include "util.h" - -#define LED_TOTAL_TICKS 16 -#define LED_ON_TICKS 4 - -enum led_color { - LED_OFF = 0, - LED_BLUE, - LED_AMBER, - LED_PINK, - - LED_COLOR_COUNT /* Number of colors, not a color itself */ -}; - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_POWER_LED, EC_LED_ID_BATTERY_LED}; - -const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); - -static int peppy_led_set_gpio(enum led_color color, - enum gpio_signal gpio_led_blue_l, - enum gpio_signal gpio_led_amber_l) -{ - switch (color) { - case LED_OFF: - gpio_set_level(gpio_led_blue_l, 1); - gpio_set_level(gpio_led_amber_l, 1); - break; - case LED_BLUE: - gpio_set_level(gpio_led_blue_l, 0); - gpio_set_level(gpio_led_amber_l, 1); - break; - case LED_AMBER: - gpio_set_level(gpio_led_blue_l, 1); - gpio_set_level(gpio_led_amber_l, 0); - break; - case LED_PINK: - gpio_set_level(gpio_led_blue_l, 0); - gpio_set_level(gpio_led_amber_l, 0); - break; - default: - return EC_ERROR_UNKNOWN; - } - return EC_SUCCESS; -} - -static int peppy_led_set_color_battery(enum led_color color) -{ - return peppy_led_set_gpio(color, GPIO_BAT_LED0_L, GPIO_BAT_LED1_L); -} - -static int peppy_led_set_color_power(enum led_color color) -{ - return peppy_led_set_gpio(color, GPIO_PWR_LED0_L, GPIO_PWR_LED1_L); -} - -static int peppy_led_set_color(enum ec_led_id led_id, enum led_color color) -{ - int rv; - - led_auto_control(led_id, 0); - switch (led_id) { - case EC_LED_ID_BATTERY_LED: - rv = peppy_led_set_color_battery(color); - break; - case EC_LED_ID_POWER_LED: - rv = peppy_led_set_color_power(color); - break; - default: - return EC_ERROR_UNKNOWN; - } - return rv; -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - if (brightness[EC_LED_COLOR_BLUE] != 0 && - brightness[EC_LED_COLOR_YELLOW] != 0) - peppy_led_set_color(led_id, LED_PINK); - else if (brightness[EC_LED_COLOR_BLUE] != 0) - peppy_led_set_color(led_id, LED_BLUE); - else if (brightness[EC_LED_COLOR_YELLOW] != 0) - peppy_led_set_color(led_id, LED_AMBER); - else - peppy_led_set_color(led_id, LED_OFF); - - return EC_SUCCESS; -} - -void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) -{ - /* Ignoring led_id as both leds support the same colors */ - brightness_range[EC_LED_COLOR_BLUE] = 1; - brightness_range[EC_LED_COLOR_YELLOW] = 1; -} - -static void peppy_led_set_power(void) -{ - static int power_ticks; - static int previous_state_suspend; - - power_ticks++; - - if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { - /* Reset ticks if entering suspend so LED turns amber - * as soon as possible. */ - if (!previous_state_suspend) - power_ticks = 0; - - /* Blink once every four seconds. */ - peppy_led_set_color_power( - (power_ticks % LED_TOTAL_TICKS < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); - - previous_state_suspend = 1; - return; - } - - previous_state_suspend = 0; - - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - peppy_led_set_color_power(LED_OFF); - else if (chipset_in_state(CHIPSET_STATE_ON)) - peppy_led_set_color_power(LED_BLUE); -} - -static void peppy_led_set_battery(void) -{ - static int battery_ticks; - uint32_t chflags = charge_get_flags(); - - battery_ticks++; - - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - peppy_led_set_color_battery(LED_AMBER); - break; - case PWR_STATE_CHARGE_NEAR_FULL: - peppy_led_set_color_battery(LED_BLUE); - break; - case PWR_STATE_DISCHARGE: - peppy_led_set_color_battery(LED_OFF); - break; - case PWR_STATE_ERROR: - peppy_led_set_color_battery( - (battery_ticks % LED_TOTAL_TICKS < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); - break; - case PWR_STATE_IDLE: /* External power connected in IDLE. */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - peppy_led_set_color_battery( - (battery_ticks & 0x4) ? LED_BLUE : LED_OFF); - else - peppy_led_set_color_battery(LED_BLUE); - break; - default: - /* Other states don't alter LED behavior */ - break; - } -} - -/* Called by hook task every 250mSec */ -static void led_tick(void) -{ - if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - peppy_led_set_power(); - - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) - peppy_led_set_battery(); -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); diff --git a/board/pit/board.c b/board/pit/board.c deleted file mode 100644 index afd8112f94..0000000000 --- a/board/pit/board.c +++ /dev/null @@ -1,204 +0,0 @@ -/* 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. - */ -/* Pit board-specific configuration */ - -#include "battery.h" -#include "chipset.h" -#include "common.h" -#include "extpower.h" -#include "gpio.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "keyboard_raw.h" -#include "lid_switch.h" -#include "pmu_tpschrome.h" -#include "power.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "spi.h" -#include "timer.h" -#include "task.h" -#include "util.h" - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) -#define GPIO_KB_OUTPUT GPIO_ODR_HIGH - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_RISING, - power_signal_interrupt}, - {"CHARGER_INT_L", GPIO_C, (1<<6), GPIO_INT_FALLING, pmu_irq_handler}, - {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt}, - {"SUSPEND_L", GPIO_C, (1<<7), GPIO_INT_BOTH, - power_signal_interrupt}, - {"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_BOTH | GPIO_PULL_UP, - spi_event}, - {"AC_PRESENT", GPIO_A, (1<<0), GPIO_INT_BOTH, extpower_interrupt}, - {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - /* Other inputs */ - {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL}, - /* Outputs */ - {"AP_RESET_L", GPIO_B, (1<<3), GPIO_ODR_HIGH, NULL}, - {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL}, - {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL}, - {"EN_PP1350", GPIO_H, (1<<1), GPIO_OUT_LOW, NULL}, - {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, - {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", GPIO_H, (1<<0), GPIO_OUT_LOW, NULL}, - {"I2C1_SCL", GPIO_B, (1<<6), GPIO_ODR_HIGH, NULL}, - {"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL}, - {"I2C2_SCL", GPIO_B, (1<<10), GPIO_ODR_HIGH, NULL}, - {"I2C2_SDA", GPIO_B, (1<<11), GPIO_ODR_HIGH, NULL}, - {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL}, - {"PMIC_PWRON", GPIO_A, (1<<12), GPIO_OUT_LOW, NULL}, - {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL}, - {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT11", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x0004, GPIO_ALT_TIM2, MODULE_POWER_LED}, - {GPIO_A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI}, - {GPIO_A, 0x0600, GPIO_ALT_USART, MODULE_UART}, - {GPIO_B, 0x0cc0, GPIO_ALT_I2C, MODULE_I2C}, -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* Battery temperature ranges in degrees C */ -static const struct battery_info info = { - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 100, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"master", I2C_PORT_MASTER, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -struct keyboard_scan_config keyscan_config = { - .output_settle_us = 40, - .debounce_down_us = 6 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 1500, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = SECOND, - .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, - 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ - }, -}; - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {STM32_TIM(2), STM32_TIM_CH(3), - PWM_CONFIG_ACTIVE_LOW, GPIO_LED_POWER_L}, -}; -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -int pmu_board_init(void) -{ - int ver, failure = 0; - - /* Set fast charging timeout to 6 hours*/ - if (!failure) - failure = pmu_set_fastcharge(TIMEOUT_6HRS); - /* Enable external gpio CHARGER_EN control */ - if (!failure) - failure = pmu_enable_ext_control(1); - /* Disable force charging */ - if (!failure) - failure = pmu_enable_charger(0); - - /* Set NOITERM bit */ - if (!failure) - failure = pmu_low_current_charging(1); - - /* - * High temperature charging - * termination voltage: 2.1V - * termination current: 100% - */ - if (!failure) - failure = pmu_set_term_voltage(RANGE_T34, TERM_V2100); - if (!failure) - failure = pmu_set_term_current(RANGE_T34, TERM_I1000); - /* - * Standard temperature charging - * termination voltage: 2.1V - * termination current: 100% - */ - if (!failure) - failure = pmu_set_term_voltage(RANGE_T23, TERM_V2100); - if (!failure) - failure = pmu_set_term_current(RANGE_T23, TERM_I1000); - - /* - * Ignore TPSCHROME NTC reading in T40. This is snow board specific - * setting. Check: - * http://crosbug.com/p/12221 - * http://crosbug.com/p/13171 - */ - if (!failure) - failure = pmu_set_term_voltage(RANGE_T40, TERM_V2100); - if (!failure) - failure = pmu_set_term_current(RANGE_T40, TERM_I1000); - - /* Workaround init values before ES3 */ - if (pmu_version(&ver) || ver < 3) { - /* Termination current: 75% */ - if (!failure) - failure = pmu_set_term_current(RANGE_T34, TERM_I0750); - if (!failure) - failure = pmu_set_term_current(RANGE_T23, TERM_I0750); - if (!failure) - failure = pmu_set_term_current(RANGE_T40, TERM_I0750); - } - - return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; -} diff --git a/board/pit/board.h b/board/pit/board.h deleted file mode 100644 index f4fc68b06d..0000000000 --- a/board/pit/board.h +++ /dev/null @@ -1,110 +0,0 @@ -/* 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. - */ - -/* Pit board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_BATTERY_BQ20Z453 -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER_TPS65090 -#define CONFIG_CHIPSET_GAIA -#define CONFIG_CMD_PMU -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_HOST_COMMAND_STATUS -#define CONFIG_I2C -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_MKBP -#define CONFIG_PMU_HARD_RESET -#define CONFIG_PMU_POWERINFO -#define CONFIG_PMU_TPS65090 -#define CONFIG_SPI -#define CONFIG_PWM - -#ifndef __ASSEMBLER__ - -/* Keyboard output port list */ -#define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C - -/* Single I2C port, where the EC is the master. */ -#define I2C_PORT_MASTER 0 -#define I2C_PORT_BATTERY I2C_PORT_MASTER -#define I2C_PORT_CHARGER I2C_PORT_MASTER - -/* Charger sense resistors */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 12 -#define CONFIG_CHARGER_SENSE_RESISTOR 16 - -/* Timer selection */ -#define TIM_CLOCK_MSB 3 -#define TIM_CLOCK_LSB 9 -#define TIM_POWER_LED 2 -#define TIM_WATCHDOG 4 - -/* GPIO signal list */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_KB_PWR_ON_L = 0, - GPIO_PP1800_LDO2, - GPIO_SOC1V8_XPSHOLD, - GPIO_CHARGER_INT_L, - GPIO_LID_OPEN, - GPIO_SUSPEND_L, - GPIO_SPI1_NSS, - GPIO_AC_PRESENT, - /* Keyboard inputs */ - GPIO_KB_IN00, - GPIO_KB_IN01, - GPIO_KB_IN02, - GPIO_KB_IN03, - GPIO_KB_IN04, - GPIO_KB_IN05, - GPIO_KB_IN06, - GPIO_KB_IN07, - /* Other inputs */ - GPIO_WP_L, - /* Outputs */ - GPIO_AP_RESET_L, - GPIO_CHARGER_EN, - GPIO_EC_INT, - GPIO_EN_PP1350, - GPIO_EN_PP3300, - GPIO_EN_PP5000, - GPIO_ENTERING_RW, - GPIO_I2C1_SCL, - GPIO_I2C1_SDA, - GPIO_I2C2_SCL, - GPIO_I2C2_SDA, - GPIO_LED_POWER_L, - GPIO_PMIC_PWRON, - GPIO_PMIC_RESET, - GPIO_KB_OUT00, - GPIO_KB_OUT01, - GPIO_KB_OUT02, - GPIO_KB_OUT03, - GPIO_KB_OUT04, - GPIO_KB_OUT05, - GPIO_KB_OUT06, - GPIO_KB_OUT07, - GPIO_KB_OUT08, - GPIO_KB_OUT09, - GPIO_KB_OUT10, - GPIO_KB_OUT11, - GPIO_KB_OUT12, - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -enum pwm_channel { - PWM_CH_POWER_LED = 0, - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/pit/build.mk b/board/pit/build.mk deleted file mode 100644 index c8feaecd01..0000000000 --- a/board/pit/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -# the IC is STmicro STM32L151RBH6 -CHIP:=stm32 -CHIP_FAMILY:=stm32l -CHIP_VARIANT:=stm32l15x - -board-y=board.o diff --git a/board/pit/ec.tasklist b/board/pit/ec.tasklist deleted file mode 100644 index 448879d105..0000000000 --- a/board/pit/ec.tasklist +++ /dev/null @@ -1,25 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK(n, r, d, s) where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(POWERLED, power_led_task, NULL, 256) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/samus/board.c b/board/samus/board.c deleted file mode 100644 index 3ae8e9d590..0000000000 --- a/board/samus/board.c +++ /dev/null @@ -1,318 +0,0 @@ -/* 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. - */ -/* EC for Samus board configuration */ - -#include "als.h" -#include "adc.h" -#include "adc_chip.h" -#include "backlight.h" -#include "common.h" -#include "driver/temp_sensor/tmp006.h" -#include "driver/als_isl29035.h" -#include "extpower.h" -#include "fan.h" -#include "gpio.h" -#include "host_command.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "peci.h" -#include "power.h" -#include "power_button.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "switch.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "timer.h" -#include "thermal.h" -#include "util.h" - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH, - power_button_interrupt}, - {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH, - lid_interrupt}, - {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH, - extpower_interrupt}, - {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1200_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1800_PGOOD", LM4_GPIO_L, (1<<7), GPIO_INT_BOTH, - power_signal_interrupt}, - {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH, - switch_interrupt}, - {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH, - switch_interrupt}, - {"PCH_BL_EN", LM4_GPIO_M, (1<<3), GPIO_INT_RISING, - backlight_interrupt}, - - /* Other inputs */ - {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL}, - {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL}, - {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL}, - {"ONEWIRE", LM4_GPIO_F, (1<<7), GPIO_INPUT, NULL}, - {"THERMAL_DATA_READY_L", LM4_GPIO_B, (1<<0), GPIO_INPUT, NULL}, - {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL}, - {"USB1_STATUS_L", LM4_GPIO_E, (1<<6), GPIO_INPUT, NULL}, - {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL}, - {"USB2_STATUS_L", LM4_GPIO_D, (1<<7), GPIO_INPUT, NULL}, - /* Not yet sure if this will need to be handled as an interrupt */ - {"CAPSENSE_INT_L", LM4_GPIO_N, (1<<0), GPIO_INPUT, NULL}, - - /* Outputs; all unasserted by default except for reset signals */ - {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL}, - {"PP1200_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP3300_DSW_EN", LM4_GPIO_F, (1<<6), GPIO_OUT_LOW, NULL}, - {"PP3300_DSW_GATED_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL}, - {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL}, - {"PP1050_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL}, - {"PP5000_USB_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL}, - {"PP1800_EN", LM4_GPIO_L, (1<<6), GPIO_OUT_LOW, NULL}, - {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL}, - {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL}, - - {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL}, - {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL}, - {"LIGHTBAR_RESET_L", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL}, - {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL}, - /* - * HDA_SDO is technically an output, but we need to leave it as an - * input until we drive it high. So can't use open-drain (HI_Z). - */ - {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL}, - {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL}, - {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_ODR_HIGH, NULL}, - {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL}, - {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, - {"PCH_RCIN_L", LM4_GPIO_F, (1<<3), GPIO_ODR_HIGH, NULL}, - {"PCH_SYS_RST_L", LM4_GPIO_F, (1<<1), GPIO_ODR_HIGH, NULL}, - {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL}, - {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL}, - {"PCH_ACOK", LM4_GPIO_M, (1<<6), GPIO_OUT_LOW, NULL}, -#ifndef HEY_USE_BUILTIN_CLKRUN - {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, -#endif - {"USB1_CTL1", LM4_GPIO_E, (1<<1), GPIO_OUT_LOW, NULL}, - {"USB1_CTL2", LM4_GPIO_E, (1<<2), GPIO_OUT_HIGH, NULL}, - {"USB1_CTL3", LM4_GPIO_E, (1<<3), GPIO_OUT_LOW, NULL}, - {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_HIGH, NULL}, - {"USB1_ILIM_SEL", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL}, - {"USB2_CTL1", LM4_GPIO_D, (1<<0), GPIO_OUT_LOW, NULL}, - {"USB2_CTL2", LM4_GPIO_D, (1<<1), GPIO_OUT_HIGH, NULL}, - {"USB2_CTL3", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_HIGH, NULL}, - {"USB2_ILIM_SEL", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */ - {GPIO_A, 0x40, 3, MODULE_I2C}, /* I2C1 SCL */ - {GPIO_A, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C1 SDA */ - {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */ - {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */ - {GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_G, 0x30, 1, MODULE_UART}, /* UART2 */ - {GPIO_J, 0x40, 1, MODULE_PECI}, /* PECI Tx */ - {GPIO_J, 0x80, 0, MODULE_PECI, GPIO_ANALOG}, /* PECI Rx */ - {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0x33, 15, MODULE_LPC}, /* LPC */ -#ifdef HEY_USE_BUILTIN_CLKRUN - {GPIO_M, 0x04, 15, MODULE_LPC, GPIO_OPEN_DRAIN},/* LPC */ -#endif - {GPIO_N, 0x3c, 1, MODULE_PWM_FAN}, /* FAN0PWM 2&3 */ - {GPIO_N, 0x40, 1, MODULE_PWM_KBLIGHT}, /* FAN0PWM4 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_PP1050_PGOOD, 1, "PGOOD_PP1050"}, - {GPIO_PP1200_PGOOD, 1, "PGOOD_PP1200"}, - {GPIO_PP1800_PGOOD, 1, "PGOOD_PP1800"}, - {GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"}, - {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"}, - {GPIO_PCH_SLP_S5_L, 1, "SLP_S5_DEASSERTED"}, - {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"}, - {GPIO_PCH_SUSWARN_L, 1, "SUSWARN_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -/* ADC channels. Must be in the exactly same order as in enum adc_channel. */ -const struct adc_t adc_channels[] = { - /* EC internal temperature is calculated by - * 273 + (295 - 450 * ADC_VALUE / ADC_READ_MAX) / 2 - * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 - */ - {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - - /* We're measuring the adapter input current through a 0.01-ohm - * resistor (ACP/ACN). IOUT is 40X the differential voltage, so - * 1000mA => 400mV. ADC returns 0x000-0xFFF over 0.0-3.3V. - * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3.3(V) * 100(R) / 40(gain) - */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 4, 0, - LM4_AIN(11), 0x06 /* IE0 | END0 */, LM4_GPIO_B, (1<<5)}, - - /* - * TODO(crosbug.com/p/23827): We don't know what to expect here, but - * it's an analog input that's pulled high. We're using it as a battery - * presence indicator for now. We'll return just 0 - ADC_READ_MAX for - * now. - */ - {"BatteryTemp", LM4_ADC_SEQ2, 1, 1, 0, - LM4_AIN(10), 0x06 /* IE0 | END0 */, LM4_GPIO_B, (1<<4)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {4, 0}, -}; -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -/* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_max = 6500, - .ch = 2, - .pgood_gpio = -1, - .enable_gpio = -1, - }, - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_max = 6500, - .ch = 3, - .pgood_gpio = -1, - .enable_gpio = -1, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", 0, 100}, - {"lightbar", 1, 400}, - {"thermal", 5, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -#define TEMP_U40_REG_ADDR ((0x40 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_U41_REG_ADDR ((0x44 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_U42_REG_ADDR ((0x41 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_U43_REG_ADDR ((0x45 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_U115_REG_ADDR ((0x42 << 1) | I2C_FLAG_BIG_ENDIAN) -#define TEMP_U116_REG_ADDR ((0x43 << 1) | I2C_FLAG_BIG_ENDIAN) - -#define TEMP_U40_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U40_REG_ADDR) -#define TEMP_U41_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U41_REG_ADDR) -#define TEMP_U42_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U42_REG_ADDR) -#define TEMP_U43_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U43_REG_ADDR) -#define TEMP_U115_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U115_REG_ADDR) -#define TEMP_U116_ADDR TMP006_ADDR(I2C_PORT_THERMAL, TEMP_U116_REG_ADDR) - -const struct tmp006_t tmp006_sensors[TMP006_COUNT] = { - {"Charger", TEMP_U40_ADDR}, - {"CPU", TEMP_U41_ADDR}, - {"Left C", TEMP_U42_ADDR}, - {"Right C", TEMP_U43_ADDR}, - {"Right D", TEMP_U115_ADDR}, - {"Left D", TEMP_U116_ADDR}, -}; - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[] = { - {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, - {"I2C-Charger-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 0, 7}, - {"I2C-Charger-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 1, 7}, - {"I2C-CPU-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 2, 7}, - {"I2C-CPU-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 3, 7}, - {"I2C-Left C-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 4, 7}, - {"I2C-Left C-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 5, 7}, - {"I2C-Right C-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 6, 7}, - {"I2C-Right C-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 7, 7}, - {"I2C-Right D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 8, 7}, - {"I2C-Right D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 9, 7}, - {"I2C-Left D-Die", TEMP_SENSOR_TYPE_BOARD, tmp006_get_val, 10, 7}, - {"I2C-Left D-Object", TEMP_SENSOR_TYPE_CASE, tmp006_get_val, 11, 7}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* ALS instances. Must be in same order as enum als_id. */ -struct als_t als[] = { - {"ISL", isl29035_read_lux}, -}; -BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT); - - -/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in - * same order as enum temp_sensor_id. To always ignore any temp, use 0. - */ -struct ec_thermal_config thermal_params[] = { - /* Only the AP affects the thermal limits and fan speed. */ - {{C_TO_K(95), C_TO_K(97), C_TO_K(99)}, C_TO_K(55), C_TO_K(85)}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -struct keyboard_scan_config keyscan_config = { - .output_settle_us = 40, - .debounce_down_us = 6 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 1500, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = SECOND, - .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, - 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ - }, -}; - -/** - * Physical detection of battery connection. - */ -int battery_is_connected(void) -{ - return adc_read_channel(ADC_CH_BAT_TEMP) < (9 * ADC_READ_MAX / 10); -} diff --git a/board/samus/board.h b/board/samus/board.h deleted file mode 100644 index fac709c313..0000000000 --- a/board/samus/board.h +++ /dev/null @@ -1,242 +0,0 @@ -/* 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. - */ - -/* Configuration for Samus mainboard */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Debug features */ -#define CONFIG_CONSOLE_CMDHELP -#define CONFIG_TASK_PROFILING - -#undef HEY_USE_BUILTIN_CLKRUN - -/* Optional features */ -#define CONFIG_ALS -#define CONFIG_ALS_ISL29035 -#define CONFIG_BOARD_VERSION -#define CONFIG_CHIPSET_X86 -#define CONFIG_CHIPSET_CAN_THROTTLE -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_LED_DRIVER_DS2413 -#define CONFIG_ONEWIRE -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 - -#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BL_EN -#define CONFIG_BATTERY_CHECK_CONNECTED -#define CONFIG_BATTERY_LINK -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24715 -/* 10mOhm sense resitors. */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 -#define CONFIG_CHARGER_INPUT_CURRENT 2000 -#define CONFIG_FANS 2 -#define CONFIG_PECI_TJMAX 100 -#define CONFIG_PWM -#define CONFIG_PWM_KBLIGHT -#define CONFIG_SWITCH_DEDICATED_RECOVERY -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_TMP006 -#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_PP3300_DSW_GATED_EN -#define CONFIG_UART_HOST 2 -#define CONFIG_WIRELESS -#define CONFIG_USB_PORT_POWER_SMART - -#ifndef __ASSEMBLER__ - -/* I2C ports */ -#define I2C_PORT_BACKLIGHT 0 -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#define I2C_PORT_ALS 1 -#define I2C_PORT_CAPSENSE 1 -#define I2C_PORT_LIGHTBAR 1 -#define I2C_PORT_THERMAL 5 - -/* Backlight I2C device address */ -#define I2C_ADDR_BACKLIGHT ((0x2C << 1) | I2C_FLAG_BIG_ENDIAN) - -/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */ -#define KB_SCAN_ROW_IRQ LM4_IRQ_GPIOK -#define KB_SCAN_ROW_GPIO LM4_GPIO_K - -/* Host connects to keyboard controller module via LPC */ -#define HOST_KB_BUS_LPC - -/* USB ports */ -#define USB_PORT_COUNT 2 - -/* GPIO signal definitions. */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, /* Power button */ - GPIO_LID_OPEN, /* Lid switch */ - GPIO_AC_PRESENT, /* AC power present */ - GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */ - GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */ - GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */ - GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */ - GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */ - GPIO_PP1050_PGOOD, /* Power good on 1.05V */ - GPIO_PP1200_PGOOD, /* Power good on 1.2V (DRAM) */ - GPIO_PP1800_PGOOD, /* Power good on 1.8V (DRAM) */ - GPIO_VCORE_PGOOD, /* Power good on core VR */ - GPIO_RECOVERY_L, /* Recovery signal from servo */ - GPIO_WP_L, /* Write protect input */ - GPIO_PCH_BL_EN, /* PCH backlight input */ - - /* Other inputs */ - GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */ - GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ - GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ - GPIO_CPU_PGOOD, /* Power good to the CPU */ - GPIO_ONEWIRE, /* One-wire bus to adapter LED */ - GPIO_THERMAL_DATA_READY_L, /* From thermal sensor */ - GPIO_USB1_OC_L, /* USB port overcurrent warning */ - GPIO_USB1_STATUS_L, /* USB charger port 1 status output */ - GPIO_USB2_OC_L, /* USB port overcurrent warning */ - GPIO_USB2_STATUS_L, /* USB charger port 2 status output */ - GPIO_CAPSENSE_INT_L, /* Capsense interrupt (through EC_WAKE_L) */ - - /* Outputs */ - GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ - GPIO_PP1200_EN, /* Enable 1.20V supply */ - GPIO_PP3300_DSW_EN, /* Enable 3.3V DSW rail */ - GPIO_PP3300_DSW_GATED_EN, /* Enable 3.3V Gated DSW and core VDD */ - GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ - GPIO_PP1050_EN, /* Enable 1.05V regulator */ - GPIO_PP5000_USB_EN, /* Enable USB power */ - GPIO_PP5000_EN, /* Enable 5V supply */ - GPIO_PP1800_EN, /* Enable 1.8V supply */ - GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi radio */ - - GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ - GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ - GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ - GPIO_LIGHTBAR_RESET_L, /* Reset lightbar controllers */ - GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */ - - GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME - * ignores security descriptor */ - GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */ - GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */ - GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ - GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */ - GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */ - GPIO_PCH_SYS_RST_L, /* Reset PCH resume power plane logic */ - GPIO_PCH_SMI_L, /* System management interrupt to PCH */ - GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ - GPIO_PCH_ACOK, /* AC present signal buffered to PCH */ -#ifndef HEY_USE_BUILTIN_CLKRUN - GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */ -#endif - GPIO_USB1_CTL1, /* USB charger port 1 CTL1 output */ - GPIO_USB1_CTL2, /* USB charger port 1 CTL2 output */ - GPIO_USB1_CTL3, /* USB charger port 1 CTL3 output */ - GPIO_USB1_ENABLE, /* USB charger port 1 enable */ - GPIO_USB1_ILIM_SEL, /* USB charger port 1 ILIM_SEL output */ - GPIO_USB2_CTL1, /* USB charger port 2 CTL1 output */ - GPIO_USB2_CTL2, /* USB charger port 2 CTL2 output */ - GPIO_USB2_CTL3, /* USB charger port 2 CTL3 output */ - GPIO_USB2_ENABLE, /* USB charger port 2 enable */ - GPIO_USB2_ILIM_SEL, /* USB charger port 2 ILIM_SEL output */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -/* x86 signal definitions */ -enum x86_signal { - X86_PGOOD_PP1050 = 0, - X86_PGOOD_PP1200, - X86_PGOOD_PP1800, - X86_PGOOD_VCORE, - - X86_SLP_S0_DEASSERTED, - X86_SLP_S3_DEASSERTED, - X86_SLP_S5_DEASSERTED, - X86_SLP_SUS_DEASSERTED, - X86_SUSWARN_DEASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -enum adc_channel { - /* EC internal die temperature in degrees K. */ - ADC_CH_EC_TEMP = 0, - /* Charger current in mA. */ - ADC_CH_CHARGER_CURRENT, - /* BAT_TEMP */ - ADC_CH_BAT_TEMP, - - ADC_CH_COUNT -}; - -enum pwm_channel { - PWM_CH_KBLIGHT, - - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -enum temp_sensor_id { - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI, - /* EC internal temperature sensor */ - TEMP_SENSOR_EC_INTERNAL, - /* TMP006 U40, die/object temperature near battery charger */ - TEMP_SENSOR_I2C_U40_DIE, - TEMP_SENSOR_I2C_U40_OBJECT, - /* TMP006 U41, die/object temperature near CPU */ - TEMP_SENSOR_I2C_U41_DIE, - TEMP_SENSOR_I2C_U41_OBJECT, - /* TMP006 U42, die/object temperature left side of C-case */ - TEMP_SENSOR_I2C_U42_DIE, - TEMP_SENSOR_I2C_U42_OBJECT, - /* TMP006 U43, die/object temperature right side of C-case */ - TEMP_SENSOR_I2C_U43_DIE, - TEMP_SENSOR_I2C_U43_OBJECT, - /* TMP006 U115, die/object temperature right side of D-case */ - TEMP_SENSOR_I2C_U115_DIE, - TEMP_SENSOR_I2C_U115_OBJECT, - /* TMP006 U116, die/object temperature left side of D-case */ - TEMP_SENSOR_I2C_U116_DIE, - TEMP_SENSOR_I2C_U116_OBJECT, - - TEMP_SENSOR_COUNT -}; - -/* The number of TMP006 sensor chips on the board. */ -#define TMP006_COUNT 6 - -/* Light sensors attached to the EC. */ -enum als_id { - ALS_ISL29035 = 0, - - ALS_COUNT, -}; - -/* Known board versions for system_get_board_version(). */ -enum board_version { - BOARD_VERSION_PROTO1 = 0, - BOARD_VERSION_EVT = 1, -}; - -/* Wireless signals */ -#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L -#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN -#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/samus/build.mk b/board/samus/build.mk deleted file mode 100644 index 153a280b76..0000000000 --- a/board/samus/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build -# - -# the IC is TI Stellaris LM4 -CHIP:=lm4 - -board-y=board.o power_sequence.o panel.o extpower.o diff --git a/board/samus/ec.tasklist b/board/samus/ec.tasklist deleted file mode 100644 index 3f3d9b5015..0000000000 --- a/board/samus/ec.tasklist +++ /dev/null @@ -1,29 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' is the name of the task - * 'r' is the main routine of the task - * 'd' is an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(LIGHTBAR, lightbar_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/samus/extpower.c b/board/samus/extpower.c deleted file mode 100644 index 4da7e655a7..0000000000 --- a/board/samus/extpower.c +++ /dev/null @@ -1,72 +0,0 @@ -/* 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. - */ - -/* - * Pure GPIO-based external power detection, buffered to PCH. - * Drive high in S5-S0 when AC_PRESENT is high, otherwise drive low. - */ - -#include "chipset.h" -#include "common.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" - -int extpower_is_present(void) -{ - return gpio_get_level(GPIO_AC_PRESENT); -} - -/** - * Deferred function to handle external power change - */ -static void extpower_deferred(void) -{ - hook_notify(HOOK_AC_CHANGE); - - /* Forward notification to host */ - if (extpower_is_present()) - host_set_single_event(EC_HOST_EVENT_AC_CONNECTED); - else - host_set_single_event(EC_HOST_EVENT_AC_DISCONNECTED); -} -DECLARE_DEFERRED(extpower_deferred); - -static void extpower_buffer_to_pch(void) -{ - if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) { - /* Drive low in G3 state */ - gpio_set_level(GPIO_PCH_ACOK, 0); - } else { - /* Buffer from extpower in S5+ (where 3.3DSW enabled) */ - gpio_set_level(GPIO_PCH_ACOK, extpower_is_present()); - } -} -DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, extpower_buffer_to_pch, HOOK_PRIO_DEFAULT); - -static void extpower_shutdown(void) -{ - /* Drive ACOK buffer to PCH low when shutting down */ - gpio_set_level(GPIO_PCH_ACOK, 0); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, extpower_shutdown, HOOK_PRIO_DEFAULT); - -void extpower_interrupt(enum gpio_signal signal) -{ - extpower_buffer_to_pch(); - - /* Trigger deferred notification of external power change */ - hook_call_deferred(extpower_deferred, 0); -} - -static void extpower_init(void) -{ - extpower_buffer_to_pch(); - - /* Enable interrupts, now that we've initialized */ - gpio_enable_interrupt(GPIO_AC_PRESENT); -} -DECLARE_HOOK(HOOK_INIT, extpower_init, HOOK_PRIO_DEFAULT); diff --git a/board/samus/panel.c b/board/samus/panel.c deleted file mode 100644 index c9c9c3f6cb..0000000000 --- a/board/samus/panel.c +++ /dev/null @@ -1,95 +0,0 @@ -/* 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. - */ - -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "i2c.h" -#include "lid_switch.h" - -#define LP8555_REG_COMMAND 0x00 -#define LP8555_REG_COMMAND_ON 0x01 -#define LP8555_REG_CONFIG 0x10 -#define LP8555_REG_CONFIG_MODE_MASK 0x03 -#define LP8555_REG_CONFIG_MODE_PWM 0x00 - -/** - * Enable PWM mode in backlight controller and turn it on. - */ -static void lp8555_enable_pwm_mode(void) -{ - int reg; - - /* Enable PWM mode. */ - i2c_read8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT, - LP8555_REG_CONFIG, ®); - reg &= ~LP8555_REG_CONFIG_MODE_MASK; - reg |= LP8555_REG_CONFIG_MODE_PWM; - i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT, - LP8555_REG_CONFIG, reg); - - /* Power on. */ - i2c_read8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT, - LP8555_REG_COMMAND, ®); - reg |= LP8555_REG_COMMAND_ON; - i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT, - LP8555_REG_COMMAND, reg); -} -DECLARE_DEFERRED(lp8555_enable_pwm_mode); - -/** - * Host command to toggle backlight. - */ -static int switch_command_enable_backlight(struct host_cmd_handler_args *args) -{ - const struct ec_params_switch_enable_backlight *p = args->params; - - gpio_set_level(GPIO_ENABLE_BACKLIGHT, p->enabled); - - if (p->enabled) - lp8555_enable_pwm_mode(); - - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_SWITCH_ENABLE_BKLIGHT, - switch_command_enable_backlight, - EC_VER_MASK(0)); - -void backlight_interrupt(enum gpio_signal signal) -{ - /* - * PCH indicates it is turning on backlight so we should - * attempt to put the backlight controller into PWM mode. - */ - hook_call_deferred(lp8555_enable_pwm_mode, 0); -} - -/** - * Update backlight state. - */ -static void update_backlight(void) -{ - /* - * Enable backlight if lid is open; this is AND'd with the request from - * the AP in hardware. - */ - gpio_set_level(GPIO_ENABLE_BACKLIGHT, lid_is_open()); - if (lid_is_open()) - hook_call_deferred(lp8555_enable_pwm_mode, 0); -} -DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT); - -/** - * Initialize backlight module. - */ -static void backlight_init(void) -{ - gpio_enable_interrupt(GPIO_PCH_BL_EN); - gpio_set_level(GPIO_ENABLE_BACKLIGHT, lid_is_open()); -} -DECLARE_HOOK(HOOK_INIT, backlight_init, HOOK_PRIO_DEFAULT); diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c deleted file mode 100644 index 74efef873e..0000000000 --- a/board/samus/power_sequence.c +++ /dev/null @@ -1,406 +0,0 @@ -/* 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. - */ - -/* X86 chipset power control module for Chrome EC */ - -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "lid_switch.h" -#include "power.h" -#include "registers.h" -#include "system.h" -#include "task.h" -#include "timer.h" -#include "util.h" -#include "wireless.h" - -/* Console output macros */ -#define CPUTS(outstr) cputs(CC_CHIPSET, outstr) -#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args) - -/* Input state flags */ -#define IN_PGOOD_PP1050 POWER_SIGNAL_MASK(X86_PGOOD_PP1050) -#define IN_PGOOD_PP1200 POWER_SIGNAL_MASK(X86_PGOOD_PP1200) -#define IN_PGOOD_PP1800 POWER_SIGNAL_MASK(X86_PGOOD_PP1800) -#define IN_PGOOD_VCORE POWER_SIGNAL_MASK(X86_PGOOD_VCORE) - -#define IN_PCH_SLP_S0_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_S0_DEASSERTED) -#define IN_PCH_SLP_S3_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_S3_DEASSERTED) -#define IN_PCH_SLP_S5_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_S5_DEASSERTED) -#define IN_PCH_SLP_SUS_DEASSERTED POWER_SIGNAL_MASK(X86_SLP_SUS_DEASSERTED) - - -/* All non-core power rails */ -#define IN_PGOOD_ALL_NONCORE (IN_PGOOD_PP1050) -/* All core power rails */ -#define IN_PGOOD_ALL_CORE (IN_PGOOD_VCORE) -/* Rails required for S3 */ -#define IN_PGOOD_S3 (IN_PGOOD_PP1200 | IN_PGOOD_PP1800) -/* Rails required for S0 */ -#define IN_PGOOD_S0 (IN_PGOOD_ALL_NONCORE) -/* Rails used to detect if PP5000 is up. 1.8V PGOOD is not - * a reliable signal to use here with an internal pullup. */ -#define IN_PGOOD_PP5000 (IN_PGOOD_PP1050 | IN_PGOOD_PP1200) - - -/* All PM_SLP signals from PCH deasserted */ -#define IN_ALL_PM_SLP_DEASSERTED (IN_PCH_SLP_S3_DEASSERTED | \ - IN_PCH_SLP_S5_DEASSERTED | \ - IN_PCH_SLP_SUS_DEASSERTED) - -/* All inputs in the right state for S0 */ -#define IN_ALL_S0 (IN_PGOOD_ALL_NONCORE | IN_PGOOD_ALL_CORE | \ - IN_ALL_PM_SLP_DEASSERTED) - -static int throttle_cpu; /* Throttle CPU? */ -static int pause_in_s5; /* Pause in S5 when shutting down? */ - -void chipset_force_shutdown(void) -{ - CPRINTF("[%T %s()]\n", __func__); - - /* - * Force off. This condition will reset once the state machine - * transitions to G3. - */ - gpio_set_level(GPIO_PCH_DPWROK, 0); -} - -void chipset_reset(int cold_reset) -{ - CPRINTF("[%T %s(%d)]\n", __func__, cold_reset); - if (cold_reset) { - /* - * Drop and restore PWROK. This causes the PCH to reboot, - * regardless of its after-G3 setting. This type of reboot - * causes the PCH to assert PLTRST#, SLP_S3#, and SLP_S5#, so - * we actually drop power to the rest of the system (hence, a - * "cold" reboot). - */ - - /* Ignore if PWROK is already low */ - if (gpio_get_level(GPIO_PCH_PWROK) == 0) - return; - - /* PWROK must deassert for at least 3 RTC clocks = 91 us */ - gpio_set_level(GPIO_PCH_PWROK, 0); - udelay(100); - gpio_set_level(GPIO_PCH_PWROK, 1); - - } else { - /* - * Send a RCIN# pulse to the PCH. This just causes it to - * assert INIT# to the CPU without dropping power or asserting - * PLTRST# to reset the rest of the system. - */ - - /* - * Pulse must be at least 16 PCI clocks long = 500 ns. - */ - gpio_set_level(GPIO_PCH_RCIN_L, 0); - udelay(10); - gpio_set_level(GPIO_PCH_RCIN_L, 1); - } -} - -void chipset_throttle_cpu(int throttle) -{ - if (chipset_in_state(CHIPSET_STATE_ON)) - gpio_set_level(GPIO_CPU_PROCHOT, throttle); -} - -enum power_state power_chipset_init(void) -{ - /* - * If we're switching between images without rebooting, see if the x86 - * is already powered on; if so, leave it there instead of cycling - * through G3. - */ - if (system_jumped_to_this_image()) { - if ((power_get_signals() & IN_ALL_S0) == IN_ALL_S0) { - CPRINTF("[%T already in S0]\n"); - return POWER_S0; - } else { - /* Force all signals to their G3 states */ - CPRINTF("[%T forcing G3]\n"); - gpio_set_level(GPIO_PCH_PWROK, 0); - gpio_set_level(GPIO_SYS_PWROK, 0); - gpio_set_level(GPIO_PP1050_EN, 0); - gpio_set_level(GPIO_PP1200_EN, 0); - gpio_set_level(GPIO_PP1800_EN, 0); - gpio_set_level(GPIO_PP3300_DSW_GATED_EN, 0); - gpio_set_level(GPIO_PP5000_USB_EN, 0); - gpio_set_level(GPIO_PP5000_EN, 0); - gpio_set_level(GPIO_PCH_DPWROK, 0); - gpio_set_level(GPIO_PP3300_DSW_EN, 0); - wireless_enable(0); - } - } - - return POWER_G3; -} - -enum power_state power_handle_state(enum power_state state) -{ - switch (state) { - case POWER_G3: - break; - - case POWER_S5: - if (gpio_get_level(GPIO_PCH_SLP_S5_L) == 1) - return POWER_S5S3; /* Power up to next state */ - - break; - - case POWER_S3: - /* - * If lid is closed; hold touchscreen in reset to cut - * power usage. If lid is open, take touchscreen out - * of reset so it can wake the processor. - */ - gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, lid_is_open()); - - /* Check for state transitions */ - if (!power_has_signals(IN_PGOOD_S3)) { - /* Required rail went away */ - chipset_force_shutdown(); - return POWER_S3S5; - } else if (gpio_get_level(GPIO_PCH_SLP_S3_L) == 1) { - /* Power up to next state */ - return POWER_S3S0; - } else if (gpio_get_level(GPIO_PCH_SLP_S5_L) == 0) { - /* Power down to next state */ - return POWER_S3S5; - } - break; - - case POWER_S0: - if (!power_has_signals(IN_PGOOD_S0)) { - /* Required rail went away */ - chipset_force_shutdown(); - return POWER_S0S3; - } else if (gpio_get_level(GPIO_PCH_SLP_S3_L) == 0) { - /* Power down to next state */ - return POWER_S0S3; - } - break; - - case POWER_G3S5: - /* Enable 3.3V DSW */ - gpio_set_level(GPIO_PP3300_DSW_EN, 1); - - /* - * Wait 10ms after +3VALW good, since that powers VccDSW and - * VccSUS. - */ - msleep(10); - - /* Enable PP5000 (5V) rail as 1.05V and 1.2V rails need 5V - * rail to regulate properly. */ - gpio_set_level(GPIO_PP5000_EN, 1); - - /* Wait for PP1050/PP1200 PGOOD to go LOW to - * indicate that PP5000 is stable */ - while ((power_get_signals() & IN_PGOOD_PP5000) != 0) { - if (task_wait_event(SECOND) == TASK_EVENT_TIMER) { - CPRINTF("[%T timeout waiting for PP5000\n"); - chipset_force_shutdown(); - return POWER_G3; - } - } - - /* Turn on 3.3V DSW gated rail for core regulator */ - gpio_set_level(GPIO_PP3300_DSW_GATED_EN, 1); - - /* Assert DPWROK */ - gpio_set_level(GPIO_PCH_DPWROK, 1); - - /* Enable PP1050 rail. */ - gpio_set_level(GPIO_PP1050_EN, 1); - - /* Wait for 1.05V to come up and CPU to notice */ - if (power_wait_signals(IN_PGOOD_PP1050 | - IN_PCH_SLP_SUS_DEASSERTED)) { - chipset_force_shutdown(); - return POWER_G3; - } - - /* Wait 5ms for SUSCLK to stabilize */ - msleep(5); - - /* Call hook to indicate out of G3 state */ - hook_notify(HOOK_CHIPSET_PRE_INIT); - return POWER_S5; - - case POWER_S5S3: - /* Turn on power to RAM */ - gpio_set_level(GPIO_PP1800_EN, 1); - gpio_set_level(GPIO_PP1200_EN, 1); - if (power_wait_signals(IN_PGOOD_S3)) { - chipset_force_shutdown(); - return POWER_S5; - } - - /* - * Take lightbar out of reset, now that +5VALW is - * available and we won't leak +3VALW through the reset - * line. - */ - gpio_set_level(GPIO_LIGHTBAR_RESET_L, 1); - - /* - * Enable touchpad power so it can wake the system from - * suspend. - */ - gpio_set_level(GPIO_ENABLE_TOUCHPAD, 1); - - /* Turn on USB power rail. */ - gpio_set_level(GPIO_PP5000_USB_EN, 1); - - /* Call hooks now that rails are up */ - hook_notify(HOOK_CHIPSET_STARTUP); - return POWER_S3; - - case POWER_S3S0: - /* Wait 20ms before allowing VCCST_PGOOD to rise. */ - msleep(20); - - /* Enable wireless. */ - wireless_enable(EC_WIRELESS_SWITCH_ALL); - - /* - * Make sure touchscreen is out if reset (even if the - * lid is still closed); it may have been turned off if - * the lid was closed in S3. - */ - gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, 1); - - /* Wait for non-core power rails good */ - if (power_wait_signals(IN_PGOOD_S0)) { - chipset_force_shutdown(); - wireless_enable(0); - return POWER_S3; - } - - /* Call hooks now that rails are up */ - hook_notify(HOOK_CHIPSET_RESUME); - - /* Wait 99ms after all voltages good */ - msleep(99); - - /* - * Throttle CPU if necessary. This should only be asserted - * when +VCCP is powered (it is by now). - */ - gpio_set_level(GPIO_CPU_PROCHOT, throttle_cpu); - - /* Set PCH_PWROK */ - gpio_set_level(GPIO_PCH_PWROK, 1); - gpio_set_level(GPIO_SYS_PWROK, 1); - return POWER_S0; - - case POWER_S0S3: - /* Call hooks before we remove power rails */ - hook_notify(HOOK_CHIPSET_SUSPEND); - - /* Clear PCH_PWROK */ - gpio_set_level(GPIO_SYS_PWROK, 0); - gpio_set_level(GPIO_PCH_PWROK, 0); - - /* Wait 40ns */ - udelay(1); - - /* Disable WWAN, but leave WiFi on */ - wireless_enable(EC_WIRELESS_SWITCH_WLAN | - EC_WIRELESS_SWITCH_WLAN_POWER); - - /* - * Deassert prochot since CPU is off and we're about to drop - * +VCCP. - */ - gpio_set_level(GPIO_CPU_PROCHOT, 0); - - return POWER_S3; - - case POWER_S3S5: - /* Call hooks before we remove power rails */ - hook_notify(HOOK_CHIPSET_SHUTDOWN); - - /* Disable wireless */ - wireless_enable(0); - - /* Disable peripheral power */ - gpio_set_level(GPIO_ENABLE_TOUCHPAD, 0); - gpio_set_level(GPIO_PP5000_USB_EN, 0); - - /* Turn off power to RAM */ - gpio_set_level(GPIO_PP1800_EN, 0); - gpio_set_level(GPIO_PP1200_EN, 0); - - /* - * Put touchscreen and lightbar in reset, so we won't - * leak +3VALW through the reset line to chips powered - * by +5VALW. - * - * (Note that we're no longer powering down +5VALW due - * to crosbug.com/p/16600, but to minimize side effects - * of that change we'll still reset these components in - * S5.) - */ - gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, 0); - gpio_set_level(GPIO_LIGHTBAR_RESET_L, 0); - - return pause_in_s5 ? POWER_S5 : POWER_S5G3; - - case POWER_S5G3: - /* Deassert DPWROK */ - gpio_set_level(GPIO_PCH_DPWROK, 0); - - /* Turn off power rails enabled in S5 */ - gpio_set_level(GPIO_PP1050_EN, 0); - gpio_set_level(GPIO_PP3300_DSW_GATED_EN, 0); - gpio_set_level(GPIO_PP5000_EN, 0); - /* Disable 3.3V DSW */ - gpio_set_level(GPIO_PP3300_DSW_EN, 0); - return POWER_G3; - } - - return state; -} - -static int host_command_gsv(struct host_cmd_handler_args *args) -{ - const struct ec_params_get_set_value *p = args->params; - struct ec_response_get_set_value *r = args->response; - - if (p->flags & EC_GSV_SET) - pause_in_s5 = p->value; - - r->value = pause_in_s5; - - args->response_size = sizeof(*r); - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_GSV_PAUSE_IN_S5, - host_command_gsv, - EC_VER_MASK(0)); - -static int console_command_gsv(int argc, char **argv) -{ - if (argc > 1 && !parse_bool(argv[1], &pause_in_s5)) - return EC_ERROR_INVAL; - - ccprintf("pause_in_s5 = %s\n", pause_in_s5 ? "on" : "off"); - - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(pause_in_s5, console_command_gsv, - "[on|off]", - "Should the AP pause in S5 during shutdown?", - NULL); diff --git a/board/snow/board.c b/board/snow/board.c deleted file mode 100644 index bf89ebc467..0000000000 --- a/board/snow/board.c +++ /dev/null @@ -1,279 +0,0 @@ -/* 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. - */ -/* Snow board-specific configuration */ - -#include "battery.h" -#include "board_config.h" -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "i2c.h" -#include "keyboard_raw.h" -#include "lid_switch.h" -#include "pmu_tpschrome.h" -#include "power.h" -#include "power_led.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "spi.h" -#include "task.h" -#include "timer.h" -#include "util.h" - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) -#define GPIO_KB_OUTPUT GPIO_ODR_HIGH - -#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH) -#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"CHARGER_INT_L", GPIO_C, (1<<4), GPIO_INT_FALLING, pmu_irq_handler}, - {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt}, - {"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING, - power_signal_interrupt}, - {"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL}, - {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - /* Other inputs */ - {"AC_PWRBTN_L", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL}, - {"SPI1_NSS", GPIO_A, (1<<4), GPIO_DEFAULT, spi_event}, - /* - * I2C pins should be configured as inputs until I2C module is - * initialized. This will avoid driving the lines unintentionally. - */ - {"I2C1_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL}, - {"I2C1_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL}, - {"I2C2_SCL", GPIO_B, (1<<10), GPIO_INPUT, NULL}, - {"I2C2_SDA", GPIO_B, (1<<11), GPIO_INPUT, NULL}, - /* Outputs */ - {"AC_STATUS", GPIO_A, (1<<5), GPIO_DEFAULT, NULL}, - {"SPI1_MISO", GPIO_A, (1<<6), GPIO_DEFAULT, NULL}, - {"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL}, - {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, - {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, - {"PMIC_PWRON_L",GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL}, - {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", GPIO_D, (1<<0), GPIO_OUT_LOW, NULL}, - {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL}, - {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL}, - {"CODEC_INT", GPIO_D, (1<<1), GPIO_ODR_HIGH, NULL}, - {"LED_POWER_L", GPIO_B, (1<<3), GPIO_INPUT, NULL}, - {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT11", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - /* - * TODO(crosbug.com/p/21618): use this instead of hard-coded register - * writes in board_config_pre_init(). - */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* Battery temperature ranges in degrees C */ -static const struct battery_info info = { - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 100, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"master", I2C_PORT_MASTER, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {STM32_TIM(2), STM32_TIM_CH(2), - PWM_CONFIG_ACTIVE_LOW, GPIO_LED_POWER_L}, -}; -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -void board_config_pre_init(void) -{ - uint32_t val; - - /* Enable all GPIOs clocks */ - STM32_RCC_APB2ENR |= 0x1fd; - - /* remap OSC_IN/OSC_OUT to PD0/PD1 */ - STM32_GPIO_AFIO_MAPR |= 1 << 15; - - /* use PB3 as a GPIO, so disable JTAG and keep only SWD */ - STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x7 << 24)) - | (2 << 24); - - /* remap TIM2_CH2 to PB3 */ - STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x3 << 8)) - | (1 << 8); - - /* - * Set alternate function for USART1. For alt. function input - * the port is configured in either floating or pull-up/down - * input mode (ref. section 7.1.4 in datasheet RM0041): - * PA9: Tx, alt. function output - * PA10: Rx, input with pull-down - * - * note: see crosbug.com/p/12223 for more info - */ - val = STM32_GPIO_CRH(GPIO_A) & ~0x00000ff0; - val |= 0x00000890; - STM32_GPIO_CRH(GPIO_A) = val; - - /* EC_INT is output, open-drain */ - val = STM32_GPIO_CRH(GPIO_B) & ~0xf0; - val |= 0x50; - STM32_GPIO_CRH(GPIO_B) = val; - /* put GPIO in Hi-Z state */ - gpio_set_level(GPIO_EC_INT, 1); -} - -/* GPIO configuration to be done after I2C module init */ -void board_i2c_post_init(int port) -{ - uint32_t val; - - /* enable alt. function (open-drain) */ - if (port == STM32_I2C1_PORT) { - /* I2C1 is on PB6-7 */ - val = STM32_GPIO_CRL(GPIO_B) & ~0xff000000; - val |= 0xdd000000; - STM32_GPIO_CRL(GPIO_B) = val; - } else if (port == STM32_I2C2_PORT) { - /* I2C2 is on PB10-11 */ - val = STM32_GPIO_CRH(GPIO_B) & ~0x0000ff00; - val |= 0x0000dd00; - STM32_GPIO_CRH(GPIO_B) = val; - } -} - -void keyboard_suppress_noise(void) -{ - /* notify audio codec of keypress for noise suppression */ - gpio_set_level(GPIO_CODEC_INT, 0); - gpio_set_level(GPIO_CODEC_INT, 1); -} - -static void board_startup_hook(void) -{ - gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP); -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_startup_hook, HOOK_PRIO_DEFAULT); - -static void board_shutdown_hook(void) -{ - /* Disable pull-up on SUSPEND_L during shutdown to prevent leakage */ - gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_FLOATING); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT); - -int pmu_board_init(void) -{ - int ver, failure = 0; - - /* Set fast charging timeout to 6 hours*/ - if (!failure) - failure = pmu_set_fastcharge(TIMEOUT_6HRS); - /* Enable external gpio CHARGER_EN control */ - if (!failure) - failure = pmu_enable_ext_control(1); - /* Disable force charging */ - if (!failure) - failure = pmu_enable_charger(0); - - /* Set NOITERM bit */ - if (!failure) - failure = pmu_low_current_charging(1); - - /* - * High temperature charging - * termination voltage: 2.1V - * termination current: 100% - */ - if (!failure) - failure = pmu_set_term_voltage(RANGE_T34, TERM_V2100); - if (!failure) - failure = pmu_set_term_current(RANGE_T34, TERM_I1000); - /* - * Standard temperature charging - * termination voltage: 2.1V - * termination current: 100% - */ - if (!failure) - failure = pmu_set_term_voltage(RANGE_T23, TERM_V2100); - if (!failure) - failure = pmu_set_term_current(RANGE_T23, TERM_I1000); - - /* - * Ignore TPSCHROME NTC reading in T40. This is snow board specific - * setting. Check: - * http://crosbug.com/p/12221 - * http://crosbug.com/p/13171 - */ - if (!failure) - failure = pmu_set_term_voltage(RANGE_T40, TERM_V2100); - if (!failure) - failure = pmu_set_term_current(RANGE_T40, TERM_I1000); - - /* Workaround init values before ES3 */ - if (pmu_version(&ver) || ver < 3) { - /* Termination current: 75% */ - if (!failure) - failure = pmu_set_term_current(RANGE_T34, TERM_I0750); - if (!failure) - failure = pmu_set_term_current(RANGE_T23, TERM_I0750); - if (!failure) - failure = pmu_set_term_current(RANGE_T40, TERM_I0750); - } - - return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; -} diff --git a/board/snow/board.h b/board/snow/board.h deleted file mode 100644 index 476fc551c9..0000000000 --- a/board/snow/board.h +++ /dev/null @@ -1,121 +0,0 @@ -/* 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. - */ - -/* Snow board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* 16 MHz SYSCLK clock frequency */ -#define CPU_CLOCK 16000000 - -/* Debug features */ -#undef CONFIG_TASK_PROFILING - -/* Optional features */ -#define CONFIG_BATTERY_BQ20Z453 -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_PRE_INIT -#define CONFIG_CHARGER_TPS65090 -#define CONFIG_CHIPSET_GAIA -#define CONFIG_CMD_PMU -#define CONFIG_EXTPOWER_SNOW -#define CONFIG_HOST_COMMAND_STATUS -#define CONFIG_I2C -#define CONFIG_I2C_ARBITRATION -#define CONFIG_KEYBOARD_PROTOCOL_MKBP -#define CONFIG_KEYBOARD_SUPPRESS_NOISE -#define CONFIG_PMU_HARD_RESET -#define CONFIG_PMU_TPS65090 -#define CONFIG_PWM - -/* use STOP mode when we have nothing to do */ -#define CONFIG_LOW_POWER_IDLE - -#ifndef __ASSEMBLER__ - -/* Keyboard output ports */ -#define KB_OUT_PORT_LIST GPIO_B, GPIO_C - -/* Charging */ -#define I2C_PORT_MASTER 1 -#define I2C_PORT_BATTERY I2C_PORT_MASTER -#define I2C_PORT_CHARGER I2C_PORT_MASTER -#define I2C_PORT_SLAVE 1 - -#define GPIO_AP_CLAIM GPIO_SPI1_NSS /* AP claims bus */ -#define GPIO_EC_CLAIM GPIO_SPI1_MISO /* EC claims bus */ - -/* Timer selection */ -#define TIM_CLOCK_MSB 3 -#define TIM_CLOCK_LSB 4 -#define TIM_POWER_LED 2 -#define TIM_WATCHDOG 1 - -/* GPIO signal list */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_KB_PWR_ON_L = 0, /* Keyboard power button */ - GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */ - GPIO_SOC1V8_XPSHOLD, /* App Processor ON */ - GPIO_CHARGER_INT_L, - GPIO_LID_OPEN, /* LID switch detection */ - GPIO_SUSPEND_L, /* AP suspend/resume state */ - GPIO_WP_L, /* Write protection pin (low active) */ - /* Keyboard inputs */ - GPIO_KB_IN00, - GPIO_KB_IN01, - GPIO_KB_IN02, - GPIO_KB_IN03, - GPIO_KB_IN04, - GPIO_KB_IN05, - GPIO_KB_IN06, - GPIO_KB_IN07, - /* Other inputs */ - GPIO_AC_PWRBTN_L, - GPIO_SPI1_NSS, - GPIO_I2C1_SCL, - GPIO_I2C1_SDA, - GPIO_I2C2_SCL, - GPIO_I2C2_SDA, - /* Outputs */ - GPIO_AC_STATUS, - GPIO_SPI1_MISO, - GPIO_EN_PP1350, /* DDR 1.35v rail enable */ - GPIO_EN_PP5000, /* 5.0v rail enable */ - GPIO_EN_PP3300, /* 3.3v rail enable */ - GPIO_PMIC_PWRON_L, /* 5v rail ready */ - GPIO_PMIC_RESET, /* Force hard reset of the pmic */ - GPIO_ENTERING_RW, /* EC is R/W mode for the kbc mux */ - GPIO_CHARGER_EN, - GPIO_EC_INT, - GPIO_CODEC_INT, /* To audio codec (KB noise cancellation) */ - GPIO_LED_POWER_L, /* Keyboard power LED */ - GPIO_KB_OUT00, - GPIO_KB_OUT01, - GPIO_KB_OUT02, - GPIO_KB_OUT03, - GPIO_KB_OUT04, - GPIO_KB_OUT05, - GPIO_KB_OUT06, - GPIO_KB_OUT07, - GPIO_KB_OUT08, - GPIO_KB_OUT09, - GPIO_KB_OUT10, - GPIO_KB_OUT11, - GPIO_KB_OUT12, - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -enum pwm_channel { - PWM_CH_POWER_LED = 0, - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/snow/build.mk b/board/snow/build.mk deleted file mode 100644 index 84db0e5304..0000000000 --- a/board/snow/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -# the IC is STmicro STM32F100RB -CHIP:=stm32 -CHIP_FAMILY:=stm32f -CHIP_VARIANT:=stm32f100 - -board-y=board.o diff --git a/board/snow/ec.tasklist b/board/snow/ec.tasklist deleted file mode 100644 index e2525aaeaf..0000000000 --- a/board/snow/ec.tasklist +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(POWERLED, power_led_task, NULL, 256) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, 360) diff --git a/board/spring/battery.c b/board/spring/battery.c deleted file mode 100644 index f8d88a84d2..0000000000 --- a/board/spring/battery.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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. - * - * Smart battery driver for Spring. - */ - -#include "battery.h" -#include "battery_smart.h" -#include "host_command.h" -#include "i2c.h" -#include "util.h" - -#define PARAM_CUT_OFF_LOW 0x10 -#define PARAM_CUT_OFF_HIGH 0x00 - -/* Battery temperature ranges in degrees C */ -static const struct battery_info info = { - .start_charging_min_c = 5, - .start_charging_max_c = 45, - .charging_min_c = 5, - .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 100, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -int battery_command_cut_off(struct host_cmd_handler_args *args) -{ - int rv; - uint8_t buf[3]; - - buf[0] = SB_MANUFACTURER_ACCESS & 0xff; - buf[1] = PARAM_CUT_OFF_LOW; - buf[2] = PARAM_CUT_OFF_HIGH; - - i2c_lock(I2C_PORT_BATTERY, 1); - rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0, - I2C_XFER_SINGLE); - rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0, - I2C_XFER_SINGLE); - i2c_lock(I2C_PORT_BATTERY, 0); - - if (rv) - return EC_RES_ERROR; - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off, - EC_VER_MASK(0)); diff --git a/board/spring/board.c b/board/spring/board.c deleted file mode 100644 index 965da81283..0000000000 --- a/board/spring/board.c +++ /dev/null @@ -1,264 +0,0 @@ -/* 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. - */ -/* Spring board-specific configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "board_config.h" -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "i2c.h" -#include "keyboard_raw.h" -#include "lid_switch.h" -#include "pmu_tpschrome.h" -#include "power.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "timer.h" -#include "util.h" - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) -#define GPIO_KB_OUTPUT GPIO_ODR_HIGH - -#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH) -#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH, - power_signal_interrupt}, - {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH, - power_signal_interrupt}, - {"CHARGER_INT_L", GPIO_C, (1<<4), GPIO_INT_FALLING, pmu_irq_handler}, - {"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt}, - {"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING, - power_signal_interrupt}, - {"WP_L", GPIO_A, (1<<13), GPIO_INPUT, NULL}, - {"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN02", GPIO_C, (1<<10), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN03", GPIO_C, (1<<11), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN04", GPIO_C, (1<<12), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN05", GPIO_C, (1<<14), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN06", GPIO_C, (1<<15), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"KB_IN07", GPIO_D, (1<<2), GPIO_KB_INPUT, - keyboard_raw_gpio_interrupt}, - {"USB_CHG_INT", GPIO_A, (1<<6), GPIO_INT_FALLING, extpower_interrupt}, - /* Other inputs */ - {"BCHGR_VACG", GPIO_A, (1<<0), GPIO_INT_BOTH, NULL}, - /* - * I2C pins should be configured as inputs until I2C module is - * initialized. This will avoid driving the lines unintentionally. - */ - {"I2C1_SCL", GPIO_B, (1<<6), GPIO_INPUT, NULL}, - {"I2C1_SDA", GPIO_B, (1<<7), GPIO_INPUT, NULL}, - {"I2C2_SCL", GPIO_B, (1<<10), GPIO_INPUT, NULL}, - {"I2C2_SDA", GPIO_B, (1<<11), GPIO_INPUT, NULL}, - /* Outputs */ - {"EN_PP1350", GPIO_A, (1<<14), GPIO_OUT_LOW, NULL}, - {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, - {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, - {"PMIC_PWRON_L",GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL}, - {"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", GPIO_D, (1<<0), GPIO_OUT_LOW, NULL}, - {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL}, - {"EC_INT", GPIO_B, (1<<9), GPIO_ODR_HIGH, NULL}, - {"ID_MUX", GPIO_D, (1<<1), GPIO_OUT_LOW, NULL}, - {"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT01", GPIO_B, (1<<8), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT02", GPIO_B, (1<<12), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT03", GPIO_B, (1<<13), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT04", GPIO_B, (1<<14), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT05", GPIO_B, (1<<15), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT06", GPIO_C, (1<<0), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT07", GPIO_C, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT08", GPIO_C, (1<<2), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT09", GPIO_B, (1<<1), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT11", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL}, - {"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL}, - {"BOOST_EN", GPIO_B, (1<<3), GPIO_OUT_HIGH, NULL}, - {"ILIM", GPIO_B, (1<<4), GPIO_OUT_LOW, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - /* - * TODO(crosbug.com/p/21618): use this instead of hard-coded register - * writes in board_config_pre_init(). - */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* ADC channels */ -const struct adc_t adc_channels[] = { - /* - * VBUS voltage sense pin. - * Sense pin 3.3V is converted to 4096. Accounting for the 2x - * voltage divider, the conversion factor is 6600mV/4096. - */ - [ADC_CH_USB_VBUS_SNS] = {"USB_VBUS_SNS", 6600, 4096, 0, STM32_AIN(5)}, - /* Micro USB D+ sense pin. Converted to mV (3300mV/4096). */ - [ADC_CH_USB_DP_SNS] = {"USB_DP_SNS", 3300, 4096, 0, STM32_AIN(2)}, - /* Micro USB D- sense pin. Converted to mV (3300mV/4096). */ - [ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 3300, 4096, 0, STM32_AIN(4)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {STM32_TIM(3), STM32_TIM_CH(1), 0, GPIO_ILIM}, -}; -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"master", I2C_PORT_MASTER, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -void board_config_pre_init(void) -{ - uint32_t val; - - /* Enable all GPIOs clocks */ - STM32_RCC_APB2ENR |= 0x1fd; - - /* remap OSC_IN/OSC_OUT to PD0/PD1 */ - STM32_GPIO_AFIO_MAPR |= 1 << 15; - - /* - * use PA13, PA14, PA15, PB3, PB4 as a GPIO, - * so disable JTAG and SWD - */ - STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x7 << 24)) - | (4 << 24); - - /* remap TIM3_CH1 to PB4 */ - STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x3 << 10)) - | (2 << 10); - - /* Analog input for ADC pins (PA2, PA4, PA5) */ - STM32_GPIO_CRL(GPIO_A) &= ~0x00ff0f00; - - /* - * Set alternate function for USART1. For alt. function input - * the port is configured in either floating or pull-up/down - * input mode (ref. section 7.1.4 in datasheet RM0041): - * PA9: Tx, alt. function output - * PA10: Rx, input with pull-down - * - * note: see crosbug.com/p/12223 for more info - */ - val = STM32_GPIO_CRH(GPIO_A) & ~0x00000ff0; - val |= 0x00000890; - STM32_GPIO_CRH(GPIO_A) = val; - - /* EC_INT is output, open-drain */ - val = STM32_GPIO_CRH(GPIO_B) & ~0xf0; - val |= 0x50; - STM32_GPIO_CRH(GPIO_B) = val; - /* put GPIO in Hi-Z state */ - gpio_set_level(GPIO_EC_INT, 1); -} - -/* GPIO configuration to be done after I2C module init */ -void board_i2c_post_init(int port) -{ - uint32_t val; - - /* enable alt. function (open-drain) */ - if (port == STM32_I2C1_PORT) { - /* I2C1 is on PB6-7 */ - val = STM32_GPIO_CRL(GPIO_B) & ~0xff000000; - val |= 0xdd000000; - STM32_GPIO_CRL(GPIO_B) = val; - } else if (port == STM32_I2C2_PORT) { - /* I2C2 is on PB10-11 */ - val = STM32_GPIO_CRH(GPIO_B) & ~0x0000ff00; - val |= 0x0000dd00; - STM32_GPIO_CRH(GPIO_B) = val; - } -} - -static void board_startup_hook(void) -{ - gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP); - -#ifdef CONFIG_PMU_FORCE_FET - /* Enable lcd panel power */ - pmu_enable_fet(FET_LCD_PANEL, 1, NULL); - /* Enable backlight power */ - pmu_enable_fet(FET_BACKLIGHT, 1, NULL); -#endif /* CONFIG_PMU_FORCE_FET */ -} -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_startup_hook, HOOK_PRIO_DEFAULT); - -static void board_shutdown_hook(void) -{ -#ifdef CONFIG_PMU_FORCE_FET - /* Power off backlight power */ - pmu_enable_fet(FET_BACKLIGHT, 0, NULL); - /* Power off lcd panel */ - pmu_enable_fet(FET_LCD_PANEL, 0, NULL); -#endif /* CONFIG_PMU_FORCE_FET */ - - /* Disable pull-up on SUSPEND_L during shutdown to prevent leakage */ - gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_FLOATING); -} -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT); - -int pmu_board_init(void) -{ - int failure = 0; - - /* - * Adjust charging parameters to match the expectations - * of the hardware fixing the cap ringing on DVT+ machines. - */ - failure |= pmu_set_term_current(RANGE_T01, TERM_I0875); - failure |= pmu_set_term_current(RANGE_T12, TERM_I0875); - failure |= pmu_set_term_current(RANGE_T23, TERM_I0875); - failure |= pmu_set_term_current(RANGE_T34, TERM_I0875); - failure |= pmu_set_term_current(RANGE_T40, TERM_I1000); - failure |= pmu_set_term_voltage(RANGE_T01, TERM_V2100); - failure |= pmu_set_term_voltage(RANGE_T12, TERM_V2100); - failure |= pmu_set_term_voltage(RANGE_T23, TERM_V2100); - failure |= pmu_set_term_voltage(RANGE_T34, TERM_V2100); - failure |= pmu_set_term_voltage(RANGE_T40, TERM_V2100); - - /* Set fast charging timeout to 6 hours*/ - if (!failure) - failure = pmu_set_fastcharge(TIMEOUT_6HRS); - /* Enable external gpio CHARGER_EN control */ - if (!failure) - failure = pmu_enable_ext_control(1); - /* Disable force charging */ - if (!failure) - failure = pmu_enable_charger(0); - - /* Set NOITERM bit */ - if (!failure) - failure = pmu_low_current_charging(1); - - return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; -} diff --git a/board/spring/board.h b/board/spring/board.h deleted file mode 100644 index 031e8b96b7..0000000000 --- a/board/spring/board.h +++ /dev/null @@ -1,132 +0,0 @@ -/* 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. - */ - -/* Spring board configuration */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* 16 MHz SYSCLK clock frequency */ -#define CPU_CLOCK 16000000 - - -/* Debug features */ -#undef CONFIG_TASK_PROFILING - -/* Optional features */ -#define CONFIG_ADC -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_PRE_INIT -#define CONFIG_CHARGER_TPS65090 -#define CONFIG_CHIPSET_GAIA -#define CONFIG_CMD_BATDEBUG -#define CONFIG_CMD_ILIM -#define CONFIG_CMD_PMU -#define CONFIG_CONSOLE_RESTRICTED_INPUT -#define CONFIG_EXTPOWER_SPRING -#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_LED_DRIVER_LP5562 -#define CONFIG_PMU_HARD_RESET -#define CONFIG_PMU_TPS65090 -#define CONFIG_USB_SWITCH_TSU6721 -#define CONFIG_PWM - -#ifndef __ASSEMBLER__ - -/* Keyboard output port list */ -#define KB_OUT_PORT_LIST GPIO_B, GPIO_C - -/* Charging */ -#define I2C_PORT_MASTER 0 -#define I2C_PORT_BATTERY I2C_PORT_MASTER -#define I2C_PORT_CHARGER I2C_PORT_MASTER -#define I2C_PORT_SLAVE 1 - -/* Low battery threshold. In mAh. */ -#define BATTERY_AP_OFF_LEVEL 1 - -/* Timer selection */ -#define TIM_CLOCK_MSB 2 -#define TIM_CLOCK_LSB 4 -#define TIM_WATCHDOG 1 - -/* ADC signal */ -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 -}; - -/* PWM signal */ -enum pwm_channel { - PWM_CH_ILIM = 0, - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -/* GPIO signal list */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_KB_PWR_ON_L = 0, /* Keyboard power button */ - GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */ - GPIO_SOC1V8_XPSHOLD, /* App Processor ON */ - GPIO_CHARGER_INT_L, - GPIO_LID_OPEN, /* LID switch detection */ - GPIO_SUSPEND_L, /* AP suspend/resume state */ - GPIO_WP_L, /* Write protection pin (low active) */ - /* Keyboard inputs */ - GPIO_KB_IN00, - GPIO_KB_IN01, - GPIO_KB_IN02, - GPIO_KB_IN03, - GPIO_KB_IN04, - GPIO_KB_IN05, - GPIO_KB_IN06, - GPIO_KB_IN07, - GPIO_USB_CHG_INT, - /* Other inputs */ - GPIO_BCHGR_VACG, /* AC good on TPSChrome */ - GPIO_I2C1_SCL, - GPIO_I2C1_SDA, - GPIO_I2C2_SCL, - GPIO_I2C2_SDA, - /* Outputs */ - GPIO_EN_PP1350, /* DDR 1.35v rail enable */ - GPIO_EN_PP5000, /* 5.0v rail enable */ - GPIO_EN_PP3300, /* 3.3v rail enable */ - GPIO_PMIC_PWRON_L, /* 5v rail ready */ - GPIO_PMIC_RESET, /* Force hard reset of the pmic */ - GPIO_ENTERING_RW, /* EC is R/W mode for the kbc mux */ - GPIO_CHARGER_EN, - GPIO_EC_INT, - GPIO_ID_MUX, - GPIO_KB_OUT00, - GPIO_KB_OUT01, - GPIO_KB_OUT02, - GPIO_KB_OUT03, - GPIO_KB_OUT04, - GPIO_KB_OUT05, - GPIO_KB_OUT06, - GPIO_KB_OUT07, - GPIO_KB_OUT08, - GPIO_KB_OUT09, - GPIO_KB_OUT10, - GPIO_KB_OUT11, - GPIO_KB_OUT12, - GPIO_BOOST_EN, - GPIO_ILIM, - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/spring/build.mk b/board/spring/build.mk deleted file mode 100644 index 2d3d6770db..0000000000 --- a/board/spring/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# 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. -# -# Board specific files build - -# the IC is STmicro STM32F100RB -CHIP:=stm32 -CHIP_FAMILY:=stm32f -CHIP_VARIANT:=stm32f100 - -board-y=board.o battery.o led.o diff --git a/board/spring/ec.tasklist b/board/spring/ec.tasklist deleted file mode 100644 index 4503bb2e95..0000000000 --- a/board/spring/ec.tasklist +++ /dev/null @@ -1,26 +0,0 @@ -/* 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, 320) diff --git a/board/spring/led.c b/board/spring/led.c deleted file mode 100644 index cbb1fd9ab9..0000000000 --- a/board/spring/led.c +++ /dev/null @@ -1,202 +0,0 @@ -/* 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. - * - * Battery LED state machine to drive RGB LED on LP5562 - */ - -#include "battery.h" -#include "battery_smart.h" -#include "common.h" -#include "driver/led/lp5562.h" -#include "extpower.h" -#include "hooks.h" -#include "host_command.h" -#include "pmu_tpschrome.h" -#include "timer.h" -#include "util.h" - -#define GREEN_LED_THRESHOLD 94 - -/* Minimal interval between changing LED color to green and yellow. */ -#define LED_WAIT_INTERVAL (15 * SECOND) - -/* We use yellow LED instead of blue LED. Re-map colors here. */ -#define LED_COLOR_NONE LP5562_COLOR_NONE -#define LED_COLOR_GREEN LP5562_COLOR_GREEN(0x10) -#define LED_COLOR_YELLOW LP5562_COLOR_BLUE(0x40) -#define LED_COLOR_RED LP5562_COLOR_RED(0x80) - -/* LED states */ -enum led_state_t { - LED_STATE_SOLID_RED, - LED_STATE_SOLID_GREEN, - LED_STATE_SOLID_YELLOW, - - /* Not an actual state */ - LED_STATE_OFF, - - /* Used to force next LED color update */ - LED_STATE_INVALID, -}; - -static enum led_state_t last_state = LED_STATE_OFF; -static int led_auto_control = 1; - -static int set_led_color(enum led_state_t state) -{ - int rv = EC_SUCCESS; - - if (!led_auto_control || state == last_state) - return EC_SUCCESS; - - switch (state) { - case LED_STATE_SOLID_RED: - rv = lp5562_set_color(LED_COLOR_RED); - break; - case LED_STATE_SOLID_GREEN: - rv = lp5562_set_color(LED_COLOR_GREEN); - break; - case LED_STATE_SOLID_YELLOW: - rv = lp5562_set_color(LED_COLOR_YELLOW); - break; - default: - break; - } - - if (rv == EC_SUCCESS) - last_state = state; - else - last_state = LED_STATE_INVALID; - return rv; -} - -/** - * Directly read state of charge (0-100) of battery. - */ -static int battery_state_of_charge(int *percent) -{ - return sb_read(SB_RELATIVE_STATE_OF_CHARGE, percent); -} - -/*****************************************************************************/ -/* Host commands */ - -static int led_command_control(struct host_cmd_handler_args *args) -{ - const struct ec_params_led_control *p = args->params; - struct ec_response_led_control *r = args->response; - int i; - uint8_t clipped[EC_LED_COLOR_COUNT]; - - /* Only support battery LED control */ - if (p->led_id != EC_LED_ID_BATTERY_LED) - return EC_RES_INVALID_PARAM; - - if (p->flags & EC_LED_FLAGS_AUTO) { - if (!extpower_is_present()) - lp5562_poweroff(); - last_state = LED_STATE_OFF; - led_auto_control = 1; - } else if (!(p->flags & EC_LED_FLAGS_QUERY)) { - for (i = 0; i < EC_LED_COLOR_COUNT; ++i) - clipped[i] = MIN(p->brightness[i], 0x80); - led_auto_control = 0; - if (!extpower_is_present()) - lp5562_poweron(); - if (lp5562_set_color((clipped[EC_LED_COLOR_RED] << 16) + - (clipped[EC_LED_COLOR_GREEN] << 8) + - clipped[EC_LED_COLOR_YELLOW])) - return EC_RES_ERROR; - } - - r->brightness_range[EC_LED_COLOR_RED] = 0x80; - r->brightness_range[EC_LED_COLOR_GREEN] = 0x80; - r->brightness_range[EC_LED_COLOR_BLUE] = 0x0; - r->brightness_range[EC_LED_COLOR_YELLOW] = 0x80; - r->brightness_range[EC_LED_COLOR_WHITE] = 0x0; - args->response_size = sizeof(struct ec_response_led_control); - - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_LED_CONTROL, - led_command_control, - EC_VER_MASK(1)); - -/*****************************************************************************/ -/* Hooks */ - -static void battery_led_update(void) -{ - int rv; - int state_of_charge; - enum led_state_t state = LED_STATE_OFF; - - /* Current states and next states */ - static int led_power = -1; - int new_led_power; - - /* - * The time before which we should not change LED - * color between green and yellow. - */ - static timestamp_t led_update_deadline = {.val = 0}; - - /* Determine LED power */ - new_led_power = extpower_is_present(); - if (new_led_power != led_power) { - if (new_led_power) { - rv = lp5562_poweron(); - } else { - rv = lp5562_poweroff(); - set_led_color(LED_STATE_OFF); - led_update_deadline.val = 0; - } - if (!rv) - led_power = new_led_power; - } - if (!new_led_power) - return; - - /* - * LED power is controlled by accessory detection. We only - * set color here. - */ - switch (charge_get_state()) { - case ST_IDLE0: - case ST_BAD_COND: - case ST_PRE_CHARGING: - state = LED_STATE_SOLID_YELLOW; - break; - case ST_IDLE: - case ST_DISCHARGING: - case ST_CHARGING: - if (battery_state_of_charge(&state_of_charge)) { - /* Cannot talk to the battery. Set LED to red. */ - state = LED_STATE_SOLID_RED; - break; - } - - if (state_of_charge < GREEN_LED_THRESHOLD) - state = LED_STATE_SOLID_YELLOW; - else - state = LED_STATE_SOLID_GREEN; - break; - case ST_CHARGING_ERROR: - state = LED_STATE_SOLID_RED; - break; - } - - if (state == LED_STATE_SOLID_GREEN || - state == LED_STATE_SOLID_YELLOW) { - if (!timestamp_expired(led_update_deadline, NULL)) - return; - led_update_deadline.val = - get_time().val + LED_WAIT_INTERVAL; - } else { - led_update_deadline.val = 0; - } - - set_led_color(state); -} -DECLARE_HOOK(HOOK_SECOND, battery_led_update, HOOK_PRIO_DEFAULT); diff --git a/board/squawks/battery.c b/board/squawks/battery.c deleted file mode 100644 index 156818d7fd..0000000000 --- a/board/squawks/battery.c +++ /dev/null @@ -1,68 +0,0 @@ -/* 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. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" -#include "console.h" -#include "gpio.h" -#include "host_command.h" -#include "util.h" - -/* Shutdown mode parameter to write to manufacturer access register */ -#define SB_SHUTDOWN_DATA 0x0010 - -/* 3S1P battery */ -static const struct battery_info info = { - .voltage_max = 12600, /* mV */ - .voltage_normal = 10800, - .voltage_min = 8250, - /* - * Precharge current max is 400 mA, but 384 mA is as close to that - * as the charger can get without going over. - */ - .precharge_current = 384, /* mA */ - .start_charging_min_c = 10, - .start_charging_max_c = 45, - .charging_min_c = 10, - .charging_max_c = 45, - .discharging_min_c = -20, - .discharging_max_c = 60, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -static int cutoff(void) -{ - int rv; - - /* Ship mode command must be sent twice to take effect */ - rv = sb_write(SB_MANUFACTURER_ACCESS, SB_SHUTDOWN_DATA); - - if (rv != EC_SUCCESS) - return rv; - - return sb_write(SB_MANUFACTURER_ACCESS, SB_SHUTDOWN_DATA); -} - -static int battery_command_cut_off(struct host_cmd_handler_args *args) -{ - return cutoff() ? EC_RES_SUCCESS : EC_RES_ERROR; -} -DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off, - EC_VER_MASK(0)); - -static int command_battcutoff(int argc, char **argv) -{ - return cutoff(); -} -DECLARE_CONSOLE_COMMAND(battcutoff, command_battcutoff, - NULL, - "Enable battery cutoff (ship mode)", - NULL); diff --git a/board/squawks/board.c b/board/squawks/board.c deleted file mode 100644 index 825d551c78..0000000000 --- a/board/squawks/board.c +++ /dev/null @@ -1,201 +0,0 @@ -/* 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. - */ -/* EC for Squawks board configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "backlight.h" -#include "common.h" -#include "driver/temp_sensor/tmp432.h" -#include "extpower.h" -#include "gpio.h" -#include "host_command.h" -#include "i2c.h" -#include "jtag.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "peci.h" -#include "power.h" -#include "power_button.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "switch.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "thermal.h" -#include "timer.h" -#include "uart.h" -#include "util.h" - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH_DSLEEP, - power_button_interrupt}, - {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH_DSLEEP, - lid_interrupt}, - {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH_DSLEEP, - extpower_interrupt}, - {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH_DSLEEP | - GPIO_PULL_UP, - power_signal_interrupt}, - {"PCH_SLP_S4_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH_DSLEEP | - GPIO_PULL_UP, - power_signal_interrupt}, - {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP3300_PCH_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INT_BOTH, - power_signal_interrupt}, - {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"S5_PGOOD", LM4_GPIO_G, (1<<0), GPIO_INT_BOTH, - power_signal_interrupt}, - {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH, - power_signal_interrupt}, - {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH, - switch_interrupt}, - {"JTAG_TCK", LM4_GPIO_C, (1<<0), GPIO_DEFAULT, - jtag_interrupt}, - {"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_INT_BOTH_DSLEEP | - GPIO_PULL_UP, - uart_deepsleep_interrupt}, - - /* Other inputs */ - {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL}, - {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL}, - {"PCH_SLP_SX_L", LM4_GPIO_G, (1<<3), GPIO_INPUT|GPIO_PULL_UP, - NULL}, - {"PCH_SUS_STAT_L", LM4_GPIO_G, (1<<6), GPIO_INPUT|GPIO_PULL_UP, - NULL}, - {"PCH_SUSPWRDNACK", LM4_GPIO_G, (1<<2), GPIO_INPUT|GPIO_PULL_UP, - NULL}, - {"PP1000_S0IX_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INPUT, NULL}, - {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL}, - {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL}, - - /* Outputs; all unasserted by default except for reset signals */ - {"CPU_PROCHOT", LM4_GPIO_B, (1<<5), GPIO_OUT_LOW, NULL}, - {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_ODR_HIGH, NULL}, - {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", LM4_GPIO_D, (1<<6), GPIO_OUT_LOW, NULL}, - {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, - {"PCH_CORE_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, - {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL}, - {"PCH_RCIN_L", LM4_GPIO_F, (1<<3), GPIO_ODR_HIGH, NULL}, - {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL}, - {"PCH_SOC_OVERRIDE", LM4_GPIO_G, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL}, - {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL}, - {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_LTE_EN", LM4_GPIO_D, (1<<4), GPIO_OUT_LOW, NULL}, - {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL}, - {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL}, - {"PPSX_EN", LM4_GPIO_L, (1<<6), GPIO_OUT_LOW, NULL}, - {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL}, - {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL}, - {"USB_CTL1", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL}, - {"USB_ILIM_SEL", LM4_GPIO_E, (1<<5), GPIO_OUT_LOW, NULL}, - {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL}, - {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL}, - {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL}, - {"PCH_SCI_L", LM4_GPIO_M, (1<<1), GPIO_ODR_HIGH, NULL}, - {"KBD_IRQ_L", LM4_GPIO_M, (1<<3), GPIO_ODR_HIGH, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */ - {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */ - {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */ - {GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_D, 0x0f, 2, MODULE_SPI}, /* SPI1 */ - {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0x21, 15, MODULE_LPC}, /* LPC */ - {GPIO_N, 0x50, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN}, /* FAN0PWM 3&4 */ - {GPIO_M, 0x40, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN}, /* FAN0PWM0 */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_PP1050_PGOOD, 1, "PGOOD_PP1050"}, - {GPIO_PP3300_PCH_PGOOD, 1, "PGOOD_PP3300_PCH"}, - {GPIO_PP5000_PGOOD, 1, "PGOOD_PP5000"}, - {GPIO_S5_PGOOD, 1, "PGOOD_S5"}, - {GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"}, - {GPIO_PP1000_S0IX_PGOOD, 1, "PGOOD_PP1000_S0IX"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S4_L, 1, "SLP_S4#_DEASSERTED"}, - {GPIO_PCH_SLP_SX_L, 1, "SLP_SX#_DEASSERTED"}, - {GPIO_PCH_SUS_STAT_L, 0, "SUS_STAT#_ASSERTED"}, - {GPIO_PCH_SUSPWRDNACK, 1, "SUSPWRDNACK_ASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -/* ADC channels. Must be in the exactly same order as in enum adc_channel. */ -const struct adc_t adc_channels[] = { - /* EC internal temperature is calculated by - * 273 + (295 - 450 * ADC_VALUE / ADC_READ_MAX) / 2 - * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 - */ - {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - - /* IOUT == ICMNT is on PE3/AIN0 */ - /* We have 0.01-ohm resistors, and IOUT is 20X the differential - * voltage, so 1000mA ==> 200mV. - * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured). - * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 200 - */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 2, 0, - LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {4, PWM_CONFIG_ACTIVE_LOW}, - {3, PWM_CONFIG_ACTIVE_LOW}, - {0, PWM_CONFIG_ACTIVE_LOW}, -}; - -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", 0, 100}, - {"thermal", 5, 100}, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[] = { - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, - {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_LOCAL, 4}, - {"TMP432_Power_top", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE1, 4}, - {"TMP432_CPU_bottom", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE2, 4}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in - * same order as enum temp_sensor_id. To always ignore any temp, use 0. - */ -struct ec_thermal_config thermal_params[] = { - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, - {{0, 0, 0}, 0, 0}, -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); diff --git a/board/squawks/board.h b/board/squawks/board.h deleted file mode 100644 index 1b93ecab22..0000000000 --- a/board/squawks/board.h +++ /dev/null @@ -1,182 +0,0 @@ -/* 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. - */ - -/* Configuration for Rambi mainboard */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_AP_HANG_DETECT -#define CONFIG_BACKLIGHT_LID -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_VERSION -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24715 -#define CONFIG_CHARGER_INPUT_CURRENT 1700 /* 33 W adapter, 19 V, 1.75 A */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input senso resistor, mOhm */ -#define CONFIG_CHIPSET_BAYTRAIL -#define CONFIG_CHIPSET_CAN_THROTTLE -#define CONFIG_CHIPSET_X86 -#define CONFIG_CMD_GSV -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_KEYBOARD_COL2_INVERTED -#define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_LED_COMMON -#undef CONFIG_PECI -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_PWM -#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_TMP432 -#define CONFIG_USB_PORT_POWER_SMART -#define CONFIG_USB_PORT_POWER_SMART_SIMPLE -#define CONFIG_WIRELESS - -#ifndef __ASSEMBLER__ - -/* I2C ports */ -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#define I2C_PORT_THERMAL 5 - -/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */ -#define KB_SCAN_ROW_IRQ LM4_IRQ_GPIOK -#define KB_SCAN_ROW_GPIO LM4_GPIO_K - -/* Host connects to keyboard controller module via LPC */ -#define HOST_KB_BUS_LPC - -/* USB ports */ -#define USB_PORT_COUNT 2 - -/* Wireless signals */ -#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L -#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN -#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN - -/* GPIO signal definitions. */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, /* Power button */ - GPIO_LID_OPEN, /* Lid switch */ - GPIO_AC_PRESENT, /* AC power present */ - GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */ - GPIO_PCH_SLP_S4_L, /* SLP_S4# signal from PCH */ - GPIO_PP1050_PGOOD, /* Power good on 1.05V */ - GPIO_PP3300_PCH_PGOOD, /* Power good on 3.3V (PCH supply) */ - GPIO_PP5000_PGOOD, /* Power good on 5V */ - GPIO_S5_PGOOD, /* Power good on S5 supplies */ - GPIO_VCORE_PGOOD, /* Power good on core VR */ - GPIO_WP_L, /* Write protect input */ - GPIO_JTAG_TCK, /* JTAG clock input */ - GPIO_UART0_RX, /* UART0 RX input */ - - /* Other inputs */ - GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */ - GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ - GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ - GPIO_PCH_SLP_SX_L, /* SLP_S0IX# signal from PCH */ - GPIO_PCH_SUS_STAT_L, /* SUS_STAT# signal from PCH */ - GPIO_PCH_SUSPWRDNACK, /* SUSPWRDNACK signal from PCH */ - GPIO_PP1000_S0IX_PGOOD, /* Power good on 1.00V (S0iX supplies) */ - GPIO_USB1_OC_L, /* USB port overcurrent warning */ - GPIO_USB2_OC_L, /* USB port overcurrent warning */ - - /* Outputs */ - GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ - GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ - GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ - GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ - GPIO_LPC_CLKRUN_L, /* Request that PCH drive LPC clock */ - GPIO_PCH_CORE_PWROK, /* Indicate core well power is stable */ - GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ - GPIO_PCH_RCIN_L, /* Reset line to PCH (for 8042 emulation) */ - GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */ - GPIO_PCH_SMI_L, /* System management interrupt to PCH */ - GPIO_PCH_SOC_OVERRIDE, /* SOC override signal to PCH; when high, ME - * ignores security descriptor */ - /* - * TODO(crosbug.com/p/24424): Remove old assignment and remove _NEW - * from the new one when we deprecate the 1.5 boards. - */ - GPIO_PCH_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */ - GPIO_PP1350_EN, /* Enable 1.35V supply */ - GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ - GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ - GPIO_PP5000_EN, /* Enable 5V supply */ - GPIO_PPSX_EN, /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ - GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ - GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ - GPIO_USB_CTL1, /* USB control signal 1 to both ports */ - GPIO_USB_ILIM_SEL, /* USB current limit to both ports */ - GPIO_USB1_ENABLE, /* USB port 1 output power enable */ - GPIO_USB2_ENABLE, /* USB port 2 output power enable */ - GPIO_VCORE_EN, /* Enable core power supplies */ - GPIO_WLAN_OFF_L, /* Disable WiFi radio */ - GPIO_PCH_SCI_L, /* Assert SCI to PCH */ - GPIO_KBD_IRQ_L, /* Negative edge triggered irq. */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -/* power signal definitions */ -enum power_signal { - X86_PGOOD_PP1050 = 0, - X86_PGOOD_PP3300_PCH, - X86_PGOOD_PP5000, - X86_PGOOD_S5, - X86_PGOOD_VCORE, - X86_PGOOD_PP1000_S0IX, - X86_SLP_S3_DEASSERTED, - X86_SLP_S4_DEASSERTED, - X86_SLP_SX_DEASSERTED, - X86_SUS_STAT_ASSERTED, - X86_SUSPWRDNACK_ASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -enum adc_channel { - /* EC internal die temperature in degrees K. */ - ADC_CH_EC_TEMP = 0, - - /* Charger current in mA. */ - ADC_CH_CHARGER_CURRENT, - - ADC_CH_COUNT -}; - -enum pwm_channel { - PWM_CH_LED_BATTERY_GREEN, - PWM_CH_LED_BATTERY_ORANGE, - PWM_CH_LED_POWER_GREEN, - - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -enum temp_sensor_id { - /* EC internal temperature sensor */ - TEMP_SENSOR_EC_INTERNAL = 0, - - /* TMP432 local and remote sensors */ - TEMP_SENSOR_I2C_TMP432_LOCAL, - TEMP_SENSOR_I2C_TMP432_REMOTE1, - TEMP_SENSOR_I2C_TMP432_REMOTE2, - - TEMP_SENSOR_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/squawks/build.mk b/board/squawks/build.mk deleted file mode 100644 index f771f4f0ec..0000000000 --- a/board/squawks/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build -# - -# the IC is TI Stellaris LM4 -CHIP:=lm4 - -board-y=battery.o board.o led.o diff --git a/board/squawks/ec.tasklist b/board/squawks/ec.tasklist deleted file mode 100644 index c8284ec561..0000000000 --- a/board/squawks/ec.tasklist +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- 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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' is the name of the task - * 'r' is the main routine of the task - * 'd' is an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) diff --git a/board/squawks/led.c b/board/squawks/led.c deleted file mode 100644 index c65d4c02fc..0000000000 --- a/board/squawks/led.c +++ /dev/null @@ -1,163 +0,0 @@ -/* 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. - * - * Battery LED control for Rambi - */ - -#include "charge_state.h" -#include "chipset.h" -#include "gpio.h" -#include "hooks.h" -#include "led_common.h" -#include "lid_switch.h" -#include "pwm.h" -#include "util.h" - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED, EC_LED_ID_POWER_LED}; -const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); - -enum led_color { - LED_OFF = 0, - LED_ORANGE, - LED_GREEN, -}; - -/** - * Set battery LED color - * - * @param color Enumerated color value - */ -static void set_battery_led_color(enum led_color color) -{ - pwm_set_duty(PWM_CH_LED_BATTERY_ORANGE, color == LED_ORANGE ? 100 : 0); - pwm_set_duty(PWM_CH_LED_BATTERY_GREEN, color == LED_GREEN ? 100 : 0); -} - -void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) -{ - if (led_id == EC_LED_ID_POWER_LED) { - brightness_range[EC_LED_COLOR_GREEN] = 100; - } else { - brightness_range[EC_LED_COLOR_RED] = 100; - brightness_range[EC_LED_COLOR_GREEN] = 100; - } -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - if (led_id == EC_LED_ID_POWER_LED) { - pwm_set_duty(PWM_CH_LED_BATTERY_GREEN, - brightness[EC_LED_COLOR_GREEN]); - } else { - pwm_set_duty(PWM_CH_LED_BATTERY_ORANGE, - brightness[EC_LED_COLOR_RED]); - pwm_set_duty(PWM_CH_LED_BATTERY_GREEN, - brightness[EC_LED_COLOR_GREEN]); - } - return EC_SUCCESS; -} - -static void led_init(void) -{ - /* Configure GPIOs */ - gpio_config_module(MODULE_PWM_LED, 1); - - /* - * Enable PWMs and set to 0% duty cycle. If they're disabled, the LM4 - * seems to ground the pins instead of letting them float. - */ - pwm_enable(PWM_CH_LED_BATTERY_ORANGE, 1); - pwm_enable(PWM_CH_LED_BATTERY_GREEN, 1); - pwm_enable(PWM_CH_LED_POWER_GREEN, 1); - pwm_set_duty(PWM_CH_LED_POWER_GREEN, 0); - set_battery_led_color(LED_OFF); -} -DECLARE_HOOK(HOOK_INIT, led_init, HOOK_PRIO_DEFAULT); - -/** - * Return new duty cycle for power LED (0-100). - */ -static int new_power_led_brightness(void) -{ - static unsigned ticks; - static int suspended_prev; - - int suspended = chipset_in_state(CHIPSET_STATE_SUSPEND); - - /* If we're just suspending now, reset ticks so LED changes quickly */ - if (suspended && !suspended_prev) - ticks = 0; - else - ticks++; - - suspended_prev = suspended; - - /* If lid is closed, LED is off in all chipset states */ - if (!lid_is_open()) - return 0; - - /* If chipset is on, LED is on */ - if (chipset_in_state(CHIPSET_STATE_ON)) - return 100; - - /* If chipset isn't on or suspended, it's off; LED is off */ - if (!chipset_in_state(CHIPSET_STATE_SUSPEND)) - return 0; - - /* Suspended. Blink with 25% duty cycle, 2 sec period */ - return (ticks % 8 < 2) ? 100 : 0; -} - -/** - * Return new color for battery LED. - */ -static enum led_color new_battery_led_color(void) -{ - static unsigned ticks; - - int chstate = charge_get_state(); - - ticks++; - - /* If charging error, blink orange, 50% duty cycle, 0.5 sec period */ - if (chstate == PWR_STATE_ERROR) - return (ticks & 0x1) ? LED_ORANGE : LED_OFF; - - /* If charge-force-idle, blink green, 50% duty cycle, 2 sec period */ - if (chstate == PWR_STATE_IDLE && - (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)) - return (ticks & 0x4) ? LED_GREEN : LED_OFF; - - /* If the system is charging, orange under 95%; green if over */ - if (chstate == PWR_STATE_CHARGE) - return charge_get_percent() < 95 ? LED_ORANGE : LED_GREEN; - - /* If AC connected and fully charged (or close to it), solid green */ - if (chstate == PWR_STATE_CHARGE_NEAR_FULL || - chstate == PWR_STATE_IDLE) { - return LED_GREEN; - } - - /* Otherwise, discharging; flash orange if less than 10% power */ - if (charge_get_percent() < 10) - return (ticks % 8 < 2) ? LED_ORANGE : LED_OFF; - - /* Discharging and greater than 10% power, so off */ - return LED_OFF; -} - -/** - * Called by hook task every 250 ms - */ -static void led_tick(void) -{ - if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - pwm_set_duty(PWM_CH_LED_POWER_GREEN, - new_power_led_brightness()); - - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) - set_battery_led_color(new_battery_led_color()); -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); diff --git a/test/build.mk b/test/build.mk index 170b0e37b0..daea926970 100644 --- a/test/build.mk +++ b/test/build.mk @@ -21,7 +21,7 @@ test-list-$(BOARD_SAMUS)= # Emulator tests test-list-host=mutex pingpong utils kb_scan kb_mkbp lid_sw power_button hooks test-list-host+=thermal flash queue kb_8042 extpwr_gpio console_edit system -test-list-host+=sbs_charging adapter host_command thermal_falco led_spring +test-list-host+=sbs_charging adapter host_command thermal_falco test-list-host+=bklight_lid bklight_passthru interrupt adapter-y=adapter.o @@ -36,7 +36,6 @@ kb_8042-y=kb_8042.o interrupt-y=interrupt.o kb_mkbp-y=kb_mkbp.o kb_scan-y=kb_scan.o -led_spring-y=led_spring.o led_spring_impl.o lid_sw-y=lid_sw.o mutex-y=mutex.o pingpong-y=pingpong.o diff --git a/test/led_spring_impl.c b/test/led_spring_impl.c deleted file mode 120000 index 25fcf73a27..0000000000 --- a/test/led_spring_impl.c +++ /dev/null @@ -1 +0,0 @@ -../board/spring/led.c
\ No newline at end of file |