summaryrefslogtreecommitdiff
path: root/board/snow/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/snow/board.c')
-rw-r--r--board/snow/board.c202
1 files changed, 0 insertions, 202 deletions
diff --git a/board/snow/board.c b/board/snow/board.c
deleted file mode 100644
index c356378fb1..0000000000
--- a/board/snow/board.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.
- */
-/* 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)
-
-#include "gpio_list.h"
-
-/* 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, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
-};
-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;
-}