aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mayer <markus.mayer@linaro.org>2014-02-25 17:17:43 -0500
committerMatt Porter <mporter@linaro.org>2014-03-06 03:17:59 -0500
commit8b1c342629ecf7c2c52600dbe626d74cffc8d6cc (patch)
tree8127124f28d8b4bea739c64d06c613bef9df3fd5
parent9c6423aa7e32c74f7992c0428d8456373a5c48a8 (diff)
ARM: bcm281xx: Move kona_l2_cache_init() so it can be shared
In preparation for future SoCs, move kona_l2_cache_init() from board specific board_bcm281xx.c to shared kona.c, so multiple SoC families can make use of it. Also change the return type to "void", since we never look at the return code anyway. Signed-off-by: Markus Mayer <markus.mayer@linaro.org> Signed-off-by: Matt Porter <mporter@linaro.org>
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c26
-rw-r--r--arch/arm/mach-bcm/kona.c30
-rw-r--r--arch/arm/mach-bcm/kona.h3
3 files changed, 32 insertions, 27 deletions
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index d8f0b6cc78aa..5494e9146761 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -12,37 +12,13 @@
12 */ 12 */
13 13
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <linux/init.h> 15#include <linux/of_address.h>
16#include <linux/device.h>
17#include <linux/platform_device.h>
18#include <linux/clocksource.h> 16#include <linux/clocksource.h>
19 17
20#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
21#include <asm/mach/time.h>
22#include <asm/hardware/cache-l2x0.h>
23 19
24#include "bcm_kona_smc.h"
25#include "kona.h" 20#include "kona.h"
26 21
27static int __init kona_l2_cache_init(void)
28{
29 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
30 return 0;
31
32 if (bcm_kona_smc_init() < 0) {
33 pr_info("Kona secure API not available. Skipping L2 init\n");
34 return 0;
35 }
36
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 */
43 return l2x0_of_init(0, ~0);
44}
45
46static void bcm_board_setup_restart(void) 22static void bcm_board_setup_restart(void)
47{ 23{
48 struct device_node *np; 24 struct device_node *np;
diff --git a/arch/arm/mach-bcm/kona.c b/arch/arm/mach-bcm/kona.c
index 6939d9017f63..2f1db29291fe 100644
--- a/arch/arm/mach-bcm/kona.c
+++ b/arch/arm/mach-bcm/kona.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2013 Broadcom Corporation 2 * Copyright (C) 2012-2014 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 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 5 * modify it under the terms of the GNU General Public License as
@@ -12,10 +12,38 @@
12 */ 12 */
13 13
14#include <linux/of_address.h> 14#include <linux/of_address.h>
15#include <linux/of_platform.h>
16#include <asm/hardware/cache-l2x0.h>
15#include <asm/io.h> 17#include <asm/io.h>
16 18
19#include "bcm_kona_smc.h"
17#include "kona.h" 20#include "kona.h"
18 21
22void __init kona_l2_cache_init(void)
23{
24 int ret;
25
26 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
27 return;
28
29 ret = bcm_kona_smc_init();
30 if (ret) {
31 pr_info("Secure API not available (%d). Skipping L2 init.\n",
32 ret);
33 return;
34 }
35
36 bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
37
38 /*
39 * The aux_val and aux_mask have no effect since L2 cache is already
40 * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
41 */
42 ret = l2x0_of_init(0, ~0);
43 if (ret)
44 pr_err("Couldn't enable L2 cache: %d\n", ret);
45}
46
19static void __iomem *watchdog_base; 47static void __iomem *watchdog_base;
20 48
21void bcm_kona_setup_restart(void) 49void bcm_kona_setup_restart(void)
diff --git a/arch/arm/mach-bcm/kona.h b/arch/arm/mach-bcm/kona.h
index 291eca3e06ff..f42aef837444 100644
--- a/arch/arm/mach-bcm/kona.h
+++ b/arch/arm/mach-bcm/kona.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2013 Broadcom Corporation 2 * Copyright (C) 2012-2014 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 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 5 * modify it under the terms of the GNU General Public License as
@@ -13,5 +13,6 @@
13 13
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15 15
16void __init kona_l2_cache_init(void);
16void bcm_kona_setup_restart(void); 17void bcm_kona_setup_restart(void);
17void bcm_kona_restart(enum reboot_mode mode, const char *cmd); 18void bcm_kona_restart(enum reboot_mode mode, const char *cmd);