blob: 9c62e4a77568efa3a4f3fb4bd6c748cbf7719831 [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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +05307 */
8
9#ifndef _MV88E61XX_H
10#define _MV88E61XX_H
11
12#include <miiphy.h>
13
14#define MV88E61XX_CPU_PORT 0x5
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053015
16#define MV88E61XX_PHY_TIMEOUT 100000
17
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000018/* port dev-addr (= port + 0x10) */
19#define MV88E61XX_PRT_OFST 0x10
20/* port registers */
21#define MV88E61XX_PCS_CTRL_REG 0x1
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053022#define MV88E61XX_PRT_CTRL_REG 0x4
23#define MV88E61XX_PRT_VMAP_REG 0x6
24#define MV88E61XX_PRT_VID_REG 0x7
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000025#define MV88E61XX_RGMII_TIMECTRL_REG 0x1A
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053026
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000027/* global registers dev-addr */
28#define MV88E61XX_GLBREG_DEVADR 0x1B
29/* global registers */
30#define MV88E61XX_SGSR 0x00
31#define MV88E61XX_SGCR 0x04
32
33/* global 2 registers dev-addr */
34#define MV88E61XX_GLB2REG_DEVADR 0x1C
35/* global 2 registers */
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053036#define MV88E61XX_PHY_CMD 0x18
37#define MV88E61XX_PHY_DATA 0x19
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000038/* global 2 phy commands */
39#define MV88E61XX_PHY_WRITE_CMD 0x9400
40#define MV88E61XX_PHY_READ_CMD 0x9800
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053041
42#define MV88E61XX_BUSY_OFST 15
43#define MV88E61XX_MODE_OFST 12
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000044#define MV88E61XX_OP_OFST 10
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053045#define MV88E61XX_ADDR_OFST 5
46
47#ifdef CONFIG_MV88E61XX_MULTICHIP_ADRMODE
Prafulla Wadaskar443ce4a2009-07-16 20:58:02 +053048static int mv88e61xx_busychk_multic(char *name, u32 devaddr);
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000049static void mv88e61xx_switch_write(char *name, u32 phy_adr,
50 u32 reg_ofs, u16 data);
51static void mv88e61xx_switch_read(char *name, u32 phy_adr,
52 u32 reg_ofs, u16 *data);
53#define wr_switch_reg mv88e61xx_switch_write
54#define rd_switch_reg mv88e61xx_switch_read
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053055#else
Albert ARIBAUD0a16ea52012-11-26 11:27:35 +000056/* switch appears a s simple PHY and can thus use miiphy */
57#define wr_switch_reg miiphy_write
58#define rd_switch_reg miiphy_read
Prafulla Wadaskar6f51deb2009-05-19 01:40:16 +053059#endif /* CONFIG_MV88E61XX_MULTICHIP_ADRMODE */
60
61#endif /* _MV88E61XX_H */