aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-socfpga/socfpga.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-socfpga/socfpga.c')
-rw-r--r--arch/arm/mach-socfpga/socfpga.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index f01e1ebf5396..6732924a5fee 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -15,23 +15,73 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include <linux/dw_apb_timer.h> 17#include <linux/dw_apb_timer.h>
18#include <linux/of_address.h>
18#include <linux/of_irq.h> 19#include <linux/of_irq.h>
19#include <linux/of_platform.h> 20#include <linux/of_platform.h>
20 21
21#include <asm/hardware/cache-l2x0.h> 22#include <asm/hardware/cache-l2x0.h>
22#include <asm/hardware/gic.h> 23#include <asm/hardware/gic.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
24 26
25extern void socfpga_init_clocks(void); 27#include "core.h"
28
29void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
30void __iomem *sys_manager_base_addr;
31void __iomem *rst_manager_base_addr;
32
33static struct map_desc scu_io_desc __initdata = {
34 .virtual = SOCFPGA_SCU_VIRT_BASE,
35 .pfn = 0, /* run-time */
36 .length = SZ_8K,
37 .type = MT_DEVICE,
38};
39
40static struct map_desc uart_io_desc __initdata = {
41 .virtual = 0xfec02000,
42 .pfn = __phys_to_pfn(0xffc02000),
43 .length = SZ_8K,
44 .type = MT_DEVICE,
45};
46
47static void __init socfpga_scu_map_io(void)
48{
49 unsigned long base;
50
51 /* Get SCU base */
52 asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
53
54 scu_io_desc.pfn = __phys_to_pfn(base);
55 iotable_init(&scu_io_desc, 1);
56}
57
58static void __init socfpga_map_io(void)
59{
60 socfpga_scu_map_io();
61 iotable_init(&uart_io_desc, 1);
62 early_printk("Early printk initialized\n");
63}
26 64
27const static struct of_device_id irq_match[] = { 65const static struct of_device_id irq_match[] = {
28 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, 66 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
29 {} 67 {}
30}; 68};
31 69
70void __init socfpga_sysmgr_init(void)
71{
72 struct device_node *np;
73
74 np = of_find_compatible_node(NULL, NULL, "altr,sys-mgr");
75 sys_manager_base_addr = of_iomap(np, 0);
76
77 np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr");
78 rst_manager_base_addr = of_iomap(np, 0);
79}
80
32static void __init gic_init_irq(void) 81static void __init gic_init_irq(void)
33{ 82{
34 of_irq_init(irq_match); 83 of_irq_init(irq_match);
84 socfpga_sysmgr_init();
35} 85}
36 86
37static void socfpga_cyclone5_restart(char mode, const char *cmd) 87static void socfpga_cyclone5_restart(char mode, const char *cmd)
@@ -53,6 +103,8 @@ static const char *altera_dt_match[] = {
53}; 103};
54 104
55DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA") 105DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
106 .smp = smp_ops(socfpga_smp_ops),
107 .map_io = socfpga_map_io,
56 .init_irq = gic_init_irq, 108 .init_irq = gic_init_irq,
57 .handle_irq = gic_handle_irq, 109 .handle_irq = gic_handle_irq,
58 .timer = &dw_apb_timer, 110 .timer = &dw_apb_timer,