All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5(7)] OMAP1: Amstrad Delta: add FIQ based support for external keyboard
@ 2010-04-15  2:19 ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:19 UTC (permalink / raw)
  To: linux-omap
  Cc: Tony Lindgren, Dmitry Torokhov, linux-input, linux-arm-kernel,
	e3-hacking

This series of patches adds support for an external keyboard (called 
mailboard) connected to the Amstrad Delta (E3) videophone.

The series is based on a patch by Matt Callow, created against
linux-omap-2.6.19[1], initially submitted to the e3-hacking mailing list in
April 2006[2].

Since the keyboard serial clock line is connected to a GPIO line, it generates
interrupts every single bit received. In order to handle this correctly, the
code makes use of a FIQ hardware feature. Since all GPIO generated interrupts 
would be converted to FIQ, the handler must include support for all supported 
GPIO connected devices: the keyboard, a modem and a hook switch.

My initial modifications to the original patch included:
- split into several patches,
- refresh against a recent linux version,
- a lot of cleanups, mainly to get rid of checkpatch reported issues,
- add support for handling interrupts generated by a GPIO line that the 
  meanwhile activated hook switch hangs off.
v2 changes:
- remove scan code to key code mapping from the serio driver, that doesn't 
  belong here and should be set up from userspace; thanks to Dmitry Torokhov 
  for advising this,
- no funtional changes in FIQ part (there were no comments in round 1).
v3 changes:
- cleanups suggested by Dmitry (applied not only to serio bits),
- assembly code optimizations suggested by Ralph Corderoy,
- (re)use existing header file provided macros where applicable instead of 
  defining new; remove a lot of unnecessary defines,
- extract missing FIQ_START definition fix into an extra patch numbered 
  0.1/5(7),
- modify both fiq and deferred_fiq handlers to follow default OMAP GPIO 
  interrupt processing path more closely,
- update board initialization code for complete modem IRQ GPIO line setup; 
  this appeared essential for correct interaction with optimized FIQ handler; 
  change is provided as a separate patch numbered 2.1/5(7),
- use IRQ12 (reserved on OMAP1510) for requesting deferred_fiq handler instead 
  of TIMER32k dedicated IRQ,
- more optimizations in both assembly and C code,
- modify serio Kconfig for automatic AT keyboard and FIQ handler selection,
- drop intermediate defconfig changes.

Created and tested against linux-2.6.34-rc4.

Janusz Krzysztofik(7)
	OMAP: add missing FIQ_START definition, required by arch/arm/plat-omap/fiq.c
	OMAP1: Amstrad Delta: add FIQ handler for serial keyboard port interrupt
			processing
	OMAP1: Amstrad Delta: add a handler for processing interrupts generated by
			the FIQ routine
	OMAP1: Amstrad Delta: update board initialization code for complete modem IRQ 
			GPIO line setup
	OMAP1: Amstrad Delta: use FIQ for processing GPIO interrupts
	input: serio: add support for Amstrad Delta serial keyboard port
	OMAP1: Amstrad Delta: modify defconfig for external keyboard support

 arch/arm/configs/ams_delta_defconfig             |    1
 arch/arm/mach-omap1/Kconfig                      |   10
 arch/arm/mach-omap1/Makefile                     |    3
 arch/arm/mach-omap1/ams-delta-fiq-handler.S      |  281 +++++++++++++++++++++++
 arch/arm/mach-omap1/ams-delta-fiq.c              |  155 ++++++++++++
 arch/arm/mach-omap1/board-ams-delta.c            |   18 +
 arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |   79 ++++++
 arch/arm/plat-omap/include/plat/irqs.h           |    4
 drivers/input/serio/Kconfig                      |   17 +
 drivers/input/serio/Makefile                     |    1
 drivers/input/serio/ams_delta_serio.c            |  177 ++++++++++++++
 11 files changed, 744 insertions(+), 2 deletions(-)

Thanks,
Janusz

[1] http://the.earth.li/pub/e3/2.6.19/ams-delta-keyboard.patch
[2] http://www.earth.li/pipermail/e3-hacking/2006-April/000453.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 0/5(7)] OMAP1: Amstrad Delta: add FIQ based support for external keyboard
@ 2010-04-15  2:19 ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:19 UTC (permalink / raw)
  To: linux-arm-kernel

This series of patches adds support for an external keyboard (called 
mailboard) connected to the Amstrad Delta (E3) videophone.

The series is based on a patch by Matt Callow, created against
linux-omap-2.6.19[1], initially submitted to the e3-hacking mailing list in
April 2006[2].

Since the keyboard serial clock line is connected to a GPIO line, it generates
interrupts every single bit received. In order to handle this correctly, the
code makes use of a FIQ hardware feature. Since all GPIO generated interrupts 
would be converted to FIQ, the handler must include support for all supported 
GPIO connected devices: the keyboard, a modem and a hook switch.

My initial modifications to the original patch included:
- split into several patches,
- refresh against a recent linux version,
- a lot of cleanups, mainly to get rid of checkpatch reported issues,
- add support for handling interrupts generated by a GPIO line that the 
  meanwhile activated hook switch hangs off.
v2 changes:
- remove scan code to key code mapping from the serio driver, that doesn't 
  belong here and should be set up from userspace; thanks to Dmitry Torokhov 
  for advising this,
- no funtional changes in FIQ part (there were no comments in round 1).
v3 changes:
- cleanups suggested by Dmitry (applied not only to serio bits),
- assembly code optimizations suggested by Ralph Corderoy,
- (re)use existing header file provided macros where applicable instead of 
  defining new; remove a lot of unnecessary defines,
- extract missing FIQ_START definition fix into an extra patch numbered 
  0.1/5(7),
- modify both fiq and deferred_fiq handlers to follow default OMAP GPIO 
  interrupt processing path more closely,
- update board initialization code for complete modem IRQ GPIO line setup; 
  this appeared essential for correct interaction with optimized FIQ handler; 
  change is provided as a separate patch numbered 2.1/5(7),
- use IRQ12 (reserved on OMAP1510) for requesting deferred_fiq handler instead 
  of TIMER32k dedicated IRQ,
- more optimizations in both assembly and C code,
- modify serio Kconfig for automatic AT keyboard and FIQ handler selection,
- drop intermediate defconfig changes.

Created and tested against linux-2.6.34-rc4.

Janusz Krzysztofik(7)
	OMAP: add missing FIQ_START definition, required by arch/arm/plat-omap/fiq.c
	OMAP1: Amstrad Delta: add FIQ handler for serial keyboard port interrupt
			processing
	OMAP1: Amstrad Delta: add a handler for processing interrupts generated by
			the FIQ routine
	OMAP1: Amstrad Delta: update board initialization code for complete modem IRQ 
			GPIO line setup
	OMAP1: Amstrad Delta: use FIQ for processing GPIO interrupts
	input: serio: add support for Amstrad Delta serial keyboard port
	OMAP1: Amstrad Delta: modify defconfig for external keyboard support

 arch/arm/configs/ams_delta_defconfig             |    1
 arch/arm/mach-omap1/Kconfig                      |   10
 arch/arm/mach-omap1/Makefile                     |    3
 arch/arm/mach-omap1/ams-delta-fiq-handler.S      |  281 +++++++++++++++++++++++
 arch/arm/mach-omap1/ams-delta-fiq.c              |  155 ++++++++++++
 arch/arm/mach-omap1/board-ams-delta.c            |   18 +
 arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |   79 ++++++
 arch/arm/plat-omap/include/plat/irqs.h           |    4
 drivers/input/serio/Kconfig                      |   17 +
 drivers/input/serio/Makefile                     |    1
 drivers/input/serio/ams_delta_serio.c            |  177 ++++++++++++++
 11 files changed, 744 insertions(+), 2 deletions(-)

Thanks,
Janusz

[1] http://the.earth.li/pub/e3/2.6.19/ams-delta-keyboard.patch
[2] http://www.earth.li/pipermail/e3-hacking/2006-April/000453.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 0.1/5(7)] OMAP: add missing FIQ_START definition required for arch/arm/plat-omap/fiq.c compilation
  2010-04-15  2:19 ` Janusz Krzysztofik
  (?)
@ 2010-04-15  2:23 ` Janusz Krzysztofik
  2010-04-20  9:14   ` [PATCH v3 0.1/5(7)] OMAP: add missing FIQ_START definition required for arch/arm/kernel/fiq.c compilation (was: OMAP: add missing FIQ_START definition required for arch/arm/plat-omap/fiq.c compilation) Janusz Krzysztofik
  -1 siblings, 1 reply; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:23 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, e3-hacking

Several ARM platforms/machines that use FIQ define their value of FIQ_START. 
Since FIQ is not implemented for OMAP yet, this definition is missing from 
OMAP header files.

Put an arbitrary value for FIQ_START into plat/irqs.h for OMAP. Even if not 
used by the WiP FIQ handler for Amstrad Delta, this is required for 
successfull compilation of arch/arm/plat-omap/fiq.c that provides several 
usefull functions.

Even if prepended in front of the Amstrad Delta FIQ patch set, can be applied 
alone in advance as well, possibly as a fix.

Created and tested against linux-2.6.34-rc4.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---

 arch/arm/plat-omap/include/plat/irqs.h |    4 ++++
 1 file changed, 4 insertions(+)

--- git.orig/arch/arm/plat-omap/include/plat/irqs.h	2010-04-14 03:07:16.000000000 +0200
+++ git/arch/arm/plat-omap/include/plat/irqs.h	2010-04-14 22:28:05.000000000 +0200
@@ -430,4 +430,8 @@ void omap3_intc_resume_idle(void);
 
 #include <mach/hardware.h>
 
+#ifdef CONFIG_FIQ
+#define FIQ_START		1024
+#endif
+
 #endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 1/5(7)] OMAP1: Amstrad Delta: add FIQ handler for serial keyboard port interrupt processing
  2010-04-15  2:19 ` Janusz Krzysztofik
@ 2010-04-15  2:24   ` Janusz Krzysztofik
  -1 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:24 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, linux-arm-kernel, e3-hacking

This patch introduces a Fast Interrupt Request (FIQ) handler for Amstrad Delta
(E3) videophone. The handler's purpose is to process interrupts generated by a
GPIO line that a serial keyboard clock hangs off. It collects consecutive bits
into words, pushing them into a buffer, then requests a higher level interrupt
after one or more words are ready for further processing by a keyboard port 
driver.

The handler also processes interrupts generated by two other GPIO lines, used
by other on-board supported devices, by simply requesting a higher level
interrupt, that in turn should invoke those device's specific irq handlers.

IRQ12 line, not used by OMAP1510 hardware (described as reserved), has been 
choosen as a higher level interrupt source.

Created and tested against linux-2.6.34-rc4.
Compiles on top of PATCH v3 0.1/5(7), "OMAP: add missing FIQ_START definition 
required for arch/arm/plat-omap/fiq.c compilation".

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- no functional changes,
- refresh against linux-2.6.34-rc2.
v3 changes:
- assembler code optimizations suggested by Ralph Corderoy,
- (re)use existing header file provided macros where applicable instead of 
  defining new (from scratch); remove a lot of unnecessary defines,
- follow default OMAP GPIO interrupt processing path more closely,
- prepare for choosing arbitrary IRQ for deferred_fiq handler; use IRQ12 
  (reserved on OMAP1510) instead of Timer 32K dedicated IRQ,
- more optimizations for smaller code.

 arch/arm/mach-omap1/Kconfig                      |   10
 arch/arm/mach-omap1/Makefile                     |    1
 arch/arm/mach-omap1/ams-delta-fiq-handler.S      |  281 +++++++++++++++++++++++
 arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |   72 +++++
 4 files changed, 364 insertions(+)

diff -uprN git.orig/arch/arm/mach-omap1/Kconfig git/arch/arm/mach-omap1/Kconfig
--- git.orig/arch/arm/mach-omap1/Kconfig	2010-04-14 03:07:13.000000000 +0200
+++ git/arch/arm/mach-omap1/Kconfig	2010-04-14 22:19:37.000000000 +0200
@@ -152,6 +152,16 @@ config MACH_AMS_DELTA
 	  Support for the Amstrad E3 (codename Delta) videophone. Say Y here
 	  if you have such a device.
 
+config AMS_DELTA_FIQ
+	bool "Fast Interrupt Request (FIQ) support for the E3"
+	depends on MACH_AMS_DELTA
+	select FIQ
+	help
+	  Provide a FIQ handler for the E3.
+	  This allows for fast handling of interrupts generated
+	  by the clock line of the E3 mailboard (or a PS/2 keyboard)
+	  connected to the GPIO based external keyboard port.
+
 config MACH_OMAP_GENERIC
 	bool "Generic OMAP board"
 	depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX)
diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
--- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 03:07:13.000000000 +0200
+++ git/arch/arm/mach-omap1/Makefile	2010-04-14 22:19:37.000000000 +0200
@@ -37,6 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
 obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
 obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
 obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
+obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
 obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
 obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
 
diff -uprN git.orig/arch/arm/mach-omap1/ams-delta-fiq-handler.S git/arch/arm/mach-omap1/ams-delta-fiq-handler.S
--- git.orig/arch/arm/mach-omap1/ams-delta-fiq-handler.S	1970-01-01 01:00:00.000000000 +0100
+++ git/arch/arm/mach-omap1/ams-delta-fiq-handler.S	2010-04-14 22:19:37.000000000 +0200
@@ -0,0 +1,281 @@
+/*
+ *  linux/arch/arm/mach-omap1/ams-delta-fiq-handler.S
+ *
+ *  Based on  linux/arch/arm/lib/floppydma.S
+ *  Renamed and modified to work with 2.6 kernel by Matt Callow
+ *  Copyright (C) 1995, 1996 Russell King
+ *  Copyright (C) 2004 Pete Trapps
+ *  Copyright (C) 2006 Matt Callow
+ *  Copyright (C) 2010 Janusz Krzysztofik
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#include <linux/linkage.h>
+
+#include <plat/io.h>
+#include <plat/board-ams-delta.h>
+
+#include <mach/ams-delta-fiq.h>
+
+/*
+ * GPIO related definitions, copied from arch/arm/plat-omap/gpio.c.
+ * Unfortunately, those were not placed in a separate header file.
+ */
+#define OMAP1510_GPIO_BASE		0xFFFCE000
+#define OMAP1510_GPIO_DATA_INPUT	0x00
+#define OMAP1510_GPIO_DATA_OUTPUT	0x04
+#define OMAP1510_GPIO_DIR_CONTROL	0x08
+#define OMAP1510_GPIO_INT_CONTROL	0x0c
+#define OMAP1510_GPIO_INT_MASK		0x10
+#define OMAP1510_GPIO_INT_STATUS	0x14
+#define OMAP1510_GPIO_PIN_CONTROL	0x18
+
+/* GPIO register bitmasks */
+#define KEYBRD_DATA_MASK		(0x1 << AMS_DELTA_GPIO_PIN_KEYBRD_DATA)
+#define KEYBRD_CLK_MASK			(0x1 << AMS_DELTA_GPIO_PIN_KEYBRD_CLK)
+#define MODEM_IRQ_MASK			(0x1 << AMS_DELTA_GPIO_PIN_MODEM_IRQ)
+#define HOOK_SWITCH_MASK		(0x1 << AMS_DELTA_GPIO_PIN_HOOK_SWITCH)
+#define OTHERS_MASK			(MODEM_IRQ_MASK | HOOK_SWITCH_MASK)
+
+/* IRQ handler register bitmasks */
+#define DEFERRED_FIQ_MASK		(0x1 << (INT_DEFERRED_FIQ % IH2_BASE))
+#define GPIO_BANK1_MASK  		(0x1 << INT_GPIO_BANK1)
+
+/* Driver buffer byte offsets */
+#define BUF_MASK			(FIQ_MASK * 4)
+#define BUF_STATE			(FIQ_STATE * 4)
+#define BUF_KEYS_CNT			(FIQ_KEYS_CNT * 4)
+#define BUF_TAIL_OFFSET			(FIQ_TAIL_OFFSET * 4)
+#define BUF_HEAD_OFFSET			(FIQ_HEAD_OFFSET * 4)
+#define BUF_BUF_LEN			(FIQ_BUF_LEN * 4)
+#define BUF_KEY				(FIQ_KEY * 4)
+#define BUF_MISSED_KEYS			(FIQ_MISSED_KEYS * 4)
+#define BUF_BUFFER_START		(FIQ_BUFFER_START * 4)
+#define BUF_GPIO_INT_MASK		(FIQ_GPIO_INT_MASK * 4)
+#define BUF_KEYS_HICNT			(FIQ_KEYS_HICNT * 4)
+#define BUF_IRQ_PEND			(FIQ_IRQ_PEND * 4)
+#define BUF_SIR_CODE_L1			(FIQ_SIR_CODE_L1 * 4)
+#define BUF_SIR_CODE_L2			(IRQ_SIR_CODE_L2 * 4)
+#define BUF_CNT_INT_00			(FIQ_CNT_INT_00 * 4)
+#define BUF_CNT_INT_KEY			(FIQ_CNT_INT_KEY * 4)
+#define BUF_CNT_INT_MDM			(FIQ_CNT_INT_MDM * 4)
+#define BUF_CNT_INT_03			(FIQ_CNT_INT_03 * 4)
+#define BUF_CNT_INT_HSW			(FIQ_CNT_INT_HSW * 4)
+#define BUF_CNT_INT_05			(FIQ_CNT_INT_05 * 4)
+#define BUF_CNT_INT_06			(FIQ_CNT_INT_06 * 4)
+#define BUF_CNT_INT_07			(FIQ_CNT_INT_07 * 4)
+#define BUF_CNT_INT_08			(FIQ_CNT_INT_08 * 4)
+#define BUF_CNT_INT_09			(FIQ_CNT_INT_09 * 4)
+#define BUF_CNT_INT_10			(FIQ_CNT_INT_10 * 4)
+#define BUF_CNT_INT_11			(FIQ_CNT_INT_11 * 4)
+#define BUF_CNT_INT_12			(FIQ_CNT_INT_12 * 4)
+#define BUF_CNT_INT_13			(FIQ_CNT_INT_13 * 4)
+#define BUF_CNT_INT_14			(FIQ_CNT_INT_14 * 4)
+#define BUF_CNT_INT_15			(FIQ_CNT_INT_15 * 4)
+#define BUF_CIRC_BUFF			(FIQ_CIRC_BUFF * 4)
+
+
+/*
+ * Register useage
+ * r8  - temporary
+ * r9  - the driver buffer
+ * r10 - temporary
+ * r11 - interrupts mask
+ * r12 - base pointers
+ * r13 - interrupts status
+ */
+
+	.text
+
+	.global qwerty_fiqin_end
+
+ENTRY(qwerty_fiqin_start)
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+	@ FIQ intrrupt handler
+	ldr r12, omap_ih1_base			@ set pointer to level1 handler
+
+	ldr r11, [r12, #IRQ_MIR_REG_OFFSET]	@ fetch interrupts mask
+
+	ldr r13, [r12, #IRQ_ITR_REG_OFFSET]	@ fetch interrupts status
+	bics r13, r13, r11			@ clear masked - any left?
+	beq exit				@ none - spurious FIQ? exit
+
+	ldr r10, [r12, #IRQ_SIR_FIQ_REG_OFFSET]	@ get requested interrupt number
+
+	mov r8, #2				@ reset FIQ agreement
+	str r8, [r12, #IRQ_CONTROL_REG_OFFSET]
+
+	cmp r10, #INT_GPIO_BANK1		@ is it GPIO bank interrupt?
+	beq gpio				@ yes - process it
+
+	mov r8, #1
+	orr r8, r11, r8, lsl r10		@ mask spurious interrupt
+	str r8, [r12, #IRQ_MIR_REG_OFFSET]
+exit:
+	subs	pc, lr, #4			@ return from FIQ
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@
+gpio:	@ GPIO bank interrupt handler
+	ldr r12, omap1510_gpio_base		@ set base pointer to GPIO bank
+
+	ldr r11, [r12, #OMAP1510_GPIO_INT_MASK]	@ fetch GPIO interrupts mask
+restart:
+	ldr r13, [r12, #OMAP1510_GPIO_INT_STATUS]	@ fetch status bits
+	bics r13, r13, r11			@ clear masked - any left?
+	beq exit				@ no - spurious interrupt? exit
+
+	orr r11, r11, r13			@ mask all requested interrupts
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]
+
+	ands r10, r13, #KEYBRD_CLK_MASK		@ extract keyboard status - set?
+	beq hksw				@ no - try next source
+
+
+	@@@@@@@@@@@@@@@@@@@@@@
+	@ Keyboard clock FIQ mode interrupt handler
+	@ r10 now contains KEYBRD_CLK_MASK, use it
+	str r10, [r12, #OMAP1510_GPIO_INT_STATUS]	@ ack the interrupt
+	bic r11, r10					@ unmask it
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]
+
+	@ Process keyboard data
+	ldr r8, [r12, #OMAP1510_GPIO_DATA_INPUT]	@ fetch GPIO input
+
+	ldr r10, [r9, #BUF_STATE]		@ fetch kbd interface state
+	cmp r10, #0				@ are we expecting start bit?
+	bne data				@ no - go to data processing
+
+	ands r8, #KEYBRD_DATA_MASK		@ check start bit - detected?
+	beq hksw				@ no - try next source
+
+	@ r8 contains KEYBRD_DATA_MASK, use it
+	str r8, [r9, #BUF_STATE]		@ enter data processing state
+	@ r10 already contains 0, reuse it
+	str r10, [r9, #BUF_KEY]			@ clear keycode
+	mov r10, #2				@ reset input bit mask
+	str r10, [r9, #BUF_MASK]
+
+	@ Mask other GPIO line interrupts till key done
+	str r11, [r9, #BUF_GPIO_INT_MASK]	@ save mask for later restore
+	mvn r11, #KEYBRD_CLK_MASK		@ prepare all except kbd mask
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]	@ store into the mask register
+
+	b restart				@ restart
+
+data:	ldr r10, [r9, #BUF_MASK]		@ fetch current input bit mask
+
+	@ r8 still contains GPIO input bits
+	ands r8, r8, #KEYBRD_DATA_MASK		@ is keyboard data line low?
+	ldreq r8, [r9, #BUF_KEY]		@ yes - fetch collected so far,
+	orreq r8, r8, r10			@ set 1 at current mask position
+	streq r8, [r9, #BUF_KEY]		@ and save back
+
+	mov r10, r10, lsl #1			@ shift mask left
+	bics r10, #0x800			@ have we got all the bits?
+	strne r10, [r9, #BUF_MASK]		@ not yet - store the mask
+	bne restart				@ and restart
+
+	@ r10 already contains 0, reuse it
+	str r10, [r9, #BUF_STATE]		@ reset state to start
+
+	@ Key done - restore interrupt mask
+	ldr r10, [r9, #BUF_GPIO_INT_MASK]	@ fetch saved mask
+	and r11, r11, r10			@ unmask all saved as unmasked
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]	@ restore into the mask register
+
+	@ Try appending the keycode to the circular buffer
+	ldr r10, [r9, #BUF_KEYS_CNT]		@ get saved keystrokes count
+	ldr r8, [r9, #BUF_BUF_LEN]		@ get buffer size
+	cmp r10, r8				@ is buffer full?
+	beq hksw				@ yes - key lost, next source
+
+	add r10, r10, #1			@ incremet keystrokes counter
+	str r10, [r9, #BUF_KEYS_CNT]
+
+	ldr r10, [r9, #BUF_TAIL_OFFSET]		@ get buffer tail offset
+	@ r8 already contains buffer size
+	cmp r10, r8				@ end of buffer?
+	moveq r10, #0				@ yes - rewind to buffer start
+
+	ldr r12, [r9, #BUF_BUFFER_START]	@ get buffer start address
+	add r12, r12, r10, LSL #2		@ calculate buffer tail address
+	ldr r8, [r9, #BUF_KEY]			@ get last keycode
+	str r8, [r12]				@ append it to the buffer tail
+
+	add r10, r10, #1			@ increment buffer tail offset
+	str r10, [r9, #BUF_TAIL_OFFSET]
+
+	ldr r10, [r9, #BUF_CNT_INT_KEY]		@ increment interrupts counter
+	add r10, r10, #1
+	str r10, [r9, #BUF_CNT_INT_KEY]
+	@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+hksw:	@Is hook switch interrupt requested?
+	tst r13, #HOOK_SWITCH_MASK 		@ is hook switch status bit set?
+	beq mdm					@ no - try next source
+
+
+	@@@@@@@@@@@@@@@@@@@@@@@@
+	@ Hook switch interrupt FIQ mode simple handler
+
+	@Toggle active edge
+	@ldr r8, [r12,#OMAP1510_GPIO_INT_CONTROL]
+	@eor r8, r8, r10
+	@str r8, [r12,#OMAP1510_GPIO_INT_CONTROL]
+
+	@ Increment hook switch interrupt counter
+	ldr r10, [r9, #BUF_CNT_INT_HSW]
+	add r10, r10, #1
+	str r10, [r9, #BUF_CNT_INT_HSW]
+	@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+mdm:	@Is it a modem interrupt?
+	tst r13, #MODEM_IRQ_MASK 		@ is modem status bit set?
+	beq irq					@ no - check for next interrupt
+
+
+	@@@@@@@@@@@@@@@@@@@@@@@@
+	@ Modem FIQ mode interrupt handler stub
+
+	@ Increment modem interrupt counter
+	ldr r10, [r9, #BUF_CNT_INT_MDM]
+	add r10, r10, #1
+	str r10, [r9, #BUF_CNT_INT_MDM]
+	@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+irq:	@ Place deferred_fiq interrupt request
+	ldr r12, deferred_fiq_ih_base		@ set pointer to IRQ handler
+	mov r10, #DEFERRED_FIQ_MASK		@ set deferred_fiq bit
+	str r10, [r12, #IRQ_ISR_REG_OFFSET] 	@ place it in the ISR register
+
+	ldr r12, omap1510_gpio_base		@ set pointer back to GPIO bank
+	b restart				@ check for next GPIO interrupt
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+/*
+ * Virtual addresses for IO
+ */
+omap_ih1_base:
+	.word OMAP1_IO_ADDRESS(OMAP_IH1_BASE)
+deferred_fiq_ih_base:
+	.word OMAP1_IO_ADDRESS(DEFERRED_FIQ_IH_BASE)
+omap1510_gpio_base:
+	.word OMAP1_IO_ADDRESS(OMAP1510_GPIO_BASE)
+qwerty_fiqin_end:
+
+/*
+ * Check the size of the FIQ,
+ * it cannot go beyond 0xffff0200, and is copied to 0xffff001c
+ */
+.if (qwerty_fiqin_end - qwerty_fiqin_start) > (0x200 - 0x1c)
+	.err
+.endif
diff -uprN git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
--- git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	1970-01-01 01:00:00.000000000 +0100
+++ git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	2010-04-14 22:19:37.000000000 +0200
@@ -0,0 +1,72 @@
+/*
+ * arch/arm/mach-omap1/include/ams-delta-fiq.h
+ *
+ * Taken from the original Amstrad modifications to fiq.h
+ *
+ * Copyright (c) 2004 Amstrad Plc
+ * Copyright (c) 2006 Matt Callow
+ * Copyright (c) 2010 Janusz Krzysztofik
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __AMS_DELTA_FIQ_H
+#define __AMS_DELTA_FIQ_H
+
+#include <plat/irqs.h>
+
+/*
+ * Interrupt number used for passing control from FIQ to IRQ.
+ * IRQ12, described as reserved, has been selected.
+ */
+#define INT_DEFERRED_FIQ	INT_1510_RES12
+/*
+ * Base address of an interrupt handler that the INT_DEFERRED_FIQ belongs to.
+ */
+#if (INT_DEFERRED_FIQ < IH2_BASE)
+#define DEFERRED_FIQ_IH_BASE	OMAP_IH1_BASE
+#else
+#define DEFERRED_FIQ_IH_BASE	OMAP_IH2_BASE
+#endif
+
+/*
+ * These are the offsets from the begining of the fiq_buffer. They are put here
+ * since the buffer and header need to be accessed by drivers servicing devices
+ * which generate GPIO interrupts - e.g. keyboard, modem, hook switch.
+ */
+#define FIQ_MASK		 0
+#define FIQ_STATE		 1
+#define FIQ_KEYS_CNT		 2
+#define FIQ_TAIL_OFFSET		 3
+#define FIQ_HEAD_OFFSET		 4
+#define FIQ_BUF_LEN		 5
+#define FIQ_KEY			 6
+#define FIQ_MISSED_KEYS		 7
+#define FIQ_BUFFER_START	 8
+#define FIQ_GPIO_INT_MASK	 9
+#define FIQ_KEYS_HICNT		10
+#define FIQ_IRQ_PEND		11
+#define FIQ_SIR_CODE_L1		12
+#define IRQ_SIR_CODE_L2		13
+
+#define FIQ_CNT_INT_00		14
+#define FIQ_CNT_INT_KEY		15
+#define FIQ_CNT_INT_MDM		16
+#define FIQ_CNT_INT_03		17
+#define FIQ_CNT_INT_HSW		18
+#define FIQ_CNT_INT_05		19
+#define FIQ_CNT_INT_06		20
+#define FIQ_CNT_INT_07		21
+#define FIQ_CNT_INT_08		22
+#define FIQ_CNT_INT_09		23
+#define FIQ_CNT_INT_10		24
+#define FIQ_CNT_INT_11		25
+#define FIQ_CNT_INT_12		26
+#define FIQ_CNT_INT_13		27
+#define FIQ_CNT_INT_14		28
+#define FIQ_CNT_INT_15		29
+
+#define FIQ_CIRC_BUFF		30      /*Start of circular buffer */
+
+#endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 1/5(7)] OMAP1: Amstrad Delta: add FIQ handler for serial keyboard port interrupt processing
@ 2010-04-15  2:24   ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:24 UTC (permalink / raw)
  To: linux-arm-kernel

This patch introduces a Fast Interrupt Request (FIQ) handler for Amstrad Delta
(E3) videophone. The handler's purpose is to process interrupts generated by a
GPIO line that a serial keyboard clock hangs off. It collects consecutive bits
into words, pushing them into a buffer, then requests a higher level interrupt
after one or more words are ready for further processing by a keyboard port 
driver.

The handler also processes interrupts generated by two other GPIO lines, used
by other on-board supported devices, by simply requesting a higher level
interrupt, that in turn should invoke those device's specific irq handlers.

IRQ12 line, not used by OMAP1510 hardware (described as reserved), has been 
choosen as a higher level interrupt source.

Created and tested against linux-2.6.34-rc4.
Compiles on top of PATCH v3 0.1/5(7), "OMAP: add missing FIQ_START definition 
required for arch/arm/plat-omap/fiq.c compilation".

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- no functional changes,
- refresh against linux-2.6.34-rc2.
v3 changes:
- assembler code optimizations suggested by Ralph Corderoy,
- (re)use existing header file provided macros where applicable instead of 
  defining new (from scratch); remove a lot of unnecessary defines,
- follow default OMAP GPIO interrupt processing path more closely,
- prepare for choosing arbitrary IRQ for deferred_fiq handler; use IRQ12 
  (reserved on OMAP1510) instead of Timer 32K dedicated IRQ,
- more optimizations for smaller code.

 arch/arm/mach-omap1/Kconfig                      |   10
 arch/arm/mach-omap1/Makefile                     |    1
 arch/arm/mach-omap1/ams-delta-fiq-handler.S      |  281 +++++++++++++++++++++++
 arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |   72 +++++
 4 files changed, 364 insertions(+)

diff -uprN git.orig/arch/arm/mach-omap1/Kconfig git/arch/arm/mach-omap1/Kconfig
--- git.orig/arch/arm/mach-omap1/Kconfig	2010-04-14 03:07:13.000000000 +0200
+++ git/arch/arm/mach-omap1/Kconfig	2010-04-14 22:19:37.000000000 +0200
@@ -152,6 +152,16 @@ config MACH_AMS_DELTA
 	  Support for the Amstrad E3 (codename Delta) videophone. Say Y here
 	  if you have such a device.
 
+config AMS_DELTA_FIQ
+	bool "Fast Interrupt Request (FIQ) support for the E3"
+	depends on MACH_AMS_DELTA
+	select FIQ
+	help
+	  Provide a FIQ handler for the E3.
+	  This allows for fast handling of interrupts generated
+	  by the clock line of the E3 mailboard (or a PS/2 keyboard)
+	  connected to the GPIO based external keyboard port.
+
 config MACH_OMAP_GENERIC
 	bool "Generic OMAP board"
 	depends on ARCH_OMAP1 && (ARCH_OMAP15XX || ARCH_OMAP16XX)
diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
--- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 03:07:13.000000000 +0200
+++ git/arch/arm/mach-omap1/Makefile	2010-04-14 22:19:37.000000000 +0200
@@ -37,6 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
 obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
 obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
 obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
+obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
 obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
 obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
 
diff -uprN git.orig/arch/arm/mach-omap1/ams-delta-fiq-handler.S git/arch/arm/mach-omap1/ams-delta-fiq-handler.S
--- git.orig/arch/arm/mach-omap1/ams-delta-fiq-handler.S	1970-01-01 01:00:00.000000000 +0100
+++ git/arch/arm/mach-omap1/ams-delta-fiq-handler.S	2010-04-14 22:19:37.000000000 +0200
@@ -0,0 +1,281 @@
+/*
+ *  linux/arch/arm/mach-omap1/ams-delta-fiq-handler.S
+ *
+ *  Based on  linux/arch/arm/lib/floppydma.S
+ *  Renamed and modified to work with 2.6 kernel by Matt Callow
+ *  Copyright (C) 1995, 1996 Russell King
+ *  Copyright (C) 2004 Pete Trapps
+ *  Copyright (C) 2006 Matt Callow
+ *  Copyright (C) 2010 Janusz Krzysztofik
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ */
+
+#include <linux/linkage.h>
+
+#include <plat/io.h>
+#include <plat/board-ams-delta.h>
+
+#include <mach/ams-delta-fiq.h>
+
+/*
+ * GPIO related definitions, copied from arch/arm/plat-omap/gpio.c.
+ * Unfortunately, those were not placed in a separate header file.
+ */
+#define OMAP1510_GPIO_BASE		0xFFFCE000
+#define OMAP1510_GPIO_DATA_INPUT	0x00
+#define OMAP1510_GPIO_DATA_OUTPUT	0x04
+#define OMAP1510_GPIO_DIR_CONTROL	0x08
+#define OMAP1510_GPIO_INT_CONTROL	0x0c
+#define OMAP1510_GPIO_INT_MASK		0x10
+#define OMAP1510_GPIO_INT_STATUS	0x14
+#define OMAP1510_GPIO_PIN_CONTROL	0x18
+
+/* GPIO register bitmasks */
+#define KEYBRD_DATA_MASK		(0x1 << AMS_DELTA_GPIO_PIN_KEYBRD_DATA)
+#define KEYBRD_CLK_MASK			(0x1 << AMS_DELTA_GPIO_PIN_KEYBRD_CLK)
+#define MODEM_IRQ_MASK			(0x1 << AMS_DELTA_GPIO_PIN_MODEM_IRQ)
+#define HOOK_SWITCH_MASK		(0x1 << AMS_DELTA_GPIO_PIN_HOOK_SWITCH)
+#define OTHERS_MASK			(MODEM_IRQ_MASK | HOOK_SWITCH_MASK)
+
+/* IRQ handler register bitmasks */
+#define DEFERRED_FIQ_MASK		(0x1 << (INT_DEFERRED_FIQ % IH2_BASE))
+#define GPIO_BANK1_MASK  		(0x1 << INT_GPIO_BANK1)
+
+/* Driver buffer byte offsets */
+#define BUF_MASK			(FIQ_MASK * 4)
+#define BUF_STATE			(FIQ_STATE * 4)
+#define BUF_KEYS_CNT			(FIQ_KEYS_CNT * 4)
+#define BUF_TAIL_OFFSET			(FIQ_TAIL_OFFSET * 4)
+#define BUF_HEAD_OFFSET			(FIQ_HEAD_OFFSET * 4)
+#define BUF_BUF_LEN			(FIQ_BUF_LEN * 4)
+#define BUF_KEY				(FIQ_KEY * 4)
+#define BUF_MISSED_KEYS			(FIQ_MISSED_KEYS * 4)
+#define BUF_BUFFER_START		(FIQ_BUFFER_START * 4)
+#define BUF_GPIO_INT_MASK		(FIQ_GPIO_INT_MASK * 4)
+#define BUF_KEYS_HICNT			(FIQ_KEYS_HICNT * 4)
+#define BUF_IRQ_PEND			(FIQ_IRQ_PEND * 4)
+#define BUF_SIR_CODE_L1			(FIQ_SIR_CODE_L1 * 4)
+#define BUF_SIR_CODE_L2			(IRQ_SIR_CODE_L2 * 4)
+#define BUF_CNT_INT_00			(FIQ_CNT_INT_00 * 4)
+#define BUF_CNT_INT_KEY			(FIQ_CNT_INT_KEY * 4)
+#define BUF_CNT_INT_MDM			(FIQ_CNT_INT_MDM * 4)
+#define BUF_CNT_INT_03			(FIQ_CNT_INT_03 * 4)
+#define BUF_CNT_INT_HSW			(FIQ_CNT_INT_HSW * 4)
+#define BUF_CNT_INT_05			(FIQ_CNT_INT_05 * 4)
+#define BUF_CNT_INT_06			(FIQ_CNT_INT_06 * 4)
+#define BUF_CNT_INT_07			(FIQ_CNT_INT_07 * 4)
+#define BUF_CNT_INT_08			(FIQ_CNT_INT_08 * 4)
+#define BUF_CNT_INT_09			(FIQ_CNT_INT_09 * 4)
+#define BUF_CNT_INT_10			(FIQ_CNT_INT_10 * 4)
+#define BUF_CNT_INT_11			(FIQ_CNT_INT_11 * 4)
+#define BUF_CNT_INT_12			(FIQ_CNT_INT_12 * 4)
+#define BUF_CNT_INT_13			(FIQ_CNT_INT_13 * 4)
+#define BUF_CNT_INT_14			(FIQ_CNT_INT_14 * 4)
+#define BUF_CNT_INT_15			(FIQ_CNT_INT_15 * 4)
+#define BUF_CIRC_BUFF			(FIQ_CIRC_BUFF * 4)
+
+
+/*
+ * Register useage
+ * r8  - temporary
+ * r9  - the driver buffer
+ * r10 - temporary
+ * r11 - interrupts mask
+ * r12 - base pointers
+ * r13 - interrupts status
+ */
+
+	.text
+
+	.global qwerty_fiqin_end
+
+ENTRY(qwerty_fiqin_start)
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+	@ FIQ intrrupt handler
+	ldr r12, omap_ih1_base			@ set pointer to level1 handler
+
+	ldr r11, [r12, #IRQ_MIR_REG_OFFSET]	@ fetch interrupts mask
+
+	ldr r13, [r12, #IRQ_ITR_REG_OFFSET]	@ fetch interrupts status
+	bics r13, r13, r11			@ clear masked - any left?
+	beq exit				@ none - spurious FIQ? exit
+
+	ldr r10, [r12, #IRQ_SIR_FIQ_REG_OFFSET]	@ get requested interrupt number
+
+	mov r8, #2				@ reset FIQ agreement
+	str r8, [r12, #IRQ_CONTROL_REG_OFFSET]
+
+	cmp r10, #INT_GPIO_BANK1		@ is it GPIO bank interrupt?
+	beq gpio				@ yes - process it
+
+	mov r8, #1
+	orr r8, r11, r8, lsl r10		@ mask spurious interrupt
+	str r8, [r12, #IRQ_MIR_REG_OFFSET]
+exit:
+	subs	pc, lr, #4			@ return from FIQ
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@
+gpio:	@ GPIO bank interrupt handler
+	ldr r12, omap1510_gpio_base		@ set base pointer to GPIO bank
+
+	ldr r11, [r12, #OMAP1510_GPIO_INT_MASK]	@ fetch GPIO interrupts mask
+restart:
+	ldr r13, [r12, #OMAP1510_GPIO_INT_STATUS]	@ fetch status bits
+	bics r13, r13, r11			@ clear masked - any left?
+	beq exit				@ no - spurious interrupt? exit
+
+	orr r11, r11, r13			@ mask all requested interrupts
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]
+
+	ands r10, r13, #KEYBRD_CLK_MASK		@ extract keyboard status - set?
+	beq hksw				@ no - try next source
+
+
+	@@@@@@@@@@@@@@@@@@@@@@
+	@ Keyboard clock FIQ mode interrupt handler
+	@ r10 now contains KEYBRD_CLK_MASK, use it
+	str r10, [r12, #OMAP1510_GPIO_INT_STATUS]	@ ack the interrupt
+	bic r11, r10					@ unmask it
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]
+
+	@ Process keyboard data
+	ldr r8, [r12, #OMAP1510_GPIO_DATA_INPUT]	@ fetch GPIO input
+
+	ldr r10, [r9, #BUF_STATE]		@ fetch kbd interface state
+	cmp r10, #0				@ are we expecting start bit?
+	bne data				@ no - go to data processing
+
+	ands r8, #KEYBRD_DATA_MASK		@ check start bit - detected?
+	beq hksw				@ no - try next source
+
+	@ r8 contains KEYBRD_DATA_MASK, use it
+	str r8, [r9, #BUF_STATE]		@ enter data processing state
+	@ r10 already contains 0, reuse it
+	str r10, [r9, #BUF_KEY]			@ clear keycode
+	mov r10, #2				@ reset input bit mask
+	str r10, [r9, #BUF_MASK]
+
+	@ Mask other GPIO line interrupts till key done
+	str r11, [r9, #BUF_GPIO_INT_MASK]	@ save mask for later restore
+	mvn r11, #KEYBRD_CLK_MASK		@ prepare all except kbd mask
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]	@ store into the mask register
+
+	b restart				@ restart
+
+data:	ldr r10, [r9, #BUF_MASK]		@ fetch current input bit mask
+
+	@ r8 still contains GPIO input bits
+	ands r8, r8, #KEYBRD_DATA_MASK		@ is keyboard data line low?
+	ldreq r8, [r9, #BUF_KEY]		@ yes - fetch collected so far,
+	orreq r8, r8, r10			@ set 1@current mask position
+	streq r8, [r9, #BUF_KEY]		@ and save back
+
+	mov r10, r10, lsl #1			@ shift mask left
+	bics r10, #0x800			@ have we got all the bits?
+	strne r10, [r9, #BUF_MASK]		@ not yet - store the mask
+	bne restart				@ and restart
+
+	@ r10 already contains 0, reuse it
+	str r10, [r9, #BUF_STATE]		@ reset state to start
+
+	@ Key done - restore interrupt mask
+	ldr r10, [r9, #BUF_GPIO_INT_MASK]	@ fetch saved mask
+	and r11, r11, r10			@ unmask all saved as unmasked
+	str r11, [r12, #OMAP1510_GPIO_INT_MASK]	@ restore into the mask register
+
+	@ Try appending the keycode to the circular buffer
+	ldr r10, [r9, #BUF_KEYS_CNT]		@ get saved keystrokes count
+	ldr r8, [r9, #BUF_BUF_LEN]		@ get buffer size
+	cmp r10, r8				@ is buffer full?
+	beq hksw				@ yes - key lost, next source
+
+	add r10, r10, #1			@ incremet keystrokes counter
+	str r10, [r9, #BUF_KEYS_CNT]
+
+	ldr r10, [r9, #BUF_TAIL_OFFSET]		@ get buffer tail offset
+	@ r8 already contains buffer size
+	cmp r10, r8				@ end of buffer?
+	moveq r10, #0				@ yes - rewind to buffer start
+
+	ldr r12, [r9, #BUF_BUFFER_START]	@ get buffer start address
+	add r12, r12, r10, LSL #2		@ calculate buffer tail address
+	ldr r8, [r9, #BUF_KEY]			@ get last keycode
+	str r8, [r12]				@ append it to the buffer tail
+
+	add r10, r10, #1			@ increment buffer tail offset
+	str r10, [r9, #BUF_TAIL_OFFSET]
+
+	ldr r10, [r9, #BUF_CNT_INT_KEY]		@ increment interrupts counter
+	add r10, r10, #1
+	str r10, [r9, #BUF_CNT_INT_KEY]
+	@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+hksw:	@Is hook switch interrupt requested?
+	tst r13, #HOOK_SWITCH_MASK 		@ is hook switch status bit set?
+	beq mdm					@ no - try next source
+
+
+	@@@@@@@@@@@@@@@@@@@@@@@@
+	@ Hook switch interrupt FIQ mode simple handler
+
+	@Toggle active edge
+	@ldr r8, [r12,#OMAP1510_GPIO_INT_CONTROL]
+	@eor r8, r8, r10
+	@str r8, [r12,#OMAP1510_GPIO_INT_CONTROL]
+
+	@ Increment hook switch interrupt counter
+	ldr r10, [r9, #BUF_CNT_INT_HSW]
+	add r10, r10, #1
+	str r10, [r9, #BUF_CNT_INT_HSW]
+	@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+mdm:	@Is it a modem interrupt?
+	tst r13, #MODEM_IRQ_MASK 		@ is modem status bit set?
+	beq irq					@ no - check for next interrupt
+
+
+	@@@@@@@@@@@@@@@@@@@@@@@@
+	@ Modem FIQ mode interrupt handler stub
+
+	@ Increment modem interrupt counter
+	ldr r10, [r9, #BUF_CNT_INT_MDM]
+	add r10, r10, #1
+	str r10, [r9, #BUF_CNT_INT_MDM]
+	@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+irq:	@ Place deferred_fiq interrupt request
+	ldr r12, deferred_fiq_ih_base		@ set pointer to IRQ handler
+	mov r10, #DEFERRED_FIQ_MASK		@ set deferred_fiq bit
+	str r10, [r12, #IRQ_ISR_REG_OFFSET] 	@ place it in the ISR register
+
+	ldr r12, omap1510_gpio_base		@ set pointer back to GPIO bank
+	b restart				@ check for next GPIO interrupt
+	@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+
+/*
+ * Virtual addresses for IO
+ */
+omap_ih1_base:
+	.word OMAP1_IO_ADDRESS(OMAP_IH1_BASE)
+deferred_fiq_ih_base:
+	.word OMAP1_IO_ADDRESS(DEFERRED_FIQ_IH_BASE)
+omap1510_gpio_base:
+	.word OMAP1_IO_ADDRESS(OMAP1510_GPIO_BASE)
+qwerty_fiqin_end:
+
+/*
+ * Check the size of the FIQ,
+ * it cannot go beyond 0xffff0200, and is copied to 0xffff001c
+ */
+.if (qwerty_fiqin_end - qwerty_fiqin_start) > (0x200 - 0x1c)
+	.err
+.endif
diff -uprN git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
--- git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	1970-01-01 01:00:00.000000000 +0100
+++ git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	2010-04-14 22:19:37.000000000 +0200
@@ -0,0 +1,72 @@
+/*
+ * arch/arm/mach-omap1/include/ams-delta-fiq.h
+ *
+ * Taken from the original Amstrad modifications to fiq.h
+ *
+ * Copyright (c) 2004 Amstrad Plc
+ * Copyright (c) 2006 Matt Callow
+ * Copyright (c) 2010 Janusz Krzysztofik
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __AMS_DELTA_FIQ_H
+#define __AMS_DELTA_FIQ_H
+
+#include <plat/irqs.h>
+
+/*
+ * Interrupt number used for passing control from FIQ to IRQ.
+ * IRQ12, described as reserved, has been selected.
+ */
+#define INT_DEFERRED_FIQ	INT_1510_RES12
+/*
+ * Base address of an interrupt handler that the INT_DEFERRED_FIQ belongs to.
+ */
+#if (INT_DEFERRED_FIQ < IH2_BASE)
+#define DEFERRED_FIQ_IH_BASE	OMAP_IH1_BASE
+#else
+#define DEFERRED_FIQ_IH_BASE	OMAP_IH2_BASE
+#endif
+
+/*
+ * These are the offsets from the begining of the fiq_buffer. They are put here
+ * since the buffer and header need to be accessed by drivers servicing devices
+ * which generate GPIO interrupts - e.g. keyboard, modem, hook switch.
+ */
+#define FIQ_MASK		 0
+#define FIQ_STATE		 1
+#define FIQ_KEYS_CNT		 2
+#define FIQ_TAIL_OFFSET		 3
+#define FIQ_HEAD_OFFSET		 4
+#define FIQ_BUF_LEN		 5
+#define FIQ_KEY			 6
+#define FIQ_MISSED_KEYS		 7
+#define FIQ_BUFFER_START	 8
+#define FIQ_GPIO_INT_MASK	 9
+#define FIQ_KEYS_HICNT		10
+#define FIQ_IRQ_PEND		11
+#define FIQ_SIR_CODE_L1		12
+#define IRQ_SIR_CODE_L2		13
+
+#define FIQ_CNT_INT_00		14
+#define FIQ_CNT_INT_KEY		15
+#define FIQ_CNT_INT_MDM		16
+#define FIQ_CNT_INT_03		17
+#define FIQ_CNT_INT_HSW		18
+#define FIQ_CNT_INT_05		19
+#define FIQ_CNT_INT_06		20
+#define FIQ_CNT_INT_07		21
+#define FIQ_CNT_INT_08		22
+#define FIQ_CNT_INT_09		23
+#define FIQ_CNT_INT_10		24
+#define FIQ_CNT_INT_11		25
+#define FIQ_CNT_INT_12		26
+#define FIQ_CNT_INT_13		27
+#define FIQ_CNT_INT_14		28
+#define FIQ_CNT_INT_15		29
+
+#define FIQ_CIRC_BUFF		30      /*Start of circular buffer */
+
+#endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
  2010-04-15  2:19 ` Janusz Krzysztofik
@ 2010-04-15  2:26   ` Janusz Krzysztofik
  -1 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:26 UTC (permalink / raw)
  To: linux-omap
  Cc: Tony Lindgren, Dmitry Torokhov, linux-input, linux-arm-kernel,
	e3-hacking

This patch introduces an IRQ handler used for processing interrupts generated
by the FIQ handler when it decides there are data ready for processing.

The handler further invokes device specific interrupt routines based on an
interrupt source as passed from the FIQ handler.

It can be registered by the board as a handler for the otherwise unused 32k
timer interrupt.

Created and tested against linux-2.6.34-rc4.
Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler for 
serial keyboard port interrupt processing".

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- add fiq_buffer[] declaration missing from the header file,
- refresh against 2.6.34-rc2.
v3 changes:
- follow Dmitry's serio cleanup suggestions here as well,
- follow default OMAP GPIO interrupt processing path more closely,
- more optimizations and cleanups.

 arch/arm/mach-omap1/Makefile                     |    2
 arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
 arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
 3 files changed, 163 insertions(+), 1 deletion(-)

diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
--- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
+++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
@@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
 obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
 obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
 obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
-obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
+obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
 obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
 obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
 
diff -uprN git.orig/arch/arm/mach-omap1/ams-delta-fiq.c git/arch/arm/mach-omap1/ams-delta-fiq.c
--- git.orig/arch/arm/mach-omap1/ams-delta-fiq.c	1970-01-01 01:00:00.000000000 +0100
+++ git/arch/arm/mach-omap1/ams-delta-fiq.c	2010-04-14 23:18:10.000000000 +0200
@@ -0,0 +1,155 @@
+/*
+ *  Amstrad E3 FIQ handling
+ *
+ *  Copyright (C) 2009 Janusz Krzysztofik
+ *  Copyright (c) 2006 Matt Callow
+ *  Copyright (c) 2004 Amstrad Plc
+ *  Copyright (C) 2001 RidgeRun, Inc.
+ *
+ * Parts of this code are taken from linux/arch/arm/mach-omap/irq.c
+ * in the MontaVista 2.4 kernel (and the Amstrad changes therein)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+
+#include <plat/io.h>
+#include <plat/board-ams-delta.h>
+
+#include <asm/fiq.h>
+#include <mach/ams-delta-fiq.h>
+
+static struct fiq_handler fh = {
+	.name	= "ams-delta-fiq"
+};
+
+/*
+ * This buffer is shared between FIQ and IRQ contexts.
+ * The FIQ and IRQ isrs can both read and write it.
+ * It is structured as a header section several 32bit slots,
+ * followed by the circular buffer where the FIQ isr stores
+ * keystrokes received from the qwerty keyboard.
+ * See ams-delta-fiq.h for details of offsets.
+ */
+unsigned int fiq_buffer[1024];
+EXPORT_SYMBOL(fiq_buffer);
+
+static unsigned int irq_counter[16];
+
+static irqreturn_t deferred_fiq(int irq, void *dev_id)
+{
+	struct irq_desc *irq_desc;
+	struct irq_chip *irq_chip = NULL;
+	int gpio, irq_num, fiq_count;
+
+	irq_desc = irq_to_desc(IH_GPIO_BASE);
+	if (irq_desc)
+		irq_chip = irq_desc->chip;
+
+	/*
+	 * For each handled GPIO interrupt, keep calling its interrupt handler
+	 * until the IRQ counter catches the FIQ incremented interrupt counter.
+	 */
+	for (gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK;
+			gpio <= AMS_DELTA_GPIO_PIN_HOOK_SWITCH; gpio++) {
+		irq_num = gpio_to_irq(gpio);
+		fiq_count = fiq_buffer[FIQ_CNT_INT_00 + gpio];
+
+		while (irq_counter[gpio] < fiq_count) {
+			if (gpio != AMS_DELTA_GPIO_PIN_KEYBRD_CLK) {
+				/*
+				 * It looks like handle_edge_irq() that
+				 * OMAP GPIO edge interrupts default to,
+				 * expects interrupt already unmasked.
+				 */
+				if (irq_chip && irq_chip->unmask)
+					irq_chip->unmask(irq_num);
+			}
+			generic_handle_irq(irq_num);
+
+			irq_counter[gpio]++;
+		}
+	}
+	return IRQ_HANDLED;
+}
+
+void __init ams_delta_init_fiq(void)
+{
+	void *fiqhandler_start;
+	unsigned int fiqhandler_length;
+	struct pt_regs FIQ_regs;
+	unsigned long val, offset;
+	int i, retval;
+
+	fiqhandler_start = &qwerty_fiqin_start;
+	fiqhandler_length = &qwerty_fiqin_end - &qwerty_fiqin_start;
+	pr_info("Installing fiq handler from %p, length 0x%x\n",
+			fiqhandler_start, fiqhandler_length);
+
+	retval = claim_fiq(&fh);
+	if (retval) {
+		pr_err("ams_delta_init_fiq(): couldn't claim FIQ, ret=%d\n",
+				retval);
+		return;
+	}
+
+	retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq,
+			IRQ_TYPE_EDGE_RISING, "deferred_fiq", 0);
+	if (retval < 0) {
+		pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval);
+		release_fiq(&fh);
+		return;
+	}
+	/*
+	 * Since no set_type() method is provided by OMAP irq chip,
+	 * switch to edge triggered interrupt type manually.
+	 */
+	offset = IRQ_ILR0_REG_OFFSET + INT_DEFERRED_FIQ * 0x4;
+	val = omap_readl(DEFERRED_FIQ_IH_BASE + offset) & ~(1 << 1);
+	omap_writel(val, DEFERRED_FIQ_IH_BASE + offset);
+
+	set_fiq_handler(fiqhandler_start, fiqhandler_length);
+
+	/*
+	 * Initialise the buffer which is shared
+	 * between FIQ mode and IRQ mode
+	 */
+	fiq_buffer[FIQ_GPIO_INT_MASK]	= 0;
+	fiq_buffer[FIQ_MASK]		= 0;
+	fiq_buffer[FIQ_STATE]		= 0;
+	fiq_buffer[FIQ_KEY]		= 0;
+	fiq_buffer[FIQ_KEYS_CNT]	= 0;
+	fiq_buffer[FIQ_KEYS_HICNT]	= 0;
+	fiq_buffer[FIQ_TAIL_OFFSET]	= 0;
+	fiq_buffer[FIQ_HEAD_OFFSET]	= 0;
+	fiq_buffer[FIQ_BUF_LEN]		= 256;
+	fiq_buffer[FIQ_MISSED_KEYS]	= 0;
+	fiq_buffer[FIQ_BUFFER_START]	=
+			(unsigned int) &fiq_buffer[FIQ_CIRC_BUFF];
+
+	for (i = FIQ_CNT_INT_00; i <= FIQ_CNT_INT_15; i++)
+		fiq_buffer[i] = 0;
+
+	/*
+	 * FIQ mode r9 always points to the fiq_buffer, becauses the FIQ isr
+	 * will run in an unpredictable context. The fiq_buffer is the FIQ isr's
+	 * only means of communication with the IRQ level and other kernel
+	 * context code.
+	 */
+	FIQ_regs.ARM_r9 = (unsigned int)fiq_buffer;
+	set_fiq_regs(&FIQ_regs);
+
+	pr_info("request_fiq(): fiq_buffer = %p\n", fiq_buffer);
+
+	/*
+	 * Redirect GPIO interrupts to FIQ
+	 */
+	offset = IRQ_ILR0_REG_OFFSET + INT_GPIO_BANK1 * 0x4;
+	val = omap_readl(OMAP_IH1_BASE + offset) | 1;
+	omap_writel(val, OMAP_IH1_BASE + offset);
+}
diff -uprN git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
--- git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	2010-04-14 22:35:22.000000000 +0200
+++ git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	2010-04-14 23:18:10.000000000 +0200
@@ -69,4 +69,11 @@
 
 #define FIQ_CIRC_BUFF		30      /*Start of circular buffer */
 
+#ifndef __ASSEMBLER__
+extern unsigned int fiq_buffer[];
+extern unsigned char qwerty_fiqin_start, qwerty_fiqin_end;
+
+extern void __init ams_delta_init_fiq(void);
+#endif
+
 #endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
@ 2010-04-15  2:26   ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:26 UTC (permalink / raw)
  To: linux-arm-kernel

This patch introduces an IRQ handler used for processing interrupts generated
by the FIQ handler when it decides there are data ready for processing.

The handler further invokes device specific interrupt routines based on an
interrupt source as passed from the FIQ handler.

It can be registered by the board as a handler for the otherwise unused 32k
timer interrupt.

Created and tested against linux-2.6.34-rc4.
Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler for 
serial keyboard port interrupt processing".

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- add fiq_buffer[] declaration missing from the header file,
- refresh against 2.6.34-rc2.
v3 changes:
- follow Dmitry's serio cleanup suggestions here as well,
- follow default OMAP GPIO interrupt processing path more closely,
- more optimizations and cleanups.

 arch/arm/mach-omap1/Makefile                     |    2
 arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
 arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
 3 files changed, 163 insertions(+), 1 deletion(-)

diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
--- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
+++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
@@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
 obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
 obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
 obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
-obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
+obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
 obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
 obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
 
diff -uprN git.orig/arch/arm/mach-omap1/ams-delta-fiq.c git/arch/arm/mach-omap1/ams-delta-fiq.c
--- git.orig/arch/arm/mach-omap1/ams-delta-fiq.c	1970-01-01 01:00:00.000000000 +0100
+++ git/arch/arm/mach-omap1/ams-delta-fiq.c	2010-04-14 23:18:10.000000000 +0200
@@ -0,0 +1,155 @@
+/*
+ *  Amstrad E3 FIQ handling
+ *
+ *  Copyright (C) 2009 Janusz Krzysztofik
+ *  Copyright (c) 2006 Matt Callow
+ *  Copyright (c) 2004 Amstrad Plc
+ *  Copyright (C) 2001 RidgeRun, Inc.
+ *
+ * Parts of this code are taken from linux/arch/arm/mach-omap/irq.c
+ * in the MontaVista 2.4 kernel (and the Amstrad changes therein)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+
+#include <plat/io.h>
+#include <plat/board-ams-delta.h>
+
+#include <asm/fiq.h>
+#include <mach/ams-delta-fiq.h>
+
+static struct fiq_handler fh = {
+	.name	= "ams-delta-fiq"
+};
+
+/*
+ * This buffer is shared between FIQ and IRQ contexts.
+ * The FIQ and IRQ isrs can both read and write it.
+ * It is structured as a header section several 32bit slots,
+ * followed by the circular buffer where the FIQ isr stores
+ * keystrokes received from the qwerty keyboard.
+ * See ams-delta-fiq.h for details of offsets.
+ */
+unsigned int fiq_buffer[1024];
+EXPORT_SYMBOL(fiq_buffer);
+
+static unsigned int irq_counter[16];
+
+static irqreturn_t deferred_fiq(int irq, void *dev_id)
+{
+	struct irq_desc *irq_desc;
+	struct irq_chip *irq_chip = NULL;
+	int gpio, irq_num, fiq_count;
+
+	irq_desc = irq_to_desc(IH_GPIO_BASE);
+	if (irq_desc)
+		irq_chip = irq_desc->chip;
+
+	/*
+	 * For each handled GPIO interrupt, keep calling its interrupt handler
+	 * until the IRQ counter catches the FIQ incremented interrupt counter.
+	 */
+	for (gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK;
+			gpio <= AMS_DELTA_GPIO_PIN_HOOK_SWITCH; gpio++) {
+		irq_num = gpio_to_irq(gpio);
+		fiq_count = fiq_buffer[FIQ_CNT_INT_00 + gpio];
+
+		while (irq_counter[gpio] < fiq_count) {
+			if (gpio != AMS_DELTA_GPIO_PIN_KEYBRD_CLK) {
+				/*
+				 * It looks like handle_edge_irq() that
+				 * OMAP GPIO edge interrupts default to,
+				 * expects interrupt already unmasked.
+				 */
+				if (irq_chip && irq_chip->unmask)
+					irq_chip->unmask(irq_num);
+			}
+			generic_handle_irq(irq_num);
+
+			irq_counter[gpio]++;
+		}
+	}
+	return IRQ_HANDLED;
+}
+
+void __init ams_delta_init_fiq(void)
+{
+	void *fiqhandler_start;
+	unsigned int fiqhandler_length;
+	struct pt_regs FIQ_regs;
+	unsigned long val, offset;
+	int i, retval;
+
+	fiqhandler_start = &qwerty_fiqin_start;
+	fiqhandler_length = &qwerty_fiqin_end - &qwerty_fiqin_start;
+	pr_info("Installing fiq handler from %p, length 0x%x\n",
+			fiqhandler_start, fiqhandler_length);
+
+	retval = claim_fiq(&fh);
+	if (retval) {
+		pr_err("ams_delta_init_fiq(): couldn't claim FIQ, ret=%d\n",
+				retval);
+		return;
+	}
+
+	retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq,
+			IRQ_TYPE_EDGE_RISING, "deferred_fiq", 0);
+	if (retval < 0) {
+		pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval);
+		release_fiq(&fh);
+		return;
+	}
+	/*
+	 * Since no set_type() method is provided by OMAP irq chip,
+	 * switch to edge triggered interrupt type manually.
+	 */
+	offset = IRQ_ILR0_REG_OFFSET + INT_DEFERRED_FIQ * 0x4;
+	val = omap_readl(DEFERRED_FIQ_IH_BASE + offset) & ~(1 << 1);
+	omap_writel(val, DEFERRED_FIQ_IH_BASE + offset);
+
+	set_fiq_handler(fiqhandler_start, fiqhandler_length);
+
+	/*
+	 * Initialise the buffer which is shared
+	 * between FIQ mode and IRQ mode
+	 */
+	fiq_buffer[FIQ_GPIO_INT_MASK]	= 0;
+	fiq_buffer[FIQ_MASK]		= 0;
+	fiq_buffer[FIQ_STATE]		= 0;
+	fiq_buffer[FIQ_KEY]		= 0;
+	fiq_buffer[FIQ_KEYS_CNT]	= 0;
+	fiq_buffer[FIQ_KEYS_HICNT]	= 0;
+	fiq_buffer[FIQ_TAIL_OFFSET]	= 0;
+	fiq_buffer[FIQ_HEAD_OFFSET]	= 0;
+	fiq_buffer[FIQ_BUF_LEN]		= 256;
+	fiq_buffer[FIQ_MISSED_KEYS]	= 0;
+	fiq_buffer[FIQ_BUFFER_START]	=
+			(unsigned int) &fiq_buffer[FIQ_CIRC_BUFF];
+
+	for (i = FIQ_CNT_INT_00; i <= FIQ_CNT_INT_15; i++)
+		fiq_buffer[i] = 0;
+
+	/*
+	 * FIQ mode r9 always points to the fiq_buffer, becauses the FIQ isr
+	 * will run in an unpredictable context. The fiq_buffer is the FIQ isr's
+	 * only means of communication with the IRQ level and other kernel
+	 * context code.
+	 */
+	FIQ_regs.ARM_r9 = (unsigned int)fiq_buffer;
+	set_fiq_regs(&FIQ_regs);
+
+	pr_info("request_fiq(): fiq_buffer = %p\n", fiq_buffer);
+
+	/*
+	 * Redirect GPIO interrupts to FIQ
+	 */
+	offset = IRQ_ILR0_REG_OFFSET + INT_GPIO_BANK1 * 0x4;
+	val = omap_readl(OMAP_IH1_BASE + offset) | 1;
+	omap_writel(val, OMAP_IH1_BASE + offset);
+}
diff -uprN git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
--- git.orig/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	2010-04-14 22:35:22.000000000 +0200
+++ git/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h	2010-04-14 23:18:10.000000000 +0200
@@ -69,4 +69,11 @@
 
 #define FIQ_CIRC_BUFF		30      /*Start of circular buffer */
 
+#ifndef __ASSEMBLER__
+extern unsigned int fiq_buffer[];
+extern unsigned char qwerty_fiqin_start, qwerty_fiqin_end;
+
+extern void __init ams_delta_init_fiq(void);
+#endif
+
 #endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 2.1/5(7)] OMAP1: Amstrad Delta: update board initialization code for complete modem IRQ GPIO line setup
  2010-04-15  2:19 ` Janusz Krzysztofik
                   ` (3 preceding siblings ...)
  (?)
@ 2010-04-15  2:27 ` Janusz Krzysztofik
  -1 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, e3-hacking

In case of Amstrad Delta modem utilized GPIO line, interrupt is requested from 
standard serial8250 driver code without first requesting the GPIO pin itself. 
Even if it works with default OMAP GPIO interrupt handler, it appeared not 
compatible with recent, optimized version of the board WiP GPIO FIQ handler, 
required for fast processing of interrupts generated by other GPIO pin that a 
serial keyboard clock hangs off.

This patch fills the board specific modem initialization routine with common 
GPIO line reservation and direction setup.

Even if included in the Amstrad Delta FIQ patch set, can be applied alone in 
advance as well, possibly as a fix.

Created and tested against linux-2.6.34-rc4.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---

 arch/arm/mach-omap1/board-ams-delta.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- git.orig/arch/arm/mach-omap1/board-ams-delta.c	2010-04-14 03:07:13.000000000 +0200
+++ git/arch/arm/mach-omap1/board-ams-delta.c	2010-04-14 21:58:12.000000000 +0200
@@ -263,8 +263,18 @@ static struct platform_device ams_delta_
 
 static int __init ams_delta_modem_init(void)
 {
+	int err;
+
 	omap_cfg_reg(M14_1510_GPIO2);
-	ams_delta_modem_ports[0].irq = gpio_to_irq(2);
+	ams_delta_modem_ports[0].irq =
+			gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
+
+	err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem");
+	if (err) {
+		pr_err("Couldn't request gpio pin for modem\n");
+		return err;
+	}
+	gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
 	ams_delta_latch2_write(
 		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 3/5(7)] OMAP1: Amstrad Delta: use FIQ for processing GPIO interrupts
  2010-04-15  2:19 ` Janusz Krzysztofik
@ 2010-04-15  2:29   ` Janusz Krzysztofik
  -1 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:29 UTC (permalink / raw)
  To: linux-omap
  Cc: Tony Lindgren, Dmitry Torokhov, linux-input, linux-arm-kernel,
	e3-hacking

The patch adds initialization of FIQ related handlers to the Amstrad Delta
videophone board code. FIQ will be used instead of a traditional IRQ for
processing all GPIO generated interrupts, including a keyboard serial clock 
line.

Created and tested against linux-2.6.34-rc4.
Compiles and works on top of PATCH v3 2/5(7), "OMAP1: Amstrad Delta: add a 
handler for processing interrupts generated by the FIQ routine". Also requires 
PATCH v3 2.1/5(7), "OMAP1: Amstrad Delta: update board initialization code 
for complete modem IRQ GPIO line setup" for correct modem handling.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- no functional changes,
- refreshed against linux-2.6.34-rc2.
v3 changes:
- drop intermediate defconfig modification

 arch/arm/mach-omap1/board-ams-delta.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- git.orig/arch/arm/mach-omap1/board-ams-delta.c	2010-04-14 22:18:25.000000000 +0200
+++ git/arch/arm/mach-omap1/board-ams-delta.c	2010-04-14 23:52:07.000000000 +0200
@@ -33,6 +33,8 @@
 #include <plat/board.h>
 #include <plat/common.h>
 
+#include <mach/ams-delta-fiq.h>
+
 static u8 ams_delta_latch1_reg;
 static u16 ams_delta_latch2_reg;
 
@@ -236,6 +238,10 @@ static void __init ams_delta_init(void)
 	omap_usb_init(&ams_delta_usb_config);
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 
+#ifdef CONFIG_AMS_DELTA_FIQ
+	ams_delta_init_fiq();
+#endif
+
 	omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
 }
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 3/5(7)] OMAP1: Amstrad Delta: use FIQ for processing GPIO interrupts
@ 2010-04-15  2:29   ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:29 UTC (permalink / raw)
  To: linux-arm-kernel

The patch adds initialization of FIQ related handlers to the Amstrad Delta
videophone board code. FIQ will be used instead of a traditional IRQ for
processing all GPIO generated interrupts, including a keyboard serial clock 
line.

Created and tested against linux-2.6.34-rc4.
Compiles and works on top of PATCH v3 2/5(7), "OMAP1: Amstrad Delta: add a 
handler for processing interrupts generated by the FIQ routine". Also requires 
PATCH v3 2.1/5(7), "OMAP1: Amstrad Delta: update board initialization code 
for complete modem IRQ GPIO line setup" for correct modem handling.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- no functional changes,
- refreshed against linux-2.6.34-rc2.
v3 changes:
- drop intermediate defconfig modification

 arch/arm/mach-omap1/board-ams-delta.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- git.orig/arch/arm/mach-omap1/board-ams-delta.c	2010-04-14 22:18:25.000000000 +0200
+++ git/arch/arm/mach-omap1/board-ams-delta.c	2010-04-14 23:52:07.000000000 +0200
@@ -33,6 +33,8 @@
 #include <plat/board.h>
 #include <plat/common.h>
 
+#include <mach/ams-delta-fiq.h>
+
 static u8 ams_delta_latch1_reg;
 static u16 ams_delta_latch2_reg;
 
@@ -236,6 +238,10 @@ static void __init ams_delta_init(void)
 	omap_usb_init(&ams_delta_usb_config);
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 
+#ifdef CONFIG_AMS_DELTA_FIQ
+	ams_delta_init_fiq();
+#endif
+
 	omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
 }
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 4/5(7)] input: serio: add support for Amstrad Delta serial keyboard port
  2010-04-15  2:19 ` Janusz Krzysztofik
                   ` (5 preceding siblings ...)
  (?)
@ 2010-04-15  2:31 ` Janusz Krzysztofik
  2010-04-15 16:14   ` Dmitry Torokhov
  -1 siblings, 1 reply; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:31 UTC (permalink / raw)
  To: linux-input; +Cc: linux-omap, Tony Lindgren, Dmitry Torokhov, e3-hacking

The patch introduces a serio driver that supports a keyboard serial port found
on the Amstrad Delta videophone board.

After initializing the hardware, the driver reads its input data from a buffer
filled in by the board FIQ (Fast Interrupt Request) handler.

Standard AT keyboard driver (atkbd) will be used on top of the serio layer for 
handling the E3 keyboard (called mailboard) connected to the port. Since the 
device generated scancodes differ from what the atkbd expects, a custom key 
code to scan code table must be loaded from userspace for the keyboard to be 
useable.

Compiles and works on top of PATCH v3 3/5(7), "OMAP1: Amstrad Delta: use FIQ 
for processing GPIO interrupts".

Created and tested against linux-2.6.34-rc4.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- use correct variable name for return value in ams_delta_kbd_init(),
- remove scan code to key code mapping,
- refreshed against linux-2.6.34-rc2.
v3 changes:
- cleanups suggested by Dmitry,
- force using of handle_simple_irq() to avoid GPIO register manipulation, 
  already handled at FIQ level,
- modify Kconfig for automatic AT keyboard and FIQ handler selection,
- misc cleanups.

 drivers/input/serio/Kconfig           |   17 +++
 drivers/input/serio/Makefile          |    1
 drivers/input/serio/ams_delta_serio.c |  177 ++++++++++++++++++++++++++++++++++
 3 files changed, 195 insertions(+)

diff -uprN git.orig/drivers/input/serio/Kconfig git/drivers/input/serio/Kconfig
--- git.orig/drivers/input/serio/Kconfig	2010-04-14 03:07:47.000000000 +0200
+++ git/drivers/input/serio/Kconfig	2010-04-15 02:34:33.000000000 +0200
@@ -210,3 +210,20 @@ config SERIO_ALTERA_PS2
 	  module will be called altera_ps2.
 
 endif
+
+config SERIO_AMS_DELTA
+	tristate "Amstrad Delta (E3) mailboard support"
+	depends on MACH_AMS_DELTA
+	default y
+	select AMS_DELTA_FIQ
+	select KEYBOARD_ATKBD
+	---help---
+	  Say Y here if you have an E3 and want to use its mailboard,
+	  or any standard AT keyboard connected to the mailboard port.
+
+	  When used for the E3 mailboard, a non-standard key table
+	  must be loaded from userspace, possibly using udev extras
+	  provided keymap helper utility.
+
+	  To compile this driver as a module, choose M here;
+	  the module will be called ams_delta_serio
diff -uprN git.orig/drivers/input/serio/Makefile git/drivers/input/serio/Makefile
--- git.orig/drivers/input/serio/Makefile	2010-04-14 03:07:47.000000000 +0200
+++ git/drivers/input/serio/Makefile	2010-04-15 02:34:33.000000000 +0200
@@ -21,5 +21,6 @@ obj-$(CONFIG_SERIO_PCIPS2)	+= pcips2.o
 obj-$(CONFIG_SERIO_MACEPS2)	+= maceps2.o
 obj-$(CONFIG_SERIO_LIBPS2)	+= libps2.o
 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
diff -uprN git.orig/drivers/input/serio/ams_delta_serio.c git/drivers/input/serio/ams_delta_serio.c
--- git.orig/drivers/input/serio/ams_delta_serio.c	1970-01-01 01:00:00.000000000 +0100
+++ git/drivers/input/serio/ams_delta_serio.c	2010-04-15 02:34:33.000000000 +0200
@@ -0,0 +1,177 @@
+/*
+ *  Amstrad E3 (Delta) keyboard port driver
+ *
+ *  Copyright (c) 2006 Matt Callow
+ *  Copyright (c) 2010 Janusz Krzysztofik
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * Thanks to Cliff Lawson for his help
+ *
+ * The Amstrad Delta keyboard (aka mailboard) uses normal PC-AT style serial
+ * transmission.  The keyboard port is formed of two GPIO lines, for clock
+ * and data.  Due to strict timing requirements of the interface,
+ * the serial data stream is read and processed by a FIQ handler.
+ * The resulting words are fetched by this driver from a circular buffer.
+ *
+ * Standard AT keyboard driver (atkbd) is used for handling the keyboard data.
+ * However, when used with the E3 mailboard that producecs non-standard
+ * scancodes, a custom key table must be prepared and loaded from userspace.
+ */
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/serio.h>
+#include <linux/slab.h>
+
+#include <asm/mach-types.h>
+#include <plat/board-ams-delta.h>
+
+#include <mach/ams-delta-fiq.h>
+
+MODULE_AUTHOR("Matt Callow");
+MODULE_DESCRIPTION("AMS Delta (E3) keyboard port driver");
+MODULE_LICENSE("GPL");
+
+static struct serio *ams_delta_serio;
+
+static int check_data(int data)
+{
+	int i, parity = 0;
+
+	/* check valid stop bit */
+	if (!(data & 0x400)) {
+		dev_warn(&ams_delta_serio->dev,
+				"invalid stop bit, data=0x%X\n",
+				data);
+		return SERIO_FRAME;
+	}
+	/* calculate the parity */
+	for (i = 1; i < 10; i++) {
+		if (data & (1 << i))
+			parity++;
+	}
+	/* it should be odd */
+	if (!(parity & 0x01)) {
+		dev_warn(&ams_delta_serio->dev,
+				"paritiy check failed, data=0x%X parity=0x%X\n",
+				data, parity);
+		return SERIO_PARITY;
+	}
+	return 0;
+}
+
+static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
+{
+	int *circ_buff = &fiq_buffer[FIQ_CIRC_BUFF];
+	int data, dfl;
+	u8 scancode;
+
+	fiq_buffer[FIQ_IRQ_PEND] = 0;
+
+	/*
+	 * Read data from the circular buffer, check it
+	 * and then pass it on the serio
+	 */
+	while (fiq_buffer[FIQ_KEYS_CNT] > 0) {
+
+		data = circ_buff[fiq_buffer[FIQ_HEAD_OFFSET]++];
+		fiq_buffer[FIQ_KEYS_CNT]--;
+		if (fiq_buffer[FIQ_HEAD_OFFSET] == fiq_buffer[FIQ_BUF_LEN])
+			fiq_buffer[FIQ_HEAD_OFFSET] = 0;
+
+		dfl = check_data(data);
+		scancode = (u8) (data >> 1) & 0xFF;
+		serio_interrupt(ams_delta_serio, scancode, dfl);
+	}
+	return IRQ_HANDLED;
+}
+
+static int ams_delta_serio_open(struct serio *serio)
+{
+	/* enable keyboard */
+	ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR,
+			AMD_DELTA_LATCH2_KEYBRD_PWR);
+	
+	return 0;
+}
+
+static void ams_delta_serio_close(struct serio *serio)
+{
+	/* disable keyboard */
+	ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0);
+}
+
+static int __init ams_delta_serio_init(void)
+{
+	int err;
+
+	if (!(machine_is_ams_delta()))
+		return -ENODEV;
+
+	ams_delta_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+	if (!ams_delta_serio)
+		return -ENOMEM;
+
+	ams_delta_serio->id.type = SERIO_8042;
+	ams_delta_serio->open = ams_delta_serio_open;
+	ams_delta_serio->close = ams_delta_serio_close;
+	strlcpy(ams_delta_serio->name, "AMS DELTA keyboard adapter",
+			sizeof(ams_delta_serio->name));
+	strlcpy(ams_delta_serio->phys, "GPIO/serio0",
+			sizeof(ams_delta_serio->phys));
+
+	err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+	if (err) {
+		pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
+		goto serio;
+	}
+	gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+
+	err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
+	if (err) {
+		pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
+		goto gpio_data;
+	}
+	gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
+
+	err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
+			ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
+			"ams-delta-serio", 0);
+	if (err < 0) {
+		pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
+				gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
+		goto gpio_clk;
+	}
+	/*
+	 * Since GPIO register handling for keyboard clock pin is performed
+	 * at FIQ level, switch back from edge to simple interrupt handler
+	 * to avoid bad interaction.
+	 */
+	set_irq_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
+			handle_simple_irq);
+
+	serio_register_port(ams_delta_serio);
+	dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
+
+	return 0;
+gpio_clk:
+	gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
+gpio_data:
+	gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+serio:
+	kfree(ams_delta_serio);
+	return err;
+}
+module_init(ams_delta_serio_init);
+
+static void __exit ams_delta_serio_exit(void)
+{
+	serio_unregister_port(ams_delta_serio);
+	free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
+	gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
+	gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
+	kfree(ams_delta_serio);
+}
+module_exit(ams_delta_serio_exit);

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 5/5(7)] OMAP1: Amstrad Delta: modify defconfig for external keyboard support
  2010-04-15  2:19 ` Janusz Krzysztofik
                   ` (6 preceding siblings ...)
  (?)
@ 2010-04-15  2:32 ` Janusz Krzysztofik
  -1 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15  2:32 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Dmitry Torokhov, linux-input, e3-hacking

The patch adds a CONFIG directive required for supporting the Amstrad Delta
connected external keyboard by default.

Created and tested against linux-2.6.34-rc2.
Works on top of PATCH 4/5(7), "input: serio: add support for Amstrad Delta 
serial keyboard port".

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v2 changes:
- no functional changes,
- refreshed against linux-2.6.34-rc2.
v3 changes:
- since CONFIG_KEYBOARD_ATKBD and CONFIG_AMS_DELTA_FIQ are now selected 
  automatically, limit defconfig changes to CONFIG_SERIO_AMS_DELTA selection

 arch/arm/configs/ams_delta_defconfig |    1 +
 1 file changed, 1 insertion(+)

--- git.orig/arch/arm/configs/ams_delta_defconfig	2010-04-14 03:11:50.000000000 +0200
+++ git/arch/arm/configs/ams_delta_defconfig	2010-04-15 03:29:05.000000000 +0200
@@ -699,6 +699,7 @@ CONFIG_SERIO=y
 CONFIG_SERIO_SERPORT=y
 CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
+CONFIG_SERIO_AMS_DELTA=y
 # CONFIG_GAMEPORT is not set
 
 #

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 4/5(7)] input: serio: add support for Amstrad Delta serial keyboard port
  2010-04-15  2:31 ` [PATCH v3 4/5(7)] input: serio: add support for Amstrad Delta serial keyboard port Janusz Krzysztofik
@ 2010-04-15 16:14   ` Dmitry Torokhov
  2010-04-15 18:16     ` Janusz Krzysztofik
  0 siblings, 1 reply; 22+ messages in thread
From: Dmitry Torokhov @ 2010-04-15 16:14 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: linux-input, linux-omap, Tony Lindgren, e3-hacking

Hi Janusz,

On Thu, Apr 15, 2010 at 04:31:03AM +0200, Janusz Krzysztofik wrote:
> +
> +config SERIO_AMS_DELTA
> +	tristate "Amstrad Delta (E3) mailboard support"
> +	depends on MACH_AMS_DELTA
> +	default y
> +	select AMS_DELTA_FIQ
> +	select KEYBOARD_ATKBD

I'd rather not select atkbd here since it is not required for this
driver to work but simply adjust your defconfig.

> +
> +	if (!(machine_is_ams_delta()))
> +		return -ENODEV;

Extra parens.

Otherwise:

	Acked-by: Dmitry Torokhov <dtor@mail.ru>

I assume it is going to be merged with the rest of your patches through
a tree other than linux-input.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 4/5(7)] input: serio: add support for Amstrad Delta serial keyboard port
  2010-04-15 16:14   ` Dmitry Torokhov
@ 2010-04-15 18:16     ` Janusz Krzysztofik
  2010-04-22 23:14       ` Tony Lindgren
  0 siblings, 1 reply; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-15 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-omap, Tony Lindgren, e3-hacking

Thursday 15 April 2010 18:14:51 Dmitry Torokhov napisał(a):
> Hi Janusz,

Hi Dmitry,

> On Thu, Apr 15, 2010 at 04:31:03AM +0200, Janusz Krzysztofik wrote:
> > +
> > +config SERIO_AMS_DELTA
> > +	tristate "Amstrad Delta (E3) mailboard support"
> > +	depends on MACH_AMS_DELTA
> > +	default y
> > +	select AMS_DELTA_FIQ
> > +	select KEYBOARD_ATKBD
>
> I'd rather not select atkbd here since it is not required for this
> driver to work but simply adjust your defconfig.

I was just trying to address possible future support questions, as you can 
already find them in the e3-hacking 2006 archives :).

OK, I'll drop it then and move the config back inside the "if SERIO"..."endif" 
block.

> > +
> > +	if (!(machine_is_ams_delta()))
> > +		return -ENODEV;
>
> Extra parens.

Yes, it looks like I'm too much wary. I'll drop them.

> Otherwise:
>
> 	Acked-by: Dmitry Torokhov <dtor@mail.ru>

Thanks.

> I assume it is going to be merged with the rest of your patches through
> a tree other than linux-input.

Probably yes, since it depends on most of them. Let's see first what Tony 
says.

Regards,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 0.1/5(7)] OMAP: add missing FIQ_START definition required for arch/arm/kernel/fiq.c compilation (was: OMAP: add missing FIQ_START definition required for arch/arm/plat-omap/fiq.c compilation)
  2010-04-15  2:23 ` [PATCH v3 0.1/5(7)] OMAP: add missing FIQ_START definition required for arch/arm/plat-omap/fiq.c compilation Janusz Krzysztofik
@ 2010-04-20  9:14   ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-20  9:14 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, e3-hacking

Thursday 15 April 2010 04:23:04 Janusz Krzysztofik napisał(a):
> Several ARM platforms/machines that use FIQ define their value of
> FIQ_START. Since FIQ is not implemented for OMAP yet, this definition is
> missing from OMAP header files.
>
> Put an arbitrary value for FIQ_START into plat/irqs.h for OMAP. Even if not
> used by the WiP FIQ handler for Amstrad Delta, this is required for
> successfull compilation of arch/arm/plat-omap/fiq.c that provides several
> usefull functions.


Hi,
I've just noticed that I messsed up the file name. It's arch/arm/kernel/fiq.c 
that does not compile without platform provided FIQ_START definition. 
Sorry for this.

Thanks,
Janusz

> Even if prepended in front of the Amstrad Delta FIQ patch set, can be
> applied alone in advance as well, possibly as a fix.
>
> Created and tested against linux-2.6.34-rc4.
>
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> ---
>
>  arch/arm/plat-omap/include/plat/irqs.h |    4 ++++
>  1 file changed, 4 insertions(+)
>
> --- git.orig/arch/arm/plat-omap/include/plat/irqs.h	2010-04-14 03:07:16.000000000 +0200
> +++ > git/arch/arm/plat-omap/include/plat/irqs.h	2010-04-14 22:28:05.000000000 +0200
> @@ -430,4 +430,8 @@ void omap3_intc_resume_idle(void); 
>
>  #include <mach/hardware.h>
>
> +#ifdef CONFIG_FIQ
> +#define FIQ_START		1024
> +#endif
> +
>  #endif


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 4/5(7)] input: serio: add support for Amstrad Delta serial keyboard port
  2010-04-15 18:16     ` Janusz Krzysztofik
@ 2010-04-22 23:14       ` Tony Lindgren
  0 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2010-04-22 23:14 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: Dmitry Torokhov, linux-input, linux-omap, e3-hacking

* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100415 11:14]:
> Thursday 15 April 2010 18:14:51 Dmitry Torokhov napisał(a):
> > Hi Janusz,
> 
> Hi Dmitry,
> 
> > On Thu, Apr 15, 2010 at 04:31:03AM +0200, Janusz Krzysztofik wrote:
> > > +
> > > +config SERIO_AMS_DELTA
> > > +	tristate "Amstrad Delta (E3) mailboard support"
> > > +	depends on MACH_AMS_DELTA
> > > +	default y
> > > +	select AMS_DELTA_FIQ
> > > +	select KEYBOARD_ATKBD
> >
> > I'd rather not select atkbd here since it is not required for this
> > driver to work but simply adjust your defconfig.
> 
> I was just trying to address possible future support questions, as you can 
> already find them in the e3-hacking 2006 archives :).
> 
> OK, I'll drop it then and move the config back inside the "if SERIO"..."endif" 
> block.
> 
> > > +
> > > +	if (!(machine_is_ams_delta()))
> > > +		return -ENODEV;
> >
> > Extra parens.
> 
> Yes, it looks like I'm too much wary. I'll drop them.
> 
> > Otherwise:
> >
> > 	Acked-by: Dmitry Torokhov <dtor@mail.ru>
> 
> Thanks.
> 
> > I assume it is going to be merged with the rest of your patches through
> > a tree other than linux-input.
> 
> Probably yes, since it depends on most of them. Let's see first what Tony 
> says.

Sorry for the delay, quite a few patches to read through right now..

Looks pretty good to me, I have one comment on the FIQ though.

After the remaining fixes, could you please repost the whole series
one more time now with linux-arm-kernel also cc'd?

Then if no more comments there, I'll add add it to omap for-next.

Cheers,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
  2010-04-15  2:26   ` Janusz Krzysztofik
@ 2010-04-22 23:17     ` Tony Lindgren
  -1 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2010-04-22 23:17 UTC (permalink / raw)
  To: Janusz Krzysztofik
  Cc: linux-omap, Dmitry Torokhov, linux-input, linux-arm-kernel, e3-hacking

* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100414 19:24]:
> This patch introduces an IRQ handler used for processing interrupts generated
> by the FIQ handler when it decides there are data ready for processing.
> 
> The handler further invokes device specific interrupt routines based on an
> interrupt source as passed from the FIQ handler.
> 
> It can be registered by the board as a handler for the otherwise unused 32k
> timer interrupt.
> 
> Created and tested against linux-2.6.34-rc4.
> Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler for 
> serial keyboard port interrupt processing".
> 
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> ---
> v2 changes:
> - add fiq_buffer[] declaration missing from the header file,
> - refresh against 2.6.34-rc2.
> v3 changes:
> - follow Dmitry's serio cleanup suggestions here as well,
> - follow default OMAP GPIO interrupt processing path more closely,
> - more optimizations and cleanups.
> 
>  arch/arm/mach-omap1/Makefile                     |    2
>  arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
>  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
>  3 files changed, 163 insertions(+), 1 deletion(-)
> 
> diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
> --- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
> +++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
> @@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
>  obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
>  obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
>  obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
> -obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
> +obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
>  obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
>  obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o

Do you really need a separate option for CONFIG_AMS_DELTA_FIQ?
To me it seems you can just compile it in when CONFIG_MACH_AMS_DELTA
is selected.

Also, please make sure the FIQ only gets initialized for the right
board when multiple boards are compiled in.

Regards,

Tony

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
@ 2010-04-22 23:17     ` Tony Lindgren
  0 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2010-04-22 23:17 UTC (permalink / raw)
  To: linux-arm-kernel

* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100414 19:24]:
> This patch introduces an IRQ handler used for processing interrupts generated
> by the FIQ handler when it decides there are data ready for processing.
> 
> The handler further invokes device specific interrupt routines based on an
> interrupt source as passed from the FIQ handler.
> 
> It can be registered by the board as a handler for the otherwise unused 32k
> timer interrupt.
> 
> Created and tested against linux-2.6.34-rc4.
> Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler for 
> serial keyboard port interrupt processing".
> 
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> ---
> v2 changes:
> - add fiq_buffer[] declaration missing from the header file,
> - refresh against 2.6.34-rc2.
> v3 changes:
> - follow Dmitry's serio cleanup suggestions here as well,
> - follow default OMAP GPIO interrupt processing path more closely,
> - more optimizations and cleanups.
> 
>  arch/arm/mach-omap1/Makefile                     |    2
>  arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
>  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
>  3 files changed, 163 insertions(+), 1 deletion(-)
> 
> diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
> --- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
> +++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
> @@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
>  obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
>  obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
>  obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
> -obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
> +obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
>  obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
>  obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o

Do you really need a separate option for CONFIG_AMS_DELTA_FIQ?
To me it seems you can just compile it in when CONFIG_MACH_AMS_DELTA
is selected.

Also, please make sure the FIQ only gets initialized for the right
board when multiple boards are compiled in.

Regards,

Tony

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
  2010-04-22 23:17     ` Tony Lindgren
@ 2010-04-23  1:21       ` Janusz Krzysztofik
  -1 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-23  1:21 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: e3-hacking, linux-omap, Dmitry Torokhov, linux-arm-kernel, linux-input

Friday 23 April 2010 01:17:26 Tony Lindgren napisał(a):
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100414 19:24]:
> > This patch introduces an IRQ handler used for processing interrupts
> > generated by the FIQ handler when it decides there are data ready for
> > processing.
> >
> > The handler further invokes device specific interrupt routines based on
> > an interrupt source as passed from the FIQ handler.
> >
> > It can be registered by the board as a handler for the otherwise unused
> > 32k timer interrupt.
> >
> > Created and tested against linux-2.6.34-rc4.
> > Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler
> > for serial keyboard port interrupt processing".
> >
> > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> > ---
> > v2 changes:
> > - add fiq_buffer[] declaration missing from the header file,
> > - refresh against 2.6.34-rc2.
> > v3 changes:
> > - follow Dmitry's serio cleanup suggestions here as well,
> > - follow default OMAP GPIO interrupt processing path more closely,
> > - more optimizations and cleanups.
> >
> >  arch/arm/mach-omap1/Makefile                     |    2
> >  arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
> >  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
> >  3 files changed, 163 insertions(+), 1 deletion(-)
> >
> > diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
> > --- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
> > +++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
> > @@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
> >  obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
> >  obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
> >  obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
> > -obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
> > +obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
> >  obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
> >  obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
>
> Do you really need a separate option for CONFIG_AMS_DELTA_FIQ?

Not really, but could we keep it for now, until the code gets a bit matured?

> To me it seems you can just compile it in when CONFIG_MACH_AMS_DELTA
> is selected.

If you agree, I will change it this way with a followup patch prepared for the 
next + 1 kernel release.

> Also, please make sure the FIQ only gets initialized for the right
> board when multiple boards are compiled in.

I believe it works this way. The ams_delta_init_fiq() routine, that sets up 
both FIQ and IRQ handlers, is invoked from the machines' init_machine() 
callback. Can I assume it won't be called for other machine types then?

Thanks,
Janusz

_______________________________________________
e3-hacking mailing list
e3-hacking@earth.li
http://www.earth.li/cgi-bin/mailman/listinfo/e3-hacking

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
@ 2010-04-23  1:21       ` Janusz Krzysztofik
  0 siblings, 0 replies; 22+ messages in thread
From: Janusz Krzysztofik @ 2010-04-23  1:21 UTC (permalink / raw)
  To: linux-arm-kernel

Friday 23 April 2010 01:17:26 Tony Lindgren napisa?(a):
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100414 19:24]:
> > This patch introduces an IRQ handler used for processing interrupts
> > generated by the FIQ handler when it decides there are data ready for
> > processing.
> >
> > The handler further invokes device specific interrupt routines based on
> > an interrupt source as passed from the FIQ handler.
> >
> > It can be registered by the board as a handler for the otherwise unused
> > 32k timer interrupt.
> >
> > Created and tested against linux-2.6.34-rc4.
> > Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler
> > for serial keyboard port interrupt processing".
> >
> > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> > ---
> > v2 changes:
> > - add fiq_buffer[] declaration missing from the header file,
> > - refresh against 2.6.34-rc2.
> > v3 changes:
> > - follow Dmitry's serio cleanup suggestions here as well,
> > - follow default OMAP GPIO interrupt processing path more closely,
> > - more optimizations and cleanups.
> >
> >  arch/arm/mach-omap1/Makefile                     |    2
> >  arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
> >  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
> >  3 files changed, 163 insertions(+), 1 deletion(-)
> >
> > diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
> > --- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
> > +++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
> > @@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
> >  obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
> >  obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
> >  obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
> > -obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
> > +obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
> >  obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
> >  obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
>
> Do you really need a separate option for CONFIG_AMS_DELTA_FIQ?

Not really, but could we keep it for now, until the code gets a bit matured?

> To me it seems you can just compile it in when CONFIG_MACH_AMS_DELTA
> is selected.

If you agree, I will change it this way with a followup patch prepared for the 
next + 1 kernel release.

> Also, please make sure the FIQ only gets initialized for the right
> board when multiple boards are compiled in.

I believe it works this way. The ams_delta_init_fiq() routine, that sets up 
both FIQ and IRQ handlers, is invoked from the machines' init_machine() 
callback. Can I assume it won't be called for other machine types then?

Thanks,
Janusz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
  2010-04-23  1:21       ` Janusz Krzysztofik
@ 2010-04-26 18:17         ` Tony Lindgren
  -1 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2010-04-26 18:17 UTC (permalink / raw)
  To: Janusz Krzysztofik
  Cc: linux-omap, Dmitry Torokhov, linux-input, linux-arm-kernel, e3-hacking

* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100422 18:20]:
> Friday 23 April 2010 01:17:26 Tony Lindgren napisał(a):
> > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100414 19:24]:
> > > This patch introduces an IRQ handler used for processing interrupts
> > > generated by the FIQ handler when it decides there are data ready for
> > > processing.
> > >
> > > The handler further invokes device specific interrupt routines based on
> > > an interrupt source as passed from the FIQ handler.
> > >
> > > It can be registered by the board as a handler for the otherwise unused
> > > 32k timer interrupt.
> > >
> > > Created and tested against linux-2.6.34-rc4.
> > > Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler
> > > for serial keyboard port interrupt processing".
> > >
> > > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> > > ---
> > > v2 changes:
> > > - add fiq_buffer[] declaration missing from the header file,
> > > - refresh against 2.6.34-rc2.
> > > v3 changes:
> > > - follow Dmitry's serio cleanup suggestions here as well,
> > > - follow default OMAP GPIO interrupt processing path more closely,
> > > - more optimizations and cleanups.
> > >
> > >  arch/arm/mach-omap1/Makefile                     |    2
> > >  arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
> > >  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
> > >  3 files changed, 163 insertions(+), 1 deletion(-)
> > >
> > > diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
> > > --- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
> > > +++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
> > > @@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
> > >  obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
> > >  obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
> > >  obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
> > > -obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
> > > +obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
> > >  obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
> > >  obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
> >
> > Do you really need a separate option for CONFIG_AMS_DELTA_FIQ?
> 
> Not really, but could we keep it for now, until the code gets a bit matured?
> 
> > To me it seems you can just compile it in when CONFIG_MACH_AMS_DELTA
> > is selected.
> 
> If you agree, I will change it this way with a followup patch prepared for the 
> next + 1 kernel release.

OK
 
> > Also, please make sure the FIQ only gets initialized for the right
> > board when multiple boards are compiled in.
> 
> I believe it works this way. The ams_delta_init_fiq() routine, that sets up 
> both FIQ and IRQ handlers, is invoked from the machines' init_machine() 
> callback. Can I assume it won't be called for other machine types then?

Just please check that compile works OK if you compile in other omap1 boards.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine
@ 2010-04-26 18:17         ` Tony Lindgren
  0 siblings, 0 replies; 22+ messages in thread
From: Tony Lindgren @ 2010-04-26 18:17 UTC (permalink / raw)
  To: linux-arm-kernel

* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100422 18:20]:
> Friday 23 April 2010 01:17:26 Tony Lindgren napisa?(a):
> > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100414 19:24]:
> > > This patch introduces an IRQ handler used for processing interrupts
> > > generated by the FIQ handler when it decides there are data ready for
> > > processing.
> > >
> > > The handler further invokes device specific interrupt routines based on
> > > an interrupt source as passed from the FIQ handler.
> > >
> > > It can be registered by the board as a handler for the otherwise unused
> > > 32k timer interrupt.
> > >
> > > Created and tested against linux-2.6.34-rc4.
> > > Applies on top of PATCH v3 1/5(7), "OMAP1: Amstrad Delta: add FIQ handler
> > > for serial keyboard port interrupt processing".
> > >
> > > Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> > > ---
> > > v2 changes:
> > > - add fiq_buffer[] declaration missing from the header file,
> > > - refresh against 2.6.34-rc2.
> > > v3 changes:
> > > - follow Dmitry's serio cleanup suggestions here as well,
> > > - follow default OMAP GPIO interrupt processing path more closely,
> > > - more optimizations and cleanups.
> > >
> > >  arch/arm/mach-omap1/Makefile                     |    2
> > >  arch/arm/mach-omap1/ams-delta-fiq.c              |  155 +++++++++++++++++++++++
> > >  arch/arm/mach-omap1/include/mach/ams-delta-fiq.h |    7 +
> > >  3 files changed, 163 insertions(+), 1 deletion(-)
> > >
> > > diff -uprN git.orig/arch/arm/mach-omap1/Makefile git/arch/arm/mach-omap1/Makefile
> > > --- git.orig/arch/arm/mach-omap1/Makefile	2010-04-14 22:35:22.000000000 +0200
> > > +++ git/arch/arm/mach-omap1/Makefile	2010-04-14 23:18:10.000000000 +0200
> > > @@ -37,7 +37,7 @@ obj-$(CONFIG_MACH_OMAP_PALMZ71)		+= boar
> > >  obj-$(CONFIG_MACH_OMAP_PALMTT)		+= board-palmtt.o
> > >  obj-$(CONFIG_MACH_NOKIA770)		+= board-nokia770.o
> > >  obj-$(CONFIG_MACH_AMS_DELTA)		+= board-ams-delta.o
> > > -obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq-handler.o
> > > +obj-$(CONFIG_AMS_DELTA_FIQ)		+= ams-delta-fiq.o ams-delta-fiq-handler.o
> > >  obj-$(CONFIG_MACH_SX1)			+= board-sx1.o board-sx1-mmc.o
> > >  obj-$(CONFIG_MACH_HERALD)		+= board-htcherald.o
> >
> > Do you really need a separate option for CONFIG_AMS_DELTA_FIQ?
> 
> Not really, but could we keep it for now, until the code gets a bit matured?
> 
> > To me it seems you can just compile it in when CONFIG_MACH_AMS_DELTA
> > is selected.
> 
> If you agree, I will change it this way with a followup patch prepared for the 
> next + 1 kernel release.

OK
 
> > Also, please make sure the FIQ only gets initialized for the right
> > board when multiple boards are compiled in.
> 
> I believe it works this way. The ams_delta_init_fiq() routine, that sets up 
> both FIQ and IRQ handlers, is invoked from the machines' init_machine() 
> callback. Can I assume it won't be called for other machine types then?

Just please check that compile works OK if you compile in other omap1 boards.

Tony

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-04-26 18:17 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15  2:19 [PATCH v3 0/5(7)] OMAP1: Amstrad Delta: add FIQ based support for external keyboard Janusz Krzysztofik
2010-04-15  2:19 ` Janusz Krzysztofik
2010-04-15  2:23 ` [PATCH v3 0.1/5(7)] OMAP: add missing FIQ_START definition required for arch/arm/plat-omap/fiq.c compilation Janusz Krzysztofik
2010-04-20  9:14   ` [PATCH v3 0.1/5(7)] OMAP: add missing FIQ_START definition required for arch/arm/kernel/fiq.c compilation (was: OMAP: add missing FIQ_START definition required for arch/arm/plat-omap/fiq.c compilation) Janusz Krzysztofik
2010-04-15  2:24 ` [PATCH v3 1/5(7)] OMAP1: Amstrad Delta: add FIQ handler for serial keyboard port interrupt processing Janusz Krzysztofik
2010-04-15  2:24   ` Janusz Krzysztofik
2010-04-15  2:26 ` [PATCH v3 2/5(7)] OMAP1: Amstrad Delta: add a handler for processing interrupts generated by the FIQ routine Janusz Krzysztofik
2010-04-15  2:26   ` Janusz Krzysztofik
2010-04-22 23:17   ` Tony Lindgren
2010-04-22 23:17     ` Tony Lindgren
2010-04-23  1:21     ` Janusz Krzysztofik
2010-04-23  1:21       ` Janusz Krzysztofik
2010-04-26 18:17       ` Tony Lindgren
2010-04-26 18:17         ` Tony Lindgren
2010-04-15  2:27 ` [PATCH v3 2.1/5(7)] OMAP1: Amstrad Delta: update board initialization code for complete modem IRQ GPIO line setup Janusz Krzysztofik
2010-04-15  2:29 ` [PATCH v3 3/5(7)] OMAP1: Amstrad Delta: use FIQ for processing GPIO interrupts Janusz Krzysztofik
2010-04-15  2:29   ` Janusz Krzysztofik
2010-04-15  2:31 ` [PATCH v3 4/5(7)] input: serio: add support for Amstrad Delta serial keyboard port Janusz Krzysztofik
2010-04-15 16:14   ` Dmitry Torokhov
2010-04-15 18:16     ` Janusz Krzysztofik
2010-04-22 23:14       ` Tony Lindgren
2010-04-15  2:32 ` [PATCH v3 5/5(7)] OMAP1: Amstrad Delta: modify defconfig for external keyboard support Janusz Krzysztofik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.