atge_mii.c revision 015a6ef6781cc3ceba8ad3bfbae98449b6002a1f
/*
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice unmodified, this list of conditions, and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "atge.h"
#include "atge_cmn_reg.h"
#include "atge_l1e_reg.h"
{
uint32_t v;
int i;
for (i = PHY_TIMEOUT; i > 0; i--) {
drv_usecwait(5);
if ((v & (MDIO_OP_EXECUTE | MDIO_OP_BUSY)) == 0)
break;
}
if (i == 0) {
return (0xffff);
}
return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT);
}
void
{
uint32_t v;
int i;
for (i = PHY_TIMEOUT; i > 0; i--) {
drv_usecwait(1);
if ((v & (MDIO_OP_EXECUTE | MDIO_OP_BUSY)) == 0)
break;
}
if (i == 0) {
}
}
void
atge_l1e_mii_reset(void *arg)
{
int phyaddr;
drv_usecwait(1000);
drv_usecwait(1000);
/* Enable hibernation mode. */
/* Set Class A/B for all modes. */
/* Enable 10BT power saving. */
/* Adjust 1000T power. */
/* 10BT center tap voltage. */
drv_usecwait(1000);
}