18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci#ifndef _I8042_SNIRM_H 38c2ecf20Sopenharmony_ci#define _I8042_SNIRM_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/sni.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* 98c2ecf20Sopenharmony_ci * Names. 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define I8042_KBD_PHYS_DESC "onboard/serio0" 138c2ecf20Sopenharmony_ci#define I8042_AUX_PHYS_DESC "onboard/serio1" 148c2ecf20Sopenharmony_ci#define I8042_MUX_PHYS_DESC "onboard/serio%d" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * IRQs. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_cistatic int i8042_kbd_irq; 208c2ecf20Sopenharmony_cistatic int i8042_aux_irq; 218c2ecf20Sopenharmony_ci#define I8042_KBD_IRQ i8042_kbd_irq 228c2ecf20Sopenharmony_ci#define I8042_AUX_IRQ i8042_aux_irq 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistatic void __iomem *kbd_iobase; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define I8042_COMMAND_REG (kbd_iobase + 0x64UL) 278c2ecf20Sopenharmony_ci#define I8042_DATA_REG (kbd_iobase + 0x60UL) 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic inline int i8042_read_data(void) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci return readb(kbd_iobase + 0x60UL); 328c2ecf20Sopenharmony_ci} 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic inline int i8042_read_status(void) 358c2ecf20Sopenharmony_ci{ 368c2ecf20Sopenharmony_ci return readb(kbd_iobase + 0x64UL); 378c2ecf20Sopenharmony_ci} 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_cistatic inline void i8042_write_data(int val) 408c2ecf20Sopenharmony_ci{ 418c2ecf20Sopenharmony_ci writeb(val, kbd_iobase + 0x60UL); 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic inline void i8042_write_command(int val) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci writeb(val, kbd_iobase + 0x64UL); 478c2ecf20Sopenharmony_ci} 488c2ecf20Sopenharmony_cistatic inline int i8042_platform_init(void) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci /* RM200 is strange ... */ 518c2ecf20Sopenharmony_ci if (sni_brd_type == SNI_BRD_RM200) { 528c2ecf20Sopenharmony_ci kbd_iobase = ioremap(0x16000000, 4); 538c2ecf20Sopenharmony_ci i8042_kbd_irq = 33; 548c2ecf20Sopenharmony_ci i8042_aux_irq = 44; 558c2ecf20Sopenharmony_ci } else { 568c2ecf20Sopenharmony_ci kbd_iobase = ioremap(0x14000000, 4); 578c2ecf20Sopenharmony_ci i8042_kbd_irq = 1; 588c2ecf20Sopenharmony_ci i8042_aux_irq = 12; 598c2ecf20Sopenharmony_ci } 608c2ecf20Sopenharmony_ci if (!kbd_iobase) 618c2ecf20Sopenharmony_ci return -ENOMEM; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci return 0; 648c2ecf20Sopenharmony_ci} 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cistatic inline void i8042_platform_exit(void) 678c2ecf20Sopenharmony_ci{ 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci} 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#endif /* _I8042_SNIRM_H */ 72