1/*- 2 * Copyright (c) 2003-2012 Broadcom Corporation 3 * All Rights Reserved 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31#ifndef __NLM_MDIO_H__ 32#define __NLM_MDIO_H__ 33 34/** 35* @file_name mdio.h 36* @author Netlogic Microsystems 37* @brief Access functions for XLP MDIO 38*/ 39#define INT_MDIO_CTRL 0x19 40#define INT_MDIO_CTRL_DATA 0x1A 41#define INT_MDIO_RD_STAT 0x1B 42#define INT_MDIO_LINK_STAT 0x1C 43#define EXT_G0_MDIO_CTRL 0x1D 44#define EXT_G1_MDIO_CTRL 0x21 45#define EXT_G0_MDIO_CTRL_DATA 0x1E 46#define EXT_G1_MDIO_CTRL_DATA 0x22 47#define EXT_G0_MDIO_LINK_STAT 0x20 48#define EXT_G1_MDIO_LINK_STAT 0x24 49#define EXT_G0_MDIO_RD_STAT 0x1F 50#define EXT_G1_MDIO_RD_STAT 0x23 51 52#define INT_MDIO_CTRL_ST_POS 0 53#define INT_MDIO_CTRL_OP_POS 2 54#define INT_MDIO_CTRL_PHYADDR_POS 4 55#define INT_MDIO_CTRL_DEVTYPE_POS 9 56#define INT_MDIO_CTRL_TA_POS 14 57#define INT_MDIO_CTRL_MIIM_POS 16 58#define INT_MDIO_CTRL_LOAD_POS 19 59#define INT_MDIO_CTRL_XDIV_POS 21 60#define INT_MDIO_CTRL_MCDIV_POS 28 61#define INT_MDIO_CTRL_RST 0x40000000 62#define INT_MDIO_CTRL_SMP 0x00100000 63#define INT_MDIO_CTRL_CMD_LOAD 0x00080000 64 65#define INT_MDIO_RD_STAT_MASK 0x0000FFFF 66#define INT_MDIO_STAT_LFV 0x00010000 67#define INT_MDIO_STAT_SC 0x00020000 68#define INT_MDIO_STAT_SM 0x00040000 69#define INT_MDIO_STAT_MIILFS 0x00080000 70#define INT_MDIO_STAT_MBSY 0x00100000 71 72#define EXT_G_MDIO_CLOCK_DIV_4 0 73#define EXT_G_MDIO_CLOCK_DIV_2 1 74#define EXT_G_MDIO_CLOCK_DIV_1 2 75#define EXT_G_MDIO_REGADDR_POS 5 76#define EXT_G_MDIO_PHYADDR_POS 10 77#define EXT_G_MDIO_CMD_SP 0x00008000 78#define EXT_G_MDIO_CMD_PSIA 0x00010000 79#define EXT_G_MDIO_CMD_LCD 0x00020000 80#define EXT_G_MDIO_CMD_RDS 0x00040000 81#define EXT_G_MDIO_CMD_SC 0x00080000 82#define EXT_G_MDIO_MMRST 0x00100000 83#define EXT_G_MDIO_DIV 0x0000001E 84#define EXT_G_MDIO_DIV_WITH_HW_DIV64 0x00000010 85 86#define EXT_G_MDIO_RD_STAT_MASK 0x0000FFFF 87#define EXT_G_MDIO_STAT_LFV 0x00010000 88#define EXT_G_MDIO_STAT_SC 0x00020000 89#define EXT_G_MDIO_STAT_SM 0x00040000 90#define EXT_G_MDIO_STAT_MIILFS 0x00080000 91#define EXT_G_MDIO_STAT_MBSY 0x80000000 92#define MDIO_OP_CMD_READ 0x10 93#define MDIO_OP_CMD_WRITE 0x01 94 95#if !defined(LOCORE) && !defined(__ASSEMBLY__) 96 97int nlm_int_gmac_mdio_read(uint64_t, int, int, int, int, int); 98int nlm_int_gmac_mdio_write(uint64_t, int, int, int, int, int, uint16_t); 99int nlm_int_gmac_mdio_reset(uint64_t, int, int, int); 100int nlm_gmac_mdio_read(uint64_t, int, int, int, int, int); 101int nlm_gmac_mdio_write(uint64_t, int, int, int, int, int, uint16_t); 102int nlm_gmac_mdio_reset(uint64_t, int, int, int); 103void nlm_mdio_reset_all(uint64_t); 104 105#endif /* !(LOCORE) && !(__ASSEMBLY__) */ 106#endif 107