summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-09-28 16:27:38 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-10 12:58:55 -0800
commit9a89170ed4878df8a04cb7d82ea3afc102179107 (patch)
treef6587e82b02fa5e75cd07e682cb1e65dcc6db93a
parentc20884cf4e1d8e059952e1e313a5a949e96be91b (diff)
downloadchrome-ec-9a89170ed4878df8a04cb7d82ea3afc102179107.tar.gz
lux: Add lux board
lux is a dual-battery poppy derivative. BRANCH=none BUG=b:67029560 TEST=make BOARD=lux -j Change-Id: I01fdb1e5e2b4803cdf7f03f9e6ee73603f84a7b8 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/845542 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
l---------board/lux1
-rw-r--r--board/poppy/base_detect_lux.c13
-rw-r--r--board/poppy/battery.c2
-rw-r--r--board/poppy/board.c10
-rw-r--r--board/poppy/board.h15
-rw-r--r--board/poppy/build.mk1
-rw-r--r--board/poppy/gpio.inc52
-rwxr-xr-xutil/flash_ec1
8 files changed, 86 insertions, 9 deletions
diff --git a/board/lux b/board/lux
new file mode 120000
index 0000000000..e61be5c7db
--- /dev/null
+++ b/board/lux
@@ -0,0 +1 @@
+poppy \ No newline at end of file
diff --git a/board/poppy/base_detect_lux.c b/board/poppy/base_detect_lux.c
new file mode 100644
index 0000000000..49192f368c
--- /dev/null
+++ b/board/poppy/base_detect_lux.c
@@ -0,0 +1,13 @@
+/* Copyright 2018 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.
+ */
+
+/* Lux base detection code */
+
+#include "gpio.h"
+
+void base_detect_interrupt(enum gpio_signal signal)
+{
+ /* TODO(b:67029560): Implement base detection for lux. */
+}
diff --git a/board/poppy/battery.c b/board/poppy/battery.c
index 30c89c24df..3f6c4e273d 100644
--- a/board/poppy/battery.c
+++ b/board/poppy/battery.c
@@ -23,7 +23,7 @@ static enum battery_present batt_pres_prev = BP_NOT_SURE;
#define SB_SHUTDOWN_DATA 0x0010
#define SB_REVIVE_DATA 0x23a7
-#ifdef BOARD_SORAKA
+#if defined(BOARD_SORAKA) || defined(BOARD_LUX)
static const struct battery_info info = {
.voltage_max = 8800,
.voltage_normal = 7700,
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 3cc8100728..0658c70ac3 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -199,6 +199,16 @@ const struct adc_t adc_channels[] = {
*/
[ADC_AMON_BMON] = {"AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT*1000/18,
ADC_READ_MAX+1, 0},
+#ifdef BOARD_LUX
+ /*
+ * ISL9238 PSYS output is 1.44 uA/W over 12.4K resistor, to read
+ * 0.8V @ 45 W, i.e. 56250 uW/mV. Using ADC_MAX_VOLT*56250 and
+ * ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
+ * only divide by 2 (enough to avoid precision issues).
+ */
+ [ADC_PSYS] = {"PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT*56250*2/(ADC_READ_MAX+1), 2, 0},
+#endif
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
diff --git a/board/poppy/board.h b/board/poppy/board.h
index 3fd10a9b20..1ac8b9237c 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -73,6 +73,14 @@
#define CONFIG_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_SMART
+#ifdef BOARD_LUX
+#define CONFIG_UART_PAD_SWITCH
+
+#define CONFIG_EC_EC_COMM_MASTER
+#define CONFIG_EC_EC_COMM_BATTERY
+#define CONFIG_CRC8
+#endif
+
/* Charger */
#define CONFIG_CHARGE_MANAGER
#define CONFIG_CHARGE_RAMP_HW /* This, or just RAMP? */
@@ -86,6 +94,10 @@
#define CONFIG_CHARGER_PSYS
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
+#ifdef BOARD_LUX
+#define CONFIG_CHARGER_OTG
+#define CONFIG_CHARGER_PSYS_READ
+#endif
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
#define CONFIG_CMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
@@ -224,6 +236,9 @@ enum adc_channel {
ADC_BASE_DET,
ADC_VBUS,
ADC_AMON_BMON,
+#ifdef BOARD_LUX
+ ADC_PSYS,
+#endif
ADC_CH_COUNT
};
diff --git a/board/poppy/build.mk b/board/poppy/build.mk
index 194869ba1b..df32a7ca8f 100644
--- a/board/poppy/build.mk
+++ b/board/poppy/build.mk
@@ -13,5 +13,6 @@ board-y=board.o
board-$(CONFIG_BATTERY_SMART)+=battery.o
board-$(CONFIG_LED_COMMON)+=led.o
board-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
+board-$(BOARD_LUX)+=base_detect_lux.o
board-$(BOARD_POPPY)+=base_detect_poppy.o
board-$(BOARD_SORAKA)+=base_detect_poppy.o
diff --git a/board/poppy/gpio.inc b/board/poppy/gpio.inc
index c4562bb7bd..dab91d4741 100644
--- a/board/poppy/gpio.inc
+++ b/board/poppy/gpio.inc
@@ -15,9 +15,13 @@ GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
/* Use VW signals instead of GPIOs */
#ifndef CONFIG_ESPI_VW_SIGNALS
+#ifdef BOARD_LUX
+GPIO_INT(PCH_SLP_S3_L, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
+#else
GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
#endif
+GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
+#endif /* !CONFIG_ESPI_VW_SIGNALS */
GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(RSMRST_L_PGOOD, PIN(B, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PMIC_DPWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
@@ -33,9 +37,16 @@ GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt)
GPIO_INT(USB_C1_VBUS_WAKE_L, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, vbus1_evt)
GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb0_evt)
GPIO_INT(USB_C1_BC12_INT_L, PIN(3, 3), GPIO_INT_FALLING, usb1_evt)
+#ifdef BOARD_LUX
+GPIO_INT(ACCELGYRO3_INT_L, PIN(7, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
+#else
GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
+#endif
GPIO_INT(BASE_DET_A, PIN(4, 5), GPIO_INT_BOTH, base_detect_interrupt)
GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
+#ifdef BOARD_LUX
+GPIO_INT(UART_MAIN_RX, PIN(6, 4), GPIO_INT_FALLING, uart_default_pad_rx_interrupt)
+#endif
GPIO(PCH_RTCRST, PIN(2, 7), GPIO_OUT_LOW) /* RTCRST# to SOC (>= rev4) */
GPIO(ENABLE_BACKLIGHT, PIN(2, 6), GPIO_OUT_LOW) /* Enable Backlight */
@@ -67,25 +78,47 @@ GPIO(PP3300_DX_SENSOR, PIN(2, 1), GPIO_OUTPUT)
GPIO(PP3300_USB_PD, PIN(2, 0), GPIO_OUTPUT)
/* end of TODO */
-GPIO(WLAN_PE_RST, PIN(1, 2), GPIO_OUTPUT)
GPIO(PP3300_DX_LTE, PIN(0, 5), GPIO_OUT_LOW)
+
+#ifndef BOARD_LUX
+GPIO(WLAN_PE_RST, PIN(1, 2), GPIO_OUTPUT)
GPIO(LTE_GPS_OFF_L, PIN(0, 0), GPIO_ODR_HIGH)
GPIO(LTE_BODY_SAR_L, PIN(0, 1), GPIO_ODR_HIGH)
-GPIO(LTE_WAKE_L, PIN(7, 1), GPIO_INPUT)
GPIO(LTE_OFF_ODL, PIN(8, 0), GPIO_ODR_LOW)
+GPIO(LTE_WAKE_L, PIN(7, 1), GPIO_INPUT)
+#endif
+
+#ifdef BOARD_LUX
+GPIO(WFCAM_VSYNC, PIN(7, 1), GPIO_INPUT)
+#endif
/* Set unused pins as Input+PU */
+#ifdef BOARD_LUX
+GPIO(TP_EC_GPIO_00, PIN(0, 0), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(TP_EC_GPIO_01, PIN(0, 1), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(TP_EC_GPIO_36, PIN(3, 6), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(TP_EC_GPIO_80, PIN(8, 0), GPIO_INPUT | GPIO_PULL_UP)
+#else
GPIO(TP_EC_GPIO_06, PIN(0, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_07, PIN(0, 7), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_10, PIN(1, 0), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_15, PIN(1, 5), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP_EC_GPIO_16, PIN(1, 6), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP_EC_GPIO_22, PIN(2, 2), GPIO_INPUT | GPIO_PULL_UP)
+#endif
+GPIO(TP_EC_GPIO_16, PIN(1, 6), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP_EC_GPIO_23, PIN(2, 3), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP_EC_GPIO_57, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP_EC_GPIO_B6, PIN(B, 6), GPIO_INPUT | GPIO_PULL_UP)
+#ifdef BOARD_LUX
+GPIO(UART_ALT_RX, PIN(1, 0), GPIO_INPUT)
+GPIO(UART_ALT_TX, PIN(1, 1), GPIO_INPUT)
+GPIO(EC_COMM_PD, PIN(1, 5), GPIO_ODR_HIGH)
+GPIO(EC_COMM_PU, PIN(0, 7), GPIO_INPUT)
+GPIO(PPVAR_VAR_BASE, PIN(1, 2), GPIO_OUT_LOW)
+#else
GPIO(PP3300_DX_BASE, PIN(1, 1), GPIO_OUT_LOW)
+GPIO(TP_EC_GPIO_07, PIN(0, 7), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(TP_EC_GPIO_10, PIN(1, 0), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(TP_EC_GPIO_15, PIN(1, 5), GPIO_INPUT | GPIO_PULL_UP)
+#endif
/* I2C pins - these will be reconfigured for alternate function below */
GPIO(I2C0_0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C0_0_USBC_3V3_SCL */
@@ -99,8 +132,11 @@ GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_I2C2_PMIC_3V3_SDA */
GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT | GPIO_SEL_1P8V) /* EC_I2C3_SENSOR_1V8_SCL */
GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* EC_I2C3_SENSOR_1V8_SDA */
-/* rev0: 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A */
+#ifdef BOARD_LUX
+GPIO(USB_C0_5V_EN, PIN(0, 6), GPIO_OUT_LOW) /* C0 5V Enable */
+#else
GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW) /* C0 5V Enable */
+#endif
GPIO(USB_C0_3A_EN, PIN(6, 6), GPIO_OUT_LOW) /* C0 Enable 3A */
GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */
GPIO(USB_C1_5V_EN, PIN(B, 1), GPIO_OUT_LOW) /* C1 5V Enable */
diff --git a/util/flash_ec b/util/flash_ec
index ae9fcbd6fb..927135ca87 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -116,6 +116,7 @@ BOARDS_NPCX_SPI=(
glkrvp
gru
kevin
+ lux
nautilus
poppy
reef