2 * (C) Copyright 2016 Linaro
3 * Jon Medhurst <tixy@linaro.org>
5 * TC2 specific code for Versatile Express.
7 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/armv7.h>
12 #include <asm/u-boot.h>
14 #include <linux/libfdt.h>
16 #define SCC_BASE 0x7fff0000
18 bool armv7_boot_nonsec_default(void)
20 #ifdef CONFIG_ARMV7_BOOT_SEC_DEFAULT
24 * The Serial Configuration Controller (SCC) register at address 0x700
25 * contains flags for configuring the behaviour of the Boot Monitor
26 * (which CPUs execute from reset). Two of these bits are of interest:
28 * bit 12 = Use per-cpu mailboxes for power management
29 * bit 13 = Power down the non-boot cluster
31 * It is only when both of these are false that U-Boot's current
32 * implementation of 'nonsec' mode can work as expected because we
33 * rely on getting all CPUs to execute _nonsec_init, so let's check that.
35 return (readl((u32 *)(SCC_BASE + 0x700)) & ((1 << 12) | (1 << 13))) == 0;
39 #ifdef CONFIG_OF_BOARD_SETUP
40 int ft_board_setup(void *fdt, bd_t *bd)
43 const struct fdt_property *prop;
44 const char *cci_compatible = "arm,cci-400-ctrl-if";
46 #ifdef CONFIG_ARMV7_NONSEC
47 if (!armv7_boot_nonsec())
52 /* Booting in nonsec mode, disable CCI access */
53 offset = fdt_path_offset(fdt, "/cpus");
55 printf("couldn't find /cpus\n");
59 /* delete cci-control-port in each cpu node */
60 for (tmp = fdt_first_subnode(fdt, offset); tmp >= 0;
61 tmp = fdt_next_subnode(fdt, tmp))
62 fdt_delprop(fdt, tmp, "cci-control-port");
64 /* disable all ace cci slave ports */
65 offset = fdt_node_offset_by_prop_value(fdt, offset, "compatible",
68 prop = fdt_get_property(fdt, offset, "interface-type",
74 if (strcmp(prop->data, "ace"))
77 fdt_setprop_string(fdt, offset, "status", "disabled");
79 offset = fdt_node_offset_by_prop_value(fdt, offset, "compatible",
85 #endif /* CONFIG_OF_BOARD_SETUP */