blob: f961c46453b97c3ba7aa636af837e4cc66801260 [file] [log] [blame]
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +05301/*
2 * OMAP WakeupGen Source file
3 *
4 * OMAP WakeupGen is the interrupt controller extension used along
5 * with ARM GIC to wake the CPU out from low power states on
6 * external interrupts. It is responsible for generating wakeup
7 * event from the incoming interrupts and enable bits. It is
8 * implemented in MPU always ON power domain. During normal operation,
9 * WakeupGen delivers external interrupts directly to the GIC.
10 *
11 * Copyright (C) 2011 Texas Instruments, Inc.
12 * Santosh Shilimkar <santosh.shilimkar@ti.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/io.h>
22#include <linux/irq.h>
23#include <linux/platform_device.h>
24#include <linux/cpu.h>
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +053025#include <linux/notifier.h>
26#include <linux/cpu_pm.h>
Rob Herring520f7bd2012-12-27 13:10:24 -060027#include <linux/irqchip/arm-gic.h>
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053028
Tony Lindgren732231a2012-09-20 11:41:16 -070029#include "omap-wakeupgen.h"
Tony Lindgrenc1db9d72012-09-20 11:41:14 -070030#include "omap-secure.h"
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +053031
Tony Lindgrendbc04162012-08-31 10:59:07 -070032#include "soc.h"
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +053033#include "omap4-sar-layout.h"
34#include "common.h"
Rajendra Nayak6099dd32013-05-27 15:46:44 +053035#include "pm.h"
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053036
Afzal Mohammed6246cd02013-10-09 12:42:33 +053037#define AM43XX_NR_REG_BANKS 7
38#define AM43XX_IRQS 224
39#define MAX_NR_REG_BANKS AM43XX_NR_REG_BANKS
40#define MAX_IRQS AM43XX_IRQS
41#define DEFAULT_NR_REG_BANKS 5
42#define DEFAULT_IRQS 160
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053043#define WKG_MASK_ALL 0x00000000
44#define WKG_UNMASK_ALL 0xffffffff
45#define CPU_ENA_OFFSET 0x400
46#define CPU0_ID 0x0
47#define CPU1_ID 0x1
Santosh Shilimkar247c4452012-05-09 20:38:35 +053048#define OMAP4_NR_BANKS 4
49#define OMAP4_NR_IRQS 128
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053050
51static void __iomem *wakeupgen_base;
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +053052static void __iomem *sar_base;
Thomas Gleixneraecb9e12012-12-07 16:49:47 +020053static DEFINE_RAW_SPINLOCK(wakeupgen_lock);
Tony Lindgrene534e872012-09-04 17:22:45 -070054static unsigned int irq_target_cpu[MAX_IRQS];
Afzal Mohammed6246cd02013-10-09 12:42:33 +053055static unsigned int irq_banks = DEFAULT_NR_REG_BANKS;
56static unsigned int max_irqs = DEFAULT_IRQS;
Santosh Shilimkar247c4452012-05-09 20:38:35 +053057static unsigned int omap_secure_apis;
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053058
59/*
60 * Static helper functions.
61 */
62static inline u32 wakeupgen_readl(u8 idx, u32 cpu)
63{
Victor Kamenskyedfaf052014-04-15 20:37:46 +030064 return readl_relaxed(wakeupgen_base + OMAP_WKG_ENB_A_0 +
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053065 (cpu * CPU_ENA_OFFSET) + (idx * 4));
66}
67
68static inline void wakeupgen_writel(u32 val, u8 idx, u32 cpu)
69{
Victor Kamenskyedfaf052014-04-15 20:37:46 +030070 writel_relaxed(val, wakeupgen_base + OMAP_WKG_ENB_A_0 +
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053071 (cpu * CPU_ENA_OFFSET) + (idx * 4));
72}
73
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +053074static inline void sar_writel(u32 val, u32 offset, u8 idx)
75{
Victor Kamenskyedfaf052014-04-15 20:37:46 +030076 writel_relaxed(val, sar_base + offset + (idx * 4));
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +053077}
78
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +053079static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index)
80{
81 unsigned int spi_irq;
82
83 /*
84 * PPIs and SGIs are not supported.
85 */
86 if (irq < OMAP44XX_IRQ_GIC_START)
87 return -EINVAL;
88
89 /*
90 * Subtract the GIC offset.
91 */
92 spi_irq = irq - OMAP44XX_IRQ_GIC_START;
93 if (spi_irq > MAX_IRQS) {
94 pr_err("omap wakeupGen: Invalid IRQ%d\n", irq);
95 return -EINVAL;
96 }
97
98 /*
99 * Each WakeupGen register controls 32 interrupt.
100 * i.e. 1 bit per SPI IRQ
101 */
102 *reg_index = spi_irq >> 5;
103 *bit_posn = spi_irq %= 32;
104
105 return 0;
106}
107
108static void _wakeupgen_clear(unsigned int irq, unsigned int cpu)
109{
110 u32 val, bit_number;
111 u8 i;
112
113 if (_wakeupgen_get_irq_info(irq, &bit_number, &i))
114 return;
115
116 val = wakeupgen_readl(i, cpu);
117 val &= ~BIT(bit_number);
118 wakeupgen_writel(val, i, cpu);
119}
120
121static void _wakeupgen_set(unsigned int irq, unsigned int cpu)
122{
123 u32 val, bit_number;
124 u8 i;
125
126 if (_wakeupgen_get_irq_info(irq, &bit_number, &i))
127 return;
128
129 val = wakeupgen_readl(i, cpu);
130 val |= BIT(bit_number);
131 wakeupgen_writel(val, i, cpu);
132}
133
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530134/*
135 * Architecture specific Mask extension
136 */
137static void wakeupgen_mask(struct irq_data *d)
138{
139 unsigned long flags;
140
Thomas Gleixneraecb9e12012-12-07 16:49:47 +0200141 raw_spin_lock_irqsave(&wakeupgen_lock, flags);
Sricharan R1cc4b1a92013-12-03 15:57:24 +0530142 _wakeupgen_clear(d->hwirq, irq_target_cpu[d->hwirq]);
Thomas Gleixneraecb9e12012-12-07 16:49:47 +0200143 raw_spin_unlock_irqrestore(&wakeupgen_lock, flags);
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530144}
145
146/*
147 * Architecture specific Unmask extension
148 */
149static void wakeupgen_unmask(struct irq_data *d)
150{
151 unsigned long flags;
152
Thomas Gleixneraecb9e12012-12-07 16:49:47 +0200153 raw_spin_lock_irqsave(&wakeupgen_lock, flags);
Sricharan R1cc4b1a92013-12-03 15:57:24 +0530154 _wakeupgen_set(d->hwirq, irq_target_cpu[d->hwirq]);
Thomas Gleixneraecb9e12012-12-07 16:49:47 +0200155 raw_spin_unlock_irqrestore(&wakeupgen_lock, flags);
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530156}
157
Kevin Hilmanbb1dbe72012-03-06 12:00:25 -0800158#ifdef CONFIG_HOTPLUG_CPU
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530159static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks);
Kevin Hilmanbb1dbe72012-03-06 12:00:25 -0800160
161static void _wakeupgen_save_masks(unsigned int cpu)
162{
163 u8 i;
164
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530165 for (i = 0; i < irq_banks; i++)
Kevin Hilmanbb1dbe72012-03-06 12:00:25 -0800166 per_cpu(irqmasks, cpu)[i] = wakeupgen_readl(i, cpu);
167}
168
169static void _wakeupgen_restore_masks(unsigned int cpu)
170{
171 u8 i;
172
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530173 for (i = 0; i < irq_banks; i++)
Kevin Hilmanbb1dbe72012-03-06 12:00:25 -0800174 wakeupgen_writel(per_cpu(irqmasks, cpu)[i], i, cpu);
175}
176
177static void _wakeupgen_set_all(unsigned int cpu, unsigned int reg)
178{
179 u8 i;
180
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530181 for (i = 0; i < irq_banks; i++)
Kevin Hilmanbb1dbe72012-03-06 12:00:25 -0800182 wakeupgen_writel(reg, i, cpu);
183}
184
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530185/*
186 * Mask or unmask all interrupts on given CPU.
187 * 0 = Mask all interrupts on the 'cpu'
188 * 1 = Unmask all interrupts on the 'cpu'
189 * Ensure that the initial mask is maintained. This is faster than
190 * iterating through GIC registers to arrive at the correct masks.
191 */
192static void wakeupgen_irqmask_all(unsigned int cpu, unsigned int set)
193{
194 unsigned long flags;
195
Thomas Gleixneraecb9e12012-12-07 16:49:47 +0200196 raw_spin_lock_irqsave(&wakeupgen_lock, flags);
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530197 if (set) {
198 _wakeupgen_save_masks(cpu);
199 _wakeupgen_set_all(cpu, WKG_MASK_ALL);
200 } else {
201 _wakeupgen_set_all(cpu, WKG_UNMASK_ALL);
202 _wakeupgen_restore_masks(cpu);
203 }
Thomas Gleixneraecb9e12012-12-07 16:49:47 +0200204 raw_spin_unlock_irqrestore(&wakeupgen_lock, flags);
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530205}
Kevin Hilmanbb1dbe72012-03-06 12:00:25 -0800206#endif
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530207
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530208#ifdef CONFIG_CPU_PM
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530209static inline void omap4_irq_save_context(void)
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530210{
211 u32 i, val;
212
213 if (omap_rev() == OMAP4430_REV_ES1_0)
214 return;
215
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530216 for (i = 0; i < irq_banks; i++) {
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530217 /* Save the CPUx interrupt mask for IRQ 0 to 127 */
218 val = wakeupgen_readl(i, 0);
219 sar_writel(val, WAKEUPGENENB_OFFSET_CPU0, i);
220 val = wakeupgen_readl(i, 1);
221 sar_writel(val, WAKEUPGENENB_OFFSET_CPU1, i);
222
223 /*
224 * Disable the secure interrupts for CPUx. The restore
225 * code blindly restores secure and non-secure interrupt
226 * masks from SAR RAM. Secure interrupts are not suppose
227 * to be enabled from HLOS. So overwrite the SAR location
228 * so that the secure interrupt remains disabled.
229 */
230 sar_writel(0x0, WAKEUPGENENB_SECURE_OFFSET_CPU0, i);
231 sar_writel(0x0, WAKEUPGENENB_SECURE_OFFSET_CPU1, i);
232 }
233
234 /* Save AuxBoot* registers */
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300235 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
236 writel_relaxed(val, sar_base + AUXCOREBOOT0_OFFSET);
237 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_1);
238 writel_relaxed(val, sar_base + AUXCOREBOOT1_OFFSET);
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530239
240 /* Save SyncReq generation logic */
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300241 val = readl_relaxed(wakeupgen_base + OMAP_PTMSYNCREQ_MASK);
242 writel_relaxed(val, sar_base + PTMSYNCREQ_MASK_OFFSET);
243 val = readl_relaxed(wakeupgen_base + OMAP_PTMSYNCREQ_EN);
244 writel_relaxed(val, sar_base + PTMSYNCREQ_EN_OFFSET);
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530245
246 /* Set the Backup Bit Mask status */
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300247 val = readl_relaxed(sar_base + SAR_BACKUP_STATUS_OFFSET);
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530248 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300249 writel_relaxed(val, sar_base + SAR_BACKUP_STATUS_OFFSET);
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530250
251}
252
253static inline void omap5_irq_save_context(void)
254{
255 u32 i, val;
256
257 for (i = 0; i < irq_banks; i++) {
258 /* Save the CPUx interrupt mask for IRQ 0 to 159 */
259 val = wakeupgen_readl(i, 0);
260 sar_writel(val, OMAP5_WAKEUPGENENB_OFFSET_CPU0, i);
261 val = wakeupgen_readl(i, 1);
262 sar_writel(val, OMAP5_WAKEUPGENENB_OFFSET_CPU1, i);
263 sar_writel(0x0, OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU0, i);
264 sar_writel(0x0, OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU1, i);
265 }
266
267 /* Save AuxBoot* registers */
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300268 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
269 writel_relaxed(val, sar_base + OMAP5_AUXCOREBOOT0_OFFSET);
270 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
271 writel_relaxed(val, sar_base + OMAP5_AUXCOREBOOT1_OFFSET);
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530272
273 /* Set the Backup Bit Mask status */
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300274 val = readl_relaxed(sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530275 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300276 writel_relaxed(val, sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530277
278}
279
280/*
281 * Save WakeupGen interrupt context in SAR BANK3. Restore is done by
282 * ROM code. WakeupGen IP is integrated along with GIC to manage the
283 * interrupt wakeups from CPU low power states. It manages
284 * masking/unmasking of Shared peripheral interrupts(SPI). So the
285 * interrupt enable/disable control should be in sync and consistent
286 * at WakeupGen and GIC so that interrupts are not lost.
287 */
288static void irq_save_context(void)
289{
290 if (!sar_base)
291 sar_base = omap4_get_sar_ram_base();
292
293 if (soc_is_omap54xx())
294 omap5_irq_save_context();
295 else
296 omap4_irq_save_context();
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530297}
298
299/*
300 * Clear WakeupGen SAR backup status.
301 */
Paul Walmsley8c3d4532012-04-13 06:34:26 -0600302static void irq_sar_clear(void)
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530303{
304 u32 val;
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530305 u32 offset = SAR_BACKUP_STATUS_OFFSET;
306
307 if (soc_is_omap54xx())
308 offset = OMAP5_SAR_BACKUP_STATUS_OFFSET;
309
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300310 val = readl_relaxed(sar_base + offset);
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530311 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN;
Victor Kamenskyedfaf052014-04-15 20:37:46 +0300312 writel_relaxed(val, sar_base + offset);
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530313}
314
315/*
316 * Save GIC and Wakeupgen interrupt context using secure API
317 * for HS/EMU devices.
318 */
319static void irq_save_secure_context(void)
320{
321 u32 ret;
322 ret = omap_secure_dispatcher(OMAP4_HAL_SAVEGIC_INDEX,
323 FLAG_START_CRITICAL,
324 0, 0, 0, 0, 0);
325 if (ret != API_HAL_RET_VALUE_OK)
326 pr_err("GIC and Wakeupgen context save failed\n");
327}
328#endif
329
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +0530330#ifdef CONFIG_HOTPLUG_CPU
Paul Gortmaker8bd26e32013-06-17 15:43:14 -0400331static int irq_cpu_hotplug_notify(struct notifier_block *self,
332 unsigned long action, void *hcpu)
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +0530333{
334 unsigned int cpu = (unsigned int)hcpu;
335
336 switch (action) {
337 case CPU_ONLINE:
338 wakeupgen_irqmask_all(cpu, 0);
339 break;
340 case CPU_DEAD:
341 wakeupgen_irqmask_all(cpu, 1);
342 break;
343 }
344 return NOTIFY_OK;
345}
346
347static struct notifier_block __refdata irq_hotplug_notifier = {
348 .notifier_call = irq_cpu_hotplug_notify,
349};
350
351static void __init irq_hotplug_init(void)
352{
353 register_hotcpu_notifier(&irq_hotplug_notifier);
354}
355#else
356static void __init irq_hotplug_init(void)
357{}
358#endif
359
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530360#ifdef CONFIG_CPU_PM
361static int irq_notifier(struct notifier_block *self, unsigned long cmd, void *v)
362{
363 switch (cmd) {
364 case CPU_CLUSTER_PM_ENTER:
365 if (omap_type() == OMAP2_DEVICE_TYPE_GP)
366 irq_save_context();
367 else
368 irq_save_secure_context();
369 break;
370 case CPU_CLUSTER_PM_EXIT:
371 if (omap_type() == OMAP2_DEVICE_TYPE_GP)
372 irq_sar_clear();
373 break;
374 }
375 return NOTIFY_OK;
376}
377
378static struct notifier_block irq_notifier_block = {
379 .notifier_call = irq_notifier,
380};
381
382static void __init irq_pm_init(void)
383{
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530384 /* FIXME: Remove this when MPU OSWR support is added */
Rajendra Nayak6099dd32013-05-27 15:46:44 +0530385 if (!IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE))
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530386 cpu_pm_register_notifier(&irq_notifier_block);
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530387}
388#else
389static void __init irq_pm_init(void)
390{}
391#endif
392
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530393void __iomem *omap_get_wakeupgen_base(void)
394{
395 return wakeupgen_base;
396}
397
398int omap_secure_apis_support(void)
399{
400 return omap_secure_apis;
401}
402
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530403/*
404 * Initialise the wakeupgen module.
405 */
406int __init omap_wakeupgen_init(void)
407{
408 int i;
409 unsigned int boot_cpu = smp_processor_id();
Santosh Shilimkar4664d4d2013-02-08 17:07:31 +0530410 u32 val;
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530411
412 /* Not supported on OMAP4 ES1.0 silicon */
413 if (omap_rev() == OMAP4430_REV_ES1_0) {
414 WARN(1, "WakeupGen: Not supported on OMAP4430 ES1.0\n");
415 return -EPERM;
416 }
417
418 /* Static mapping, never released */
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530419 wakeupgen_base = ioremap(OMAP_WKUPGEN_BASE, SZ_4K);
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530420 if (WARN_ON(!wakeupgen_base))
421 return -ENOMEM;
422
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530423 if (cpu_is_omap44xx()) {
424 irq_banks = OMAP4_NR_BANKS;
425 max_irqs = OMAP4_NR_IRQS;
426 omap_secure_apis = 1;
Afzal Mohammed6246cd02013-10-09 12:42:33 +0530427 } else if (soc_is_am43xx()) {
428 irq_banks = AM43XX_NR_REG_BANKS;
429 max_irqs = AM43XX_IRQS;
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530430 }
431
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530432 /* Clear all IRQ bitmasks at wakeupGen level */
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530433 for (i = 0; i < irq_banks; i++) {
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530434 wakeupgen_writel(0, i, CPU0_ID);
Afzal Mohammed6246cd02013-10-09 12:42:33 +0530435 if (!soc_is_am43xx())
436 wakeupgen_writel(0, i, CPU1_ID);
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530437 }
438
439 /*
440 * Override GIC architecture specific functions to add
441 * OMAP WakeupGen interrupt controller along with GIC
442 */
443 gic_arch_extn.irq_mask = wakeupgen_mask;
444 gic_arch_extn.irq_unmask = wakeupgen_unmask;
445 gic_arch_extn.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE;
446
447 /*
448 * FIXME: Add support to set_smp_affinity() once the core
449 * GIC code has necessary hooks in place.
450 */
451
452 /* Associate all the IRQs to boot CPU like GIC init does. */
Santosh Shilimkar247c4452012-05-09 20:38:35 +0530453 for (i = 0; i < max_irqs; i++)
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530454 irq_target_cpu[i] = boot_cpu;
455
Santosh Shilimkar4664d4d2013-02-08 17:07:31 +0530456 /*
457 * Enables OMAP5 ES2 PM Mode using ES2_PM_MODE in AMBA_IF_MODE
458 * 0x0: ES1 behavior, CPU cores would enter and exit OFF mode together.
459 * 0x1: ES2 behavior, CPU cores are allowed to enter/exit OFF mode
460 * independently.
461 * This needs to be set one time thanks to always ON domain.
462 *
463 * We do not support ES1 behavior anymore. OMAP5 is assumed to be
464 * ES2.0, and the same is applicable for DRA7.
465 */
466 if (soc_is_omap54xx() || soc_is_dra7xx()) {
467 val = __raw_readl(wakeupgen_base + OMAP_AMBA_IF_MODE);
468 val |= BIT(5);
469 omap_smc1(OMAP5_MON_AMBA_IF_INDEX, val);
470 }
471
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +0530472 irq_hotplug_init();
Santosh Shilimkar0f3cf2e2010-06-16 23:29:31 +0530473 irq_pm_init();
Santosh Shilimkarb5b4f282010-06-16 22:19:48 +0530474
Santosh Shilimkarfcf6efa2010-06-16 22:19:47 +0530475 return 0;
476}