diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/include/mach/legacy_irq.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/irq.c | 66 | ||||
-rw-r--r-- | arch/arm/mach-tegra/legacy_irq.c | 77 |
3 files changed, 0 insertions, 146 deletions
diff --git a/arch/arm/mach-tegra/include/mach/legacy_irq.h b/arch/arm/mach-tegra/include/mach/legacy_irq.h index d898c0e3d905..4c1f53543744 100644 --- a/arch/arm/mach-tegra/include/mach/legacy_irq.h +++ b/arch/arm/mach-tegra/include/mach/legacy_irq.h | |||
@@ -27,9 +27,6 @@ int tegra_legacy_force_irq_status(unsigned int irq); | |||
27 | void tegra_legacy_select_fiq(unsigned int irq, bool fiq); | 27 | void tegra_legacy_select_fiq(unsigned int irq, bool fiq); |
28 | unsigned long tegra_legacy_vfiq(int nr); | 28 | unsigned long tegra_legacy_vfiq(int nr); |
29 | unsigned long tegra_legacy_class(int nr); | 29 | unsigned long tegra_legacy_class(int nr); |
30 | int tegra_legacy_irq_set_wake(int irq, int enable); | ||
31 | void tegra_legacy_irq_set_lp1_wake_mask(void); | ||
32 | void tegra_legacy_irq_restore_mask(void); | ||
33 | void tegra_init_legacy_irq(void); | 30 | void tegra_init_legacy_irq(void); |
34 | 31 | ||
35 | #endif | 32 | #endif |
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index 567b75c4c67b..4fa7a37ea5e4 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c | |||
@@ -28,75 +28,9 @@ | |||
28 | 28 | ||
29 | #include <mach/iomap.h> | 29 | #include <mach/iomap.h> |
30 | #include <mach/legacy_irq.h> | 30 | #include <mach/legacy_irq.h> |
31 | #include <mach/suspend.h> | ||
32 | 31 | ||
33 | #include "board.h" | 32 | #include "board.h" |
34 | 33 | ||
35 | #define PMC_CTRL 0x0 | ||
36 | #define PMC_CTRL_LATCH_WAKEUPS (1 << 5) | ||
37 | #define PMC_WAKE_MASK 0xc | ||
38 | #define PMC_WAKE_LEVEL 0x10 | ||
39 | #define PMC_WAKE_STATUS 0x14 | ||
40 | #define PMC_SW_WAKE_STATUS 0x18 | ||
41 | #define PMC_DPD_SAMPLE 0x20 | ||
42 | |||
43 | static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); | ||
44 | |||
45 | static u32 tegra_lp0_wake_enb; | ||
46 | static u32 tegra_lp0_wake_level; | ||
47 | static u32 tegra_lp0_wake_level_any; | ||
48 | |||
49 | /* ensures that sufficient time is passed for a register write to | ||
50 | * serialize into the 32KHz domain */ | ||
51 | static void pmc_32kwritel(u32 val, unsigned long offs) | ||
52 | { | ||
53 | writel(val, pmc + offs); | ||
54 | udelay(130); | ||
55 | } | ||
56 | |||
57 | int tegra_set_lp1_wake(int irq, int enable) | ||
58 | { | ||
59 | return tegra_legacy_irq_set_wake(irq, enable); | ||
60 | } | ||
61 | |||
62 | void tegra_set_lp0_wake_pads(u32 wake_enb, u32 wake_level, u32 wake_any) | ||
63 | { | ||
64 | u32 temp; | ||
65 | u32 status; | ||
66 | u32 lvl; | ||
67 | |||
68 | wake_level &= wake_enb; | ||
69 | wake_any &= wake_enb; | ||
70 | |||
71 | wake_level |= (tegra_lp0_wake_level & tegra_lp0_wake_enb); | ||
72 | wake_any |= (tegra_lp0_wake_level_any & tegra_lp0_wake_enb); | ||
73 | |||
74 | wake_enb |= tegra_lp0_wake_enb; | ||
75 | |||
76 | pmc_32kwritel(0, PMC_SW_WAKE_STATUS); | ||
77 | temp = readl(pmc + PMC_CTRL); | ||
78 | temp |= PMC_CTRL_LATCH_WAKEUPS; | ||
79 | pmc_32kwritel(temp, PMC_CTRL); | ||
80 | temp &= ~PMC_CTRL_LATCH_WAKEUPS; | ||
81 | pmc_32kwritel(temp, PMC_CTRL); | ||
82 | status = readl(pmc + PMC_SW_WAKE_STATUS); | ||
83 | lvl = readl(pmc + PMC_WAKE_LEVEL); | ||
84 | |||
85 | /* flip the wakeup trigger for any-edge triggered pads | ||
86 | * which are currently asserting as wakeups */ | ||
87 | lvl ^= status; | ||
88 | lvl &= wake_any; | ||
89 | |||
90 | wake_level |= lvl; | ||
91 | |||
92 | writel(wake_level, pmc + PMC_WAKE_LEVEL); | ||
93 | /* Enable DPD sample to trigger sampling pads data and direction | ||
94 | * in which pad will be driven during lp0 mode*/ | ||
95 | writel(0x1, pmc + PMC_DPD_SAMPLE); | ||
96 | |||
97 | writel(wake_enb, pmc + PMC_WAKE_MASK); | ||
98 | } | ||
99 | |||
100 | static void tegra_mask(struct irq_data *d) | 34 | static void tegra_mask(struct irq_data *d) |
101 | { | 35 | { |
102 | if (d->irq >= 32) | 36 | if (d->irq >= 32) |
diff --git a/arch/arm/mach-tegra/legacy_irq.c b/arch/arm/mach-tegra/legacy_irq.c index 38eb719a4f53..cb316699ffad 100644 --- a/arch/arm/mach-tegra/legacy_irq.c +++ b/arch/arm/mach-tegra/legacy_irq.c | |||
@@ -49,9 +49,6 @@ static void __iomem *ictlr_reg_base[] = { | |||
49 | IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), | 49 | IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static u32 tegra_legacy_wake_mask[4]; | ||
53 | static u32 tegra_legacy_saved_mask[4]; | ||
54 | |||
55 | /* When going into deep sleep, the CPU is powered down, taking the GIC with it | 52 | /* When going into deep sleep, the CPU is powered down, taking the GIC with it |
56 | In order to wake, the wake interrupts need to be enabled in the legacy | 53 | In order to wake, the wake interrupts need to be enabled in the legacy |
57 | interrupt controller. */ | 54 | interrupt controller. */ |
@@ -129,40 +126,6 @@ unsigned long tegra_legacy_class(int nr) | |||
129 | return readl(base + ICTLR_CPU_IEP_CLASS); | 126 | return readl(base + ICTLR_CPU_IEP_CLASS); |
130 | } | 127 | } |
131 | 128 | ||
132 | int tegra_legacy_irq_set_wake(int irq, int enable) | ||
133 | { | ||
134 | irq -= 32; | ||
135 | if (enable) | ||
136 | tegra_legacy_wake_mask[irq >> 5] |= 1 << (irq & 31); | ||
137 | else | ||
138 | tegra_legacy_wake_mask[irq >> 5] &= ~(1 << (irq & 31)); | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | void tegra_legacy_irq_set_lp1_wake_mask(void) | ||
144 | { | ||
145 | void __iomem *base; | ||
146 | int i; | ||
147 | |||
148 | for (i = 0; i < NUM_ICTLRS; i++) { | ||
149 | base = ictlr_reg_base[i]; | ||
150 | tegra_legacy_saved_mask[i] = readl(base + ICTLR_CPU_IER); | ||
151 | writel(tegra_legacy_wake_mask[i], base + ICTLR_CPU_IER); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | void tegra_legacy_irq_restore_mask(void) | ||
156 | { | ||
157 | void __iomem *base; | ||
158 | int i; | ||
159 | |||
160 | for (i = 0; i < NUM_ICTLRS; i++) { | ||
161 | base = ictlr_reg_base[i]; | ||
162 | writel(tegra_legacy_saved_mask[i], base + ICTLR_CPU_IER); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | void tegra_init_legacy_irq(void) | 129 | void tegra_init_legacy_irq(void) |
167 | { | 130 | { |
168 | int i; | 131 | int i; |
@@ -173,43 +136,3 @@ void tegra_init_legacy_irq(void) | |||
173 | writel(0, ictlr + ICTLR_CPU_IEP_CLASS); | 136 | writel(0, ictlr + ICTLR_CPU_IEP_CLASS); |
174 | } | 137 | } |
175 | } | 138 | } |
176 | |||
177 | #ifdef CONFIG_PM | ||
178 | static u32 cop_ier[NUM_ICTLRS]; | ||
179 | static u32 cpu_ier[NUM_ICTLRS]; | ||
180 | static u32 cpu_iep[NUM_ICTLRS]; | ||
181 | |||
182 | void tegra_irq_suspend(void) | ||
183 | { | ||
184 | unsigned long flags; | ||
185 | int i; | ||
186 | |||
187 | local_irq_save(flags); | ||
188 | for (i = 0; i < NUM_ICTLRS; i++) { | ||
189 | void __iomem *ictlr = ictlr_reg_base[i]; | ||
190 | cpu_ier[i] = readl(ictlr + ICTLR_CPU_IER); | ||
191 | cpu_iep[i] = readl(ictlr + ICTLR_CPU_IEP_CLASS); | ||
192 | cop_ier[i] = readl(ictlr + ICTLR_COP_IER); | ||
193 | writel(~0, ictlr + ICTLR_COP_IER_CLR); | ||
194 | } | ||
195 | local_irq_restore(flags); | ||
196 | } | ||
197 | |||
198 | void tegra_irq_resume(void) | ||
199 | { | ||
200 | unsigned long flags; | ||
201 | int i; | ||
202 | |||
203 | local_irq_save(flags); | ||
204 | for (i = 0; i < NUM_ICTLRS; i++) { | ||
205 | void __iomem *ictlr = ictlr_reg_base[i]; | ||
206 | writel(cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS); | ||
207 | writel(~0ul, ictlr + ICTLR_CPU_IER_CLR); | ||
208 | writel(cpu_ier[i], ictlr + ICTLR_CPU_IER_SET); | ||
209 | writel(0, ictlr + ICTLR_COP_IEP_CLASS); | ||
210 | writel(~0ul, ictlr + ICTLR_COP_IER_CLR); | ||
211 | writel(cop_ier[i], ictlr + ICTLR_COP_IER_SET); | ||
212 | } | ||
213 | local_irq_restore(flags); | ||
214 | } | ||
215 | #endif | ||