msm: watchdog: Add support for VIC based devices
Current driver supports only GIC based devices. Revert
the old changes such that VIC based device can use the existing
driver.
Change-Id: I77bcdc57a001f77538641a62f57d13da4f278bac
Acked-by: Kaushik Sikdar <ksikdar@qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
diff --git a/arch/arm/mach-msm/msm_watchdog.c b/arch/arm/mach-msm/msm_watchdog.c
index 28b5995..994dca6 100644
--- a/arch/arm/mach-msm/msm_watchdog.c
+++ b/arch/arm/mach-msm/msm_watchdog.c
@@ -47,6 +47,7 @@
static unsigned long delay_time;
static unsigned long bark_time;
static unsigned long long last_pet;
+static bool has_vic;
/*
* On the kernel command line specify
@@ -161,9 +162,14 @@
if (!old_val) {
__raw_writel(0, msm_tmr0_base + WDT0_EN);
mb();
- disable_percpu_irq(WDT0_ACCSCSSNBARK_INT);
- free_percpu_irq(WDT0_ACCSCSSNBARK_INT, percpu_pdata);
- free_percpu(percpu_pdata);
+ if (has_vic) {
+ free_irq(WDT0_ACCSCSSNBARK_INT, 0);
+ } else {
+ disable_percpu_irq(WDT0_ACCSCSSNBARK_INT);
+ free_percpu_irq(WDT0_ACCSCSSNBARK_INT,
+ percpu_pdata);
+ free_percpu(percpu_pdata);
+ }
enable = 0;
atomic_notifier_chain_unregister(&panic_notifier_list,
&panic_blk);
@@ -221,9 +227,13 @@
if (enable) {
__raw_writel(0, msm_tmr0_base + WDT0_EN);
mb();
- disable_percpu_irq(WDT0_ACCSCSSNBARK_INT);
- free_percpu_irq(WDT0_ACCSCSSNBARK_INT, percpu_pdata);
- free_percpu(percpu_pdata);
+ if (has_vic) {
+ free_irq(WDT0_ACCSCSSNBARK_INT, 0);
+ } else {
+ disable_percpu_irq(WDT0_ACCSCSSNBARK_INT);
+ free_percpu_irq(WDT0_ACCSCSSNBARK_INT, percpu_pdata);
+ free_percpu(percpu_pdata);
+ }
enable = 0;
/* In case we got suspended mid-exit */
__raw_writel(0, msm_tmr0_base + WDT0_EN);
@@ -338,26 +348,34 @@
appsbark = 1;
bark_time = pdata->bark_time;
+ has_vic = pdata->has_vic;
msm_tmr0_base = msm_timer_get_timer0_base();
- percpu_pdata = alloc_percpu(struct msm_watchdog_pdata *);
- if (!percpu_pdata) {
- pr_err("%s: memory allocation failed for percpu data\n",
- __func__);
- return -ENOMEM;
- }
+ if (has_vic) {
+ ret = request_irq(WDT0_ACCSCSSNBARK_INT, wdog_bark_handler, 0,
+ "apps_wdog_bark", NULL);
+ if (ret)
+ return ret;
+ } else {
+ percpu_pdata = alloc_percpu(struct msm_watchdog_pdata *);
+ if (!percpu_pdata) {
+ pr_err("%s: memory allocation failed for percpu data\n",
+ __func__);
+ return -ENOMEM;
+ }
- *__this_cpu_ptr(percpu_pdata) = pdata;
- /* Must request irq before sending scm command */
- ret = request_percpu_irq(WDT0_ACCSCSSNBARK_INT, wdog_bark_handler,
- "apps_wdog_bark", percpu_pdata);
- if (ret) {
- free_percpu(percpu_pdata);
- return ret;
- }
+ *__this_cpu_ptr(percpu_pdata) = pdata;
+ /* Must request irq before sending scm command */
+ ret = request_percpu_irq(WDT0_ACCSCSSNBARK_INT,
+ wdog_bark_handler, "apps_wdog_bark", percpu_pdata);
+ if (ret) {
+ free_percpu(percpu_pdata);
+ return ret;
+ }
- enable_percpu_irq(WDT0_ACCSCSSNBARK_INT, IRQ_TYPE_EDGE_RISING);
+ enable_percpu_irq(WDT0_ACCSCSSNBARK_INT, IRQ_TYPE_EDGE_RISING);
+ }
/*
* This is only temporary till SBLs turn on the XPUs