Commit c9a67217 authored by Russell King's avatar Russell King

[ARM] Make rpckbd.c compile

- Add missing interrupt.h include
- Bring up to date wrt serio code
- CONFiG_SERIO_ACORN should be CONFIG_SERIO_RPCKBD
parent 3893341d
...@@ -83,7 +83,7 @@ config SERIO_PARKBD ...@@ -83,7 +83,7 @@ config SERIO_PARKBD
The module will be called parkbd.o. If you want to compile it as a The module will be called parkbd.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>. module, say M here and read <file:Documentation/modules.txt>.
config SERIO_ACORN config SERIO_RPCKBD
tristate "Acorn RiscPC keyboard controller" tristate "Acorn RiscPC keyboard controller"
depends on ARCH_ACORN && SERIO depends on ARCH_ACORN && SERIO
help help
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
* Copyright (c) 2000-2001 Vojtech Pavlik * Copyright (c) 2000-2001 Vojtech Pavlik
* *
* Based on the work of: * Based on the work of:
* unknown author * Russell King
*
* Fixes by Russell King.
*/ */
/* /*
...@@ -32,44 +34,42 @@ ...@@ -32,44 +34,42 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/serio.h> #include <linux/serio.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/iomd.h> #include <asm/hardware/iomd.h>
#include <asm/system.h> #include <asm/system.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver"); MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static inline void rpckbd_write(unsigned char val) extern struct pt_regs *kbd_pt_regs;
static int rpckbd_write(struct serio *port, unsigned char val)
{ {
while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) while (!(iomd_readb(IOMD_KCTRL) & (1 << 7)))
cpu_relax(); cpu_relax();
iomd_writeb(val, IOMD_KARTTX); iomd_writeb(val, IOMD_KARTTX);
}
static struct serio rpckbd_port = return 0;
{ }
.type = SERIO_8042,
.write = rpckbd_write,
.name = "RiscPC PS/2 kbd port",
.phys = "rpckbd/serio0",
};
static void rpckbd_rx(int irq, void *dev_id, struct pt_regs *regs) static void rpckbd_rx(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct serio *port = dev_id;
unsigned int byte; unsigned int byte;
kbd_pt_regs = regs; kbd_pt_regs = regs;
while (iomd_readb(IOMD_KCTRL) & (1 << 5)) { while (iomd_readb(IOMD_KCTRL) & (1 << 5)) {
byte = iomd_readb(IOMD_KARTRX); byte = iomd_readb(IOMD_KARTRX);
serio_interrupt(&rpckbd_port, byte, 0); serio_interrupt(port, byte, 0);
} }
} }
...@@ -77,34 +77,52 @@ static void rpckbd_tx(int irq, void *dev_id, struct pt_regs *regs) ...@@ -77,34 +77,52 @@ static void rpckbd_tx(int irq, void *dev_id, struct pt_regs *regs)
{ {
} }
static int __init rpckbd_init(void) static int rpckbd_open(struct serio *port)
{ {
/* Reset the keyboard state machine. */ /* Reset the keyboard state machine. */
iomd_writeb(0, IOMD_KCTRL); iomd_writeb(0, IOMD_KCTRL);
iomd_writeb(8, IOMD_KCTRL); iomd_writeb(8, IOMD_KCTRL);
iomd_readb(IOMD_KARTRX); iomd_readb(IOMD_KARTRX);
if (request_irq(IRQ_KEYBOARDRX, rpckbd_rx, 0, "rpckbd", NULL) != 0) { if (request_irq(IRQ_KEYBOARDRX, rpckbd_rx, 0, "rpckbd", port) != 0) {
printk(KERN_ERR "rpckbd.c: Could not allocate keyboard receive IRQ!\n") printk(KERN_ERR "rpckbd.c: Could not allocate keyboard receive IRQ\n");
return -EBUSY; return -EBUSY;
} }
if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", NULL) != 0) { if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", port) != 0) {
printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ!\n") printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n");
free_irq(IRQ_KEYBOARDRX, NULL); free_irq(IRQ_KEYBOARDRX, NULL);
return -EBUSY; return -EBUSY;
} }
register_serio_port(&rpckbd_port);
return 0; return 0;
} }
static void __exit rpckbd_exit(void) static void rpckbd_close(struct serio *port)
{ {
free_irq(IRQ_KEYBOARDRX, NULL); free_irq(IRQ_KEYBOARDRX, port);
free_irq(IRQ_KEYBOARDTX, NULL); free_irq(IRQ_KEYBOARDTX, port);
}
unregister_serio_port(&rpckbd_port); static struct serio rpckbd_port =
{
.type = SERIO_8042,
.open = rpckbd_open,
.close = rpckbd_close,
.write = rpckbd_write,
.name = "RiscPC PS/2 kbd port",
.phys = "rpckbd/serio0",
};
static int __init rpckbd_init(void)
{
serio_register_port(&rpckbd_port);
return 0;
}
static void __exit rpckbd_exit(void)
{
serio_unregister_port(&rpckbd_port);
} }
module_init(rpckbd_init); module_init(rpckbd_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment