]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/mach-spear6xx/spear6xx.c
powerpc: Fix fallout from system.h split up
[karo-tx-linux.git] / arch / arm / mach-spear6xx / spear6xx.c
1 /*
2  * arch/arm/mach-spear6xx/spear6xx.c
3  *
4  * SPEAr6XX machines common source file
5  *
6  * Copyright (C) 2009 ST Microelectronics
7  * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8  *
9  * Copyright 2012 Stefan Roese <sr@denx.de>
10  *
11  * This file is licensed under the terms of the GNU General Public
12  * License version 2. This program is licensed "as is" without any
13  * warranty of any kind, whether express or implied.
14  */
15
16 #include <linux/of.h>
17 #include <linux/of_address.h>
18 #include <linux/of_irq.h>
19 #include <linux/of_platform.h>
20 #include <asm/hardware/vic.h>
21 #include <asm/mach/arch.h>
22 #include <mach/generic.h>
23 #include <mach/hardware.h>
24
25 /* Following will create static virtual/physical mappings */
26 static struct map_desc spear6xx_io_desc[] __initdata = {
27         {
28                 .virtual        = VA_SPEAR6XX_ICM1_UART0_BASE,
29                 .pfn            = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE),
30                 .length         = SZ_4K,
31                 .type           = MT_DEVICE
32         }, {
33                 .virtual        = VA_SPEAR6XX_CPU_VIC_PRI_BASE,
34                 .pfn            = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE),
35                 .length         = SZ_4K,
36                 .type           = MT_DEVICE
37         }, {
38                 .virtual        = VA_SPEAR6XX_CPU_VIC_SEC_BASE,
39                 .pfn            = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE),
40                 .length         = SZ_4K,
41                 .type           = MT_DEVICE
42         }, {
43                 .virtual        = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE,
44                 .pfn            = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE),
45                 .length         = SZ_4K,
46                 .type           = MT_DEVICE
47         }, {
48                 .virtual        = VA_SPEAR6XX_ICM3_MISC_REG_BASE,
49                 .pfn            = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE),
50                 .length         = SZ_4K,
51                 .type           = MT_DEVICE
52         },
53 };
54
55 /* This will create static memory mapping for selected devices */
56 void __init spear6xx_map_io(void)
57 {
58         iotable_init(spear6xx_io_desc, ARRAY_SIZE(spear6xx_io_desc));
59
60         /* This will initialize clock framework */
61         spear6xx_clk_init();
62 }
63
64 static void __init spear6xx_timer_init(void)
65 {
66         char pclk_name[] = "pll3_48m_clk";
67         struct clk *gpt_clk, *pclk;
68
69         /* get the system timer clock */
70         gpt_clk = clk_get_sys("gpt0", NULL);
71         if (IS_ERR(gpt_clk)) {
72                 pr_err("%s:couldn't get clk for gpt\n", __func__);
73                 BUG();
74         }
75
76         /* get the suitable parent clock for timer*/
77         pclk = clk_get(NULL, pclk_name);
78         if (IS_ERR(pclk)) {
79                 pr_err("%s:couldn't get %s as parent for gpt\n",
80                                 __func__, pclk_name);
81                 BUG();
82         }
83
84         clk_set_parent(gpt_clk, pclk);
85         clk_put(gpt_clk);
86         clk_put(pclk);
87
88         spear_setup_timer();
89 }
90
91 struct sys_timer spear6xx_timer = {
92         .init = spear6xx_timer_init,
93 };
94
95 static void __init spear600_dt_init(void)
96 {
97         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
98 }
99
100 static const char *spear600_dt_board_compat[] = {
101         "st,spear600",
102         NULL
103 };
104
105 static const struct of_device_id vic_of_match[] __initconst = {
106         { .compatible = "arm,pl190-vic", .data = vic_of_init, },
107         { /* Sentinel */ }
108 };
109
110 static void __init spear6xx_dt_init_irq(void)
111 {
112         of_irq_init(vic_of_match);
113 }
114
115 DT_MACHINE_START(SPEAR600_DT, "ST SPEAr600 (Flattened Device Tree)")
116         .map_io         =       spear6xx_map_io,
117         .init_irq       =       spear6xx_dt_init_irq,
118         .handle_irq     =       vic_handle_irq,
119         .timer          =       &spear6xx_timer,
120         .init_machine   =       spear600_dt_init,
121         .restart        =       spear_restart,
122         .dt_compat      =       spear600_dt_board_compat,
123 MACHINE_END