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