Lars Persson | 590b460 | 2016-02-11 17:06:19 +0100 | [diff] [blame] | 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_platform.h> |
| 17 | #include <linux/of.h> |
| 18 | #include <linux/of_address.h> |
| 19 | #include <linux/clk-provider.h> |
| 20 | #include <linux/regmap.h> |
| 21 | #include <linux/smp.h> |
| 22 | #include <asm/smp_scu.h> |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/mach/map.h> |
| 25 | #include <asm/psci.h> |
| 26 | #include <linux/arm-smccc.h> |
| 27 | |
| 28 | |
| 29 | #define ARTPEC6_DMACFG_REGNUM 0x10 |
| 30 | #define ARTPEC6_DMACFG_UARTS_BURST 0xff |
| 31 | |
| 32 | #define SECURE_OP_L2C_WRITEREG 0xb4000001 |
| 33 | |
| 34 | static void __init artpec6_init_machine(void) |
| 35 | { |
| 36 | struct regmap *regmap; |
| 37 | |
| 38 | regmap = syscon_regmap_lookup_by_compatible("axis,artpec6-syscon"); |
| 39 | |
| 40 | if (!IS_ERR(regmap)) { |
| 41 | /* Use PL011 DMA Burst Request signal instead of DMA |
| 42 | * Single Request |
| 43 | */ |
| 44 | regmap_write(regmap, ARTPEC6_DMACFG_REGNUM, |
| 45 | ARTPEC6_DMACFG_UARTS_BURST); |
| 46 | }; |
| 47 | |
| 48 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 49 | } |
| 50 | |
| 51 | static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg) |
| 52 | { |
| 53 | struct arm_smccc_res res; |
| 54 | |
| 55 | arm_smccc_smc(SECURE_OP_L2C_WRITEREG, reg, val, 0, |
| 56 | 0, 0, 0, 0, &res); |
| 57 | |
| 58 | WARN_ON(res.a0); |
| 59 | } |
| 60 | |
| 61 | static const char * const artpec6_dt_match[] = { |
| 62 | "axis,artpec6", |
| 63 | NULL |
| 64 | }; |
| 65 | |
| 66 | DT_MACHINE_START(ARTPEC6, "Axis ARTPEC-6 Platform") |
| 67 | .l2c_aux_val = 0x0C000000, |
| 68 | .l2c_aux_mask = 0xF3FFFFFF, |
| 69 | .l2c_write_sec = artpec6_l2c310_write_sec, |
| 70 | .init_machine = artpec6_init_machine, |
| 71 | .dt_compat = artpec6_dt_match, |
| 72 | MACHINE_END |