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