1 /*
2  * ARTPEC-6 device support.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  */
8 
9 #include <linux/amba/bus.h>
10 #include <linux/clocksource.h>
11 #include <linux/dma-mapping.h>
12 #include <linux/io.h>
13 #include <linux/irqchip.h>
14 #include <linux/irqchip/arm-gic.h>
15 #include <linux/mfd/syscon.h>
16 #include <linux/of.h>
17 #include <linux/of_address.h>
18 #include <linux/clk-provider.h>
19 #include <linux/regmap.h>
20 #include <linux/smp.h>
21 #include <asm/smp_scu.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/map.h>
24 #include <asm/psci.h>
25 #include <linux/arm-smccc.h>
26 
27 
28 #define ARTPEC6_DMACFG_REGNUM 0x10
29 #define ARTPEC6_DMACFG_UARTS_BURST 0xff
30 
31 #define SECURE_OP_L2C_WRITEREG 0xb4000001
32 
33 static void __init artpec6_init_machine(void)
34 {
35 	struct regmap *regmap;
36 
37 	regmap = syscon_regmap_lookup_by_compatible("axis,artpec6-syscon");
38 
39 	if (!IS_ERR(regmap)) {
40 		/* Use PL011 DMA Burst Request signal instead of DMA
41 		 *  Single Request
42 		 */
43 		regmap_write(regmap, ARTPEC6_DMACFG_REGNUM,
44 			     ARTPEC6_DMACFG_UARTS_BURST);
45 	};
46 }
47 
48 static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg)
49 {
50 	struct arm_smccc_res res;
51 
52 	arm_smccc_smc(SECURE_OP_L2C_WRITEREG, reg, val, 0,
53 		      0, 0, 0, 0, &res);
54 
55 	WARN_ON(res.a0);
56 }
57 
58 static const char * const artpec6_dt_match[] = {
59 	"axis,artpec6",
60 	NULL
61 };
62 
63 DT_MACHINE_START(ARTPEC6, "Axis ARTPEC-6 Platform")
64 	.l2c_aux_val	= 0x0C000000,
65 	.l2c_aux_mask	= 0xF3FFFFFF,
66 	.l2c_write_sec  = artpec6_l2c310_write_sec,
67 	.init_machine	= artpec6_init_machine,
68 	.dt_compat	= artpec6_dt_match,
69 MACHINE_END
70