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