blob: 7bd39c0032bdc9183a87d574f6a0d9033b7ab5f1 [file] [log] [blame]
viresh kumarbc4e8142010-04-01 12:30:58 +01001/*
2 * arch/arm/mach-spear3xx/spear320.c
3 *
4 * SPEAr320 machine source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
Viresh Kumar5fb00f92012-03-26 10:39:43 +053014#define pr_fmt(fmt) "SPEAr320: " fmt
15
viresh kumarbc4e8142010-04-01 12:30:58 +010016#include <linux/ptrace.h>
17#include <asm/irq.h>
viresh kumar410782b2011-03-07 05:57:01 +010018#include <plat/shirq.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010019#include <mach/generic.h>
viresh kumar02aa06b2011-03-07 05:57:02 +010020#include <mach/hardware.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010021
viresh kumar70f4c0b2010-04-01 12:31:29 +010022/* pad multiplexing support */
23/* muxing registers */
24#define PAD_MUX_CONFIG_REG 0x0C
25#define MODE_CONFIG_REG 0x10
26
27/* modes */
28#define AUTO_NET_SMII_MODE (1 << 0)
29#define AUTO_NET_MII_MODE (1 << 1)
30#define AUTO_EXP_MODE (1 << 2)
31#define SMALL_PRINTERS_MODE (1 << 3)
32#define ALL_MODES 0xF
33
Ryan Mallon6618c3a2011-05-20 08:34:22 +010034struct pmx_mode spear320_auto_net_smii_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010035 .id = AUTO_NET_SMII_MODE,
36 .name = "Automation Networking SMII Mode",
37 .mask = 0x00,
38};
39
Ryan Mallon6618c3a2011-05-20 08:34:22 +010040struct pmx_mode spear320_auto_net_mii_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010041 .id = AUTO_NET_MII_MODE,
42 .name = "Automation Networking MII Mode",
43 .mask = 0x01,
44};
45
Ryan Mallon6618c3a2011-05-20 08:34:22 +010046struct pmx_mode spear320_auto_exp_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010047 .id = AUTO_EXP_MODE,
48 .name = "Automation Expanded Mode",
49 .mask = 0x02,
50};
51
Ryan Mallon6618c3a2011-05-20 08:34:22 +010052struct pmx_mode spear320_small_printers_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010053 .id = SMALL_PRINTERS_MODE,
54 .name = "Small Printers Mode",
55 .mask = 0x03,
56};
57
58/* devices */
Ryan Mallon6618c3a2011-05-20 08:34:22 +010059static struct pmx_dev_mode pmx_clcd_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010060 {
61 .ids = AUTO_NET_SMII_MODE,
62 .mask = 0x0,
63 },
64};
65
Ryan Mallon6618c3a2011-05-20 08:34:22 +010066struct pmx_dev spear320_pmx_clcd = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010067 .name = "clcd",
68 .modes = pmx_clcd_modes,
69 .mode_count = ARRAY_SIZE(pmx_clcd_modes),
70 .enb_on_reset = 1,
71};
72
Ryan Mallon6618c3a2011-05-20 08:34:22 +010073static struct pmx_dev_mode pmx_emi_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010074 {
75 .ids = AUTO_EXP_MODE,
76 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
77 },
78};
79
Ryan Mallon6618c3a2011-05-20 08:34:22 +010080struct pmx_dev spear320_pmx_emi = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010081 .name = "emi",
82 .modes = pmx_emi_modes,
83 .mode_count = ARRAY_SIZE(pmx_emi_modes),
84 .enb_on_reset = 1,
85};
86
Ryan Mallon6618c3a2011-05-20 08:34:22 +010087static struct pmx_dev_mode pmx_fsmc_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010088 {
89 .ids = ALL_MODES,
90 .mask = 0x0,
91 },
92};
93
Ryan Mallon6618c3a2011-05-20 08:34:22 +010094struct pmx_dev spear320_pmx_fsmc = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010095 .name = "fsmc",
96 .modes = pmx_fsmc_modes,
97 .mode_count = ARRAY_SIZE(pmx_fsmc_modes),
98 .enb_on_reset = 1,
99};
100
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100101static struct pmx_dev_mode pmx_spp_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100102 {
103 .ids = SMALL_PRINTERS_MODE,
104 .mask = 0x0,
105 },
106};
107
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100108struct pmx_dev spear320_pmx_spp = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100109 .name = "spp",
110 .modes = pmx_spp_modes,
111 .mode_count = ARRAY_SIZE(pmx_spp_modes),
112 .enb_on_reset = 1,
113};
114
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100115static struct pmx_dev_mode pmx_sdhci_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100116 {
117 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE |
118 SMALL_PRINTERS_MODE,
119 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
120 },
121};
122
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100123struct pmx_dev spear320_pmx_sdhci = {
viresh kumar069580b2011-03-07 05:57:03 +0100124 .name = "sdhci",
125 .modes = pmx_sdhci_modes,
126 .mode_count = ARRAY_SIZE(pmx_sdhci_modes),
viresh kumar70f4c0b2010-04-01 12:31:29 +0100127 .enb_on_reset = 1,
128};
129
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100130static struct pmx_dev_mode pmx_i2s_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100131 {
132 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
133 .mask = PMX_UART0_MODEM_MASK,
134 },
135};
136
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100137struct pmx_dev spear320_pmx_i2s = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100138 .name = "i2s",
139 .modes = pmx_i2s_modes,
140 .mode_count = ARRAY_SIZE(pmx_i2s_modes),
141 .enb_on_reset = 1,
142};
143
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100144static struct pmx_dev_mode pmx_uart1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100145 {
146 .ids = ALL_MODES,
147 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK,
148 },
149};
150
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100151struct pmx_dev spear320_pmx_uart1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100152 .name = "uart1",
153 .modes = pmx_uart1_modes,
154 .mode_count = ARRAY_SIZE(pmx_uart1_modes),
155 .enb_on_reset = 1,
156};
157
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100158static struct pmx_dev_mode pmx_uart1_modem_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100159 {
160 .ids = AUTO_EXP_MODE,
161 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK |
162 PMX_SSP_CS_MASK,
163 }, {
164 .ids = SMALL_PRINTERS_MODE,
165 .mask = PMX_GPIO_PIN3_MASK | PMX_GPIO_PIN4_MASK |
166 PMX_GPIO_PIN5_MASK | PMX_SSP_CS_MASK,
167 },
168};
169
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100170struct pmx_dev spear320_pmx_uart1_modem = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100171 .name = "uart1_modem",
172 .modes = pmx_uart1_modem_modes,
173 .mode_count = ARRAY_SIZE(pmx_uart1_modem_modes),
174 .enb_on_reset = 1,
175};
176
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100177static struct pmx_dev_mode pmx_uart2_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100178 {
179 .ids = ALL_MODES,
180 .mask = PMX_FIRDA_MASK,
181 },
182};
183
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100184struct pmx_dev spear320_pmx_uart2 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100185 .name = "uart2",
186 .modes = pmx_uart2_modes,
187 .mode_count = ARRAY_SIZE(pmx_uart2_modes),
188 .enb_on_reset = 1,
189};
190
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100191static struct pmx_dev_mode pmx_touchscreen_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100192 {
193 .ids = AUTO_NET_SMII_MODE,
194 .mask = PMX_SSP_CS_MASK,
195 },
196};
197
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100198struct pmx_dev spear320_pmx_touchscreen = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100199 .name = "touchscreen",
200 .modes = pmx_touchscreen_modes,
201 .mode_count = ARRAY_SIZE(pmx_touchscreen_modes),
202 .enb_on_reset = 1,
203};
204
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100205static struct pmx_dev_mode pmx_can_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100206 {
207 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE,
208 .mask = PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
209 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK,
210 },
211};
212
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100213struct pmx_dev spear320_pmx_can = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100214 .name = "can",
215 .modes = pmx_can_modes,
216 .mode_count = ARRAY_SIZE(pmx_can_modes),
217 .enb_on_reset = 1,
218};
219
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100220static struct pmx_dev_mode pmx_sdhci_led_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100221 {
222 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
223 .mask = PMX_SSP_CS_MASK,
224 },
225};
226
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100227struct pmx_dev spear320_pmx_sdhci_led = {
viresh kumar069580b2011-03-07 05:57:03 +0100228 .name = "sdhci_led",
229 .modes = pmx_sdhci_led_modes,
230 .mode_count = ARRAY_SIZE(pmx_sdhci_led_modes),
viresh kumar70f4c0b2010-04-01 12:31:29 +0100231 .enb_on_reset = 1,
232};
233
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100234static struct pmx_dev_mode pmx_pwm0_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100235 {
236 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
237 .mask = PMX_UART0_MODEM_MASK,
238 }, {
239 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
240 .mask = PMX_MII_MASK,
241 },
242};
243
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100244struct pmx_dev spear320_pmx_pwm0 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100245 .name = "pwm0",
246 .modes = pmx_pwm0_modes,
247 .mode_count = ARRAY_SIZE(pmx_pwm0_modes),
248 .enb_on_reset = 1,
249};
250
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100251static struct pmx_dev_mode pmx_pwm1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100252 {
253 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
254 .mask = PMX_UART0_MODEM_MASK,
255 }, {
256 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
257 .mask = PMX_MII_MASK,
258 },
259};
260
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100261struct pmx_dev spear320_pmx_pwm1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100262 .name = "pwm1",
263 .modes = pmx_pwm1_modes,
264 .mode_count = ARRAY_SIZE(pmx_pwm1_modes),
265 .enb_on_reset = 1,
266};
267
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100268static struct pmx_dev_mode pmx_pwm2_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100269 {
270 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
271 .mask = PMX_SSP_CS_MASK,
272 }, {
273 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
274 .mask = PMX_MII_MASK,
275 },
276};
277
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100278struct pmx_dev spear320_pmx_pwm2 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100279 .name = "pwm2",
280 .modes = pmx_pwm2_modes,
281 .mode_count = ARRAY_SIZE(pmx_pwm2_modes),
282 .enb_on_reset = 1,
283};
284
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100285static struct pmx_dev_mode pmx_pwm3_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100286 {
287 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE,
288 .mask = PMX_MII_MASK,
289 },
290};
291
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100292struct pmx_dev spear320_pmx_pwm3 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100293 .name = "pwm3",
294 .modes = pmx_pwm3_modes,
295 .mode_count = ARRAY_SIZE(pmx_pwm3_modes),
296 .enb_on_reset = 1,
297};
298
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100299static struct pmx_dev_mode pmx_ssp1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100300 {
301 .ids = SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE,
302 .mask = PMX_MII_MASK,
303 },
304};
305
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100306struct pmx_dev spear320_pmx_ssp1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100307 .name = "ssp1",
308 .modes = pmx_ssp1_modes,
309 .mode_count = ARRAY_SIZE(pmx_ssp1_modes),
310 .enb_on_reset = 1,
311};
312
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100313static struct pmx_dev_mode pmx_ssp2_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100314 {
315 .ids = AUTO_NET_SMII_MODE,
316 .mask = PMX_MII_MASK,
317 },
318};
319
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100320struct pmx_dev spear320_pmx_ssp2 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100321 .name = "ssp2",
322 .modes = pmx_ssp2_modes,
323 .mode_count = ARRAY_SIZE(pmx_ssp2_modes),
324 .enb_on_reset = 1,
325};
326
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100327static struct pmx_dev_mode pmx_mii1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100328 {
329 .ids = AUTO_NET_MII_MODE,
330 .mask = 0x0,
331 },
332};
333
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100334struct pmx_dev spear320_pmx_mii1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100335 .name = "mii1",
336 .modes = pmx_mii1_modes,
337 .mode_count = ARRAY_SIZE(pmx_mii1_modes),
338 .enb_on_reset = 1,
339};
340
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100341static struct pmx_dev_mode pmx_smii0_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100342 {
343 .ids = AUTO_NET_SMII_MODE | AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
344 .mask = PMX_MII_MASK,
345 },
346};
347
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100348struct pmx_dev spear320_pmx_smii0 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100349 .name = "smii0",
350 .modes = pmx_smii0_modes,
351 .mode_count = ARRAY_SIZE(pmx_smii0_modes),
352 .enb_on_reset = 1,
353};
354
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100355static struct pmx_dev_mode pmx_smii1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100356 {
357 .ids = AUTO_NET_SMII_MODE | SMALL_PRINTERS_MODE,
358 .mask = PMX_MII_MASK,
359 },
360};
361
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100362struct pmx_dev spear320_pmx_smii1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100363 .name = "smii1",
364 .modes = pmx_smii1_modes,
365 .mode_count = ARRAY_SIZE(pmx_smii1_modes),
366 .enb_on_reset = 1,
367};
368
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100369static struct pmx_dev_mode pmx_i2c1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100370 {
371 .ids = AUTO_EXP_MODE,
372 .mask = 0x0,
373 },
374};
375
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100376struct pmx_dev spear320_pmx_i2c1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100377 .name = "i2c1",
378 .modes = pmx_i2c1_modes,
379 .mode_count = ARRAY_SIZE(pmx_i2c1_modes),
380 .enb_on_reset = 1,
381};
382
383/* pmx driver structure */
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100384static struct pmx_driver pmx_driver = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100385 .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x00000007},
386 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
387};
388
viresh kumar4c18e772010-05-03 09:24:30 +0100389/* spear3xx shared irq */
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100390static struct shirq_dev_config shirq_ras1_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100391 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100392 .virq = SPEAR320_VIRQ_EMI,
393 .status_mask = SPEAR320_EMI_IRQ_MASK,
394 .clear_mask = SPEAR320_EMI_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100395 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100396 .virq = SPEAR320_VIRQ_CLCD,
397 .status_mask = SPEAR320_CLCD_IRQ_MASK,
398 .clear_mask = SPEAR320_CLCD_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100399 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100400 .virq = SPEAR320_VIRQ_SPP,
401 .status_mask = SPEAR320_SPP_IRQ_MASK,
402 .clear_mask = SPEAR320_SPP_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100403 },
404};
405
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100406static struct spear_shirq shirq_ras1 = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100407 .irq = SPEAR3XX_IRQ_GEN_RAS_1,
viresh kumar4c18e772010-05-03 09:24:30 +0100408 .dev_config = shirq_ras1_config,
409 .dev_count = ARRAY_SIZE(shirq_ras1_config),
410 .regs = {
411 .enb_reg = -1,
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100412 .status_reg = SPEAR320_INT_STS_MASK_REG,
413 .status_reg_mask = SPEAR320_SHIRQ_RAS1_MASK,
414 .clear_reg = SPEAR320_INT_CLR_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100415 .reset_to_clear = 1,
416 },
417};
418
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100419static struct shirq_dev_config shirq_ras3_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100420 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100421 .virq = SPEAR320_VIRQ_PLGPIO,
422 .enb_mask = SPEAR320_GPIO_IRQ_MASK,
423 .status_mask = SPEAR320_GPIO_IRQ_MASK,
424 .clear_mask = SPEAR320_GPIO_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100425 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100426 .virq = SPEAR320_VIRQ_I2S_PLAY,
427 .enb_mask = SPEAR320_I2S_PLAY_IRQ_MASK,
428 .status_mask = SPEAR320_I2S_PLAY_IRQ_MASK,
429 .clear_mask = SPEAR320_I2S_PLAY_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100430 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100431 .virq = SPEAR320_VIRQ_I2S_REC,
432 .enb_mask = SPEAR320_I2S_REC_IRQ_MASK,
433 .status_mask = SPEAR320_I2S_REC_IRQ_MASK,
434 .clear_mask = SPEAR320_I2S_REC_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100435 },
436};
437
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100438static struct spear_shirq shirq_ras3 = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100439 .irq = SPEAR3XX_IRQ_GEN_RAS_3,
viresh kumar4c18e772010-05-03 09:24:30 +0100440 .dev_config = shirq_ras3_config,
441 .dev_count = ARRAY_SIZE(shirq_ras3_config),
442 .regs = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100443 .enb_reg = SPEAR320_INT_ENB_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100444 .reset_to_enb = 1,
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100445 .status_reg = SPEAR320_INT_STS_MASK_REG,
446 .status_reg_mask = SPEAR320_SHIRQ_RAS3_MASK,
447 .clear_reg = SPEAR320_INT_CLR_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100448 .reset_to_clear = 1,
449 },
450};
451
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100452static struct shirq_dev_config shirq_intrcomm_ras_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100453 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100454 .virq = SPEAR320_VIRQ_CANU,
455 .status_mask = SPEAR320_CAN_U_IRQ_MASK,
456 .clear_mask = SPEAR320_CAN_U_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100457 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100458 .virq = SPEAR320_VIRQ_CANL,
459 .status_mask = SPEAR320_CAN_L_IRQ_MASK,
460 .clear_mask = SPEAR320_CAN_L_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100461 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100462 .virq = SPEAR320_VIRQ_UART1,
463 .status_mask = SPEAR320_UART1_IRQ_MASK,
464 .clear_mask = SPEAR320_UART1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100465 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100466 .virq = SPEAR320_VIRQ_UART2,
467 .status_mask = SPEAR320_UART2_IRQ_MASK,
468 .clear_mask = SPEAR320_UART2_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100469 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100470 .virq = SPEAR320_VIRQ_SSP1,
471 .status_mask = SPEAR320_SSP1_IRQ_MASK,
472 .clear_mask = SPEAR320_SSP1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100473 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100474 .virq = SPEAR320_VIRQ_SSP2,
475 .status_mask = SPEAR320_SSP2_IRQ_MASK,
476 .clear_mask = SPEAR320_SSP2_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100477 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100478 .virq = SPEAR320_VIRQ_SMII0,
479 .status_mask = SPEAR320_SMII0_IRQ_MASK,
480 .clear_mask = SPEAR320_SMII0_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100481 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100482 .virq = SPEAR320_VIRQ_MII1_SMII1,
483 .status_mask = SPEAR320_MII1_SMII1_IRQ_MASK,
484 .clear_mask = SPEAR320_MII1_SMII1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100485 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100486 .virq = SPEAR320_VIRQ_WAKEUP_SMII0,
487 .status_mask = SPEAR320_WAKEUP_SMII0_IRQ_MASK,
488 .clear_mask = SPEAR320_WAKEUP_SMII0_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100489 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100490 .virq = SPEAR320_VIRQ_WAKEUP_MII1_SMII1,
491 .status_mask = SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK,
492 .clear_mask = SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100493 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100494 .virq = SPEAR320_VIRQ_I2C1,
495 .status_mask = SPEAR320_I2C1_IRQ_MASK,
496 .clear_mask = SPEAR320_I2C1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100497 },
498};
499
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100500static struct spear_shirq shirq_intrcomm_ras = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100501 .irq = SPEAR3XX_IRQ_INTRCOMM_RAS_ARM,
viresh kumar4c18e772010-05-03 09:24:30 +0100502 .dev_config = shirq_intrcomm_ras_config,
503 .dev_count = ARRAY_SIZE(shirq_intrcomm_ras_config),
504 .regs = {
505 .enb_reg = -1,
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100506 .status_reg = SPEAR320_INT_STS_MASK_REG,
507 .status_reg_mask = SPEAR320_SHIRQ_INTRCOMM_RAS_MASK,
508 .clear_reg = SPEAR320_INT_CLR_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100509 .reset_to_clear = 1,
510 },
511};
512
viresh kumarc2c07832011-03-07 05:57:05 +0100513/* Add spear320 specific devices here */
514
viresh kumar70f4c0b2010-04-01 12:31:29 +0100515/* spear320 routines */
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100516void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
517 u8 pmx_dev_count)
viresh kumarbc4e8142010-04-01 12:30:58 +0100518{
viresh kumar4c18e772010-05-03 09:24:30 +0100519 void __iomem *base;
520 int ret = 0;
521
viresh kumarbc4e8142010-04-01 12:30:58 +0100522 /* call spear3xx family common init function */
523 spear3xx_init();
viresh kumar4c18e772010-05-03 09:24:30 +0100524
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400525 /* shared irq registration */
viresh kumar53821162011-03-07 05:57:06 +0100526 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K);
viresh kumar4c18e772010-05-03 09:24:30 +0100527 if (base) {
528 /* shirq 1 */
529 shirq_ras1.regs.base = base;
530 ret = spear_shirq_register(&shirq_ras1);
531 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530532 pr_err("Error registering Shared IRQ 1\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100533
534 /* shirq 3 */
535 shirq_ras3.regs.base = base;
536 ret = spear_shirq_register(&shirq_ras3);
537 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530538 pr_err("Error registering Shared IRQ 3\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100539
540 /* shirq 4 */
541 shirq_intrcomm_ras.regs.base = base;
542 ret = spear_shirq_register(&shirq_intrcomm_ras);
543 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530544 pr_err("Error registering Shared IRQ 4\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100545 }
viresh kumar70f4c0b2010-04-01 12:31:29 +0100546
viresh kumar53688c52011-02-16 07:40:30 +0100547 /* pmx initialization */
548 pmx_driver.base = base;
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100549 pmx_driver.mode = pmx_mode;
550 pmx_driver.devs = pmx_devs;
551 pmx_driver.devs_count = pmx_dev_count;
552
viresh kumar53688c52011-02-16 07:40:30 +0100553 ret = pmx_register(&pmx_driver);
554 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530555 pr_err("padmux: registration failed. err no: %d\n", ret);
viresh kumar70f4c0b2010-04-01 12:31:29 +0100556}