blob: 55ded7e03232b11df7f9f0901a71d07212c9de16 [file] [log] [blame]
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +05301/*
2 * (C) Copyright 2009
3 * Marvell Semiconductor <www.marvell.com>
4 * Prafulla Wadaskar <prafulla@marvell.com>
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 */
24
25#ifndef _MV88E61XX_H
26#define _MV88E61XX_H
27
28#include <miiphy.h>
29
30#define MV88E61XX_CPU_PORT 0x5
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053031
32#define MV88E61XX_PHY_TIMEOUT 100000
33
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000034/* port dev-addr (= port + 0x10) */
35#define MV88E61XX_PRT_OFST 0x10
36/* port registers */
37#define MV88E61XX_PCS_CTRL_REG 0x1
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053038#define MV88E61XX_PRT_CTRL_REG 0x4
39#define MV88E61XX_PRT_VMAP_REG 0x6
40#define MV88E61XX_PRT_VID_REG 0x7
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000041#define MV88E61XX_RGMII_TIMECTRL_REG 0x1A
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053042
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000043/* global registers dev-addr */
44#define MV88E61XX_GLBREG_DEVADR 0x1B
45/* global registers */
46#define MV88E61XX_SGSR 0x00
47#define MV88E61XX_SGCR 0x04
48
49/* global 2 registers dev-addr */
50#define MV88E61XX_GLB2REG_DEVADR 0x1C
51/* global 2 registers */
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053052#define MV88E61XX_PHY_CMD 0x18
53#define MV88E61XX_PHY_DATA 0x19
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000054/* global 2 phy commands */
55#define MV88E61XX_PHY_WRITE_CMD 0x9400
56#define MV88E61XX_PHY_READ_CMD 0x9800
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053057
58#define MV88E61XX_BUSY_OFST 15
59#define MV88E61XX_MODE_OFST 12
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000060#define MV88E61XX_OP_OFST 10
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053061#define MV88E61XX_ADDR_OFST 5
62
63#ifdef CONFIG_MV88E61XX_MULTICHIP_ADRMODE
Prafulla Wadaskar443ce4a2009-07-16 20:58:02 +053064static int mv88e61xx_busychk_multic(char *name, u32 devaddr);
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000065static void mv88e61xx_switch_write(char *name, u32 phy_adr,
66 u32 reg_ofs, u16 data);
67static void mv88e61xx_switch_read(char *name, u32 phy_adr,
68 u32 reg_ofs, u16 *data);
69#define wr_switch_reg mv88e61xx_switch_write
70#define rd_switch_reg mv88e61xx_switch_read
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053071#else
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000072/* switch appears a s simple PHY and can thus use miiphy */
73#define wr_switch_reg miiphy_write
74#define rd_switch_reg miiphy_read
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053075#endif /* CONFIG_MV88E61XX_MULTICHIP_ADRMODE */
76
77#endif /* _MV88E61XX_H */