"Mark A. Greer" <[email protected]> writes: > From: Mark A. Greer <[email protected]> > > Currently, the davinci code uses a fixed base address for the interrupt > controller. Change this so the the base address is determined at > runtime to support some new SoC that will be added. Use the SoC > infrastructure to pass the base address to the common code and > then put the address in a global so that get_irqnr_preamble() > can access it. > > Signed-off-by: Mark A. Greer <[email protected]>
Signed-off-by: Kevin Hilman <[email protected]> > --- > I still need to figure out the best way to have 2 versions of > get_irqnr_and_base(). I'm ok with some #ifdef'ery here: A single (slower) version that checks the INTC type when multiple devices are supported, and then optimized fast versions if only a single INTC type is config'd in. I was envisioning a hidden Kconfig option for the different INTC types (CONFIG_DAVINCI_INTC_xyz) that is selected by each CPU type in Kconfig. Then, this #ifdef'ery could use those CONFIG_DAVINCI_INTC_* ifdefs. But frankly, I haven't thought this through entirely. There maybe some gotchas that I haven't thought of. I guess the primary concern is performance, and my main point is that I'm OK with the cost of a few extra instructions per interrupt if I can get a single binary for multiple devices. Kevin > arch/arm/mach-davinci/common.c | 3 +++ > arch/arm/mach-davinci/dm355.c | 1 + > arch/arm/mach-davinci/dm644x.c | 2 ++ > arch/arm/mach-davinci/dm646x.c | 2 ++ > arch/arm/mach-davinci/include/mach/common.h | 1 + > arch/arm/mach-davinci/include/mach/entry-macro.S | 3 ++- > 6 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c > index 8198558..81ef841 100644 > --- a/arch/arm/mach-davinci/common.c > +++ b/arch/arm/mach-davinci/common.c > @@ -15,6 +15,7 @@ > #include <mach/common.h> > > struct davinci_soc_info *davinci_soc_info; > +void __iomem *davinci_intc_base; > > int __init davinci_soc_init(struct davinci_soc_info *soc_info) > { > @@ -51,6 +52,8 @@ int __init davinci_soc_init(struct davinci_soc_info > *soc_info) > goto err; > } > > + davinci_intc_base = davinci_soc_info->intc_base; > + > return 0; > > err: > diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c > index 76691fc..abfe8b3 100644 > --- a/arch/arm/mach-davinci/dm355.c > +++ b/arch/arm/mach-davinci/dm355.c > @@ -484,4 +484,5 @@ DAVINCI_SOC_START(dm355) > .mux_base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE), > .io_desc = dm355_io_desc, > .io_desc_num = ARRAY_SIZE(dm355_io_desc), > + .intc_base = IO_ADDRESS(DAVINCI_ARM_INTC_BASE), > DAVINCI_SOC_END > diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c > index 3475a0b..4de48bb 100644 > --- a/arch/arm/mach-davinci/dm644x.c > +++ b/arch/arm/mach-davinci/dm644x.c > @@ -17,6 +17,7 @@ > #include <mach/clock.h> > #include <mach/psc.h> > #include <mach/mux.h> > +#include <mach/irqs.h> > #include <mach/cpu.h> > > #include "clock.h" > @@ -376,4 +377,5 @@ DAVINCI_SOC_START(dm644x) > .mux_base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE), > .io_desc = dm644x_io_desc, > .io_desc_num = ARRAY_SIZE(dm644x_io_desc), > + .intc_base = IO_ADDRESS(DAVINCI_ARM_INTC_BASE), > DAVINCI_SOC_END > diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c > index 2405f29..96366d4 100644 > --- a/arch/arm/mach-davinci/dm646x.c > +++ b/arch/arm/mach-davinci/dm646x.c > @@ -17,6 +17,7 @@ > #include <mach/clock.h> > #include <mach/psc.h> > #include <mach/mux.h> > +#include <mach/irqs.h> > #include <mach/cpu.h> > > #include "clock.h" > @@ -287,4 +288,5 @@ DAVINCI_SOC_START(dm646x) > .mux_base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE), > .io_desc = dm646x_io_desc, > .io_desc_num = ARRAY_SIZE(dm646x_io_desc), > + .intc_base = IO_ADDRESS(DAVINCI_ARM_INTC_BASE), > DAVINCI_SOC_END > diff --git a/arch/arm/mach-davinci/include/mach/common.h > b/arch/arm/mach-davinci/include/mach/common.h > index 128203f..2f1db24 100644 > --- a/arch/arm/mach-davinci/include/mach/common.h > +++ b/arch/arm/mach-davinci/include/mach/common.h > @@ -36,6 +36,7 @@ struct davinci_soc_info { > void __iomem *mux_base; > struct map_desc *io_desc; > unsigned long io_desc_num; > + void __iomem *intc_base; > }; > > #define DAVINCI_SOC_START(_name) \ > diff --git a/arch/arm/mach-davinci/include/mach/entry-macro.S > b/arch/arm/mach-davinci/include/mach/entry-macro.S > index 0ebb445..ed78851 100644 > --- a/arch/arm/mach-davinci/include/mach/entry-macro.S > +++ b/arch/arm/mach-davinci/include/mach/entry-macro.S > @@ -15,7 +15,8 @@ > .endm > > .macro get_irqnr_preamble, base, tmp > - ldr \base, =IO_ADDRESS(DAVINCI_ARM_INTC_BASE) > + ldr \base, =davinci_intc_base > + ldr \base, [\base] > .endm > > .macro arch_ret_to_user, tmp1, tmp2 > -- > 1.6.0.3 > > > _______________________________________________ > Davinci-linux-open-source mailing list > [email protected] > http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source _______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
