1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2590b460cSLars Persson /*
3590b460cSLars Persson * ARTPEC-6 device support.
4590b460cSLars Persson */
5590b460cSLars Persson
6590b460cSLars Persson #include <linux/amba/bus.h>
7590b460cSLars Persson #include <linux/clocksource.h>
8590b460cSLars Persson #include <linux/dma-mapping.h>
9590b460cSLars Persson #include <linux/io.h>
10590b460cSLars Persson #include <linux/irqchip.h>
11590b460cSLars Persson #include <linux/irqchip/arm-gic.h>
12590b460cSLars Persson #include <linux/mfd/syscon.h>
13590b460cSLars Persson #include <linux/of.h>
14590b460cSLars Persson #include <linux/of_address.h>
15590b460cSLars Persson #include <linux/clk-provider.h>
16590b460cSLars Persson #include <linux/regmap.h>
17590b460cSLars Persson #include <linux/smp.h>
18590b460cSLars Persson #include <asm/smp_scu.h>
19590b460cSLars Persson #include <asm/mach/arch.h>
20590b460cSLars Persson #include <asm/mach/map.h>
21590b460cSLars Persson #include <asm/psci.h>
22590b460cSLars Persson #include <linux/arm-smccc.h>
23590b460cSLars Persson
24590b460cSLars Persson
25590b460cSLars Persson #define ARTPEC6_DMACFG_REGNUM 0x10
26590b460cSLars Persson #define ARTPEC6_DMACFG_UARTS_BURST 0xff
27590b460cSLars Persson
28590b460cSLars Persson #define SECURE_OP_L2C_WRITEREG 0xb4000001
29590b460cSLars Persson
artpec6_init_machine(void)30590b460cSLars Persson static void __init artpec6_init_machine(void)
31590b460cSLars Persson {
32590b460cSLars Persson struct regmap *regmap;
33590b460cSLars Persson
34590b460cSLars Persson regmap = syscon_regmap_lookup_by_compatible("axis,artpec6-syscon");
35590b460cSLars Persson
36590b460cSLars Persson if (!IS_ERR(regmap)) {
37590b460cSLars Persson /* Use PL011 DMA Burst Request signal instead of DMA
38590b460cSLars Persson * Single Request
39590b460cSLars Persson */
40590b460cSLars Persson regmap_write(regmap, ARTPEC6_DMACFG_REGNUM,
41590b460cSLars Persson ARTPEC6_DMACFG_UARTS_BURST);
42590b460cSLars Persson };
43590b460cSLars Persson }
44590b460cSLars Persson
artpec6_l2c310_write_sec(unsigned long val,unsigned reg)45590b460cSLars Persson static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg)
46590b460cSLars Persson {
47590b460cSLars Persson struct arm_smccc_res res;
48590b460cSLars Persson
49590b460cSLars Persson arm_smccc_smc(SECURE_OP_L2C_WRITEREG, reg, val, 0,
50590b460cSLars Persson 0, 0, 0, 0, &res);
51590b460cSLars Persson
52590b460cSLars Persson WARN_ON(res.a0);
53590b460cSLars Persson }
54590b460cSLars Persson
55590b460cSLars Persson static const char * const artpec6_dt_match[] = {
56590b460cSLars Persson "axis,artpec6",
57590b460cSLars Persson NULL
58590b460cSLars Persson };
59590b460cSLars Persson
60590b460cSLars Persson DT_MACHINE_START(ARTPEC6, "Axis ARTPEC-6 Platform")
61590b460cSLars Persson .l2c_aux_val = 0x0C000000,
62590b460cSLars Persson .l2c_aux_mask = 0xF3FFFFFF,
63590b460cSLars Persson .l2c_write_sec = artpec6_l2c310_write_sec,
64590b460cSLars Persson .init_machine = artpec6_init_machine,
65590b460cSLars Persson .dt_compat = artpec6_dt_match,
66590b460cSLars Persson MACHINE_END
67