18c2ecf20Sopenharmony_ci/*****************************************************************************
28c2ecf20Sopenharmony_ci *                                                                           *
38c2ecf20Sopenharmony_ci * File: elmer0.h                                                            *
48c2ecf20Sopenharmony_ci * $Revision: 1.6 $                                                          *
58c2ecf20Sopenharmony_ci * $Date: 2005/06/21 22:49:43 $                                              *
68c2ecf20Sopenharmony_ci * Description:                                                              *
78c2ecf20Sopenharmony_ci *  part of the Chelsio 10Gb Ethernet Driver.                                *
88c2ecf20Sopenharmony_ci *                                                                           *
98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify      *
108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, version 2, as       *
118c2ecf20Sopenharmony_ci * published by the Free Software Foundation.                                *
128c2ecf20Sopenharmony_ci *                                                                           *
138c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along   *
148c2ecf20Sopenharmony_ci * with this program; if not, see <http://www.gnu.org/licenses/>.            *
158c2ecf20Sopenharmony_ci *                                                                           *
168c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED    *
178c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF      *
188c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.                     *
198c2ecf20Sopenharmony_ci *                                                                           *
208c2ecf20Sopenharmony_ci * http://www.chelsio.com                                                    *
218c2ecf20Sopenharmony_ci *                                                                           *
228c2ecf20Sopenharmony_ci * Copyright (c) 2003 - 2005 Chelsio Communications, Inc.                    *
238c2ecf20Sopenharmony_ci * All rights reserved.                                                      *
248c2ecf20Sopenharmony_ci *                                                                           *
258c2ecf20Sopenharmony_ci * Maintainers: maintainers@chelsio.com                                      *
268c2ecf20Sopenharmony_ci *                                                                           *
278c2ecf20Sopenharmony_ci * Authors: Dimitrios Michailidis   <dm@chelsio.com>                         *
288c2ecf20Sopenharmony_ci *          Tina Yang               <tainay@chelsio.com>                     *
298c2ecf20Sopenharmony_ci *          Felix Marti             <felix@chelsio.com>                      *
308c2ecf20Sopenharmony_ci *          Scott Bardone           <sbardone@chelsio.com>                   *
318c2ecf20Sopenharmony_ci *          Kurt Ottaway            <kottaway@chelsio.com>                   *
328c2ecf20Sopenharmony_ci *          Frank DiMambro          <frank@chelsio.com>                      *
338c2ecf20Sopenharmony_ci *                                                                           *
348c2ecf20Sopenharmony_ci * History:                                                                  *
358c2ecf20Sopenharmony_ci *                                                                           *
368c2ecf20Sopenharmony_ci ****************************************************************************/
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#ifndef _CXGB_ELMER0_H_
398c2ecf20Sopenharmony_ci#define _CXGB_ELMER0_H_
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* ELMER0 flavors */
428c2ecf20Sopenharmony_cienum {
438c2ecf20Sopenharmony_ci	ELMER0_XC2S300E_6FT256_C,
448c2ecf20Sopenharmony_ci	ELMER0_XC2S100E_6TQ144_C
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* ELMER0 registers */
488c2ecf20Sopenharmony_ci#define A_ELMER0_VERSION	0x100000
498c2ecf20Sopenharmony_ci#define A_ELMER0_PHY_CFG	0x100004
508c2ecf20Sopenharmony_ci#define A_ELMER0_INT_ENABLE	0x100008
518c2ecf20Sopenharmony_ci#define A_ELMER0_INT_CAUSE	0x10000c
528c2ecf20Sopenharmony_ci#define A_ELMER0_GPI_CFG	0x100010
538c2ecf20Sopenharmony_ci#define A_ELMER0_GPI_STAT	0x100014
548c2ecf20Sopenharmony_ci#define A_ELMER0_GPO		0x100018
558c2ecf20Sopenharmony_ci#define A_ELMER0_PORT0_MI1_CFG	0x400000
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define S_MI1_MDI_ENABLE    0
588c2ecf20Sopenharmony_ci#define V_MI1_MDI_ENABLE(x) ((x) << S_MI1_MDI_ENABLE)
598c2ecf20Sopenharmony_ci#define F_MI1_MDI_ENABLE    V_MI1_MDI_ENABLE(1U)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define S_MI1_MDI_INVERT    1
628c2ecf20Sopenharmony_ci#define V_MI1_MDI_INVERT(x) ((x) << S_MI1_MDI_INVERT)
638c2ecf20Sopenharmony_ci#define F_MI1_MDI_INVERT    V_MI1_MDI_INVERT(1U)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define S_MI1_PREAMBLE_ENABLE    2
668c2ecf20Sopenharmony_ci#define V_MI1_PREAMBLE_ENABLE(x) ((x) << S_MI1_PREAMBLE_ENABLE)
678c2ecf20Sopenharmony_ci#define F_MI1_PREAMBLE_ENABLE    V_MI1_PREAMBLE_ENABLE(1U)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define S_MI1_SOF    3
708c2ecf20Sopenharmony_ci#define M_MI1_SOF    0x3
718c2ecf20Sopenharmony_ci#define V_MI1_SOF(x) ((x) << S_MI1_SOF)
728c2ecf20Sopenharmony_ci#define G_MI1_SOF(x) (((x) >> S_MI1_SOF) & M_MI1_SOF)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define S_MI1_CLK_DIV    5
758c2ecf20Sopenharmony_ci#define M_MI1_CLK_DIV    0xff
768c2ecf20Sopenharmony_ci#define V_MI1_CLK_DIV(x) ((x) << S_MI1_CLK_DIV)
778c2ecf20Sopenharmony_ci#define G_MI1_CLK_DIV(x) (((x) >> S_MI1_CLK_DIV) & M_MI1_CLK_DIV)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define A_ELMER0_PORT0_MI1_ADDR 0x400004
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define S_MI1_REG_ADDR    0
828c2ecf20Sopenharmony_ci#define M_MI1_REG_ADDR    0x1f
838c2ecf20Sopenharmony_ci#define V_MI1_REG_ADDR(x) ((x) << S_MI1_REG_ADDR)
848c2ecf20Sopenharmony_ci#define G_MI1_REG_ADDR(x) (((x) >> S_MI1_REG_ADDR) & M_MI1_REG_ADDR)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define S_MI1_PHY_ADDR    5
878c2ecf20Sopenharmony_ci#define M_MI1_PHY_ADDR    0x1f
888c2ecf20Sopenharmony_ci#define V_MI1_PHY_ADDR(x) ((x) << S_MI1_PHY_ADDR)
898c2ecf20Sopenharmony_ci#define G_MI1_PHY_ADDR(x) (((x) >> S_MI1_PHY_ADDR) & M_MI1_PHY_ADDR)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define A_ELMER0_PORT0_MI1_DATA 0x400008
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define S_MI1_DATA    0
948c2ecf20Sopenharmony_ci#define M_MI1_DATA    0xffff
958c2ecf20Sopenharmony_ci#define V_MI1_DATA(x) ((x) << S_MI1_DATA)
968c2ecf20Sopenharmony_ci#define G_MI1_DATA(x) (((x) >> S_MI1_DATA) & M_MI1_DATA)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define A_ELMER0_PORT0_MI1_OP 0x40000c
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define S_MI1_OP    0
1018c2ecf20Sopenharmony_ci#define M_MI1_OP    0x3
1028c2ecf20Sopenharmony_ci#define V_MI1_OP(x) ((x) << S_MI1_OP)
1038c2ecf20Sopenharmony_ci#define G_MI1_OP(x) (((x) >> S_MI1_OP) & M_MI1_OP)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define S_MI1_ADDR_AUTOINC    2
1068c2ecf20Sopenharmony_ci#define V_MI1_ADDR_AUTOINC(x) ((x) << S_MI1_ADDR_AUTOINC)
1078c2ecf20Sopenharmony_ci#define F_MI1_ADDR_AUTOINC    V_MI1_ADDR_AUTOINC(1U)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define S_MI1_OP_BUSY    31
1108c2ecf20Sopenharmony_ci#define V_MI1_OP_BUSY(x) ((x) << S_MI1_OP_BUSY)
1118c2ecf20Sopenharmony_ci#define F_MI1_OP_BUSY    V_MI1_OP_BUSY(1U)
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define A_ELMER0_PORT1_MI1_CFG	0x500000
1148c2ecf20Sopenharmony_ci#define A_ELMER0_PORT1_MI1_ADDR	0x500004
1158c2ecf20Sopenharmony_ci#define A_ELMER0_PORT1_MI1_DATA	0x500008
1168c2ecf20Sopenharmony_ci#define A_ELMER0_PORT1_MI1_OP	0x50000c
1178c2ecf20Sopenharmony_ci#define A_ELMER0_PORT2_MI1_CFG	0x600000
1188c2ecf20Sopenharmony_ci#define A_ELMER0_PORT2_MI1_ADDR	0x600004
1198c2ecf20Sopenharmony_ci#define A_ELMER0_PORT2_MI1_DATA	0x600008
1208c2ecf20Sopenharmony_ci#define A_ELMER0_PORT2_MI1_OP	0x60000c
1218c2ecf20Sopenharmony_ci#define A_ELMER0_PORT3_MI1_CFG	0x700000
1228c2ecf20Sopenharmony_ci#define A_ELMER0_PORT3_MI1_ADDR	0x700004
1238c2ecf20Sopenharmony_ci#define A_ELMER0_PORT3_MI1_DATA	0x700008
1248c2ecf20Sopenharmony_ci#define A_ELMER0_PORT3_MI1_OP	0x70000c
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* Simple bit definition for GPI and GP0 registers. */
1278c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT0              0x0001
1288c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT1              0x0002
1298c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT2              0x0004
1308c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT3              0x0008
1318c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT4              0x0010
1328c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT5              0x0020
1338c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT6              0x0040
1348c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT7              0x0080
1358c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT8              0x0100
1368c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT9              0x0200
1378c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT10             0x0400
1388c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT11             0x0800
1398c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT12             0x1000
1408c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT13             0x2000
1418c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT14             0x4000
1428c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT15             0x8000
1438c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT16             0x10000
1448c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT17             0x20000
1458c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT18             0x40000
1468c2ecf20Sopenharmony_ci#define     ELMER0_GP_BIT19             0x80000
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define MI1_OP_DIRECT_WRITE 1
1498c2ecf20Sopenharmony_ci#define MI1_OP_DIRECT_READ  2
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define MI1_OP_INDIRECT_ADDRESS  0
1528c2ecf20Sopenharmony_ci#define MI1_OP_INDIRECT_WRITE    1
1538c2ecf20Sopenharmony_ci#define MI1_OP_INDIRECT_READ_INC 2
1548c2ecf20Sopenharmony_ci#define MI1_OP_INDIRECT_READ     3
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#endif /* _CXGB_ELMER0_H_ */
1578c2ecf20Sopenharmony_ci
158