Skip to contentSkip to conversation

Input: serio - Add ARC PS/2 driver

PATCH Superseded Mischa Jonker 2 participants 5 messages Oct 18, 2012

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#1 lore raw

PATCH v3 1/1 Input: serio - Add ARC PS/2 driver

In reply to Mischa Jonker

This adds support for the PS/2 block that is used in various ARC FPGA platforms.

---
 drivers/input/serio/Kconfig   |    9 ++
 drivers/input/serio/Makefile  |    1 +
 drivers/input/serio/arc_ps2.c |  276 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 286 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/serio/arc_ps2.c
drivers/input/serio/Kconfig +9 -0
index 55f2c22..4a4e182 100644
@@ -234,4 +234,13 @@ config SERIO_PS2MULT
 	  To compile this driver as a module, choose M here: the
 	  module will be called ps2mult.
 
+config SERIO_ARC_PS2
+	tristate "ARC PS/2 support"
+	help
+	  Say Y here if you have an ARC FPGA platform with a PS/2
+	  controller in it.
+
+	  To compile this driver as a module, choose M here; the module
+	  will be called arc_ps2.
+
 endif
drivers/input/serio/Makefile +1 -0
index dbbe376..4b0c8f8 100644
@@ -25,3 +25,4 @@ obj-$(CONFIG_SERIO_RAW)		+= serio_raw.o
 obj-$(CONFIG_SERIO_AMS_DELTA)	+= ams_delta_serio.o
 obj-$(CONFIG_SERIO_XILINX_XPS_PS2)	+= xilinx_ps2.o
 obj-$(CONFIG_SERIO_ALTERA_PS2)	+= altera_ps2.o
+obj-$(CONFIG_SERIO_ARC_PS2)	+= arc_ps2.o
drivers/input/serio/arc_ps2.c new file +276 -0

276 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#0 lore raw

v3 cover Input: serio - Add ARC PS/2 driver

main changes for v3:
* proper __iomem annotation
* correct return values in case of error

main changes for v2:
* dev_* instead of pr_*
* ioread32/iowrite32 instead of inl/outl
* use module_platform_driver macro
* disabling interrupt twice was unnecessary

New patch has been tested on our own architecture (ARC) and builds cleanly on x86-64.

Mischa Jonker (1):
Input: serio - Add ARC PS/2 driver

 drivers/input/serio/Kconfig   |    9 ++
 drivers/input/serio/Makefile  |    1 +
 drivers/input/serio/arc_ps2.c |  275 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 285 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/serio/arc_ps2.c
#2 lore raw
In reply to Mischa Jonker
Quoted 2 lines · Mischa Jonker

This adds support for the PS/2 block that is used in various ARC FPGA platforms.

[]

drivers/input/serio/arc_ps2.c

Quoted 1 line
drivers/input/serio/arc_ps2.c +0 -0

[]

drivers/input/serio/arc_ps2.c line 54

Quoted 7 lines
drivers/input/serio/arc_ps2.c +7 -0
+static void arc_ps2_check_rx(struct arc_ps2_data *arc_ps2,
+			     struct arc_ps2_port *port)
+{
+	unsigned flag, status;
+	unsigned char data;
+
+	while (1) {

infinite loop with bad hardware?
Perhaps a jiffies timeout?

#3 lore raw

Hi Joe,

Quoted 3 lines

drivers/input/serio/arc_ps2.c line 54

Quoted 1 line
drivers/input/serio/arc_ps2.c new file +1 -0
+	while (1) {

infinite loop with bad hardware?
Perhaps a jiffies timeout?

What do you suggest? Add a counter and limit the maximum number of iterations to an arbitrary number (say 1000)?

Mischa

#4 lore raw
Quoted 7 lines · Mischa Jonker

Hi Joe,

Quoted 3 lines

drivers/input/serio/arc_ps2.c line 54

Quoted 1 line
drivers/input/serio/arc_ps2.c new file +1 -0
+	while (1) {

infinite loop with bad hardware?
Perhaps a jiffies timeout?

What do you suggest? Add a counter and limit the maximum number of iterations to an arbitrary number (say 1000)?

Yes, something like that.
Or something like:

	unsigned long timeout = jiffies + somevalue;
	while (time_before(jiffies, timeout) {
		etc...
	}

cheers, Joe