diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2020-07-28 18:27:15 -0600 |
---|---|---|
committer | Archie Pusaka <apusaka@chromium.org> | 2020-07-29 03:46:11 +0000 |
commit | 08df256be2e54d3d9655d100f8a2b68c9a21590f (patch) | |
tree | 40ffbc64408a9c8248729f7195e9ca704f850f1c /board/strago | |
parent | 95aeff804bfa2269f7aab45df2342f242fabc51d (diff) | |
download | chrome-ec-08df256be2e54d3d9655d100f8a2b68c9a21590f.tar.gz |
board: kill strago board from ToT
Strago is a 2x offender on flash space issues in the past week.
It's pretty mature, doubt anyone is doing new developments for this
board on ToT. Let's kill it from ToT.
BUG=chromium:1110513
BRANCH=none
TEST=no EC_FIRMWARE="strago" in any make.defaults
Change-Id: Ib5bfa75dc71038849323f646aec0448c0bd20f61
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2325253
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/strago')
-rw-r--r-- | board/strago/battery.c | 43 | ||||
-rw-r--r-- | board/strago/board.c | 368 | ||||
-rw-r--r-- | board/strago/board.h | 212 | ||||
-rw-r--r-- | board/strago/build.mk | 15 | ||||
-rw-r--r-- | board/strago/ec.tasklist | 22 | ||||
-rw-r--r-- | board/strago/gpio.inc | 157 | ||||
-rw-r--r-- | board/strago/led.c | 206 | ||||
-rw-r--r-- | board/strago/lfw/gpio.inc | 19 | ||||
-rw-r--r-- | board/strago/usb_pd_policy.c | 44 |
9 files changed, 0 insertions, 1086 deletions
diff --git a/board/strago/battery.c b/board/strago/battery.c deleted file mode 100644 index ef4bfe27ce..0000000000 --- a/board/strago/battery.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 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" - -/* Shutdown mode parameter to write to manufacturer access register */ -#define SB_SHUTDOWN_DATA 0x0010 - -static const struct battery_info info = { - .voltage_max = 8700,/* mV */ - .voltage_normal = 7600, - .voltage_min = 6000, - .precharge_current = 150,/* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -20, - .discharging_max_c = 60, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -int board_cut_off_battery(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); -} diff --git a/board/strago/board.c b/board/strago/board.c deleted file mode 100644 index 14be616184..0000000000 --- a/board/strago/board.c +++ /dev/null @@ -1,368 +0,0 @@ -/* Copyright 2014 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. - */ -/* Strago board-specific configuration */ - -#include "adc.h" -#include "adc_chip.h" -#include "als.h" -#include "button.h" -#include "charger.h" -#include "charge_manager.h" -#include "charge_state.h" -#include "console.h" -#include "driver/accel_kionix.h" -#include "driver/accel_kxcj9.h" -#include "driver/als_isl29035.h" -#include "driver/charger/bq24773.h" -#include "driver/tcpm/tcpci.h" -#include "driver/temp_sensor/tmp432.h" -#include "driver/usb_mux/pi3usb3x532.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "i2c.h" -#include "lid_switch.h" -#include "math_util.h" -#include "motion_lid.h" -#include "motion_sense.h" -#include "pi3usb9281.h" -#include "power.h" -#include "power_button.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "spi.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "thermal.h" -#include "usb_charge.h" -#include "usb_mux.h" -#include "usb_pd.h" -#include "usb_pd_tcpm.h" -#include "util.h" - -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) - -/* Exchange status with PD MCU. */ -static void pd_mcu_interrupt(enum gpio_signal signal) -{ -#ifdef HAS_TASK_PDCMD - /* Exchange status with PD MCU to determine interrupt cause */ - host_command_pd_send_status(0); -#endif -} - -void vbus0_evt(enum gpio_signal signal) -{ - /* VBUS present GPIO is inverted */ - usb_charger_vbus_change(0, !gpio_get_level(signal)); - task_wake(TASK_ID_PD_C0); -} - -void usb0_evt(enum gpio_signal signal) -{ - task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12, 0); -} - -#include "gpio_list.h" - -/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ -const struct pwm_t pwm_channels[] = { - {0, PWM_CONFIG_ACTIVE_LOW}, - {1, PWM_CONFIG_ACTIVE_LOW}, - {3, PWM_CONFIG_ACTIVE_LOW}, -}; - -BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_ALL_SYS_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "ALL_SYS_PWRGD"}, - {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_N_PWRGD"}, - {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4#_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -/* ADC channels */ -const struct adc_t adc_channels[] = { - /* Vbus sensing. Converted to mV, full ADC is equivalent to 30V. */ - [ADC_VBUS] = {"VBUS", 30000, 1024, 0, 4}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", MEC1322_I2C0_0, 100, - GPIO_I2C_PORT0_SCL, GPIO_I2C_PORT0_SDA}, - {"sensors", MEC1322_I2C1, 100, - GPIO_I2C_PORT1_SCL, GPIO_I2C_PORT1_SDA}, - {"pd_mcu", MEC1322_I2C2, 1000, - GPIO_I2C_PORT2_SCL, GPIO_I2C_PORT2_SDA}, - {"thermal", MEC1322_I2C3, 100, - GPIO_I2C_PORT3_SCL, GPIO_I2C_PORT3_SDA} -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .bus_type = EC_BUS_TYPE_I2C, - .i2c_info = { - .port = I2C_PORT_TCPC, - .addr_flags = CONFIG_TCPC_I2C_BASE_ADDR_FLAGS, - }, - .drv = &tcpci_tcpm_drv, - }, -}; - -/* SPI master ports */ -const struct spi_device_t spi_devices[] = { - { CONFIG_SPI_FLASH_PORT, 0, GPIO_PVT_CS0}, -}; -const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); - -const enum gpio_signal hibernate_wake_pins[] = { - GPIO_AC_PRESENT, - GPIO_LID_OPEN, - GPIO_POWER_BUTTON_L, -}; - -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); - -struct pi3usb9281_config pi3usb9281_chips[] = { - { - .i2c_port = I2C_PORT_USB_CHARGER_1, - .mux_lock = NULL, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) == - CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT); - -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { - { - .usb_port = 0, - .i2c_port = I2C_PORT_USB_MUX, - .i2c_addr_flags = PI3USB3X532_I2C_ADDR1, - .driver = &pi3usb3x532_usb_mux_driver, - }, -}; - -const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = { - GPIO_USB1_ENABLE, - GPIO_USB2_ENABLE, -}; - -/* - * Temperature sensors data; must be in same order as enum temp_sensor_id. - * Sensor index and name must match those present in coreboot: - * src/mainboard/google/${board}/acpi/dptf.asl - */ -const struct temp_sensor_t temp_sensors[] = { - {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_LOCAL}, - {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE1}, - {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE2}, - {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, - 0}, -}; -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_init, isl29035_read_lux, 5}, -}; -BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT); - -const struct charger_config_t chg_chips[] = { - { - .i2c_port = I2C_PORT_CHARGER, - .i2c_addr_flags = I2C_ADDR_CHARGER_FLAGS, - .drv = &bq2477x_drv, - }, -}; - -/** - * Reset PD MCU - */ -void board_reset_pd_mcu(void) -{ - gpio_set_level(GPIO_PD_RST_L, 0); - usleep(100); - gpio_set_level(GPIO_PD_RST_L, 1); -} - -/* Four Motion sensors */ -/* kxcj9 mutex and local/private data*/ -static struct mutex g_kxcj9_mutex[2]; -struct kionix_accel_data g_kxcj9_data[2]; - -/* Matrix to rotate accelrator into standard reference frame */ -const mat33_fp_t base_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, - {FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - -const mat33_fp_t lid_standard_ref = { - {FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; - -struct motion_sensor_t motion_sensors[] = { - [BASE_ACCEL] = { - .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_KXCJ9, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &kionix_accel_drv, - .mutex = &g_kxcj9_mutex[0], - .drv_data = &g_kxcj9_data[0], - .port = I2C_PORT_ACCEL, - .i2c_spi_addr_flags = KXCJ9_ADDR1_FLAGS, - .rot_standard_ref = &base_standard_ref, - .default_range = 2, /* g, to support lid angle calculation. */ - .min_frequency = KXCJ9_ACCEL_MIN_FREQ, - .max_frequency = KXCJ9_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 100000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - } - }, - [LID_ACCEL] = { - .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0, - .chip = MOTIONSENSE_CHIP_KXCJ9, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &kionix_accel_drv, - .mutex = &g_kxcj9_mutex[1], - .drv_data = &g_kxcj9_data[1], - .port = I2C_PORT_ACCEL, - .i2c_spi_addr_flags = KXCJ9_ADDR0_FLAGS, - .rot_standard_ref = &lid_standard_ref, - .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = KXCJ9_ACCEL_MIN_FREQ, - .max_frequency = KXCJ9_ACCEL_MAX_FREQ, - .config = { - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 100000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, - }, - }, - }, -}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -/* init ADC ports to avoid floating state due to thermistors */ -static void adc_pre_init(void) -{ - /* Configure GPIOs */ - gpio_config_module(MODULE_ADC, 1); -} -DECLARE_HOOK(HOOK_INIT, adc_pre_init, HOOK_PRIO_INIT_ADC - 1); - -/* Initialize board. */ -static void board_init(void) -{ - /* Enable PD MCU interrupt */ - gpio_enable_interrupt(GPIO_PD_MCU_INT); - /* Enable VBUS interrupt */ - gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L); - - /* Enable pericom BC1.2 interrupts */ - gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -/** - * Set active charge port -- Enable or Disable charging - * - * @param charge_port Charge port to enable. - * - * Returns EC_SUCCESS if charge port is accepted and made active, - * EC_ERROR_* otherwise. - */ -int board_set_active_charge_port(int charge_port) -{ - /* charge port is a realy physical port */ - int is_real_port = (charge_port >= 0 && - charge_port < CONFIG_USB_PD_PORT_MAX_COUNT); - /* check if we are source vbus on that port */ - int source = gpio_get_level(GPIO_USB_C0_5V_EN); - - if (is_real_port && source) { - CPRINTS("Skip enable p%d", charge_port); - return EC_ERROR_INVAL; - } - - CPRINTS("New chg p%d", charge_port); - - if (charge_port == CHARGE_PORT_NONE) { - /* Disable charging port */ - gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1); - gpio_set_level(GPIO_EC_ACDET_CTRL, 1); - } else { - /* Enable charging port */ - gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0); - gpio_set_level(GPIO_EC_ACDET_CTRL, 0); - } - - return EC_SUCCESS; -} - -/** - * Set the charge limit based upon desired maximum. - * - * @param port Port number. - * @param supplier Charge supplier type. - * @param charge_ma Desired charge limit (mA). - * @param charge_mv Negotiated charge voltage (mV). - */ -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) -{ - charge_set_input_current_limit(MAX(charge_ma, - CONFIG_CHARGER_INPUT_CURRENT), charge_mv); -} - -/** - * TODO: Remove this code after the BAT_PRESENT_L GPIO is implemented in - * the hardware. - * - * Get the battery present status. - * - * Return EC_ERROR_UNIMPLEMENTED. - */ -enum battery_present battery_is_present(void) -{ - return EC_ERROR_UNIMPLEMENTED; -} - -void board_hibernate(void) -{ - CPRINTS("Enter Pseudo G3"); - - /* - * Clean up the UART buffer and prevent any unwanted garbage characters - * before power off and also ensure above debug message is printed. - */ - cflush(); - - gpio_set_level(GPIO_EC_HIB_L, 1); - gpio_set_level(GPIO_SMC_SHUTDOWN, 1); - - /* Power to EC should shut down now */ - while (1) - ; -} diff --git a/board/strago/board.h b/board/strago/board.h deleted file mode 100644 index 8ebda12166..0000000000 --- a/board/strago/board.h +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright 2014 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. - */ - -/* Strago board configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - -/* Optional features */ -#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */ -#undef CONFIG_WATCHDOG_HELP -#define CONFIG_CLOCK_CRYSTAL -#define CONFIG_CHIPSET_BRASWELL -#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L - -#define CONFIG_BOARD_VERSION_GPIO - -#undef CONFIG_KEYBOARD_VIVALDI -#define CONFIG_KEYBOARD_COL2_INVERTED -#define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L -#undef CONFIG_KEYBOARD_KSO_BASE -#define CONFIG_KEYBOARD_KSO_BASE 4 /* KSO starts from KSO04 */ -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_LID_SWITCH -#define CONFIG_POWER_COMMON -#define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_LTO - -/* All data won't fit in data RAM. So, moving boundary slightly. */ -#undef CONFIG_RO_SIZE -#define CONFIG_RO_SIZE (104 * 1024) - -#define CONFIG_USB_CHARGER -#define CONFIG_USB_MUX_PI3USB30532 -#define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PD_TCPMV1 -#undef CONFIG_USB_PD_TCPMV1_DEBUG -#define CONFIG_USB_PD_ALT_MODE -#define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USB_PD_DP_HPD_GPIO -#define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_TCPM_TCPCI -#define CONFIG_USB_PD_TRY_SRC -#define CONFIG_USB_PD_VBUS_DETECT_GPIO -#define CONFIG_BC12_DETECT_PI3USB9281 -#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 1 -#define CONFIG_USBC_SS_MUX -#define CONFIG_USBC_SS_MUX_DFP_ONLY -#define CONFIG_USBC_VCONN - -#define CONFIG_SPI_FLASH_PORT 1 -#define CONFIG_SPI_FLASH -#define CONFIG_FLASH_SIZE 524288 -#define CONFIG_SPI_FLASH_W25Q64 - -#define CONFIG_USB_PORT_POWER_SMART -#define CONFIG_USB_PORT_POWER_SMART_SIMPLE -#define GPIO_USB1_ILIM_SEL GPIO_USB_ILIM_SEL - -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_TMP432 -#define CONFIG_DPTF - -#define CONFIG_PMIC - -#define CONFIG_ALS_ISL29035 -#define CONFIG_BATTERY_CUT_OFF -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24770 -#define CONFIG_CHARGER_ILIM_PIN_DISABLED -#define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 -#define CONFIG_CHARGER_INPUT_CURRENT 2240 -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHARGE_MANAGER -#define CONFIG_HOSTCMD_PD - -#define CONFIG_PWM -#define CONFIG_LED_COMMON - -#define CONFIG_I2C -#define CONFIG_I2C_MASTER - -/* Accelerometer */ -#define CONFIG_ACCEL_KXCJ9 -#undef CONFIG_CMD_ACCELS -#undef CONFIG_CMD_ACCEL_INFO -#undef CONFIG_CMD_ACCELSPOOF -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL -#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL - -/* Number of buttons */ -#define CONFIG_VOLUME_BUTTONS -#define GPIO_VOLUME_DOWN_L GPIO_VOLUME_DOWN -#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP - -#define CONFIG_ADC - -/* Modules we want to exclude */ -#undef CONFIG_CMD_HCDEBUG -#undef CONFIG_CMD_HASH -#undef CONFIG_CMD_HOSTCMD -#undef CONFIG_CMD_I2C_SCAN -#undef CONFIG_CMD_IDLE_STATS -#undef CONFIG_CMD_PD -#undef CONFIG_CMD_SHMEM -#undef CONFIG_CMD_TEMP_SENSOR -#undef CONFIG_CMD_TIMERINFO -#undef CONFIG_CONSOLE_CMDHELP -#undef CONFIG_CONSOLE_HISTORY -#undef CONFIG_EEPROM -#undef CONFIG_FANS -#undef CONFIG_PSTORE -#undef CONFIG_PECI -#ifndef __ASSEMBLER__ - -#include "gpio_signal.h" -#include "registers.h" - -/* I2C ports */ -#define I2C_PORT_BATTERY MEC1322_I2C0_0 -#define I2C_PORT_CHARGER MEC1322_I2C0_0 -#define I2C_PORT_ACCEL MEC1322_I2C1 -#define I2C_PORT_GYRO MEC1322_I2C1 -#define I2C_PORT_ALS MEC1322_I2C1 -#define I2C_PORT_USB_CHARGER_1 MEC1322_I2C2 -#define I2C_PORT_PD_MCU MEC1322_I2C2 -#define I2C_PORT_TCPC MEC1322_I2C2 -#define I2C_PORT_THERMAL MEC1322_I2C3 -#define I2C_PORT_USB_MUX MEC1322_I2C2 - -/* ADC signal */ -enum adc_channel { - ADC_VBUS, - /* Number of ADC channels */ - ADC_CH_COUNT -}; - -/* power signal definitions */ -enum power_signal { - X86_ALL_SYS_PWRGD = 0, - X86_RSMRST_L_PWRGD, - X86_SLP_S3_DEASSERTED, - X86_SLP_S4_DEASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -enum pwm_channel { - PWM_CH_LED_RED, - PWM_CH_LED_BLUE, - PWM_CH_LED_GREEN, - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -enum temp_sensor_id { - /* TMP432 local and remote sensors */ - TEMP_SENSOR_I2C_TMP432_LOCAL, - TEMP_SENSOR_I2C_TMP432_REMOTE1, - TEMP_SENSOR_I2C_TMP432_REMOTE2, - - /* Battery temperature sensor */ - TEMP_SENSOR_BATTERY, - - TEMP_SENSOR_COUNT -}; - -enum sensor_id { - BASE_ACCEL, - LID_ACCEL, - SENSOR_COUNT, -}; - -/* Light sensors */ -enum als_id { - ALS_ISL29035 = 0, - - ALS_COUNT, -}; - -/* TODO: determine the following board specific type-C power constants */ -/* - * delay to turn on the power supply max is ~16ms. - * delay to turn off the power supply max is about ~180ms. - */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */ - -/* Define typical operating power and max power */ -#define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_POWER_MW 60000 -#define PD_MAX_CURRENT_MA 3000 -#define PD_MAX_VOLTAGE_MV 20000 - -/* Reset PD MCU */ -void board_reset_pd_mcu(void); - -#define PORT_TO_HPD(port) (GPIO_USB_C0_DP_HPD) - -#endif /* !__ASSEMBLER__ */ - -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/strago/build.mk b/board/strago/build.mk deleted file mode 100644 index dd9dc7b3c3..0000000000 --- a/board/strago/build.mk +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# Copyright 2014 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 / external SPI is 512KB / external clock is crystal -CHIP:=mec1322 -CHIP_SPI_SIZE_KB:=512 - -board-y=board.o led.o -board-$(CONFIG_BATTERY_SMART)+=battery.o -board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o diff --git a/board/strago/ec.tasklist b/board/strago/ec.tasklist deleted file mode 100644 index 431c2b12a6..0000000000 --- a/board/strago/ec.tasklist +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2014 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. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(ALS, als_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(PDCMD, pd_command_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_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/board/strago/gpio.inc b/board/strago/gpio.inc deleted file mode 100644 index c793b582f6..0000000000 --- a/board/strago/gpio.inc +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2014 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. - */ - -/* Declare symbolic names for all the GPIOs that we care about. - * Note: Those with interrupt handlers must be declared first. */ - -GPIO_INT(PD_MCU_INT, PIN(47), GPIO_INT_FALLING | GPIO_INT_DSLEEP, pd_mcu_interrupt) -GPIO_INT(USB_C0_VBUS_WAKE_L,PIN(12), GPIO_INT_BOTH, vbus0_evt) -GPIO_INT(USB_C0_BC12_INT_L, PIN(155), GPIO_INT_FALLING, usb0_evt) -GPIO_INT(LID_OPEN, PIN(27), GPIO_INT_BOTH | GPIO_PULL_UP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, PIN(30), GPIO_INT_BOTH | GPIO_PULL_UP | GPIO_PULL_DOWN, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ -#ifdef CONFIG_BUTTON_COUNT -GPIO_INT(VOLUME_UP, PIN(31), GPIO_INT_BOTH, button_interrupt) /* Volume up button */ -GPIO_INT(VOLUME_DOWN, PIN(34), GPIO_INT_BOTH, button_interrupt) /* Volume down button */ -#endif -GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH, power_button_interrupt) /* Power button */ -GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ -GPIO_INT(ALL_SYS_PGOOD, PIN(130), GPIO_INT_BOTH, power_signal_interrupt) /* ALL_SYS_PWRGD from power logic */ -#ifdef CONFIG_LOW_POWER_IDLE -GPIO_INT(UART0_RX, PIN(162), GPIO_INT_BOTH | GPIO_PULL_UP, uart_deepsleep_interrupt) /* UART0 RX input */ -#else -GPIO_INT(UART0_RX, PIN(162), GPIO_INPUT | GPIO_PULL_UP, NULL) /* UART0 RX input */ -#endif -GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S3# signal from PCH */ - -UNIMPLEMENTED(BAT_PRESENT_L) -UNIMPLEMENTED(USB_PD_WAKE) - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP) -#define GPIO_KB_OUTPUT (GPIO_ODR_HIGH) -#define GPIO_KB_OUTPUT_COL2 (GPIO_OUT_LOW) - -GPIO(NC_GPIO0, PIN(0), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(KBD_KSO2, PIN(1), GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ - -GPIO(USB_ILIM_SEL, PIN(13), GPIO_OUT_HIGH) /* USB current control */ -GPIO(I2C_PORT0_SCL, PIN(15), GPIO_ODR_HIGH) -GPIO(I2C_PORT0_SDA, PIN(16), GPIO_ODR_HIGH) -GPIO(BOARD_VERSION3, PIN(17), GPIO_INPUT) /* BOARD_ID2 */ - -GPIO(I2C_PORT2_SCL, PIN(20), GPIO_ODR_HIGH) -GPIO(I2C_PORT2_SDA, PIN(21), GPIO_ODR_HIGH) -GPIO(I2C_PORT1_SCL, PIN(22), GPIO_ODR_HIGH) -GPIO(I2C_PORT1_SDA, PIN(23), GPIO_ODR_HIGH) -GPIO(I2C_PORT3_SCL, PIN(24), GPIO_ODR_HIGH) -GPIO(I2C_PORT3_SDA, PIN(25), GPIO_ODR_HIGH) -GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) /* SCI output */ - -#ifndef CONFIG_BUTTON_COUNT -GPIO(VOLUME_UP, PIN(31), GPIO_INPUT) /* Volume up button */ -#endif -GPIO(WP_L, PIN(33), GPIO_INPUT) /* EC_SPI_WP_ME_L */ -#ifndef CONFIG_BUTTON_COUNT -GPIO(VOLUME_DOWN, PIN(34), GPIO_INPUT) /* Volume down button */ -#endif -GPIO(USB2_ENABLE, PIN(36), GPIO_OUT_LOW) /* Enable power for USB2 Port */ - -GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) /* SMI output */ -GPIO(USB_OC1_L, PIN(45), GPIO_INT_FALLING) /* DB2 BC1.2 over current signal to EC */ -GPIO(USB_C0_DP_HPD, PIN(46), GPIO_OUT_LOW) /* DP hot plug detect from EC to SOC */ - -GPIO(USB_C0_5V_EN, PIN(50), GPIO_OUT_LOW) /* USB C0 5V enable */ -GPIO(PCH_SUS_STAT_L, PIN(51), GPIO_INT_FALLING) /* Signal to inform EC that SOC is entering low power state */ -GPIO(EC_ACDET_CTRL, PIN(52), GPIO_OUT_HIGH) /* EC AC Detect control */ -GPIO(TRACKPAD_PWREN, PIN(53), GPIO_OUT_HIGH) /* Enable power for Track Pad */ -GPIO(USB_OC0_L, PIN(55), GPIO_INT_FALLING) /* Over current signal of the BC1.2 charger to EC */ -GPIO(EC_ADC1, PIN(57), GPIO_INPUT) /* EC_ADC1, TEMP_SENSOR_2 no_stuff */ - -GPIO(EC_ADC0, PIN(61), GPIO_INPUT) /* EC_ADC0 */ -GPIO(EC_HIB_L, PIN(64), GPIO_OUT_LOW) /* Set to high before Pseduo G3 */ -GPIO(PCH_SYS_PWROK, PIN(65), GPIO_OUT_LOW) /* EC thinks everything is up and ready (DELAY_ALL_SYS_PWRGD) */ -GPIO(PCH_WAKE_L, PIN(66), GPIO_ODR_HIGH) /* PCH wake pin */ -GPIO(USB1_ENABLE, PIN(67), GPIO_OUT_LOW) /* Enable power for USB3 Port */ - -GPIO(NC_GPIO100, PIN(100), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_GPIO101, PIN(101), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_GPIO102, PIN(102), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(USB_CTL1, PIN(105), GPIO_OUT_HIGH) /* USB charging mode control */ - -GPIO(PCH_RCIN_L, PIN(110), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(NC_115, PIN(115), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(EC_VNN_VCLK, PIN(122), GPIO_INPUT | GPIO_PULL_UP) /* Interrupt from USB PD Controller to EC */ -GPIO(STRAP_L, PIN(123), GPIO_OUT_LOW) -GPIO(EC_VNN_ALERT_L, PIN(124), GPIO_INPUT | GPIO_PULL_UP) -GPIO(GYRO_INT2, PIN(127), GPIO_INPUT | GPIO_PULL_DOWN) /* Gyro sensor interrupt 2 to EC */ - -GPIO(EC_PLUG_DETECT, PIN(132), GPIO_INT_BOTH | GPIO_PULL_UP | GPIO_PULL_DOWN) -GPIO(BOARD_VERSION2, PIN(134), GPIO_INPUT) /* BOARD_ID1 */ -GPIO(PD_RST_L, PIN(135), GPIO_ODR_HIGH) /* USB PD MCU reset */ - -GPIO(THERMAL_PROBE_EN_L,PIN(140), GPIO_OUT_HIGH) -GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* RSMRST_N to PCH */ -GPIO(EC_KBD_ALERT, PIN(145), GPIO_OUT_LOW) /* EC_KBD_ALERT */ -GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ -GPIO(ALS_INT, PIN(147), GPIO_INPUT | GPIO_PULL_UP) /* ALS sensor interrupt to EC */ - -GPIO(WLAN_OFF_L, PIN(150), GPIO_ODR_HIGH) /* Wireless LAN */ -GPIO(CPU_PROCHOT, PIN(151), GPIO_OUT_LOW) -GPIO(KBD_IRQ_L, PIN(152), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -GPIO(BOARD_VERSION1, PIN(154), GPIO_INPUT) /* BOARD_ID0 */ -GPIO(PWR_BTN_SELECT, PIN(156), GPIO_ODR_HIGH) /* HIGH in clamshell mode and LOW in tablet mode */ -GPIO(PCH_SUSPWRDNACK, PIN(157), GPIO_INT_FALLING) /* PMC SUSPWRDNACK signal from SOC to EC */ - -GPIO(PCH_PWRBTN_L, PIN(160), GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(GYRO_INT1, PIN(161), GPIO_INPUT | GPIO_PULL_DOWN) /* Gyro sensor interrupt 1 to EC */ -GPIO(VP9_CODEC_RESET_L, PIN(163), GPIO_OUT_LOW) /* VP9_CODEC_RESET_L, OUTPUT, ACTIVE LOW */ - -GPIO(STARTUP_LATCH_SET, PIN(201), GPIO_OUT_HIGH) /* Output from EC to POL signal of USB Type C Mux */ -GPIO(EC_BL_DISABLE_L, PIN(202), GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ -GPIO(SMC_SHUTDOWN, PIN(203), GPIO_OUT_LOW) /* Shutdown signal from EC to power sequencing PLD */ -GPIO(USB_C0_CHARGE_EN_L,PIN(204), GPIO_OUT_LOW) - -GPIO(SUSPWRDNACK_SOC_EC,PIN(210), GPIO_OUT_LOW) /* SUSPWRDNACK signal from MOIC device to EC */ -GPIO(GPIO_3_EC, PIN(211), GPIO_OUT_LOW) /* Sleep SOIX signal from SOC to EC */ - -/* Alternate functions GPIO definition */ -ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ - -ALTERNATE(PIN_MASK(1, 0x60), 2, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0: Battery Charger */ -ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1: Temp Sensor / I2C2: SOC / I2C3: VNN */ - -ALTERNATE(PIN_MASK(0, 0xfc), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PIN_MASK(1, 0x03), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PIN_MASK(10, 0xd8), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) - -ALTERNATE(PIN_MASK(1, 0x10), 0, MODULE_LPC, GPIO_OUT_HIGH) /* 14: LPC CLKRUN - Program as GPIO for power saving */ -ALTERNATE(PIN_MASK(11, 0x9e), 1, MODULE_LPC, 0) /* 111~114:LAD[0:3], 117:PCI_CLK */ -ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ -ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* 120: LFRAME# */ - -ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) -ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) -ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ - -ALTERNATE(PIN_MASK(13, 0x48), 1, MODULE_PWM, GPIO_OUTPUT) /* 133: PWM0, 136: PWM1 */ -ALTERNATE(PIN_MASK(14, 0x02), 1, MODULE_PWM, GPIO_OUTPUT) /* 141: PWM3 */ -ALTERNATE(PIN_MASK(5, 0x40), 1, MODULE_ADC, 0) /* 56: temperature sensor 1 */ -ALTERNATE(PIN_MASK(6, 0x01), 1, MODULE_ADC, 0) /* 60: PC_MON, 62: temperature sensor 3 */ - -/* Re-Config LPC Pins to GPIO Open Drain for SOC G3 (EC - POWER_G3) state */ -ALTERNATE(PIN_MASK(1, 0x10), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 14: LPC CLKRUN */ -ALTERNATE(PIN_MASK(11, 0x9e), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 111~114:LAD[0:3], 117:PCI_CLK */ -ALTERNATE(PIN_MASK(11, 0x40), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 116: LRESET# */ -ALTERNATE(PIN_MASK(12, 0x01), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 120: LFRAME# */ - -/* FOR USBPD - GP62/ADC4 */ -ALTERNATE(PIN_MASK(6, 0x04), 1, MODULE_ADC, GPIO_ANALOG) diff --git a/board/strago/led.c b/board/strago/led.c deleted file mode 100644 index cb0c0c313f..0000000000 --- a/board/strago/led.c +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright 2015 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/Battery LED control for Strago - */ - -#include "charge_state.h" -#include "chipset.h" -#include "console.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "led_common.h" -#include "pwm.h" -#include "registers.h" -#include "util.h" - -#define CPRINTF(format, args...) cprintf(CC_PWM, format, ## args) -#define CPRINTS(format, args...) cprints(CC_PWM, format, ## args) - -#define LED_TOTAL_TICKS 16 -#define LED_ON_TICKS 4 - -static int led_debug; - -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); - -enum led_color { - LED_OFF = 0, - LED_RED, - LED_AMBER, - LED_GREEN, - - /* Number of colors, not a color itself */ - LED_COLOR_COUNT -}; - -/* Brightness vs. color, in the order of off, red, amber, and green */ -static const uint8_t color_brightness[LED_COLOR_COUNT][3] = { - /* {Red, Blue, Green}, */ - [LED_OFF] = { 0, 0, 0}, - [LED_RED] = {100, 0, 0}, - [LED_AMBER] = { 75, 0, 10}, - [LED_GREEN] = { 0, 0, 100}, -}; - -/** - * Set LED color - * - * @param color Enumerated color value - */ -static void set_color(enum led_color color) -{ - pwm_set_duty(PWM_CH_LED_RED, color_brightness[color][0]); - pwm_set_duty(PWM_CH_LED_BLUE, color_brightness[color][1]); - pwm_set_duty(PWM_CH_LED_GREEN, color_brightness[color][2]); -} - -void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) -{ - brightness_range[EC_LED_COLOR_RED] = 100; - brightness_range[EC_LED_COLOR_BLUE] = 100; - brightness_range[EC_LED_COLOR_GREEN] = 100; -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - pwm_set_duty(PWM_CH_LED_RED, brightness[EC_LED_COLOR_RED]); - pwm_set_duty(PWM_CH_LED_BLUE, brightness[EC_LED_COLOR_BLUE]); - pwm_set_duty(PWM_CH_LED_GREEN, brightness[EC_LED_COLOR_GREEN]); - return EC_SUCCESS; -} - -static void strago_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. */ - set_color( - (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)) - set_color(LED_OFF); - else if (chipset_in_state(CHIPSET_STATE_ON)) - set_color(LED_GREEN); -} - -static void strago_led_set_battery(void) -{ - static int battery_ticks; - - battery_ticks++; - - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - set_color(LED_AMBER); - break; - case PWR_STATE_ERROR: - set_color(LED_RED); - break; - case PWR_STATE_CHARGE_NEAR_FULL: - case PWR_STATE_IDLE: /* External power connected in IDLE. */ - set_color(LED_GREEN); - break; - default: - /* Other states don't alter LED behavior */ - break; - } -} - -static void led_init(void) -{ - /* - * Enable PWMs and set to 0% duty cycle. If they're disabled, - * seems to ground the pins instead of letting them float. - */ - pwm_enable(PWM_CH_LED_RED, 1); - pwm_enable(PWM_CH_LED_GREEN, 1); - pwm_enable(PWM_CH_LED_BLUE, 1); - - set_color(LED_OFF); -} -DECLARE_HOOK(HOOK_INIT, led_init, HOOK_PRIO_DEFAULT); - -/** - * Called by hook task every 250 ms - */ -static void led_tick(void) -{ - if (led_debug) - return; - - if (extpower_is_present()) { - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { - strago_led_set_battery(); - return; - } - } else if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) { - strago_led_set_power(); - return; - } - - set_color(LED_OFF); -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); - -static void dump_pwm_channels(void) -{ - int ch; - for (ch = 0; ch < 4; ch++) { - CPRINTF("channel = %d\n", ch); - CPRINTF("0x%04X 0x%04X 0x%04X\n", - MEC1322_PWM_CFG(ch), - MEC1322_PWM_ON(ch), - MEC1322_PWM_OFF(ch)); - } -} -/******************************************************************/ -/* Console commands */ -static int command_led_color(int argc, char **argv) -{ - if (argc > 1) { - if (!strcasecmp(argv[1], "debug")) { - led_debug ^= 1; - CPRINTF("led_debug = %d\n", led_debug); - } else if (!strcasecmp(argv[1], "off")) { - set_color(LED_OFF); - } else if (!strcasecmp(argv[1], "red")) { - set_color(LED_RED); - } else if (!strcasecmp(argv[1], "green")) { - set_color(LED_GREEN); - } else if (!strcasecmp(argv[1], "amber")) { - set_color(LED_AMBER); - } else { - /* maybe handle charger_discharge_on_ac() too? */ - return EC_ERROR_PARAM1; - } - } - - if (led_debug == 1) - dump_pwm_channels(); - return EC_SUCCESS; -} -DECLARE_CONSOLE_COMMAND(ledcolor, command_led_color, - "[debug|red|green|amber|off]", - "Change LED color"); - diff --git a/board/strago/lfw/gpio.inc b/board/strago/lfw/gpio.inc deleted file mode 100644 index eef2640ab6..0000000000 --- a/board/strago/lfw/gpio.inc +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2014 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. - * - * Minimal set of GPIOs needed for LFW loader - */ - -/* Declare symbolic names for all the GPIOs that we care about. - * Note: Those with interrupt handlers must be declared first. */ - -GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ - -/* Alternate functions GPIO definition */ -ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) -ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) -ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/strago/usb_pd_policy.c b/board/strago/usb_pd_policy.c deleted file mode 100644 index b44726ae96..0000000000 --- a/board/strago/usb_pd_policy.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright 2015 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 "atomic.h" -#include "charge_manager.h" -#include "common.h" -#include "console.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "registers.h" -#include "system.h" -#include "task.h" -#include "timer.h" -#include "util.h" -#include "usb_mux.h" -#include "usb_pd.h" - -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) -#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) - -int pd_set_power_supply_ready(int port) -{ - /* Disable charging */ - gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1); - - /* Provide VBUS */ - gpio_set_level(GPIO_USB_C0_5V_EN, 1); - - return EC_SUCCESS; /* we are ready */ -} - -void pd_power_supply_reset(int port) -{ - /* Disable VBUS */ - gpio_set_level(GPIO_USB_C0_5V_EN, 0); -} - -int pd_snk_is_vbus_provided(int port) -{ - return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L); -} |