xref: /rk3399_rockchip-uboot/include/mv88e6352.h (revision b737337aaf7d266f0e5228d1129ac40e300878f8)
1*b737337aSValentin Longchamp /*
2*b737337aSValentin Longchamp  * (C) Copyright 2012
3*b737337aSValentin Longchamp  * Valentin Lontgchamp, Keymile AG, valentin.longchamp@keymile.com
4*b737337aSValentin Longchamp  *
5*b737337aSValentin Longchamp  * See file CREDITS for list of people who contributed to this
6*b737337aSValentin Longchamp  * project.
7*b737337aSValentin Longchamp  *
8*b737337aSValentin Longchamp  * This program is free software; you can redistribute it and/or
9*b737337aSValentin Longchamp  * modify it under the terms of the GNU General Public License as
10*b737337aSValentin Longchamp  * published by the Free Software Foundation; either version 2 of
11*b737337aSValentin Longchamp  * the License, or (at your option) any later version.
12*b737337aSValentin Longchamp  *
13*b737337aSValentin Longchamp  * This program is distributed in the hope that it will be useful,
14*b737337aSValentin Longchamp  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15*b737337aSValentin Longchamp  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
16*b737337aSValentin Longchamp  * GNU General Public License for more details.
17*b737337aSValentin Longchamp  *
18*b737337aSValentin Longchamp  * You should have received a copy of the GNU General Public License
19*b737337aSValentin Longchamp  * along with this program; if not, write to the Free Software
20*b737337aSValentin Longchamp  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21*b737337aSValentin Longchamp  * MA 02110-1301 USA
22*b737337aSValentin Longchamp  */
23*b737337aSValentin Longchamp 
24*b737337aSValentin Longchamp #ifndef __MV886352_H
25*b737337aSValentin Longchamp #define __MV886352_H
26*b737337aSValentin Longchamp 
27*b737337aSValentin Longchamp #include <common.h>
28*b737337aSValentin Longchamp 
29*b737337aSValentin Longchamp /* PHY registers */
30*b737337aSValentin Longchamp #define PHY(itf)	(itf)
31*b737337aSValentin Longchamp 
32*b737337aSValentin Longchamp #define PHY_CTRL	0x00
33*b737337aSValentin Longchamp #define PHY_100_MBPS	0x2000
34*b737337aSValentin Longchamp #define PHY_1_GBPS	0x0040
35*b737337aSValentin Longchamp #define AUTONEG_EN	0x1000
36*b737337aSValentin Longchamp #define AUTONEG_RST	0x0200
37*b737337aSValentin Longchamp #define FULL_DUPLEX	0x0100
38*b737337aSValentin Longchamp #define PHY_PWR_DOWN	0x0800
39*b737337aSValentin Longchamp 
40*b737337aSValentin Longchamp #define PHY_STATUS	0x01
41*b737337aSValentin Longchamp #define AN1000FIX	0x0001
42*b737337aSValentin Longchamp 
43*b737337aSValentin Longchamp #define PHY_SPEC_CTRL	0x10
44*b737337aSValentin Longchamp #define SPEC_PWR_DOWN	0x0004
45*b737337aSValentin Longchamp #define AUTO_MDIX_EN	0x0060
46*b737337aSValentin Longchamp 
47*b737337aSValentin Longchamp #define PHY_1000_CTRL	0x9
48*b737337aSValentin Longchamp 
49*b737337aSValentin Longchamp #define NO_ADV		0x0000
50*b737337aSValentin Longchamp #define ADV_1000_FDPX	0x0200
51*b737337aSValentin Longchamp #define ADV_1000_HDPX	0x0100
52*b737337aSValentin Longchamp 
53*b737337aSValentin Longchamp #define PHY_PAGE	0x16
54*b737337aSValentin Longchamp 
55*b737337aSValentin Longchamp #define AN1000FIX_PAGE	0x00fc
56*b737337aSValentin Longchamp 
57*b737337aSValentin Longchamp /* PORT or MAC registers */
58*b737337aSValentin Longchamp #define PORT(itf)	(itf+0x10)
59*b737337aSValentin Longchamp 
60*b737337aSValentin Longchamp #define PORT_STATUS	0x00
61*b737337aSValentin Longchamp #define NO_PHY_DETECT	0x0000
62*b737337aSValentin Longchamp 
63*b737337aSValentin Longchamp #define PORT_PHY	0x01
64*b737337aSValentin Longchamp #define RX_RGMII_TIM	0x8000
65*b737337aSValentin Longchamp #define TX_RGMII_TIM	0x4000
66*b737337aSValentin Longchamp #define FLOW_CTRL_EN	0x0080
67*b737337aSValentin Longchamp #define FLOW_CTRL_FOR	0x0040
68*b737337aSValentin Longchamp #define LINK_VAL	0x0020
69*b737337aSValentin Longchamp #define LINK_FOR	0x0010
70*b737337aSValentin Longchamp #define FULL_DPX	0x0008
71*b737337aSValentin Longchamp #define FULL_DPX_FOR	0x0004
72*b737337aSValentin Longchamp #define NO_SPEED_FOR	0x0003
73*b737337aSValentin Longchamp #define SPEED_1000_FOR	0x0002
74*b737337aSValentin Longchamp #define SPEED_100_FOR	0x0001
75*b737337aSValentin Longchamp #define SPEED_10_FOR	0x0000
76*b737337aSValentin Longchamp 
77*b737337aSValentin Longchamp #define PORT_CTRL	0x04
78*b737337aSValentin Longchamp #define FORWARDING	0x0003
79*b737337aSValentin Longchamp #define EGRS_FLD_ALL	0x000c
80*b737337aSValentin Longchamp #define PORT_DIS	0x0000
81*b737337aSValentin Longchamp 
82*b737337aSValentin Longchamp struct mv88e_sw_reg {
83*b737337aSValentin Longchamp 	u8 port;
84*b737337aSValentin Longchamp 	u8 reg;
85*b737337aSValentin Longchamp 	u16 value;
86*b737337aSValentin Longchamp };
87*b737337aSValentin Longchamp 
88*b737337aSValentin Longchamp int mv88e_sw_reset(const char *devname, u8 phy_addr);
89*b737337aSValentin Longchamp int mv88e_sw_program(const char *devname, u8 phy_addr,
90*b737337aSValentin Longchamp 	struct mv88e_sw_reg *regs, int regs_nb);
91*b737337aSValentin Longchamp 
92*b737337aSValentin Longchamp #endif
93