xref: /openbmc/linux/arch/arm/mach-at91/sama5.c (revision 6a3fc8c3)
1a636cd6cSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2cac01723SNicolas Ferre /*
3cac01723SNicolas Ferre  *  Setup code for SAMA5
4cac01723SNicolas Ferre  *
5cac01723SNicolas Ferre  *  Copyright (C) 2013 Atmel,
6cac01723SNicolas Ferre  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
7cac01723SNicolas Ferre  */
8cac01723SNicolas Ferre 
9cac01723SNicolas Ferre #include <linux/of.h>
10cac01723SNicolas Ferre #include <linux/of_platform.h>
11e7336083SAlexandre Belloni 
123b5a7ca7SClément Léger #include <asm/hardware/cache-l2x0.h>
13e7336083SAlexandre Belloni #include <asm/mach/arch.h>
14e7336083SAlexandre Belloni #include <asm/mach/map.h>
153b5a7ca7SClément Léger #include <asm/outercache.h>
16e7336083SAlexandre Belloni #include <asm/system_misc.h>
17cac01723SNicolas Ferre 
18cac01723SNicolas Ferre #include "generic.h"
190c9fd821SClément Léger #include "sam_secure.h"
20cac01723SNicolas Ferre 
sama5_l2c310_write_sec(unsigned long val,unsigned reg)213b5a7ca7SClément Léger static void sama5_l2c310_write_sec(unsigned long val, unsigned reg)
223b5a7ca7SClément Léger {
233b5a7ca7SClément Léger 	/* OP-TEE configures the L2 cache and does not allow modifying it yet */
243b5a7ca7SClément Léger }
253b5a7ca7SClément Léger 
sama5_secure_cache_init(void)263b5a7ca7SClément Léger static void __init sama5_secure_cache_init(void)
273b5a7ca7SClément Léger {
283b5a7ca7SClément Léger 	sam_secure_init();
29*6a3fc8c3SPeter Rosin 	if (IS_ENABLED(CONFIG_OUTER_CACHE) && sam_linux_is_optee_available())
303b5a7ca7SClément Léger 		outer_cache.write_sec = sama5_l2c310_write_sec;
313b5a7ca7SClément Léger }
323b5a7ca7SClément Léger 
sama5_dt_device_init(void)33cac01723SNicolas Ferre static void __init sama5_dt_device_init(void)
34cac01723SNicolas Ferre {
35b32de9ddSAlexandre Belloni 	of_platform_default_populate(NULL, NULL, NULL);
36fbc7edcaSAlexandre Belloni 	sama5_pm_init();
37cac01723SNicolas Ferre }
38cac01723SNicolas Ferre 
3919c233b7SNicolas Pitre static const char *const sama5_dt_board_compat[] __initconst = {
40cac01723SNicolas Ferre 	"atmel,sama5",
41cac01723SNicolas Ferre 	NULL
42cac01723SNicolas Ferre };
43cac01723SNicolas Ferre 
44ad3fc3e3SNicolas Ferre DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
45cac01723SNicolas Ferre 	/* Maintainer: Atmel */
46cac01723SNicolas Ferre 	.init_machine	= sama5_dt_device_init,
47cac01723SNicolas Ferre 	.dt_compat	= sama5_dt_board_compat,
48cac01723SNicolas Ferre MACHINE_END
49cac01723SNicolas Ferre 
5019c233b7SNicolas Pitre static const char *const sama5_alt_dt_board_compat[] __initconst = {
51cac01723SNicolas Ferre 	"atmel,sama5d4",
52cac01723SNicolas Ferre 	NULL
53cac01723SNicolas Ferre };
54cac01723SNicolas Ferre 
55ad3fc3e3SNicolas Ferre DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
56cac01723SNicolas Ferre 	/* Maintainer: Atmel */
57cac01723SNicolas Ferre 	.init_machine	= sama5_dt_device_init,
58cac01723SNicolas Ferre 	.dt_compat	= sama5_alt_dt_board_compat,
59cac01723SNicolas Ferre 	.l2c_aux_mask	= ~0UL,
60cac01723SNicolas Ferre MACHINE_END
6124a0f5c5SAlexandre Belloni 
6224a0f5c5SAlexandre Belloni static void __init sama5d2_init(void)
6324a0f5c5SAlexandre Belloni {
6424a0f5c5SAlexandre Belloni 	of_platform_default_populate(NULL, NULL, NULL);
6524a0f5c5SAlexandre Belloni 	sama5d2_pm_init();
6624a0f5c5SAlexandre Belloni }
6724a0f5c5SAlexandre Belloni 
6824a0f5c5SAlexandre Belloni static const char *const sama5d2_compat[] __initconst = {
6924a0f5c5SAlexandre Belloni 	"atmel,sama5d2",
7024a0f5c5SAlexandre Belloni 	NULL
7124a0f5c5SAlexandre Belloni };
7224a0f5c5SAlexandre Belloni 
7324a0f5c5SAlexandre Belloni DT_MACHINE_START(sama5d2, "Atmel SAMA5")
7424a0f5c5SAlexandre Belloni 	/* Maintainer: Atmel */
7524a0f5c5SAlexandre Belloni 	.init_machine	= sama5d2_init,
763b5a7ca7SClément Léger 	.init_early	= sama5_secure_cache_init,
7724a0f5c5SAlexandre Belloni 	.dt_compat	= sama5d2_compat,
7824a0f5c5SAlexandre Belloni 	.l2c_aux_mask	= ~0UL,
7924a0f5c5SAlexandre Belloni MACHINE_END
80