aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorSukumar Ghorai <s-ghorai@ti.com>2011-01-28 05:12:05 -0500
committerTony Lindgren <tony@atomide.com>2011-02-17 18:32:53 -0500
commitdb97eb7dfe13f6c04f0a0e77c32e2691f563ab8b (patch)
tree116c66fc27f6f493fca9def7414366fd30b23343 /arch/arm/mach-omap2
parent1b0b323c70cd5fdca967d89ed3a03dfebd84ada7 (diff)
omap: gpmc: enable irq mode in gpmc
add support the irq mode in GPMC. gpmc_init() function move after omap_init_irq() as it has dependecy on irq. Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/gpmc.c45
-rw-r--r--arch/arm/mach-omap2/io.c2
2 files changed, 42 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 1b7b3e7d02f7..382dea83e4f0 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/irq.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/err.h> 20#include <linux/err.h>
@@ -22,6 +23,7 @@
22#include <linux/spinlock.h> 23#include <linux/spinlock.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/interrupt.h>
25 27
26#include <asm/mach-types.h> 28#include <asm/mach-types.h>
27#include <plat/gpmc.h> 29#include <plat/gpmc.h>
@@ -100,6 +102,8 @@ static void __iomem *gpmc_base;
100 102
101static struct clk *gpmc_l3_clk; 103static struct clk *gpmc_l3_clk;
102 104
105static irqreturn_t gpmc_handle_irq(int irq, void *dev);
106
103static void gpmc_write_reg(int idx, u32 val) 107static void gpmc_write_reg(int idx, u32 val)
104{ 108{
105 __raw_writel(val, gpmc_base + idx); 109 __raw_writel(val, gpmc_base + idx);
@@ -497,6 +501,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
497 u32 regval = 0; 501 u32 regval = 0;
498 502
499 switch (cmd) { 503 switch (cmd) {
504 case GPMC_ENABLE_IRQ:
505 gpmc_write_reg(GPMC_IRQENABLE, wval);
506 break;
507
500 case GPMC_SET_IRQ_STATUS: 508 case GPMC_SET_IRQ_STATUS:
501 gpmc_write_reg(GPMC_IRQSTATUS, wval); 509 gpmc_write_reg(GPMC_IRQSTATUS, wval);
502 break; 510 break;
@@ -678,9 +686,10 @@ static void __init gpmc_mem_init(void)
678 } 686 }
679} 687}
680 688
681void __init gpmc_init(void) 689static int __init gpmc_init(void)
682{ 690{
683 u32 l; 691 u32 l, irq;
692 int cs, ret = -EINVAL;
684 char *ck = NULL; 693 char *ck = NULL;
685 694
686 if (cpu_is_omap24xx()) { 695 if (cpu_is_omap24xx()) {
@@ -698,7 +707,7 @@ void __init gpmc_init(void)
698 } 707 }
699 708
700 if (WARN_ON(!ck)) 709 if (WARN_ON(!ck))
701 return; 710 return ret;
702 711
703 gpmc_l3_clk = clk_get(NULL, ck); 712 gpmc_l3_clk = clk_get(NULL, ck);
704 if (IS_ERR(gpmc_l3_clk)) { 713 if (IS_ERR(gpmc_l3_clk)) {
@@ -723,6 +732,36 @@ void __init gpmc_init(void)
723 l |= (0x02 << 3) | (1 << 0); 732 l |= (0x02 << 3) | (1 << 0);
724 gpmc_write_reg(GPMC_SYSCONFIG, l); 733 gpmc_write_reg(GPMC_SYSCONFIG, l);
725 gpmc_mem_init(); 734 gpmc_mem_init();
735
736 /* initalize the irq_chained */
737 irq = OMAP_GPMC_IRQ_BASE;
738 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
739 set_irq_handler(irq, handle_simple_irq);
740 set_irq_flags(irq, IRQF_VALID);
741 irq++;
742 }
743
744 ret = request_irq(INT_34XX_GPMC_IRQ,
745 gpmc_handle_irq, IRQF_SHARED, "gpmc", gpmc_base);
746 if (ret)
747 pr_err("gpmc: irq-%d could not claim: err %d\n",
748 INT_34XX_GPMC_IRQ, ret);
749 return ret;
750}
751postcore_initcall(gpmc_init);
752
753static irqreturn_t gpmc_handle_irq(int irq, void *dev)
754{
755 u8 cs;
756
757 if (irq != INT_34XX_GPMC_IRQ)
758 return IRQ_HANDLED;
759 /* check cs to invoke the irq */
760 cs = ((gpmc_read_reg(GPMC_PREFETCH_CONFIG1)) >> CS_NUM_SHIFT) & 0x7;
761 if (OMAP_GPMC_IRQ_BASE+cs <= OMAP_GPMC_IRQ_END)
762 generic_handle_irq(OMAP_GPMC_IRQ_BASE+cs);
763
764 return IRQ_HANDLED;
726} 765}
727 766
728#ifdef CONFIG_ARCH_OMAP3 767#ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index b8b49e4ae928..657f3c84687c 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -30,7 +30,6 @@
30 30
31#include <plat/sram.h> 31#include <plat/sram.h>
32#include <plat/sdrc.h> 32#include <plat/sdrc.h>
33#include <plat/gpmc.h>
34#include <plat/serial.h> 33#include <plat/serial.h>
35 34
36#include "clock2xxx.h" 35#include "clock2xxx.h"
@@ -422,7 +421,6 @@ void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
422 omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 421 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
423 _omap2_init_reprogram_sdrc(); 422 _omap2_init_reprogram_sdrc();
424 } 423 }
425 gpmc_init();
426 424
427 omap_irq_base_init(); 425 omap_irq_base_init();
428} 426}