From ad3696b1ca12997f5c0ade53635b6a018ea7bc9a Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 9 Nov 2017 11:06:06 -0800 Subject: cleanup: Remove llama board The llama is a South American relative of the camel, though the llama does not have a hump. These sturdy creatures are domestic animals used by the peoples of the Andes Mountains. BUG=None TEST=`make buildall -j` BRANCH=None Change-Id: I55dbd8d5b0b14c41e27c4ef473833563f38878c3 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/761298 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Nicolas Boichat --- board/llama/battery.c | 61 --------------------- board/llama/board.c | 82 ---------------------------- board/llama/board.h | 102 ----------------------------------- board/llama/build.mk | 13 ----- board/llama/ec.tasklist | 25 --------- board/llama/gpio.inc | 78 --------------------------- board/llama/led.c | 138 ------------------------------------------------ test/build.mk | 3 -- util/flash_ec | 1 - 9 files changed, 503 deletions(-) delete mode 100644 board/llama/battery.c delete mode 100644 board/llama/board.c delete mode 100644 board/llama/board.h delete mode 100644 board/llama/build.mk delete mode 100644 board/llama/ec.tasklist delete mode 100644 board/llama/gpio.inc delete mode 100644 board/llama/led.c diff --git a/board/llama/battery.c b/board/llama/battery.c deleted file mode 100644 index b3c2d53210..0000000000 --- a/board/llama/battery.c +++ /dev/null @@ -1,61 +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. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" -#include "i2c.h" -#include "util.h" - -/* Shutdown mode parameter to write to manufacturer access register */ -#define PARAM_CUT_OFF_LOW 0x10 -#define PARAM_CUT_OFF_HIGH 0x00 - -static const struct battery_info info = { - .voltage_max = 8700, - .voltage_normal = 7600, - .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; -} - -static int cutoff(void) -{ - int rv; - uint8_t buf[3]; - - /* Ship mode command must be sent twice to take effect */ - 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); - - return rv; -} - -int board_cut_off_battery(void) -{ - return cutoff(); -} diff --git a/board/llama/board.c b/board/llama/board.c deleted file mode 100644 index f7a5c869b2..0000000000 --- a/board/llama/board.c +++ /dev/null @@ -1,82 +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. - */ -/* llama board configuration */ - -#include "battery.h" -#include "charger.h" -#include "chipset.h" -#include "common.h" -#include "console.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "i2c.h" -#include "keyboard_raw.h" -#include "lid_switch.h" -#include "power.h" -#include "power_button.h" -#include "pwm.h" -#include "pwm_chip.h" -#include "registers.h" -#include "spi.h" -#include "task.h" -#include "util.h" - -#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args) - -#include "gpio_list.h" - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_SOC_POWER_GOOD_L, POWER_SIGNAL_ACTIVE_LOW, "POWER_GOOD#"}, - {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"}, -}; - -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -#ifdef CONFIG_PWM -/* 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); -#endif - -#ifdef CONFIG_I2C -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - {"master", I2C_PORT_MASTER, 100, GPIO_MASTER_I2C_SCL, - GPIO_MASTER_I2C_SDA}, -#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR - {"slave", I2C_PORT_SLAVE, 100, GPIO_SLAVE_I2C_SCL, GPIO_SLAVE_I2C_SDA} -#endif -}; - -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -#endif - -void board_config_pre_init(void) -{ - /* enable SYSCFG clock */ - STM32_RCC_APB2ENR |= 1 << 0; - - /* Remap USART DMA to match the USART driver */ - /* - * the DMA mapping is : - * Chan 2 : TIM1_CH1 - * Chan 3 : SPI1_TX - * Chan 4 : USART1_TX - * Chan 5 : USART1_RX - */ - STM32_SYSCFG_CFGR1 |= (1 << 9) | (1 << 10); /* Remap USART1 RX/TX DMA */ -} - -void board_set_ap_reset(int asserted) -{ - gpio_set_level(GPIO_AP_RESET_H, asserted); -} diff --git a/board/llama/board.h b/board/llama/board.h deleted file mode 100644 index 4a6503b851..0000000000 --- a/board/llama/board.h +++ /dev/null @@ -1,102 +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. - */ - -/* llama board configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - -#define CONFIG_CHIPSET_MEDIATEK -/* Add for AC adaptor, charger, battery */ -#define CONFIG_BATTERY_CUT_OFF -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_PRE_INIT -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24715 -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHARGER_V2 -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_FORCE_CONSOLE_RESUME -#define CONFIG_HOST_COMMAND_STATUS -#define CONFIG_I2C -#define CONFIG_I2C_MASTER -#define CONFIG_KEYBOARD_COL2_INVERTED -#define CONFIG_KEYBOARD_PROTOCOL_MKBP -#define CONFIG_LED_COMMON -#define CONFIG_LOW_POWER_IDLE -#define CONFIG_FORCE_CONSOLE_RESUME -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_COMMON -/* #define CONFIG_PWM */ -#define CONFIG_SPI -#define CONFIG_STM_HWTIMER32 -#define CONFIG_VBOOT_HASH -#undef CONFIG_WATCHDOG_HELP -#define CONFIG_LID_SWITCH -#define CONFIG_SWITCH -#define CONFIG_BOARD_VERSION -#undef CONFIG_UART_CONSOLE -#define CONFIG_UART_CONSOLE 1 - -/* Hibernate is not supported on STM32F0.*/ -#undef CONFIG_HIBERNATE -/* #define CONFIG_HIBERNATE_WAKEUP_PINS STM32_PWR_CSR_EWUP1 */ - -/* - * Allow dangerous commands all the time, since we don't have a write protect - * switch. - */ -#define CONFIG_SYSTEM_UNLOCKED - -#define CONFIG_PMIC_FW_LONG_PRESS_TIMER -/* Optional features */ -/* #define CONFIG_HW_CRC */ -#define CONFIG_CMD_HOSTCMD - -#ifndef __ASSEMBLER__ - -/* 48 MHz SYSCLK clock frequency */ -#define CPU_CLOCK 48000000 - -/* 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_CLOCK32 2 -#define TIM_WATCHDOG 4 - -#include "gpio_signal.h" - -enum power_signal { - MTK_POWER_GOOD = 0, - MTK_SUSPEND_ASSERTED, - /* Number of power signals */ - POWER_SIGNAL_COUNT -}; - -enum pwm_channel { - PWM_CH_POWER_LED = 0, - /* Number of PWM channels */ - PWM_CH_COUNT -}; - -/* Charger module */ -/* Charge sense resistor */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* mOhm */ -/* Input sensor resistor */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* mOhm */ -#define CONFIG_CHARGER_INPUT_CURRENT 2150 /* mA */ - -/* Set AP reset pin according to parameter */ -void board_set_ap_reset(int asserted); - -#endif /* !__ASSEMBLER__ */ - -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/llama/build.mk b/board/llama/build.mk deleted file mode 100644 index 1247589da1..0000000000 --- a/board/llama/build.mk +++ /dev/null @@ -1,13 +0,0 @@ -#-*- makefile -*- -#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. -# -#Board specific files build - -#the IC is STmicro STM32F071RB -CHIP := stm32 -CHIP_FAMILY := stm32f0 -CHIP_VARIANT:= stm32f07x - -board-y = board.o battery.o led.o diff --git a/board/llama/ec.tasklist b/board/llama/ec.tasklist deleted file mode 100644 index b85777b97f..0000000000 --- a/board/llama/ec.tasklist +++ /dev/null @@ -1,25 +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. - */ - -/** - * 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, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_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/llama/gpio.inc b/board/llama/gpio.inc deleted file mode 100644 index 96cf7652b3..0000000000 --- a/board/llama/gpio.inc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- mode:c -*- - * - * 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. - */ - -/* Declare symbolic names for all the GPIOs that we care about. - * Note: Those with interrupt handlers must be declared first. */ - -GPIO_INT(AC_PRESENT, PIN(A, 0), GPIO_INT_BOTH, extpower_interrupt) /* AC power present: PA 0 */ -GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* Keyboard power button: PB 5 */ -GPIO_INT(SOC_POWER_GOOD_L, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ -GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) /* AP suspend/resume state */ - -/* Keyboard inputs */ -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) -#define GPIO_KB_OUTPUT GPIO_ODR_HIGH - -GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) - -/* SPI Chip Select */ -GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) - -GPIO(5V_GOOD_L, PIN(A, 1), GPIO_INT_BOTH) -GPIO(AP_RESET_H, PIN(B, 3), GPIO_OUT_LOW) -GPIO(BOARD_VERSION1, PIN(C, 6), GPIO_INPUT|GPIO_PULL_UP) /* Board version stuffing resistor 1 */ - - -/* Outputs */ -GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) /* LED_GREEN */ -GPIO(BAT_LED1, PIN(A, 11), GPIO_OUT_LOW) /* LED_ORANGE */ -GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW) -GPIO(EC_INT_L, PIN(B, 9), GPIO_OUT_HIGH) -GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW) -GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) -GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) -GPIO(KB_OUT02, PIN(B, 12), GPIO_OUT_LOW) /* KSO2 is inverted */ -GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) -GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) -GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) -GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) -GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) -GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) -GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) -GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) -GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) -GPIO(KB_OUT12, PIN(A, 14), GPIO_KB_OUTPUT) -GPIO(SYSTEM_POWER_H, PIN(B, 10), GPIO_OUT_LOW) -GPIO(PMIC_PWRON_H, PIN(A, 12), GPIO_OUT_LOW) -GPIO(PMIC_WARM_RESET_H, PIN(C, 3), GPIO_ODR_LOW) - -/* - * I2C pins should be configured as inputs until I2C module is - * initialized. This will avoid driving the lines unintentionally. - */ -GPIO(MASTER_I2C_SCL, PIN(B, 6), GPIO_INPUT) -GPIO(MASTER_I2C_SDA, PIN(B, 7), GPIO_INPUT) - -/* Unimplemented signals which we need to emulate for now */ -/* UNIMPLEMENTED(ENTERING_RW) */ -UNIMPLEMENTED(WP_L) -UNIMPLEMENTED(BOARD_VERSION2) -UNIMPLEMENTED(BOARD_VERSION3) -UNIMPLEMENTED(5V_POWER_GOOD) -UNIMPLEMENTED(AP_RESET_L) - -ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ -ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) /* I2C MASTER:PB6/7 */ -ALTERNATE(PIN_MASK(A, 0x00f0), 0, MODULE_SPI, 0) /* SPI SLAVE:PA4/5/6/7 */ diff --git a/board/llama/led.c b/board/llama/led.c deleted file mode 100644 index fd86cab223..0000000000 --- a/board/llama/led.c +++ /dev/null @@ -1,138 +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. - * - * Battery LED and Power LED control for LLAMA Board. - */ - -#include "battery.h" -#include "charge_state.h" -#include "chipset.h" -#include "gpio.h" -#include "hooks.h" -#include "led_common.h" -#include "util.h" - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED -}; - -const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); - -enum led_color { - LED_GREEN = 0, - LED_ORANGE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ -}; - -static int bat_led_set(enum led_color color, int on) -{ - switch (color) { - case LED_GREEN: - gpio_set_level(GPIO_BAT_LED0, on ? 0 : 1); - break; - case LED_ORANGE: - gpio_set_level(GPIO_BAT_LED1, on ? 0 : 1); - break; - default: - return EC_ERROR_UNKNOWN; - } - 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_GREEN] = 1; - brightness_range[EC_LED_COLOR_YELLOW] = 1; -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - if (EC_LED_ID_BATTERY_LED == led_id) { - if (brightness[EC_LED_COLOR_GREEN] != 0) { - bat_led_set(LED_GREEN, 1); - bat_led_set(LED_ORANGE, 0); - } else if (brightness[EC_LED_COLOR_YELLOW] != 0) { - bat_led_set(LED_GREEN, 1); - bat_led_set(LED_ORANGE, 1); - } else { - bat_led_set(LED_GREEN, 0); - bat_led_set(LED_ORANGE, 0); - } - return EC_SUCCESS; - } else { - return EC_ERROR_UNKNOWN; - } -} - -static void llama_led_set_power(void) -{ - static int power_second; - - power_second++; - - /* PWR LED behavior: - * Power on: Green - * Suspend: Green in breeze mode ( 1 sec on/ 3 sec off) - * Power off: OFF - */ - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - bat_led_set(LED_GREEN, 0); - else if (chipset_in_state(CHIPSET_STATE_ON)) - bat_led_set(LED_GREEN, 1); - else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) - bat_led_set(LED_GREEN, (power_second & 3) ? 0 : 1); -} - -static void llama_led_set_battery(void) -{ - static int battery_second; - - battery_second++; - - /* BAT LED behavior: - * Fully charged / idle: Off - * Under charging: Orange - * Battery low (10%): Orange in breeze mode (1 sec on, 3 sec off) - * Battery critical low (less than 3%) or abnormal battery - * situation: Orange in blinking mode (1 sec on, 1 sec off) - * Using battery or not connected to AC power: OFF - */ - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - bat_led_set(LED_ORANGE, 1); - break; - case PWR_STATE_CHARGE_NEAR_FULL: - bat_led_set(LED_ORANGE, 1); - break; - case PWR_STATE_DISCHARGE: - if (charge_get_percent() < 3) - bat_led_set(LED_ORANGE, (battery_second & 1) ? 0 : 1); - else if (charge_get_percent() < 10) - bat_led_set(LED_ORANGE, (battery_second & 3) ? 0 : 1); - else - bat_led_set(LED_ORANGE, 0); - break; - case PWR_STATE_ERROR: - bat_led_set(LED_ORANGE, (battery_second & 1) ? 0 : 1); - break; - case PWR_STATE_IDLE: /* External power connected in IDLE. */ - bat_led_set(LED_ORANGE, 0); - break; - default: - /* Other states don't alter LED behavior */ - break; - } -} - -/** * Called by hook task every 1 sec */ -static void led_second(void) -{ - if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - llama_led_set_power(); - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) - llama_led_set_battery(); -} - -DECLARE_HOOK(HOOK_SECOND, led_second, HOOK_PRIO_DEFAULT); diff --git a/test/build.mk b/test/build.mk index ed22aea4d5..9c5dd53349 100644 --- a/test/build.mk +++ b/test/build.mk @@ -17,9 +17,6 @@ test-list-$(BOARD_HAMMER)+=entropy # compile with it. Disable them for now. test-list-$(BOARD_SAMUS)= -# llama has issues when building tests -test-list-$(BOARD_LLAMA)= - # So does Cr50 test-list-$(BOARD_CR50)= diff --git a/util/flash_ec b/util/flash_ec index 9ba3f4a659..d19aa0508d 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -65,7 +65,6 @@ BOARDS_STM32=( honeybuns jerry kitty - llama minimuffin oak oak_pd -- cgit v1.2.1