sparc32: genirq support
PATCH 3/3 sparc32: genirq support
The conversion of sparc32 to genirq is based on original work done by David S. Miller.
Daniel Hellstrom has helped in the conversion and implemented the shutdowm functionality.
Marcel van Nies <[email protected]> has tested this on Sparc Station 20
Test status:
sun4c - not tested
sun4m,pci - not tested
sun4m,sbus - tested (Sparc Classic, Sparc Station 5, Sparc Station 20)
sun4d - not tested
leon - tested on various combinations of leon boards,
including SMP variants
generic
Introduce use of GENERIC_HARDIRQS and GENERIC_IRQ_SHOW Allocate 64 IRQs - which is enough even for SS2000 Use a table of irq_bucket to maintain uses IRQs
irq_bucket is also used to chain several irq's that must be called when the same intrrupt is asserted
Use irq_link to link a interrupt source to the irq All plafforms must now supply their own build_device_irq method handler_irq rewriten to use generic irq support
floppy
Read FLOPPY_IRQ from platform device
Use generic request_irq to register the floppy interrupt Rewrote sparc_floppy_irq to use the generic irq support
pcic:
Introduce irq_chip
Store mask in chip_data for use in mask/unmask functions Add build_device_irq for pcic
Use pcic_build_device_irq in pci_time_init allocate virtual irqs in pcic_fill_irq
sun4c:
Introduce irq_chip
Store mask in chip_data for use in mask/unmask functions Add build_device_irq for sun4c
Use sun4c_build_device_irq in sun4c_init_timers
sun4m:
Introduce irq_chip
Introduce dedicated mask/unmask methods
Introduce sun4m_handler_data that allow easy access to necessary
data in the mask/unmask functions
Add a helper method to enable profile_timer (used from smp) Added sun4m_build_device_irq
Use sun4m_build_device_irq in sun4m_init_timers
TODO:
There is no replacement for smp_rotate that always scheduled next CPU as interrupt target upon an interrupt
sun4d:
Introduce irq_chip
Introduce dedicated mask/unmask methods Introduce sun4d_handler_data that allow easy access to necessary data in mask/unmask fuctions Rewrote sun4d_handler_irq to use generic irq support
TODO:
The original implmentation of enable/disable had:
if (irq < NR_IRQS)
return;
The new implmentation does not distingush between SBUS and cpu interrupts.
I am no sure what is right here. I assume we need to do something for the cpu interrupts.
I have not succeeded booting my sun4d box (with or without this patch) and my understanding of this platfrom is limited.
So I would be a bit suprised if this works.
leon:
Introduce irq_chip
Store mask in chip_data for use in mask/unmask functions Add build_device_irq for leon
Use leon_build_device_irq in leon_init_timers
--- arch/sparc/Kconfig | 6 +- arch/sparc/include/asm/floppy_32.h | 40 ++- arch/sparc/include/asm/irq_32.h | 6 +- arch/sparc/include/asm/system_32.h | 5 - arch/sparc/kernel/Makefile | 4 - arch/sparc/kernel/irq.h | 45 ++-- arch/sparc/kernel/irq_32.c | 494 ++++++++---------------------------- arch/sparc/kernel/kernel.h | 1 + arch/sparc/kernel/leon_kernel.c | 70 ++++- arch/sparc/kernel/pcic.c | 83 ++++-- arch/sparc/kernel/sun4c_irq.c | 150 +++++++----- arch/sparc/kernel/sun4d_irq.c | 472 ++++++++++++---------------------- arch/sparc/kernel/sun4m_irq.c | 179 +++++++------ arch/sparc/kernel/sun4m_smp.c | 16 +- 14 files changed, 636 insertions(+), 935 deletions(-)
arch/sparc/Kconfig +4 -2
@@ -25,6 +25,10 @@ config SPARC select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG select HAVE_ARCH_JUMP_LABEL + select HAVE_GENERIC_HARDIRQS + select GENERIC_HARDIRQS_NO_DEPRECATED + select GENERIC_IRQ_SHOW + config SPARC32 def_bool !64BIT
@@ -50,8 +54,6 @@ config SPARC64 select RTC_DRV_STARFIRE select HAVE_PERF_EVENTS select PERF_USE_VMALLOC - select HAVE_GENERIC_HARDIRQS - select GENERIC_IRQ_SHOW select IRQ_PREFLOW_FASTEOI config ARCH_DEFCONFIG
arch/sparc/include/asm/floppy_32.h +29 -11
@@ -281,28 +281,27 @@ static inline void sun_fd_enable_dma(void) pdma_areasize = pdma_size; } -/* Our low-level entry point in arch/sparc/kernel/entry.S */ -extern int sparc_floppy_request_irq (int irq,unsigned long flags, -irq_handler_t irq_handler); +extern int sparc_floppy_request_irq (unsigned int irq, +irq_handler_t irq_handler);static int sun_fd_request_irq (void ) {static int once =0 ; -int error; -if (!once) { +if (!once) { once =1 ; - error =sparc_floppy_request_irq (FLOPPY_IRQ , -IRQF_DISABLED , - floppy_interrupt); -return ((error =0 ) ?0 :-1 ); - }else return 0 ; +return sparc_floppy_request_irq (FLOPPY_IRQ , floppy_interrupt); + }else { +return 0 ; + } }static struct linux_prom_registers fd_regs[2 ];static int sun_floppy_init (void ) { +struct platform_device *op; +struct device_node *dp;char state[128 ];phandle tnode, fd_node;int num_regs;
@@ -310,7 +309,6 @@ static int sun_floppy_init(void) use_virtual_dma =1 ; -FLOPPY_IRQ =11 ;/* Forget it if we aren't on a machine that could possibly * ever have a floppy drive. */
@@ -349,6 +347,26 @@ static int sun_floppy_init(void) sun_fdc = (struct sun_flpy_controller *)of_ioremap (&r,0 , fd_regs[0 ].reg_size,"floppy" ); +/* Look up irq in platform_device. +* We try "SUNW,fdtwo" and "fd" +*/ +for_each_node_by_name (dp,"SUNW,fdtwo" ) { + op =of_find_device_by_node (dp); +if (op) +break ; + } +if (!op) { +for_each_node_by_name (dp,"fd" ) { + op =of_find_device_by_node (dp); +if (op) +break ; + } + } +if (!op) + goto no_sun_fdc; + +FLOPPY_IRQ = op->archdata.irqs[0 ]; +/* Last minute sanity check... */ if (sun_fdc->status_82072 =0xff ) { sun_fdc =NULL ;
arch/sparc/include/asm/irq_32.h +5 -1
@@ -6,7 +6,11 @@#ifndef _SPARC_IRQ_H#define _SPARC_IRQ_H -#define NR_IRQS 16 +/* Allocated number of logical irq numbers. +* sun4d boxes (ss2000e) should be OK with ~32. +* Be on the safe side and make room for 64 +*/ +#define NR_IRQS 64#include <linux/interrupt.h>
arch/sparc/include/asm/system_32.h +0 -5
@@ -15,11 +15,6 @@#include <linux/irqflags.h> -static inline unsigned int probe_irq_mask (unsigned long val) -{ -return 0 ; -} -/* * Sparc (general) CPU types */
arch/sparc/kernel/Makefile +0 -4
@@ -71,10 +71,6 @@ obj-$(CONFIG_SPARC64) += pcr.o obj-$(CONFIG_SPARC64) += nmi.o obj-$(CONFIG_SPARC64_SMP) += cpumap.o -# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation -obj-$(CONFIG_SPARC32) += devres.o -devres-y := ../../../kernel/irq/devres.o - obj-y += dma.o obj-$(CONFIG_SPARC32_PCI) += pcic.o
arch/sparc/kernel/irq.h +21 -24
66 lines not on this page · raw message
arch/sparc/kernel/irq_32.c +111 -383
594 lines not on this page · raw message
arch/sparc/kernel/kernel.h +1 -0
@@ -37,6 +37,7 @@ extern void sun4c_init_IRQ(void);extern unsigned int lvl14_resolution;extern void sun4m_init_IRQ (void ); +extern void sun4m_unmask_profile_irq (void );extern void sun4m_clear_profile_irq (int cpu);/* sun4d_irq.c */
arch/sparc/kernel/leon_kernel.c +56 -14
111 lines not on this page · raw message
arch/sparc/kernel/pcic.c +56 -27
166 lines not on this page · raw message
arch/sparc/kernel/sun4c_irq.c +90 -60
198 lines not on this page · raw message
arch/sparc/kernel/sun4d_irq.c +164 -308
582 lines not on this page · raw message
arch/sparc/kernel/sun4m_irq.c +98 -81
260 lines not on this page · raw message
arch/sparc/kernel/sun4m_smp.c +1 -15
@@ -150,20 +150,6 @@ void __init smp4m_smp_done(void)/* Ok, they are spinning and ready to go. */ } -/* At each hardware IRQ, we get this called to forward IRQ reception -* to the next processor. The caller must disable the IRQ level being -* serviced globally so that there are no double interrupts received. -* -* XXX See sparc64 irq.c. -*/ -void smp4m_irq_rotate (int cpu) -{ -int next =cpu_data (cpu).next; - -if (next != cpu) -set_irq_udt (next); -} - static struct smp_funcall { smpfunc_t func; unsigned long arg1;
@@ -277,7 +263,7 @@ static void __cpuinit smp_setup_percpu_timer(void)load_profile_irq (cpu, lvl14_resolution);if (cpu = boot_cpu_id) -enable_pil_irq (14 ); +sun4m_unmask_profile_irq (); }static void __init smp4m_blackbox_id (unsigned *addr)
Signature · 1 line
1.6.0.6
Quoted 6 lines · Sam Ravnborg
The conversion of sparc32 to genirq is based on original work done by David S. Miller.
Daniel Hellstrom has helped in the conversion and implemented the shutdowm functionality.
Marcel van Nies <[email protected]> has tested this on Sparc Station 20
Quoted 9 lines
Test status:
sun4c - not tested
sun4m,pci - not tested
sun4m,sbus - tested (Sparc Classic, Sparc Station 5, Sparc Station 20)
sun4d - not tested
leon - tested on various combinations of leon boards,
including SMP variants
Hello Sam,
I have tested this version of your patch on a couple of LEONs, and it works fine.
Thanks for a great job,
Daniel
From: Sam Ravnborg <[email protected]>
Date: Mon, 18 Apr 2011 23:25:44 +0200
Quoted 5 lines
The conversion of sparc32 to genirq is based on original work done by David S. Miller.
Daniel Hellstrom has helped in the conversion and implemented the shutdowm functionality.
Marcel van Nies <[email protected]> has tested this on Sparc Station 20
...
Quoted 5 lines
Signed-off-by Sam Ravnborg <[email protected]>Acked-by Daniel Hellstrom <[email protected]>Tested-by Daniel Hellstrom <[email protected]>Tested-by Marcel van Nies <[email protected]>Cc Thomas Gleixner <[email protected]>
Applied.
Thanks so much for sticking with this!