18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ARTPEC-6 device support. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/amba/bus.h> 78c2ecf20Sopenharmony_ci#include <linux/clocksource.h> 88c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h> 98c2ecf20Sopenharmony_ci#include <linux/io.h> 108c2ecf20Sopenharmony_ci#include <linux/irqchip.h> 118c2ecf20Sopenharmony_ci#include <linux/irqchip/arm-gic.h> 128c2ecf20Sopenharmony_ci#include <linux/mfd/syscon.h> 138c2ecf20Sopenharmony_ci#include <linux/of.h> 148c2ecf20Sopenharmony_ci#include <linux/of_address.h> 158c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 168c2ecf20Sopenharmony_ci#include <linux/regmap.h> 178c2ecf20Sopenharmony_ci#include <linux/smp.h> 188c2ecf20Sopenharmony_ci#include <asm/smp_scu.h> 198c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 208c2ecf20Sopenharmony_ci#include <asm/mach/map.h> 218c2ecf20Sopenharmony_ci#include <asm/psci.h> 228c2ecf20Sopenharmony_ci#include <linux/arm-smccc.h> 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define ARTPEC6_DMACFG_REGNUM 0x10 268c2ecf20Sopenharmony_ci#define ARTPEC6_DMACFG_UARTS_BURST 0xff 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define SECURE_OP_L2C_WRITEREG 0xb4000001 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic void __init artpec6_init_machine(void) 318c2ecf20Sopenharmony_ci{ 328c2ecf20Sopenharmony_ci struct regmap *regmap; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci regmap = syscon_regmap_lookup_by_compatible("axis,artpec6-syscon"); 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci if (!IS_ERR(regmap)) { 378c2ecf20Sopenharmony_ci /* Use PL011 DMA Burst Request signal instead of DMA 388c2ecf20Sopenharmony_ci * Single Request 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci regmap_write(regmap, ARTPEC6_DMACFG_REGNUM, 418c2ecf20Sopenharmony_ci ARTPEC6_DMACFG_UARTS_BURST); 428c2ecf20Sopenharmony_ci }; 438c2ecf20Sopenharmony_ci} 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic void artpec6_l2c310_write_sec(unsigned long val, unsigned reg) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci struct arm_smccc_res res; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci arm_smccc_smc(SECURE_OP_L2C_WRITEREG, reg, val, 0, 508c2ecf20Sopenharmony_ci 0, 0, 0, 0, &res); 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci WARN_ON(res.a0); 538c2ecf20Sopenharmony_ci} 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic const char * const artpec6_dt_match[] = { 568c2ecf20Sopenharmony_ci "axis,artpec6", 578c2ecf20Sopenharmony_ci NULL 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ciDT_MACHINE_START(ARTPEC6, "Axis ARTPEC-6 Platform") 618c2ecf20Sopenharmony_ci .l2c_aux_val = 0x0C000000, 628c2ecf20Sopenharmony_ci .l2c_aux_mask = 0xF3FFFFFF, 638c2ecf20Sopenharmony_ci .l2c_write_sec = artpec6_l2c310_write_sec, 648c2ecf20Sopenharmony_ci .init_machine = artpec6_init_machine, 658c2ecf20Sopenharmony_ci .dt_compat = artpec6_dt_match, 668c2ecf20Sopenharmony_ciMACHINE_END 67