summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Chao <scott_chao@wistron.corp-partner.google.com>2021-06-11 14:26:50 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-16 02:30:39 +0000
commit9f540598b57f5305e13b1f9cccad21bad0fb7f4e (patch)
tree982623d8edaad9c51e6e94740d110b01f1d2eac5
parentdc08f0db223b2c2543168a5062047f515ea19daa (diff)
downloadchrome-ec-9f540598b57f5305e13b1f9cccad21bad0fb7f4e.tar.gz
primus: Enable PS/2 Mouse
BUG=b:187969783 BRANCH=none TEST=make buildall Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: I99a72393dbe732bcab51a02278b0c372239f895c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2952804 Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com>
-rw-r--r--board/primus/board.h5
-rw-r--r--board/primus/build.mk1
-rw-r--r--board/primus/gpio.inc4
-rw-r--r--board/primus/ps2.c19
4 files changed, 29 insertions, 0 deletions
diff --git a/board/primus/board.h b/board/primus/board.h
index 3e59d9ee9f..01961b632d 100644
--- a/board/primus/board.h
+++ b/board/primus/board.h
@@ -164,6 +164,11 @@
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+/* PS2 defines */
+#define CONFIG_8042_AUX
+#define CONFIG_PS2
+#define CONFIG_CMD_PS2
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h" /* needed by registers.h */
diff --git a/board/primus/build.mk b/board/primus/build.mk
index b75a75e6a6..b2f1423b1f 100644
--- a/board/primus/build.mk
+++ b/board/primus/build.mk
@@ -20,6 +20,7 @@ board-y+=i2c.o
board-y+=keyboard.o
board-y+=led.o
board-y+=pwm.o
+board-y+=ps2.o
board-y+=sensors.o
board-y+=tune_mp2964.o
board-y+=usbc_config.o
diff --git a/board/primus/gpio.inc b/board/primus/gpio.inc
index 670ddc5938..513045a11c 100644
--- a/board/primus/gpio.inc
+++ b/board/primus/gpio.inc
@@ -116,6 +116,10 @@ ALTERNATE(PIN_MASK(0, 0x01), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH)
ALTERNATE(PIN_MASK(0, 0x02), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_LOW) /* GPIO01/PSL_IN3_L&GPI01 */
ALTERNATE(PIN_MASK(D, 0x04), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH) /* PSL_IN1_L&GPID2/GPIOD2 */
+/* PS2 function */
+/* PS/2 channel 1 for aux device */
+ALTERNATE(PIN_MASK(6, 0x0C), 0, MODULE_PS2, 0) /* PS2_CLK1/GPIO62, PS2_DAT1/GPIO63 */
+
/* Unused Pins */
UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
diff --git a/board/primus/ps2.c b/board/primus/ps2.c
new file mode 100644
index 0000000000..2a605b37e5
--- /dev/null
+++ b/board/primus/ps2.c
@@ -0,0 +1,19 @@
+/* Copyright 2021 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 "hooks.h"
+#include "keyboard_8042.h"
+#include "ps2_chip.h"
+
+void send_aux_data_to_device(uint8_t data)
+{
+ ps2_transmit_byte(NPCX_PS2_CH1, data);
+}
+
+static void board_init(void)
+{
+ ps2_enable_channel(NPCX_PS2_CH1, 1, send_aux_data_to_host_interrupt);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);