diff --git a/include/libopencm3/ethernet/phy_lan87xx.h b/include/libopencm3/ethernet/phy_lan87xx.h new file mode 100644 index 00000000..ca6c065d --- /dev/null +++ b/include/libopencm3/ethernet/phy_lan87xx.h @@ -0,0 +1,297 @@ +/** @defgroup ethernet_phy_lan87xx_defines PHY LAN8710 Defines + * + * @brief Defined Constants and Types for the Ethernet PHY LAN87xx chips + * + * @ingroup ETH + * + * @version 1.0.0 + * + * @author @htmlonly © @endhtmlonly 2014 Frantisek Burian + * + * @date 6 February 2014 + * + * LGPL License Terms @ref lgpl_license + */ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2013 Frantisek Burian + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#ifndef LIBOPENCM3_PHY_LAN87XX_H +#define LIBOPENCM3_PHY_LAN87XX_H + +#include + +/**@{*/ + +/* + * Architecture availability: + * + * A stands for LAN8700 + * B stands for LAN8710A + * C stands for LAN8720A + * D stands for LAN8740A + * E stands for LAN8741A + * F stands for LAN8742A + */ + +/*****************************************************************************/ +/* Register definitions */ +/*****************************************************************************/ + +#define LAN87XX_BCR 0x00 /* ABCDEF */ +#define LAN87XX_BSR 0x01 /* ABCDEF */ +#define LAN87XX_PID1 0x02 /* ABCDEF */ +#define LAN87XX_PID2 0x03 /* ABCDEF */ +#define LAN87XX_ANA 0x04 /* ABCDEF */ +#define LAN87XX_ANLPA 0x05 /* ABCDEF */ +#define LAN87XX_ANE 0x06 /* ABCDEF */ +#define LAN87XX_ANNPTX 0x07 /* ---DEF */ +#define LAN87XX_ANNPRX 0x08 /* ---DEF */ + +#define LAN87XX_MMDACR 0x0D /* ---DEF */ +#define LAN87XX_MMDADR 0x0E /* ---DEF */ + +#define LAN87XX_REVISION 0x10 /* A----- */ +#define LAN87XX_EDPDNLP 0x10 /* ---DEF */ +#define LAN87XX_MCS 0x11 /* ABCDEF */ +#define LAN87XX_SM 0x12 /* ABCDEF */ + +#define LAN87XX_TDRDCR 0x18 /* ---D-F */ +#define LAN87XX_TDRCSR 0x19 /* ---D-F */ +#define LAN87XX_ERRCNT 0x1A /* -BCDEF */ +#define LAN87XX_CSR 0x1B /* ABCDEF */ +#define LAN87XX_CBLN 0x1C /* ---D-F */ +#define LAN87XX_ISR 0x1D /* ABCDEF */ +#define LAN87XX_IMR 0x1E /* ABCDEF */ +#define LAN87XX_SCSR 0x1F /* ABCDEF */ + + +/*****************************************************************************/ +/* Register values */ +/*****************************************************************************/ + +/* LAN87XX_BCR --------------------------------------------------------------*/ +/* LAN87XX_BSR --------------------------------------------------------------*/ +/* LAN87XX_PID1 -------------------------------------------------------------*/ +/* LAN87XX_PID2 -------------------------------------------------------------*/ +/* LAN87XX_ANA --------------------------------------------------------------*/ +/* LAN87XX_ANLPA ------------------------------------------------------------*/ +/* LAN87XX_ANE --------------------------------------------------------------*/ +/* LAN87XX_ANNPTX -----------------------------------------------------------*/ +/* LAN87XX_ANNPRX -----------------------------------------------------------*/ + +/* LAN87XX_MMDACR -----------------------------------------------------------*/ + +/* the MMD provides register access into bare PHY chip. MMD provides its own + * register address space, completely different between devices. + * It should be implemented later. + */ + +#define LAN87XX_MMDACR_FUNC_SHIFT 14 /* ---DEF */ +#define LAN87XX_MMDACR_FUNC (3 << LAN87XX_MMDACR_FUNC_SHIFT) +#define LAN87XX_MMDACR_FUNC_ADDRESS (0 << LAN87XX_MMDACR_FUNC_SHIFT) +#define LAN87XX_MMDACR_FUNC_DATA (1 << LAN87XX_MMDACR_FUNC_SHIFT) + +#define LAN87XX_MMDACR_DEVAD (31 << 0) /* ---DEF */ +#define LAN87XX_MMDACR_DEVAD_PCS (3 << 0) /* ---DEF */ +#define LAN87XX_MMDACR_DEVAD_ANN (7 << 0) /* ---DE- */ +#define LAN87XX_MMDACR_DEVAD_VENDOR (30 << 0) /* ---DE- */ + +/* LAN87XX_MMDADR -----------------------------------------------------------*/ + +/* LAN87XX_REVISION ---------------------------------------------------------*/ +/* note this register is valid only on original LAN8700 */ + +/* LAN87XX_EDPDNLP ----------------------------------------------------------*/ +/* note this register is valid only on newer than original LAN8700 */ + +#define LAN87XX_EDPDNLP_TXEN (1 << 15) /* ---DEF */ + +#define LAN87XX_EDPDNLP_TXTIM_SHIFT 13 /* ---DEF */ +#define LAN87XX_EDPDNLP_TXTIM (3<