blob: 9c571d0f20c305891c6e603f802eb2470ef6555d [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 *
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +05306 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com>
viresh kumarbc4e8142010-04-01 12:30:58 +01008 *
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 Kumarc5fa4fd2012-03-23 00:17:43 +053016#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
18#include <linux/amba/serial.h>
19#include <linux/of_platform.h>
20#include <asm/hardware/vic.h>
21#include <asm/mach/arch.h>
viresh kumar410782b2011-03-07 05:57:01 +010022#include <plat/shirq.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010023#include <mach/generic.h>
viresh kumar02aa06b2011-03-07 05:57:02 +010024#include <mach/hardware.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010025
viresh kumar70f4c0b2010-04-01 12:31:29 +010026/* pad multiplexing support */
27/* muxing registers */
28#define PAD_MUX_CONFIG_REG 0x0C
29#define MODE_CONFIG_REG 0x10
30
31/* modes */
32#define AUTO_NET_SMII_MODE (1 << 0)
33#define AUTO_NET_MII_MODE (1 << 1)
34#define AUTO_EXP_MODE (1 << 2)
35#define SMALL_PRINTERS_MODE (1 << 3)
36#define ALL_MODES 0xF
37
Ryan Mallon6618c3a2011-05-20 08:34:22 +010038struct pmx_mode spear320_auto_net_smii_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010039 .id = AUTO_NET_SMII_MODE,
40 .name = "Automation Networking SMII Mode",
41 .mask = 0x00,
42};
43
Ryan Mallon6618c3a2011-05-20 08:34:22 +010044struct pmx_mode spear320_auto_net_mii_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010045 .id = AUTO_NET_MII_MODE,
46 .name = "Automation Networking MII Mode",
47 .mask = 0x01,
48};
49
Ryan Mallon6618c3a2011-05-20 08:34:22 +010050struct pmx_mode spear320_auto_exp_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010051 .id = AUTO_EXP_MODE,
52 .name = "Automation Expanded Mode",
53 .mask = 0x02,
54};
55
Ryan Mallon6618c3a2011-05-20 08:34:22 +010056struct pmx_mode spear320_small_printers_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010057 .id = SMALL_PRINTERS_MODE,
58 .name = "Small Printers Mode",
59 .mask = 0x03,
60};
61
62/* devices */
Ryan Mallon6618c3a2011-05-20 08:34:22 +010063static struct pmx_dev_mode pmx_clcd_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010064 {
65 .ids = AUTO_NET_SMII_MODE,
66 .mask = 0x0,
67 },
68};
69
Ryan Mallon6618c3a2011-05-20 08:34:22 +010070struct pmx_dev spear320_pmx_clcd = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010071 .name = "clcd",
72 .modes = pmx_clcd_modes,
73 .mode_count = ARRAY_SIZE(pmx_clcd_modes),
74 .enb_on_reset = 1,
75};
76
Ryan Mallon6618c3a2011-05-20 08:34:22 +010077static struct pmx_dev_mode pmx_emi_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010078 {
79 .ids = AUTO_EXP_MODE,
80 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
81 },
82};
83
Ryan Mallon6618c3a2011-05-20 08:34:22 +010084struct pmx_dev spear320_pmx_emi = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010085 .name = "emi",
86 .modes = pmx_emi_modes,
87 .mode_count = ARRAY_SIZE(pmx_emi_modes),
88 .enb_on_reset = 1,
89};
90
Ryan Mallon6618c3a2011-05-20 08:34:22 +010091static struct pmx_dev_mode pmx_fsmc_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010092 {
93 .ids = ALL_MODES,
94 .mask = 0x0,
95 },
96};
97
Ryan Mallon6618c3a2011-05-20 08:34:22 +010098struct pmx_dev spear320_pmx_fsmc = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010099 .name = "fsmc",
100 .modes = pmx_fsmc_modes,
101 .mode_count = ARRAY_SIZE(pmx_fsmc_modes),
102 .enb_on_reset = 1,
103};
104
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100105static struct pmx_dev_mode pmx_spp_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100106 {
107 .ids = SMALL_PRINTERS_MODE,
108 .mask = 0x0,
109 },
110};
111
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100112struct pmx_dev spear320_pmx_spp = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100113 .name = "spp",
114 .modes = pmx_spp_modes,
115 .mode_count = ARRAY_SIZE(pmx_spp_modes),
116 .enb_on_reset = 1,
117};
118
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100119static struct pmx_dev_mode pmx_sdhci_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100120 {
121 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE |
122 SMALL_PRINTERS_MODE,
123 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
124 },
125};
126
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100127struct pmx_dev spear320_pmx_sdhci = {
viresh kumar069580b2011-03-07 05:57:03 +0100128 .name = "sdhci",
129 .modes = pmx_sdhci_modes,
130 .mode_count = ARRAY_SIZE(pmx_sdhci_modes),
viresh kumar70f4c0b2010-04-01 12:31:29 +0100131 .enb_on_reset = 1,
132};
133
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100134static struct pmx_dev_mode pmx_i2s_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100135 {
136 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
137 .mask = PMX_UART0_MODEM_MASK,
138 },
139};
140
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100141struct pmx_dev spear320_pmx_i2s = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100142 .name = "i2s",
143 .modes = pmx_i2s_modes,
144 .mode_count = ARRAY_SIZE(pmx_i2s_modes),
145 .enb_on_reset = 1,
146};
147
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100148static struct pmx_dev_mode pmx_uart1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100149 {
150 .ids = ALL_MODES,
151 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK,
152 },
153};
154
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100155struct pmx_dev spear320_pmx_uart1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100156 .name = "uart1",
157 .modes = pmx_uart1_modes,
158 .mode_count = ARRAY_SIZE(pmx_uart1_modes),
159 .enb_on_reset = 1,
160};
161
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100162static struct pmx_dev_mode pmx_uart1_modem_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100163 {
164 .ids = AUTO_EXP_MODE,
165 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK |
166 PMX_SSP_CS_MASK,
167 }, {
168 .ids = SMALL_PRINTERS_MODE,
169 .mask = PMX_GPIO_PIN3_MASK | PMX_GPIO_PIN4_MASK |
170 PMX_GPIO_PIN5_MASK | PMX_SSP_CS_MASK,
171 },
172};
173
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100174struct pmx_dev spear320_pmx_uart1_modem = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100175 .name = "uart1_modem",
176 .modes = pmx_uart1_modem_modes,
177 .mode_count = ARRAY_SIZE(pmx_uart1_modem_modes),
178 .enb_on_reset = 1,
179};
180
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100181static struct pmx_dev_mode pmx_uart2_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100182 {
183 .ids = ALL_MODES,
184 .mask = PMX_FIRDA_MASK,
185 },
186};
187
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100188struct pmx_dev spear320_pmx_uart2 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100189 .name = "uart2",
190 .modes = pmx_uart2_modes,
191 .mode_count = ARRAY_SIZE(pmx_uart2_modes),
192 .enb_on_reset = 1,
193};
194
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100195static struct pmx_dev_mode pmx_touchscreen_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100196 {
197 .ids = AUTO_NET_SMII_MODE,
198 .mask = PMX_SSP_CS_MASK,
199 },
200};
201
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100202struct pmx_dev spear320_pmx_touchscreen = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100203 .name = "touchscreen",
204 .modes = pmx_touchscreen_modes,
205 .mode_count = ARRAY_SIZE(pmx_touchscreen_modes),
206 .enb_on_reset = 1,
207};
208
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100209static struct pmx_dev_mode pmx_can_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100210 {
211 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE,
212 .mask = PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
213 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK,
214 },
215};
216
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100217struct pmx_dev spear320_pmx_can = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100218 .name = "can",
219 .modes = pmx_can_modes,
220 .mode_count = ARRAY_SIZE(pmx_can_modes),
221 .enb_on_reset = 1,
222};
223
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100224static struct pmx_dev_mode pmx_sdhci_led_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100225 {
226 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
227 .mask = PMX_SSP_CS_MASK,
228 },
229};
230
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100231struct pmx_dev spear320_pmx_sdhci_led = {
viresh kumar069580b2011-03-07 05:57:03 +0100232 .name = "sdhci_led",
233 .modes = pmx_sdhci_led_modes,
234 .mode_count = ARRAY_SIZE(pmx_sdhci_led_modes),
viresh kumar70f4c0b2010-04-01 12:31:29 +0100235 .enb_on_reset = 1,
236};
237
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100238static struct pmx_dev_mode pmx_pwm0_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100239 {
240 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
241 .mask = PMX_UART0_MODEM_MASK,
242 }, {
243 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
244 .mask = PMX_MII_MASK,
245 },
246};
247
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100248struct pmx_dev spear320_pmx_pwm0 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100249 .name = "pwm0",
250 .modes = pmx_pwm0_modes,
251 .mode_count = ARRAY_SIZE(pmx_pwm0_modes),
252 .enb_on_reset = 1,
253};
254
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100255static struct pmx_dev_mode pmx_pwm1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100256 {
257 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
258 .mask = PMX_UART0_MODEM_MASK,
259 }, {
260 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
261 .mask = PMX_MII_MASK,
262 },
263};
264
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100265struct pmx_dev spear320_pmx_pwm1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100266 .name = "pwm1",
267 .modes = pmx_pwm1_modes,
268 .mode_count = ARRAY_SIZE(pmx_pwm1_modes),
269 .enb_on_reset = 1,
270};
271
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100272static struct pmx_dev_mode pmx_pwm2_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100273 {
274 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
275 .mask = PMX_SSP_CS_MASK,
276 }, {
277 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
278 .mask = PMX_MII_MASK,
279 },
280};
281
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100282struct pmx_dev spear320_pmx_pwm2 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100283 .name = "pwm2",
284 .modes = pmx_pwm2_modes,
285 .mode_count = ARRAY_SIZE(pmx_pwm2_modes),
286 .enb_on_reset = 1,
287};
288
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100289static struct pmx_dev_mode pmx_pwm3_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100290 {
291 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE,
292 .mask = PMX_MII_MASK,
293 },
294};
295
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100296struct pmx_dev spear320_pmx_pwm3 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100297 .name = "pwm3",
298 .modes = pmx_pwm3_modes,
299 .mode_count = ARRAY_SIZE(pmx_pwm3_modes),
300 .enb_on_reset = 1,
301};
302
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100303static struct pmx_dev_mode pmx_ssp1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100304 {
305 .ids = SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE,
306 .mask = PMX_MII_MASK,
307 },
308};
309
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100310struct pmx_dev spear320_pmx_ssp1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100311 .name = "ssp1",
312 .modes = pmx_ssp1_modes,
313 .mode_count = ARRAY_SIZE(pmx_ssp1_modes),
314 .enb_on_reset = 1,
315};
316
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100317static struct pmx_dev_mode pmx_ssp2_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100318 {
319 .ids = AUTO_NET_SMII_MODE,
320 .mask = PMX_MII_MASK,
321 },
322};
323
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100324struct pmx_dev spear320_pmx_ssp2 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100325 .name = "ssp2",
326 .modes = pmx_ssp2_modes,
327 .mode_count = ARRAY_SIZE(pmx_ssp2_modes),
328 .enb_on_reset = 1,
329};
330
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100331static struct pmx_dev_mode pmx_mii1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100332 {
333 .ids = AUTO_NET_MII_MODE,
334 .mask = 0x0,
335 },
336};
337
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100338struct pmx_dev spear320_pmx_mii1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100339 .name = "mii1",
340 .modes = pmx_mii1_modes,
341 .mode_count = ARRAY_SIZE(pmx_mii1_modes),
342 .enb_on_reset = 1,
343};
344
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100345static struct pmx_dev_mode pmx_smii0_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100346 {
347 .ids = AUTO_NET_SMII_MODE | AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
348 .mask = PMX_MII_MASK,
349 },
350};
351
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100352struct pmx_dev spear320_pmx_smii0 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100353 .name = "smii0",
354 .modes = pmx_smii0_modes,
355 .mode_count = ARRAY_SIZE(pmx_smii0_modes),
356 .enb_on_reset = 1,
357};
358
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100359static struct pmx_dev_mode pmx_smii1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100360 {
361 .ids = AUTO_NET_SMII_MODE | SMALL_PRINTERS_MODE,
362 .mask = PMX_MII_MASK,
363 },
364};
365
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100366struct pmx_dev spear320_pmx_smii1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100367 .name = "smii1",
368 .modes = pmx_smii1_modes,
369 .mode_count = ARRAY_SIZE(pmx_smii1_modes),
370 .enb_on_reset = 1,
371};
372
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100373static struct pmx_dev_mode pmx_i2c1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100374 {
375 .ids = AUTO_EXP_MODE,
376 .mask = 0x0,
377 },
378};
379
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100380struct pmx_dev spear320_pmx_i2c1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100381 .name = "i2c1",
382 .modes = pmx_i2c1_modes,
383 .mode_count = ARRAY_SIZE(pmx_i2c1_modes),
384 .enb_on_reset = 1,
385};
386
387/* pmx driver structure */
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100388static struct pmx_driver pmx_driver = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100389 .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x00000007},
390 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
391};
392
viresh kumar4c18e772010-05-03 09:24:30 +0100393/* spear3xx shared irq */
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100394static struct shirq_dev_config shirq_ras1_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100395 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100396 .virq = SPEAR320_VIRQ_EMI,
397 .status_mask = SPEAR320_EMI_IRQ_MASK,
398 .clear_mask = SPEAR320_EMI_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100399 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100400 .virq = SPEAR320_VIRQ_CLCD,
401 .status_mask = SPEAR320_CLCD_IRQ_MASK,
402 .clear_mask = SPEAR320_CLCD_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100403 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100404 .virq = SPEAR320_VIRQ_SPP,
405 .status_mask = SPEAR320_SPP_IRQ_MASK,
406 .clear_mask = SPEAR320_SPP_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100407 },
408};
409
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100410static struct spear_shirq shirq_ras1 = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100411 .irq = SPEAR3XX_IRQ_GEN_RAS_1,
viresh kumar4c18e772010-05-03 09:24:30 +0100412 .dev_config = shirq_ras1_config,
413 .dev_count = ARRAY_SIZE(shirq_ras1_config),
414 .regs = {
415 .enb_reg = -1,
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100416 .status_reg = SPEAR320_INT_STS_MASK_REG,
417 .status_reg_mask = SPEAR320_SHIRQ_RAS1_MASK,
418 .clear_reg = SPEAR320_INT_CLR_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100419 .reset_to_clear = 1,
420 },
421};
422
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100423static struct shirq_dev_config shirq_ras3_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100424 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100425 .virq = SPEAR320_VIRQ_PLGPIO,
426 .enb_mask = SPEAR320_GPIO_IRQ_MASK,
427 .status_mask = SPEAR320_GPIO_IRQ_MASK,
428 .clear_mask = SPEAR320_GPIO_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100429 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100430 .virq = SPEAR320_VIRQ_I2S_PLAY,
431 .enb_mask = SPEAR320_I2S_PLAY_IRQ_MASK,
432 .status_mask = SPEAR320_I2S_PLAY_IRQ_MASK,
433 .clear_mask = SPEAR320_I2S_PLAY_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100434 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100435 .virq = SPEAR320_VIRQ_I2S_REC,
436 .enb_mask = SPEAR320_I2S_REC_IRQ_MASK,
437 .status_mask = SPEAR320_I2S_REC_IRQ_MASK,
438 .clear_mask = SPEAR320_I2S_REC_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100439 },
440};
441
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100442static struct spear_shirq shirq_ras3 = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100443 .irq = SPEAR3XX_IRQ_GEN_RAS_3,
viresh kumar4c18e772010-05-03 09:24:30 +0100444 .dev_config = shirq_ras3_config,
445 .dev_count = ARRAY_SIZE(shirq_ras3_config),
446 .regs = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100447 .enb_reg = SPEAR320_INT_ENB_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100448 .reset_to_enb = 1,
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100449 .status_reg = SPEAR320_INT_STS_MASK_REG,
450 .status_reg_mask = SPEAR320_SHIRQ_RAS3_MASK,
451 .clear_reg = SPEAR320_INT_CLR_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100452 .reset_to_clear = 1,
453 },
454};
455
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100456static struct shirq_dev_config shirq_intrcomm_ras_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100457 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100458 .virq = SPEAR320_VIRQ_CANU,
459 .status_mask = SPEAR320_CAN_U_IRQ_MASK,
460 .clear_mask = SPEAR320_CAN_U_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100461 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100462 .virq = SPEAR320_VIRQ_CANL,
463 .status_mask = SPEAR320_CAN_L_IRQ_MASK,
464 .clear_mask = SPEAR320_CAN_L_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100465 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100466 .virq = SPEAR320_VIRQ_UART1,
467 .status_mask = SPEAR320_UART1_IRQ_MASK,
468 .clear_mask = SPEAR320_UART1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100469 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100470 .virq = SPEAR320_VIRQ_UART2,
471 .status_mask = SPEAR320_UART2_IRQ_MASK,
472 .clear_mask = SPEAR320_UART2_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100473 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100474 .virq = SPEAR320_VIRQ_SSP1,
475 .status_mask = SPEAR320_SSP1_IRQ_MASK,
476 .clear_mask = SPEAR320_SSP1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100477 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100478 .virq = SPEAR320_VIRQ_SSP2,
479 .status_mask = SPEAR320_SSP2_IRQ_MASK,
480 .clear_mask = SPEAR320_SSP2_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100481 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100482 .virq = SPEAR320_VIRQ_SMII0,
483 .status_mask = SPEAR320_SMII0_IRQ_MASK,
484 .clear_mask = SPEAR320_SMII0_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100485 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100486 .virq = SPEAR320_VIRQ_MII1_SMII1,
487 .status_mask = SPEAR320_MII1_SMII1_IRQ_MASK,
488 .clear_mask = SPEAR320_MII1_SMII1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100489 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100490 .virq = SPEAR320_VIRQ_WAKEUP_SMII0,
491 .status_mask = SPEAR320_WAKEUP_SMII0_IRQ_MASK,
492 .clear_mask = SPEAR320_WAKEUP_SMII0_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100493 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100494 .virq = SPEAR320_VIRQ_WAKEUP_MII1_SMII1,
495 .status_mask = SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK,
496 .clear_mask = SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100497 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100498 .virq = SPEAR320_VIRQ_I2C1,
499 .status_mask = SPEAR320_I2C1_IRQ_MASK,
500 .clear_mask = SPEAR320_I2C1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100501 },
502};
503
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100504static struct spear_shirq shirq_intrcomm_ras = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100505 .irq = SPEAR3XX_IRQ_INTRCOMM_RAS_ARM,
viresh kumar4c18e772010-05-03 09:24:30 +0100506 .dev_config = shirq_intrcomm_ras_config,
507 .dev_count = ARRAY_SIZE(shirq_intrcomm_ras_config),
508 .regs = {
509 .enb_reg = -1,
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100510 .status_reg = SPEAR320_INT_STS_MASK_REG,
511 .status_reg_mask = SPEAR320_SHIRQ_INTRCOMM_RAS_MASK,
512 .clear_reg = SPEAR320_INT_CLR_MASK_REG,
viresh kumar4c18e772010-05-03 09:24:30 +0100513 .reset_to_clear = 1,
514 },
515};
516
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530517/* padmux devices to enable */
518static struct pmx_dev *spear320_evb_pmx_devs[] = {
519 /* spear3xx specific devices */
520 &spear3xx_pmx_i2c,
521 &spear3xx_pmx_ssp,
522 &spear3xx_pmx_mii,
523 &spear3xx_pmx_uart0,
viresh kumarc2c07832011-03-07 05:57:05 +0100524
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530525 /* spear320 specific devices */
526 &spear320_pmx_fsmc,
527 &spear320_pmx_sdhci,
528 &spear320_pmx_i2s,
529 &spear320_pmx_uart1,
530 &spear320_pmx_uart2,
531 &spear320_pmx_can,
532 &spear320_pmx_pwm0,
533 &spear320_pmx_pwm1,
534 &spear320_pmx_pwm2,
535 &spear320_pmx_mii1,
536};
537
538static struct pl022_ssp_controller spear320_ssp_data[] = {
539 {
540 .bus_id = 1,
541 .enable_dma = 1,
542 .dma_filter = pl08x_filter_id,
543 .dma_tx_param = "ssp1_tx",
544 .dma_rx_param = "ssp1_rx",
545 .num_chipselect = 2,
546 }, {
547 .bus_id = 2,
548 .enable_dma = 1,
549 .dma_filter = pl08x_filter_id,
550 .dma_tx_param = "ssp2_tx",
551 .dma_rx_param = "ssp2_rx",
552 .num_chipselect = 2,
553 }
554};
555
556static struct amba_pl011_data spear320_uart_data[] = {
557 {
558 .dma_filter = pl08x_filter_id,
559 .dma_tx_param = "uart1_tx",
560 .dma_rx_param = "uart1_rx",
561 }, {
562 .dma_filter = pl08x_filter_id,
563 .dma_tx_param = "uart2_tx",
564 .dma_rx_param = "uart2_rx",
565 },
566};
567
568/* Add SPEAr310 auxdata to pass platform data */
569static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = {
570 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
571 &pl022_plat_data),
572 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL,
573 &spear320_ssp_data[0]),
574 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE, NULL,
575 &spear320_ssp_data[1]),
576 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE, NULL,
577 &spear320_uart_data[0]),
578 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE, NULL,
579 &spear320_uart_data[1]),
580 {}
581};
582
583static void __init spear320_dt_init(void)
viresh kumarbc4e8142010-04-01 12:30:58 +0100584{
viresh kumar4c18e772010-05-03 09:24:30 +0100585 void __iomem *base;
586 int ret = 0;
587
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530588 of_platform_populate(NULL, of_default_bus_match_table,
589 spear320_auxdata_lookup, NULL);
viresh kumar4c18e772010-05-03 09:24:30 +0100590
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400591 /* shared irq registration */
viresh kumar53821162011-03-07 05:57:06 +0100592 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K);
viresh kumar4c18e772010-05-03 09:24:30 +0100593 if (base) {
594 /* shirq 1 */
595 shirq_ras1.regs.base = base;
596 ret = spear_shirq_register(&shirq_ras1);
597 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530598 pr_err("Error registering Shared IRQ 1\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100599
600 /* shirq 3 */
601 shirq_ras3.regs.base = base;
602 ret = spear_shirq_register(&shirq_ras3);
603 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530604 pr_err("Error registering Shared IRQ 3\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100605
606 /* shirq 4 */
607 shirq_intrcomm_ras.regs.base = base;
608 ret = spear_shirq_register(&shirq_intrcomm_ras);
609 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530610 pr_err("Error registering Shared IRQ 4\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100611 }
viresh kumar70f4c0b2010-04-01 12:31:29 +0100612
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530613 if (of_machine_is_compatible("st,spear320-evb")) {
614 /* pmx initialization */
615 pmx_driver.base = base;
616 pmx_driver.mode = &spear320_auto_net_mii_mode;
617 pmx_driver.devs = spear320_evb_pmx_devs;
618 pmx_driver.devs_count = ARRAY_SIZE(spear320_evb_pmx_devs);
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100619
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530620 ret = pmx_register(&pmx_driver);
621 if (ret)
622 pr_err("padmux: registration failed. err no: %d\n",
623 ret);
624 }
viresh kumar70f4c0b2010-04-01 12:31:29 +0100625}
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530626
627static const char * const spear320_dt_board_compat[] = {
628 "st,spear320",
629 "st,spear320-evb",
630 NULL,
631};
632
633static void __init spear320_map_io(void)
634{
635 spear3xx_map_io();
636 spear320_clk_init();
637}
638
639DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree")
640 .map_io = spear320_map_io,
641 .init_irq = spear3xx_dt_init_irq,
642 .handle_irq = vic_handle_irq,
643 .timer = &spear3xx_timer,
644 .init_machine = spear320_dt_init,
645 .restart = spear_restart,
646 .dt_compat = spear320_dt_board_compat,
647MACHINE_END