Enable SPARSE_IRQ for mach-mxs
Subsystems (6)
cover Enable SPARSE_IRQ for mach-mxs
The series adopts irq_domain support for mxs icoll and gpio drivers, enables SPARSE_IRQ, and remove mach/irqs.h for mach-mxs.
As the series depends on mxs/dt branch, I plan to have it go via arm-soc tree with Linus' ack on the first patch.
Shawn Guo (6):
gpio/mxs: adopt irq_domain support for mxs gpio driver
ARM: mxs: retrieve timer irq from device tree
ARM: mxs: select MULTI_IRQ_HANDLER
ARM: mxs: adopt irq_domain support for icoll driver
ARM: mxs: select SPARSE_IRQ
ARM: mxs: remove mach/irqs.h
arch/arm/Kconfig | 2 + arch/arm/boot/dts/imx23.dtsi | 5 +- arch/arm/boot/dts/imx28.dtsi | 5 +- arch/arm/mach-mxs/icoll.c | 63 ++++++++++++++++++++++---- arch/arm/mach-mxs/include/mach/common.h | 3 +- arch/arm/mach-mxs/include/mach/entry-macro.S | 35 -------------- arch/arm/mach-mxs/include/mach/irqs.h | 32 ------------- arch/arm/mach-mxs/mach-mxs.c | 39 ++-------------- arch/arm/mach-mxs/timer.c | 13 +++++- drivers/clk/mxs/clk-imx23.c | 2 +- drivers/clk/mxs/clk-imx28.c | 2 +- drivers/gpio/gpio-mxs.c | 48 ++++++++++++------- 12 files changed, 112 insertions(+), 137 deletions(-) delete mode 100644 arch/arm/mach-mxs/include/mach/entry-macro.S delete mode 100644 arch/arm/mach-mxs/include/mach/irqs.h
Signature · 1 line
1.7.5.4
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without using virtual_irq_start and MXS_GPIO_IRQ_START.
--- arch/arm/mach-mxs/mach-mxs.c | 12 ---------- drivers/gpio/gpio-mxs.c | 48 ++++++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-)
arch/arm/mach-mxs/mach-mxs.c +0 -12
@@ -149,20 +149,8 @@ static int __init mxs_icoll_add_irq_domain(struct device_node *np,return 0 ; } -static int __init mxs_gpio_add_irq_domain (struct device_node *np, -struct device_node *interrupt_parent) -{ -static int gpio_irq_base =MXS_GPIO_IRQ_START ; - -irq_domain_add_legacy (np,32 , gpio_irq_base,0 , &irq_domain_simple_ops,NULL ); - gpio_irq_base +=32 ; - -return 0 ; -} -static const struct of_device_id mxs_irq_match[]__initconst = { { .compatible ="fsl,mxs-icoll" , .data = mxs_icoll_add_irq_domain, }, - { .compatible ="fsl,mxs-gpio" , .data = mxs_gpio_add_irq_domain, }, {/* sentinel */ } };
drivers/gpio/gpio-mxs.c +30 -18
138 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Quoted 4 lines · Shawn Guo
Remove
irq_domain_add_legacycall frommach-mxs.cand have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without usingvirtual_irq_startandMXS_GPIO_IRQ_START.
Seems like a good thing to do, but with Grant and Rob being better at irqdomain than me I'd prefer one of them to have a look at this too.
drivers/gpio/gpio-mxs.c static int __devinit mxs_gpio_probe(struct platform_device *pdev) · line 280
Quoted 6 lines
drivers/gpio/gpio-mxs.c +6
-0+ irq_base =irq_alloc_descs (-1 ,0 ,32 ,numa_node_id ()); +if (irq_base <0 ) +return irq_base; + + port->domain =irq_domain_add_legacy (np,32 , irq_base,0 , + &irq_domain_simple_ops,NULL );
For example I want to understand if it'd be possible to use a linear domain here.
Yours,
Linus Walleij
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Quoted 17 lines · Linus Walleij
Quoted 4 lines · Shawn Guo
Remove
irq_domain_add_legacycall frommach-mxs.cand have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without usingvirtual_irq_startandMXS_GPIO_IRQ_START.Seems like a good thing to do, but with Grant and Rob being better at irqdomain than me I'd prefer one of them to have a look at this too.
drivers/gpio/gpio-mxs.c static int __devinit mxs_gpio_probe(struct platform_device *pdev) · line 280
Quoted 6 lines
drivers/gpio/gpio-mxs.c +6
-0+ irq_base =irq_alloc_descs (-1 ,0 ,32 ,numa_node_id ()); +if (irq_base <0 ) +return irq_base; + + port->domain =irq_domain_add_legacy (np,32 , irq_base,0 , + &irq_domain_simple_ops,NULL );
Quoted 2 lines
For example I want to understand if it'd be possible to use a linear domain here.
Unfortunately, not if you care about your irq base and need sequential irq numbers which is the case for non-DT.
Rob
Quoted 9 lines
Yours,
Linus Walleij_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Quoted 18 lines · Rob Herring
Quoted 17 lines · Linus Walleij
Quoted 4 lines · Shawn Guo
Remove
irq_domain_add_legacycall frommach-mxs.cand have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without usingvirtual_irq_startandMXS_GPIO_IRQ_START.Seems like a good thing to do, but with Grant and Rob being better at irqdomain than me I'd prefer one of them to have a look at this too.
Quoted 6 lines
drivers/gpio/gpio-mxs.c +6
-0+ irq_base =irq_alloc_descs (-1 ,0 ,32 ,numa_node_id ()); +if (irq_base <0 ) +return irq_base; + + port->domain =irq_domain_add_legacy (np,32 , irq_base,0 , + &irq_domain_simple_ops,NULL );
Quoted 6 lines
Quoted 2 lines
For example I want to understand if it'd be possible to use a linear domain here.
Unfortunately, not if you care about your irq base and need sequential irq numbers which is the case for non-DT.
Right. For for this particular case, it's more because generic-chip currently does not cope with the driver using linear domain.
Signature · 2 lines
Regards, Shawn
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
In reply to Shawn GuoQuoted 7 lines · Shawn Guo
Remove
irq_domain_add_legacycall frommach-mxs.cand have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without usingvirtual_irq_startandMXS_GPIO_IRQ_START.Signed-off-by Shawn Guo <[email protected]>Cc Linus Walleij <[email protected]>
OK patch applied, thanks!
Yours,
Linus Walleij
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Quoted 7 lines · Linus Walleij
Quoted 5 lines · Shawn Guo
Remove
irq_domain_add_legacycall frommach-mxs.cand have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without usingvirtual_irq_startandMXS_GPIO_IRQ_START.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Shawn Guo <[email protected]>Cc Linus Walleij <[email protected]>OK patch applied, thanks!
I was planning to have the patch to go via arm-soc tree with your ACK. But it also works to have it on gpio tree and I ask arm-soc people to pull gpio tree into arm-soc, but you need to ensure the branch is stable (no rebase).
Signature · 2 lines
Regards, Shawn
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Quoted 11 lines · Shawn Guo
Quoted 10 lines · Linus Walleij
Quoted 7 lines · Shawn Guo
Remove
irq_domain_add_legacycall frommach-mxs.cand have the gpio driver adopt irqdomain support, so that we can have the mapping between gpio and irq number available without usingvirtual_irq_startandMXS_GPIO_IRQ_START.Signed-off-by Shawn Guo <[email protected]>Cc Linus Walleij <[email protected]>
Quoted 6 lines
Quoted 2 lines
OK patch applied, thanks!
I was planning to have the patch to go via arm-soc tree with your ACK. But it also works to have it on gpio tree and I ask arm-soc people to pull gpio tree into arm-soc, but you need to ensure the branch is stable (no rebase).
OK sorry (and sorry for the delay) I took the patch out again, please take this through your tree as needed.
Yours.
Linus Walleij
PATCH 1/6 gpio/mxs: adopt irq_domain support for mxs gpio driver
Quoted 3 lines · Linus Walleij
OK sorry (and sorry for the delay) I took the patch out again, please take this through your tree as needed.
Will do.
Quoted 2 lines
Acked-by Linus Walleij <[email protected]>
Thanks, Linus.
Signature · 2 lines
Regards, Shawn
PATCH 2/6 ARM: mxs: retrieve timer irq from device tree
In reply to Shawn GuoRather than using the static timer irq definition, we should retrieve timer irq from device tree for better.
--- arch/arm/boot/dts/imx23.dtsi | 3 ++- arch/arm/boot/dts/imx28.dtsi | 3 ++- arch/arm/mach-mxs/include/mach/common.h | 2 +- arch/arm/mach-mxs/timer.c | 13 ++++++++++++- drivers/clk/mxs/clk-imx23.c | 2 +- drivers/clk/mxs/clk-imx28.c | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-)
arch/arm/boot/dts/imx23.dtsi +2 -1
@@ -400,8 +400,9 @@ }; timrot at 80068000 { + compatible = "fsl,imx23-timrot", "fsl,timrot"; reg = <0x80068000 0x2000>; - status = "disabled"; + interrupts = <28 29 30 31>; }; auart0: serial at 8006c000 {
arch/arm/boot/dts/imx28.dtsi +2 -1
@@ -686,8 +686,9 @@ }; timrot at 80068000 { + compatible = "fsl,imx28-timrot", "fsl,timrot"; reg = <0x80068000 0x2000>; - status = "disabled"; + interrupts = <48 49 50 51>; }; auart0: serial at 8006a000 {
arch/arm/mach-mxs/include/mach/common.h +1 -1
@@ -13,7 +13,7 @@extern const u32 *mxs_get_ocotp (void );extern int mxs_reset_block (void __iomem *); -extern void mxs_timer_init (int ); +extern void mxs_timer_init (void );extern void mxs_restart (char ,const char *);extern int mxs_saif_clkmux_select (unsigned int clkmux);
arch/arm/mach-mxs/timer.c +12 -1
@@ -25,6 +25,8 @@#include <linux/irq.h> #include <linux/clockchips.h> #include <linux/clk.h> +#include <linux/of.h> +#include <linux/of_irq.h> #include <asm/mach/time.h> #include <mach/mxs.h>
@@ -244,9 +246,17 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)return 0 ; } -void __init mxs_timer_init (int irq) +void __init mxs_timer_init (void ) { +struct device_node *np;struct clk *timer_clk; +int irq; + + np =of_find_compatible_node (NULL ,NULL ,"fsl,timrot" ); +if (!np) { +pr_err ("%s: failed find timrot node\n" , __func__); +return ; + } timer_clk =clk_get_sys ("timrot" ,NULL );if (IS_ERR (timer_clk)) {
@@ -295,5 +305,6 @@ void __init mxs_timer_init(int irq)mxs_clockevent_init (timer_clk);/* Make irqs happen */ + irq =irq_of_parse_and_map (np,0 );setup_irq (irq, &mxs_timer_irq); }
drivers/clk/mxs/clk-imx23.c +1 -1
@@ -200,7 +200,7 @@ int __init mx23_clocks_init(void)for (i =0 ; i <ARRAY_SIZE (clks_init_on); i++)clk_prepare_enable (clks[clks_init_on[i]]); -mxs_timer_init (MX23_INT_TIMER0 ); +mxs_timer_init ();return 0 ; }
drivers/clk/mxs/clk-imx28.c +1 -1
@@ -337,7 +337,7 @@ int __init mx28_clocks_init(void)for (i =0 ; i <ARRAY_SIZE (clks_init_on); i++)clk_prepare_enable (clks[clks_init_on[i]]); -mxs_timer_init (MX28_INT_TIMER0 ); +mxs_timer_init ();return 0 ; }
Signature · 1 line
1.7.5.4
PATCH 3/6 ARM: mxs: select MULTI_IRQ_HANDLER
In reply to Shawn GuoAs part of multi-platform effort, let's enable MULTI_IRQ_HANDLER for mach-mxs and remove entry-macro.S.
--- arch/arm/Kconfig | 1 + arch/arm/mach-mxs/icoll.c | 18 ++++++++++++- arch/arm/mach-mxs/include/mach/common.h | 1 + arch/arm/mach-mxs/include/mach/entry-macro.S | 35 -------------------------- arch/arm/mach-mxs/mach-mxs.c | 2 + 5 files changed, 21 insertions(+), 36 deletions(-) delete mode 100644 arch/arm/mach-mxs/include/mach/entry-macro.S
arch/arm/Kconfig +1 -0
@@ -489,6 +489,7 @@ config ARCH_MXS select CLKSRC_MMIO select COMMON_CLK select HAVE_CLK_PREPARE + select MULTI_IRQ_HANDLER select PINCTRL select USE_OF help
arch/arm/mach-mxs/icoll.c +17 -1
@@ -20,13 +20,14 @@#include <linux/init.h> #include <linux/irq.h> #include <linux/io.h> - +#include <asm/exception.h> #include <mach/mxs.h> #include <mach/common.h> #define HW_ICOLL_VECTOR 0x0000#define HW_ICOLL_LEVELACK 0x0010#define HW_ICOLL_CTRL 0x0020 +#define HW_ICOLL_STAT_OFFSET 0x0070#define HW_ICOLL_INTERRUPTn_SET (n) (0x0124 + (n) * 0x10)#define HW_ICOLL_INTERRUPTn_CLR (n) (0x0128 + (n) * 0x10)#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004
@@ -63,6 +64,21 @@ static struct irq_chip mxs_icoll_chip = { .irq_unmask = icoll_unmask_irq, }; +asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) +{ +u32 irqnr; + +do { + irqnr =__raw_readl (icoll_base +HW_ICOLL_STAT_OFFSET ); +if (irqnr !=0x7f ) { +__raw_writel (irqnr, icoll_base +HW_ICOLL_VECTOR ); +handle_IRQ (irqnr, regs); +continue ; + } +break ; + }while (1 ); +} +void __init icoll_init_irq (void ) {int i;
arch/arm/mach-mxs/include/mach/common.h +1 -0
@@ -24,5 +24,6 @@ extern int mx28_clocks_init(void);extern void mx28_map_io (void );extern void icoll_init_irq (void ); +extern void icoll_handle_irq (struct pt_regs *);#endif /* __MACH_MXS_COMMON_H__ */
arch/arm/mach-mxs/include/mach/entry-macro.S deleted +0 -35
@@ -1,35 +0,0 @@ -/* - * Low-level IRQ helper macros for Freescale MXS-based - * - * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <mach/mxs.h> - -#define MXS_ICOLL_VBASE MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR) -#define HW_ICOLL_STAT_OFFSET 0x70 - - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqnr, [\base, #HW_ICOLL_STAT_OFFSET] - cmp \irqnr, #0x7F - strne \irqnr, [\base] - moveqs \irqnr, #0 - .endm - - .macro get_irqnr_preamble, base, tmp - ldr \base, =MXS_ICOLL_VBASE - .endm
arch/arm/mach-mxs/mach-mxs.c +2 -0
@@ -413,6 +413,7 @@ static const char *imx28_dt_compat[] __initdata = {DT_MACHINE_START (IMX23 ,"Freescale i.MX23 (Device Tree)" ) .map_io = mx23_map_io, .init_irq = mxs_dt_init_irq, + .handle_irq = icoll_handle_irq, .timer = &imx23_timer, .init_machine = mxs_machine_init, .dt_compat = imx23_dt_compat,
@@ -422,6 +423,7 @@ MACHINE_ENDDT_MACHINE_START (IMX28 ,"Freescale i.MX28 (Device Tree)" ) .map_io = mx28_map_io, .init_irq = mxs_dt_init_irq, + .handle_irq = icoll_handle_irq, .timer = &imx28_timer, .init_machine = mxs_machine_init, .dt_compat = imx28_dt_compat,
Signature · 1 line
1.7.5.4
PATCH 4/6 ARM: mxs: adopt irq_domain support for icoll driver
In reply to Shawn GuoRemove irq_domain_add_legacy call from mach-mxs.c and have icoll adopt irq_domain support in the driver.
--- arch/arm/boot/dts/imx23.dtsi | 2 +- arch/arm/boot/dts/imx28.dtsi | 2 +- arch/arm/mach-mxs/icoll.c | 45 ++++++++++++++++++++++++++++++++++------- arch/arm/mach-mxs/mach-mxs.c | 25 +--------------------- 4 files changed, 41 insertions(+), 33 deletions(-)
arch/arm/boot/dts/imx23.dtsi +1 -1
@@ -43,7 +43,7 @@ ranges; icoll: interrupt-controller at 80000000 { - compatible = "fsl,imx23-icoll", "fsl,mxs-icoll"; + compatible = "fsl,imx23-icoll", "fsl,icoll"; interrupt-controller; #interrupt-cells = <1>; reg = <0x80000000 0x2000>;
arch/arm/boot/dts/imx28.dtsi +1 -1
@@ -50,7 +50,7 @@ ranges; icoll: interrupt-controller at 80000000 { - compatible = "fsl,imx28-icoll", "fsl,mxs-icoll"; + compatible = "fsl,imx28-icoll", "fsl,icoll"; interrupt-controller; #interrupt-cells = <1>; reg = <0x80000000 0x2000>;
arch/arm/mach-mxs/icoll.c +37 -8
88 lines not on this page · raw message
arch/arm/mach-mxs/mach-mxs.c +2 -23
@@ -17,10 +17,8 @@#include <linux/err.h> #include <linux/gpio.h> #include <linux/init.h> -#include <linux/irqdomain.h> #include <linux/micrel_phy.h> #include <linux/mxsfb.h> -#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/phy.h> #include <linux/pinctrl/consumer.h>
@@ -141,25 +139,6 @@ static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = { {/* sentinel */ } }; -static int __init mxs_icoll_add_irq_domain (struct device_node *np, -struct device_node *interrupt_parent) -{ -irq_domain_add_legacy (np,128 ,0 ,0 , &irq_domain_simple_ops,NULL ); - -return 0 ; -} - -static const struct of_device_id mxs_irq_match[]__initconst = { - { .compatible ="fsl,mxs-icoll" , .data = mxs_icoll_add_irq_domain, }, - {/* sentinel */ } -}; - -static void __init mxs_dt_init_irq (void ) -{ -icoll_init_irq (); -of_irq_init (mxs_irq_match); -} -static void __init imx23_timer_init (void ) {mx23_clocks_init ();
@@ -412,7 +391,7 @@ static const char *imx28_dt_compat[] __initdata = {DT_MACHINE_START (IMX23 ,"Freescale i.MX23 (Device Tree)" ) .map_io = mx23_map_io, - .init_irq = mxs_dt_init_irq, + .init_irq = icoll_init_irq, .handle_irq = icoll_handle_irq, .timer = &imx23_timer, .init_machine = mxs_machine_init,
@@ -422,7 +401,7 @@ MACHINE_ENDDT_MACHINE_START (IMX28 ,"Freescale i.MX28 (Device Tree)" ) .map_io = mx28_map_io, - .init_irq = mxs_dt_init_irq, + .init_irq = icoll_init_irq, .handle_irq = icoll_handle_irq, .timer = &imx28_timer, .init_machine = mxs_machine_init,
Signature · 1 line
1.7.5.4
PATCH 5/6 ARM: mxs: select SPARSE_IRQ
In reply to Shawn GuoWith icoll and gpio interrupt controllers adopt irqdomain support and all interrupt nubmers are retrieved from device tree, it's save to select SPARSE_IRQ for mxs now.
--- arch/arm/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/Kconfig +1 -0
@@ -491,6 +491,7 @@ config ARCH_MXS select HAVE_CLK_PREPARE select MULTI_IRQ_HANDLER select PINCTRL + select SPARSE_IRQ select USE_OF help Support for Freescale MXS-based family of processors
Signature · 1 line
1.7.5.4
PATCH 5/6 ARM: mxs: select SPARSE_IRQ
Quoted 2 lines · Shawn Guo
With icoll and gpio interrupt controllers adopt irqdomain support and all interrupt nubmers are retrieved from device tree, it's save to
s/save/safe
Quoted 3 lines
select
SPARSE_IRQfor mxs now.Signed-off-by Shawn Guo <[email protected]>
PATCH 6/6 ARM: mxs: remove mach/irqs.h
In reply to Shawn GuoWith SPARSE_IRQ adopted for mach-mxs, header mach/irqs.h is needed nowhere now, so remove it.
--- arch/arm/mach-mxs/include/mach/irqs.h | 32 -------------------------------- 1 files changed, 0 insertions(+), 32 deletions(-) delete mode 100644 arch/arm/mach-mxs/include/mach/irqs.h
arch/arm/mach-mxs/include/mach/irqs.h deleted +0 -32
@@ -1,32 +0,0 @@ -/* -* Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. -*/ - -/* -* 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 __MACH_MXS_IRQS_H__ -#define __MACH_MXS_IRQS_H__ - -#define MXS_INTERNAL_IRQS 128 - -#define MXS_GPIO_IRQ_START MXS_INTERNAL_IRQS - -/* the maximum for MXS-based */ -#define MXS_GPIO_IRQS (32 * 5) - -/* -* The next 16 interrupts are for board specific purposes. Since -* the kernel can only run on one machine at a time, we can re-use -* these. If you need more, increase MXS_BOARD_IRQS, but keep it -* within sensible limits. -*/ -#define MXS_BOARD_IRQ_START (MXS_GPIO_IRQ_START + MXS_GPIO_IRQS) -#define MXS_BOARD_IRQS 16 - -#define NR_IRQS (MXS_BOARD_IRQ_START + MXS_BOARD_IRQS) - -#endif /* __MACH_MXS_IRQS_H__ */
Signature · 1 line
1.7.5.4