1/* 2 * Misc Broadcom BCM47XX MDC/MDIO enet phy definitions. 3 * 4 * Copyright (C) 2013, Broadcom Corporation. All Rights Reserved. 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * $Id: bcmenetphy.h 376344 2012-12-24 21:10:09Z $ 18 */ 19 20#ifndef _bcmenetphy_h_ 21#define _bcmenetphy_h_ 22 23/* phy address */ 24#define MAXEPHY 32 /* mdio phy addresses are 5bit quantities */ 25#define EPHY_MASK 0x1f /* phy mask */ 26#define EPHY_NONE 31 /* nvram: no phy present at all */ 27#define EPHY_NOREG 30 /* nvram: no local phy regs */ 28 29#define MAXPHYREG 32 /* max 32 registers per phy */ 30 31/* just a few phy registers */ 32#define CTL_RESET (1 << 15) /* reset */ 33#define CTL_LOOP (1 << 14) /* loopback */ 34#define CTL_SPEED (1 << 13) /* speed selection lsb 0=10, 1=100 */ 35#define CTL_ANENAB (1 << 12) /* autonegotiation enable */ 36#define CTL_RESTART (1 << 9) /* restart autonegotiation */ 37#define CTL_DUPLEX (1 << 8) /* duplex mode 0=half, 1=full */ 38#define CTL_SPEED_MSB (1 << 6) /* speed selection msb */ 39 40#define CTL_SPEED_10 ((0 << 6) | (0 << 13)) /* speed selection CTL.6=0, CTL.13=0 */ 41#define CTL_SPEED_100 ((0 << 6) | (1 << 13)) /* speed selection CTL.6=0, CTL.13=1 */ 42#define CTL_SPEED_1000 ((1 << 6) | (0 << 13)) /* speed selection CTL.6=1, CTL.13=0 */ 43 44#define ADV_10FULL (1 << 6) /* autonegotiate advertise 10full */ 45#define ADV_10HALF (1 << 5) /* autonegotiate advertise 10half */ 46#define ADV_100FULL (1 << 8) /* autonegotiate advertise 100full */ 47#define ADV_100HALF (1 << 7) /* autonegotiate advertise 100half */ 48 49/* link partner ability register */ 50#define LPA_SLCT 0x001f /* same as advertise selector */ 51#define LPA_10HALF 0x0020 /* can do 10mbps half-duplex */ 52#define LPA_10FULL 0x0040 /* can do 10mbps full-duplex */ 53#define LPA_100HALF 0x0080 /* can do 100mbps half-duplex */ 54#define LPA_100FULL 0x0100 /* can do 100mbps full-duplex */ 55#define LPA_100BASE4 0x0200 /* can do 100mbps 4k packets */ 56#define LPA_RESV 0x1c00 /* unused */ 57#define LPA_RFAULT 0x2000 /* link partner faulted */ 58#define LPA_LPACK 0x4000 /* link partner acked us */ 59#define LPA_NPAGE 0x8000 /* next page bit */ 60 61#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL) 62#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4) 63 64/* 1000BASE-T control register */ 65#define ADV_1000HALF 0x0100 /* advertise 1000BASE-T half duplex */ 66#define ADV_1000FULL 0x0200 /* advertise 1000BASE-T full duplex */ 67 68/* 1000BASE-T status register */ 69#define LPA_1000HALF 0x0400 /* link partner 1000BASE-T half duplex */ 70#define LPA_1000FULL 0x0800 /* link partner 1000BASE-T full duplex */ 71 72/* 1000BASE-T extended status register */ 73#define EST_1000THALF 0x1000 /* 1000BASE-T half duplex capable */ 74#define EST_1000TFULL 0x2000 /* 1000BASE-T full duplex capable */ 75#define EST_1000XHALF 0x4000 /* 1000BASE-X half duplex capable */ 76#define EST_1000XFULL 0x8000 /* 1000BASE-X full duplex capable */ 77 78#define STAT_REMFAULT (1 << 4) /* remote fault */ 79#define STAT_LINK (1 << 2) /* link status */ 80#define STAT_JAB (1 << 1) /* jabber detected */ 81#define AUX_FORCED (1 << 2) /* forced 10/100 */ 82#define AUX_SPEED (1 << 1) /* speed 0=10mbps 1=100mbps */ 83#define AUX_DUPLEX (1 << 0) /* duplex 0=half 1=full */ 84 85#endif /* _bcmenetphy_h_ */ 86