]>
Commit | Line | Data |
---|---|---|
8ac49e04 | 1 | /* |
257b49e3 | 2 | * Copyright (C) 2012-2013 Broadcom Corporation |
8ac49e04 CD |
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 | ||
8ac49e04 CD |
14 | #include <linux/of_platform.h> |
15 | #include <linux/init.h> | |
16 | #include <linux/device.h> | |
17 | #include <linux/platform_device.h> | |
8011657b | 18 | #include <linux/clocksource.h> |
8ac49e04 CD |
19 | |
20 | #include <asm/mach/arch.h> | |
8ac49e04 | 21 | #include <asm/mach/time.h> |
b8eb35fd | 22 | #include <asm/hardware/cache-l2x0.h> |
8ac49e04 | 23 | |
b8eb35fd | 24 | #include "bcm_kona_smc.h" |
257b49e3 | 25 | #include "kona.h" |
b8eb35fd CD |
26 | |
27 | static int __init kona_l2_cache_init(void) | |
28 | { | |
29 | if (!IS_ENABLED(CONFIG_CACHE_L2X0)) | |
30 | return 0; | |
31 | ||
3a76b351 CD |
32 | if (bcm_kona_smc_init() < 0) { |
33 | pr_info("Kona secure API not available. Skipping L2 init\n"); | |
34 | return 0; | |
35 | } | |
36 | ||
b8eb35fd CD |
37 | bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); |
38 | ||
39 | /* | |
40 | * The aux_val and aux_mask have no effect since L2 cache is already | |
41 | * enabled. Pass 0s for aux_val and 1s for aux_mask for default value. | |
42 | */ | |
3a76b351 | 43 | return l2x0_of_init(0, ~0); |
b8eb35fd CD |
44 | } |
45 | ||
257b49e3 MM |
46 | static void bcm_board_setup_restart(void) |
47 | { | |
48 | struct device_node *np; | |
49 | ||
aea237bf | 50 | np = of_find_compatible_node(NULL, NULL, "brcm,bcm11351"); |
257b49e3 MM |
51 | if (np) { |
52 | if (of_device_is_available(np)) | |
53 | bcm_kona_setup_restart(); | |
54 | of_node_put(np); | |
55 | } | |
56 | /* Restart setup for other boards goes here */ | |
57 | } | |
58 | ||
8ac49e04 CD |
59 | static void __init board_init(void) |
60 | { | |
61 | of_platform_populate(NULL, of_default_bus_match_table, NULL, | |
62 | &platform_bus); | |
b8eb35fd | 63 | |
257b49e3 | 64 | bcm_board_setup_restart(); |
b8eb35fd | 65 | kona_l2_cache_init(); |
8ac49e04 CD |
66 | } |
67 | ||
aea237bf | 68 | static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, }; |
8ac49e04 | 69 | |
616b931e | 70 | DT_MACHINE_START(BCM11351_DT, "BCM281xx Broadcom Application Processor") |
8ac49e04 | 71 | .init_machine = board_init, |
257b49e3 | 72 | .restart = bcm_kona_restart, |
8ac49e04 | 73 | .dt_compat = bcm11351_dt_compat, |
8ac49e04 | 74 | MACHINE_END |