1e49ec0399adbcf636c3ca1948a8deb8da2ce881
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / arm / mach-bcm / board_bcm281xx.c
1 /*
2  * Copyright (C) 2012-2013 Broadcom Corporation
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation version 2.
7  *
8  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9  * kind, whether express or implied; without even the implied warranty
10  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13
14 #include <linux/of_platform.h>
15 #include <linux/init.h>
16 #include <linux/device.h>
17 #include <linux/platform_device.h>
18 #include <linux/clocksource.h>
19
20 #include <asm/mach/arch.h>
21 #include <asm/mach/time.h>
22 #include <asm/hardware/cache-l2x0.h>
23
24 #include "bcm_kona_smc.h"
25 #include "kona.h"
26
27 static int __init kona_l2_cache_init(void)
28 {
29         if (!IS_ENABLED(CONFIG_CACHE_L2X0))
30                 return 0;
31
32         bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
33
34         /*
35          * The aux_val and aux_mask have no effect since L2 cache is already
36          * enabled.  Pass 0s for aux_val and 1s for aux_mask for default value.
37          */
38         l2x0_of_init(0, ~0);
39
40         return 0;
41 }
42
43 static void bcm_board_setup_restart(void)
44 {
45         struct device_node *np;
46
47         np = of_find_compatible_node(NULL, NULL, "bcm,bcm11351");
48         if (np) {
49                 if (of_device_is_available(np))
50                         bcm_kona_setup_restart();
51                 of_node_put(np);
52         }
53         /* Restart setup for other boards goes here */
54 }
55
56 static void __init board_init(void)
57 {
58         of_platform_populate(NULL, of_default_bus_match_table, NULL,
59                 &platform_bus);
60
61         bcm_kona_smc_init();
62         bcm_board_setup_restart();
63         kona_l2_cache_init();
64 }
65
66 static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, };
67
68 DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
69         .init_time = clocksource_of_init,
70         .init_machine = board_init,
71         .restart = bcm_kona_restart,
72         .dt_compat = bcm11351_dt_compat,
73 MACHINE_END