diff options
author | CHLin <CHLIN56@nuvoton.com> | 2020-01-16 15:58:02 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-30 11:49:39 +0000 |
commit | 41614aba60ca77cd566b9bf29494aaf562225292 (patch) | |
tree | 7169b6081ffd829b78bfa4ab7f736150b8b4f936 /chip/npcx/lpc.c | |
parent | 0171ea4e6b23cf0c54e83fe3c2272ed30dc28c8d (diff) | |
download | chrome-ec-41614aba60ca77cd566b9bf29494aaf562225292.tar.gz |
npcx: enable the host interface mouse channel
In Morphius, the trackpoint data is passed through EC to the host by the
legacy ports (60h/64h). In this CL, we enable the host interface mouse
channel (LDN = 05h). Mouse interrupt (IRQ 12) will be asserted when the
trackpoint data is written to the HIMDO register. It will be de-asserted
once the host reads the data via IO port 60h.
BUG=b:145575366
BRANCH=none
TEST=No error for "make buildall"
TEST=Apply this and related CL, connect npcx EVB to host emulator.
Execute console command "kbcmouse data". Make sure the host can see IRQ12
and read correct data from IO port 60h.
Change-Id: I4a4e9fb6c079c164b6a5e617587dd2f2cdf55164
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2003002
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Diffstat (limited to 'chip/npcx/lpc.c')
-rw-r--r-- | chip/npcx/lpc.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c index 09dc8c7f20..18b464f294 100644 --- a/chip/npcx/lpc.c +++ b/chip/npcx/lpc.c @@ -299,7 +299,7 @@ int lpc_keyboard_input_pending(void) return (NPCX_HIKMST&0x02) ? 1 : 0; } -/* Put a char to host buffer and send IRQ if specified. */ +/* Put a char to host buffer by HIKDO and send IRQ if specified. */ void lpc_keyboard_put_char(uint8_t chr, int send_irq) { NPCX_HIKDO = chr; @@ -313,6 +313,17 @@ void lpc_keyboard_put_char(uint8_t chr, int send_irq) } } +/* Put a char to host buffer by HIMDO */ +void lpc_mouse_put_char(uint8_t chr) +{ + NPCX_HIMDO = chr; + CPRINTS("Mouse put %02x", chr); + + /* Enable OBE interrupt to detect host read data out */ + SET_BIT(NPCX_HICTRL, NPCX_HICTRL_OBECIE); + task_enable_irq(NPCX_IRQ_KBC_OBE); +} + void lpc_keyboard_clear_buffer(void) { /* @@ -586,10 +597,17 @@ void host_register_init(void) sib_write_reg(SIO_OFFSET, 0x07, 0x11); sib_write_reg(SIO_OFFSET, 0x30, 0x01); - /* enable KBC*/ + /* Enable kbc and mouse */ #ifdef HAS_TASK_KEYPROTO + /* LDN = 0x06 : keyboard */ sib_write_reg(SIO_OFFSET, 0x07, 0x06); sib_write_reg(SIO_OFFSET, 0x30, 0x01); + + /* LDN = 0x05 : mouse */ + if (IS_ENABLED(CONFIG_PS2)) { + sib_write_reg(SIO_OFFSET, 0x07, 0x05); + sib_write_reg(SIO_OFFSET, 0x30, 0x01); + } #endif /* Setting PMC2 */ |