aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-spear3xx/spear310.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-03-22 14:47:43 -0400
committerArnd Bergmann <arnd@arndb.de>2012-04-22 16:41:35 -0400
commitc5fa4fdcdbe5f52c3e36892cc81f9378339b00ce (patch)
tree1dbdf4cb9a33637210f69c692aecb57d09c2dfb1 /arch/arm/mach-spear3xx/spear310.c
parent5fb00f965eeac548015bcd45414cccbe53b13d3f (diff)
ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture
This patch adds a generic target for SPEAr3xx machines that can be configured via the device-tree. Currently the following devices are supported via the devicetree: - VIC interrupts - PL011 UART - PL061 GPIO - PL110 CLCD - SP805 WDT - Synopsys DW I2C - Synopsys DW ethernet - ST FSMC-NAND - ST SPEAR-SMI - ST SPEAR-KEYBOARD - ST SPEAR-RTC - ARASAN SDHCI-SPEAR - SPEAR-EHCI - SPEAR-OHCI Other peripheral devices will follow in later patches. This also removes IO_ADDRESS macro and creates 16 MB static mappings instead of 4K for individual peripherals. This is done to have efficient TLB lookup for any I/O windows that are located closely together. ioremap() on this range will return this mapping only instead of creating another. Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Diffstat (limited to 'arch/arm/mach-spear3xx/spear310.c')
-rw-r--r--arch/arm/mach-spear3xx/spear310.c126
1 files changed, 108 insertions, 18 deletions
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear3xx/spear310.c
index b7c28764df92..641fd4cf6bc7 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear3xx/spear310.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * SPEAr310 machine source file 4 * SPEAr310 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 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 10 * License version 2. This program is licensed "as is" without any
@@ -13,8 +13,11 @@
13 13
14#define pr_fmt(fmt) "SPEAr310: " fmt 14#define pr_fmt(fmt) "SPEAr310: " fmt
15 15
16#include <linux/ptrace.h> 16#include <linux/amba/pl08x.h>
17#include <asm/irq.h> 17#include <linux/amba/serial.h>
18#include <linux/of_platform.h>
19#include <asm/hardware/vic.h>
20#include <asm/mach/arch.h>
18#include <plat/shirq.h> 21#include <plat/shirq.h>
19#include <mach/generic.h> 22#include <mach/generic.h>
20#include <mach/hardware.h> 23#include <mach/hardware.h>
@@ -257,17 +260,79 @@ static struct spear_shirq shirq_intrcomm_ras = {
257 }, 260 },
258}; 261};
259 262
260/* Add spear310 specific devices here */ 263/* padmux devices to enable */
264static struct pmx_dev *spear310_evb_pmx_devs[] = {
265 /* spear3xx specific devices */
266 &spear3xx_pmx_i2c,
267 &spear3xx_pmx_ssp,
268 &spear3xx_pmx_gpio_pin0,
269 &spear3xx_pmx_gpio_pin1,
270 &spear3xx_pmx_gpio_pin2,
271 &spear3xx_pmx_gpio_pin3,
272 &spear3xx_pmx_gpio_pin4,
273 &spear3xx_pmx_gpio_pin5,
274 &spear3xx_pmx_uart0,
275
276 /* spear310 specific devices */
277 &spear310_pmx_emi_cs_0_1_4_5,
278 &spear310_pmx_emi_cs_2_3,
279 &spear310_pmx_uart1,
280 &spear310_pmx_uart2,
281 &spear310_pmx_uart3_4_5,
282 &spear310_pmx_fsmc,
283 &spear310_pmx_rs485_0_1,
284 &spear310_pmx_tdm0,
285};
286
287/* uart devices plat data */
288static struct amba_pl011_data spear310_uart_data[] = {
289 {
290 .dma_filter = pl08x_filter_id,
291 .dma_tx_param = "uart1_tx",
292 .dma_rx_param = "uart1_rx",
293 }, {
294 .dma_filter = pl08x_filter_id,
295 .dma_tx_param = "uart2_tx",
296 .dma_rx_param = "uart2_rx",
297 }, {
298 .dma_filter = pl08x_filter_id,
299 .dma_tx_param = "uart3_tx",
300 .dma_rx_param = "uart3_rx",
301 }, {
302 .dma_filter = pl08x_filter_id,
303 .dma_tx_param = "uart4_tx",
304 .dma_rx_param = "uart4_rx",
305 }, {
306 .dma_filter = pl08x_filter_id,
307 .dma_tx_param = "uart5_tx",
308 .dma_rx_param = "uart5_rx",
309 },
310};
261 311
262/* spear310 routines */ 312/* Add SPEAr310 auxdata to pass platform data */
263void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 313static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
264 u8 pmx_dev_count) 314 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
315 &pl022_plat_data),
316 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
317 &spear310_uart_data[0]),
318 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART2_BASE, NULL,
319 &spear310_uart_data[1]),
320 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART3_BASE, NULL,
321 &spear310_uart_data[2]),
322 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART4_BASE, NULL,
323 &spear310_uart_data[3]),
324 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART5_BASE, NULL,
325 &spear310_uart_data[4]),
326 {}
327};
328
329static void __init spear310_dt_init(void)
265{ 330{
266 void __iomem *base; 331 void __iomem *base;
267 int ret = 0; 332 int ret = 0;
268 333
269 /* call spear3xx family common init function */ 334 of_platform_populate(NULL, of_default_bus_match_table,
270 spear3xx_init(); 335 spear310_auxdata_lookup, NULL);
271 336
272 /* shared irq registration */ 337 /* shared irq registration */
273 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K); 338 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K);
@@ -297,13 +362,38 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
297 pr_err("Error registering Shared IRQ 4\n"); 362 pr_err("Error registering Shared IRQ 4\n");
298 } 363 }
299 364
300 /* pmx initialization */ 365 if (of_machine_is_compatible("st,spear310-evb")) {
301 pmx_driver.base = base; 366 /* pmx initialization */
302 pmx_driver.mode = pmx_mode; 367 pmx_driver.base = base;
303 pmx_driver.devs = pmx_devs; 368 pmx_driver.mode = NULL;
304 pmx_driver.devs_count = pmx_dev_count; 369 pmx_driver.devs = spear310_evb_pmx_devs;
370 pmx_driver.devs_count = ARRAY_SIZE(spear310_evb_pmx_devs);
305 371
306 ret = pmx_register(&pmx_driver); 372 ret = pmx_register(&pmx_driver);
307 if (ret) 373 if (ret)
308 pr_err("padmux: registration failed. err no: %d\n", ret); 374 pr_err("padmux: registration failed. err no: %d\n",
375 ret);
376 }
309} 377}
378
379static const char * const spear310_dt_board_compat[] = {
380 "st,spear310",
381 "st,spear310-evb",
382 NULL,
383};
384
385static void __init spear310_map_io(void)
386{
387 spear3xx_map_io();
388 spear310_clk_init();
389}
390
391DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
392 .map_io = spear310_map_io,
393 .init_irq = spear3xx_dt_init_irq,
394 .handle_irq = vic_handle_irq,
395 .timer = &spear3xx_timer,
396 .init_machine = spear310_dt_init,
397 .restart = spear_restart,
398 .dt_compat = spear310_dt_board_compat,
399MACHINE_END