1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2017 Linaro Ltd.
5 * Author: Linus Walleij <linus.walleij@linaro.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2, as
9 * published by the Free Software Foundation.
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/mfd/syscon.h>
15 #include <linux/regmap.h>
18 #define GLOBAL_WORD_ID 0x00
19 #define GEMINI_GLOBAL_ARB1_CTRL 0x2c
20 #define GEMINI_ARB1_BURST_MASK GENMASK(21, 16)
21 #define GEMINI_ARB1_BURST_SHIFT 16
22 /* These all define the priority on the BUS2 backplane */
23 #define GEMINI_ARB1_PRIO_MASK GENMASK(9, 0)
24 #define GEMINI_ARB1_DMAC_HIGH_PRIO BIT(0)
25 #define GEMINI_ARB1_IDE_HIGH_PRIO BIT(1)
26 #define GEMINI_ARB1_RAID_HIGH_PRIO BIT(2)
27 #define GEMINI_ARB1_SECURITY_HIGH_PRIO BIT(3)
28 #define GEMINI_ARB1_GMAC0_HIGH_PRIO BIT(4)
29 #define GEMINI_ARB1_GMAC1_HIGH_PRIO BIT(5)
30 #define GEMINI_ARB1_USB0_HIGH_PRIO BIT(6)
31 #define GEMINI_ARB1_USB1_HIGH_PRIO BIT(7)
32 #define GEMINI_ARB1_PCI_HIGH_PRIO BIT(8)
33 #define GEMINI_ARB1_TVE_HIGH_PRIO BIT(9)
35 #define GEMINI_DEFAULT_BURST_SIZE 0x20
36 #define GEMINI_DEFAULT_PRIO (GEMINI_ARB1_GMAC0_HIGH_PRIO | \
37 GEMINI_ARB1_GMAC1_HIGH_PRIO)
39 static int __init
gemini_soc_init(void)
46 /* Multiplatform guard, only proceed on Gemini */
47 if (!of_machine_is_compatible("cortina,gemini"))
50 map
= syscon_regmap_lookup_by_compatible("cortina,gemini-syscon");
53 ret
= regmap_read(map
, GLOBAL_WORD_ID
, &rev
);
57 val
= (GEMINI_DEFAULT_BURST_SIZE
<< GEMINI_ARB1_BURST_SHIFT
) |
60 /* Set up system arbitration */
61 regmap_update_bits(map
,
62 GEMINI_GLOBAL_ARB1_CTRL
,
63 GEMINI_ARB1_BURST_MASK
| GEMINI_ARB1_PRIO_MASK
,
66 pr_info("Gemini SoC %04x revision %02x, set arbitration %08x\n",
67 rev
>> 8, rev
& 0xff, val
);
71 subsys_initcall(gemini_soc_init
);