void __init pckbd_init_hw(void) { if (!kbd_controller_present()) { kbd_exists = 0; return; } kbd_request_region(); /* Flush any pending input. */ kbd_clear_input(); if (kbd_startup_reset) { char *msg = initialize_kbd(); if (msg) printk(KERN_WARNING "initialize_kbd: %s\n", msg); } #if defined CONFIG_PSMOUSE psaux_init(); #endif kbd_rate = pckbd_rate; /* Ok, finally allocate the IRQ, and off we go.. */ kbd_request_irq(keyboard_interrupt); }
int __init q40kbd_init_hw(void) { /* Flush any pending input. */ kbd_clear_input(); /* Ok, finally allocate the IRQ, and off we go.. */ request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "keyboard", NULL); master_outb(-1,KEYBOARD_UNLOCK_REG); master_outb(1,KEY_IRQ_ENABLE_REG); return 0; }
void __init q40kbd_init_hw(void) { #if 0 /* Get the keyboard controller registers (incomplete decode) */ request_region(0x60, 16, "keyboard"); #endif /* Flush any pending input. */ kbd_clear_input(); /* Ok, finally allocate the IRQ, and off we go.. */ request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "keyboard", NULL); master_outb(-1,KEYBOARD_UNLOCK_REG); master_outb(1,KEY_IRQ_ENABLE_REG); }
int __init sa1111_kbd_init_hw(void) { char *msg; int ret; if (!request_mem_region(_KBDCR, 512, "keyboard")) return -EBUSY; SKPCR |= SKPCR_PTCLKEN; KBDCLKDIV = 0; KBDPRECNT = 127; /* Flush any pending input. */ kbd_clear_input(); msg = initialize_kbd(); if (msg) printk(KERN_WARNING "initialize_kbd: %s\n", msg); #if defined CONFIG_PSMOUSE psaux_init(); #endif k_setkeycode = sa1111_setkeycode; k_getkeycode = sa1111_getkeycode; k_translate = sa1111_translate; k_unexpected_up = sa1111_unexpected_up; k_leds = sa1111_leds; #ifdef CONFIG_MAGIC_SYSRQ k_sysrq_xlate = sa1111_sysrq_xlate; k_sysrq_key = 0x54; #endif /* Ok, finally allocate the IRQ, and off we go.. */ ret = request_irq(IRQ_TPRXINT, keyboard_interrupt, 0, "keyboard", NULL); if (ret) release_mem_region(_KBDCR, 512); return ret; }
int kbd_initialize(void) { int status; int count; #ifdef LOONGSON2F_7INCH status = kb3310_test(); if(status != 0){ printf("Waring!! You should burn the flash rom first for kbd initial.\n"); } #endif /* Flush the buffer */ kbd_clear_input(); /* * Test the keyboard interface. * This seems to be the only way to get it going. * If the test is successful a x55 is placed in the input buffer. */ kbd_write_command_w(KBD_CCMD_SELF_TEST); if (kbd_wait_for_input() != 0x55) { printf("Self test cmd failed,ignored!\n"); //return 1; } /* * Perform a keyboard interface test. This causes the controller * to test the keyboard clock and data lines. The results of the * test are placed in the input buffer. */ kbd_write_command_w(KBD_CCMD_KBD_TEST); if (kbd_wait_for_input() != 0x00) { printf("KBD_TEST cmd failed,ignored!\n"); //return 1; } /* * Enable the keyboard by allowing the keyboard clock to run. */ kbd_write_command_w(KBD_CCMD_KBD_ENABLE); /* * Reset keyboard. If the read times out * then the assumption is that no keyboard is * plugged into the machine. * This defaults the keyboard to scan-code set 2. * * Set up to try again if the keyboard asks for RESEND. */ count = 0; do { kbd_write_output_w(KBD_CMD_RESET); status = kbd_wait_for_input(); if (status == KBD_REPLY_ACK) break; if (status != KBD_REPLY_RESEND) { printf("reset failed\n"); if (++count > 1) break; //return 2; } } while (1); if (kbd_wait_for_input() != KBD_REPLY_POR) { printf("NO POR, ignored!\n"); //return 3; } /* * Set keyboard controller mode. During this, the keyboard should be * in the disabled state. * * Set up to try again if the keyboard asks for RESEND. */ count = 0; do { kbd_write_output_w(KBD_CMD_DISABLE); status = kbd_wait_for_input(); if (status == KBD_REPLY_ACK) break; if (status != KBD_REPLY_RESEND) { printf("disable failed\n"); if (++count > 1) break; //return 4; } } while (1); kbd_write_command_w(KBD_CCMD_WRITE_MODE); kbd_write_output_w(KBD_MODE_KBD_INT | KBD_MODE_SYS | KBD_MODE_DISABLE_MOUSE | KBD_MODE_KCC); #if 1 /* ibm powerpc portables need this to use scan-code set 1 -- Cort */ if (!(kbd_write_command_w_and_wait(KBD_CCMD_READ_MODE) & KBD_MODE_KCC)) { /* * If the controller does not support conversion, * Set the keyboard to scan-code set 1. */ kbd_write_output_w(0xF0); kbd_wait_for_input(); kbd_write_output_w(0x01); kbd_wait_for_input(); } #endif if (kbd_write_output_w_and_wait(KBD_CMD_ENABLE) != KBD_REPLY_ACK) { return 5; } /* * Finally, set the typematic rate to maximum. */ if (kbd_write_output_w_and_wait(KBD_CMD_SET_RATE) != KBD_REPLY_ACK) { return 6; } if (kbd_write_output_w_and_wait(0x00) != KBD_REPLY_ACK) { return 7; } return 0; }