Skip to content

Commit 1ee603b

Browse files
committed
ARC: [xplorer] Add support for ARC Xplorer System
The ARC Xplorer System consists of a mainboard with peripherals, on which several daughter cards can be placed. This adds support for the mainboard in combination with an ARC 770D CPU tile. Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
1 parent 4cceeba commit 1ee603b

File tree

5 files changed

+222
-0
lines changed

5 files changed

+222
-0
lines changed

arch/arc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ menu "ARC Platform/SoC/Board"
7979

8080
source "arch/arc/plat-arcfpga/Kconfig"
8181
source "arch/arc/plat-tb10x/Kconfig"
82+
source "arch/arc/plat-xplorer/Kconfig"
8283
#New platform adds here
8384

8485
endmenu

arch/arc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ core-y += arch/arc/boot/dts/
9898

9999
core-$(CONFIG_ARC_PLAT_FPGA_LEGACY) += arch/arc/plat-arcfpga/
100100
core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
101+
core-$(CONFIG_ARC_PLAT_XPLORER) += arch/arc/plat-xplorer/
101102

102103
drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/
103104

arch/arc/plat-xplorer/Kconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
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+
config ARC_PLAT_XPLORER
10+
bool "Synopsys ARC Xplorer System"
11+
select COMMON_CLK
12+
select DW_APB_ICTL
13+
help
14+
Support for the ARC Xplorer System.
15+
16+
The ARC Xplorer System consists of a mainboard with peripherals,
17+
on which several daughter cards can be placed. The daughter cards
18+
typically contain a CPU and memory.
19+
20+
if ARC_PLAT_XPLORER
21+
22+
config XPLORER_CPUTILE_770
23+
select DW_APB_GPIO_INTC
24+
bool "ARC Xplorer CPU Tile with 770D/EM6/AS221"
25+
help
26+
This adds support for the 770D/EM6/AS221 CPU Tile. Only the ARC
27+
770D is supported in Linux.
28+
29+
The ARC Xplorer System 770D/EM6/AS221 consists of an ARC Xplorer
30+
System mainboard with this daughtercard. Please use the
31+
xplorer_system_770.dts device tree with this configuration.
32+
33+
endif

arch/arc/plat-xplorer/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
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+
obj-$(CONFIG_XPLORER_CPUTILE_770) += xplorer770.o

arch/arc/plat-xplorer/xplorer770.c

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
/*
2+
* ARC Xplorer System 770D/EM6/AS221 platform specific code
3+
*
4+
* Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
5+
*
6+
* Mischa Jonker <mjonker@synopsys.com>
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License version 2 as
10+
* published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
*/
21+
22+
#include <linux/init.h>
23+
#include <linux/clk-provider.h>
24+
#include <linux/of_platform.h>
25+
#include <asm/mach_desc.h>
26+
#include <asm/io.h>
27+
28+
#define CPUTILE_CREG 0xf0001000
29+
#define FPGA_CREG 0xe0011000
30+
31+
static const char *xplorer770_compat[] __initdata = {
32+
"snps,xplorer770",
33+
NULL,
34+
};
35+
36+
#define CPUTILE_SLV_NONE 0
37+
#define CPUTILE_SLV_DDR_PORT0 1
38+
#define CPUTILE_SLV_SRAM 2
39+
#define CPUTILE_SLV_AXI_TUNNEL 3
40+
#define CPUTILE_SLV_EM6_ICCM 4
41+
#define CPUTILE_SLV_EM6_DCCM 5
42+
#define CPUTILE_SLV_AXI2APB 6
43+
#define CPUTILE_SLV_DDR_PORT1 7
44+
45+
#define FPGA_SLV_AXI_TUNNEL_1 1
46+
#define FPGA_SLV_AXI_TUNNEL_2 2
47+
#define FPGA_SLV_SRAM 3
48+
#define FPGA_SLV_CONTROL 4
49+
50+
static const int cputile_memmap[16][2] = {
51+
{CPUTILE_SLV_EM6_ICCM, 0x0}, /* 0x0000.0000 */
52+
{CPUTILE_SLV_SRAM, 0x0}, /* 0x1000.0000 */
53+
{CPUTILE_SLV_AXI_TUNNEL, 0x2}, /* 0x2000.0000 */
54+
{CPUTILE_SLV_AXI_TUNNEL, 0x3}, /* 0x3000.0000 */
55+
{CPUTILE_SLV_AXI_TUNNEL, 0x4}, /* 0x4000.0000 */
56+
{CPUTILE_SLV_AXI_TUNNEL, 0x5}, /* 0x5000.0000 */
57+
{CPUTILE_SLV_AXI_TUNNEL, 0x6}, /* 0x6000.0000 */
58+
{CPUTILE_SLV_AXI_TUNNEL, 0x7}, /* 0x7000.0000 */
59+
{CPUTILE_SLV_DDR_PORT0, 0x0}, /* 0x8000.0000 */
60+
{CPUTILE_SLV_DDR_PORT0, 0x1}, /* 0x9000.0000 */
61+
{CPUTILE_SLV_DDR_PORT0, 0x2}, /* 0xA000.0000 */
62+
{CPUTILE_SLV_DDR_PORT0, 0x3}, /* 0xB000.0000 */
63+
{CPUTILE_SLV_AXI_TUNNEL, 0xC}, /* 0xC000.0000 */
64+
{CPUTILE_SLV_AXI_TUNNEL, 0xD}, /* 0xD000.0000 */
65+
{CPUTILE_SLV_AXI_TUNNEL, 0xE}, /* 0xE000.0000 */
66+
{CPUTILE_SLV_AXI2APB, 0x0}, /* 0xF000.0000 */
67+
};
68+
69+
static const int cputile_axi_tunnel_memmap[16][2] = {
70+
{CPUTILE_SLV_EM6_ICCM, 0x0}, /* 0x0000.0000 */
71+
{CPUTILE_SLV_SRAM, 0x0}, /* 0x1000.0000 */
72+
{CPUTILE_SLV_NONE, 0x0}, /* 0x2000.0000 */
73+
{CPUTILE_SLV_NONE, 0x0}, /* 0x3000.0000 */
74+
{CPUTILE_SLV_NONE, 0x0}, /* 0x4000.0000 */
75+
{CPUTILE_SLV_NONE, 0x0}, /* 0x5000.0000 */
76+
{CPUTILE_SLV_NONE, 0x0}, /* 0x6000.0000 */
77+
{CPUTILE_SLV_NONE, 0x0}, /* 0x7000.0000 */
78+
{CPUTILE_SLV_DDR_PORT0, 0x0}, /* 0x8000.0000 */
79+
{CPUTILE_SLV_DDR_PORT0, 0x1}, /* 0x9000.0000 */
80+
{CPUTILE_SLV_DDR_PORT0, 0x2}, /* 0xA000.0000 */
81+
{CPUTILE_SLV_DDR_PORT0, 0x3}, /* 0xB000.0000 */
82+
{CPUTILE_SLV_NONE, 0x0}, /* 0xC000.0000 */
83+
{CPUTILE_SLV_NONE, 0x0}, /* 0xD000.0000 */
84+
{CPUTILE_SLV_NONE, 0x0}, /* 0xE000.0000 */
85+
{CPUTILE_SLV_AXI2APB, 0x0}, /* 0xF000.0000 */
86+
};
87+
88+
static const int fpga_memmap[16][2] = {
89+
{FPGA_SLV_SRAM, 0x0}, /* 0x0000.0000 */
90+
{FPGA_SLV_AXI_TUNNEL_1, 0x1}, /* 0x1000.0000 */
91+
{FPGA_SLV_AXI_TUNNEL_1, 0x2}, /* 0x2000.0000 */
92+
{FPGA_SLV_AXI_TUNNEL_1, 0x3}, /* 0x3000.0000 */
93+
{FPGA_SLV_AXI_TUNNEL_1, 0x4}, /* 0x4000.0000 */
94+
{FPGA_SLV_AXI_TUNNEL_1, 0x5}, /* 0x5000.0000 */
95+
{FPGA_SLV_AXI_TUNNEL_1, 0x6}, /* 0x6000.0000 */
96+
{FPGA_SLV_AXI_TUNNEL_1, 0x7}, /* 0x7000.0000 */
97+
{FPGA_SLV_AXI_TUNNEL_1, 0x8}, /* 0x8000.0000 */
98+
{FPGA_SLV_AXI_TUNNEL_1, 0x9}, /* 0x9000.0000 */
99+
{FPGA_SLV_AXI_TUNNEL_1, 0xA}, /* 0xA000.0000 */
100+
{FPGA_SLV_AXI_TUNNEL_1, 0xB}, /* 0xB000.0000 */
101+
{FPGA_SLV_AXI_TUNNEL_1, 0xC}, /* 0xC000.0000 */
102+
{FPGA_SLV_AXI_TUNNEL_1, 0xD}, /* 0xD000.0000 */
103+
{FPGA_SLV_CONTROL, 0x0}, /* 0xE000.0000 */
104+
{FPGA_SLV_AXI_TUNNEL_1, 0xF}, /* 0xF000.0000 */
105+
};
106+
107+
/*
108+
* base + 0x00 : slave select (low 32 bits)
109+
* base + 0x04 : slave select (high 32 bits)
110+
* base + 0x08 : slave offset (low 32 bits)
111+
* base + 0x0C : slave offset (high 32 bits)
112+
*/
113+
static void xplorer770_set_memmap(void __iomem *base, const int memmap[16][2])
114+
{
115+
int i;
116+
u64 slave_select, slave_offset;
117+
118+
slave_select = slave_offset = 0;
119+
for (i = 0; i < 16; i++) {
120+
slave_select |= ((u64) memmap[i][0]) << (i << 2);
121+
slave_offset |= ((u64) memmap[i][1]) << (i << 2);
122+
}
123+
iowrite32(slave_select & 0xffffffff, base + 0x0);
124+
iowrite32(slave_select >> 32, base + 0x4);
125+
iowrite32(slave_offset & 0xffffffff, base + 0x8);
126+
iowrite32(slave_offset >> 32, base + 0xC);
127+
}
128+
129+
static void xplorer770_early_init(void)
130+
{
131+
int i;
132+
133+
/* ARC 770D memory view */
134+
xplorer770_set_memmap((void __iomem *) CPUTILE_CREG + 0x20,
135+
cputile_memmap);
136+
137+
iowrite32(1, (void __iomem *) CPUTILE_CREG + 0x34); /* Update */
138+
139+
/* AXI tunnel memory view (incoming traffic from FPGA into CPU tile) */
140+
xplorer770_set_memmap((void __iomem *) CPUTILE_CREG + 0x60,
141+
cputile_axi_tunnel_memmap);
142+
143+
iowrite32(1, (void __iomem *) CPUTILE_CREG + 0x74); /* Update */
144+
145+
/* FPGA DMA peripherals memory view
146+
(incoming traffic from FPGA peripherals towards FPGA bus) */
147+
for (i = 0; i <= 10; i++)
148+
xplorer770_set_memmap((void __iomem *) FPGA_CREG + (i << 4),
149+
fpga_memmap);
150+
151+
iowrite32(0x3ff, (void __iomem *) FPGA_CREG + 0x100); /* Update */
152+
153+
/* GPIO pins 18 and 19 are used as UART rx and tx, respectively. */
154+
iowrite32(0x01, (void __iomem *) CPUTILE_CREG + 0x120);
155+
156+
/* Set up the FPGA interrupt system.*/
157+
/* FPGA mux interrupts to GPIO7) */
158+
iowrite32(0x01, (void __iomem *) FPGA_CREG + 0x214);
159+
160+
/* reset ethernet and ULPI interfaces */
161+
iowrite32(0x18, (void __iomem *) FPGA_CREG + 0x220);
162+
163+
/* map GPIO 14:10 to ARC 9:5 (IRQ mux change for rev 2 boards) */
164+
iowrite32(0x52, (void __iomem *) CPUTILE_CREG + 0x114);
165+
}
166+
167+
static void xplorer770_plat_init(void)
168+
{
169+
of_clk_init(NULL);
170+
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
171+
}
172+
173+
MACHINE_START(XPLORER770, "xplorer770")
174+
.dt_compat = xplorer770_compat,
175+
.init_early = xplorer770_early_init,
176+
.init_machine = xplorer770_plat_init,
177+
.init_irq = NULL,
178+
MACHINE_END

0 commit comments

Comments
 (0)