blob: f18595dc1311cb80118a6fa0587f536c4db331ab [file] [log] [blame]
Masahiro Yamada063eb1e2016-04-21 14:43:18 +09001/*
2 * Initialization of ARM Corelink CCI-500 Cache Coherency Interconnect
3 *
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +09004 * Copyright (C) 2016 Socionext Inc.
5 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada063eb1e2016-04-21 14:43:18 +09006 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090010#include <linux/bitops.h>
11#include <linux/io.h>
12#include <linux/sizes.h>
13
14#define CCI500_BASE 0x5FD00000
15#define CCI500_SLAVE_OFFSET 0x1000
16
17#define CCI500_SNOOP_CTRL
18#define CCI500_SNOOP_CTRL_EN_DVM BIT(1)
19#define CCI500_SNOOP_CTRL_EN_SNOOP BIT(0)
20
21void cci500_init(unsigned int nr_slaves)
22{
23 unsigned long slave_base = CCI500_BASE + CCI500_SLAVE_OFFSET;
24 int i;
25
26 for (i = 0; i < nr_slaves; i++) {
27 void __iomem *base;
28 u32 tmp;
29
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +090030 base = ioremap(slave_base, SZ_4K);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090031
32 tmp = readl(base);
33 tmp |= CCI500_SNOOP_CTRL_EN_DVM | CCI500_SNOOP_CTRL_EN_SNOOP;
34 writel(tmp, base);
35
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +090036 iounmap(base);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090037
38 slave_base += CCI500_SLAVE_OFFSET;
39 }
40}