1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 21df49e27Swdenk /* 31df49e27Swdenk * (C) Copyright 2002 ELTEC Elektronik AG 41df49e27Swdenk * Frank Gottschling <fgottschling@eltec.de> 51df49e27Swdenk */ 61df49e27Swdenk 71df49e27Swdenk /* i8042.h - Intel 8042 keyboard driver header */ 81df49e27Swdenk 91df49e27Swdenk #ifndef _I8042_H_ 101df49e27Swdenk #define _I8042_H_ 111df49e27Swdenk 121df49e27Swdenk /* defines */ 131df49e27Swdenk 14835dd000SBin Meng #define I8042_DATA_REG 0x60 /* keyboard i/o buffer */ 15835dd000SBin Meng #define I8042_STS_REG 0x64 /* keyboard status read */ 16835dd000SBin Meng #define I8042_CMD_REG 0x64 /* keyboard ctrl write */ 171df49e27Swdenk 18835dd000SBin Meng /* Status register bit defines */ 19835dd000SBin Meng #define STATUS_OBF (1 << 0) 20835dd000SBin Meng #define STATUS_IBF (1 << 1) 21835dd000SBin Meng 22835dd000SBin Meng /* Configuration byte bit defines */ 23835dd000SBin Meng #define CONFIG_KIRQ_EN (1 << 0) 24835dd000SBin Meng #define CONFIG_MIRQ_EN (1 << 1) 25835dd000SBin Meng #define CONFIG_SET_BIST (1 << 2) 26835dd000SBin Meng #define CONFIG_KCLK_DIS (1 << 4) 27835dd000SBin Meng #define CONFIG_MCLK_DIS (1 << 5) 28835dd000SBin Meng #define CONFIG_AT_TRANS (1 << 6) 29835dd000SBin Meng 30835dd000SBin Meng /* i8042 commands */ 31835dd000SBin Meng #define CMD_RD_CONFIG 0x20 /* read configuration byte */ 32835dd000SBin Meng #define CMD_WR_CONFIG 0x60 /* write configuration byte */ 33835dd000SBin Meng #define CMD_SELF_TEST 0xaa /* controller self-test */ 34835dd000SBin Meng #define CMD_KBD_DIS 0xad /* keyboard disable */ 35835dd000SBin Meng #define CMD_KBD_EN 0xae /* keyboard enable */ 36835dd000SBin Meng #define CMD_SET_KBD_LED 0xed /* set keyboard led */ 378226a3e9SSimon Glass #define CMD_DRAIN_OUTPUT 0xf4 /* drain output buffer */ 38835dd000SBin Meng #define CMD_RESET_KBD 0xff /* reset keyboard */ 39835dd000SBin Meng 40835dd000SBin Meng /* i8042 command result */ 41835dd000SBin Meng #define KBC_TEST_OK 0x55 42835dd000SBin Meng #define KBD_ACK 0xfa 43835dd000SBin Meng #define KBD_POR 0xaa 44835dd000SBin Meng 45835dd000SBin Meng /* keyboard scan codes */ 46ef94f7faSGabe Black 471df49e27Swdenk #define KBD_US 0 /* default US layout */ 481df49e27Swdenk #define KBD_GER 1 /* german layout */ 491df49e27Swdenk 501df49e27Swdenk #define KBD_TIMEOUT 1000 /* 1 sec */ 511df49e27Swdenk #define KBD_RESET_TRIES 3 521df49e27Swdenk 531df49e27Swdenk #define AS 0 /* normal character index */ 541df49e27Swdenk #define SH 1 /* shift index */ 551df49e27Swdenk #define CN 2 /* control index */ 561df49e27Swdenk #define NM 3 /* numeric lock index */ 571df49e27Swdenk #define AK 4 /* right alt key */ 581df49e27Swdenk #define CP 5 /* capslock index */ 591df49e27Swdenk #define ST 6 /* stop output index */ 601df49e27Swdenk #define EX 7 /* extended code index */ 611df49e27Swdenk #define ES 8 /* escape and extended code index */ 621df49e27Swdenk 631df49e27Swdenk #define NORMAL 0x0000 /* normal key */ 641df49e27Swdenk #define STP 0x0001 /* scroll lock stop output*/ 651df49e27Swdenk #define NUM 0x0002 /* numeric lock */ 661df49e27Swdenk #define CAPS 0x0004 /* capslock */ 671df49e27Swdenk #define SHIFT 0x0008 /* shift */ 681df49e27Swdenk #define CTRL 0x0010 /* control*/ 691df49e27Swdenk #define EXT 0x0020 /* extended scan code 0xe0 */ 701df49e27Swdenk #define ESC 0x0040 /* escape key press */ 711df49e27Swdenk #define E1 0x0080 /* extended scan code 0xe1 */ 721df49e27Swdenk #define BRK 0x0100 /* make break flag for keyboard */ 731df49e27Swdenk #define ALT 0x0200 /* right alt */ 741df49e27Swdenk 751df49e27Swdenk #endif /* _I8042_H_ */ 76