blob: b58713d896f445e435ecd329e63953e2642f4ef4 [file] [log] [blame]
Andy Fleming063c1262011-04-08 02:10:54 -05001/*
Claudiu Manoil5be00a02013-09-30 12:44:43 +03002 * Copyright 2009-2012, 2013 Freescale Semiconductor, Inc.
Andy Fleming063c1262011-04-08 02:10:54 -05003 * Jun-jie Zhang <b18070@freescale.com>
4 * Mingkai Hu <Mingkai.hu@freescale.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Andy Fleming063c1262011-04-08 02:10:54 -05007 */
8#ifndef __FSL_PHY_H__
9#define __FSL_PHY_H__
10
11#include <net.h>
12#include <miiphy.h>
13#include <asm/fsl_enet.h>
14
15/* PHY register offsets */
16#define PHY_EXT_PAGE_ACCESS 0x1f
17
18/* MII Management Configuration Register */
19#define MIIMCFG_RESET_MGMT 0x80000000
20#define MIIMCFG_MGMT_CLOCK_SELECT 0x00000007
21#define MIIMCFG_INIT_VALUE 0x00000003
22
23/* MII Management Command Register */
24#define MIIMCOM_READ_CYCLE 0x00000001
25#define MIIMCOM_SCAN_CYCLE 0x00000002
26
27/* MII Management Address Register */
28#define MIIMADD_PHY_ADDR_SHIFT 8
29
30/* MII Management Indicator Register */
31#define MIIMIND_BUSY 0x00000001
32#define MIIMIND_NOTVALID 0x00000004
33
Claudiu Manoil5be00a02013-09-30 12:44:43 +030034void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,
Andy Fleming063c1262011-04-08 02:10:54 -050035 int dev_addr, int reg, int value);
Claudiu Manoil5be00a02013-09-30 12:44:43 +030036int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,
Andy Fleming063c1262011-04-08 02:10:54 -050037 int dev_addr, int regnum);
38int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum);
39int tsec_phy_write(struct mii_dev *bus, int addr, int dev_addr, int regnum,
40 u16 value);
Roy Zang111fd192012-10-08 07:44:21 +000041int memac_mdio_write(struct mii_dev *bus, int port_addr, int dev_addr,
42 int regnum, u16 value);
43int memac_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,
44 int regnum);
Andy Fleming063c1262011-04-08 02:10:54 -050045
46struct fsl_pq_mdio_info {
Claudiu Manoil5be00a02013-09-30 12:44:43 +030047 struct tsec_mii_mng __iomem *regs;
Andy Fleming063c1262011-04-08 02:10:54 -050048 char *name;
49};
50int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info);
51
52#endif /* __FSL_PHY_H__ */