summarylogtreecommitdiffstats
path: root/epiphany.h
blob: 1378296d264388257693ce6937e7d8e2bb1d1f0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef __EPIPHANY_H__
#define __EPIPHANY_H__

#include <uapi/misc/epiphany.h>

/* Epiphany system registers */
enum e_elink_regs {
	ELINK_RESET		= 0xF0200,
	ELINK_CLK		= 0xF0204,
	ELINK_CHIPID		= 0xF0208,
	ELINK_VERSION		= 0xF020C,
	ELINK_TXCFG		= 0xF0210,
	ELINK_TXSTATUS		= 0xF0214,
	ELINK_TXGPIO		= 0xF0218,
	ELINK_TXMONITOR		= 0xF021C,
	ELINK_TXPACKET		= 0xF0220,
	ELINK_RXCFG		= 0xF0300,
	ELINK_RXSTATUS		= 0xF0304,
	ELINK_RXGPIO		= 0xF0308,
	ELINK_RXOFFSET		= 0xF030C,
	ELINK_RXDELAY0		= 0xF0310,
	ELINK_RXDELAY1		= 0xF0314,
	ELINK_RXTESTDATA	= 0xF0318,
	ELINK_MAILBOXLO		= 0xF0730,
	ELINK_MAILBOXHI		= 0xF0734,
	ELINK_MAILBOXSTAT	= 0xF0738,
	ELINK_TXMMU		= 0xE0000,
	ELINK_RXMMU		= 0xE8000,
};

union elink_reset {
	u32 reg;
	struct {
		unsigned tx_reset:1;
		unsigned rx_reset:1;
	};
} __packed;

union elink_chipid {
	u32 reg;
	union {
		struct {
			unsigned corecol:6;
			unsigned corerow:6;
		};
		struct {
			unsigned:2;
			unsigned chipcol;
			unsigned:2;
			unsigned chiprow;
		};
	};
} __packed;

union elink_version {
	u32 reg;
	struct {
		unsigned platform:8;
		unsigned revision:8;
	};
} __packed;

union elink_txcfg {
	u32 reg;
	struct {
		unsigned enable:1;
		unsigned mmu_enable:1;
		unsigned remap_mode:2;
		unsigned ctrlmode:4;
		unsigned:1;
		unsigned ctrlmode_bypass:1;
		unsigned burst_enable:1;
		unsigned transmit_mode:2;
	};
} __packed;

union elink_rxcfg {
	u32 reg;
	struct {
		unsigned test_mode:1;
		unsigned mmu_enable:1;
		unsigned remap_mode:2;
		unsigned remap_sel:12;
		unsigned remap_pattern:12;
		unsigned mailbox_irq_en:1;
	};
} __packed;

union elink_mailboxstat {
	u32 reg;
	struct {
		unsigned not_empty:1;
		unsigned full:1;
		unsigned half_full:1;
		unsigned:13;
		u16 count;
	};
} __packed;

/* Chip registers */
enum e_chip_regs {
	E_REG_LINKCFG		= 0xf0300,
	E_REG_LINKTXCFG		= 0xf0304,
	E_REG_LINKRXCFG		= 0xf0308,
	E_REG_GPIOCFG		= 0xf030c,
	E_REG_FLAGCFG		= 0xf0318,
	E_REG_SYNC		= 0xf031c,
	E_REG_HALT		= 0xf0320,
	E_REG_RESET		= 0xf0324,
	E_REG_LINKDEBUG		= 0xf0328
};

enum e_ctrlmode {
	E_CTRLMODE_NORMAL	= 0,
	E_CTRLMODE_DMA0_LAST	= 4,
	E_CTRLMODE_DMA1_LAST	= 8,
	E_CTRLMODE_MSGMODE	= 12,
	E_CTRLMODE_MULTICAST	= 3,
	E_CTRLMODE_NORTH	= 1,
	E_CTRLMODE_EAST		= 5,
	E_CTRLMODE_SOUTH	= 9,
	E_CTRLMODE_WEST		= 13
};

enum e_core_reg {
	E_REG_BASE		= 0xf0000,
	E_REG_CONFIG		= 0xf0400,
	E_REG_MESHCONFIG	= 0xf0700
};

#endif /* __EPIPHANY_H__ */