34d08347be5f1684490163cb0ca027af76f5057e
[platform/kernel/linux-starfive.git] / arch / arm / mach-picoxcell / common.c
1 /*
2  * Copyright (c) 2011 Picochip Ltd., Jamie Iles
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * All enquiries to support@picochip.com
9  */
10 #include <linux/irq.h>
11 #include <linux/irqdomain.h>
12 #include <linux/of.h>
13 #include <linux/of_address.h>
14 #include <linux/of_platform.h>
15
16 #include <asm/mach/arch.h>
17 #include <asm/hardware/vic.h>
18
19 #include <mach/map.h>
20 #include <mach/picoxcell_soc.h>
21
22 #include "common.h"
23
24 static void __init picoxcell_init_machine(void)
25 {
26         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
27 }
28
29 static const char *picoxcell_dt_match[] = {
30         "picochip,pc3x2",
31         "picochip,pc3x3",
32         NULL
33 };
34
35 static const struct of_device_id vic_of_match[] __initconst = {
36         { .compatible = "arm,pl192-vic" },
37         { /* Sentinel */ }
38 };
39
40 static void __init picoxcell_init_irq(void)
41 {
42         vic_init(IO_ADDRESS(PICOXCELL_VIC0_BASE), 0, ~0, 0);
43         vic_init(IO_ADDRESS(PICOXCELL_VIC1_BASE), 32, ~0, 0);
44         irq_domain_generate_simple(vic_of_match, PICOXCELL_VIC0_BASE, 0);
45         irq_domain_generate_simple(vic_of_match, PICOXCELL_VIC1_BASE, 32);
46 }
47
48 DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
49         .map_io         = picoxcell_map_io,
50         .nr_irqs        = ARCH_NR_IRQS,
51         .init_irq       = picoxcell_init_irq,
52         .timer          = &picoxcell_timer,
53         .init_machine   = picoxcell_init_machine,
54         .dt_compat      = picoxcell_dt_match,
55 MACHINE_END