blob: d6441214d432460d56e02f9656e4edc125b5f434 [file] [log] [blame]
Prasad Sodagudied8df5b2012-09-28 13:49:59 +05301/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/module.h>
14#include <linux/interrupt.h>
15#include <linux/slab.h>
16#include <linux/irq.h>
17#include <asm/fiq.h>
18#include <asm/hardware/gic.h>
19#include <asm/cacheflush.h>
20#include <mach/irqs-8625.h>
Taniya Dasebc6a792012-10-18 14:57:29 +053021#include <mach/socinfo.h>
Prasad Sodagudied8df5b2012-09-28 13:49:59 +053022
23#include "msm_watchdog.h"
24
25#define MODULE_NAME "MSM7K_FIQ"
26
27struct msm_watchdog_dump msm_dump_cpu_ctx;
28static int fiq_counter;
29void *msm7k_fiq_stack;
30
31/* Called from the FIQ asm handler */
32void msm7k_fiq_handler(void)
33{
34 struct irq_data *d;
35 struct irq_chip *c;
36
37 pr_info("Fiq is received %s\n", __func__);
38 fiq_counter++;
39 d = irq_get_irq_data(MSM8625_INT_A9_M2A_2);
40 c = irq_data_get_irq_chip(d);
41 c->irq_mask(d);
42 local_irq_disable();
43
44 /* Clear the IRQ from the ENABLE_SET */
45 gic_clear_irq_pending(MSM8625_INT_A9_M2A_2);
46 local_irq_enable();
47 flush_cache_all();
48 outer_flush_all();
49 return;
50}
51
52struct fiq_handler msm7k_fh = {
53 .name = MODULE_NAME,
54};
55
56static int __init msm_setup_fiq_handler(void)
57{
58 int ret = 0;
59
60 claim_fiq(&msm7k_fh);
61 set_fiq_handler(&msm7k_fiq_start, msm7k_fiq_length);
62 msm7k_fiq_stack = (void *)__get_free_pages(GFP_KERNEL,
63 THREAD_SIZE_ORDER);
64 if (msm7k_fiq_stack == NULL) {
65 pr_err("FIQ STACK SETUP IS NOT SUCCESSFUL\n");
66 return -ENOMEM;
67 }
68
69 fiq_set_type(MSM8625_INT_A9_M2A_2, IRQF_TRIGGER_RISING);
70 gic_set_irq_secure(MSM8625_INT_A9_M2A_2);
71 enable_irq(MSM8625_INT_A9_M2A_2);
72 pr_info("%s : msm7k fiq setup--done\n", __func__);
73 return ret;
74}
75
76static int __init init7k_fiq(void)
77{
Utsab Bose4ed4ba12012-11-08 18:52:38 +053078 if (!cpu_is_msm8625() && !cpu_is_msm8625q())
Taniya Dasebc6a792012-10-18 14:57:29 +053079 return 0;
80
Prasad Sodagudied8df5b2012-09-28 13:49:59 +053081 if (msm_setup_fiq_handler())
82 pr_err("MSM7K FIQ INIT FAILED\n");
83
84 return 0;
85}
86late_initcall(init7k_fiq);