1f7917c00SJeff Kirsher /*****************************************************************************
2f7917c00SJeff Kirsher  *                                                                           *
3f7917c00SJeff Kirsher  * File: elmer0.h                                                            *
4f7917c00SJeff Kirsher  * $Revision: 1.6 $                                                          *
5f7917c00SJeff Kirsher  * $Date: 2005/06/21 22:49:43 $                                              *
6f7917c00SJeff Kirsher  * Description:                                                              *
7f7917c00SJeff Kirsher  *  part of the Chelsio 10Gb Ethernet Driver.                                *
8f7917c00SJeff Kirsher  *                                                                           *
9f7917c00SJeff Kirsher  * This program is free software; you can redistribute it and/or modify      *
10f7917c00SJeff Kirsher  * it under the terms of the GNU General Public License, version 2, as       *
11f7917c00SJeff Kirsher  * published by the Free Software Foundation.                                *
12f7917c00SJeff Kirsher  *                                                                           *
13f7917c00SJeff Kirsher  * You should have received a copy of the GNU General Public License along   *
14f7917c00SJeff Kirsher  * with this program; if not, write to the Free Software Foundation, Inc.,   *
15f7917c00SJeff Kirsher  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 *
16f7917c00SJeff Kirsher  *                                                                           *
17f7917c00SJeff Kirsher  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED    *
18f7917c00SJeff Kirsher  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF      *
19f7917c00SJeff Kirsher  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.                     *
20f7917c00SJeff Kirsher  *                                                                           *
21f7917c00SJeff Kirsher  * http://www.chelsio.com                                                    *
22f7917c00SJeff Kirsher  *                                                                           *
23f7917c00SJeff Kirsher  * Copyright (c) 2003 - 2005 Chelsio Communications, Inc.                    *
24f7917c00SJeff Kirsher  * All rights reserved.                                                      *
25f7917c00SJeff Kirsher  *                                                                           *
26f7917c00SJeff Kirsher  * Maintainers: maintainers@chelsio.com                                      *
27f7917c00SJeff Kirsher  *                                                                           *
28f7917c00SJeff Kirsher  * Authors: Dimitrios Michailidis   <dm@chelsio.com>                         *
29f7917c00SJeff Kirsher  *          Tina Yang               <tainay@chelsio.com>                     *
30f7917c00SJeff Kirsher  *          Felix Marti             <felix@chelsio.com>                      *
31f7917c00SJeff Kirsher  *          Scott Bardone           <sbardone@chelsio.com>                   *
32f7917c00SJeff Kirsher  *          Kurt Ottaway            <kottaway@chelsio.com>                   *
33f7917c00SJeff Kirsher  *          Frank DiMambro          <frank@chelsio.com>                      *
34f7917c00SJeff Kirsher  *                                                                           *
35f7917c00SJeff Kirsher  * History:                                                                  *
36f7917c00SJeff Kirsher  *                                                                           *
37f7917c00SJeff Kirsher  ****************************************************************************/
38f7917c00SJeff Kirsher 
39f7917c00SJeff Kirsher #ifndef _CXGB_ELMER0_H_
40f7917c00SJeff Kirsher #define _CXGB_ELMER0_H_
41f7917c00SJeff Kirsher 
42f7917c00SJeff Kirsher /* ELMER0 flavors */
43f7917c00SJeff Kirsher enum {
44f7917c00SJeff Kirsher 	ELMER0_XC2S300E_6FT256_C,
45f7917c00SJeff Kirsher 	ELMER0_XC2S100E_6TQ144_C
46f7917c00SJeff Kirsher };
47f7917c00SJeff Kirsher 
48f7917c00SJeff Kirsher /* ELMER0 registers */
49f7917c00SJeff Kirsher #define A_ELMER0_VERSION	0x100000
50f7917c00SJeff Kirsher #define A_ELMER0_PHY_CFG	0x100004
51f7917c00SJeff Kirsher #define A_ELMER0_INT_ENABLE	0x100008
52f7917c00SJeff Kirsher #define A_ELMER0_INT_CAUSE	0x10000c
53f7917c00SJeff Kirsher #define A_ELMER0_GPI_CFG	0x100010
54f7917c00SJeff Kirsher #define A_ELMER0_GPI_STAT	0x100014
55f7917c00SJeff Kirsher #define A_ELMER0_GPO		0x100018
56f7917c00SJeff Kirsher #define A_ELMER0_PORT0_MI1_CFG	0x400000
57f7917c00SJeff Kirsher 
58f7917c00SJeff Kirsher #define S_MI1_MDI_ENABLE    0
59f7917c00SJeff Kirsher #define V_MI1_MDI_ENABLE(x) ((x) << S_MI1_MDI_ENABLE)
60f7917c00SJeff Kirsher #define F_MI1_MDI_ENABLE    V_MI1_MDI_ENABLE(1U)
61f7917c00SJeff Kirsher 
62f7917c00SJeff Kirsher #define S_MI1_MDI_INVERT    1
63f7917c00SJeff Kirsher #define V_MI1_MDI_INVERT(x) ((x) << S_MI1_MDI_INVERT)
64f7917c00SJeff Kirsher #define F_MI1_MDI_INVERT    V_MI1_MDI_INVERT(1U)
65f7917c00SJeff Kirsher 
66f7917c00SJeff Kirsher #define S_MI1_PREAMBLE_ENABLE    2
67f7917c00SJeff Kirsher #define V_MI1_PREAMBLE_ENABLE(x) ((x) << S_MI1_PREAMBLE_ENABLE)
68f7917c00SJeff Kirsher #define F_MI1_PREAMBLE_ENABLE    V_MI1_PREAMBLE_ENABLE(1U)
69f7917c00SJeff Kirsher 
70f7917c00SJeff Kirsher #define S_MI1_SOF    3
71f7917c00SJeff Kirsher #define M_MI1_SOF    0x3
72f7917c00SJeff Kirsher #define V_MI1_SOF(x) ((x) << S_MI1_SOF)
73f7917c00SJeff Kirsher #define G_MI1_SOF(x) (((x) >> S_MI1_SOF) & M_MI1_SOF)
74f7917c00SJeff Kirsher 
75f7917c00SJeff Kirsher #define S_MI1_CLK_DIV    5
76f7917c00SJeff Kirsher #define M_MI1_CLK_DIV    0xff
77f7917c00SJeff Kirsher #define V_MI1_CLK_DIV(x) ((x) << S_MI1_CLK_DIV)
78f7917c00SJeff Kirsher #define G_MI1_CLK_DIV(x) (((x) >> S_MI1_CLK_DIV) & M_MI1_CLK_DIV)
79f7917c00SJeff Kirsher 
80f7917c00SJeff Kirsher #define A_ELMER0_PORT0_MI1_ADDR 0x400004
81f7917c00SJeff Kirsher 
82f7917c00SJeff Kirsher #define S_MI1_REG_ADDR    0
83f7917c00SJeff Kirsher #define M_MI1_REG_ADDR    0x1f
84f7917c00SJeff Kirsher #define V_MI1_REG_ADDR(x) ((x) << S_MI1_REG_ADDR)
85f7917c00SJeff Kirsher #define G_MI1_REG_ADDR(x) (((x) >> S_MI1_REG_ADDR) & M_MI1_REG_ADDR)
86f7917c00SJeff Kirsher 
87f7917c00SJeff Kirsher #define S_MI1_PHY_ADDR    5
88f7917c00SJeff Kirsher #define M_MI1_PHY_ADDR    0x1f
89f7917c00SJeff Kirsher #define V_MI1_PHY_ADDR(x) ((x) << S_MI1_PHY_ADDR)
90f7917c00SJeff Kirsher #define G_MI1_PHY_ADDR(x) (((x) >> S_MI1_PHY_ADDR) & M_MI1_PHY_ADDR)
91f7917c00SJeff Kirsher 
92f7917c00SJeff Kirsher #define A_ELMER0_PORT0_MI1_DATA 0x400008
93f7917c00SJeff Kirsher 
94f7917c00SJeff Kirsher #define S_MI1_DATA    0
95f7917c00SJeff Kirsher #define M_MI1_DATA    0xffff
96f7917c00SJeff Kirsher #define V_MI1_DATA(x) ((x) << S_MI1_DATA)
97f7917c00SJeff Kirsher #define G_MI1_DATA(x) (((x) >> S_MI1_DATA) & M_MI1_DATA)
98f7917c00SJeff Kirsher 
99f7917c00SJeff Kirsher #define A_ELMER0_PORT0_MI1_OP 0x40000c
100f7917c00SJeff Kirsher 
101f7917c00SJeff Kirsher #define S_MI1_OP    0
102f7917c00SJeff Kirsher #define M_MI1_OP    0x3
103f7917c00SJeff Kirsher #define V_MI1_OP(x) ((x) << S_MI1_OP)
104f7917c00SJeff Kirsher #define G_MI1_OP(x) (((x) >> S_MI1_OP) & M_MI1_OP)
105f7917c00SJeff Kirsher 
106f7917c00SJeff Kirsher #define S_MI1_ADDR_AUTOINC    2
107f7917c00SJeff Kirsher #define V_MI1_ADDR_AUTOINC(x) ((x) << S_MI1_ADDR_AUTOINC)
108f7917c00SJeff Kirsher #define F_MI1_ADDR_AUTOINC    V_MI1_ADDR_AUTOINC(1U)
109f7917c00SJeff Kirsher 
110f7917c00SJeff Kirsher #define S_MI1_OP_BUSY    31
111f7917c00SJeff Kirsher #define V_MI1_OP_BUSY(x) ((x) << S_MI1_OP_BUSY)
112f7917c00SJeff Kirsher #define F_MI1_OP_BUSY    V_MI1_OP_BUSY(1U)
113f7917c00SJeff Kirsher 
114f7917c00SJeff Kirsher #define A_ELMER0_PORT1_MI1_CFG	0x500000
115f7917c00SJeff Kirsher #define A_ELMER0_PORT1_MI1_ADDR	0x500004
116f7917c00SJeff Kirsher #define A_ELMER0_PORT1_MI1_DATA	0x500008
117f7917c00SJeff Kirsher #define A_ELMER0_PORT1_MI1_OP	0x50000c
118f7917c00SJeff Kirsher #define A_ELMER0_PORT2_MI1_CFG	0x600000
119f7917c00SJeff Kirsher #define A_ELMER0_PORT2_MI1_ADDR	0x600004
120f7917c00SJeff Kirsher #define A_ELMER0_PORT2_MI1_DATA	0x600008
121f7917c00SJeff Kirsher #define A_ELMER0_PORT2_MI1_OP	0x60000c
122f7917c00SJeff Kirsher #define A_ELMER0_PORT3_MI1_CFG	0x700000
123f7917c00SJeff Kirsher #define A_ELMER0_PORT3_MI1_ADDR	0x700004
124f7917c00SJeff Kirsher #define A_ELMER0_PORT3_MI1_DATA	0x700008
125f7917c00SJeff Kirsher #define A_ELMER0_PORT3_MI1_OP	0x70000c
126f7917c00SJeff Kirsher 
127f7917c00SJeff Kirsher /* Simple bit definition for GPI and GP0 registers. */
128f7917c00SJeff Kirsher #define     ELMER0_GP_BIT0              0x0001
129f7917c00SJeff Kirsher #define     ELMER0_GP_BIT1              0x0002
130f7917c00SJeff Kirsher #define     ELMER0_GP_BIT2              0x0004
131f7917c00SJeff Kirsher #define     ELMER0_GP_BIT3              0x0008
132f7917c00SJeff Kirsher #define     ELMER0_GP_BIT4              0x0010
133f7917c00SJeff Kirsher #define     ELMER0_GP_BIT5              0x0020
134f7917c00SJeff Kirsher #define     ELMER0_GP_BIT6              0x0040
135f7917c00SJeff Kirsher #define     ELMER0_GP_BIT7              0x0080
136f7917c00SJeff Kirsher #define     ELMER0_GP_BIT8              0x0100
137f7917c00SJeff Kirsher #define     ELMER0_GP_BIT9              0x0200
138f7917c00SJeff Kirsher #define     ELMER0_GP_BIT10             0x0400
139f7917c00SJeff Kirsher #define     ELMER0_GP_BIT11             0x0800
140f7917c00SJeff Kirsher #define     ELMER0_GP_BIT12             0x1000
141f7917c00SJeff Kirsher #define     ELMER0_GP_BIT13             0x2000
142f7917c00SJeff Kirsher #define     ELMER0_GP_BIT14             0x4000
143f7917c00SJeff Kirsher #define     ELMER0_GP_BIT15             0x8000
144f7917c00SJeff Kirsher #define     ELMER0_GP_BIT16             0x10000
145f7917c00SJeff Kirsher #define     ELMER0_GP_BIT17             0x20000
146f7917c00SJeff Kirsher #define     ELMER0_GP_BIT18             0x40000
147f7917c00SJeff Kirsher #define     ELMER0_GP_BIT19             0x80000
148f7917c00SJeff Kirsher 
149f7917c00SJeff Kirsher #define MI1_OP_DIRECT_WRITE 1
150f7917c00SJeff Kirsher #define MI1_OP_DIRECT_READ  2
151f7917c00SJeff Kirsher 
152f7917c00SJeff Kirsher #define MI1_OP_INDIRECT_ADDRESS  0
153f7917c00SJeff Kirsher #define MI1_OP_INDIRECT_WRITE    1
154f7917c00SJeff Kirsher #define MI1_OP_INDIRECT_READ_INC 2
155f7917c00SJeff Kirsher #define MI1_OP_INDIRECT_READ     3
156f7917c00SJeff Kirsher 
157f7917c00SJeff Kirsher #endif /* _CXGB_ELMER0_H_ */
158f7917c00SJeff Kirsher 
159