aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-spear3xx/spear3xx.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/spear3xx.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/spear3xx.c')
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c127
1 files changed, 60 insertions, 67 deletions
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index a236925e13b3..a94d8c12ed99 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * SPEAr3XX machines common source file 4 * SPEAr3XX machines common 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,76 +13,14 @@
13 13
14#define pr_fmt(fmt) "SPEAr3xx: " fmt 14#define pr_fmt(fmt) "SPEAr3xx: " fmt
15 15
16#include <linux/types.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl061.h> 17#include <linux/amba/pl08x.h>
18#include <linux/ptrace.h> 18#include <linux/of_irq.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <asm/hardware/vic.h> 20#include <asm/hardware/vic.h>
21#include <asm/irq.h>
22#include <asm/mach/arch.h>
23#include <mach/generic.h> 21#include <mach/generic.h>
24#include <mach/hardware.h> 22#include <mach/hardware.h>
25 23
26/* Add spear3xx machines common devices here */
27/* gpio device registration */
28static struct pl061_platform_data gpio_plat_data = {
29 .gpio_base = 0,
30 .irq_base = SPEAR3XX_GPIO_INT_BASE,
31};
32
33AMBA_APB_DEVICE(spear3xx_gpio, "gpio", 0, SPEAR3XX_ICM3_GPIO_BASE,
34 {SPEAR3XX_IRQ_BASIC_GPIO}, &gpio_plat_data);
35
36/* uart device registration */
37AMBA_APB_DEVICE(spear3xx_uart, "uart", 0, SPEAR3XX_ICM1_UART_BASE,
38 {SPEAR3XX_IRQ_UART}, NULL);
39
40/* Do spear3xx familiy common initialization part here */
41void __init spear3xx_init(void)
42{
43 /* nothing to do for now */
44}
45
46/* This will initialize vic */
47void __init spear3xx_init_irq(void)
48{
49 vic_init((void __iomem *)VA_SPEAR3XX_ML1_VIC_BASE, 0, ~0, 0);
50}
51
52/* Following will create static virtual/physical mappings */
53struct map_desc spear3xx_io_desc[] __initdata = {
54 {
55 .virtual = VA_SPEAR3XX_ICM1_UART_BASE,
56 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
57 .length = SZ_4K,
58 .type = MT_DEVICE
59 }, {
60 .virtual = VA_SPEAR3XX_ML1_VIC_BASE,
61 .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
62 .length = SZ_4K,
63 .type = MT_DEVICE
64 }, {
65 .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
66 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
67 .length = SZ_4K,
68 .type = MT_DEVICE
69 }, {
70 .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE,
71 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
72 .length = SZ_4K,
73 .type = MT_DEVICE
74 },
75};
76
77/* This will create static memory mapping for selected devices */
78void __init spear3xx_map_io(void)
79{
80 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
81
82 /* This will initialize clock framework */
83 spear3xx_clk_init();
84}
85
86/* pad multiplexing support */ 24/* pad multiplexing support */
87/* devices */ 25/* devices */
88static struct pmx_dev_mode pmx_firda_modes[] = { 26static struct pmx_dev_mode pmx_firda_modes[] = {
@@ -508,6 +446,51 @@ struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = {
508}; 446};
509#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */ 447#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
510 448
449/* ssp device registration */
450struct pl022_ssp_controller pl022_plat_data = {
451 .bus_id = 0,
452 .enable_dma = 1,
453 .dma_filter = pl08x_filter_id,
454 .dma_tx_param = "ssp0_tx",
455 .dma_rx_param = "ssp0_rx",
456 /*
457 * This is number of spi devices that can be connected to spi. There are
458 * two type of chipselects on which slave devices can work. One is chip
459 * select provided by spi masters other is controlled through external
460 * gpio's. We can't use chipselect provided from spi master (because as
461 * soon as FIFO becomes empty, CS is disabled and transfer ends). So
462 * this number now depends on number of gpios available for spi. each
463 * slave on each master requires a separate gpio pin.
464 */
465 .num_chipselect = 2,
466};
467
468/*
469 * Following will create 16MB static virtual/physical mappings
470 * PHYSICAL VIRTUAL
471 * 0xD0000000 0xFD000000
472 * 0xFC000000 0xFC000000
473 */
474struct map_desc spear3xx_io_desc[] __initdata = {
475 {
476 .virtual = VA_SPEAR3XX_ICM1_2_BASE,
477 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
478 .length = SZ_16M,
479 .type = MT_DEVICE
480 }, {
481 .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
482 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
483 .length = SZ_16M,
484 .type = MT_DEVICE
485 },
486};
487
488/* This will create static memory mapping for selected devices */
489void __init spear3xx_map_io(void)
490{
491 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
492}
493
511static void __init spear3xx_timer_init(void) 494static void __init spear3xx_timer_init(void)
512{ 495{
513 char pclk_name[] = "pll3_48m_clk"; 496 char pclk_name[] = "pll3_48m_clk";
@@ -538,3 +521,13 @@ static void __init spear3xx_timer_init(void)
538struct sys_timer spear3xx_timer = { 521struct sys_timer spear3xx_timer = {
539 .init = spear3xx_timer_init, 522 .init = spear3xx_timer_init,
540}; 523};
524
525static const struct of_device_id vic_of_match[] __initconst = {
526 { .compatible = "arm,pl190-vic", .data = vic_of_init, },
527 { /* Sentinel */ }
528};
529
530void __init spear3xx_dt_init_irq(void)
531{
532 of_irq_init(vic_of_match);
533}