summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorKoro Chen <koro.chen@mediatek.com>2016-04-07 13:53:13 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-04-25 09:01:36 -0700
commit37c577cbfbc54f98c15ee8003b24e75eb9dd8f9a (patch)
tree8b5d7aa383ef5112831b486f80e9cb9d5bcd0736 /board
parent28827163c57390278a54ee10153c064cd6c18133 (diff)
downloadchrome-ec-37c577cbfbc54f98c15ee8003b24e75eb9dd8f9a.tar.gz
elm: modifications for EVT
This add modifications for EVT, including: - Use SPI for KX022 motion sensor on the daughterboard - remove TMP432 - Use PF2 to control the external power of ANX7688 BRANCH=none BUG=chrome-os-partner:52245 TEST=make BOARD=elm -j Change-Id: I7d4021746bc8a2be0028076a5c3aeefd8736c1b0 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/337338 Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/elm/battery.c7
-rw-r--r--board/elm/board.c26
-rw-r--r--board/elm/board.h4
-rw-r--r--board/elm/gpio.inc4
4 files changed, 25 insertions, 16 deletions
diff --git a/board/elm/battery.c b/board/elm/battery.c
index 4be0462efd..3fb5ac4e73 100644
--- a/board/elm/battery.c
+++ b/board/elm/battery.c
@@ -16,12 +16,7 @@
static const struct battery_info info = {
.voltage_max = 13050,
.voltage_normal = 11400,
- /*
- * TODO(crosbug.com/p/44428):
- * Support 2S battery for dev board.
- * Should set voltage_min to 9V, when 2S battery phased out.
- */
- .voltage_min = 6000,
+ .voltage_min = 9000,
/* Pre-charge values. */
.precharge_current = 256, /* mA */
diff --git a/board/elm/board.c b/board/elm/board.c
index d772d7e372..a1bf08f3e9 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -106,7 +106,8 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_ACCEL_PORT, 2, GPIO_SPI2_NSS }
+ { CONFIG_SPI_ACCEL_PORT, 2, GPIO_SPI2_NSS },
+ { CONFIG_SPI_ACCEL_PORT, 2, GPIO_SPI2_NSS_DB }
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
@@ -130,12 +131,14 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
* src/mainboard/google/${board}/acpi/dptf.asl
*/
const struct temp_sensor_t temp_sensors[] = {
+#ifdef CONFIG_TEMP_SENSOR_TMP432
{"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_LOCAL, 4},
{"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_REMOTE1, 4},
{"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_REMOTE2, 4},
+#endif
{"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val,
0, 4},
};
@@ -146,9 +149,11 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
* same order as enum temp_sensor_id. To always ignore any temp, use 0.
*/
struct ec_thermal_config thermal_params[] = {
+#ifdef CONFIG_TEMP_SENSOR_TMP432
{{0, 0, 0}, 0, 0}, /* TMP432_Internal */
{{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */
{{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */
+#endif
{{0, 0, 0}, 0, 0}, /* Battery Sensor */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
@@ -229,19 +234,18 @@ static void board_init(void)
/* Update VBUS supplier */
usb_charger_vbus_change(0, !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L));
- /* SPI sensors: put back the GPIO in its expected state */
- gpio_set_level(GPIO_SPI2_NSS, 1);
-
/* Remap SPI2 to DMA channels 6 and 7 */
REG32(STM32_DMA1_BASE + 0xa8) |= (1 << 20) | (1 << 21) |
(1 << 24) | (1 << 25);
- /* Enable SPI for BMI160 */
+ /* Enable SPI for KX022 */
gpio_config_module(MODULE_SPI_MASTER, 1);
/* Set all four SPI pins to high speed */
/* pins D0/D1/D3/D4 */
STM32_GPIO_OSPEEDR(GPIO_D) |= 0x000003cf;
+ /* pins F6 */
+ STM32_GPIO_OSPEEDR(GPIO_F) |= 0x00003000;
/* Enable clocks to SPI2 module */
STM32_RCC_APB1ENR |= STM32_RCC_PB1_SPI2;
@@ -412,6 +416,7 @@ void board_set_ap_reset(int asserted)
gpio_set_level(GPIO_AP_RESET_L, !asserted);
}
+#ifdef CONFIG_TEMP_SENSOR_TMP432
static void tmp432_set_power_deferred(void)
{
/* Shut tmp432 down if not in S0 && no external power */
@@ -426,6 +431,7 @@ static void tmp432_set_power_deferred(void)
CPRINTS("ERROR: Can't turn on TMP432.");
}
DECLARE_DEFERRED(tmp432_set_power_deferred);
+#endif
/**
* Hook of AC change. turn on/off tmp432 depends on AP & AC status.
@@ -433,7 +439,9 @@ DECLARE_DEFERRED(tmp432_set_power_deferred);
static void board_extpower(void)
{
board_extpower_buffer_to_soc();
+#ifdef CONFIG_TEMP_SENSOR_TMP432
hook_call_deferred(&tmp432_set_power_deferred_data, 0);
+#endif
}
DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
@@ -456,14 +464,18 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+#ifdef CONFIG_TEMP_SENSOR_TMP432
hook_call_deferred(&tmp432_set_power_deferred_data, 0);
+#endif
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+#ifdef CONFIG_TEMP_SENSOR_TMP432
hook_call_deferred(&tmp432_set_power_deferred_data, 0);
+#endif
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
@@ -495,7 +507,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[0],
.drv_data = &g_kx022_data[0],
- .addr = 1, /* SPI */
+ .addr = 1, /* SPI, device ID 0 */
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.config = {
@@ -529,7 +541,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &kionix_accel_drv,
.mutex = &g_kx022_mutex[1],
.drv_data = &g_kx022_data[1],
- .addr = KX022_ADDR0,
+ .addr = 3, /* SPI, device ID 1 */
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
.config = {
diff --git a/board/elm/board.h b/board/elm/board.h
index 29569d5d36..0d50d10944 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -74,7 +74,6 @@
#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_TMP432
/* Type-C */
#define CONFIG_USBC_SS_MUX
@@ -169,11 +168,12 @@ enum adc_channel {
};
enum temp_sensor_id {
+#ifdef CONFIG_TEMP_SENSOR_TMP432
/* TMP432 local and remote sensors */
TEMP_SENSOR_I2C_TMP432_LOCAL,
TEMP_SENSOR_I2C_TMP432_REMOTE1,
TEMP_SENSOR_I2C_TMP432_REMOTE2,
-
+#endif
/* Battery temperature sensor */
TEMP_SENSOR_BATTERY,
diff --git a/board/elm/gpio.inc b/board/elm/gpio.inc
index 0488d5f405..dda09cc6e1 100644
--- a/board/elm/gpio.inc
+++ b/board/elm/gpio.inc
@@ -81,6 +81,7 @@ GPIO(USB_C0_5V_EN, PIN(D, 8), GPIO_OUT_LOW) /* USBC port 0 5V */
GPIO(USB_C0_CHARGE_L, PIN(D, 9), GPIO_OUT_LOW) /* USBC port 0 charge */
GPIO(USB_C0_RST, PIN(D, 10), GPIO_OUT_LOW) /* ANX7688 reset */
GPIO(USB_C0_PWR_EN_L, PIN(B, 15), GPIO_OUT_LOW) /* ANX7688 power enable */
+GPIO(USB_C0_EXTPWR_EN, PIN(F, 2), GPIO_OUT_HIGH) /* ANX7688 3.3V ext power enable */
GPIO(USB_DP_HPD, PIN(F, 3), GPIO_OUT_LOW)
GPIO(EN_TP_INT_L, PIN(E, 14), GPIO_OUT_LOW) /* touchpad interrupt enable */
@@ -99,7 +100,8 @@ GPIO(I2C1_SCL, PIN(B, 13), GPIO_INPUT) /* PD I2C */
GPIO(I2C1_SDA, PIN(B, 14), GPIO_INPUT)
/* SPI MASTER. For SPI sensor */
-GPIO(SPI2_NSS, PIN(D, 0), GPIO_OUT_HIGH)
+GPIO(SPI2_NSS, PIN(D, 0), GPIO_OUT_HIGH) /* mainboard */
+GPIO(SPI2_NSS_DB, PIN(F, 6), GPIO_OUT_HIGH) /* daughterboard */
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 */