Skip to contentSkip to conversation

ARM: sa1100: add irq handler to prepare MULTI_IRQ_HANDLER

PATCH New Dmitry Eremin-Solenikov 3 participants 8 messages Nov 1, 2013 – Nov 12, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 ARM: sa1100: add irq handler to prepare MULTI_IRQ_HANDLER

Add sa1100_handle_irq implementating handle_irq for sa1100 platform.

---
 arch/arm/mach-sa1100/generic.h |  1 +
 arch/arm/mach-sa1100/irq.c     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
arch/arm/mach-sa1100/generic.h +1 -0
index 0d92e11..a918ea5 100644
@@ -12,6 +12,7 @@ extern void __init sa1100_init_irq(void);
 extern void __init sa1100_init_gpio(void);
 extern void sa11x0_restart(enum reboot_mode, const char *);
 extern void sa11x0_init_late(void);
+extern void sa1100_handle_irq(struct pt_regs *);
 
 #define SET_BANK(__nr,__start,__size) \
 	mi->bank[__nr].start = (__start), \
arch/arm/mach-sa1100/irq.c +17 -0
index 2124f1fc..2ec1f92 100644
@@ -20,6 +20,7 @@
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 #include <asm/mach/irq.h>
+#include <asm/exception.h>
 
 #include "generic.h"
 
@@ -340,3 +341,19 @@ void __init sa1100_init_irq(void)
 
 	sa1100_init_gpio();
 }
+
+asmlinkage void __exception_irq_entry sa1100_handle_irq(struct pt_regs *regs)
+{
+	uint32_t icip, icmr, mask;
+
+	do {
+		icip = (ICIP);
+		icmr = (ICMR);
+		mask = icip & icmr;
+
+		if (mask == 0)
+			break;
+
+		handle_IRQ(fls(mask) - 1, regs);
+	} while (1);
+}
Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH 2/4 ARM: sa1100: enable MULTI_IRQ_HANDLER for all boards

Use sa1100_handle_irq to handle irqs on all sa1100 boards.

---
 arch/arm/Kconfig                  | 1 +
 arch/arm/mach-sa1100/assabet.c    | 1 +
 arch/arm/mach-sa1100/badge4.c     | 1 +
 arch/arm/mach-sa1100/cerf.c       | 1 +
 arch/arm/mach-sa1100/collie.c     | 1 +
 arch/arm/mach-sa1100/h3100.c      | 1 +
 arch/arm/mach-sa1100/h3600.c      | 1 +
 arch/arm/mach-sa1100/hackkit.c    | 1 +
 arch/arm/mach-sa1100/jornada720.c | 1 +
 arch/arm/mach-sa1100/lart.c       | 1 +
 arch/arm/mach-sa1100/nanoengine.c | 1 +
 arch/arm/mach-sa1100/pleb.c       | 1 +
 arch/arm/mach-sa1100/shannon.c    | 1 +
 arch/arm/mach-sa1100/simpad.c     | 1 +
 14 files changed, 14 insertions(+)
arch/arm/Kconfig +1 -0
index 799ef94..5c86d8a 100644
@@ -693,6 +693,7 @@ config ARCH_SA1100
 	select GENERIC_CLOCKEVENTS
 	select HAVE_IDE
 	select ISA
+	select MULTI_IRQ_HANDLER
 	select NEED_MACH_MEMORY_H
 	select SPARSE_IRQ
 	help
arch/arm/mach-sa1100/assabet.c +1 -0
index c9808c6..d745297 100644
@@ -625,6 +625,7 @@ MACHINE_START(ASSABET, "Intel-Assabet")
 	.map_io		= assabet_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= assabet_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/badge4.c +1 -0
index 63361b6..acbaae4 100644
@@ -335,6 +335,7 @@ MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
 	.map_io		= badge4_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_late	= sa11x0_init_late,
 	.init_time	= sa1100_timer_init,
 #ifdef CONFIG_SA1111
arch/arm/mach-sa1100/cerf.c +1 -0
index 2d25ece..cad0ada 100644
@@ -174,6 +174,7 @@ MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
 	.map_io		= cerf_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= cerf_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= cerf_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/collie.c +1 -0
index 7fb96eb..3e26ddc 100644
@@ -399,6 +399,7 @@ MACHINE_START(COLLIE, "Sharp-Collie")
 	.map_io		= collie_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= collie_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/h3100.c +1 -0
index b8f2b15..5ab169d 100644
@@ -108,6 +108,7 @@ MACHINE_START(H3100, "Compaq iPAQ H3100")
 	.map_io		= h3100_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= h3100_mach_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/h3600.c +1 -0
index b8dc5bd..7209c0e 100644
@@ -158,6 +158,7 @@ MACHINE_START(H3600, "Compaq iPAQ H3600")
 	.map_io		= h3600_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= h3600_mach_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/hackkit.c +1 -0
index 643d5f2..1998805 100644
@@ -229,6 +229,7 @@ MACHINE_START(HACKKIT, "HackKit Cpu Board")
 	.map_io		= hackkit_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= hackkit_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/jornada720.c +1 -0
index c0b1f5b..74d5894 100644
@@ -346,6 +346,7 @@ MACHINE_START(JORNADA720, "HP Jornada 720")
 	.map_io		= jornada720_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= jornada720_mach_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/lart.c +1 -0
index 51b0eb5..2f3c8a1 100644
@@ -169,6 +169,7 @@ MACHINE_START(LART, "LART")
 	.map_io		= lart_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_machine	= lart_init,
 	.init_late	= sa11x0_init_late,
 	.init_time	= sa1100_timer_init,
arch/arm/mach-sa1100/nanoengine.c +1 -0
index f1cb378..b35b1ca 100644
@@ -110,6 +110,7 @@ MACHINE_START(NANOENGINE, "BSE nanoEngine")
 	.map_io		= nanoengine_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= nanoengine_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/pleb.c +1 -0
index 0912618..f35c4d9 100644
@@ -133,6 +133,7 @@ MACHINE_START(PLEB, "PLEB")
 	.map_io		= pleb_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine   = pleb_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/shannon.c +1 -0
index c8866bc..975dc95 100644
@@ -102,6 +102,7 @@ MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
 	.map_io		= shannon_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_time	= sa1100_timer_init,
 	.init_machine	= shannon_init,
 	.init_late	= sa11x0_init_late,
arch/arm/mach-sa1100/simpad.c +1 -0
index 41e476e..f40b07e 100644
@@ -396,6 +396,7 @@ MACHINE_START(SIMPAD, "Simpad")
 	.map_io		= simpad_map_io,
 	.nr_irqs	= SA1100_NR_IRQS,
 	.init_irq	= sa1100_init_irq,
+	.handle_irq	= sa1100_handle_irq,
 	.init_late	= sa11x0_init_late,
 	.init_time	= sa1100_timer_init,
 	.restart	= sa11x0_restart,
Signature · 1 line
1.8.4.rc3
#2 lore raw

PATCH 3/4 ARM: sa1100: drop entry-macro.S

In reply to Dmitry Eremin-Solenikov

As mach-sa1100 was converted to MULTI_IRQ_HANDLER, drop now-unused entry-macro.S file.

---
 arch/arm/mach-sa1100/include/mach/entry-macro.S | 41 -------------------------
 1 file changed, 41 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/include/mach/entry-macro.S
arch/arm/mach-sa1100/include/mach/entry-macro.S deleted +0 -41
deleted file mode 100644
index 8cf7630..0000000
@@ -1,41 +0,0 @@
-/*
- * arch/arm/mach-sa1100/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for SA1100-based platforms
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-		.macro  get_irqnr_preamble, base, tmp
-		mov	\base, #0xfa000000		@ ICIP = 0xfa050000
-		add	\base, \base, #0x00050000
-		.endm
-
-		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-		ldr	\irqstat, [\base]		@ get irqs
-		ldr	\irqnr, [\base, #4]		@ ICMR = 0xfa050004
-		ands	\irqstat, \irqstat, \irqnr
-		mov	\irqnr, #0
-		beq	1001f
-		tst	\irqstat, #0xff
-		moveq	\irqstat, \irqstat, lsr #8
-		addeq	\irqnr, \irqnr, #8
-		tsteq	\irqstat, #0xff
-		moveq	\irqstat, \irqstat, lsr #8
-		addeq	\irqnr, \irqnr, #8
-		tsteq	\irqstat, #0xff
-		moveq	\irqstat, \irqstat, lsr #8
-		addeq	\irqnr, \irqnr, #8
-		tst	\irqstat, #0x0f
-		moveq	\irqstat, \irqstat, lsr #4
-		addeq	\irqnr, \irqnr, #4
-		tst	\irqstat, #0x03
-		moveq	\irqstat, \irqstat, lsr #2
-		addeq	\irqnr, \irqnr, #2
-		tst	\irqstat, #0x01
-		addeqs	\irqnr, \irqnr, #1
-1001:
-		.endm
-
Signature · 1 line
1.8.4.rc3
#3 lore raw

PATCH 4/4 ARM: sa1100: switch to COMMON_CLK framework

In reply to Dmitry Eremin-Solenikov

Implement common clock framework support for SA-1100.

---
 arch/arm/Kconfig               |   2 +-
 arch/arm/mach-sa1100/clock.c   | 100 ----------------------------------
 arch/arm/mach-sa1100/generic.c |   2 +
 drivers/clk/Makefile           |   1 +
 drivers/clk/clk-sa1100.c       | 121 +++++++++++++++++++++++++++++++++++++++++
 include/linux/clk/sa1100.h     |  14 +++++
 6 files changed, 139 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/mach-sa1100/clock.c
 create mode 100644 drivers/clk/clk-sa1100.c
 create mode 100644 include/linux/clk/sa1100.h
arch/arm/Kconfig +1 -1
index 5c86d8a..b28e518 100644
@@ -686,8 +686,8 @@ config ARCH_SA1100
 	select ARCH_MTD_XIP
 	select ARCH_REQUIRE_GPIOLIB
 	select ARCH_SPARSEMEM_ENABLE
-	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
+	select COMMON_CLK
 	select CPU_FREQ
 	select CPU_SA1100
 	select GENERIC_CLOCKEVENTS
arch/arm/mach-sa1100/clock.c deleted +0 -100

100 lines not on this page · raw message

arch/arm/mach-sa1100/generic.c +2 -0
index d4ea142..f35dd06 100644
@@ -20,6 +20,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
+#include <linux/clk/sa1100.h>
 
 #include <video/sa1100fb.h>
 
@@ -312,6 +313,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 static int __init sa1100_init(void)
 {
 	pm_power_off = sa1100_power_off;
+	sa1100_clocks_init();
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
drivers/clk/Makefile +1 -0
index fe3121b..0d46402 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_ARCH_MMP)		+= mmp/
 endif
 obj-$(CONFIG_MACH_LOONGSON1)	+= clk-ls1x.o
 obj-$(CONFIG_ARCH_ROCKCHIP)	+= rockchip/
+obj-$(CONFIG_ARCH_SA1100)	+= clk-sa1100.o
 obj-$(CONFIG_ARCH_SUNXI)	+= sunxi/
 obj-$(CONFIG_ARCH_U8500)	+= ux500/
 obj-$(CONFIG_ARCH_VT8500)	+= clk-vt8500.o
drivers/clk/clk-sa1100.c new file +121 -0

121 lines not on this page · raw message

include/linux/clk/sa1100.h new file +14 -0
new file mode 100644
index 0000000..497de03
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2013 Dmitry Eremin-Solenikov
+ *
+ * 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 __LINUX_CLK_SA1100_H
+#define __LINUX_CLK_SA1100_H
+
+int sa1100_clocks_init(void);
+
+#endif
Signature · 1 line
1.8.4.rc3
#4 lore raw

PATCH 4/4 ARM: sa1100: switch to COMMON_CLK framework

drivers/clk/clk-sa1100.c line 17

Quoted 5 lines · Dmitry Eremin-Solenikov
drivers/clk/clk-sa1100.c new file +5 -0
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+
+#include <mach/hardware.h>

If the aim of this patch set is to move SA11x0 towards multiplatform, then this has just failed with the above include. It would be better not to try this without first solving the problem of the SoC register definitions.

#5 lore raw

PATCH 4/4 ARM: sa1100: switch to COMMON_CLK framework

Quoted 11 lines · Russell King - ARM Linux

drivers/clk/clk-sa1100.c line 17

Quoted 5 lines · Dmitry Eremin-Solenikov
drivers/clk/clk-sa1100.c new file +5 -0
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+
+#include <mach/hardware.h>

If the aim of this patch set is to move SA11x0 towards multiplatform, then this has just failed with the above include. It would be better not to try this without first solving the problem of the SoC register definitions.

OK, still learning "new ARM" ways. Is it ok to remap fixed addresses in that file?

And second question: what would be better: to leave that code as is, or to convert that to 3M6864/32k768 multiplexer (TUCR bit) + enable/disable (GAFR/GPDR)? I ain't sure that all other TUCR modes were ever used.

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

PATCH 4/4 ARM: sa1100: switch to COMMON_CLK framework

In reply to Russell King - ARM Linux
Quoted 11 lines · Russell King - ARM Linux

drivers/clk/clk-sa1100.c line 17

Quoted 5 lines · Dmitry Eremin-Solenikov
drivers/clk/clk-sa1100.c new file +5 -0
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+
+#include <mach/hardware.h>

If the aim of this patch set is to move SA11x0 towards multiplatform, then this has just failed with the above include. It would be better not to try this without first solving the problem of the SoC register definitions.

Also what about first three patches?

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

PATCH 1/4 ARM: sa1100: add irq handler to prepare MULTI_IRQ_HANDLER

In reply to Dmitry Eremin-Solenikov
Quoted 3 lines · Dmitry Eremin-Solenikov

Add sa1100_handle_irq implementating handle_irq for sa1100 platform.

As it happens I had a larger series doing this and some more refactorings in the SA1100 irq driver, like using irqdomain for mapping all IRQs. Sorry for not noting this earlier :-(

I cleaned it up and sending it now and we can have a fight on which patches to take ;-)

Yours,
Linus Walleij