ARM: S3C24XX: more fixes and enhancements for the s3c24xx irqs
Subsystems (3)
cover ARM: S3C24XX: more fixes and enhancements for the s3c24xx irqs
Asorted fixes and enhancements for the recent redo of the s3c24xx interrupt controllers.
The only real error that gets fixed is the handling of 0-hwirq as parent_irq on s3c2412 in patch 2. No other of the s3c24xx platforms uses the bit0 of the parent controller as parent_irq.
Heiko Stuebner (5):
ARM: S3C24XX: fix redundant checks in the irq mapping function
ARM: S3C24XX: fix irq parent check
ARM: S3C24XX: move s3c24xx_init_irq to s3c2410_init_irq
ARM: S3C24XX: make s3c24xx_init_intc static
ARM: S3C24XX: add handle_irq function
arch/arm/Kconfig | 1 + arch/arm/mach-s3c24xx/common.h | 1 + arch/arm/mach-s3c24xx/include/mach/entry-macro.S | 70 --------- arch/arm/mach-s3c24xx/irq.c | 167 +++++++++++++-------- arch/arm/mach-s3c24xx/mach-amlm5900.c | 2 +- arch/arm/mach-s3c24xx/mach-bast.c | 2 +- arch/arm/mach-s3c24xx/mach-h1940.c | 7 +- arch/arm/mach-s3c24xx/mach-n30.c | 4 +- arch/arm/mach-s3c24xx/mach-otom.c | 2 +- arch/arm/mach-s3c24xx/mach-qt2410.c | 2 +- arch/arm/mach-s3c24xx/mach-smdk2410.c | 2 +- arch/arm/mach-s3c24xx/mach-tct_hammer.c | 2 +- arch/arm/mach-s3c24xx/mach-vr1000.c | 2 +- arch/arm/plat-samsung/include/plat/cpu.h | 1 - 14 files changed, 115 insertions(+), 150 deletions(-) delete mode 100644 arch/arm/mach-s3c24xx/include/mach/entry-macro.S
Signature · 1 line
1.7.2.3
PATCH 1/5 ARM: S3C24XX: fix redundant checks in the irq mapping function
The check during the parent handling itself was wrong, as it should have checked for parent_irq_data.
The interrupt controller structs always contain an irq_data array with 32 entries and the only possible error could be a parent_irq assignment of >31.
As this would point to outside the irq_data array this could contain anything including non-NULL values. Therefore correct this to check the parent_irq value to be in the right range.
With the same explanation of a valid interrupt controller always having a full irq_data array, the topmost irq_data check in s3c24xx_irq_map can also go away.
Finally the mapping function is only called thru the irq_domain ops, in which case the intc struct is already successfully created, so there is no need to check for it again.
--- arch/arm/mach-s3c24xx/irq.c | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-)
arch/arm/mach-s3c24xx/irq.c +0 -0
@@ -324,16 +324,6 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned
int virq,
struct s3c_irq_data *parent_irq_data;
unsigned int irqno;
- if (!intc) {
- pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw);
- return -EINVAL;
- }
-
- if (!irq_data) {
- pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw);
- return -EINVAL;
- }
-
/* attach controller pointer to irq_data */ irq_data->intc = intc;
@@ -383,13 +373,13 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
goto err;
}
- parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
- if (!irq_data) {
- pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n",
- hw);
+ if (irq_data->parent_irq > 31) {
+ pr_err("irq-s3c24xx: parent irq %lu is out of range\n",
+ irq_data->parent_irq);
goto err;
}
+ parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
parent_irq_data->sub_intc = intc; parent_irq_data->sub_bits |= (1UL << hw);
Signature · 1 line
1.7.2.3
PATCH 2/5 ARM: S3C24XX: fix irq parent check
In reply to Heiko StübnerThe current parent_irq check checks for a value != 0. This does of course not work when the parent irq sits in the bit 0 of the parent register. This only affects the eint0 interrupt of the s3c2412.
To fix this behaviour, check for the presence of a parent_intc in the structure. In an s3c24xx interrupt controller either all interrupts have parent interrupts or none have, so if a parent controller is available the parent_irq value always points to a parent_irq.
--- arch/arm/mach-s3c24xx/irq.c | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-)
arch/arm/mach-s3c24xx/irq.c +8 -14
@@ -81,7 +81,7 @@ static void s3c_irq_mask(struct irq_data *data) mask |= (1UL << data->hwirq);__raw_writel (mask, intc->reg_mask); -if (parent_intc && irq_data->parent_irq) { +if (parent_intc) { parent_data = &parent_intc->irqs[irq_data->parent_irq];/* check to see if we need to mask the parent IRQ */
@@ -105,7 +105,7 @@ static void s3c_irq_unmask(struct irq_data *data) mask &= ~(1UL << data->hwirq);__raw_writel (mask, intc->reg_mask); -if (parent_intc && irq_data->parent_irq) { +if (parent_intc) { irqno =irq_find_mapping (parent_intc->domain, irq_data->parent_irq);s3c_irq_unmask (irq_get_irq_data (irqno));
@@ -327,6 +327,8 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,/* attach controller pointer to irq_data */ irq_data->intc = intc; + parent_intc = intc->parent; +/* set handler and flags */ switch (irq_data->type) {case S3C_IRQTYPE_NONE :
@@ -335,7 +337,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,/* On the S3C2412, the EINT0to3 have a parent irq * but need the s3c_irq_eint0t4 chip */ -if (irq_data->parent_irq && (!soc_is_s3c2412 () || hw >=4 )) +if (parent_intc && (!soc_is_s3c2412 () || hw >=4 ))irq_set_chip_and_handler (virq, &s3c_irqext_chip, handle_edge_irq);else
@@ -343,8 +345,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, handle_edge_irq);break ;case S3C_IRQTYPE_EDGE : -if (irq_data->parent_irq || - intc->reg_pending ==S3C2416_SRCPND2 ) +if (parent_intc || intc->reg_pending ==S3C2416_SRCPND2 )irq_set_chip_and_handler (virq, &s3c_irq_level_chip, handle_edge_irq);else
@@ -352,7 +353,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, handle_edge_irq);break ;case S3C_IRQTYPE_LEVEL : -if (irq_data->parent_irq) +if (parent_intc)irq_set_chip_and_handler (virq, &s3c_irq_level_chip, handle_level_irq);else
@@ -365,14 +366,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, }set_irq_flags (virq,IRQF_VALID ); -if (irq_data->parent_irq) { - parent_intc = intc->parent; -if (!parent_intc) { -pr_err ("irq-s3c24xx: no parent controller found for hwirq %lu\n" , - hw); - goto err; - } - +if (parent_intc && irq_data->type !=S3C_IRQTYPE_NONE ) {if (irq_data->parent_irq >31 ) {pr_err ("irq-s3c24xx: parent irq %lu is out of range\n" , irq_data->parent_irq);
Signature · 1 line
1.7.2.3
PATCH 3/5 ARM: S3C24XX: move s3c24xx_init_irq to s3c2410_init_irq
In reply to Heiko StübnerThe s3c24xx_init_irq function that was the base for all irq inits is now only used to initialize the real s3c2410 irqs.
Therefore rename it and also move its declaration from plat/cpu.h to common.h
The eint declaration is used by the vast majority of the SoCs and gets therefore placed outside any ifdefs.
--- arch/arm/mach-s3c24xx/common.h | 1 + arch/arm/mach-s3c24xx/irq.c | 69 ++++++++++++++--------------- arch/arm/mach-s3c24xx/mach-amlm5900.c | 2 +- arch/arm/mach-s3c24xx/mach-bast.c | 2 +- arch/arm/mach-s3c24xx/mach-h1940.c | 7 +--- arch/arm/mach-s3c24xx/mach-n30.c | 4 +- arch/arm/mach-s3c24xx/mach-otom.c | 2 +- arch/arm/mach-s3c24xx/mach-qt2410.c | 2 +- arch/arm/mach-s3c24xx/mach-smdk2410.c | 2 +- arch/arm/mach-s3c24xx/mach-tct_hammer.c | 2 +- arch/arm/mach-s3c24xx/mach-vr1000.c | 2 +- arch/arm/plat-samsung/include/plat/cpu.h | 1 - 12 files changed, 44 insertions(+), 52 deletions(-)
arch/arm/mach-s3c24xx/common.h +1 -0
@@ -21,6 +21,7 @@ extern void s3c2410_map_io(void);extern void s3c2410_init_uarts (struct s3c2410_uartcfg *cfg,int no);extern void s3c2410_init_clocks (int xtal);extern void s3c2410_restart (char mode,const char *cmd); +extern void s3c2410_init_irq (void );#else #define s3c2410_init_clocks NULL#define s3c2410_init_uarts NULL
arch/arm/mach-s3c24xx/irq.c +33 -36
101 lines not on this page · raw message
arch/arm/mach-s3c24xx/mach-amlm5900.c +1 -1
@@ -238,7 +238,7 @@ static void __init amlm5900_init(void)MACHINE_START (AML_M5900 ,"AML_M5900" ) .atag_offset = 0x100, .map_io = amlm5900_map_io, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_machine = amlm5900_init, .init_time = samsung_timer_init, .restart = s3c2410_restart,
arch/arm/mach-s3c24xx/mach-bast.c +1 -1
@@ -605,7 +605,7 @@ MACHINE_START(BAST, "Simtec-BAST")/* Maintainer: Ben Dooks <[email protected]> */ .atag_offset = 0x100, .map_io = bast_map_io, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_machine = bast_init, .init_time = samsung_timer_init, .restart = s3c2410_restart,
arch/arm/mach-s3c24xx/mach-h1940.c +1 -6
@@ -667,11 +667,6 @@ static void __init h1940_reserve(void)memblock_reserve (0x30081000 ,0x1000 ); } -static void __init h1940_init_irq (void ) -{ -s3c24xx_init_irq (); -} -static void __init h1940_init (void ) {u32 tmp;
@@ -740,7 +735,7 @@ MACHINE_START(H1940, "IPAQ-H1940") .atag_offset = 0x100, .map_io = h1940_map_io, .reserve = h1940_reserve, - .init_irq = h1940_init_irq, + .init_irq = s3c2410_init_irq, .init_machine = h1940_init, .init_time = samsung_timer_init, .restart = s3c2410_restart,
arch/arm/mach-s3c24xx/mach-n30.c +2 -2
@@ -592,7 +592,7 @@ MACHINE_START(N30, "Acer-N30") .atag_offset = 0x100, .init_time = samsung_timer_init, .init_machine = n30_init, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .map_io = n30_map_io, .restart = s3c2410_restart,MACHINE_END
@@ -603,7 +603,7 @@ MACHINE_START(N35, "Acer-N35") .atag_offset = 0x100, .init_time = samsung_timer_init, .init_machine = n30_init, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .map_io = n30_map_io, .restart = s3c2410_restart,MACHINE_END
arch/arm/mach-s3c24xx/mach-otom.c +1 -1
@@ -116,7 +116,7 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1") .atag_offset = 0x100, .map_io = otom11_map_io, .init_machine = otom11_init, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_time = samsung_timer_init, .restart = s3c2410_restart,MACHINE_END
arch/arm/mach-s3c24xx/mach-qt2410.c +1 -1
@@ -343,7 +343,7 @@ static void __init qt2410_machine_init(void)MACHINE_START (QT2410 ,"QT2410" ) .atag_offset = 0x100, .map_io = qt2410_map_io, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_machine = qt2410_machine_init, .init_time = samsung_timer_init, .restart = s3c2410_restart,
arch/arm/mach-s3c24xx/mach-smdk2410.c +1 -1
@@ -116,7 +116,7 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc/* Maintainer: Jonas Dietsche */ .atag_offset = 0x100, .map_io = smdk2410_map_io, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_machine = smdk2410_init, .init_time = samsung_timer_init, .restart = s3c2410_restart,
arch/arm/mach-s3c24xx/mach-tct_hammer.c +1 -1
@@ -149,7 +149,7 @@ static void __init tct_hammer_init(void)MACHINE_START (TCT_HAMMER ,"TCT_HAMMER" ) .atag_offset = 0x100, .map_io = tct_hammer_map_io, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_machine = tct_hammer_init, .init_time = samsung_timer_init, .restart = s3c2410_restart,
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
@@ -355,7 +355,7 @@ MACHINE_START(VR1000, "Thorcom-VR1000") .atag_offset = 0x100, .map_io = vr1000_map_io, .init_machine = vr1000_init, - .init_irq = s3c24xx_init_irq, + .init_irq = s3c2410_init_irq, .init_time = samsung_timer_init, .restart = s3c2410_restart,MACHINE_END
arch/arm/plat-samsung/include/plat/cpu.h +0 -1
@@ -183,7 +183,6 @@ extern void s3c_init_cpu(unsigned long idcode,/* core initialisation functions */ -extern void s3c24xx_init_irq (void );extern void s5p_init_irq (u32 *vic,u32 num_vic);extern void s3c24xx_init_io (struct map_desc *mach_desc,int size);
Signature · 1 line
1.7.2.3
PATCH 4/5 ARM: S3C24XX: make s3c24xx_init_intc static
In reply to Heiko StübnerIt's not used anywhere else.
--- arch/arm/mach-s3c24xx/irq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-s3c24xx/irq.c +1 -1
@@ -428,7 +428,7 @@ static void s3c24xx_clear_intc(struct s3c_irq_intc *intc) } } -struct s3c_irq_intc *s3c24xx_init_intc (struct device_node *np, +static struct s3c_irq_intc *s3c24xx_init_intc (struct device_node *np,struct s3c_irq_data *irq_data,struct s3c_irq_intc *parent,unsigned long address)
Signature · 1 line
1.7.2.3
PATCH 5/5 ARM: S3C24XX: add handle_irq function
In reply to Heiko StübnerThis removes the dependency on static irq mappings for basic irq handling and makes the s3c24xx entry-macro.S obsolete.
Also the interrupts of the second full interrupt controller on the s3c2416 are really handled now, which was forgotten when adding them.
The handling itself does the same as the previous assembler-code in that it tries to get the interrupt offset from the offset register first and if that produces wrong results manually searches for the interrupt bit in the pending register value. It also saves the historic comment which explains the reason behind this.
--- arch/arm/Kconfig | 1 + arch/arm/mach-s3c24xx/include/mach/entry-macro.S | 70 ---------------------- arch/arm/mach-s3c24xx/irq.c | 58 ++++++++++++++++++ 3 files changed, 59 insertions(+), 70 deletions(-) delete mode 100644 arch/arm/mach-s3c24xx/include/mach/entry-macro.S
arch/arm/Kconfig +1 -0
@@ -777,6 +777,7 @@ config ARCH_S3C24XX select HAVE_S3C2410_I2C if I2C select HAVE_S3C2410_WATCHDOG if WATCHDOG select HAVE_S3C_RTC if RTC_CLASS + select MULTI_IRQ_HANDLER select NEED_MACH_GPIO_H select NEED_MACH_IO_H help
arch/arm/mach-s3c24xx/include/mach/entry-macro.S deleted +0 -70
70 lines not on this page · raw message
arch/arm/mach-s3c24xx/irq.c +58 -0
76 lines not on this page · raw message
Signature · 1 line
1.7.2.3
cover ARM: S3C24XX: more fixes and enhancements for the s3c24xx irqs
In reply to Heiko StübnerQuoted 32 lines · Heiko St?bner
Asorted fixes and enhancements for the recent redo of the s3c24xx interrupt controllers.
The only real error that gets fixed is the handling of 0-hwirq as
parent_irqon s3c2412 in patch 2. No other of the s3c24xx platforms uses the bit0 of the parent controller asparent_irq.Heiko Stuebner (5):
ARM: S3C24XX: fix redundant checks in the irq mapping function
ARM: S3C24XX: fix irq parent check
ARM: S3C24XX: moves3c24xx_init_irqtos3c2410_init_irq
ARM: S3C24XX: makes3c24xx_init_intcstatic
ARM: S3C24XX: addhandle_irqfunctionarch/arm/Kconfig | 1 + arch/arm/mach-s3c24xx/common.h | 1 + arch/arm/mach-s3c24xx/include/mach/entry-macro.S | 70 --------- arch/arm/mach-s3c24xx/irq.c | 167 +++++++++++++-------- arch/arm/mach-s3c24xx/mach-amlm5900.c | 2 +- arch/arm/mach-s3c24xx/mach-bast.c | 2 +- arch/arm/mach-s3c24xx/mach-h1940.c | 7 +- arch/arm/mach-s3c24xx/mach-n30.c | 4 +- arch/arm/mach-s3c24xx/mach-otom.c | 2 +- arch/arm/mach-s3c24xx/mach-qt2410.c | 2 +- arch/arm/mach-s3c24xx/mach-smdk2410.c | 2 +- arch/arm/mach-s3c24xx/mach-tct_hammer.c | 2 +- arch/arm/mach-s3c24xx/mach-vr1000.c | 2 +- arch/arm/plat-samsung/include/plat/cpu.h | 1 - 14 files changed, 115 insertions(+), 150 deletions(-) delete mode 100644 arch/arm/mach-s3c24xx/include/mach/entry-macro.S
Quoted 2 lines
--
1.7.2.3
Looks good to me, applied.
Thanks.
- Kukjin