blob: f46fc2692ab6bc77d7bfffa41a9ae5a7759c0e87 [file] [log] [blame]
viresh kumarbc4e8142010-04-01 12:30:58 +01001/*
2 * arch/arm/mach-spear3xx/spear300.c
3 *
4 * SPEAr300 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) "SPEAr300: " fmt
15
Viresh Kumar0b7ee712012-03-26 10:29:23 +053016#include <linux/amba/pl08x.h>
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053017#include <linux/of_platform.h>
18#include <asm/hardware/vic.h>
19#include <asm/mach/arch.h>
viresh kumar410782b2011-03-07 05:57:01 +010020#include <plat/shirq.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010021#include <mach/generic.h>
viresh kumar02aa06b2011-03-07 05:57:02 +010022#include <mach/hardware.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010023
viresh kumar70f4c0b2010-04-01 12:31:29 +010024/* pad multiplexing support */
25/* muxing registers */
26#define PAD_MUX_CONFIG_REG 0x00
27#define MODE_CONFIG_REG 0x04
28
29/* modes */
30#define NAND_MODE (1 << 0)
31#define NOR_MODE (1 << 1)
32#define PHOTO_FRAME_MODE (1 << 2)
33#define LEND_IP_PHONE_MODE (1 << 3)
34#define HEND_IP_PHONE_MODE (1 << 4)
35#define LEND_WIFI_PHONE_MODE (1 << 5)
36#define HEND_WIFI_PHONE_MODE (1 << 6)
37#define ATA_PABX_WI2S_MODE (1 << 7)
38#define ATA_PABX_I2S_MODE (1 << 8)
39#define CAML_LCDW_MODE (1 << 9)
40#define CAMU_LCD_MODE (1 << 10)
41#define CAMU_WLCD_MODE (1 << 11)
42#define CAML_LCD_MODE (1 << 12)
43#define ALL_MODES 0x1FFF
44
Ryan Mallon6618c3a2011-05-20 08:34:22 +010045struct pmx_mode spear300_nand_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010046 .id = NAND_MODE,
47 .name = "nand mode",
48 .mask = 0x00,
49};
50
Ryan Mallon6618c3a2011-05-20 08:34:22 +010051struct pmx_mode spear300_nor_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010052 .id = NOR_MODE,
53 .name = "nor mode",
54 .mask = 0x01,
55};
56
Ryan Mallon6618c3a2011-05-20 08:34:22 +010057struct pmx_mode spear300_photo_frame_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010058 .id = PHOTO_FRAME_MODE,
59 .name = "photo frame mode",
60 .mask = 0x02,
61};
62
Ryan Mallon6618c3a2011-05-20 08:34:22 +010063struct pmx_mode spear300_lend_ip_phone_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010064 .id = LEND_IP_PHONE_MODE,
65 .name = "lend ip phone mode",
66 .mask = 0x03,
67};
68
Ryan Mallon6618c3a2011-05-20 08:34:22 +010069struct pmx_mode spear300_hend_ip_phone_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010070 .id = HEND_IP_PHONE_MODE,
71 .name = "hend ip phone mode",
72 .mask = 0x04,
73};
74
Ryan Mallon6618c3a2011-05-20 08:34:22 +010075struct pmx_mode spear300_lend_wifi_phone_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010076 .id = LEND_WIFI_PHONE_MODE,
77 .name = "lend wifi phone mode",
78 .mask = 0x05,
79};
80
Ryan Mallon6618c3a2011-05-20 08:34:22 +010081struct pmx_mode spear300_hend_wifi_phone_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010082 .id = HEND_WIFI_PHONE_MODE,
83 .name = "hend wifi phone mode",
84 .mask = 0x06,
85};
86
Ryan Mallon6618c3a2011-05-20 08:34:22 +010087struct pmx_mode spear300_ata_pabx_wi2s_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010088 .id = ATA_PABX_WI2S_MODE,
89 .name = "ata pabx wi2s mode",
90 .mask = 0x07,
91};
92
Ryan Mallon6618c3a2011-05-20 08:34:22 +010093struct pmx_mode spear300_ata_pabx_i2s_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +010094 .id = ATA_PABX_I2S_MODE,
95 .name = "ata pabx i2s mode",
96 .mask = 0x08,
97};
98
Ryan Mallon6618c3a2011-05-20 08:34:22 +010099struct pmx_mode spear300_caml_lcdw_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100100 .id = CAML_LCDW_MODE,
101 .name = "caml lcdw mode",
102 .mask = 0x0C,
103};
104
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100105struct pmx_mode spear300_camu_lcd_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100106 .id = CAMU_LCD_MODE,
107 .name = "camu lcd mode",
108 .mask = 0x0D,
109};
110
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100111struct pmx_mode spear300_camu_wlcd_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100112 .id = CAMU_WLCD_MODE,
113 .name = "camu wlcd mode",
114 .mask = 0x0E,
115};
116
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100117struct pmx_mode spear300_caml_lcd_mode = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100118 .id = CAML_LCD_MODE,
119 .name = "caml lcd mode",
120 .mask = 0x0F,
121};
122
123/* devices */
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100124static struct pmx_dev_mode pmx_fsmc_2_chips_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100125 {
126 .ids = NAND_MODE | NOR_MODE | PHOTO_FRAME_MODE |
127 ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE,
128 .mask = PMX_FIRDA_MASK,
129 },
130};
131
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100132struct pmx_dev spear300_pmx_fsmc_2_chips = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100133 .name = "fsmc_2_chips",
134 .modes = pmx_fsmc_2_chips_modes,
135 .mode_count = ARRAY_SIZE(pmx_fsmc_2_chips_modes),
136 .enb_on_reset = 1,
137};
138
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100139static struct pmx_dev_mode pmx_fsmc_4_chips_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100140 {
141 .ids = NAND_MODE | NOR_MODE | PHOTO_FRAME_MODE |
142 ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE,
143 .mask = PMX_FIRDA_MASK | PMX_UART0_MASK,
144 },
145};
146
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100147struct pmx_dev spear300_pmx_fsmc_4_chips = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100148 .name = "fsmc_4_chips",
149 .modes = pmx_fsmc_4_chips_modes,
150 .mode_count = ARRAY_SIZE(pmx_fsmc_4_chips_modes),
151 .enb_on_reset = 1,
152};
153
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100154static struct pmx_dev_mode pmx_keyboard_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100155 {
156 .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE |
157 LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE |
158 CAML_LCDW_MODE | CAMU_LCD_MODE | CAMU_WLCD_MODE |
159 CAML_LCD_MODE,
160 .mask = 0x0,
161 },
162};
163
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100164struct pmx_dev spear300_pmx_keyboard = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100165 .name = "keyboard",
166 .modes = pmx_keyboard_modes,
167 .mode_count = ARRAY_SIZE(pmx_keyboard_modes),
168 .enb_on_reset = 1,
169};
170
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100171static struct pmx_dev_mode pmx_clcd_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100172 {
173 .ids = PHOTO_FRAME_MODE,
174 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK ,
175 }, {
176 .ids = HEND_IP_PHONE_MODE | HEND_WIFI_PHONE_MODE |
177 CAMU_LCD_MODE | CAML_LCD_MODE,
178 .mask = PMX_TIMER_3_4_MASK,
179 },
180};
181
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100182struct pmx_dev spear300_pmx_clcd = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100183 .name = "clcd",
184 .modes = pmx_clcd_modes,
185 .mode_count = ARRAY_SIZE(pmx_clcd_modes),
186 .enb_on_reset = 1,
187};
188
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100189static struct pmx_dev_mode pmx_telecom_gpio_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100190 {
191 .ids = PHOTO_FRAME_MODE | CAMU_LCD_MODE | CAML_LCD_MODE,
192 .mask = PMX_MII_MASK,
193 }, {
194 .ids = LEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE,
195 .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
196 }, {
197 .ids = ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_WLCD_MODE,
198 .mask = PMX_MII_MASK | PMX_TIMER_3_4_MASK,
199 }, {
200 .ids = HEND_IP_PHONE_MODE | HEND_WIFI_PHONE_MODE,
201 .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK,
202 }, {
203 .ids = ATA_PABX_WI2S_MODE,
204 .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK
205 | PMX_UART0_MODEM_MASK,
206 },
207};
208
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100209struct pmx_dev spear300_pmx_telecom_gpio = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100210 .name = "telecom_gpio",
211 .modes = pmx_telecom_gpio_modes,
212 .mode_count = ARRAY_SIZE(pmx_telecom_gpio_modes),
213 .enb_on_reset = 1,
214};
215
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100216static struct pmx_dev_mode pmx_telecom_tdm_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100217 {
218 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
219 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE
220 | HEND_WIFI_PHONE_MODE | ATA_PABX_WI2S_MODE
221 | ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE
222 | CAMU_WLCD_MODE | CAML_LCD_MODE,
223 .mask = PMX_UART0_MODEM_MASK | PMX_SSP_CS_MASK,
224 },
225};
226
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100227struct pmx_dev spear300_pmx_telecom_tdm = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100228 .name = "telecom_tdm",
229 .modes = pmx_telecom_tdm_modes,
230 .mode_count = ARRAY_SIZE(pmx_telecom_tdm_modes),
231 .enb_on_reset = 1,
232};
233
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100234static struct pmx_dev_mode pmx_telecom_spi_cs_i2c_clk_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100235 {
236 .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE |
237 LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE
238 | ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE |
239 CAML_LCDW_MODE | CAML_LCD_MODE,
240 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
241 },
242};
243
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100244struct pmx_dev spear300_pmx_telecom_spi_cs_i2c_clk = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100245 .name = "telecom_spi_cs_i2c_clk",
246 .modes = pmx_telecom_spi_cs_i2c_clk_modes,
247 .mode_count = ARRAY_SIZE(pmx_telecom_spi_cs_i2c_clk_modes),
248 .enb_on_reset = 1,
249};
250
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100251static struct pmx_dev_mode pmx_telecom_camera_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100252 {
253 .ids = CAML_LCDW_MODE | CAML_LCD_MODE,
254 .mask = PMX_MII_MASK,
255 }, {
256 .ids = CAMU_LCD_MODE | CAMU_WLCD_MODE,
257 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK | PMX_MII_MASK,
258 },
259};
260
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100261struct pmx_dev spear300_pmx_telecom_camera = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100262 .name = "telecom_camera",
263 .modes = pmx_telecom_camera_modes,
264 .mode_count = ARRAY_SIZE(pmx_telecom_camera_modes),
265 .enb_on_reset = 1,
266};
267
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100268static struct pmx_dev_mode pmx_telecom_dac_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100269 {
270 .ids = ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE
271 | CAMU_WLCD_MODE | CAML_LCD_MODE,
272 .mask = PMX_TIMER_1_2_MASK,
273 },
274};
275
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100276struct pmx_dev spear300_pmx_telecom_dac = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100277 .name = "telecom_dac",
278 .modes = pmx_telecom_dac_modes,
279 .mode_count = ARRAY_SIZE(pmx_telecom_dac_modes),
280 .enb_on_reset = 1,
281};
282
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100283static struct pmx_dev_mode pmx_telecom_i2s_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100284 {
285 .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE
286 | LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE |
287 ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE
288 | CAMU_WLCD_MODE | CAML_LCD_MODE,
289 .mask = PMX_UART0_MODEM_MASK,
290 },
291};
292
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100293struct pmx_dev spear300_pmx_telecom_i2s = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100294 .name = "telecom_i2s",
295 .modes = pmx_telecom_i2s_modes,
296 .mode_count = ARRAY_SIZE(pmx_telecom_i2s_modes),
297 .enb_on_reset = 1,
298};
299
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100300static struct pmx_dev_mode pmx_telecom_boot_pins_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100301 {
302 .ids = NAND_MODE | NOR_MODE,
303 .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_1_2_MASK |
304 PMX_TIMER_3_4_MASK,
305 },
306};
307
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100308struct pmx_dev spear300_pmx_telecom_boot_pins = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100309 .name = "telecom_boot_pins",
310 .modes = pmx_telecom_boot_pins_modes,
311 .mode_count = ARRAY_SIZE(pmx_telecom_boot_pins_modes),
312 .enb_on_reset = 1,
313};
314
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100315static struct pmx_dev_mode pmx_telecom_sdhci_4bit_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100316 {
317 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
318 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
319 HEND_WIFI_PHONE_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
320 CAMU_WLCD_MODE | CAML_LCD_MODE | ATA_PABX_WI2S_MODE |
321 ATA_PABX_I2S_MODE,
322 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK |
323 PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
324 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK,
325 },
326};
327
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100328struct pmx_dev spear300_pmx_telecom_sdhci_4bit = {
viresh kumar069580b2011-03-07 05:57:03 +0100329 .name = "telecom_sdhci_4bit",
330 .modes = pmx_telecom_sdhci_4bit_modes,
331 .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_4bit_modes),
viresh kumar70f4c0b2010-04-01 12:31:29 +0100332 .enb_on_reset = 1,
333};
334
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100335static struct pmx_dev_mode pmx_telecom_sdhci_8bit_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100336 {
337 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
338 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
339 HEND_WIFI_PHONE_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
340 CAMU_WLCD_MODE | CAML_LCD_MODE,
341 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK |
342 PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
343 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK | PMX_MII_MASK,
344 },
345};
346
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100347struct pmx_dev spear300_pmx_telecom_sdhci_8bit = {
viresh kumar069580b2011-03-07 05:57:03 +0100348 .name = "telecom_sdhci_8bit",
349 .modes = pmx_telecom_sdhci_8bit_modes,
350 .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_8bit_modes),
viresh kumar70f4c0b2010-04-01 12:31:29 +0100351 .enb_on_reset = 1,
352};
353
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100354static struct pmx_dev_mode pmx_gpio1_modes[] = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100355 {
356 .ids = PHOTO_FRAME_MODE,
357 .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_1_2_MASK |
358 PMX_TIMER_3_4_MASK,
359 },
360};
361
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100362struct pmx_dev spear300_pmx_gpio1 = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100363 .name = "arm gpio1",
364 .modes = pmx_gpio1_modes,
365 .mode_count = ARRAY_SIZE(pmx_gpio1_modes),
366 .enb_on_reset = 1,
367};
368
369/* pmx driver structure */
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100370static struct pmx_driver pmx_driver = {
viresh kumar70f4c0b2010-04-01 12:31:29 +0100371 .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x0000000f},
372 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
373};
374
viresh kumar4c18e772010-05-03 09:24:30 +0100375/* spear3xx shared irq */
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100376static struct shirq_dev_config shirq_ras1_config[] = {
viresh kumar4c18e772010-05-03 09:24:30 +0100377 {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100378 .virq = SPEAR300_VIRQ_IT_PERS_S,
379 .enb_mask = SPEAR300_IT_PERS_S_IRQ_MASK,
380 .status_mask = SPEAR300_IT_PERS_S_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100381 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100382 .virq = SPEAR300_VIRQ_IT_CHANGE_S,
383 .enb_mask = SPEAR300_IT_CHANGE_S_IRQ_MASK,
384 .status_mask = SPEAR300_IT_CHANGE_S_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100385 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100386 .virq = SPEAR300_VIRQ_I2S,
387 .enb_mask = SPEAR300_I2S_IRQ_MASK,
388 .status_mask = SPEAR300_I2S_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100389 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100390 .virq = SPEAR300_VIRQ_TDM,
391 .enb_mask = SPEAR300_TDM_IRQ_MASK,
392 .status_mask = SPEAR300_TDM_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100393 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100394 .virq = SPEAR300_VIRQ_CAMERA_L,
395 .enb_mask = SPEAR300_CAMERA_L_IRQ_MASK,
396 .status_mask = SPEAR300_CAMERA_L_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100397 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100398 .virq = SPEAR300_VIRQ_CAMERA_F,
399 .enb_mask = SPEAR300_CAMERA_F_IRQ_MASK,
400 .status_mask = SPEAR300_CAMERA_F_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100401 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100402 .virq = SPEAR300_VIRQ_CAMERA_V,
403 .enb_mask = SPEAR300_CAMERA_V_IRQ_MASK,
404 .status_mask = SPEAR300_CAMERA_V_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100405 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100406 .virq = SPEAR300_VIRQ_KEYBOARD,
407 .enb_mask = SPEAR300_KEYBOARD_IRQ_MASK,
408 .status_mask = SPEAR300_KEYBOARD_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100409 }, {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100410 .virq = SPEAR300_VIRQ_GPIO1,
411 .enb_mask = SPEAR300_GPIO1_IRQ_MASK,
412 .status_mask = SPEAR300_GPIO1_IRQ_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100413 },
414};
415
Ryan Mallonf6558bf2011-05-20 08:34:20 +0100416static struct spear_shirq shirq_ras1 = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100417 .irq = SPEAR3XX_IRQ_GEN_RAS_1,
viresh kumar4c18e772010-05-03 09:24:30 +0100418 .dev_config = shirq_ras1_config,
419 .dev_count = ARRAY_SIZE(shirq_ras1_config),
420 .regs = {
Ryan Mallon61e72bc2011-05-20 08:34:21 +0100421 .enb_reg = SPEAR300_INT_ENB_MASK_REG,
422 .status_reg = SPEAR300_INT_STS_MASK_REG,
423 .status_reg_mask = SPEAR300_SHIRQ_RAS1_MASK,
viresh kumar4c18e772010-05-03 09:24:30 +0100424 .clear_reg = -1,
425 },
viresh kumarbc4e8142010-04-01 12:30:58 +0100426};
427
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530428/* padmux devices to enable */
429static struct pmx_dev *spear300_evb_pmx_devs[] = {
430 /* spear3xx specific devices */
431 &spear3xx_pmx_i2c,
432 &spear3xx_pmx_ssp_cs,
433 &spear3xx_pmx_ssp,
434 &spear3xx_pmx_mii,
435 &spear3xx_pmx_uart0,
436
437 /* spear300 specific devices */
438 &spear300_pmx_fsmc_2_chips,
439 &spear300_pmx_clcd,
440 &spear300_pmx_telecom_sdhci_4bit,
441 &spear300_pmx_gpio1,
viresh kumarc2c07832011-03-07 05:57:05 +0100442};
443
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530444/* DMAC platform data's slave info */
445struct pl08x_channel_data spear300_dma_info[] = {
446 {
447 .bus_id = "uart0_rx",
448 .min_signal = 2,
449 .max_signal = 2,
450 .muxval = 0,
451 .cctl = 0,
452 .periph_buses = PL08X_AHB1,
453 }, {
454 .bus_id = "uart0_tx",
455 .min_signal = 3,
456 .max_signal = 3,
457 .muxval = 0,
458 .cctl = 0,
459 .periph_buses = PL08X_AHB1,
460 }, {
461 .bus_id = "ssp0_rx",
462 .min_signal = 8,
463 .max_signal = 8,
464 .muxval = 0,
465 .cctl = 0,
466 .periph_buses = PL08X_AHB1,
467 }, {
468 .bus_id = "ssp0_tx",
469 .min_signal = 9,
470 .max_signal = 9,
471 .muxval = 0,
472 .cctl = 0,
473 .periph_buses = PL08X_AHB1,
474 }, {
475 .bus_id = "i2c_rx",
476 .min_signal = 10,
477 .max_signal = 10,
478 .muxval = 0,
479 .cctl = 0,
480 .periph_buses = PL08X_AHB1,
481 }, {
482 .bus_id = "i2c_tx",
483 .min_signal = 11,
484 .max_signal = 11,
485 .muxval = 0,
486 .cctl = 0,
487 .periph_buses = PL08X_AHB1,
488 }, {
489 .bus_id = "irda",
490 .min_signal = 12,
491 .max_signal = 12,
492 .muxval = 0,
493 .cctl = 0,
494 .periph_buses = PL08X_AHB1,
495 }, {
496 .bus_id = "adc",
497 .min_signal = 13,
498 .max_signal = 13,
499 .muxval = 0,
500 .cctl = 0,
501 .periph_buses = PL08X_AHB1,
502 }, {
503 .bus_id = "to_jpeg",
504 .min_signal = 14,
505 .max_signal = 14,
506 .muxval = 0,
507 .cctl = 0,
508 .periph_buses = PL08X_AHB1,
509 }, {
510 .bus_id = "from_jpeg",
511 .min_signal = 15,
512 .max_signal = 15,
513 .muxval = 0,
514 .cctl = 0,
515 .periph_buses = PL08X_AHB1,
516 }, {
517 .bus_id = "ras0_rx",
518 .min_signal = 0,
519 .max_signal = 0,
520 .muxval = 1,
521 .cctl = 0,
522 .periph_buses = PL08X_AHB1,
523 }, {
524 .bus_id = "ras0_tx",
525 .min_signal = 1,
526 .max_signal = 1,
527 .muxval = 1,
528 .cctl = 0,
529 .periph_buses = PL08X_AHB1,
530 }, {
531 .bus_id = "ras1_rx",
532 .min_signal = 2,
533 .max_signal = 2,
534 .muxval = 1,
535 .cctl = 0,
536 .periph_buses = PL08X_AHB1,
537 }, {
538 .bus_id = "ras1_tx",
539 .min_signal = 3,
540 .max_signal = 3,
541 .muxval = 1,
542 .cctl = 0,
543 .periph_buses = PL08X_AHB1,
544 }, {
545 .bus_id = "ras2_rx",
546 .min_signal = 4,
547 .max_signal = 4,
548 .muxval = 1,
549 .cctl = 0,
550 .periph_buses = PL08X_AHB1,
551 }, {
552 .bus_id = "ras2_tx",
553 .min_signal = 5,
554 .max_signal = 5,
555 .muxval = 1,
556 .cctl = 0,
557 .periph_buses = PL08X_AHB1,
558 }, {
559 .bus_id = "ras3_rx",
560 .min_signal = 6,
561 .max_signal = 6,
562 .muxval = 1,
563 .cctl = 0,
564 .periph_buses = PL08X_AHB1,
565 }, {
566 .bus_id = "ras3_tx",
567 .min_signal = 7,
568 .max_signal = 7,
569 .muxval = 1,
570 .cctl = 0,
571 .periph_buses = PL08X_AHB1,
572 }, {
573 .bus_id = "ras4_rx",
574 .min_signal = 8,
575 .max_signal = 8,
576 .muxval = 1,
577 .cctl = 0,
578 .periph_buses = PL08X_AHB1,
579 }, {
580 .bus_id = "ras4_tx",
581 .min_signal = 9,
582 .max_signal = 9,
583 .muxval = 1,
584 .cctl = 0,
585 .periph_buses = PL08X_AHB1,
586 }, {
587 .bus_id = "ras5_rx",
588 .min_signal = 10,
589 .max_signal = 10,
590 .muxval = 1,
591 .cctl = 0,
592 .periph_buses = PL08X_AHB1,
593 }, {
594 .bus_id = "ras5_tx",
595 .min_signal = 11,
596 .max_signal = 11,
597 .muxval = 1,
598 .cctl = 0,
599 .periph_buses = PL08X_AHB1,
600 }, {
601 .bus_id = "ras6_rx",
602 .min_signal = 12,
603 .max_signal = 12,
604 .muxval = 1,
605 .cctl = 0,
606 .periph_buses = PL08X_AHB1,
607 }, {
608 .bus_id = "ras6_tx",
609 .min_signal = 13,
610 .max_signal = 13,
611 .muxval = 1,
612 .cctl = 0,
613 .periph_buses = PL08X_AHB1,
614 }, {
615 .bus_id = "ras7_rx",
616 .min_signal = 14,
617 .max_signal = 14,
618 .muxval = 1,
619 .cctl = 0,
620 .periph_buses = PL08X_AHB1,
621 }, {
622 .bus_id = "ras7_tx",
623 .min_signal = 15,
624 .max_signal = 15,
625 .muxval = 1,
626 .cctl = 0,
627 .periph_buses = PL08X_AHB1,
628 },
629};
630
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530631/* Add SPEAr300 auxdata to pass platform data */
632static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
633 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
634 &pl022_plat_data),
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530635 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
636 &pl080_plat_data),
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530637 {}
638};
viresh kumarc2c07832011-03-07 05:57:05 +0100639
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530640static void __init spear300_dt_init(void)
viresh kumarbc4e8142010-04-01 12:30:58 +0100641{
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530642 int ret = -EINVAL;
viresh kumar4c18e772010-05-03 09:24:30 +0100643
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530644 pl080_plat_data.slave_channels = spear300_dma_info;
645 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
646
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530647 of_platform_populate(NULL, of_default_bus_match_table,
648 spear300_auxdata_lookup, NULL);
viresh kumar4c18e772010-05-03 09:24:30 +0100649
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400650 /* shared irq registration */
viresh kumar53821162011-03-07 05:57:06 +0100651 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K);
viresh kumar4c18e772010-05-03 09:24:30 +0100652 if (shirq_ras1.regs.base) {
653 ret = spear_shirq_register(&shirq_ras1);
654 if (ret)
Viresh Kumar5fb00f92012-03-26 10:39:43 +0530655 pr_err("Error registering Shared IRQ\n");
viresh kumar4c18e772010-05-03 09:24:30 +0100656 }
viresh kumar70f4c0b2010-04-01 12:31:29 +0100657
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530658 if (of_machine_is_compatible("st,spear300-evb")) {
659 /* pmx initialization */
660 pmx_driver.mode = &spear300_photo_frame_mode;
661 pmx_driver.devs = spear300_evb_pmx_devs;
662 pmx_driver.devs_count = ARRAY_SIZE(spear300_evb_pmx_devs);
Ryan Mallon6618c3a2011-05-20 08:34:22 +0100663
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530664 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K);
665 if (pmx_driver.base) {
666 ret = pmx_register(&pmx_driver);
667 if (ret)
668 pr_err("padmux: registration failed. err no: %d\n",
669 ret);
670 /* Free Mapping, device selection already done */
671 iounmap(pmx_driver.base);
672 }
673
viresh kumar53688c52011-02-16 07:40:30 +0100674 if (ret)
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530675 pr_err("Initialization Failed");
viresh kumar53688c52011-02-16 07:40:30 +0100676 }
viresh kumar70f4c0b2010-04-01 12:31:29 +0100677}
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530678
679static const char * const spear300_dt_board_compat[] = {
680 "st,spear300",
681 "st,spear300-evb",
682 NULL,
683};
684
685static void __init spear300_map_io(void)
686{
687 spear3xx_map_io();
688 spear300_clk_init();
689}
690
691DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
692 .map_io = spear300_map_io,
693 .init_irq = spear3xx_dt_init_irq,
694 .handle_irq = vic_handle_irq,
695 .timer = &spear3xx_timer,
696 .init_machine = spear300_dt_init,
697 .restart = spear_restart,
698 .dt_compat = spear300_dt_board_compat,
699MACHINE_END