Add preliminary RouterBoard RB1xx support
[openwrt/svn-archive/archive.git] / target / linux / rb1xx-2.6 / files / include / asm-mips / mach-adm5120 / adm5120_switch.h
1 /*
2 * ADM5120 ethernet switch definitions
3 *
4 * This header file defines the hardware registers of the ADM5120 SoC
5 * built-in Ethernet switch.
6 *
7 * Copyright (C) 2007 OpenWrt.org
8 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24 */
25
26 #ifndef _ADM5120_SWITCH_H
27 #define _ADM5120_SWITCH_H
28
29 #define BITMASK(len) ((1 << (len))-1)
30 #define ONEBIT(at) (1 << (at))
31
32 /* Switch register offsets */
33 #define SWITCH_REG_CODE 0x0000
34 #define SWITCH_REG_SOFT_RESET 0x0004
35 #define SWITCH_REG_MEMCTRL 0x001C
36 #define SWITCH_REG_CPUP_CONF 0x0024
37 #define SWITCH_REG_PORT_CONF0 0x0028
38 #define SWITCH_REG_PORT_CONF1 0x002C
39 #define SWITCH_REG_PORT_CONF2 0x0030
40 #define SWITCH_REG_VLAN_G1 0x0040
41 #define SWITCH_REG_VLAN_G2 0x0044
42 #define SWITCH_REG_SEND_TRIG 0x0048
43 #define SWITCH_REG_MAC_WT0 0x0058
44 #define SWITCH_REG_MAC_WT1 0x005C
45 #define SWITCH_REG_PHY_CNTL0 0x0068
46 #define SWITCH_REG_PHY_CNTL1 0x006C
47 #define SWITCH_REG_PHY_CNTL2 0x007C
48 #define SWITCH_REG_PHY_CNTL3 0x0080
49 #define SWITCH_REG_PRI_CNTL 0x0084
50 #define SWITCH_REG_INT_STATUS 0x00B0
51 #define SWITCH_REG_INT_MASK 0x00B4
52 #define SWITCH_REG_GPIO_CONF0 0x00B8
53 #define SWITCH_REG_GPIO_CONF2 0x00BC
54 #define SWITCH_REG_WDOG0 0x00C0
55 #define SWITCH_REG_WDOG1 0x00C4
56 #define SWITCH_REG_PHY_CNTL4 0x00A0
57
58 #define SWITCH_REG_SEND_HBADDR 0x00D0
59 #define SWITCH_REG_SEND_LBADDR 0x00D4
60 #define SWITCH_REG_RECV_HBADDR 0x00D8
61 #define SWITCH_REG_RECV_LBADDR 0x00DC
62
63 #define SWITCH_REG_TIMER_INT 0x00F0
64 #define SWITCH_REG_TIMER 0x00F4
65
66 #define SWITCH_REG_PORT0_LED 0x0100
67 #define SWITCH_REG_PORT1_LED 0x0104
68 #define SWITCH_REG_PORT2_LED 0x0108
69 #define SWITCH_REG_PORT3_LED 0x010C
70 #define SWITCH_REG_PORT4_LED 0x0110
71
72 /* CODE register bits */
73 #define CODE_PC_MASK BITMASK(16) /* Product Code */
74 #define CODE_REV_SHIFT 16
75 #define CODE_REV_MASK BITMASK(4) /* Product Revision */
76 #define CODE_CLKS_SHIFT 20
77 #define CODE_CLKS_MASK BITMASK(2) /* Clock Speed */
78 #define CODE_CLKS_175 0 /* 175 MHz */
79 #define CODE_CLKS_200 1 /* 200 MHz */
80 #define CODE_CLKS_225 2 /* 225 MHz */
81 #define CODE_CLKS_250 3 /* 250 MHz */
82 #define CODE_NAB ONEBIT(24) /* NAND boot */
83 #define CODE_PK_MASK BITMASK(1) /* Package type */
84 #define CODE_PK_SHIFT 29
85 #define CODE_PK_BGA 0 /* BGA package */
86 #define CODE_PK_PQFP 1 /* PQFP package */
87
88
89 #endif /* _ADM5120_SWITCH_H */