From c47ec318058a5de54226b45485917424033d1fa3 Mon Sep 17 00:00:00 2001 From: Trumeet Date: Fri, 14 Oct 2022 15:30:37 -0700 Subject: First Commit --- freebsd/rtl_bsd_drv_v197.00/Makefile | 30 + freebsd/rtl_bsd_drv_v197.00/Readme.txt | 98 + freebsd/rtl_bsd_drv_v197.00/if_re.c | 31155 +++++++++++++++++++++++++++ freebsd/rtl_bsd_drv_v197.00/if_rereg.h | 1252 ++ linux/r8169-6.030.01/Makefile | 57 + linux/r8169-6.030.01/readme | 156 + linux/r8169-6.030.01/src/Makefile | 119 + linux/r8169-6.030.01/src/Makefile_linux24x | 80 + linux/r8169-6.030.01/src/r8169.h | 1382 ++ linux/r8169-6.030.01/src/r8169_n.c | 4975 +++++ 10 files changed, 39304 insertions(+) create mode 100755 freebsd/rtl_bsd_drv_v197.00/Makefile create mode 100755 freebsd/rtl_bsd_drv_v197.00/Readme.txt create mode 100755 freebsd/rtl_bsd_drv_v197.00/if_re.c create mode 100755 freebsd/rtl_bsd_drv_v197.00/if_rereg.h create mode 100755 linux/r8169-6.030.01/Makefile create mode 100755 linux/r8169-6.030.01/readme create mode 100755 linux/r8169-6.030.01/src/Makefile create mode 100755 linux/r8169-6.030.01/src/Makefile_linux24x create mode 100755 linux/r8169-6.030.01/src/r8169.h create mode 100755 linux/r8169-6.030.01/src/r8169_n.c diff --git a/freebsd/rtl_bsd_drv_v197.00/Makefile b/freebsd/rtl_bsd_drv_v197.00/Makefile new file mode 100755 index 0000000..7d3256b --- /dev/null +++ b/freebsd/rtl_bsd_drv_v197.00/Makefile @@ -0,0 +1,30 @@ +# $FreeBSD: src/sys/modules/re/Makefile,v 1.6 2000/01/28 11:26:34 bde Exp $ + +enable_fiber_support = n +enable_s5wol = n +enable_eee = n +enable_s0_magic_packet = n + + +.PATH: ${.CURDIR}/../../dev/re +KMOD = if_re +SRCS = if_re.c opt_bdg.h device_if.h bus_if.h pci_if.h + +.if $(enable_fiber_support) == y +SRCS += if_fiber.c +CFLAGS += -DENABLE_FIBER_SUPPORT +.endif + +.if $(enable_s5wol) == y +CFLAGS += -DENABLE_S5WOL +.endif + +.if $(enable_eee) == y +CFLAGS += -DENABLE_EEE +.endif + +.if $(enable_s0_magic_packet) == y +CFLAGS += -DENABLE_S0_MAGIC_PACKET +.endif + +.include diff --git a/freebsd/rtl_bsd_drv_v197.00/Readme.txt b/freebsd/rtl_bsd_drv_v197.00/Readme.txt new file mode 100755 index 0000000..6332a56 --- /dev/null +++ b/freebsd/rtl_bsd_drv_v197.00/Readme.txt @@ -0,0 +1,98 @@ +================================================================================= += Realtek 8169S/8169SB/8169SC/8168B/8168C/8168CP/8168D/8168DP/8168E/8168F = += 8168FB/8168G/818GU/8168H/8168EP/8411/8168FP = += 8101E/8102E/8103E/8401/8105E/8106E/8402 = += 8125 Driver = += for FreeBSD v4.x/5.x/6.x/7.x/8.x/9.x/10.x/11.x//12.x/13.x = +================================================================================= + +This driver is modified by Realtek Semiconductor corp. and it has been tested OK +on FreeBSD v5.4, FreeBSD v6.4, FreeBSD v7.3, FreeBSD v8.0, and FreeBSD v9.0. To +update the driver, you may use method 1. If method 1 failed, you must use method 2 +which is more complex. + +Method 1: + 1.Copy if_re.ko in "modules" directory to "/modules" directory and overwrite + the existing file. + 2.Modify the file "/boot/defaults/loader.conf" and set "if_re_load" in "Network + drivers" section to "Yes" + 3.Reboot. + +Method 2: + Because the FreeBSD kernel has default drivers to support RTL8139C and RTL8169S. To use the RTL8139C+, RTL8169SB, RTL8169SC, RTL8168B, and RTL8101E, you need to update your NIC driver by recompiling your FreeBSD kernel. + + The main steps you have to do:(FreeBSDSrcDir means the directory of FreeBSD source code + and it may be "/usr/src/sys") + + 1. keep the orginal driver source code: + # cd /usr/src/sys/dev/re + # cp if_re.c if_re.c.org + + # cd /usr/src/sys/modules + # cp Makefile Makefile.org + + # cd /usr/src/sys/modules/re + # cp Makefile Makefile.org + + # cd /usr/src/sys/i386/conf/ + # cp GENERIC GENERIC.org + + 2. recompile your kernel (you must install your FreeBSD source code first !!) + # vim /usr/src/sys/i386/conf/GENERIC and delete re + # vim /usr/src/sys/modules/Makefile and delete re + # cd /usr/src/sys/i386/conf + # /usr/sbin/config GENERIC + + (for FreeBSD 5.x/6.x/7.x/8.x/9.x) + # cd ../compile/GENERIC + (for FreeBSD 4.x) + # cd ../../compile/GENERIC + + # make clean + # make depend + # make + # make install + # reboot + + 3. update the driver source code: + Copy the driver source code( if_re.c and if_rereg.h) into /usr/src/sys/dev/re + Copy the Makefile into /usr/src/sys/modules/re + + 4. build the driver: + # cd /usr/src/sys/modules/re + # make clean + # make + + 5. install the driver + (for FreeBSD 12 or later) + # cd /usr/obj/usr/src/./sys/modules + # kldload ./if_re.ko + (for FreeBSD 11 or earlier) + # cd /usr/src/sys/modules/re + + # kldload ./if_re.ko + + 6. configurate the static IP address + # ifconfig re0 xxx.xxx.xxx.xxx + + 7. configurate the IP address by DHCP + # /sbin/dhclient re0 + +The user can use the following command to change link speed and duplexmode. + 1. For auto negotiation, + #ifconfig re media autoselect + + 2. For 1000Mbps full-duplex, + #ifconfig re media 1000baseTX mediaopt full-duplex + + 3. For 100Mbps full-duplex, + #ifconfig re media 100baseTX mediaopt full-duplex + + 4. For 100Mbps half-duplex, + #ifconfig re media 100baseTX -mediaopt full-duplex + + 5. For 10Mbps full-duplex, + #ifconfig re media 10baseT/UTP mediaopt full-duplex + + 6. For 10Mbps half-duplex, + #ifconfig re media 10baseT/UTP -mediaopt full-duplex diff --git a/freebsd/rtl_bsd_drv_v197.00/if_re.c b/freebsd/rtl_bsd_drv_v197.00/if_re.c new file mode 100755 index 0000000..9d54e3c --- /dev/null +++ b/freebsd/rtl_bsd_drv_v197.00/if_re.c @@ -0,0 +1,31155 @@ +/* + * Copyright (c) 1997, 1998 + * Bill Paul . 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, 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 + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD + * 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. + * + * $FreeBSD: src/sys/dev/if_rl.c,v 1.38.2.7 2001/07/19 18:33:07 wpaul Exp $ + */ + +/* + * RealTek 8129/8139 PCI NIC driver + * + * Written by Bill Paul + * Electrical Engineering Department + * Columbia University, New York City + */ + +#include + +#ifdef ENABLE_FIBER_SUPPORT +#define FIBER_SUFFIX "-FIBER" +#else +#define FIBER_SUFFIX "" +#endif +#define RE_VERSION "1.97.00" FIBER_SUFFIX + +__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v " RE_VERSION __DATE__ " " __TIME__ " wpaul Exp $"); + +/* +* This driver also support Realtek RTL8110/RTL8169, RTL8111/RTL8168, RTL8125, and RTL8136/RTL810x. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include /* for vtophys */ +#include /* for vtophys */ +#include /* for DELAY */ + +#include +#include +#include +#include +#include + +#include +#include +#ifdef ENABLE_FIBER_SUPPORT +#include +#endif //ENABLE_FIBER_SUPPORT + +#if OS_VER < VERSION(5,3) +#include +#include +#include +#include +#else +#include +#include +#include +#endif + +#if OS_VER > VERSION(5,9) +#include +#include +#include +#include +#endif + +#include +#include +#include + +#include + +#define EE_SET(x) \ + CSR_WRITE_1(sc, RE_EECMD, \ + CSR_READ_1(sc, RE_EECMD) | x) + +#define EE_CLR(x) \ + CSR_WRITE_1(sc, RE_EECMD, \ + CSR_READ_1(sc, RE_EECMD) & ~x) + +/* + * Various supported device vendors/types and their names. + */ +static struct re_type re_devs[] = { + { + RT_VENDORID, RT_DEVICEID_8169, + "Realtek PCI GbE Family Controller" + }, + { + RT_VENDORID, RT_DEVICEID_8169SC, + "Realtek PCI GbE Family Controller" + }, + { + RT_VENDORID, RT_DEVICEID_8168, + "Realtek PCIe GbE Family Controller" + }, + { + RT_VENDORID, RT_DEVICEID_8161, + "Realtek PCIe GbE Family Controller" + }, + { + RT_VENDORID, RT_DEVICEID_8162, + "Realtek PCIe GbE Family Controller" + }, + { + RT_VENDORID, RT_DEVICEID_8136, + "Realtek PCIe FE Family Controller" + }, + { + DLINK_VENDORID, 0x4300, + "Realtek PCI GbE Family Controller" + }, + { + RT_VENDORID, RT_DEVICEID_8125, + "Realtek PCIe 2.5GbE Family Controller" + }, + { 0, 0, NULL } +}; + +static int re_probe __P((device_t)); +static int re_attach __P((device_t)); +static int re_detach __P((device_t)); +static int re_suspend __P((device_t)); +static int re_resume __P((device_t)); +static int re_shutdown __P((device_t)); + +void MP_WritePhyUshort __P((struct re_softc*, u_int8_t, u_int16_t)); +u_int16_t MP_ReadPhyUshort __P((struct re_softc*, u_int8_t)); +static void MP_WriteEPhyUshort __P((struct re_softc*, u_int8_t, u_int16_t)); +static u_int16_t MP_ReadEPhyUshort __P((struct re_softc*, u_int8_t)); +static u_int8_t MP_ReadEfuse __P((struct re_softc*, u_int16_t)); +static void MP_RealWritePhyOcpRegWord __P((struct re_softc*, u_int16_t, u_int16_t)); +static u_int16_t MP_RealReadPhyOcpRegWord __P((struct re_softc*, u_int16_t)); +static void MP_WritePhyOcpRegWord __P((struct re_softc*, u_int16_t, u_int8_t, u_int16_t)); +static u_int16_t MP_ReadPhyOcpRegWord __P((struct re_softc*, u_int16_t, u_int8_t)); +void MP_WriteMcuAccessRegWord __P((struct re_softc*, u_int16_t, u_int16_t)); +u_int16_t MP_ReadMcuAccessRegWord __P((struct re_softc*, u_int16_t)); +static void MP_WriteOtherFunPciEConfigSpace __P((struct re_softc *, u_int8_t, u_int16_t, u_int32_t Regata)); +static u_int32_t MP_ReadOtherFunPciEConfigSpace __P((struct re_softc *, u_int8_t, u_int16_t)); +static void MP_WritePciEConfigSpace __P((struct re_softc*, u_int16_t, u_int32_t)); +static u_int32_t MP_ReadPciEConfigSpace __P((struct re_softc*, u_int16_t)); +//static u_int8_t MP_ReadByteFun0PciEConfigSpace __P((struct re_softc*, u_int16_t)); +static bool re_set_phy_mcu_patch_request __P((struct re_softc *)); +static bool re_clear_phy_mcu_patch_request __P((struct re_softc *)); + +static int re_check_dash __P((struct re_softc *)); + +static void re_driver_start __P((struct re_softc*)); +static void re_driver_stop __P((struct re_softc*)); + +static void re_hw_phy_config __P((struct re_softc *)); +static void re_init __P((void *)); +static int re_var_init __P((struct re_softc *)); +static void re_reset __P((struct re_softc *)); +static void re_stop __P((struct re_softc *)); +static void re_setwol __P((struct re_softc *)); +static void re_clrwol __P((struct re_softc *)); +static void re_set_wol_linkspeed __P((struct re_softc *)); + +static void re_start __P((struct ifnet *)); +static int re_encap __P((struct re_softc *, struct mbuf *)); +static int re_8125_pad __P((struct re_softc *, struct mbuf *)); +static void WritePacket __P((struct re_softc *, caddr_t, int, int, int, uint32_t, uint32_t)); +static int CountFreeTxDescNum __P((struct re_descriptor)); +static int CountMbufNum __P((struct mbuf *)); +#ifdef RE_FIXUP_RX +static __inline void re_fixup_rx __P((struct mbuf *)); +#endif +static void re_txeof __P((struct re_softc *)); + +static void re_rxeof __P((struct re_softc *)); + +#if OS_VER < VERSION(7,0) +static void re_intr __P((void *)); +#else +static int re_intr __P((void *)); +#endif //OS_VER < VERSION(7,0) +#if OS_VER < VERSION(7,0) +static void re_intr_8125 __P((void *)); +#else +static int re_intr_8125 __P((void *)); +#endif //OS_VER < VERSION(7,0) +static void re_set_multicast_reg __P((struct re_softc *, u_int32_t, u_int32_t)); +static void re_set_rx_packet_filter_in_sleep_state __P((struct re_softc *)); +static void re_set_rx_packet_filter __P((struct re_softc *)); +static void re_setmulti __P((struct re_softc *)); +static int re_ioctl __P((struct ifnet *, u_long, caddr_t)); +static u_int8_t re_link_ok __P((struct re_softc *)); +static void re_link_on_patch __P((struct re_softc *)); +static void re_link_down_patch __P((struct re_softc *)); +static void re_init_timer __P((struct re_softc *)); +static void re_stop_timer __P((struct re_softc *)); +static void re_start_timer __P((struct re_softc *)); +static void re_tick __P((void *)); +#if OS_VER < VERSION(7,0) +static void re_watchdog __P((struct ifnet *)); +#endif + +static int re_ifmedia_upd __P((struct ifnet *)); +static void re_ifmedia_sts __P((struct ifnet *, struct ifmediareq *)); + +static int re_ifmedia_upd_8125 __P((struct ifnet *)); +static void re_ifmedia_sts_8125 __P((struct ifnet *, struct ifmediareq *)); + +static void re_eeprom_ShiftOutBits __P((struct re_softc *, int, int)); +static u_int16_t re_eeprom_ShiftInBits __P((struct re_softc *)); +static void re_eeprom_EEpromCleanup __P((struct re_softc *)); +static void re_eeprom_getword __P((struct re_softc *, int, u_int16_t *)); +static void re_read_eeprom __P((struct re_softc *, caddr_t, int, int, int)); +static void re_int_task (void *, int); +static void re_int_task_8125 (void *, int); + +static void re_phy_power_up(device_t dev); +static void re_phy_power_down(device_t dev); +static int re_alloc_buf(struct re_softc *); +static void re_release_buf(struct re_softc *); +static void set_rxbufsize(struct re_softc*); +static void re_release_rx_buf(struct re_softc *); +static void re_release_tx_buf(struct re_softc *); +static u_int32_t re_eri_read(struct re_softc *, int, int, int); +static int re_eri_write(struct re_softc *, int, int, u_int32_t, int); +static void OOB_mutex_lock(struct re_softc *); +static void OOB_mutex_unlock(struct re_softc *); +static void re_hw_start_unlock(struct re_softc *sc); +static void re_hw_start_unlock_8125(struct re_softc *sc); + +/* Tunables. */ +static int msi_disable = 1; +TUNABLE_INT("hw.re.msi_disable", &msi_disable); +static int msix_disable = 0; +TUNABLE_INT("hw.re.msix_disable", &msix_disable); +static int prefer_iomap = 0; +TUNABLE_INT("hw.re.prefer_iomap", &prefer_iomap); +#ifdef ENABLE_EEE +static int eee_enable = 1; +#else +static int eee_enable = 0; +#endif +TUNABLE_INT("hw.re.eee_enable", &eee_enable); +static int phy_power_saving = 1; +TUNABLE_INT("hw.re.phy_power_saving", &phy_power_saving); +static int phy_mdix_mode = RE_ETH_PHY_AUTO_MDI_MDIX; +TUNABLE_INT("hw.re.phy_mdix_mode", &phy_mdix_mode); +#ifdef ENABLE_S5WOL +static int s5wol = 1; +#else +static int s5wol = 0; +TUNABLE_INT("hw.re.s5wol", &s5wol); +#endif +#ifdef ENABLE_S0_MAGIC_PACKET +static int s0_magic_packet = 1; +#else +static int s0_magic_packet = 0; +#endif +TUNABLE_INT("hw.re.s0_magic_packet", &s0_magic_packet); + +#define RE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) + +static device_method_t re_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, re_probe), + DEVMETHOD(device_attach, re_attach), + DEVMETHOD(device_detach, re_detach), + DEVMETHOD(device_suspend, re_suspend), + DEVMETHOD(device_resume, re_resume), + DEVMETHOD(device_shutdown, re_shutdown), + { 0, 0 } +}; + +static driver_t re_driver = { + "re", + re_methods, + sizeof(struct re_softc) +}; + +static devclass_t re_devclass; + +DRIVER_MODULE(if_re, pci, re_driver, re_devclass, 0, 0); + +static void +ClearAndSetEthPhyBit( + struct re_softc *sc, + u_int8_t addr, + u_int16_t clearmask, + u_int16_t setmask +) +{ + u_int16_t PhyRegValue; + + + PhyRegValue = MP_ReadPhyUshort(sc, addr); + PhyRegValue &= ~clearmask; + PhyRegValue |= setmask; + MP_WritePhyUshort(sc, addr, PhyRegValue); +} + +static void +ClearEthPhyBit( + struct re_softc *sc, + u_int8_t addr, + u_int16_t mask +) +{ + ClearAndSetEthPhyBit(sc, + addr, + mask, + 0 + ); +} + +static void +SetEthPhyBit( + struct re_softc *sc, + u_int8_t addr, + u_int16_t mask +) +{ + ClearAndSetEthPhyBit(sc, + addr, + 0, + mask + ); +} + +static void +ClearAndSetEthPhyOcpBit( + struct re_softc *sc, + u_int16_t addr, + u_int16_t clearmask, + u_int16_t setmask +) +{ + u_int16_t PhyRegValue; + + PhyRegValue = MP_RealReadPhyOcpRegWord(sc, addr); + PhyRegValue &= ~clearmask; + PhyRegValue |= setmask; + MP_RealWritePhyOcpRegWord(sc, addr, PhyRegValue); +} + +static void +ClearEthPhyOcpBit( + struct re_softc *sc, + u_int16_t addr, + u_int16_t mask +) +{ + ClearAndSetEthPhyOcpBit(sc, + addr, + mask, + 0 + ); +} + +static void +SetEthPhyOcpBit( + struct re_softc *sc, + u_int16_t addr, + u_int16_t mask +) +{ + ClearAndSetEthPhyOcpBit(sc, + addr, + 0, + mask + ); +} + +static void +ClearAndSetMcuAccessRegBit( + struct re_softc *sc, + u_int16_t addr, + u_int16_t clearmask, + u_int16_t setmask +) +{ + u_int16_t PhyRegValue; + + PhyRegValue = MP_ReadMcuAccessRegWord(sc, addr); + PhyRegValue &= ~clearmask; + PhyRegValue |= setmask; + MP_WriteMcuAccessRegWord(sc, addr, PhyRegValue); +} + +static void +ClearMcuAccessRegBit( + struct re_softc *sc, + u_int16_t addr, + u_int16_t mask +) +{ + ClearAndSetMcuAccessRegBit(sc, + addr, + mask, + 0 + ); +} + +static void +SetMcuAccessRegBit( + struct re_softc *sc, + u_int16_t addr, + u_int16_t mask +) +{ + ClearAndSetMcuAccessRegBit(sc, + addr, + 0, + mask + ); +} + +static void re_clear_phy_ups_reg(struct re_softc *sc) +{ + switch(sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + if (sc->re_type == MACFG_82 || sc->re_type == MACFG_83) + ClearEthPhyOcpBit(sc, 0xA466, BIT_0); + + ClearEthPhyOcpBit(sc, 0xA468, BIT_3 | BIT_1); + break; + }; +} + +static int re_is_ups_resume(struct re_softc *sc) +{ + switch(sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + return (MP_ReadMcuAccessRegWord(sc, 0xD42C) & BIT_8); + default: + return (MP_ReadMcuAccessRegWord(sc, 0xD408) & BIT_0); + } +} + +static void re_clear_ups_resume_bit(struct re_softc *sc) +{ + switch(sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + MP_WriteMcuAccessRegWord(sc, 0xD408, MP_ReadMcuAccessRegWord(sc, 0xD408) & ~(BIT_8)); + break; + default: + MP_WriteMcuAccessRegWord(sc, 0xD408, MP_ReadMcuAccessRegWord(sc, 0xD408) & ~(BIT_0)); + break; + } +} + +static void re_wait_phy_ups_resume(struct re_softc *sc, u_int16_t PhyState) +{ + u_int16_t TmpPhyState; + int i=0; + + switch(sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + do { + TmpPhyState = MP_RealReadPhyOcpRegWord(sc, 0xA420); + TmpPhyState &= 0x7; + DELAY(1000); + i++; + } while ((i < 100) && (TmpPhyState != 2)); + break; + default: + do { + TmpPhyState = MP_ReadPhyOcpRegWord(sc, 0x0A42, 0x10); + TmpPhyState &= 0x7; + DELAY(1000); + i++; + } while ((i < 100) && (TmpPhyState != 2)); + break; + }; +} + +static void re_phy_power_up(dev) +device_t dev; +{ + struct re_softc *sc; + u_int8_t Data8; + + sc = device_get_softc(dev); + + if ((sc->re_if_flags & RL_FLAG_PHYWAKE_PM) != 0) + CSR_WRITE_1(sc, RE_PMCH, CSR_READ_1(sc, RE_PMCH) | (BIT_6|BIT_7)); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + switch (sc->re_type) { + case MACFG_4: + case MACFG_5: + case MACFG_6: + case MACFG_21: + case MACFG_22: + case MACFG_23: + case MACFG_24: + case MACFG_25: + case MACFG_26: + case MACFG_27: + case MACFG_28: + case MACFG_31: + case MACFG_32: + case MACFG_33: + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + MP_WritePhyUshort(sc, 0x0e, 0x0000); + break; + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_61: + Data8 = re_eri_read(sc, 0x1AB, 1, ERIAR_ExGMAC); + Data8 |= (BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7); + re_eri_write(sc, 0x1AB, 1, Data8, ERIAR_ExGMAC); + break; + default: + break; + }; + + + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN); + + //wait mdc/mdio ready + switch(sc->re_type) { + case MACFG_61: + case MACFG_62: + case MACFG_67: + DELAY(10000); + break; + } + + //wait ups resume (phy state 3) + switch(sc->re_type) { + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_wait_phy_ups_resume(sc, 3); + break; + }; +} + +static u_int16_t re_get_phy_lp_ability(struct re_softc *sc) +{ + u_int16_t anlpar; + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + anlpar = MP_ReadPhyUshort(sc, MII_ANLPAR); + + return anlpar; +} + +static void re_phy_power_down(dev) +device_t dev; +{ + struct re_softc *sc; + u_int8_t Data8; + + sc = device_get_softc(dev); + +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(sc)) + return; +#endif //ENABLE_FIBER_SUPPORT + + if (sc->re_dash) { + re_set_wol_linkspeed(sc); + return; + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + switch (sc->re_type) { + case MACFG_21: + case MACFG_22: + case MACFG_23: + case MACFG_24: + case MACFG_25: + case MACFG_26: + case MACFG_27: + case MACFG_28: + case MACFG_31: + case MACFG_32: + case MACFG_33: + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + MP_WritePhyUshort(sc, 0x0e, 0x0200); + MP_WritePhyUshort(sc, MII_BMCR, (BMCR_AUTOEN|BMCR_PDOWN)); + break; + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_61: + Data8 = re_eri_read(sc, 0x1AB, 1, ERIAR_ExGMAC); + Data8 &= ~(BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7); + re_eri_write(sc, 0x1AB, 1, Data8, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, MII_BMCR, (BMCR_AUTOEN|BMCR_PDOWN)); + break; + default: + MP_WritePhyUshort(sc, MII_BMCR, (BMCR_AUTOEN|BMCR_PDOWN)); + break; + } + + switch (sc->re_type) { + case MACFG_36: + case MACFG_37: + case MACFG_42: + case MACFG_43: + case MACFG_54: + case MACFG_55: + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) & ~BIT_6); + break; + case MACFG_38: + case MACFG_39: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) & ~BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~BIT_6); + break; + } + + if ((sc->re_if_flags & RL_FLAG_PHYWAKE_PM) != 0) + CSR_WRITE_1(sc, RE_PMCH, CSR_READ_1(sc, RE_PMCH) & ~(BIT_6|BIT_7)); +} + +static void re_tx_dma_map_buf(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + union TxDesc *txptr = arg; + + if (error) { + txptr->ul[0] &= ~htole32(RL_TDESC_CMD_BUFLEN); + txptr->so1.TxBuffL = 0; + txptr->so1.TxBuffH = 0; + return; + } + + txptr->so1.TxBuffL = htole32(RL_ADDR_LO(segs->ds_addr)); + txptr->so1.TxBuffH = htole32(RL_ADDR_HI(segs->ds_addr)); +} + +static void re_rx_dma_map_buf(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + union RxDesc *rxptr = arg; + + if (error) { + rxptr->ul[0] &= ~htole32(RL_RDESC_CMD_BUFLEN); + rxptr->so0.RxBuffL = 0; + rxptr->so0.RxBuffH = 0; + return; + } + + rxptr->so0.RxBuffL = htole32(RL_ADDR_LO(segs->ds_addr)); + rxptr->so0.RxBuffH = htole32(RL_ADDR_HI(segs->ds_addr)); +} + +static void re_dma_map_rxdesc(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct re_softc *sc = arg; + + + if (error) + return; + + CSR_WRITE_4(sc, 0xe4, RL_ADDR_LO(segs->ds_addr)); + CSR_WRITE_4(sc, 0xe8, RL_ADDR_HI(segs->ds_addr)); +} + +static void re_dma_map_txdesc(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct re_softc *sc = arg; + + + if (error) + return; + + CSR_WRITE_4(sc, 0x20, RL_ADDR_LO(segs->ds_addr)); + CSR_WRITE_4(sc, 0x24, RL_ADDR_HI(segs->ds_addr)); +} + +/* + * Probe for a RealTek 8129/8139 chip. Check the PCI vendor and device + * IDs against our list and return a device name if we find a match. + */ +static int re_probe(dev) /* Search for Realtek NIC chip */ +device_t dev; +{ + struct re_type *t; + t = re_devs; + while (t->re_name != NULL) { + if ((pci_get_vendor(dev) == t->re_vid) && + (pci_get_device(dev) == t->re_did)) { + device_set_desc(dev, t->re_name); + return(0); + } + t++; + } + + return(ENXIO); +} + + +static u_int32_t re_eri_read_with_oob_base_address(struct re_softc *sc, int addr, int len, int type, const u_int32_t base_address) +{ + int i, val_shift, shift = 0; + u_int32_t value1 = 0, value2 = 0, mask; + const u_int32_t transformed_base_address = ((base_address & 0x00FFF000) << 6) | (base_address & 0x000FFF); + + if (len > 4 || len <= 0) + return -1; + + while (len > 0) { + val_shift = addr % ERIAR_Addr_Align; + addr = addr & ~0x3; + + CSR_WRITE_4(sc,RE_ERIAR, + ERIAR_Read | + transformed_base_address | + type << ERIAR_Type_shift | + ERIAR_ByteEn << ERIAR_ByteEn_shift | + addr); + + for (i = 0; i < 10; i++) { + DELAY(100); + + /* Check if the RTL8168 has completed ERI read */ + if (CSR_READ_4(sc,RE_ERIAR) & ERIAR_Flag) + break; + } + + if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + + value1 = CSR_READ_4(sc,RE_ERIDR) & mask; + value2 |= (value1 >> val_shift * 8) << shift * 8; + + if (len <= 4 - val_shift) + len = 0; + else { + len -= (4 - val_shift); + shift = 4 - val_shift; + addr += 4; + } + } + + return value2; +} + +static u_int32_t re_eri_read(struct re_softc *sc, int addr, int len, int type) +{ + return re_eri_read_with_oob_base_address(sc, addr, len, type, 0); +} + +static int re_eri_write_with_oob_base_address(struct re_softc *sc, int addr, int len, u_int32_t value, int type, const u_int32_t base_address) +{ + + int i, val_shift, shift = 0; + u_int32_t value1 = 0, mask; + const u_int32_t transformed_base_address = ((base_address & 0x00FFF000) << 6) | (base_address & 0x000FFF); + + if (len > 4 || len <= 0) + return -1; + + while (len > 0) { + val_shift = addr % ERIAR_Addr_Align; + addr = addr & ~0x3; + + if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + + value1 = re_eri_read_with_oob_base_address(sc, addr, 4, type, base_address) & ~mask; + value1 |= ((value << val_shift * 8) >> shift * 8); + + CSR_WRITE_4(sc,RE_ERIDR, value1); + CSR_WRITE_4(sc,RE_ERIAR, + ERIAR_Write | + transformed_base_address | + type << ERIAR_Type_shift | + ERIAR_ByteEn << ERIAR_ByteEn_shift | + addr); + + for (i = 0; i < 10; i++) { + DELAY(100); + + /* Check if the RTL8168 has completed ERI write */ + if (!(CSR_READ_4(sc,RE_ERIAR) & ERIAR_Flag)) + break; + } + + if (len <= 4 - val_shift) + len = 0; + else { + len -= (4 - val_shift); + shift = 4 - val_shift; + addr += 4; + } + } + + return 0; +} + +static int re_eri_write(struct re_softc *sc, int addr, int len, u_int32_t value, int type) +{ + return re_eri_write_with_oob_base_address(sc, addr, len, value, type, 0); +} + +static void re_release_rx_buf(struct re_softc *sc) +{ + struct ifnet *ifp; + int i; + ifp = RE_GET_IFNET(sc); + + if (sc->re_desc.re_rx_mtag) { + for (i = 0; i < RE_RX_BUF_NUM; i++) { + if (sc->re_desc.rx_buf[i]!=NULL) { + bus_dmamap_sync(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i], + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i]); + bus_dmamap_destroy(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i]); + m_freem(sc->re_desc.rx_buf[i]); + sc->re_desc.rx_buf[i] =NULL; + } + } + bus_dma_tag_destroy(sc->re_desc.re_rx_mtag); + sc->re_desc.re_rx_mtag =0; + } + +} +static void re_release_tx_buf(struct re_softc *sc) +{ + struct ifnet *ifp; + int i; + ifp = RE_GET_IFNET(sc); + + if (sc->re_desc.re_tx_mtag) { + for (i = 0; i < RE_TX_BUF_NUM; i++) { + + bus_dmamap_destroy(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[i]); + m_freem(sc->re_desc.tx_buf[i]); + + } + bus_dma_tag_destroy(sc->re_desc.re_tx_mtag); + sc->re_desc.re_tx_mtag = 0; + } + + +} +static void re_release_buf(struct re_softc *sc) +{ + re_release_rx_buf(sc); + re_release_tx_buf(sc); +} + + + +static int re_alloc_buf(struct re_softc *sc) +{ + int error =0; + int i,size; + + error = bus_dma_tag_create(sc->re_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, MCLBYTES* RE_NTXSEGS, RE_NTXSEGS, 4096, 0, + NULL, NULL, &sc->re_desc.re_tx_mtag); + + if (error) { + //device_printf(dev,"re_tx_mtag fail\n"); + //goto fail; + return error; + } + + error = bus_dma_tag_create( + sc->re_parent_tag, + RE_RX_BUFFER_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + sc->re_rx_desc_buf_sz, 1, /* maxsize,nsegments */ + sc->re_rx_desc_buf_sz, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->re_desc.re_rx_mtag); + if (error) { + //device_printf(dev,"re_rx_mtag fail\n"); + //goto fail; + return error; + } + + if (sc->re_rx_mbuf_sz <= MCLBYTES) + size = MCLBYTES; + else if (sc->re_rx_mbuf_sz <= MJUMPAGESIZE) + size = MJUMPAGESIZE; + else + size =MJUM9BYTES; + for (i = 0; i < RE_RX_BUF_NUM; i++) { + sc->re_desc.rx_buf[i] = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, size); + if (!sc->re_desc.rx_buf[i]) { + //device_printf(dev, "m_getcl fail!!!\n"); + error = ENXIO; + //goto fail; + return error; + } + + sc->re_desc.rx_buf[i]->m_len = sc->re_desc.rx_buf[i]->m_pkthdr.len = size; +#ifdef RE_FIXUP_RX + /* + * This is part of an evil trick to deal with non-x86 platforms. + * The RealTek chip requires RX buffers to be aligned on 64-bit + * boundaries, but that will hose non-x86 machines. To get around + * this, we leave some empty space at the start of each buffer + * and for non-x86 hosts, we copy the buffer back six bytes + * to achieve word alignment. This is slightly more efficient + * than allocating a new buffer, copying the contents, and + * discarding the old buffer. + */ + m_adj(sc->re_desc.rx_buf[i], RE_ETHER_ALIGN); +#endif + + error = bus_dmamap_create(sc->re_desc.re_rx_mtag, BUS_DMA_NOWAIT, &sc->re_desc.re_rx_dmamap[i]); + if (error) { + //device_printf(dev, "bus_dmamap_create fail!!!\n"); + //goto fail; + return error; + } + } + + for (i = 0; i < RE_TX_BUF_NUM; i++) { + error = bus_dmamap_create(sc->re_desc.re_tx_mtag, BUS_DMA_NOWAIT, &sc->re_desc.re_tx_dmamap[i]); + if (error) { + //device_printf(dev, "bus_dmamap_create fail!!!\n"); + //goto fail; + return error; + } + } + + return 0; +} + +static void set_rxbufsize(struct re_softc *sc) +{ + + //printf("set size\n"); + + struct ifnet *ifp; + ifp = RE_GET_IFNET(sc); + sc->re_rx_desc_buf_sz = (ifp->if_mtu > ETHERMTU) ? ifp->if_mtu: ETHERMTU; + sc->re_rx_desc_buf_sz += (ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN + ETHER_CRC_LEN + 1); + CSR_WRITE_2(sc, RE_RxMaxSize, sc->re_rx_desc_buf_sz); +} + +static void re_enable_cfg9346_write(struct re_softc *sc) +{ + EE_SET(RE_EEMODE_WRITECFG); +} + +static void re_disable_cfg9346_write(struct re_softc *sc) +{ + EE_CLR(RE_EEMODE_WRITECFG); +} + +static void DisableMcuBPs(struct re_softc *sc) +{ + u_int16_t regAddr; + + switch(sc->re_type) { + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_enable_cfg9346_write(sc); + CSR_WRITE_1(sc, RE_CFG5, CSR_READ_1(sc, RE_CFG5) & ~BIT_0); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) & ~BIT_7); + re_disable_cfg9346_write(sc); + break; + } + + switch(sc->re_type) { + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x0000); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + MP_WriteMcuAccessRegWord(sc, 0xFC48, 0x0000); + break; + } + + switch(sc->re_type) { + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC36, 0x0000); + + DELAY(3000); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x0000); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + for (regAddr = 0xFC28; regAddr < 0xFC48; regAddr += 2) { + MP_WriteMcuAccessRegWord(sc, regAddr, 0x0000); + } + + DELAY(3000); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x0000); + break; + } +} + +static void +re_switch_mac_mcu_ram_code_page(struct re_softc *sc, u_int16_t page) +{ + u_int16_t tmpUshort; + + page &= (BIT_1 | BIT_0); + tmpUshort = MP_ReadMcuAccessRegWord(sc, 0xE446); + tmpUshort &= ~(BIT_1 | BIT_0); + tmpUshort |= page; + MP_WriteMcuAccessRegWord(sc, 0xE446, tmpUshort); +} + +static void +_re_write_mac_mcu_ram_code(struct re_softc *sc, const u_int16_t *entry, u_int16_t entry_cnt) +{ + u_int16_t i; + + for (i = 0; i < entry_cnt; i++) { + MP_WriteMcuAccessRegWord(sc, 0xF800 + i * 2, entry[i]); + } +} + +static void +_re_write_mac_mcu_ram_code_with_page(struct re_softc *sc, const u_int16_t *entry, u_int16_t entry_cnt, u_int16_t page_size) +{ + u_int16_t i; + u_int16_t offset; + + if (page_size == 0) return; + + for (i = 0; i < entry_cnt; i++) { + offset = i % page_size; + if (offset == 0) { + u_int16_t page = (i / page_size); + re_switch_mac_mcu_ram_code_page(sc, page); + } + MP_WriteMcuAccessRegWord(sc, 0xF800 + offset * 2, entry[i]); + } +} + +static void +re_write_mac_mcu_ram_code(struct re_softc *sc, const u_int16_t *entry, u_int16_t entry_cnt) +{ + if (FALSE == HW_SUPPORT_MAC_MCU(sc)) return; + if (entry == NULL || entry_cnt == 0) return; + + if (sc->MacMcuPageSize > 0) + _re_write_mac_mcu_ram_code_with_page(sc, entry, entry_cnt, sc->MacMcuPageSize); + else + _re_write_mac_mcu_ram_code(sc, entry, entry_cnt); +} + +static void re_set_mac_mcu_8168g_1(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168g_1[] = { + 0xE008, 0xE01B, 0xE022, 0xE094, 0xE097, 0xE09A, 0xE0B3, 0xE0BA, 0x49D2, + 0xF10D, 0x766C, 0x49E2, 0xF00A, 0x1EC0, 0x8EE1, 0xC60A, 0x77C0, 0x4870, + 0x9FC0, 0x1EA0, 0xC707, 0x8EE1, 0x9D6C, 0xC603, 0xBE00, 0xB416, 0x0076, + 0xE86C, 0xC406, 0x7580, 0x4852, 0x8D80, 0xC403, 0xBC00, 0xD3E0, 0x02C8, + 0x8918, 0xE815, 0x1100, 0xF011, 0xE812, 0x4990, 0xF002, 0xE817, 0xE80E, + 0x4992, 0xF002, 0xE80E, 0xE80A, 0x4993, 0xF002, 0xE818, 0xE806, 0x4991, + 0xF002, 0xE838, 0xC25E, 0xBA00, 0xC056, 0x7100, 0xFF80, 0x7100, 0x4892, + 0x4813, 0x8900, 0xE00A, 0x7100, 0x4890, 0x4813, 0x8900, 0xC74B, 0x74F8, + 0x48C2, 0x4841, 0x8CF8, 0xC746, 0x74FC, 0x49C0, 0xF120, 0x49C1, 0xF11E, + 0x74F8, 0x49C0, 0xF01B, 0x49C6, 0xF119, 0x74F8, 0x49C4, 0xF013, 0xC536, + 0x74B0, 0x49C1, 0xF1FD, 0xC537, 0xC434, 0x9CA0, 0xC435, 0x1C13, 0x484F, + 0x9CA2, 0xC52B, 0x74B0, 0x49C1, 0xF1FD, 0x74F8, 0x48C4, 0x8CF8, 0x7100, + 0x4893, 0x8900, 0xFF80, 0xC520, 0x74B0, 0x49C1, 0xF11C, 0xC71E, 0x74FC, + 0x49C1, 0xF118, 0x49C0, 0xF116, 0x74F8, 0x49C0, 0xF013, 0x48C3, 0x8CF8, + 0xC516, 0x74A2, 0x49CE, 0xF1FE, 0xC411, 0x9CA0, 0xC411, 0x1C13, 0x484F, + 0x9CA2, 0x74A2, 0x49CF, 0xF1FE, 0x7100, 0x4891, 0x8900, 0xFF80, 0xE400, + 0xD3E0, 0xE000, 0x0481, 0x0C81, 0xDE20, 0x0000, 0x0992, 0x1B76, 0xC602, + 0xBE00, 0x059C, 0x1B76, 0xC602, 0xBE00, 0x065A, 0xB400, 0x18DE, 0x2008, + 0x4001, 0xF10F, 0x7342, 0x1880, 0x2008, 0x0009, 0x4018, 0xF109, 0x7340, + 0x25BC, 0x130F, 0xF105, 0xC00A, 0x7300, 0x4831, 0x9B00, 0xB000, 0x7340, + 0x8320, 0xC302, 0xBB00, 0x0C12, 0xE860, 0xC406, 0x7580, 0x4851, 0x8D80, + 0xC403, 0xBC00, 0xD3E0, 0x02C8, 0xC406, 0x7580, 0x4850, 0x8D80, 0xC403, + 0xBC00, 0xD3E0, 0x0298 + }; + + MP_WriteMcuAccessRegWord(sc, 0xE43C, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xE43E, 0x0000); + + MP_WriteMcuAccessRegWord(sc, 0xE434, 0x0004); + MP_WriteMcuAccessRegWord(sc, 0xE43C, 0x0004); + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168g_1, ARRAY_SIZE(mcu_patch_code_8168g_1)); + + MP_WriteMcuAccessRegWord(sc, 0xDE30, 0x0080); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0075); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x02B1); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0991); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x059B); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0659); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x02C7); + MP_WriteMcuAccessRegWord(sc, 0xFC36, 0x0279); +} + +static void re_set_mac_mcu_8168gu_1(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168gu_1[] = { + 0xE008, 0xE011, 0xE015, 0xE018, 0xE01B, 0xE027, 0xE043, 0xE065, 0x49E2, + 0xF005, 0x49EA, 0xF003, 0xC404, 0xBC00, 0xC403, 0xBC00, 0x0496, 0x051A, + 0x1D01, 0x8DE8, 0xC602, 0xBE00, 0x0206, 0x1B76, 0xC202, 0xBA00, 0x058A, + 0x1B76, 0xC602, 0xBE00, 0x0648, 0x74E6, 0x1B78, 0x46DC, 0x1300, 0xF005, + 0x74F8, 0x48C3, 0x48C4, 0x8CF8, 0x64E7, 0xC302, 0xBB00, 0x068E, 0x74E4, + 0x49C5, 0xF106, 0x49C6, 0xF107, 0x48C8, 0x48C9, 0xE011, 0x48C9, 0x4848, + 0xE00E, 0x4848, 0x49C7, 0xF00A, 0x48C9, 0xC60D, 0x1D1F, 0x8DC2, 0x1D00, + 0x8DC3, 0x1D11, 0x8DC0, 0xE002, 0x4849, 0x94E5, 0xC602, 0xBE00, 0x0238, + 0xE434, 0x49D9, 0xF01B, 0xC31E, 0x7464, 0x49C4, 0xF114, 0xC31B, 0x6460, + 0x14FA, 0xFA02, 0xE00F, 0xC317, 0x7460, 0x49C0, 0xF10B, 0xC311, 0x7462, + 0x48C1, 0x9C62, 0x4841, 0x9C62, 0xC30A, 0x1C04, 0x8C60, 0xE004, 0x1C15, + 0xC305, 0x8C60, 0xC602, 0xBE00, 0x0374, 0xE434, 0xE030, 0xE61C, 0xE906, + 0xC602, 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168gu_1, ARRAY_SIZE(mcu_patch_code_8168gu_1)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0493); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0205); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0589); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0647); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x0215); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x0285); +} + +static void re_set_mac_mcu_8168gu_2(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168gu_2[] = { + 0xE008, 0xE00A, 0xE00D, 0xE02F, 0xE031, 0xE038, 0xE03A, 0xE051, 0xC202, + 0xBA00, 0x0DFC, 0x7444, 0xC502, 0xBD00, 0x0A30, 0x49D9, 0xF019, 0xC520, + 0x64A5, 0x1400, 0xF007, 0x0C01, 0x8CA5, 0x1C15, 0xC515, 0x9CA0, 0xE00F, + 0xC513, 0x74A0, 0x48C8, 0x48CA, 0x9CA0, 0xC510, 0x1B00, 0x9BA0, 0x1B1C, + 0x483F, 0x9BA2, 0x1B04, 0xC506, 0x9BA0, 0xC603, 0xBE00, 0x0298, 0x03DE, + 0xE434, 0xE096, 0xE860, 0xDE20, 0xD3C0, 0xC602, 0xBE00, 0x0A64, 0xC707, + 0x1D00, 0x8DE2, 0x48C1, 0xC502, 0xBD00, 0x00AA, 0xE0C0, 0xC502, 0xBD00, + 0x0132, 0xC50C, 0x74A2, 0x49CE, 0xF1FE, 0x1C00, 0x9EA0, 0x1C1C, 0x484F, + 0x9CA2, 0xC402, 0xBC00, 0x0AFA, 0xDE20, 0xE000, 0xE092, 0xE430, 0xDE20, + 0xE0C0, 0xE860, 0xE84C, 0xB400, 0xB430, 0xE410, 0xC0AE, 0xB407, 0xB406, + 0xB405, 0xB404, 0xB403, 0xB402, 0xB401, 0xC7EE, 0x76F4, 0xC2ED, 0xC3ED, + 0xC1EF, 0xC5F3, 0x74A0, 0x49CD, 0xF001, 0xC5EE, 0x74A0, 0x49C1, 0xF105, + 0xC5E4, 0x74A2, 0x49CE, 0xF00B, 0x7444, 0x484B, 0x9C44, 0x1C10, 0x9C62, + 0x1C11, 0x8C60, 0x1C00, 0x9CF6, 0xE0EC, 0x49E7, 0xF016, 0x1D80, 0x8DF4, + 0x74F8, 0x4843, 0x8CF8, 0x74F8, 0x74F8, 0x7444, 0x48C8, 0x48C9, 0x48CA, + 0x9C44, 0x74F8, 0x4844, 0x8CF8, 0x1E01, 0xE8DB, 0x7420, 0x48C1, 0x9C20, + 0xE0D5, 0x49E6, 0xF02A, 0x1D40, 0x8DF4, 0x74FC, 0x49C0, 0xF124, 0x49C1, + 0xF122, 0x74F8, 0x49C0, 0xF01F, 0xE8D3, 0x48C4, 0x8CF8, 0x1E00, 0xE8C6, + 0xC5B1, 0x74A0, 0x49C3, 0xF016, 0xC5AF, 0x74A4, 0x49C2, 0xF005, 0xC5AA, + 0x74B2, 0x49C9, 0xF10E, 0xC5A6, 0x74A8, 0x4845, 0x4846, 0x4847, 0x4848, + 0x9CA8, 0x74B2, 0x4849, 0x9CB2, 0x74A0, 0x484F, 0x9CA0, 0xE0AA, 0x49E4, + 0xF018, 0x1D10, 0x8DF4, 0x74F8, 0x74F8, 0x74F8, 0x4843, 0x8CF8, 0x74F8, + 0x74F8, 0x74F8, 0x4844, 0x4842, 0x4841, 0x8CF8, 0x1E01, 0xE89A, 0x7420, + 0x4841, 0x9C20, 0x7444, 0x4848, 0x9C44, 0xE091, 0x49E5, 0xF03E, 0x1D20, + 0x8DF4, 0x74F8, 0x48C2, 0x4841, 0x8CF8, 0x1E01, 0x7444, 0x49CA, 0xF103, + 0x49C2, 0xF00C, 0x49C1, 0xF004, 0x6447, 0x2244, 0xE002, 0x1C01, 0x9C62, + 0x1C11, 0x8C60, 0x1C00, 0x9CF6, 0x7444, 0x49C8, 0xF01D, 0x74FC, 0x49C0, + 0xF11A, 0x49C1, 0xF118, 0x74F8, 0x49C0, 0xF015, 0x49C6, 0xF113, 0xE875, + 0x48C4, 0x8CF8, 0x7420, 0x48C1, 0x9C20, 0xC50A, 0x74A2, 0x8CA5, 0x74A0, + 0xC505, 0x9CA2, 0x1C11, 0x9CA0, 0xE00A, 0xE434, 0xD3C0, 0xDC00, 0x7444, + 0x49CA, 0xF004, 0x48CA, 0x9C44, 0xE855, 0xE052, 0x49E8, 0xF024, 0x1D01, + 0x8DF5, 0x7440, 0x49C0, 0xF11E, 0x7444, 0x49C8, 0xF01B, 0x49CA, 0xF119, + 0xC5EC, 0x76A4, 0x49E3, 0xF015, 0x49C0, 0xF103, 0x49C1, 0xF011, 0x4849, + 0x9C44, 0x1C00, 0x9CF6, 0x7444, 0x49C1, 0xF004, 0x6446, 0x1E07, 0xE003, + 0x1C01, 0x1E03, 0x9C62, 0x1C11, 0x8C60, 0xE830, 0xE02D, 0x49E9, 0xF004, + 0x1D02, 0x8DF5, 0xE79C, 0x49E3, 0xF006, 0x1D08, 0x8DF4, 0x74F8, 0x74F8, + 0xE73A, 0x49E1, 0xF007, 0x1D02, 0x8DF4, 0x1E01, 0xE7A7, 0xDE20, 0xE410, + 0x49E0, 0xF017, 0x1D01, 0x8DF4, 0xC5FA, 0x1C00, 0x8CA0, 0x1C1B, 0x9CA2, + 0x74A2, 0x49CF, 0xF0FE, 0xC5F3, 0x74A0, 0x4849, 0x9CA0, 0x74F8, 0x49C0, + 0xF006, 0x48C3, 0x8CF8, 0xE820, 0x74F8, 0x74F8, 0xC432, 0xBC00, 0xC5E4, + 0x74A2, 0x49CE, 0xF1FE, 0x9EA0, 0x1C1C, 0x484F, 0x9CA2, 0xFF80, 0xB404, + 0xB405, 0xC5D9, 0x74A2, 0x49CE, 0xF1FE, 0xC41F, 0x9CA0, 0xC41C, 0x1C13, + 0x484F, 0x9CA2, 0x74A2, 0x49CF, 0xF1FE, 0xB005, 0xB004, 0xFF80, 0xB404, + 0xB405, 0xC5C7, 0x74A2, 0x49CE, 0xF1FE, 0xC40E, 0x9CA0, 0xC40A, 0x1C13, + 0x484F, 0x9CA2, 0x74A2, 0x49CF, 0xF1FE, 0xB005, 0xB004, 0xFF80, 0x0000, + 0x0481, 0x0C81, 0x0AE0 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168gu_2, ARRAY_SIZE(mcu_patch_code_8168gu_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0297); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x00A9); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x012D); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC36, 0x08DF); +} + +static void re_set_mac_mcu_8168ep_1(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168ep_1[] = { + 0xE008, 0xE0D3, 0xE0D6, 0xE0D9, 0xE0DB, 0xE0DD, 0xE0DF, 0xE0E1, 0xC251, + 0x7340, 0x49B1, 0xF010, 0x1D02, 0x8D40, 0xC202, 0xBA00, 0x2C3A, 0xC0F0, + 0xE8DE, 0x2000, 0x8000, 0xC0B6, 0x268C, 0x752C, 0x49D4, 0xF112, 0xE025, + 0xC2F6, 0x7146, 0xC2F5, 0x7340, 0x49BE, 0xF103, 0xC7F2, 0xE002, 0xC7F1, + 0x304F, 0x6226, 0x49A1, 0xF1F0, 0x7222, 0x49A0, 0xF1ED, 0x2525, 0x1F28, + 0x3097, 0x3091, 0x9A36, 0x752C, 0x21DC, 0x25BC, 0xC6E2, 0x77C0, 0x1304, + 0xF014, 0x1303, 0xF014, 0x1302, 0xF014, 0x1301, 0xF014, 0x49D4, 0xF103, + 0xC3D7, 0xBB00, 0xC618, 0x67C6, 0x752E, 0x22D7, 0x26DD, 0x1505, 0xF013, + 0xC60A, 0xBE00, 0xC309, 0xBB00, 0xC308, 0xBB00, 0xC307, 0xBB00, 0xC306, + 0xBB00, 0x25C8, 0x25A6, 0x25AC, 0x25B2, 0x25B8, 0xCD08, 0x0000, 0xC0BC, + 0xC2FF, 0x7340, 0x49B0, 0xF04E, 0x1F46, 0x308F, 0xC3F7, 0x1C04, 0xE84D, + 0x1401, 0xF147, 0x7226, 0x49A7, 0xF044, 0x7222, 0x2525, 0x1F30, 0x3097, + 0x3091, 0x7340, 0xC4EA, 0x401C, 0xF006, 0xC6E8, 0x75C0, 0x49D7, 0xF105, + 0xE036, 0x1D08, 0x8DC1, 0x0208, 0x6640, 0x2764, 0x1606, 0xF12F, 0x6346, + 0x133B, 0xF12C, 0x9B34, 0x1B18, 0x3093, 0xC32A, 0x1C10, 0xE82A, 0x1401, + 0xF124, 0x1A36, 0x308A, 0x7322, 0x25B5, 0x0B0E, 0x1C00, 0xE82C, 0xC71F, + 0x4027, 0xF11A, 0xE838, 0x1F42, 0x308F, 0x1B08, 0xE824, 0x7236, 0x7746, + 0x1700, 0xF00D, 0xC313, 0x401F, 0xF103, 0x1F00, 0x9F46, 0x7744, 0x449F, + 0x445F, 0xE817, 0xC70A, 0x4027, 0xF105, 0xC302, 0xBB00, 0x2E08, 0x2DC2, + 0xC7FF, 0xBF00, 0xCDB8, 0xFFFF, 0x0C02, 0xA554, 0xA5DC, 0x402F, 0xF105, + 0x1400, 0xF1FA, 0x1C01, 0xE002, 0x1C00, 0xFF80, 0x49B0, 0xF004, 0x0B01, + 0xA1D3, 0xE003, 0x0B02, 0xA5D3, 0x3127, 0x3720, 0x0B02, 0xA5D3, 0x3127, + 0x3720, 0x1300, 0xF1FB, 0xFF80, 0x7322, 0x25B5, 0x1E28, 0x30DE, 0x30D9, + 0x7264, 0x1E11, 0x2368, 0x3116, 0xFF80, 0x1B7E, 0xC602, 0xBE00, 0x06A6, + 0x1B7E, 0xC602, 0xBE00, 0x0764, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168ep_1, ARRAY_SIZE(mcu_patch_code_8168ep_1)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x2549); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x06A5); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0763); +} + +static bool re_check_dash_other_fun_present(struct re_softc *sc) +{ + //check if func 2 exist + if (MP_ReadOtherFunPciEConfigSpace(sc, 2, 0xf000) != 0xffffffff) + return true; + + return false; +} + +static void re_set_mac_mcu_8168ep_2(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168ep_2[] = { + 0xE008, 0xE017, 0xE052, 0xE057, 0xE059, 0xE05B, 0xE05D, 0xE05F, 0xC50F, + 0x76A4, 0x49E3, 0xF007, 0x49C0, 0xF103, 0xC607, 0xBE00, 0xC606, 0xBE00, + 0xC602, 0xBE00, 0x0BDA, 0x0BB6, 0x0BBA, 0xDC00, 0xB400, 0xB401, 0xB402, + 0xB403, 0xB404, 0xC02E, 0x7206, 0x49AE, 0xF1FE, 0xC12B, 0x9904, 0xC12A, + 0x9906, 0x7206, 0x49AE, 0xF1FE, 0x7200, 0x49A0, 0xF117, 0xC123, 0xC223, + 0xC323, 0xE808, 0xC322, 0xE806, 0xC321, 0xE804, 0xC320, 0xE802, 0xE00C, + 0x740E, 0x49CE, 0xF1FE, 0x9908, 0x990A, 0x9A0C, 0x9B0E, 0x740E, 0x49CE, + 0xF1FE, 0xFF80, 0xB004, 0xB003, 0xB002, 0xB001, 0xB000, 0xC604, 0xC002, + 0xB800, 0x1FC8, 0xE000, 0xE8E0, 0xF128, 0x0002, 0xFFFF, 0xF000, 0x8001, + 0x8002, 0x8003, 0x8004, 0x48C1, 0x48C2, 0x9C46, 0xC402, 0xBC00, 0x0490, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168ep_2, ARRAY_SIZE(mcu_patch_code_8168ep_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0BB3); + if (false == re_check_dash_other_fun_present(sc)) + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x1FC7); + //MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0485); +} + +static void re_set_mac_mcu_8411b_1(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8411b_1[] = { + 0xE008, 0xE00A, 0xE00C, 0xE00E, 0xE027, 0xE04F, 0xE05E, 0xE065, 0xC602, + 0xBE00, 0x0000, 0xC502, 0xBD00, 0x074C, 0xC302, 0xBB00, 0x080A, 0x6420, + 0x48C2, 0x8C20, 0xC516, 0x64A4, 0x49C0, 0xF009, 0x74A2, 0x8CA5, 0x74A0, + 0xC50E, 0x9CA2, 0x1C11, 0x9CA0, 0xE006, 0x74F8, 0x48C4, 0x8CF8, 0xC404, + 0xBC00, 0xC403, 0xBC00, 0x0BF2, 0x0C0A, 0xE434, 0xD3C0, 0x49D9, 0xF01F, + 0xC526, 0x64A5, 0x1400, 0xF007, 0x0C01, 0x8CA5, 0x1C15, 0xC51B, 0x9CA0, + 0xE013, 0xC519, 0x74A0, 0x48C4, 0x8CA0, 0xC516, 0x74A4, 0x48C8, 0x48CA, + 0x9CA4, 0xC512, 0x1B00, 0x9BA0, 0x1B1C, 0x483F, 0x9BA2, 0x1B04, 0xC508, + 0x9BA0, 0xC505, 0xBD00, 0xC502, 0xBD00, 0x0300, 0x051E, 0xE434, 0xE018, + 0xE092, 0xDE20, 0xD3C0, 0xC50F, 0x76A4, 0x49E3, 0xF007, 0x49C0, 0xF103, + 0xC607, 0xBE00, 0xC606, 0xBE00, 0xC602, 0xBE00, 0x0C4C, 0x0C28, 0x0C2C, + 0xDC00, 0xC707, 0x1D00, 0x8DE2, 0x48C1, 0xC502, 0xBD00, 0x00AA, 0xE0C0, + 0xC502, 0xBD00, 0x0132 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8411b_1, ARRAY_SIZE(mcu_patch_code_8411b_1)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0743); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0801); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0BE9); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x02FD); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x0C25); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x00A9); + MP_WriteMcuAccessRegWord(sc, 0xFC36, 0x012D); +} + +static void re_set_mac_mcu_8168h_1(struct re_softc *sc) +{ + DisableMcuBPs(sc); +} + +static void re_set_mac_mcu_8168h_2(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168h_1[] = { + 0xE008, 0xE00F, 0xE011, 0xE047, 0xE049, 0xE073, 0xE075, 0xE07A, 0xC707, + 0x1D00, 0x8DE2, 0x48C1, 0xC502, 0xBD00, 0x00E4, 0xE0C0, 0xC502, 0xBD00, + 0x0216, 0xC634, 0x75C0, 0x49D3, 0xF027, 0xC631, 0x75C0, 0x49D3, 0xF123, + 0xC627, 0x75C0, 0xB405, 0xC525, 0x9DC0, 0xC621, 0x75C8, 0x49D5, 0xF00A, + 0x49D6, 0xF008, 0x49D7, 0xF006, 0x49D8, 0xF004, 0x75D2, 0x49D9, 0xF111, + 0xC517, 0x9DC8, 0xC516, 0x9DD2, 0xC618, 0x75C0, 0x49D4, 0xF003, 0x49D0, + 0xF104, 0xC60A, 0xC50E, 0x9DC0, 0xB005, 0xC607, 0x9DC0, 0xB007, 0xC602, + 0xBE00, 0x1A06, 0xB400, 0xE86C, 0xA000, 0x01E1, 0x0200, 0x9200, 0xE84C, + 0xE004, 0xE908, 0xC502, 0xBD00, 0x0B58, 0xB407, 0xB404, 0x2195, 0x25BD, + 0x9BE0, 0x1C1C, 0x484F, 0x9CE2, 0x72E2, 0x49AE, 0xF1FE, 0x0B00, 0xF116, + 0xC71C, 0xC419, 0x9CE0, 0x1C13, 0x484F, 0x9CE2, 0x74E2, 0x49CE, 0xF1FE, + 0xC412, 0x9CE0, 0x1C13, 0x484F, 0x9CE2, 0x74E2, 0x49CE, 0xF1FE, 0xC70C, + 0x74F8, 0x48C3, 0x8CF8, 0xB004, 0xB007, 0xC502, 0xBD00, 0x0F24, 0x0481, + 0x0C81, 0xDE24, 0xE000, 0xC602, 0xBE00, 0x0CA4, 0x48C1, 0x48C2, 0x9C46, + 0xC402, 0xBC00, 0x0578, 0xC602, 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168h_1, ARRAY_SIZE(mcu_patch_code_8168h_1)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x00E2); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0210); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x1A04); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0B26); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0F02); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x0CA0); + //MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x056C); + + if (sc->re_device_id == RT_DEVICEID_8136) + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x0033); + else + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x003F); +} + +static void re_set_mac_mcu_8168h_3(struct re_softc *sc) +{ + DisableMcuBPs(sc); +} + +static void re_set_mac_mcu_8168fp_1(struct re_softc *sc) +{ + uint16_t breakPointEnabled = 0; + + DisableMcuBPs(sc); + + if(sc->HwPkgDet == 0x00 || sc->HwPkgDet == 0x0F) { + static const uint16_t mcu_patch_code_8168fp_1_1[] = { + 0xE00A, 0xE0C1, 0xE104, 0xE108, 0xE10D, 0xE112, 0xE11C, 0xE121, 0xE000, + 0xE0C8, 0xB400, 0xC1FE, 0x49E2, 0xF04C, 0x49EA, 0xF04A, 0x74E6, 0xC246, + 0x7542, 0x73EC, 0x1800, 0x49C0, 0xF10D, 0x49C1, 0xF10B, 0x49C2, 0xF109, + 0x49B0, 0xF107, 0x49B1, 0xF105, 0x7220, 0x49A2, 0xF102, 0xE002, 0x4800, + 0x49D0, 0xF10A, 0x49D1, 0xF108, 0x49D2, 0xF106, 0x49D3, 0xF104, 0x49DF, + 0xF102, 0xE00C, 0x4801, 0x72E4, 0x49AD, 0xF108, 0xC225, 0x6741, 0x48F0, + 0x8F41, 0x4870, 0x8F41, 0xC7CF, 0x49B5, 0xF01F, 0x49B2, 0xF00B, 0x4980, + 0xF003, 0x484E, 0x94E7, 0x4981, 0xF004, 0x485E, 0xC212, 0x9543, 0xE071, + 0x49B6, 0xF003, 0x49B3, 0xF10F, 0x4980, 0xF003, 0x484E, 0x94E7, 0x4981, + 0xF004, 0x485E, 0xC204, 0x9543, 0xE005, 0xE000, 0xE0FC, 0xE0FA, 0xE065, + 0x49B7, 0xF007, 0x4980, 0xF005, 0x1A38, 0x46D4, 0x1200, 0xF109, 0x4981, + 0xF055, 0x49C3, 0xF105, 0x1A30, 0x46D5, 0x1200, 0xF04F, 0x7220, 0x49A2, + 0xF130, 0x49C1, 0xF12E, 0x49B0, 0xF12C, 0xC2E6, 0x7240, 0x49A8, 0xF003, + 0x49D0, 0xF126, 0x49A9, 0xF003, 0x49D1, 0xF122, 0x49AA, 0xF003, 0x49D2, + 0xF11E, 0x49AB, 0xF003, 0x49DF, 0xF11A, 0x49AC, 0xF003, 0x49D3, 0xF116, + 0x4980, 0xF003, 0x49C7, 0xF105, 0x4981, 0xF02C, 0x49D7, 0xF02A, 0x49C0, + 0xF00C, 0xC721, 0x62F4, 0x49A0, 0xF008, 0x49A4, 0xF106, 0x4824, 0x8AF4, + 0xC71A, 0x1A40, 0x9AE0, 0x49B6, 0xF017, 0x200E, 0xC7B8, 0x72E0, 0x4710, + 0x92E1, 0xC70E, 0x77E0, 0x49F0, 0xF112, 0xC70B, 0x77E0, 0x27FE, 0x1AFA, + 0x4317, 0xC705, 0x9AE2, 0x1A11, 0x8AE0, 0xE008, 0xE41C, 0xC0AE, 0xD23A, + 0xC7A2, 0x74E6, 0x484F, 0x94E7, 0xC79E, 0x8CE6, 0x8BEC, 0xC29C, 0x8D42, + 0x7220, 0xB000, 0xC502, 0xBD00, 0x0932, 0xB400, 0xC240, 0xC340, 0x7060, + 0x498F, 0xF014, 0x488F, 0x9061, 0x744C, 0x49C3, 0xF004, 0x7562, 0x485E, + 0x9563, 0x7446, 0x49C3, 0xF106, 0x7562, 0x1C30, 0x46E5, 0x1200, 0xF004, + 0x7446, 0x484F, 0x9447, 0xC32A, 0x7466, 0x49C0, 0xF00F, 0x48C0, 0x9C66, + 0x7446, 0x4840, 0x4841, 0x4842, 0x9C46, 0x744C, 0x4840, 0x9C4C, 0x744A, + 0x484A, 0x9C4A, 0xE013, 0x498E, 0xF011, 0x488E, 0x9061, 0x744C, 0x49C3, + 0xF004, 0x7446, 0x484E, 0x9447, 0x7446, 0x1D38, 0x46EC, 0x1500, 0xF004, + 0x7446, 0x484F, 0x9447, 0xB000, 0xC502, 0xBD00, 0x074C, 0xE000, 0xE0FC, + 0xE0C0, 0x4830, 0x4837, 0xC502, 0xBD00, 0x0978, 0x63E2, 0x4830, 0x4837, + 0xC502, 0xBD00, 0x09FE, 0x73E2, 0x4830, 0x8BE2, 0xC302, 0xBB00, 0x0A12, + 0x73E2, 0x48B0, 0x48B3, 0x48B4, 0x48B5, 0x48B6, 0x48B7, 0x8BE2, 0xC302, + 0xBB00, 0x0A5A, 0x73E2, 0x4830, 0x8BE2, 0xC302, 0xBB00, 0x0A6C, 0x73E2, + 0x4830, 0x4837, 0xC502, 0xBD00, 0x0A86 + }; + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168fp_1_1, ARRAY_SIZE(mcu_patch_code_8168fp_1_1)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0890); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0712); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0974); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x09FC); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0A0E); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x0A56); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x0A68); + MP_WriteMcuAccessRegWord(sc, 0xFC36, 0x0A84); + + } else if (sc->HwPkgDet == 0x6) { + static const uint16_t mcu_patch_code_8168fp_1_2[] = { + 0xE008, 0xE00A, 0xE031, 0xE033, 0xE035, 0xE144, 0xE166, 0xE168, 0xC502, + 0xBD00, 0x0000, 0xC725, 0x75E0, 0x48D0, 0x9DE0, 0xC722, 0x75E0, 0x1C78, + 0x416C, 0x1530, 0xF111, 0xC71D, 0x75F6, 0x49D1, 0xF00D, 0x75E0, 0x1C1F, + 0x416C, 0x1502, 0xF108, 0x75FA, 0x49D3, 0xF005, 0x75EC, 0x9DE4, 0x4853, + 0x9DFA, 0xC70B, 0x75E0, 0x4852, 0x4850, 0x9DE0, 0xC602, 0xBE00, 0x04B8, + 0xE420, 0xE000, 0xE0FC, 0xE43C, 0xDC00, 0xEB00, 0xC202, 0xBA00, 0x0000, + 0xC002, 0xB800, 0x0000, 0xB401, 0xB402, 0xB403, 0xB404, 0xB405, 0xB406, + 0xC44D, 0xC54D, 0x1867, 0xE8A2, 0x2318, 0x276E, 0x1601, 0xF106, 0x1A07, + 0xE861, 0xE86B, 0xE873, 0xE037, 0x231E, 0x276E, 0x1602, 0xF10B, 0x1A07, + 0xE858, 0xE862, 0xC247, 0xC344, 0xE8E3, 0xC73B, 0x66E0, 0xE8B5, 0xE029, + 0x231A, 0x276C, 0xC733, 0x9EE0, 0x1866, 0xE885, 0x251C, 0x120F, 0xF011, + 0x1209, 0xF011, 0x2014, 0x240E, 0x1000, 0xF007, 0x120C, 0xF00D, 0x1203, + 0xF00D, 0x1200, 0xF00D, 0x120C, 0xF00D, 0x1203, 0xF00D, 0x1A03, 0xE00C, + 0x1A07, 0xE00A, 0x1A00, 0xE008, 0x1A01, 0xE006, 0x1A02, 0xE004, 0x1A04, + 0xE002, 0x1A05, 0xE829, 0xE833, 0xB006, 0xB005, 0xB004, 0xB003, 0xB002, + 0xB001, 0x60C4, 0xC702, 0xBF00, 0x2786, 0xDD00, 0xD030, 0xE0C4, 0xE0F8, + 0xDC42, 0xD3F0, 0x0000, 0x0004, 0x0007, 0x0014, 0x0090, 0x1000, 0x0F00, + 0x1004, 0x1008, 0x3000, 0x3004, 0x3008, 0x4000, 0x7777, 0x8000, 0x8001, + 0x8008, 0x8003, 0x8004, 0xC000, 0xC004, 0xF004, 0xFFFF, 0xB406, 0xB407, + 0xC6E5, 0x77C0, 0x27F3, 0x23F3, 0x47FA, 0x9FC0, 0xB007, 0xB006, 0xFF80, + 0xB405, 0xB407, 0xC7D8, 0x75E0, 0x48D0, 0x9DE0, 0xB007, 0xB005, 0xFF80, + 0xB401, 0xC0EA, 0xC2DC, 0xC3D8, 0xE865, 0xC0D3, 0xC1E0, 0xC2E3, 0xE861, + 0xE817, 0xC0CD, 0xC2CF, 0xE85D, 0xC0C9, 0xC1D6, 0xC2DB, 0xE859, 0xE80F, + 0xC1C7, 0xC2CE, 0xE855, 0xC0C0, 0xC1D1, 0xC2D3, 0xE851, 0xE807, 0xC0BE, + 0xC2C2, 0xE84D, 0xE803, 0xB001, 0xFF80, 0xB402, 0xC2C6, 0xE859, 0x499F, + 0xF1FE, 0xB002, 0xFF80, 0xB402, 0xB403, 0xB407, 0xE821, 0x8882, 0x1980, + 0x8983, 0xE81D, 0x7180, 0x218B, 0x25BB, 0x1310, 0xF014, 0x1310, 0xFB03, + 0x1F20, 0x38FB, 0x3288, 0x434B, 0x2491, 0x430B, 0x1F0F, 0x38FB, 0x4313, + 0x2121, 0x4353, 0x2521, 0x418A, 0x6282, 0x2527, 0x212F, 0x418A, 0xB007, + 0xB003, 0xB002, 0xFF80, 0x6183, 0x2496, 0x1100, 0xF1FD, 0xFF80, 0x4800, + 0x4801, 0xC213, 0xC313, 0xE815, 0x4860, 0x8EE0, 0xC210, 0xC310, 0xE822, + 0x481E, 0xC20C, 0xC30C, 0xE80C, 0xC206, 0x7358, 0x483A, 0x9B58, 0xFF80, + 0xE8E0, 0xE000, 0x1008, 0x0F00, 0x800C, 0x0F00, 0xB407, 0xB406, 0xB403, + 0xC7F7, 0x98E0, 0x99E2, 0x9AE4, 0x21B2, 0x4831, 0x483F, 0x9BE6, 0x66E7, + 0x49E6, 0xF1FE, 0xB003, 0xB006, 0xB007, 0xFF80, 0xB407, 0xB406, 0xB403, + 0xC7E5, 0x9AE4, 0x21B2, 0x4831, 0x9BE6, 0x66E7, 0x49E6, 0xF1FE, 0x70E0, + 0x71E2, 0xB003, 0xB006, 0xB007, 0xFF80, 0x4882, 0xB406, 0xB405, 0xC71E, + 0x76E0, 0x1D78, 0x4175, 0x1630, 0xF10C, 0xC715, 0x76E0, 0x4861, 0x9EE0, + 0xC713, 0x1EFF, 0x9EE2, 0x75E0, 0x4850, 0x9DE0, 0xE005, 0xC70B, 0x76E0, + 0x4865, 0x9EE0, 0xB005, 0xB006, 0xC708, 0xC102, 0xB900, 0x279E, 0xEB16, + 0xEB00, 0xE43C, 0xDC00, 0xD3EC, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000 + }; + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168fp_1_2, ARRAY_SIZE(mcu_patch_code_8168fp_1_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x04b4); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x279C); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x0000); + MP_WriteMcuAccessRegWord(sc, 0xFC36, 0x0000); + } + + if (sc->HwPkgDet == 0x00) + breakPointEnabled = 0x00FC; + else if (sc->HwPkgDet == 0x0F) + breakPointEnabled = 0x00FF; + else if (sc->HwPkgDet == 0x06) + breakPointEnabled = 0x0022; + + MP_WriteMcuAccessRegWord(sc, 0xFC38, breakPointEnabled); +} + +static void re_set_mac_mcu_8168fp_8116as_2(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168fp_2[] = { + 0xE008, 0xE00A, 0xE00F, 0xE014, 0xE016, 0xE018, 0xE01A, 0xE01C, 0xC602, + 0xBE00, 0x2AB2, 0x1BC0, 0x46EB, 0x1BFE, 0xC102, 0xB900, 0x0B1A, 0x1BC0, + 0x46EB, 0x1B7E, 0xC102, 0xB900, 0x0BEA, 0xC602, 0xBE00, 0x0000, 0xC602, + 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, + 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168fp_2, ARRAY_SIZE(mcu_patch_code_8168fp_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x2AAC); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0B14); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0BE4); + + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x0007); +} + +static void _re_set_mac_mcu_8168fp_2(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168fp_2[] = { + 0xE008, 0xE00A, 0xE00F, 0xE014, 0xE05F, 0xE064, 0xE066, 0xE068, 0xC602, + 0xBE00, 0x0000, 0x1BC0, 0x46EB, 0x1BFE, 0xC102, 0xB900, 0x0B1A, 0x1BC0, + 0x46EB, 0x1B7E, 0xC102, 0xB900, 0x0BEA, 0xB400, 0xB401, 0xB402, 0xB403, + 0xB404, 0xB405, 0xC03A, 0x7206, 0x49AE, 0xF1FE, 0xC137, 0x9904, 0xC136, + 0x9906, 0x7206, 0x49AE, 0xF1FE, 0x7200, 0x49A0, 0xF10B, 0xC52F, 0xC12E, + 0xC232, 0xC332, 0xE812, 0xC331, 0xE810, 0xC330, 0xE80E, 0xE018, 0xC126, + 0xC229, 0xC525, 0xC328, 0xE808, 0xC523, 0xC326, 0xE805, 0xC521, 0xC324, + 0xE802, 0xE00C, 0x740E, 0x49CE, 0xF1FE, 0x9908, 0x9D0A, 0x9A0C, 0x9B0E, + 0x740E, 0x49CE, 0xF1FE, 0xFF80, 0xB005, 0xB004, 0xB003, 0xB002, 0xB001, + 0xB000, 0xC604, 0xC002, 0xB800, 0x2A5E, 0xE000, 0xE8E0, 0xF128, 0x3DC2, + 0xFFFF, 0x10EC, 0x816A, 0x816D, 0x816C, 0xF000, 0x8002, 0x8004, 0x8007, + 0x48C1, 0x48C2, 0x9C46, 0xC402, 0xBC00, 0x07BC, 0xC602, 0xBE00, 0x0000, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168fp_2, ARRAY_SIZE(mcu_patch_code_8168fp_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x2AAC); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0B14); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x0BE4); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x2A5C); + //MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x07B0); + + if (true == re_check_dash_other_fun_present(sc)) + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x0006); + else + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x000E); +} + +static void re_set_mac_mcu_8168fp_2(struct re_softc *sc) +{ + if (sc->hw_hw_supp_serdes_phy_ver == 1) + re_set_mac_mcu_8168fp_8116as_2(sc); + else + _re_set_mac_mcu_8168fp_2(sc); +} + +static void re_set_mac_mcu_8168fp_3(struct re_softc *sc) +{ + static const uint16_t mcu_patch_code_8168fp_3[] = { + 0xE008, 0xE053, 0xE058, 0xE05A, 0xE05C, 0xE05E, 0xE060, 0xE062, 0xB400, + 0xB401, 0xB402, 0xB403, 0xB404, 0xB405, 0xC03A, 0x7206, 0x49AE, 0xF1FE, + 0xC137, 0x9904, 0xC136, 0x9906, 0x7206, 0x49AE, 0xF1FE, 0x7200, 0x49A0, + 0xF10B, 0xC52F, 0xC12E, 0xC232, 0xC332, 0xE812, 0xC331, 0xE810, 0xC330, + 0xE80E, 0xE018, 0xC126, 0xC229, 0xC525, 0xC328, 0xE808, 0xC523, 0xC326, + 0xE805, 0xC521, 0xC324, 0xE802, 0xE00C, 0x740E, 0x49CE, 0xF1FE, 0x9908, + 0x9D0A, 0x9A0C, 0x9B0E, 0x740E, 0x49CE, 0xF1FE, 0xFF80, 0xB005, 0xB004, + 0xB003, 0xB002, 0xB001, 0xB000, 0xC604, 0xC002, 0xB800, 0x2B16, 0xE000, + 0xE8E0, 0xF128, 0x3DC2, 0xFFFF, 0x10EC, 0x816A, 0x816D, 0x816C, 0xF000, + 0x8002, 0x8004, 0x8007, 0x48C1, 0x48C2, 0x9C46, 0xC402, 0xBC00, 0x07BC, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, + 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8168fp_3, ARRAY_SIZE(mcu_patch_code_8168fp_3)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x2B14); + //MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x07B0); + + if (true == re_check_dash_other_fun_present(sc)) + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x0000); + else + MP_WriteMcuAccessRegWord(sc, 0xFC38, 0x0001); +} + +static void re_set_mac_mcu_8168fp_4(struct re_softc *sc) +{ + DisableMcuBPs(sc); +} + +static void re_set_mac_mcu_8125a_1(struct re_softc *sc) +{ + DisableMcuBPs(sc); +} + +static void re_set_mac_mcu_8125a_2(struct re_softc *sc) +{ + static const u_int16_t mcu_patch_code_8125a_2[] = { + 0xE010, 0xE012, 0xE022, 0xE024, 0xE029, 0xE02B, 0xE094, 0xE09D, 0xE09F, + 0xE0AA, 0xE0B5, 0xE0C6, 0xE0CC, 0xE0D1, 0xE0D6, 0xE0D8, 0xC602, 0xBE00, + 0x0000, 0xC60F, 0x73C4, 0x49B3, 0xF106, 0x73C2, 0xC608, 0xB406, 0xC609, + 0xFF80, 0xC605, 0xB406, 0xC605, 0xFF80, 0x0544, 0x0568, 0xE906, 0xCDE8, + 0xC602, 0xBE00, 0x0000, 0x48C1, 0x48C2, 0x9C46, 0xC402, 0xBC00, 0x0A12, + 0xC602, 0xBE00, 0x0EBA, 0x1501, 0xF02A, 0x1500, 0xF15D, 0xC661, 0x75C8, + 0x49D5, 0xF00A, 0x49D6, 0xF008, 0x49D7, 0xF006, 0x49D8, 0xF004, 0x75D2, + 0x49D9, 0xF150, 0xC553, 0x77A0, 0x75C8, 0x4855, 0x4856, 0x4857, 0x4858, + 0x48DA, 0x48DB, 0x49FE, 0xF002, 0x485A, 0x49FF, 0xF002, 0x485B, 0x9DC8, + 0x75D2, 0x4859, 0x9DD2, 0xC643, 0x75C0, 0x49D4, 0xF033, 0x49D0, 0xF137, + 0xE030, 0xC63A, 0x75C8, 0x49D5, 0xF00E, 0x49D6, 0xF00C, 0x49D7, 0xF00A, + 0x49D8, 0xF008, 0x75D2, 0x49D9, 0xF005, 0xC62E, 0x75C0, 0x49D7, 0xF125, + 0xC528, 0x77A0, 0xC627, 0x75C8, 0x4855, 0x4856, 0x4857, 0x4858, 0x48DA, + 0x48DB, 0x49FE, 0xF002, 0x485A, 0x49FF, 0xF002, 0x485B, 0x9DC8, 0x75D2, + 0x4859, 0x9DD2, 0xC616, 0x75C0, 0x4857, 0x9DC0, 0xC613, 0x75C0, 0x49DA, + 0xF003, 0x49D0, 0xF107, 0xC60B, 0xC50E, 0x48D9, 0x9DC0, 0x4859, 0x9DC0, + 0xC608, 0xC702, 0xBF00, 0x3AE0, 0xE860, 0xB400, 0xB5D4, 0xE908, 0xE86C, + 0x1200, 0xC409, 0x6780, 0x48F1, 0x8F80, 0xC404, 0xC602, 0xBE00, 0x10AA, + 0xC010, 0xEA7C, 0xC602, 0xBE00, 0x0000, 0x740A, 0x4846, 0x4847, 0x9C0A, + 0xC607, 0x74C0, 0x48C6, 0x9CC0, 0xC602, 0xBE00, 0x13FE, 0xE054, 0x72CA, + 0x4826, 0x4827, 0x9ACA, 0xC607, 0x72C0, 0x48A6, 0x9AC0, 0xC602, 0xBE00, + 0x07DC, 0xE054, 0xC60F, 0x74C4, 0x49CC, 0xF109, 0xC60C, 0x74CA, 0x48C7, + 0x9CCA, 0xC609, 0x74C0, 0x4846, 0x9CC0, 0xC602, 0xBE00, 0x2480, 0xE092, + 0xE0C0, 0xE054, 0x7420, 0x48C0, 0x9C20, 0x7444, 0xC602, 0xBE00, 0x12F8, + 0x1BFF, 0x46EB, 0x1BFF, 0xC102, 0xB900, 0x0D5A, 0x1BFF, 0x46EB, 0x1BFF, + 0xC102, 0xB900, 0x0E2A, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6486, + 0x0B15, 0x090E, 0x1139 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8125a_2, ARRAY_SIZE(mcu_patch_code_8125a_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0540); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x0A06); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x0EB8); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x3A5C); + MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x10A8); + MP_WriteMcuAccessRegWord(sc, 0xFC40, 0x0D54); + MP_WriteMcuAccessRegWord(sc, 0xFC42, 0x0E24); + + MP_WriteMcuAccessRegWord(sc, 0xFC48, 0x307A); +} + +static void re_set_mac_mcu_8125b_1(struct re_softc *sc) +{ + DisableMcuBPs(sc); +} + +static void re_set_mac_mcu_8125b_2(struct re_softc *sc) +{ + static const u_int16_t mcu_patch_code_8125b_2[] = { + 0xE010, 0xE01B, 0xE026, 0xE037, 0xE03D, 0xE057, 0xE05B, 0xE060, 0xE062, + 0xE064, 0xE066, 0xE068, 0xE06A, 0xE06C, 0xE06E, 0xE070, 0x740A, 0x4846, + 0x4847, 0x9C0A, 0xC607, 0x74C0, 0x48C6, 0x9CC0, 0xC602, 0xBE00, 0x13F0, + 0xE054, 0x72CA, 0x4826, 0x4827, 0x9ACA, 0xC607, 0x72C0, 0x48A6, 0x9AC0, + 0xC602, 0xBE00, 0x081C, 0xE054, 0xC60F, 0x74C4, 0x49CC, 0xF109, 0xC60C, + 0x74CA, 0x48C7, 0x9CCA, 0xC609, 0x74C0, 0x4846, 0x9CC0, 0xC602, 0xBE00, + 0x2494, 0xE092, 0xE0C0, 0xE054, 0x7420, 0x48C0, 0x9C20, 0x7444, 0xC602, + 0xBE00, 0x12DC, 0x733A, 0x21B5, 0x25BC, 0x1304, 0xF111, 0x1B12, 0x1D2A, + 0x3168, 0x3ADA, 0x31AB, 0x1A00, 0x9AC0, 0x1300, 0xF1FB, 0x7620, 0x236E, + 0x276F, 0x1A3C, 0x22A1, 0x41B5, 0x9EE2, 0x76E4, 0x486F, 0x9EE4, 0xC602, + 0xBE00, 0x4A26, 0x733A, 0x49BB, 0xC602, 0xBE00, 0x47A2, 0x48C1, 0x48C2, + 0x9C46, 0xC402, 0xBC00, 0x0A52, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000, 0xC602, 0xBE00, 0x0000 + }; + + DisableMcuBPs(sc); + + re_write_mac_mcu_ram_code(sc, mcu_patch_code_8125b_2, ARRAY_SIZE(mcu_patch_code_8125b_2)); + + MP_WriteMcuAccessRegWord(sc, 0xFC26, 0x8000); + + MP_WriteMcuAccessRegWord(sc, 0xFC28, 0x13E6); + MP_WriteMcuAccessRegWord(sc, 0xFC2A, 0x0812); + MP_WriteMcuAccessRegWord(sc, 0xFC2C, 0x248C); + MP_WriteMcuAccessRegWord(sc, 0xFC2E, 0x12DA); + MP_WriteMcuAccessRegWord(sc, 0xFC30, 0x4A20); + MP_WriteMcuAccessRegWord(sc, 0xFC32, 0x47A0); + //MP_WriteMcuAccessRegWord(sc, 0xFC34, 0x0A46); + + MP_WriteMcuAccessRegWord(sc, 0xFC48, 0x003F); +} + +static void re_hw_mac_mcu_config(struct re_softc *sc) +{ + switch(sc->re_type) { + case MACFG_56: + re_set_mac_mcu_8168g_1(sc); + break; + case MACFG_58: + re_set_mac_mcu_8168gu_1(sc); + break; + case MACFG_59: + re_set_mac_mcu_8168gu_2(sc); + break; + case MACFG_60: + re_set_mac_mcu_8411b_1(sc); + break; + case MACFG_62: + re_set_mac_mcu_8168ep_1(sc); + break; + case MACFG_67: + re_set_mac_mcu_8168ep_2(sc); + break; + case MACFG_68: + re_set_mac_mcu_8168h_1(sc); + break; + case MACFG_69: + re_set_mac_mcu_8168h_2(sc); + break; + case MACFG_70: + re_set_mac_mcu_8168fp_1(sc); + break; + case MACFG_71: + re_set_mac_mcu_8168fp_2(sc); + break; + case MACFG_72: + re_set_mac_mcu_8168fp_3(sc); + break; + case MACFG_73: + re_set_mac_mcu_8168fp_4(sc); + break; + case MACFG_74: + re_set_mac_mcu_8168h_3(sc); + break; + case MACFG_80: + re_set_mac_mcu_8125a_1(sc); + break; + case MACFG_81: + re_set_mac_mcu_8125a_2(sc); + break; + case MACFG_82: + re_set_mac_mcu_8125b_1(sc); + break; + case MACFG_83: + re_set_mac_mcu_8125b_2(sc); + break; + } +} + +#define ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE BIT_5 +static void Dash2DisableTx(struct re_softc *sc) +{ + //if (!sc->re_dash) return; + + if (HW_DASH_SUPPORT_TYPE_2(sc) || HW_DASH_SUPPORT_TYPE_3(sc)) { + u_int16_t WaitCnt; + u_int8_t TmpUchar; + + //Disable oob Tx + RE_CMAC_WRITE_1(sc, RE_CMAC_IBCR2, RE_CMAC_READ_1(sc, RE_CMAC_IBCR2) & ~(BIT_0)); + WaitCnt = 0; + + //wait oob tx disable + do { + TmpUchar = RE_CMAC_READ_1(sc, RE_CMAC_IBISR0); + + if (TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE) { + break; + } + + DELAY(50); + WaitCnt++; + } while(WaitCnt < 2000); + + //Clear ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE + RE_CMAC_WRITE_1(sc, RE_CMAC_IBISR0, RE_CMAC_READ_1(sc, RE_CMAC_IBISR0) | ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE); + } +} + +static void Dash2DisableRx(struct re_softc *sc) +{ + //if (!sc->re_dash) return; + + if (HW_DASH_SUPPORT_TYPE_2(sc) || HW_DASH_SUPPORT_TYPE_3(sc)) { + RE_CMAC_WRITE_1(sc, RE_CMAC_IBCR0, RE_CMAC_READ_1(sc, RE_CMAC_IBCR0) & ~(BIT_0)); + } +} + +static void Dash2DisableTxRx(struct re_softc *sc) +{ + if (HW_DASH_SUPPORT_TYPE_2(sc) || HW_DASH_SUPPORT_TYPE_3(sc)) { + Dash2DisableTx(sc); + Dash2DisableRx(sc); + } +} + +static inline bool +is_zero_ether_addr(const u_int8_t * addr) +{ + return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == 0x00); +} + +static inline bool +is_multicast_ether_addr(const u_int8_t * addr) +{ + return (0x01 & addr[0]); +} + +/* +static inline bool +is_broadcast_ether_addr(const u_int8_t * addr) +{ + return ((addr[0] + addr[1] + addr[2] + addr[3] + addr[4] + addr[5]) == (6 * 0xff)); +} +*/ + +static inline bool +is_valid_ether_addr(const u_int8_t * addr) +{ + return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr); +} + +static inline void +random_ether_addr(u_int8_t * dst) +{ + arc4rand(dst, 6, 0); + + dst[0] &= 0xfe; + dst[0] |= 0x02; +} + +static void re_disable_now_is_oob(struct re_softc *sc) +{ + if (sc->re_hw_supp_now_is_oob_ver == 1) + CSR_WRITE_1(sc, RE_MCU_CMD, CSR_READ_1(sc, RE_MCU_CMD) & ~RE_NOW_IS_OOB); +} + +static void re_switch_to_sgmii_mode(struct re_softc *sc) +{ + if (FALSE == HW_SUPP_SERDES_PHY(sc)) return; + + switch (sc->hw_hw_supp_serdes_phy_ver) { + case 1: + MP_WriteMcuAccessRegWord(sc, 0xEB00, 0x2); + SetMcuAccessRegBit(sc, 0xEB16, BIT_1); + break; + } +} + +static void +re_enable_magic_packet(struct re_softc *sc) +{ + if (sc->re_if_flags & RL_FLAG_MAGIC_PACKET_V3) + SetMcuAccessRegBit(sc, 0xC0B6, BIT_0); + else if (sc->re_if_flags & RL_FLAG_MAGIC_PACKET_V2) + re_eri_write(sc, 0xDC, 4, + re_eri_read(sc, 0xDC, 4, ERIAR_ExGMAC) | BIT_16, + ERIAR_ExGMAC); + else + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | RL_CFG3_WOL_MAGIC); +} + +static void +re_disable_magic_packet(struct re_softc *sc) +{ + if (sc->re_if_flags & RL_FLAG_MAGIC_PACKET_V3) + ClearMcuAccessRegBit(sc, 0xC0B6, BIT_0); + else if (sc->re_if_flags & RL_FLAG_MAGIC_PACKET_V2) + re_eri_write(sc, 0xDC, 4, + re_eri_read(sc, 0xDC, 4, ERIAR_ExGMAC) & ~BIT_16, + ERIAR_ExGMAC); + else + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~RL_CFG3_WOL_MAGIC); +} + +static void re_exit_oob(struct re_softc *sc) +{ + u_int16_t data16; + int i; + + re_disable_cfg9346_write(sc); + + if (HW_SUPP_SERDES_PHY(sc)) { + if (sc->hw_hw_supp_serdes_phy_ver == 1) { + re_switch_to_sgmii_mode(sc); + } + } + + switch(sc->re_type) { + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_80: + case MACFG_81: + Dash2DisableTxRx(sc); + break; + } + + if (sc->re_dash) + re_driver_start(sc); + + switch(sc->re_type) { + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_3); + DELAY(2000); + + for (i = 0; i < 3000; i++) { + DELAY(50); + if (CSR_READ_4(sc, RE_TXCFG) & BIT_11) + break; + } + + if (CSR_READ_1(sc, RE_COMMAND) & (RE_CMD_TX_ENB | RE_CMD_RX_ENB)) { + DELAY(100); + CSR_WRITE_1(sc, RE_COMMAND, CSR_READ_1(sc, RE_COMMAND) & ~(RE_CMD_TX_ENB | RE_CMD_RX_ENB)); + } + + for (i = 0; i < 3000; i++) { + DELAY(50); + if ((CSR_READ_1(sc, RE_MCU_CMD) & (RE_TXFIFO_EMPTY | RE_RXFIFO_EMPTY)) == (RE_TXFIFO_EMPTY | RE_RXFIFO_EMPTY)) + break; + } + break; + case MACFG_80: + case MACFG_81: + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_3); + DELAY(2000); + + if (CSR_READ_1(sc, RE_COMMAND) & (RE_CMD_TX_ENB | RE_CMD_RX_ENB)) { + DELAY(100); + CSR_WRITE_1(sc, RE_COMMAND, CSR_READ_1(sc, RE_COMMAND) & ~(RE_CMD_TX_ENB | RE_CMD_RX_ENB)); + } + + for (i = 0; i < 3000; i++) { + DELAY(50); + if ((CSR_READ_1(sc, RE_MCU_CMD) & (RE_TXFIFO_EMPTY | RE_RXFIFO_EMPTY)) == (RE_TXFIFO_EMPTY | RE_RXFIFO_EMPTY)) + break; + } + break; + case MACFG_82: + case MACFG_83: + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_3); + DELAY(2000); + + if (CSR_READ_1(sc, RE_COMMAND) & (RE_CMD_TX_ENB | RE_CMD_RX_ENB)) { + DELAY(100); + CSR_WRITE_1(sc, RE_COMMAND, CSR_READ_1(sc, RE_COMMAND) & ~(RE_CMD_TX_ENB | RE_CMD_RX_ENB)); + } + + CSR_WRITE_1(sc, RE_COMMAND, CSR_READ_1(sc, RE_COMMAND) | RE_CMD_STOP_REQ); + + for (i = 0; i < 3000; i++) { + DELAY(50); + if ((CSR_READ_1(sc, RE_MCU_CMD) & (RE_TXFIFO_EMPTY | RE_RXFIFO_EMPTY)) == (RE_TXFIFO_EMPTY | RE_RXFIFO_EMPTY)) + break; + } + + for (i = 0; i < 3000; i++) { + DELAY(50); + if ((CSR_READ_2(sc, RE_IntrMitigate) & (BIT_0 | BIT_1 | BIT_8)) == (BIT_0 | BIT_1 | BIT_8)) + break; + } + break; + } + + //Disable realwow function + switch (sc->re_type) { + case MACFG_50: + case MACFG_51: + CSR_WRITE_4(sc, RE_MCUACCESS, 0xE5A90000); + CSR_WRITE_4(sc, RE_MCUACCESS, 0xF2100010); + break; + case MACFG_52: + CSR_WRITE_4(sc, RE_MCUACCESS, 0xE5A90000); + CSR_WRITE_4(sc, RE_MCUACCESS, 0xE4640000); + CSR_WRITE_4(sc, RE_MCUACCESS, 0xF2100010); + break; + case MACFG_56: + case MACFG_57: + CSR_WRITE_4(sc, RE_MCUACCESS, 0x605E0000); + CSR_WRITE_4(sc, RE_MCUACCESS, (0xE05E << 16) | (CSR_READ_4(sc, RE_MCUACCESS) & 0xFFFE)); + CSR_WRITE_4(sc, RE_MCUACCESS, 0xE9720000); + CSR_WRITE_4(sc, RE_MCUACCESS, 0xF2140010); + break; + case MACFG_60: + CSR_WRITE_4(sc, RE_MCUACCESS, 0xE05E00FF); + CSR_WRITE_4(sc, RE_MCUACCESS, 0xE9720000); + MP_WriteMcuAccessRegWord(sc, 0xE428, 0x0010); + break; + } + + if (sc->re_hw_supp_now_is_oob_ver >0) + re_disable_now_is_oob(sc); + + switch(sc->re_type) { + case MACFG_52: + for (i = 0; i < 10; i++) { + DELAY(100); + if (CSR_READ_2(sc, 0xD2) & BIT_9) + break; + } + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD4DE) | BIT_15; + MP_WriteMcuAccessRegWord(sc, 0xD4DE, data16); + + for (i = 0; i < 10; i++) { + DELAY(100); + if (CSR_READ_2(sc, 0xD2) & BIT_9) + break; + } + break; + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + data16 = MP_ReadMcuAccessRegWord(sc, 0xE8DE) & ~BIT_14; + MP_WriteMcuAccessRegWord(sc, 0xE8DE, data16); + for (i = 0; i < 10; i++) { + DELAY(100); + if (CSR_READ_2(sc, 0xD2) & BIT_9) + break; + } + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE8DE) | BIT_15; + MP_WriteMcuAccessRegWord(sc, 0xE8DE, data16); + + for (i = 0; i < 10; i++) { + DELAY(100); + if (CSR_READ_2(sc, 0xD2) & BIT_9) + break; + } + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + data16 = MP_ReadMcuAccessRegWord(sc, 0xE8DE) & ~BIT_14; + MP_WriteMcuAccessRegWord(sc, 0xE8DE, data16); + for (i = 0; i < 10; i++) { + DELAY(100); + if (CSR_READ_2(sc, 0xD2) & BIT_9) + break; + } + + MP_WriteMcuAccessRegWord(sc, 0xC0AA, 0x07D0); + MP_WriteMcuAccessRegWord(sc, 0xC0A6, 0x01B5); + MP_WriteMcuAccessRegWord(sc, 0xC01E, 0x5555); + + for (i = 0; i < 10; i++) { + DELAY(100); + if (CSR_READ_2(sc, 0xD2) & BIT_9) + break; + } + break; + } + + //wait ups resume (phy state 2) + switch(sc->re_type) { + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + if (re_is_ups_resume(sc)) { + re_wait_phy_ups_resume(sc, 2); + re_clear_ups_resume_bit(sc); + re_clear_phy_ups_reg(sc); + } + break; + }; + + /* + * Config MAC MCU + */ + re_hw_mac_mcu_config(sc); +} + +static void re_hw_init(struct re_softc *sc) +{ + /* + * disable EDT. + */ + switch(sc->re_type) { + case MACFG_16: + case MACFG_17: + case MACFG_18: + case MACFG_19: + case MACFG_41: + CSR_WRITE_1(sc, 0xF4, CSR_READ_1(sc, 0xF4) & ~(BIT_0|BIT_1)); + break; + case MACFG_36: + case MACFG_37: + case MACFG_38: + case MACFG_39: + case MACFG_42: + case MACFG_43: + case MACFG_50: + case MACFG_51: + case MACFG_54: + case MACFG_55: + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~(BIT_0|BIT_1|BIT_2)); + break; + } + + if (s0_magic_packet == 0) + re_disable_magic_packet(sc); + else + re_enable_magic_packet(sc); + + switch(sc->re_type) { + case MACFG_5: + if (CSR_READ_1(sc, RE_CFG2) & 1) { + CSR_WRITE_4(sc, 0x7C, 0x000FFFFF); + } else { + CSR_WRITE_4(sc, 0x7C, 0x000FFF00); + } + break; + case MACFG_6: + if (CSR_READ_1(sc, RE_CFG2) & 1) { + CSR_WRITE_4(sc, 0x7C, 0x003FFFFF); + } else { + CSR_WRITE_4(sc, 0x7C, 0x003FFF00); + } + break; + } + + switch(sc->re_type) { + case MACFG_33: + case MACFG_36: + case MACFG_37: + CSR_WRITE_1(sc, 0xF3, CSR_READ_1(sc, 0xF3) | BIT_2); + break; + } + + switch(sc->re_type) { + case MACFG_36: + case MACFG_37: + case MACFG_38: + case MACFG_39: + case MACFG_42: + case MACFG_43: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_54: + case MACFG_55: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_enable_cfg9346_write(sc); + CSR_WRITE_1(sc, RE_CFG5, CSR_READ_1(sc, RE_CFG5) & ~BIT_0); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) & ~BIT_7); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) & ~BIT_7); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | BIT_5); + re_disable_cfg9346_write(sc); + break; + } + + if (sc->re_if_flags & RL_FLAG_PCIE) { + uint32_t Data32; + //Set PCIE uncorrectable error status mask pcie 0x108 + Data32 = MP_ReadPciEConfigSpace(sc, 0xF108); + Data32 |= BIT_20; + MP_WritePciEConfigSpace(sc, 0xF108, Data32); + } +} + +static void re_rar_set(struct re_softc *sc, u_int8_t *eaddr) +{ + re_enable_cfg9346_write(sc); + + CSR_WRITE_4(sc, RE_IDR0, + htole32(*(u_int32_t *)(&eaddr[0]))); + CSR_WRITE_2(sc, RE_IDR4, + htole16(*(u_int32_t *)(&eaddr[4]))); + + switch (sc->re_type) { + case MACFG_36: + case MACFG_37: + case MACFG_42: + case MACFG_43: + case MACFG_54: + case MACFG_55: + CSR_WRITE_4(sc, RE_SecMAC0, + htole32(*(u_int32_t *)(&eaddr[0]))); + CSR_WRITE_2(sc, RE_SecMAC4, + htole16(*(u_int16_t *)(&eaddr[4]))); + break; + } + + switch (sc->re_type) { + case MACFG_38: + case MACFG_39: + re_eri_write(sc, 0xF0, 4, *(u_int16_t *)(&eaddr[0])<<16, ERIAR_ExGMAC); + re_eri_write(sc, 0xF4, 4, *(u_int32_t *)(&eaddr[2]), ERIAR_ExGMAC); + break; + } + + re_disable_cfg9346_write(sc); +} + +static void re_get_hw_mac_address(struct re_softc *sc, u_int8_t *eaddr) +{ + device_t dev = sc->dev; + u_int16_t re_eeid = 0; + int i; + + for (i = 0; i < ETHER_ADDR_LEN; i++) + eaddr[i] = CSR_READ_1(sc, RE_IDR0 + i); + + switch(sc->re_type) { + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + *(u_int32_t *)&eaddr[0] = re_eri_read(sc, 0xE0, 4, ERIAR_ExGMAC); + *(u_int16_t *)&eaddr[4] = (u_int16_t)re_eri_read(sc, 0xE4, 4, ERIAR_ExGMAC); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + *(u_int32_t *)&eaddr[0] = CSR_READ_4(sc, RE_BACKUP_ADDR0_8125); + *(u_int16_t *)&eaddr[4] = CSR_READ_2(sc, RE_BACKUP_ADDR4_8125); + break; + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + break; + default: + re_read_eeprom(sc, (caddr_t)&re_eeid, RE_EE_ID, 1, 0); + if (re_eeid == 0x8129) + re_read_eeprom(sc, (caddr_t)&eaddr[0], RE_EE_EADDR, 3, 0); + break; + } + + if (!is_valid_ether_addr(eaddr)) { + device_printf(dev,"Invalid ether addr: %6D\n", eaddr, ":"); + random_ether_addr(eaddr); + device_printf(dev,"Random ether addr: %6D\n", eaddr, ":"); + } + + re_rar_set(sc, eaddr); +} + +static int re_check_mac_version(struct re_softc *sc) +{ + device_t dev = sc->dev; + int error = 0; + + switch(CSR_READ_4(sc, RE_TXCFG) & 0xFCF00000) { + case 0x00800000: + case 0x04000000: + sc->re_type = MACFG_3; + sc->max_jumbo_frame_size = Jumbo_Frame_7k; + CSR_WRITE_4(sc, RE_RXCFG, 0xFF00); + break; + case 0x10000000: + sc->re_type = MACFG_4; + sc->max_jumbo_frame_size = Jumbo_Frame_7k; + CSR_WRITE_4(sc, RE_RXCFG, 0xFF00); + break; + case 0x18000000: + sc->re_type = MACFG_5; + sc->max_jumbo_frame_size = Jumbo_Frame_7k; + CSR_WRITE_4(sc, RE_RXCFG, 0xFF00); + break; + case 0x98000000: + sc->re_type = MACFG_6; + sc->max_jumbo_frame_size = Jumbo_Frame_7k; + CSR_WRITE_4(sc, RE_RXCFG, 0xFF00); + break; + case 0x34000000: + case 0xB4000000: + sc->re_type = MACFG_11; + sc->max_jumbo_frame_size = ETHERMTU; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34200000: + case 0xB4200000: + sc->re_type = MACFG_12; + sc->max_jumbo_frame_size = ETHERMTU; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34300000: + case 0xB4300000: + sc->re_type = MACFG_13; + sc->max_jumbo_frame_size = ETHERMTU; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34900000: + case 0x24900000: + sc->re_type = MACFG_14; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34A00000: + case 0x24A00000: + sc->re_type = MACFG_15; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34B00000: + case 0x24B00000: + sc->re_type = MACFG_16; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34C00000: + case 0x24C00000: + sc->re_type = MACFG_17; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34D00000: + case 0x24D00000: + sc->re_type = MACFG_18; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x34E00000: + case 0x24E00000: + sc->re_type = MACFG_19; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x30000000: + sc->re_type = MACFG_21; + sc->max_jumbo_frame_size = Jumbo_Frame_4k; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x38000000: + sc->re_type = MACFG_22; + sc->max_jumbo_frame_size = Jumbo_Frame_4k; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x38500000: + case 0xB8500000: + case 0x38700000: + case 0xB8700000: + sc->re_type = MACFG_23; + sc->max_jumbo_frame_size = Jumbo_Frame_4k; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x3C000000: + sc->re_type = MACFG_24; + sc->max_jumbo_frame_size = Jumbo_Frame_6k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xC700); + break; + case 0x3C200000: + sc->re_type = MACFG_25; + sc->max_jumbo_frame_size = Jumbo_Frame_6k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xC700); + break; + case 0x3C400000: + sc->re_type = MACFG_26; + sc->max_jumbo_frame_size = Jumbo_Frame_6k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xC700); + break; + case 0x3C900000: + sc->re_type = MACFG_27; + sc->max_jumbo_frame_size = Jumbo_Frame_6k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xC700); + break; + case 0x3CB00000: + sc->re_type = MACFG_28; + sc->max_jumbo_frame_size = Jumbo_Frame_6k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xC700); + break; + case 0x28100000: + sc->re_type = MACFG_31; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x28200000: + sc->re_type = MACFG_32; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x28300000: + sc->re_type = MACFG_33; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x2C100000: + sc->re_type = MACFG_36; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x2C200000: + sc->re_type = MACFG_37; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x2C800000: + sc->re_type = MACFG_38; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xBF00); + break; + case 0x2C900000: + sc->re_type = MACFG_39; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xBF00); + break; + case 0x24000000: + sc->re_type = MACFG_41; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x40900000: + sc->re_type = MACFG_42; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x40A00000: + case 0x40B00000: + case 0x40C00000: + sc->re_type = MACFG_43; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x48000000: + sc->re_type = MACFG_50; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xBF00); + break; + case 0x48100000: + sc->re_type = MACFG_51; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xBF00); + break; + case 0x48800000: + sc->re_type = MACFG_52; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xBF00); + break; + case 0x44000000: + sc->re_type = MACFG_53; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x44800000: + sc->re_type = MACFG_54; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x44900000: + sc->re_type = MACFG_55; + sc->max_jumbo_frame_size = ETHERMTU; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0xE700); + break; + case 0x4C000000: + sc->re_type = MACFG_56; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x4C100000: + sc->re_type = MACFG_57; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x50800000: + sc->re_type = MACFG_58; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x50900000: + sc->re_type = MACFG_59; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x5C800000: + sc->re_type = MACFG_60; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x50000000: + sc->re_type = MACFG_61; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x50100000: + sc->re_type = MACFG_62; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x50200000: + sc->re_type = MACFG_67; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x28800000: + sc->re_type = MACFG_63; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x28900000: + sc->re_type = MACFG_64; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x28A00000: + sc->re_type = MACFG_65; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x28B00000: + sc->re_type = MACFG_66; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM; + CSR_WRITE_4(sc, RE_RXCFG, 0x8700); + break; + case 0x54000000: + sc->re_type = MACFG_68; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x54100000: + sc->re_type = MACFG_69; + if ((MP_ReadMcuAccessRegWord(sc, 0xD006) & 0xFF00) == 0x0100) + sc->re_type = MACFG_74; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x54900000: + sc->re_type = MACFG_70; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x54A00000: + sc->re_type = MACFG_71; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x54B00000: + sc->re_type = MACFG_72; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x54C00000: + sc->re_type = MACFG_73; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V2; + CSR_WRITE_4(sc, RE_RXCFG, 0xCF00); + break; + case 0x60800000: + sc->re_type = MACFG_80; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V3; + CSR_WRITE_4(sc, RE_RXCFG, 0x40C00000); + break; + case 0x60900000: + sc->re_type = MACFG_81; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V3; + CSR_WRITE_4(sc, RE_RXCFG, 0x40C00000); + break; + case 0x64000000: + sc->re_type = MACFG_82; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V3; + CSR_WRITE_4(sc, RE_RXCFG, 0x40C00800); + break; + case 0x64100000: + sc->re_type = MACFG_83; + sc->max_jumbo_frame_size = Jumbo_Frame_9k; + sc->re_if_flags |= RL_FLAG_DESCV2 | RL_FLAG_PHYWAKE_PM | RL_FLAG_MAGIC_PACKET_V3; + CSR_WRITE_4(sc, RE_RXCFG, 0x40C00800); + break; + default: + device_printf(dev,"unknown device\n"); + sc->re_type = MACFG_FF; + error = ENXIO; + break; + } + + switch(sc->re_device_id) { + case RT_DEVICEID_8169: + case RT_DEVICEID_8169SC: + case RT_DEVICEID_8168: + case RT_DEVICEID_8161: + case RT_DEVICEID_8162: + case RT_DEVICEID_8125: + //do nothing + break; + default: + sc->max_jumbo_frame_size = ETHERMTU; + break; + } + + return error; +} + +static void re_init_software_variable(struct re_softc *sc) +{ + switch(sc->re_device_id) { + case RT_DEVICEID_8168: + case RT_DEVICEID_8161: + case RT_DEVICEID_8162: + case RT_DEVICEID_8136: + case RT_DEVICEID_8125: + sc->re_if_flags |= RL_FLAG_PCIE; + break; + } + + sc->re_rx_mbuf_sz = sc->max_jumbo_frame_size + ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN + ETHER_CRC_LEN + RE_ETHER_ALIGN + 1; + + if (sc->re_rx_mbuf_sz > MJUM9BYTES) { + sc->max_jumbo_frame_size -= (sc->re_rx_mbuf_sz - MJUM9BYTES); + sc->re_rx_mbuf_sz = MJUM9BYTES; + } + + switch(sc->re_type) { + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + sc->HwSuppDashVer = 1; + break; + case MACFG_61: + case MACFG_62: + case MACFG_67: + sc->HwSuppDashVer = 2; + break; + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + sc->HwSuppDashVer = 3; + break; + case MACFG_80: + case MACFG_81: { + u_int8_t tmpUchar; + tmpUchar = (u_int8_t)MP_ReadMcuAccessRegWord(sc, 0xD006); + if (tmpUchar == 0x02 || tmpUchar == 0x04) + sc->HwSuppDashVer = 2; + } + break; + default: + sc->HwSuppDashVer = 0; + break; + } + + switch(sc->re_type) { + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + sc->HwPkgDet = MP_ReadMcuAccessRegWord(sc, 0xDC00); + sc->HwPkgDet = (sc->HwPkgDet >> 3) & 0x0F; + break; + } + + switch(sc->re_type) { + case MACFG_71: + case MACFG_72: + case MACFG_73: + if (sc->HwPkgDet == 0x06) { + u_int8_t tmpUchar = re_eri_read(sc, 0xE6, 1, ERIAR_ExGMAC); + if (tmpUchar == 0x02) + sc->hw_hw_supp_serdes_phy_ver = 1; + else if (tmpUchar == 0x00) + sc->hw_hw_supp_serdes_phy_ver = 2; + } + break; + } + + if (HW_SUPP_SERDES_PHY(sc)) + eee_enable = 0; + + if (HW_DASH_SUPPORT_DASH(sc)) + sc->re_dash = re_check_dash(sc); + + if (sc->re_dash) { + if (HW_DASH_SUPPORT_TYPE_3(sc)) { + u_int64_t CmacMemPhysAddress; + bus_space_handle_t cmac_ioaddr; + + CmacMemPhysAddress = MP_ReadOtherFunPciEConfigSpace(sc, 0, 0xf018); + if (!(CmacMemPhysAddress & BIT_0)) { + if (CmacMemPhysAddress & BIT_2) + CmacMemPhysAddress |= MP_ReadOtherFunPciEConfigSpace(sc, 0, 0xf01c) << 16; + + CmacMemPhysAddress &= 0xFFFFFFF0; + /* ioremap MMIO region */ + sc->re_mapped_cmac_tag = X86_BUS_SPACE_MEM; + if (bus_space_map(sc->re_mapped_cmac_tag, CmacMemPhysAddress, RE_REGS_SIZE, 0, + &cmac_ioaddr)) + sc->re_dash = 0; + else + sc->re_mapped_cmac_handle = cmac_ioaddr; + } + } + } + + switch(sc->re_type) { + case MACFG_61: + case MACFG_62: + case MACFG_67: + sc->re_cmac_handle = sc->re_bhandle; + sc->re_cmac_tag = sc->re_btag; + break; + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + sc->re_cmac_handle = sc->re_mapped_cmac_handle; + sc->re_cmac_tag = sc->re_mapped_cmac_tag; + break; + } + + switch(sc->re_type) { + case MACFG_14: + case MACFG_15: + case MACFG_16: + case MACFG_17: + case MACFG_18: + case MACFG_19: + case MACFG_31: + case MACFG_32: + case MACFG_33: + case MACFG_41: + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + sc->re_efuse_ver = EFUSE_SUPPORT_V1; + break; + case MACFG_36: + case MACFG_37: + case MACFG_42: + case MACFG_43: + case MACFG_54: + case MACFG_55: + sc->re_efuse_ver = EFUSE_SUPPORT_V2; + break; + case MACFG_38: + case MACFG_39: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + sc->re_efuse_ver = EFUSE_SUPPORT_V3; + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + sc->re_efuse_ver = EFUSE_SUPPORT_V4; + break; + default: + sc->re_efuse_ver = EFUSE_NOT_SUPPORT; + break; + } + + switch(sc->re_type) { + case MACFG_69: { + u_int16_t ioffset_p3, ioffset_p2, ioffset_p1, ioffset_p0; + u_int16_t TmpUshort; + + MP_WriteMcuAccessRegWord(sc, 0xDD02, 0x807D); + + TmpUshort = MP_ReadMcuAccessRegWord(sc, 0xDD02); + ioffset_p3 = ((TmpUshort & BIT_7) >>7); + ioffset_p3 <<= 3; + TmpUshort = MP_ReadMcuAccessRegWord(sc, 0xDD00); + + ioffset_p3 |= ((TmpUshort & (BIT_15 | BIT_14 | BIT_13))>>13); + + ioffset_p2 = ((TmpUshort & (BIT_12|BIT_11|BIT_10|BIT_9))>>9); + ioffset_p1 = ((TmpUshort & (BIT_8|BIT_7|BIT_6|BIT_5))>>5); + + ioffset_p0 = ((TmpUshort & BIT_4) >>4); + ioffset_p0 <<= 3; + ioffset_p0 |= (TmpUshort & (BIT_2| BIT_1 | BIT_0)); + + if ((ioffset_p3 == 0x0F) && (ioffset_p2 == 0x0F) && (ioffset_p1 == 0x0F) && (ioffset_p0 == 0x0F)) { + sc->RequireAdcBiasPatch = FALSE; + } else { + sc->RequireAdcBiasPatch = TRUE; + sc->AdcBiasPatchIoffset = (ioffset_p3<<12)|(ioffset_p2<<8)|(ioffset_p1<<4)|(ioffset_p0); + } + } + break; + } + + switch(sc->re_type) { + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: { + u_int16_t rg_saw_cnt; + + MP_WritePhyUshort(sc, 0x1F, 0x0C42); + rg_saw_cnt = MP_ReadPhyUshort(sc, 0x13); + rg_saw_cnt &= ~(BIT_15|BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (rg_saw_cnt > 0) { + sc->SwrCnt1msIni = 16000000/rg_saw_cnt; + sc->SwrCnt1msIni &= 0x0FFF; + + sc->RequireAdjustUpsTxLinkPulseTiming = TRUE; + } + } + break; + } + +#ifdef ENABLE_FIBER_SUPPORT + re_check_hw_fiber_mode_support(sc); +#endif //ENABLE_FIBER_SUPPORT + + switch (sc->re_type) { + case MACFG_74: + sc->RequiredSecLanDonglePatch = FALSE; + break; + } + + switch(sc->re_type) { + case MACFG_31: + case MACFG_32: + case MACFG_33: + case MACFG_36: + case MACFG_37: + case MACFG_38: + case MACFG_39: + case MACFG_42: + case MACFG_43: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_54: + case MACFG_55: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + sc->re_hw_enable_msi_msix = TRUE; + break; + } + + switch(sc->re_type) { + case MACFG_3: + case MACFG_4: + case MACFG_5: + case MACFG_6: + case MACFG_11: + case MACFG_12: + case MACFG_13: + case MACFG_21: + case MACFG_22: + case MACFG_23: + case MACFG_24: + case MACFG_25: + case MACFG_26: + case MACFG_27: + case MACFG_28: + case MACFG_41: + case MACFG_42: + case MACFG_43: + case MACFG_54: + case MACFG_55: + sc->re_coalesce_tx_pkt = TRUE; + break; + } + + switch(sc->re_type) { + case MACFG_36: + case MACFG_37: + case MACFG_38: + case MACFG_39: + case MACFG_42: + case MACFG_43: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_54: + case MACFG_55: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + sc->re_hw_supp_now_is_oob_ver = 1; + break; + } + + switch (sc->re_type) { + case MACFG_36: + case MACFG_37: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168E; + break; + case MACFG_38: + case MACFG_39: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168EVL; + break; + case MACFG_50: + case MACFG_51: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168F; + break; + case MACFG_52: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8411; + break; + case MACFG_56: + case MACFG_57: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168G; + break; + case MACFG_58: + case MACFG_59: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168GU; + break; + case MACFG_60: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8411B; + break; + case MACFG_61: + case MACFG_62: + case MACFG_67: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168EP; + break; + case MACFG_68: + case MACFG_69: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168H; + break; + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168FP; + break; + case MACFG_74: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8168H_6838; + break; + case MACFG_80: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8125A_REV_A; + break; + case MACFG_81: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8125A_REV_B; + break; + case MACFG_82: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8125B_REV_A; + break; + case MACFG_83: + sc->re_sw_ram_code_ver = NIC_RAMCODE_VERSION_8125B_REV_B; + break; + } + + switch (sc->re_type) { + case MACFG_81: + if ((MP_ReadMcuAccessRegWord(sc, 0xD442) & BIT_5) && + (MP_RealReadPhyOcpRegWord(sc, 0xD068) & BIT_1) + ) { + sc->RequirePhyMdiSwapPatch = TRUE; + } + break; + } + + switch (sc->re_type) { + case MACFG_38: + case MACFG_39: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + sc->HwSuppMacMcuVer = 1; + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + sc->HwSuppMacMcuVer = 2; + break; + } + + switch (sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + sc->MacMcuPageSize = RTL8125_MAC_MCU_PAGE_SIZE; + break; + } + + sc->re_8169_MacVersion = (CSR_READ_4(sc, RE_TXCFG)&0x7c800000)>>25; /* Get bit 26~30 */ + sc->re_8169_MacVersion |= ((CSR_READ_4(sc, RE_TXCFG)&0x00800000)!=0 ? 1:0); /* Get bit 23 */ + DBGPRINT1(sc->re_unit,"8169 Mac Version %d",sc->re_8169_MacVersion); + + /* Rtl8169s single chip detected */ + if (sc->re_type == MACFG_3) { + RE_LOCK(sc); + sc->re_8169_PhyVersion=(MP_ReadPhyUshort(sc, 0x03)&0x000f); + DBGPRINT1(sc->re_unit,"8169 Phy Version %d",sc->re_8169_PhyVersion); + RE_UNLOCK(sc); + } + + sc->link_state = LINK_STATE_UNKNOWN; + +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(sc)) + re_set_fiber_mode_software_variable(sc); +#endif //ENABLE_FIBER_SUPPORT +} + +static void re_enable_ocp_phy_power_saving(struct re_softc *sc) +{ + u_int16_t val; + + if (sc->re_type == MACFG_59 || sc->re_type == MACFG_60 || + sc->re_type == MACFG_62 || sc->re_type == MACFG_67 || + sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73 || + sc->re_type == MACFG_74) { + val = MP_ReadPhyOcpRegWord(sc, 0x0C41, 0x13); + if (val != 0x0050) { + re_set_phy_mcu_patch_request(sc); + MP_WritePhyOcpRegWord(sc, 0x0C41, 0x13, 0x0000); + MP_WritePhyOcpRegWord(sc, 0x0C41, 0x13, 0x0050); + re_clear_phy_mcu_patch_request(sc); + } + } else if (sc->re_type == MACFG_80 || sc->re_type == MACFG_81 || + sc->re_type == MACFG_82 || sc->re_type == MACFG_83) { + val = MP_RealReadPhyOcpRegWord(sc, 0xC416); + if (val != 0x0050) { + re_set_phy_mcu_patch_request(sc); + MP_RealWritePhyOcpRegWord(sc, 0xC416, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xC416, 0x0050); + re_clear_phy_mcu_patch_request(sc); + } + } +} + +static void re_disable_ocp_phy_power_saving(struct re_softc *sc) +{ + u_int16_t val; + + if (sc->re_type == MACFG_59 || sc->re_type == MACFG_60 || + sc->re_type == MACFG_62 || sc->re_type == MACFG_67 || + sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73 || + sc->re_type == MACFG_74) { + val = MP_ReadPhyOcpRegWord(sc, 0x0C41, 0x13); + if (val != 0x0500) { + re_set_phy_mcu_patch_request(sc); + MP_WritePhyOcpRegWord(sc, 0x0C41, 0x13, 0x0000); + MP_WritePhyOcpRegWord(sc, 0x0C41, 0x13, 0x0500); + re_clear_phy_mcu_patch_request(sc); + } + } else if (sc->re_type == MACFG_80 || sc->re_type == MACFG_81 || + sc->re_type == MACFG_82 || sc->re_type == MACFG_83) { + val = MP_RealReadPhyOcpRegWord(sc, 0xC416); + if (val != 0x0500) { + re_set_phy_mcu_patch_request(sc); + MP_RealWritePhyOcpRegWord(sc, 0xC416, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xC416, 0x0500); + re_clear_phy_mcu_patch_request(sc); + } + } +} + +static void re_hw_d3_para(struct re_softc *sc) +{ + switch (sc->re_type) { + case MACFG_59: + case MACFG_60: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_disable_ocp_phy_power_saving(sc); + break; + } +} + +/* +* Attach the interface. Allocate softc structures, do ifmedia +* setup and ethernet/BPF attach. +*/ +static int re_attach(device_t dev) +{ + /*int s;*/ + u_char eaddr[ETHER_ADDR_LEN]; + u_int32_t command; + struct re_softc *sc; + struct ifnet *ifp; + int unit, error = 0, rid, i; +// int mac_version; +// int mode; +// u_int8_t data8; + int reg; + int msic=0, msixc=0; + + /*s = splimp();*/ + + sc = device_get_softc(dev); + unit = device_get_unit(dev); + bzero(sc, sizeof(struct re_softc)); + RE_LOCK_INIT(sc,device_get_nameunit(dev)); + sc->dev = dev; + + sc->driver_detach = 0; + + sc->re_vendor_id = pci_get_vendor(dev); + sc->re_device_id = pci_get_device(dev); + sc->re_subvendor_id = pci_get_subvendor(dev); + sc->re_subdevice_id = pci_get_subdevice(dev); + sc->re_revid = pci_get_revid(dev); + pci_enable_busmaster(dev); + + /* + * Map control/status registers. + */ + command = pci_read_config(dev, PCIR_COMMAND, 4); + command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); + pci_write_config(dev, PCIR_COMMAND, command, 4); + command = pci_read_config(dev, PCIR_COMMAND, 4); + + if (prefer_iomap == 0) { + sc->re_res_id = PCIR_BAR(1); + sc->re_res_type = SYS_RES_MEMORY; + /* PCIE NIC use different BARs. */ + if (sc->re_device_id == RT_DEVICEID_8168 || sc->re_device_id == RT_DEVICEID_8161 || + sc->re_device_id == RT_DEVICEID_8161 || sc->re_device_id == RT_DEVICEID_8136 || + sc->re_device_id == RT_DEVICEID_8125) + sc->re_res_id = PCIR_BAR(2); + } else { + sc->re_res_id = PCIR_BAR(0); + sc->re_res_type = SYS_RES_IOPORT; + } + sc->re_res = bus_alloc_resource(dev, sc->re_res_type, &sc->re_res_id, + 0, ~0, 1, RF_ACTIVE); + if (sc->re_res == NULL && prefer_iomap == 0) { + sc->re_res_id = PCIR_BAR(0); + sc->re_res_type = SYS_RES_IOPORT; + sc->re_res = bus_alloc_resource(dev, sc->re_res_type, &sc->re_res_id, + 0, ~0, 1, RF_ACTIVE); + } + + if (sc->re_res == NULL) { + device_printf(dev,"couldn't map ports/memory\n"); + error = ENXIO; + goto fail; + } + + if (sc->re_res_type == SYS_RES_IOPORT) + device_printf(dev, "Using I/O Ports\n"); + else + device_printf(dev, "Using Memory Mapping!\n"); + + sc->re_btag = rman_get_bustag(sc->re_res); + sc->re_bhandle = rman_get_bushandle(sc->re_res); + + error = re_check_mac_version(sc); + + if (error) { + goto fail; + } + + re_init_software_variable(sc); + +#if OS_VER >= VERSION(7,0) + msic = pci_msi_count(dev); + msixc = pci_msix_count(dev); + if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { + sc->re_if_flags |= RL_FLAG_PCIE; + sc->re_expcap = reg; + } else { + sc->re_if_flags &= ~RL_FLAG_PCIE; + sc->re_expcap = 0; + } + + //device_printf(dev, "MSI count : %d\n", msic); + //device_printf(dev, "MSI-X count : %d\n", msixc); + if (sc->re_hw_enable_msi_msix == FALSE) { + msixc = 0; + msic = 0; + } + if (msix_disable > 0) + msixc = 0; + if (msi_disable > 0) + msic = 0; + + /* Prefer MSI-X to MSI. */ + if (msixc > 0) { + rid = PCIR_BAR(4); + msixc = RL_MSI_MESSAGES; + sc->re_res_pba = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &rid, RF_ACTIVE); + if (sc->re_res_pba == NULL) { + device_printf(dev, + "could not allocate MSI-X PBA resource\n"); + } + if (sc->re_res_pba != NULL && + pci_alloc_msix(dev, &msixc) == 0) { + if (msixc == RL_MSI_MESSAGES) { + device_printf(dev, "Using %d MSI-X message\n", + msixc); + sc->re_if_flags |= RL_FLAG_MSIX; + } else + pci_release_msi(dev); + } + if ((sc->re_if_flags & RL_FLAG_MSIX) == 0) { + if (sc->re_res_pba != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, rid, + sc->re_res_pba); + sc->re_res_pba = NULL; + msixc = 0; + } + } + + /* Prefer MSI to INTx. */ + if (msixc == 0 && msic > 0) { + msic = RL_MSI_MESSAGES; + if (pci_alloc_msi(dev, &msic) == 0) { + if (msic == RL_MSI_MESSAGES) { + device_printf(dev, "Using %d MSI message\n", + msic); + sc->re_if_flags |= RL_FLAG_MSI; + } else + pci_release_msi(dev); + } + if ((sc->re_if_flags & RL_FLAG_MSI) == 0) + msic = 0; + } +#endif //OS_VER >= VERSION(7,0) + + if ((sc->re_if_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0) { + rid = 0; + sc->re_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, + RF_SHAREABLE | RF_ACTIVE); + + if (sc->re_irq == NULL) { + device_printf(dev,"couldn't map interrupt\n"); + error = ENXIO; + goto fail; + } + device_printf(dev, "Using line-based interrupt\n"); + } else { + rid = 1; + sc->re_irq = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->re_irq == NULL) { + device_printf(dev, + "couldn't allocate IRQ resources for " + "message %d\n", rid); + error = ENXIO; + goto fail; + } + } + +#if OS_VER >= VERSION(7,3) + /* Disable ASPM L0S/L1 and Clock Request. */ + if (sc->re_expcap != 0) { + u_int32_t cap, ctl; + cap = pci_read_config(dev, sc->re_expcap + + RE_PCIER_LINK_CAP, 2); + if ((cap & RE_PCIEM_LINK_CAP_ASPM) != 0) { + ctl = pci_read_config(dev, sc->re_expcap + + RE_PCIER_LINK_CTL, 2); + if ((ctl & 0x0103) != 0) { + ctl &= ~0x0103; + pci_write_config(dev, sc->re_expcap + + RE_PCIER_LINK_CTL, ctl, 2); + device_printf(dev, "ASPM disabled\n"); + } + } else + device_printf(dev, "no ASPM capability\n"); + } +#endif //OS_VER >= VERSION(7,3) + + re_init_timer(sc); + + RE_LOCK(sc); + re_exit_oob(sc); + re_hw_init(sc); + RE_UNLOCK(sc); + + /* + * Reset the adapter. Only take the lock here as it's needed in + * order to call re_reset(). + */ + RE_LOCK(sc); + re_reset(sc); + RE_UNLOCK(sc); + + /* Get station address. */ + RE_LOCK(sc); + re_get_hw_mac_address(sc, eaddr); + RE_UNLOCK(sc); + + /* + * A RealTek chip was detected. Inform the world. + */ + device_printf(dev,"version:%s\n", RE_VERSION); + device_printf(dev,"Ethernet address: %6D\n", eaddr, ":"); + printf("\nThis product is covered by one or more of the following patents: \ + \nUS6,570,884, US6,115,776, and US6,327,625.\n"); + + sc->re_unit = unit; + +#if OS_VER < VERSION(6,0) + bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); +#endif + + if (sc->re_type == MACFG_3) { /* Change PCI Latency time*/ + pci_write_config(dev, RE_PCI_LATENCY_TIMER, 0x40, 1); + } + + error = bus_dma_tag_create( +#if OS_VER < VERSION(7,0) + NULL, +#else + bus_get_dma_tag(dev), /* parent */ +#endif + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->re_parent_tag); + + i = roundup2(sizeof(union RxDesc)*RE_RX_BUF_NUM, RE_DESC_ALIGN); + error = bus_dma_tag_create( + sc->re_parent_tag, + RE_DESC_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + i, /* maxsize */ + 1, /* nsegments */ + i, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->re_desc.rx_desc_tag); + if (error) { + device_printf(dev,"bus_dma_tag_create fail\n"); + goto fail; + } + + error = bus_dmamem_alloc(sc->re_desc.rx_desc_tag, + (void**) &sc->re_desc.rx_desc, + BUS_DMA_WAITOK|BUS_DMA_COHERENT|BUS_DMA_ZERO, + &sc->re_desc.rx_desc_dmamap); + if (error) { + device_printf(dev,"bus_dmamem_alloc fail\n"); + goto fail; + } + + i = roundup2(sizeof(union TxDesc)*RE_TX_BUF_NUM, RE_DESC_ALIGN); + error = bus_dma_tag_create( + sc->re_parent_tag, + RE_DESC_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + i, /* maxsize */ + 1, /* nsegments */ + i, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->re_desc.tx_desc_tag); + if (error) { + device_printf(dev,"bus_dma_tag_create fail\n"); + goto fail; + } + + error = bus_dmamem_alloc(sc->re_desc.tx_desc_tag, + (void**) &sc->re_desc.tx_desc, + BUS_DMA_WAITOK|BUS_DMA_COHERENT|BUS_DMA_ZERO, + &sc->re_desc.tx_desc_dmamap); + + if (error) { + device_printf(dev,"bus_dmamem_alloc fail\n"); + goto fail; + } + + sc->re_tx_cstag =1; + sc->re_rx_cstag =1; + +#if OS_VER < VERSION(6,0) + ifp = &sc->arpcom.ac_if; +#else + ifp = sc->re_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + error = ENOSPC; + goto fail; + } +#endif + ifp->if_softc = sc; +#if OS_VER < VERSION(5,3) + ifp->if_unit = unit; + ifp->if_name = "re"; +#else + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); +#endif + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = re_ioctl; + ifp->if_output = ether_output; + ifp->if_start = re_start; +#if OS_VER < VERSION(7,0) + ifp->if_watchdog = re_watchdog; +#endif + if ((sc->re_type == MACFG_24) || (sc->re_type == MACFG_25) || (sc->re_type == MACFG_26)) + ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist |= RE_CSUM_FEATURES; + + ifp->if_capabilities = IFCAP_HWCSUM; + ifp->if_capenable = ifp->if_capabilities; + ifp->if_init = re_init; + /* VLAN capability setup */ + ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; + ifp->if_capenable = ifp->if_capabilities; + + /* Enable WOL if PM is supported. */ + if (pci_find_cap(sc->dev, PCIY_PMG, ®) == 0) + ifp->if_capabilities |= IFCAP_WOL; + ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); + + RE_LOCK(sc); + re_phy_power_up(dev); + re_hw_phy_config(sc); + re_clrwol(sc); + + set_rxbufsize(sc); + error =re_alloc_buf(sc); + + if (error) { + RE_UNLOCK(sc); + goto fail; + } + /* Init descriptors. */ + re_var_init(sc); + + RE_UNLOCK(sc); + + switch(sc->re_device_id) { + case RT_DEVICEID_8125: + ifp->if_baudrate = 25000000000; + break; + case RT_DEVICEID_8169: + case RT_DEVICEID_8169SC: + case RT_DEVICEID_8168: + case RT_DEVICEID_8161: + case RT_DEVICEID_8162: + ifp->if_baudrate = 1000000000; + break; + default: + ifp->if_baudrate = 100000000; + break; + } + IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_READY(&ifp->if_snd); + + if (sc->re_device_id == RT_DEVICEID_8125) { + sc->ifmedia_upd = re_ifmedia_upd_8125; + sc->ifmedia_sts = re_ifmedia_sts_8125; + sc->intr = re_intr_8125; + sc->int_task = re_int_task_8125; + sc->hw_start_unlock = re_hw_start_unlock_8125; + } else { + sc->ifmedia_upd = re_ifmedia_upd; + sc->ifmedia_sts = re_ifmedia_sts; + sc->intr = re_intr; + sc->int_task = re_int_task; + sc->hw_start_unlock = re_hw_start_unlock; + } + +#if OS_VER>=VERSION(7,0) + TASK_INIT(&sc->re_inttask, 0, sc->int_task, sc); +#endif + + /* + * Call MI attach routine. + */ + /*#if OS_VER < VERSION(5, 1)*/ +#if OS_VER < VERSION(4,9) + ether_ifattach(ifp, ETHER_BPF_SUPPORTED); +#else + ether_ifattach(ifp, eaddr); +#endif + +#if OS_VER < VERSION(7,0) + error = bus_setup_intr(dev, sc->re_irq, INTR_TYPE_NET, + sc->intr, sc, &sc->re_intrhand); +#else + error = bus_setup_intr(dev, sc->re_irq, INTR_TYPE_NET|INTR_MPSAFE, + sc->intr, NULL, sc, &sc->re_intrhand); +#endif + + if (error) { +#if OS_VER < VERSION(4,9) + ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); +#else + ether_ifdetach(ifp); +#endif + device_printf(dev,"couldn't set up irq\n"); + goto fail; + } + + /* + * Specify the media types supported by this adapter and register + * callbacks to update media and link information + */ + ifmedia_init(&sc->media, IFM_IMASK, sc->ifmedia_upd, sc->ifmedia_sts); + ifmedia_add(&sc->media, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&sc->media, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->media, IFM_ETHER | IFM_100_TX, 0, NULL); + ifmedia_add(&sc->media, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL); + switch(sc->re_device_id) { + case RT_DEVICEID_8125: + case RT_DEVICEID_8169: + case RT_DEVICEID_8169SC: + case RT_DEVICEID_8168: + case RT_DEVICEID_8161: + case RT_DEVICEID_8162: + ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); + //ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_T, 0, NULL); + break; + default: + break; + } + switch(sc->re_device_id) { + case RT_DEVICEID_8125: + ifmedia_add(&sc->media, IFM_ETHER | IFM_2500_T | IFM_FDX, 0, NULL); + break; + default: + break; + } + ifmedia_add(&sc->media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->media, IFM_ETHER | IFM_AUTO); + sc->media.ifm_media = IFM_ETHER | IFM_AUTO; + sc->ifmedia_upd(ifp); + +fail: + if (error) + re_detach(dev); + + return(error); +} + +static int re_detach(device_t dev) +{ + struct re_softc *sc; + struct ifnet *ifp; + /*int s;*/ + int i; + int rid; + + /*s = splimp();*/ + + sc = device_get_softc(dev); + + ifp = RE_GET_IFNET(sc); + + /* These should only be active if attach succeeded */ + if (device_is_attached(dev)) { + RE_LOCK(sc); + re_stop(sc); + RE_UNLOCK(sc); +#if OS_VER>=VERSION(7,0) + taskqueue_drain(taskqueue_fast, &sc->re_inttask); +#endif +#if OS_VER < VERSION(4,9) + ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); +#else + ether_ifdetach(ifp); +#endif + } + + bus_generic_detach(dev); + + sc->driver_detach = 1; + + if (sc->re_intrhand) + bus_teardown_intr(dev, sc->re_irq, sc->re_intrhand); + +#if OS_VER>=VERSION(6,0) + if (ifp) + if_free(ifp); +#endif + + if ((sc->re_if_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0) + rid = 0; + else + rid = 1; + if (sc->re_irq) { + bus_release_resource(dev, SYS_RES_IRQ, rid, sc->re_irq); + sc->re_irq = NULL; + } + if ((sc->re_if_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) != 0) + pci_release_msi(dev); + if (sc->re_res_pba) { + rid = PCIR_BAR(4); + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->re_res_pba); + } + if (sc->re_res) + bus_release_resource(dev, sc->re_res_type, sc->re_res_id, sc->re_res); + + if (HW_DASH_SUPPORT_TYPE_3(sc) && sc->re_dash) + bus_space_unmap(sc->re_cmac_tag, sc->re_mapped_cmac_handle, RE_REGS_SIZE); + + if (sc->re_desc.re_rx_mtag) { + for (i = 0; i < RE_RX_BUF_NUM; i++) { + if (sc->re_desc.rx_buf[i]!=NULL) { + bus_dmamap_sync(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i], + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i]); + bus_dmamap_destroy(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i]); + m_freem(sc->re_desc.rx_buf[i]); + sc->re_desc.rx_buf[i] =NULL; + } + } + bus_dma_tag_destroy(sc->re_desc.re_rx_mtag); + sc->re_desc.re_rx_mtag =0; + } + + if (sc->re_desc.re_tx_mtag) { + for (i = 0; i < RE_TX_BUF_NUM; i++) { + bus_dmamap_destroy(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[i]); + } + bus_dma_tag_destroy(sc->re_desc.re_tx_mtag); + sc->re_desc.re_tx_mtag =0; + } + + if (sc->re_desc.rx_desc_tag) { + bus_dmamap_sync(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc_dmamap, + BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc_dmamap); + bus_dmamem_free(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc, + sc->re_desc.rx_desc_dmamap); + bus_dma_tag_destroy(sc->re_desc.rx_desc_tag); + } + + if (sc->re_desc.tx_desc_tag) { + bus_dmamap_sync(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc_dmamap, + BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc_dmamap); + bus_dmamem_free(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc, + sc->re_desc.tx_desc_dmamap); + bus_dma_tag_destroy(sc->re_desc.tx_desc_tag); + } + + if (sc->re_parent_tag) { + bus_dma_tag_destroy(sc->re_parent_tag); + } + + /*splx(s);*/ + RE_LOCK_DESTROY(sc); + + return(0); +} + +static void +re_link_state_change(struct ifnet *ifp, int link_state) +{ +#if OS_VER>=VERSION(6,0) + if_link_state_change(ifp, link_state); +#else + ifp->if_link_state = link_state +#endif +} + +/* + * Device suspend routine. Stop the interface and save some PCI + * settings in case the BIOS doesn't restore them properly on + * resume. + */ +static int +re_suspend(device_t dev) +{ + struct re_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + RE_LOCK(sc); + ifp = RE_GET_IFNET(sc); + sc->re_link_chg_det = 0; + sc->phy_reg_anlpar = re_get_phy_lp_ability(sc); + re_stop(sc); + re_hw_d3_para(sc); + re_setwol(sc); + sc->suspended = 1; + sc->link_state = LINK_STATE_UNKNOWN; + re_link_state_change(ifp, sc->link_state); + sc->prohibit_access_reg = 1; + RE_UNLOCK(sc); + + return (0); +} + +/* + * Device resume routine. Restore some PCI settings in case the BIOS + * doesn't, re-enable busmastering, and restart the interface if + * appropriate. + */ +static int +re_resume(device_t dev) +{ + struct re_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + + RE_LOCK(sc); + + ifp = RE_GET_IFNET(sc); + + sc->prohibit_access_reg = 0; + + re_exit_oob(sc); + + re_hw_init(sc); + + re_reset(sc); + + re_phy_power_up(dev); + + re_hw_phy_config(sc); + + /* + * Clear WOL matching such that normal Rx filtering + * wouldn't interfere with WOL patterns. + */ + re_clrwol(sc); + + RE_UNLOCK(sc); + + RE_LOCK(sc); + sc->ifmedia_upd(ifp); + sc->suspended = 0; + if (ifp->if_flags & IFF_UP) { + sc->re_link_chg_det = 1; + re_start_timer(sc); + } + RE_UNLOCK(sc); + + return (0); +} + + +static void +ClearAndSetPCIePhyBit( + struct re_softc *sc, + u_int8_t addr, + u_int16_t clearmask, + u_int16_t setmask +) +{ + u_int16_t EphyValue; + + EphyValue = MP_ReadEPhyUshort(sc, addr); + EphyValue &= ~clearmask; + EphyValue |= setmask; + MP_WriteEPhyUshort(sc, addr, EphyValue); +} + +static void +ClearPCIePhyBit( + struct re_softc *sc, + u_int8_t addr, + u_int16_t mask +) +{ + ClearAndSetPCIePhyBit(sc, + addr, + mask, + 0 + ); +} + +static void +SetPCIePhyBit( + struct re_softc *sc, + u_int8_t addr, + u_int16_t mask +) +{ + ClearAndSetPCIePhyBit(sc, + addr, + 0, + mask + ); +} + +/* + * Stop all chip I/O so that the kernel's probe routines don't + * get confused by errant DMAs when rebooting. + */ +static int re_shutdown(dev) /* The same with re_stop(sc) */ +device_t dev; +{ + struct re_softc *sc; + + sc = device_get_softc(dev); + + if (sc->re_dash) + re_driver_stop(sc); + + RE_LOCK(sc); + sc->re_link_chg_det = 0; + sc->phy_reg_anlpar = re_get_phy_lp_ability(sc); + re_stop(sc); + RE_UNLOCK(sc); + + RE_LOCK(sc); + re_hw_d3_para(sc); + if (s5wol == 0) { + re_phy_power_down(dev); + } else { + struct ifnet *ifp; + ifp = RE_GET_IFNET(sc); + ifp->if_capenable = IFCAP_WOL_MAGIC; + re_setwol(sc); + } + RE_UNLOCK(sc); + + return 0; +} + +static void re_hw_start_unlock(struct re_softc *sc) +{ + struct ifnet *ifp; + u_int32_t macver; + u_int8_t data8; + u_int16_t data16 = 0; + u_int32_t Data32; + + ifp = RE_GET_IFNET(sc); + + /* Init descriptors. */ + re_var_init(sc); + + re_enable_cfg9346_write(sc); + + switch(sc->re_type) { + case MACFG_36: + case MACFG_37: + case MACFG_38: + case MACFG_39: + case MACFG_42: + case MACFG_43: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_54: + case MACFG_55: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + CSR_WRITE_1(sc, RE_CFG5, CSR_READ_1(sc, RE_CFG5) & ~BIT_0); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) & ~BIT_7); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) & ~BIT_7); + break; + } + + /*disable Link Down Power Saving(non-LDPS)*/ + /*CSR_WRITE_1(sc, RE_LDPS, 0x05);*/ + /*ldps= CSR_READ_1(sc, RE_LDPS);*/ + + CSR_WRITE_2(sc, RE_CPlusCmd, 0x2060); + + CSR_WRITE_2(sc, RE_IM, 0x5151); + + CSR_WRITE_1(sc, RE_MTPS, 0x3f); + + if (sc->re_device_id == RT_DEVICEID_8169 || sc->re_device_id == RT_DEVICEID_8169SC) { + //do nothing + } else { + /* Set the initial TX configuration.*/ + CSR_WRITE_4(sc, RE_TXCFG, RE_TXCFG_CONFIG); + } + + macver = CSR_READ_4(sc, RE_TXCFG) & 0xFC800000; + if (macver == 0x00800000 || macver == 0x04000000 || macver == 0x10000000) { + CSR_WRITE_2(sc, RE_CPlusCmd, 0x0063| ((sc->re_type == MACFG_3 && sc->re_8169_MacVersion==1) ? 0x4008:0)); + } else if (macver == 0x18000000 || macver == 0x98000000) { + CSR_WRITE_2(sc, RE_CPlusCmd, 0x0068); + CSR_WRITE_2(sc, RE_IntrMitigate, 0x0000); + } else if (macver == 0x30000000) { + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + if (ifp->if_mtu > ETHERMTU) { + data8 = pci_read_config(sc->dev, 0x69, 1); + data8 &= ~0x70; + data8 |= 0x28; + pci_write_config(sc->dev, 0x69, data8, 1); + } else { + data8 = pci_read_config(sc->dev, 0x69, 1); + data8 &= ~0x70; + data8 |= 0x58; + pci_write_config(sc->dev, 0x69, data8, 1); + } + } else if (macver == 0x38000000) { + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + if (ifp->if_mtu > ETHERMTU) { + data8 = pci_read_config(sc->dev, 0x69, 1); + data8 &= ~0x70; + data8 |= 0x28; + pci_write_config(sc->dev, 0x69, data8, 1); + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | BIT_0); + } else { + data8 = pci_read_config(sc->dev, 0x69, 1); + data8 &= ~0x70; + data8 |= 0x58; + pci_write_config(sc->dev, 0x69, data8, 1); + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~ BIT_0); + } + } else if (macver == 0x34000000 || macver == 0xB4000000) { + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + } else if (macver == 0x34800000 || macver == 0x24800000) { + if (pci_read_config(sc->dev, 0x81, 1) == 1) { + CSR_WRITE_1(sc, RE_DBG_reg, 0x98); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | 0x80); + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | 0x04); + pci_write_config(sc->dev, 0x81, 1, 1); + } + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + /*set configuration space offset 0x70f to 0x3f*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x3F << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + if (sc->re_type == MACFG_14) { + CSR_WRITE_1(sc,RE_CFG1, 0x0f); + + MP_WriteEPhyUshort(sc, 0x03, 0xC2F9); + } else if (sc->re_type == MACFG_15) { + CSR_WRITE_1(sc,RE_CFG1, 0x0f); + + MP_WriteEPhyUshort(sc, 0x01, 0x6FE5); + MP_WriteEPhyUshort(sc, 0x03, 0x07D9); + } else if (sc->re_type == MACFG_17) { + MP_WriteEPhyUshort(sc, 0x06, 0xAF35); + } else if (sc->re_type == MACFG_18) { + CSR_WRITE_1(sc, 0xF5, CSR_READ_1(sc, 0xF5)|0x04); + MP_WriteEPhyUshort(sc, 0x19, 0xEC90); + MP_WriteEPhyUshort(sc, 0x01, 0x6FE5); + MP_WriteEPhyUshort(sc, 0x03, 0x05D9); + MP_WriteEPhyUshort(sc, 0x06, 0xAF35); + } else if (sc->re_type == MACFG_19) { + if (pci_read_config(sc->dev, 0x80, 1)&3) { + MP_WriteEPhyUshort(sc, 0x02, 0x011F); + } + CSR_WRITE_1(sc, 0xF4, CSR_READ_1(sc, 0xF4)|0x08); + CSR_WRITE_1(sc, 0xF5, CSR_READ_1(sc, 0xF5)|0x04); + MP_WriteEPhyUshort(sc, 0x19, 0xEC90); + MP_WriteEPhyUshort(sc, 0x01, 0x6FE5); + MP_WriteEPhyUshort(sc, 0x03, 0x05D9); + MP_WriteEPhyUshort(sc, 0x06, 0xAF35); + } + } else if (macver == 0x3C000000) { + //disable clock request. + pci_write_config(sc->dev, 0x81, 0, 1); + + /*set configuration space offset 0x70f to 0x27*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + CSR_WRITE_1(sc, RE_CFG1, CSR_READ_1(sc, RE_CFG1)|0x10); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + if (sc->re_type == MACFG_24) { + /*set mac register offset 0xd1 to 0xf8*/ + CSR_WRITE_1(sc, RE_DBG_reg, 0xF8); + + data16 = MP_ReadEPhyUshort(sc, 0x02) & ~0x1800; + data16 |= 0x1000; + MP_WriteEPhyUshort(sc, 0x02, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x03) | 0x0002; + MP_WriteEPhyUshort(sc, 0x03, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x06) & ~0x0080; + MP_WriteEPhyUshort(sc, 0x06, data16); + + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | (1 << 1)); //Jumbo_en1 + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + + } else { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~(1 << 1)); //Jumbo_en1 + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + if ((sc->re_type == MACFG_24) || (sc->re_type == MACFG_25) || (sc->re_type == MACFG_26)) + ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + } + } else if (sc->re_type == MACFG_25) { + data16 = MP_ReadEPhyUshort(sc, 0x01) | 0x0001; + MP_WriteEPhyUshort(sc, 0x01, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x03) & ~0x0620; + data16 |= 0x0220; + MP_WriteEPhyUshort(sc, 0x03, data16); + + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | (1<<1)); //Jumbo_en1 + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + + } else { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~(1<<1)); //Jumbo_en1 + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + if ((sc->re_type == MACFG_24) || (sc->re_type == MACFG_25) || (sc->re_type == MACFG_26)) + ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + + + } + } else if (sc->re_type == MACFG_26) { + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | (1<<1)); //Jumbo_en1 + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~(1<<1)); //Jumbo_en1 + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + if ((sc->re_type == MACFG_24) || (sc->re_type == MACFG_25) || (sc->re_type == MACFG_26)) + ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + } + } + } else if (macver == 0x3C800000) { + //disable clock request. + pci_write_config(sc->dev, 0x81, 0x00, 1); + + /*set configuration space offset 0x70f to 0x27*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + re_eri_write(sc, 0x1EC, 1, 0x07, ERIAR_ASF); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + if (sc->re_type == MACFG_28) + CSR_WRITE_1(sc, 0xD1, 0x20); + + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | (1<<1)); //Jumbo_en1 + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~(1<<1)); //Jumbo_en1 + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + } + } else if (macver == 0x28000000) { + //disable clock request. + pci_write_config(sc->dev, 0x81, 0x00, 1); + + /*set configuration space offset 0x70f to 0x13*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + CSR_WRITE_1(sc, RE_TDFNR, 0x8); + + CSR_WRITE_1(sc, 0xD1, CSR_READ_1(sc, 0xD1) | 0x02); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + CSR_WRITE_1(sc, RE_DBG_reg, CSR_READ_1(sc, RE_DBG_reg)|0x82); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | (1<<1)); //Jumbo_en1 + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + + } else { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~(1<<1)); //Jumbo_en1 + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + } + + if (sc->re_type == MACFG_31) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~(1<<4)); + + MP_WriteEPhyUshort(sc, 0x01, 0x7C7F); + MP_WriteEPhyUshort(sc, 0x02, 0x011F); + MP_WriteEPhyUshort(sc, 0x06, 0xB271); + MP_WriteEPhyUshort(sc, 0x07, 0xCE00); + } else if (sc->re_type == MACFG_32) { + MP_WriteEPhyUshort(sc, 0x01, 0x7C7D); + MP_WriteEPhyUshort(sc, 0x02, 0x091F); + MP_WriteEPhyUshort(sc, 0x03, 0xC5BA); + MP_WriteEPhyUshort(sc, 0x06, 0xB279); + MP_WriteEPhyUshort(sc, 0x07, 0xAF00); + MP_WriteEPhyUshort(sc, 0x1E, 0xB8EB); + } else if (sc->re_type == MACFG_33) { + CSR_WRITE_1(sc, RE_CFG1, CSR_READ_1(sc, RE_CFG1)|0x10); + + MP_WriteEPhyUshort(sc, 0x01, 0x6C7F); + MP_WriteEPhyUshort(sc, 0x02, 0x011F); + ClearAndSetPCIePhyBit(sc, + 0x03, + 0xFFF0, + 0x01B0 + ); + MP_WriteEPhyUshort(sc, 0x1A, 0x0546); + MP_WriteEPhyUshort(sc, 0x1C, 0x80C4); + MP_WriteEPhyUshort(sc, 0x1D, 0x78E5); + MP_WriteEPhyUshort(sc, 0x0A, 0x8100); + } + } else if (macver == 0x28800000) { + /* disable clock request. */ + pci_write_config(sc->dev, 0x81, 0x00, 1); + + /*set configuration space offset 0x70f to 0x17*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + CSR_WRITE_1(sc, RE_TDFNR, 0x8); + if (sc->re_dash && + (sc->re_type == MACFG_63 || sc->re_type == MACFG_64)) + CSR_WRITE_1(sc, RE_TDFNR, 0x1); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + CSR_WRITE_1(sc, RE_DBG_reg, CSR_READ_1(sc, RE_DBG_reg)|0x82); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | (1<<1)); //Jumbo_en1 + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + + } else { + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); //Jumbo_en0 + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~(1<<1)); //Jumbo_en1 + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + } + + if (sc->re_type == MACFG_65 || sc->re_type == MACFG_66) { + SetPCIePhyBit(sc, 0x0B, (BIT_3 | BIT_6)); + + ClearAndSetPCIePhyBit(sc, + 0x19, + BIT_5, + (BIT_4 | BIT_6) + ); + + ClearAndSetPCIePhyBit(sc, + 0x0C, + BIT_8, + BIT_5 + ); + + ClearPCIePhyBit(sc, 0x10, (BIT_2)); + } + } else if (macver == 0x2C000000) { + /* disable clock request. */ + pci_write_config(sc->dev, 0x81, 0x00, 1); + + /*set configuration space offset 0x70f to 0x20*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + CSR_WRITE_1(sc, 0xF3, CSR_READ_1(sc, 0xF3)|0x20); + CSR_WRITE_1(sc, 0xF3, CSR_READ_1(sc, 0xF3)& ~0x20); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0)|0xC0); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1)|0x73); + CSR_WRITE_1(sc, RE_CFG5, (CSR_READ_1(sc, RE_CFG5)& ~0x08)); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_1(sc, RE_TDFNR, 0x8); + + if (sc->re_type == MACFG_36 || sc->re_type == MACFG_37) { + /* set EPHY registers */ + data16 = MP_ReadEPhyUshort(sc, 0x00) & ~0x0200; + data16 |= 0x0100; + MP_WriteEPhyUshort(sc, 0x00, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x00); + data16 |= 0x0004; + MP_WriteEPhyUshort(sc, 0x00, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x06) & ~0x0002; + data16 |= 0x0001; + MP_WriteEPhyUshort(sc, 0x06, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x06); + data16 |= 0x0030; + MP_WriteEPhyUshort(sc, 0x06, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x07); + data16 |= 0x2000; + MP_WriteEPhyUshort(sc, 0x07, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x00); + data16 |= 0x0020; + MP_WriteEPhyUshort(sc, 0x00, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x03) & ~0x5800; + data16 |= 0x2000; + MP_WriteEPhyUshort(sc, 0x03, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x03); + data16 |= 0x0001; + MP_WriteEPhyUshort(sc, 0x03, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x01) & ~0x0800; + data16 |= 0x1000; + MP_WriteEPhyUshort(sc, 0x01, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x07); + data16 |= 0x4000; + MP_WriteEPhyUshort(sc, 0x07, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x1E); + data16 |= 0x2000; + MP_WriteEPhyUshort(sc, 0x1E, data16); + + MP_WriteEPhyUshort(sc, 0x19, 0xFE6C); + + data16 = MP_ReadEPhyUshort(sc, 0x0A); + data16 |= 0x0040; + MP_WriteEPhyUshort(sc, 0x0A, data16); + + if (ifp->if_mtu > ETHERMTU) { + CSR_WRITE_1 (sc, RE_MTPS, 0x24); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) | BIT_2); + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) |0x01); + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x20; + pci_write_config(sc->dev, 0x79, data8, 1); + ifp->if_capenable &= ~IFCAP_HWCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) & ~RL_RxChkSum); + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + CSR_WRITE_1 (sc, RE_MTPS, 0x0c); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_2); + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) & ~0x01); + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + CSR_WRITE_2 (sc, RE_CPlusCmd,CSR_READ_2(sc, RE_CPlusCmd) |RL_RxChkSum); + } + } + } + } else if (macver == 0x2C800000) { + /* disable clock request. */ + pci_write_config(sc->dev, 0x81, 0x00, 1); + + /*set configuration space offset 0x70f to 0x27*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + CSR_WRITE_1(sc, RE_TDFNR, 0x8); + + re_eri_write(sc, 0xC0, 2, 0x0000, ERIAR_ExGMAC); + re_eri_write(sc, 0xB8, 4, 0x00000000, ERIAR_ExGMAC); + re_eri_write(sc, 0xC8, 4, 0x00100002, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0xdc, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 |= BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= (BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12); + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + if (sc ->re_type == MACFG_39) { + Data32 = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + Data32 |= BIT_4; + re_eri_write(sc, 0x1B0, 4, Data32, ERIAR_ExGMAC); + re_eri_write(sc, 0xCC, 4, 0x00000050, ERIAR_ExGMAC); + re_eri_write(sc, 0xD0, 4, 0x07ff0060, ERIAR_ExGMAC); + } + + CSR_WRITE_4(sc, RE_TXCFG, CSR_READ_4(sc, RE_TXCFG) |BIT_7); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0x1B, CSR_READ_1(sc, 0x1B) & ~0x07); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + if (sc ->re_type == MACFG_38) { + CSR_WRITE_4(sc, 0xB0, 0xEE480010); + CSR_WRITE_1(sc, 0x1A, CSR_READ_1(sc, 0x1A) & ~(BIT_2 |BIT_3)); + re_eri_write(sc, 0x1DC, 1, 0x64, ERIAR_ExGMAC); + + MP_WriteEPhyUshort(sc, 0x06, 0xF020); + MP_WriteEPhyUshort(sc, 0x07, 0x01FF); + MP_WriteEPhyUshort(sc, 0x00, 0x5027); + MP_WriteEPhyUshort(sc, 0x01, 0x0003); + MP_WriteEPhyUshort(sc, 0x02, 0x2D16); + MP_WriteEPhyUshort(sc, 0x03, 0x6D49); + MP_WriteEPhyUshort(sc, 0x08, 0x0006); + MP_WriteEPhyUshort(sc, 0x0A, 0x00C8); + } + + data16 = MP_ReadEPhyUshort(sc, 0x09); + data16 |= BIT_7; + MP_WriteEPhyUshort(sc, 0x09, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x19); + data16 |= (BIT_2 | BIT_5 | BIT_9); + MP_WriteEPhyUshort(sc, 0x19, data16); + + SetPCIePhyBit(sc, 0x00, BIT_3); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13|BIT_12|BIT_11|BIT_10|BIT_8|BIT_7|BIT_6|BIT_5|BIT_4), + BIT_9 + ); + + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | BIT_5); + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_6); + + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + ifp->if_capenable &= ~IFCAP_HWCSUM; + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else if (macver == 0x24000000) { + if (pci_read_config(sc->dev, 0x81, 1)==1) { + CSR_WRITE_1(sc, RE_DBG_reg, 0x98); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | 0x80); + CSR_WRITE_1(sc, RE_CFG4, CSR_READ_1(sc, RE_CFG4) | 0x04); + pci_write_config(sc->dev, 0x81, 1, 1); + } + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + /*set configuration space offset 0x70f to 0x3F*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x3F << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + MP_WriteEPhyUshort(sc, 0x06, 0xAF25); + MP_WriteEPhyUshort(sc, 0x07, 0x8E68); + } else if (macver == 0x40800000) { + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | 0x80); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) | 0x28); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) | 0x0C); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | 0x40); + CSR_WRITE_2(sc, 0xE0, CSR_READ_2(sc, 0xE0) & ~0xDF9C); + CSR_WRITE_1(sc, 0xD1, CSR_READ_1(sc, 0xD1) | 0x02); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + if (sc->re_type == MACFG_42) { + /* set EPHY registers */ + SetPCIePhyBit(sc, 0x07, BIT_14); + SetPCIePhyBit(sc, 0x19, BIT_9); + SetPCIePhyBit(sc, 0x19, BIT_5); + SetPCIePhyBit(sc, 0x1E, BIT_13); + SetPCIePhyBit(sc, 0x03, BIT_0); + SetPCIePhyBit(sc, 0x19, BIT_8); + SetPCIePhyBit(sc, 0x19, BIT_2); + SetPCIePhyBit(sc, 0x0A, BIT_5); + SetPCIePhyBit(sc, 0x05, BIT_13); + } + if (sc->re_type == MACFG_43) { + SetPCIePhyBit(sc, 0x07, BIT_14); + SetPCIePhyBit(sc, 0x19, BIT_9); + SetPCIePhyBit(sc, 0x19, BIT_5); + SetPCIePhyBit(sc, 0x1E, BIT_13); + SetPCIePhyBit(sc, 0x03, BIT_0); + SetPCIePhyBit(sc, 0x19, BIT_8); + SetPCIePhyBit(sc, 0x19, BIT_2); + SetPCIePhyBit(sc, 0x0A, BIT_5); + SetPCIePhyBit(sc, 0x1E, BIT_15); + SetPCIePhyBit(sc, 0x05, BIT_13); + } + } else if (macver == 0x44000000) { + + CSR_WRITE_2(sc, 0xE0, CSR_READ_2(sc, 0xE0) & ~0xDF9C); + + re_eri_write(sc, 0xC8, 4, 0x00000002, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00000006, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= BIT_11 | BIT_10; + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + /* set EPHY registers */ + MP_WriteEPhyUshort(sc, 0x19, 0xFF64); + + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + } else if (macver == 0x48000000) { + /*set configuration space offset 0x70f to 0x27*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + CSR_WRITE_1(sc, RE_TDFNR, 0x8); + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= (BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12); + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + re_eri_write(sc, 0xC0, 2, 0x0000, ERIAR_ExGMAC); + re_eri_write(sc, 0xB8, 4, 0x00000000, ERIAR_ExGMAC); + re_eri_write(sc, 0xC8, 4, 0x00100002, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0xdc, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 |= BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + Data32 |= BIT_4; + re_eri_write(sc, 0x1B0, 4, Data32, ERIAR_ExGMAC); + re_eri_write(sc, 0xCC, 4, 0x00000050, ERIAR_ExGMAC); + re_eri_write(sc, 0xD0, 4, 0x00000060, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data32 |= BIT_4; + re_eri_write(sc, 0x1D0, 4, Data32, ERIAR_ExGMAC); + + CSR_WRITE_4(sc, RE_TXCFG, CSR_READ_4(sc, RE_TXCFG) | BIT_7); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0x1B, CSR_READ_1(sc, 0x1B) & ~0x07); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + if (sc->re_type == MACFG_50) { + data16 = MP_ReadEPhyUshort(sc, 0x06); + data16 &= ~(BIT_7 | BIT_6); + data16 |= BIT_5; + MP_WriteEPhyUshort(sc, 0x06, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x08); + data16 &= ~BIT_0; + data16 |= BIT_1; + MP_WriteEPhyUshort(sc, 0x08, data16); + } + + data16 = MP_ReadEPhyUshort(sc, 0x09); + data16 |= BIT_7; + MP_WriteEPhyUshort(sc, 0x09, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x19); + data16 |= (BIT_2 | BIT_5 | BIT_9); + MP_WriteEPhyUshort(sc, 0x19, data16); + + SetPCIePhyBit(sc, 0x00, BIT_3); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13|BIT_12|BIT_11|BIT_10|BIT_8|BIT_7|BIT_6|BIT_5|BIT_4), + BIT_9 + ); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_6); + + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + + if (ifp->if_mtu > ETHERMTU) { + ifp->if_capenable &= ~IFCAP_HWCSUM; + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + } + } + } else if (macver == 0x48800000) { + /*set configuration space offset 0x70f to 0x27*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + CSR_WRITE_1(sc, RE_TDFNR, 0x8); + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= BIT_11 | BIT_10; + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + re_eri_write(sc, 0xC0, 2, 0x0000, ERIAR_ExGMAC); + re_eri_write(sc, 0xB8, 4, 0x00000000, ERIAR_ExGMAC); + re_eri_write(sc, 0xC8, 4, 0x00100002, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0xdc, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 |= BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + Data32 |= BIT_4; + re_eri_write(sc, 0x1B0, 4, Data32, ERIAR_ExGMAC); + re_eri_write(sc, 0xCC, 4, 0x00000050, ERIAR_ExGMAC); + re_eri_write(sc, 0xD0, 4, 0x00000060, ERIAR_ExGMAC); + Data32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data32 |= BIT_4; + re_eri_write(sc, 0x1D0, 4, Data32, ERIAR_ExGMAC); + + CSR_WRITE_4(sc, RE_TXCFG, CSR_READ_4(sc, RE_TXCFG) | BIT_7); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + //CSR_WRITE_1(sc, 0x1B, CSR_READ_1(sc, 0x1B) & ~0x07); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + data16 = MP_ReadEPhyUshort(sc, 0x06); + data16 &= ~(BIT_7 | BIT_6); + data16 |= BIT_5; + MP_WriteEPhyUshort(sc, 0x06, data16); + + MP_WriteEPhyUshort(sc, 0x0f, 0x5200); + + data16 = MP_ReadEPhyUshort(sc, 0x1e); + data16 |= BIT_14; + MP_WriteEPhyUshort(sc, 0x1e, data16); + + data16 = MP_ReadEPhyUshort(sc, 0x19); + data16 |= (BIT_2 | BIT_5 | BIT_9); + MP_WriteEPhyUshort(sc, 0x19, data16); + + SetPCIePhyBit(sc, 0x00, BIT_3); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13|BIT_12|BIT_11|BIT_10|BIT_8|BIT_7|BIT_6|BIT_5|BIT_4), + BIT_9 + ); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_6); + + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + + if (ifp->if_mtu > ETHERMTU) { + ifp->if_capenable &= ~IFCAP_HWCSUM; + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + } + } + } else if (macver == 0x44800000) { + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | 0x80); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) | 0x28); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) | 0x0C); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | 0x40); + CSR_WRITE_2(sc, 0xE0, CSR_READ_2(sc, 0xE0) & ~0xDF9C); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + } else if (macver == 0x4C000000 || macver == 0x50800000 || + macver == 0x5C800000 || macver == 0x54000000) { + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | BIT_5); + + if (sc->re_type == MACFG_59) { + MP_WriteMcuAccessRegWord(sc, 0xD3C0, 0x0B00); + MP_WriteMcuAccessRegWord(sc, 0xD3C2, 0x0000); + } + + if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_74) { + MP_WriteMcuAccessRegWord(sc, 0xD400, MP_ReadMcuAccessRegWord(sc, 0xD400) & ~(BIT_0)); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE63E); + data16 &= ~(BIT_3 | BIT_2 | BIT_1); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + data16 |= (BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + data16 &= ~(BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + MP_WriteMcuAccessRegWord(sc, 0xC094, 0x0); + MP_WriteMcuAccessRegWord(sc, 0xC09E, 0x0); + + MP_WriteMcuAccessRegWord(sc, 0xE098, 0x0AA2); + } + + /*set configuration space offset 0x70f to 0x17*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + CSR_WRITE_1(sc, RE_TDFNR, 0x4); + + if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57) { + Data32 = MP_ReadPciEConfigSpace(sc, 0x2710); + Data32 &=0xFFFF0FFF; + Data32 |= (0x04 << 12); + MP_WritePciEConfigSpace(sc, 0x2710, Data32); + } + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12); + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + + if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_74) { + Data32 = re_eri_read(sc, 0xDC, 4, ERIAR_ExGMAC); + Data32 |= (BIT_2| BIT_3 | BIT_4); + re_eri_write(sc, 0xDC, 4, Data32, ERIAR_ExGMAC); + } + + re_eri_write(sc, 0xC8, 4, 0x00080002, ERIAR_ExGMAC); + re_eri_write(sc, 0xCC, 1, 0x38, ERIAR_ExGMAC); + re_eri_write(sc, 0xD0, 1, 0x48, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); + + if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_74) { + MP_WriteMcuAccessRegWord(sc, 0xE054, 0x0000); + + Data32 = re_eri_read(sc, 0x5F0, 4, ERIAR_ExGMAC); + Data32 &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_3 | BIT_2 | BIT_1 | BIT_0); + re_eri_write(sc, 0x5F0, 4, Data32, ERIAR_ExGMAC); + } else { + re_eri_write(sc, 0x5F0, 2, 0x4F87, ERIAR_ExGMAC); + } + + Data32 = re_eri_read(sc, 0xdc, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 |= BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + + if (sc->re_type == MACFG_74) + SetMcuAccessRegBit(sc, 0xD438, (BIT_1 | BIT_0)); + + Data32 = re_eri_read(sc, 0x2FC, 4, ERIAR_ExGMAC); + Data32 &= ~(BIT_0 | BIT_1 | BIT_2); + Data32 |= (BIT_0); + re_eri_write(sc, 0x2FC, 4, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_12; + re_eri_write(sc, 0x1B0, 4, Data32, ERIAR_ExGMAC); + + CSR_WRITE_4(sc, RE_TXCFG, CSR_READ_4(sc, RE_TXCFG) | BIT_7); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0x1B, CSR_READ_1(sc, 0x1B) & ~0x07); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57) { + ClearPCIePhyBit(sc, 0x00, BIT_3); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13|BIT_12|BIT_10|BIT_9|BIT_8|BIT_7|BIT_6|BIT_4), + (BIT_11|BIT_5) + ); + SetPCIePhyBit(sc, 0x1E, BIT_0); + ClearPCIePhyBit(sc, 0x19, BIT_15); + } else if (sc->re_type == MACFG_58) { + SetPCIePhyBit(sc, 0x00, (BIT_3)); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4), + BIT_9 + ); + } else if (sc->re_type == MACFG_59) { + ClearPCIePhyBit(sc, 0x00, BIT_3); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13 | BIT_12 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_4), + (BIT_5 | BIT_11) + ); + + SetPCIePhyBit(sc, 0x1E, BIT_0); + ClearPCIePhyBit(sc, 0x19, BIT_15); + MP_WriteEPhyUshort(sc, 0x19, 0x7C00); + MP_WriteEPhyUshort(sc, 0x1E, 0x20EB); + MP_WriteEPhyUshort(sc, 0x0D, 0x1666); + MP_WriteEPhyUshort(sc, 0x00, 0x10A3); + + MP_WriteEPhyUshort(sc, 0x06, 0xF050); + + SetPCIePhyBit(sc, 0x04, BIT_4); + ClearPCIePhyBit(sc, 0x1D, BIT_14); + } else if (sc->re_type == MACFG_60) { + ClearPCIePhyBit(sc, 0x00, BIT_3); + ClearAndSetPCIePhyBit(sc, + 0x0C, + (BIT_13 | BIT_12 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_4), + (BIT_5 | BIT_11) + ); + SetPCIePhyBit(sc, 0x1E, BIT_0); + ClearPCIePhyBit(sc, 0x19, BIT_15); + + ClearPCIePhyBit(sc, 0x19, (BIT_5 | BIT_0)); + + SetPCIePhyBit(sc, 0x1E, BIT_13); + ClearPCIePhyBit(sc, 0x0D, BIT_8); + SetPCIePhyBit(sc, 0x0D, BIT_9); + SetPCIePhyBit(sc, 0x00, BIT_7); + + SetPCIePhyBit(sc, 0x06, BIT_4); + + SetPCIePhyBit(sc, 0x04, BIT_4); + SetPCIePhyBit(sc, 0x1D, BIT_14); + } else if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69) { + ClearPCIePhyBit(sc, 0x1E, BIT_11); + + SetPCIePhyBit(sc, 0x1E, BIT_0); + SetPCIePhyBit(sc, 0x1D, BIT_11); + + MP_WriteEPhyUshort(sc, 0x05, 0x2089); + MP_WriteEPhyUshort(sc, 0x06, 0x5881); + + MP_WriteEPhyUshort(sc, 0x04, 0x854A); + MP_WriteEPhyUshort(sc, 0x01, 0x068B); + } else if (sc->re_type == MACFG_74) { + ClearMcuAccessRegBit(sc, 0xDE28, (BIT_1 | BIT_0)); + + SetMcuAccessRegBit(sc, 0xDE38, (BIT_2)); + } + + if (sc->re_type == MACFG_60) { + data16 = MP_ReadMcuAccessRegWord(sc, 0xD3C0); + data16 &= 0xF000; + data16 |= 0x0FFF; + MP_WriteMcuAccessRegWord(sc, 0xD3C0, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD3C2); + data16 &= 0xFF00; + MP_WriteMcuAccessRegWord(sc, 0xD3C2, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD3C4); + data16 |= (BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xD3C4, data16); + } else if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69) { + if (sc->RequireAdjustUpsTxLinkPulseTiming) { + data16 = MP_ReadMcuAccessRegWord(sc, 0xD412); + data16 &= ~(0x0FFF); + data16 |= sc->SwrCnt1msIni; + MP_WriteMcuAccessRegWord(sc, 0xD412, data16); + } + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE056); + data16 &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4); + MP_WriteMcuAccessRegWord(sc, 0xE056, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE052); + data16 &= ~(BIT_15 | BIT_14 | BIT_13 | BIT_3); + data16 |= BIT_15; + MP_WriteMcuAccessRegWord(sc, 0xE052, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD420); + data16 &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); + data16 |= 0x45F; + MP_WriteMcuAccessRegWord(sc, 0xD420, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE0D6); + data16 &= ~(BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); + data16 |= 0x17F; + MP_WriteMcuAccessRegWord(sc, 0xE0D6, data16); + } + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_6); + + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~BIT_3); + + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + + if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57 || + sc->re_type == MACFG_58 || sc->re_type == MACFG_59) { + MP_WriteMcuAccessRegWord(sc, 0xC140, 0xFFFF); + } else if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_74) { + MP_WriteMcuAccessRegWord(sc, 0xC140, 0xFFFF); + MP_WriteMcuAccessRegWord(sc, 0xC142, 0xFFFF); + } + + if (ifp->if_mtu > ETHERMTU) { + ifp->if_capenable &= ~IFCAP_HWCSUM; + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + } + } + } else if (macver == 0x50000000) { + /*set configuration space offset 0x70f to 0x17*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12; + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + + re_eri_write(sc, 0xC8, 4, 0x00080002, ERIAR_ExGMAC); + re_eri_write(sc, 0xCC, 1, 0x2F, ERIAR_ExGMAC); + re_eri_write(sc, 0xD0, 1, 0x5F, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); + + if (sc->re_type == MACFG_62 || sc->re_type == MACFG_67) { + OOB_mutex_lock(sc); + re_eri_write(sc, 0x5F0, 4, 0x4F87, ERIAR_ExGMAC); + OOB_mutex_unlock(sc); + } + + Data32 = re_eri_read(sc, 0xdc, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 |= BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0x2FC, 4, ERIAR_ExGMAC); + Data32 &= ~(BIT_0 | BIT_1 | BIT_2); + Data32 |= (BIT_0 | BIT_1); + re_eri_write(sc, 0x2FC, 4, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_12; + re_eri_write(sc, 0x1B0, 4, Data32, ERIAR_ExGMAC); + + CSR_WRITE_4(sc, RE_TXCFG, CSR_READ_4(sc, RE_TXCFG) | BIT_7); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0x1B, CSR_READ_1(sc, 0x1B) & ~0x07); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + if (sc->re_type == MACFG_61) { + MP_WriteEPhyUshort(sc, 0x00, 0x10AB); + MP_WriteEPhyUshort(sc, 0x06, 0xF030); + MP_WriteEPhyUshort(sc, 0x08, 0x2006); + MP_WriteEPhyUshort(sc, 0x0D, 0x1666); + ClearPCIePhyBit(sc, 0x0C, (BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4)); + } else if (sc->re_type == MACFG_62) { + MP_WriteEPhyUshort(sc, 0x00, 0x10A3); + MP_WriteEPhyUshort(sc, 0x19, 0xFC00); + MP_WriteEPhyUshort(sc, 0x1E, 0x20EA); + } else if (sc->re_type == MACFG_67) { + MP_WriteEPhyUshort(sc, 0x00, 0x10AB); + MP_WriteEPhyUshort(sc, 0x19, 0xFC00); + MP_WriteEPhyUshort(sc, 0x1E, 0x20EB); + MP_WriteEPhyUshort(sc, 0x0D, 0x1666); + ClearPCIePhyBit(sc, 0x0B, BIT_0); + SetPCIePhyBit(sc, 0x1D, BIT_14); + ClearAndSetPCIePhyBit(sc, + 0x0C, + BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_8 | BIT_7 | BIT_6 | BIT_5, + BIT_9 | BIT_4 + ); + } + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_6); + + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~BIT_3); + + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + + if (sc->re_type == MACFG_67) { + data16 = MP_ReadMcuAccessRegWord(sc, 0xD3E2); + data16 &= 0xF000; + data16 |= 0xAFD; + MP_WriteMcuAccessRegWord(sc, 0xD3E2, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD3E4); + data16 &= 0xFF00; + MP_WriteMcuAccessRegWord(sc, 0xD3E4, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE860); + data16 |= BIT_7; + MP_WriteMcuAccessRegWord(sc, 0xE860, data16); + } + + MP_WriteMcuAccessRegWord(sc, 0xC140, 0xFFFF); + MP_WriteMcuAccessRegWord(sc, 0xC142, 0xFFFF); + + if (ifp->if_mtu > ETHERMTU) { + ifp->if_capenable &= ~IFCAP_HWCSUM; + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + } + } + } else if (macver == 0x54800000) { + MP_WriteMcuAccessRegWord(sc, 0xE098, 0xC302); + + MP_WriteMcuAccessRegWord(sc, 0xD400, MP_ReadMcuAccessRegWord(sc, 0xD400) & ~(BIT_0)); + + if (sc->RequireAdjustUpsTxLinkPulseTiming) { + data16 = MP_ReadMcuAccessRegWord(sc, 0xD412); + data16 &= ~(0x0FFF); + data16 |= sc->SwrCnt1msIni; + MP_WriteMcuAccessRegWord(sc, 0xD412, data16); + } + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE056); + data16 &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4); + if (sc->HwPkgDet == 0x0F) + data16 |= (BIT_6 | BIT_5 | BIT_4); + MP_WriteMcuAccessRegWord(sc, 0xE056, data16); + if (FALSE == HW_SUPP_SERDES_PHY(sc)) + MP_WriteMcuAccessRegWord(sc, 0xEA80, 0x0003); + else + MP_WriteMcuAccessRegWord(sc, 0xEA80, 0x0000); + + OOB_mutex_lock(sc); + data16 = MP_ReadMcuAccessRegWord(sc, 0xE052); + data16 &= ~(BIT_3 | BIT_0); + if (sc->HwPkgDet == 0x0F) + data16 |= BIT_0; + MP_WriteMcuAccessRegWord(sc, 0xE052, data16); + OOB_mutex_unlock(sc); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD420); + data16 &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); + data16 |= 0x45F; + MP_WriteMcuAccessRegWord(sc, 0xD420, data16); + + CSR_WRITE_1(sc, RE_TDFNR, 0x4); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE63E); + data16 &= ~(BIT_3 | BIT_2 | BIT_1); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + data16 |= (BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + data16 &= ~(BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + MP_WriteMcuAccessRegWord(sc, 0xC094, 0x0); + MP_WriteMcuAccessRegWord(sc, 0xC09E, 0x0); + + /*set configuration space offset 0x70f to 0x27*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + Data32 = re_eri_read(sc, 0xD4, 4, ERIAR_ExGMAC); + Data32 |= BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12; + if (sc->re_type == MACFG_71 || sc->re_type == MACFG_72 || + sc->re_type == MACFG_73) + Data32 |= BIT_4; + re_eri_write(sc, 0xD4, 4, Data32, ERIAR_ExGMAC); + + re_eri_write(sc, 0xC8, 4, 0x00080002, ERIAR_ExGMAC); + re_eri_write(sc, 0xCC, 1, 0x2F, ERIAR_ExGMAC); + re_eri_write(sc, 0xD0, 1, 0x5F, ERIAR_ExGMAC); + re_eri_write(sc, 0xE8, 4, 0x00100006, ERIAR_ExGMAC); + + OOB_mutex_lock(sc); + if (sc->HwPkgDet == 0x0F) + re_eri_write(sc, 0x5F0, 2, 0x4F00, ERIAR_ExGMAC); + else + re_eri_write(sc, 0x5F0, 2, 0x4000, ERIAR_ExGMAC); + OOB_mutex_unlock(sc); + + Data32 = re_eri_read(sc, 0xdc, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + Data32 |= BIT_0; + re_eri_write(sc, 0xdc, 1, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0x2FC, 4, ERIAR_ExGMAC); + Data32 &= ~(BIT_0 | BIT_1); + Data32 |= (BIT_0); + re_eri_write(sc, 0x2FC, 4, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + Data32 &= ~BIT_12; + re_eri_write(sc, 0x1B0, 4, Data32, ERIAR_ExGMAC); + + Data32 = re_eri_read(sc, 0x1D0, 1, ERIAR_ExGMAC); + Data32 &= ~BIT_1; + re_eri_write(sc, 0x1D0, 1, Data32, ERIAR_ExGMAC); + + re_eri_write(sc, 0xC0, 2, 0x0000, ERIAR_ExGMAC); + re_eri_write(sc, 0xB8, 4, 0x00000000, ERIAR_ExGMAC); + + CSR_WRITE_4(sc, RE_TXCFG, CSR_READ_4(sc, RE_TXCFG) | BIT_7); + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) & ~BIT_7); + CSR_WRITE_1(sc, 0x1B, CSR_READ_1(sc, 0x1B) & ~0x07); + + CSR_WRITE_2 (sc, RE_CPlusCmd, 0x2060); + + ClearAndSetPCIePhyBit(sc, + 0x19, + BIT_6, + (BIT_12| BIT_8) + ); + ClearAndSetPCIePhyBit(sc, + 0x59, + BIT_6, + (BIT_12| BIT_8) + ); + ClearPCIePhyBit(sc, 0x0C, BIT_4); + ClearPCIePhyBit(sc, 0x4C, BIT_4); + ClearPCIePhyBit(sc, 0x0B, BIT_0); + + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_0); + + if (FALSE == HW_SUPP_SERDES_PHY(sc)) { + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) | BIT_6); + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_7); + } else { + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) & ~BIT_6); + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~BIT_6); + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) & ~BIT_7); + } + + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~BIT_3); + + if (ifp->if_mtu > ETHERMTU) + CSR_WRITE_1 (sc, RE_MTPS, 0x27); + + MP_WriteMcuAccessRegWord(sc, 0xC140, 0xFFFF); + MP_WriteMcuAccessRegWord(sc, 0xC142, 0xFFFF); + + if (ifp->if_mtu > ETHERMTU) { + ifp->if_capenable &= ~IFCAP_HWCSUM; + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + } else { + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + } + } + } + + //clear io_rdy_l23 + switch (sc->re_type) { + case MACFG_42: + case MACFG_43: + case MACFG_52: + case MACFG_53: + case MACFG_54: + case MACFG_55: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_1); + break; + } + + switch(sc->re_type) { + case MACFG_36: + case MACFG_37: + case MACFG_38: + case MACFG_39: + case MACFG_42: + case MACFG_43: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + case MACFG_54: + case MACFG_55: + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + CSR_WRITE_1(sc, RE_CFG5, CSR_READ_1(sc, RE_CFG5) | BIT_0); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | BIT_7); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) & ~BIT_7); + break; + } + + //clear wol + re_clrwol(sc); + + data16 = CSR_READ_2(sc, RE_CPlusCmd); + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) + data16 |= RL_CPLUSCMD_VLANSTRIP; + else + data16 &= ~RL_CPLUSCMD_VLANSTRIP; + + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + data16 |= RL_RxChkSum; + else + data16 &= ~RL_RxChkSum; + CSR_WRITE_2 (sc, RE_CPlusCmd, data16); + + re_disable_cfg9346_write(sc); + //CSR_WRITE_1(sc, 0xec, 0x3f); + + if (sc->re_device_id == RT_DEVICEID_8169 || sc->re_device_id == RT_DEVICEID_8169SC) { + /* Enable transmit and receive.*/ + CSR_WRITE_1(sc, RE_COMMAND, RE_CMD_TX_ENB | RE_CMD_RX_ENB); + + /* Set the initial TX configuration.*/ + CSR_WRITE_4(sc, RE_TXCFG, RE_TXCFG_CONFIG); + + /* Set the initial RX configuration.*/ + /* + * Program the multicast filter, if necessary. + */ + re_set_rx_packet_filter(sc); + } else { + /* Set the initial RX configuration.*/ + /* + * Program the multicast filter, if necessary. + */ + re_set_rx_packet_filter(sc); + + /* Enable transmit and receive.*/ + CSR_WRITE_1(sc, RE_COMMAND, RE_CMD_TX_ENB | RE_CMD_RX_ENB); + } + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + /* + * Enable interrupts. + */ + CSR_WRITE_2(sc, RE_IMR, RE_INTRS); +} + +static void re_init_unlock(void *xsc) /* Software & Hardware Initialize */ +{ + struct re_softc *sc = xsc; + struct ifnet *ifp; +#if OS_VER < VERSION(6,0) + int i; +#endif + union { + uint32_t align_dummy; + u_char eaddr[ETHER_ADDR_LEN]; + } eaddr; + + ifp = RE_GET_IFNET(sc); + + /* + * Cancel pending I/O and free all RX/TX buffers. + */ + re_stop(sc); + + /* Copy MAC address on stack to align. */ +#if OS_VER < VERSION(6,0) + bcopy((char *)&sc->arpcom.ac_enaddr, eaddr.eaddr, ETHER_ADDR_LEN); +#elif OS_VER < VERSION(7,0) + bcopy(IFP2ENADDR(ifp), eaddr.eaddr, ETHER_ADDR_LEN); +#else + bcopy(IF_LLADDR(ifp), eaddr.eaddr, ETHER_ADDR_LEN); +#endif + + /* Init our MAC address */ + re_rar_set(sc, eaddr.eaddr); + + sc->hw_start_unlock(sc); + + return; +} + +static void re_init(void *xsc) /* Software & Hardware Initialize */ +{ + struct re_softc *sc = xsc; + struct ifnet *ifp; + + ifp = RE_GET_IFNET(sc); + + if (re_link_ok(sc)) { + sc->link_state = LINK_STATE_UP; + re_link_state_change(ifp, sc->link_state); + re_link_on_patch(sc); + } + + sc->re_link_chg_det = 1; + re_start_timer(sc); +} + +static void re_hw_start_unlock_8125(struct re_softc *sc) +{ + struct ifnet *ifp; + u_int32_t macver; + u_int8_t data8; + u_int16_t data16 = 0; + u_int32_t Data32; + + ifp = RE_GET_IFNET(sc); + + /* Init descriptors. */ + re_var_init(sc); + + re_enable_cfg9346_write(sc); + + CSR_WRITE_1(sc, RE_CFG5, CSR_READ_1(sc, RE_CFG5) & ~BIT_0); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) & ~BIT_7); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) & ~BIT_7); + + //Interrupt Mitigation + CSR_WRITE_4(sc, 0x0A00, 0x00630063); + + CSR_WRITE_2(sc, RE_CPlusCmd, 0x2060); + + /* Set the initial TX configuration.*/ + CSR_WRITE_4(sc, RE_TXCFG, RE_TXCFG_CONFIG); + + macver = CSR_READ_4(sc, RE_TXCFG) & 0xFC800000; + if (macver == 0x60800000 || macver == 0x64000000) { + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | BIT_5); + + MP_WriteMcuAccessRegWord(sc, 0xE098, 0xC302); + + /*set configuration space offset 0x70f to 0x17*/ + Data32 = MP_ReadPciEConfigSpace(sc, 0x870c); + Data32 &=0xC0FFFFFF; + Data32 |= (0x27 << 24); + MP_WritePciEConfigSpace(sc, 0x870c, Data32); + + data8 = pci_read_config(sc->dev, 0x79, 1); + data8 &= ~0x70; + data8 |= 0x50; + pci_write_config(sc->dev, 0x79, data8, 1); + + CSR_WRITE_2(sc, 0x382, 0x221B); + + CSR_WRITE_1(sc, 0x4500, 0x00); + CSR_WRITE_2(sc, 0x4800, 0x0000); + + CSR_WRITE_1(sc, RE_CFG1, CSR_READ_1(sc, RE_CFG1) & ~0x10); + + CSR_WRITE_1(sc, 0xF2, CSR_READ_1(sc, 0xF2) & ~BIT_3); + + CSR_WRITE_1(sc, RE_TDFNR, 0x10); + + if (sc->re_type == MACFG_80) { + MP_WriteEPhyUshort(sc, 0x01, 0xA812); + MP_WriteEPhyUshort(sc, 0x09, 0x520C); + MP_WriteEPhyUshort(sc, 0x04, 0xD000); + MP_WriteEPhyUshort(sc, 0x0D, 0xF702); + MP_WriteEPhyUshort(sc, 0x0A, 0x8653); + MP_WriteEPhyUshort(sc, 0x06, 0x001E); + MP_WriteEPhyUshort(sc, 0x08, 0x3595); + MP_WriteEPhyUshort(sc, 0x20, 0x9455); + MP_WriteEPhyUshort(sc, 0x21, 0x99FF); + MP_WriteEPhyUshort(sc, 0x02, 0x6046); + MP_WriteEPhyUshort(sc, 0x29, 0xFE00); + MP_WriteEPhyUshort(sc, 0x23, 0xAB62); + ClearPCIePhyBit(sc, 0x24, BIT_11); + + MP_WriteEPhyUshort(sc, 0x41, 0xA80C); + MP_WriteEPhyUshort(sc, 0x49, 0x520C); + MP_WriteEPhyUshort(sc, 0x44, 0xD000); + MP_WriteEPhyUshort(sc, 0x4D, 0xF702); + MP_WriteEPhyUshort(sc, 0x4A, 0x8653); + MP_WriteEPhyUshort(sc, 0x46, 0x001E); + MP_WriteEPhyUshort(sc, 0x48, 0x3595); + MP_WriteEPhyUshort(sc, 0x60, 0x9455); + MP_WriteEPhyUshort(sc, 0x61, 0x99FF); + MP_WriteEPhyUshort(sc, 0x42, 0x6046); + MP_WriteEPhyUshort(sc, 0x69, 0xFE00); + MP_WriteEPhyUshort(sc, 0x63, 0xAB62); + ClearPCIePhyBit(sc, 0x64, BIT_11); + } else if (sc->re_type == MACFG_81) { + MP_WriteEPhyUshort(sc, 0x04, 0xD000); + MP_WriteEPhyUshort(sc, 0x0A, 0x8653); + MP_WriteEPhyUshort(sc, 0x23, 0xAB66); + MP_WriteEPhyUshort(sc, 0x20, 0x9455); + MP_WriteEPhyUshort(sc, 0x21, 0x99FF); + MP_WriteEPhyUshort(sc, 0x29, 0xFE04); + + MP_WriteEPhyUshort(sc, 0x44, 0xD000); + MP_WriteEPhyUshort(sc, 0x4A, 0x8653); + MP_WriteEPhyUshort(sc, 0x63, 0xAB66); + MP_WriteEPhyUshort(sc, 0x60, 0x9455); + MP_WriteEPhyUshort(sc, 0x61, 0x99FF); + MP_WriteEPhyUshort(sc, 0x69, 0xFE04); + + ClearAndSetPCIePhyBit(sc, + 0x2A, + (BIT_14 | BIT_13 | BIT_12), + (BIT_13 | BIT_12) + ); + ClearPCIePhyBit(sc, 0x19, BIT_6); + SetPCIePhyBit(sc, 0x1B, (BIT_11 | BIT_10 | BIT_9)); + ClearPCIePhyBit(sc, 0x1B, (BIT_14 | BIT_13 | BIT_12)); + MP_WriteEPhyUshort(sc, 0x02, 0x6042); + MP_WriteEPhyUshort(sc, 0x06, 0x0014); + + ClearAndSetPCIePhyBit(sc, + 0x6A, + (BIT_14 | BIT_13 | BIT_12), + (BIT_13 | BIT_12) + ); + ClearPCIePhyBit(sc, 0x59, BIT_6); + SetPCIePhyBit(sc, 0x5B, (BIT_11 | BIT_10 | BIT_9)); + ClearPCIePhyBit(sc, 0x5B, (BIT_14 | BIT_13 | BIT_12)); + MP_WriteEPhyUshort(sc, 0x42, 0x6042); + MP_WriteEPhyUshort(sc, 0x46, 0x0014); + } else if (sc->re_type == MACFG_82) { + MP_WriteEPhyUshort(sc, 0x06, 0x001F); + MP_WriteEPhyUshort(sc, 0x0A, 0xB66B); + MP_WriteEPhyUshort(sc, 0x01, 0xA852); + MP_WriteEPhyUshort(sc, 0x24, 0x0008); + MP_WriteEPhyUshort(sc, 0x2F, 0x6052); + MP_WriteEPhyUshort(sc, 0x0D, 0xF716); + MP_WriteEPhyUshort(sc, 0x20, 0xD477); + MP_WriteEPhyUshort(sc, 0x21, 0x4477); + MP_WriteEPhyUshort(sc, 0x22, 0x0013); + MP_WriteEPhyUshort(sc, 0x23, 0xBB66); + MP_WriteEPhyUshort(sc, 0x0B, 0xA909); + MP_WriteEPhyUshort(sc, 0x29, 0xFF04); + MP_WriteEPhyUshort(sc, 0x1B, 0x1EA0); + + MP_WriteEPhyUshort(sc, 0x46, 0x001F); + MP_WriteEPhyUshort(sc, 0x4A, 0xB66B); + MP_WriteEPhyUshort(sc, 0x41, 0xA84A); + MP_WriteEPhyUshort(sc, 0x64, 0x000C); + MP_WriteEPhyUshort(sc, 0x6F, 0x604A); + MP_WriteEPhyUshort(sc, 0x4D, 0xF716); + MP_WriteEPhyUshort(sc, 0x60, 0xD477); + MP_WriteEPhyUshort(sc, 0x61, 0x4477); + MP_WriteEPhyUshort(sc, 0x62, 0x0013); + MP_WriteEPhyUshort(sc, 0x63, 0xBB66); + MP_WriteEPhyUshort(sc, 0x4B, 0xA909); + MP_WriteEPhyUshort(sc, 0x69, 0xFF04); + MP_WriteEPhyUshort(sc, 0x5B, 0x1EA0); + } else if (sc->re_type == MACFG_83) { + MP_WriteEPhyUshort(sc, 0x0B, 0xA908); + MP_WriteEPhyUshort(sc, 0x1E, 0x20EB); + MP_WriteEPhyUshort(sc, 0x22, 0x0023); + MP_WriteEPhyUshort(sc, 0x02, 0x60C2); + MP_WriteEPhyUshort(sc, 0x29, 0xFF00); + + MP_WriteEPhyUshort(sc, 0x4B, 0xA908); + MP_WriteEPhyUshort(sc, 0x5E, 0x28EB); + MP_WriteEPhyUshort(sc, 0x62, 0x0023); + MP_WriteEPhyUshort(sc, 0x42, 0x60C2); + MP_WriteEPhyUshort(sc, 0x69, 0xFF00); + } + + MP_WriteMcuAccessRegWord(sc, 0xC140, 0xFFFF); + MP_WriteMcuAccessRegWord(sc, 0xC142, 0xFFFF); + + //old tx desc format + data16 = MP_ReadMcuAccessRegWord(sc, 0xEB58); + data16 &= ~(BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xEB58, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE614); + data16 &= ~( BIT_10 | BIT_9 | BIT_8); + if (sc->re_type == MACFG_82 || sc->re_type == MACFG_83) + data16 |= (2 << 8); + else + data16 |= (3 << 8); + MP_WriteMcuAccessRegWord(sc, 0xE614, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE63E); + data16 &= ~(BIT_11 | BIT_10); + data16 |= ((0 & 0x03) << 10); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE63E); + data16 &= ~(BIT_5 | BIT_4); + if (sc->re_type == MACFG_80 || sc->re_type == MACFG_81) + data16 |= ((0x02 & 0x03) << 4); + MP_WriteMcuAccessRegWord(sc, 0xE63E, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xC0B4); + data16 |= (BIT_3|BIT_2); + MP_WriteMcuAccessRegWord(sc, 0xC0B4, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xEB6A); + data16 &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); + data16 |= (BIT_5 | BIT_4 | BIT_1 | BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xEB6A, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xEB50); + data16 &= ~(BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5); + data16 |= (BIT_6); + MP_WriteMcuAccessRegWord(sc, 0xEB50, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE056); + data16 &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4); + //data16 |= (BIT_4 | BIT_5); + MP_WriteMcuAccessRegWord(sc, 0xE056, data16); + + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | BIT_7); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xE040); + data16 &= ~(BIT_12); + MP_WriteMcuAccessRegWord(sc, 0xE040, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xEA1C); + data16 &= ~(BIT_1 | BIT_0); + data16 |= (BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xEA1C, data16); + + MP_WriteMcuAccessRegWord(sc, 0xE0C0, 0x4000); + + SetMcuAccessRegBit(sc, 0xE052, (BIT_6 | BIT_5)); + ClearMcuAccessRegBit(sc, 0xE052, BIT_3 | BIT_7); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xC0AC); + data16 |= (BIT_7|BIT_8|BIT_9|BIT_10|BIT_11|BIT_12); + if (macver == 0x60800000) + data16 &= ~(BIT_7); + MP_WriteMcuAccessRegWord(sc, 0xC0AC, data16); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xD430); + data16 &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); + data16 |= 0x45F; + MP_WriteMcuAccessRegWord(sc, 0xD430, data16); + + //MP_WriteMcuAccessRegWord(sc, 0xE0C0, 0x4F87); + CSR_WRITE_1(sc, 0xD0, CSR_READ_1(sc, 0xD0) | (BIT_6 | BIT_7)); + + if (sc->re_type == MACFG_80 || sc->re_type == MACFG_81) + CSR_WRITE_1(sc, 0xD3, CSR_READ_1(sc, 0xD3) | BIT_0); + + MP_WriteMcuAccessRegWord(sc, 0xE080, MP_ReadMcuAccessRegWord(sc, 0xE080)&~BIT_1); + + data16 = MP_ReadMcuAccessRegWord(sc, 0xEA1C); + data16 &= ~(BIT_2); + MP_WriteMcuAccessRegWord(sc, 0xEA1C, data16); + + SetMcuAccessRegBit(sc, 0xEB54, BIT_0); + DELAY(1); + ClearMcuAccessRegBit(sc, 0xEB54, BIT_0); + CSR_WRITE_2(sc, 0x1880, CSR_READ_2(sc, 0x1880) & ~(BIT_4 | BIT_5)); + + if (sc->re_tx_cstag) { + ifp->if_capenable |= IFCAP_TXCSUM; + ifp->if_hwassist |= RE_CSUM_FEATURES; + } + if (sc->re_rx_cstag) { + ifp->if_capenable |= IFCAP_RXCSUM; + } + } + + //clear io_rdy_l23 + CSR_WRITE_1(sc, RE_CFG3, CSR_READ_1(sc, RE_CFG3) & ~BIT_1); + + CSR_WRITE_1(sc, RE_CFG5, CSR_READ_1(sc, RE_CFG5) | BIT_0); + CSR_WRITE_1(sc, RE_CFG2, CSR_READ_1(sc, RE_CFG2) | BIT_7); + CSR_WRITE_1(sc, 0xF1, CSR_READ_1(sc, 0xF1) & ~BIT_7); + + //clear wol + re_clrwol(sc); + + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) + CSR_WRITE_4(sc, RE_RXCFG, CSR_READ_4(sc, RE_RXCFG) | (BIT_22 | BIT_23)); + else + CSR_WRITE_4(sc, RE_RXCFG, CSR_READ_4(sc, RE_RXCFG) & ~(BIT_22 | BIT_23)); + + data16 = CSR_READ_2(sc, RE_CPlusCmd); + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + data16 |= RL_RxChkSum; + else + data16 &= ~RL_RxChkSum; + CSR_WRITE_2 (sc, RE_CPlusCmd, data16); + + re_disable_cfg9346_write(sc); + + /* Set the initial RX configuration.*/ + /* + * Program the multicast filter, if necessary. + */ + re_set_rx_packet_filter(sc); + + /* Enable transmit and receive.*/ + CSR_WRITE_1(sc, RE_COMMAND, RE_CMD_TX_ENB | RE_CMD_RX_ENB); + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + /* + * Enable interrupts. + */ + CSR_WRITE_4(sc, RE_IMR0_8125, RE_INTRS); +} + +/* + * Initialize the transmit descriptors. + */ +static int re_var_init(struct re_softc *sc) +{ + int i; + union RxDesc *rxptr; + union TxDesc *txptr; + + sc->re_desc.rx_cur_index = 0; + sc->re_desc.rx_last_index = 0; + rxptr = sc->re_desc.rx_desc; + for (i = 0; i < RE_RX_BUF_NUM; i++) { + memset(&rxptr[i], 0, sizeof(union RxDesc)); + + /* Init the RX buffer pointer register. */ + bus_dmamap_load(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i], + sc->re_desc.rx_buf[i]->m_data, sc->re_rx_desc_buf_sz, + re_rx_dma_map_buf, + &rxptr[i], + 0); + bus_dmamap_sync(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[i], + BUS_DMASYNC_PREREAD); + + rxptr[i].ul[0] = htole32(sc->re_rx_desc_buf_sz); + if (i == (RE_RX_BUF_NUM - 1)) + rxptr[i].ul[0] |= htole32(RL_RDESC_CMD_EOR); + rxptr[i].ul[0] |= htole32(RL_RDESC_CMD_OWN); + } + + bus_dmamap_load(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc_dmamap, + sc->re_desc.rx_desc, + sizeof(union RxDesc)*RE_RX_BUF_NUM, + re_dma_map_rxdesc, + sc, + 0); + bus_dmamap_sync(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc_dmamap, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + + sc->re_desc.tx_cur_index = 0; + sc->re_desc.tx_last_index = 0; + txptr = sc->re_desc.tx_desc; + for (i = 0; i < RE_TX_BUF_NUM; i++) { + memset(&txptr[i], 0, sizeof(union TxDesc)); + if (i == (RE_TX_BUF_NUM - 1)) + txptr[i].ul[0] = htole32(RL_TDESC_CMD_EOR); + } + + bus_dmamap_load(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc_dmamap, + sc->re_desc.tx_desc, + sizeof(union RxDesc) * RE_TX_BUF_NUM, + re_dma_map_txdesc, + sc, + 0); + bus_dmamap_sync(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc_dmamap, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + + return 0; +} + +static void re_reset(struct re_softc *sc) +{ + register int i; + + CSR_WRITE_4(sc, RE_RXCFG, CSR_READ_4(sc, RE_RXCFG)& ~0x3F); + + switch (sc->re_type) { + case MACFG_3: + case MACFG_4: + case MACFG_5: + case MACFG_6: + DELAY(10000); + break; + case MACFG_11: + case MACFG_12: + case MACFG_13: + case MACFG_14: + case MACFG_15: + case MACFG_16: + case MACFG_17: + case MACFG_18: + case MACFG_19: + case MACFG_21: + case MACFG_22: + case MACFG_23: + case MACFG_24: + case MACFG_25: + case MACFG_26: + case MACFG_27: + case MACFG_28: + case MACFG_31: + case MACFG_32: + case MACFG_33: + case MACFG_36: + case MACFG_37: + case MACFG_41: + case MACFG_42: + case MACFG_43: + case MACFG_54: + case MACFG_55: + case MACFG_63: + case MACFG_64: + case MACFG_65: + case MACFG_66: + CSR_WRITE_1(sc, RE_COMMAND, 0x8C); + break; + case MACFG_38: + case MACFG_39: + case MACFG_50: + case MACFG_51: + case MACFG_52: + case MACFG_53: + CSR_WRITE_1(sc, RE_COMMAND, 0x8C); + while (!(CSR_READ_4(sc,RE_TXCFG) & BIT_11)) DELAY(100); + break; + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + DELAY(2000); + break; + default: + DELAY(10000); + break; + } + DELAY(200); + CSR_WRITE_1(sc, RE_COMMAND, RE_CMD_RESET); + + for (i = 0; i < RE_TIMEOUT; i++) { + DELAY(10); + if (!(CSR_READ_1(sc, RE_COMMAND) & RE_CMD_RESET)) + break; + } + + if (i == RE_TIMEOUT) + device_printf(sc->dev,"reset never completed!\n"); + + return; +} + +static u_int8_t re_link_ok(struct re_softc *sc) +{ + u_int8_t retval; + + retval = (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_LINK_STS) ? 1 : 0; + + return retval; +} + +static void +re_set_wol_linkspeed(struct re_softc *sc) +{ + u_int8_t wol_link_speed; + u_int16_t anar; + + if (HW_SUPP_SERDES_PHY(sc)) return; + +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(sc)) + return; +#endif //ENABLE_FIBER_SUPPORT + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + wol_link_speed = RE_WOL_LINK_SPEED_100M_FIRST; + if (!sc->re_dash) { + u_int16_t anlpar; + + anlpar = sc->phy_reg_anlpar; + + if ((anlpar & ANLPAR_10_FD) || (anlpar & ANLPAR_10)) { + wol_link_speed = RE_WOL_LINK_SPEED_10M_FIRST; + } else { + wol_link_speed = RE_WOL_LINK_SPEED_100M_FIRST; + } + } + + anar = MP_ReadPhyUshort(sc,MII_ANAR); + + if (wol_link_speed == RE_WOL_LINK_SPEED_10M_FIRST) + anar &= ~(ANAR_TX_FD | ANAR_TX); + if (sc->re_device_id==RT_DEVICEID_8125 || sc->re_device_id==RT_DEVICEID_8162) { + u_int16_t gbcr; + + ClearEthPhyOcpBit(sc, 0xA5D4, RTK_ADVERTISE_2500FULL); + gbcr = MP_ReadPhyUshort(sc,MII_100T2CR); + gbcr &= ~(GTCR_ADV_1000TFDX|GTCR_ADV_1000THDX); + MP_WritePhyUshort(sc, MII_100T2CR, gbcr); + MP_WritePhyUshort(sc, MII_ANAR, anar); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + } else if (sc->re_device_id==RT_DEVICEID_8169 || sc->re_device_id==RT_DEVICEID_8169SC || + sc->re_device_id==RT_DEVICEID_8168 || sc->re_device_id==RT_DEVICEID_8161) { + u_int16_t gbcr; + + gbcr = MP_ReadPhyUshort(sc,MII_100T2CR); + gbcr &= ~(GTCR_ADV_1000TFDX|GTCR_ADV_1000THDX); + MP_WritePhyUshort(sc, MII_100T2CR, gbcr); + MP_WritePhyUshort(sc, MII_ANAR, anar); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + } else if (sc->re_type == MACFG_36) { + MP_WritePhyUshort(sc, MII_ANAR, anar); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + } else { + MP_WritePhyUshort(sc, MII_ANAR, anar); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + } +} + +static void +re_setwol(struct re_softc *sc) +{ + struct ifnet *ifp; + int pmc; + uint16_t pmstat; + uint8_t v; + + RE_LOCK_ASSERT(sc); + + ifp = RE_GET_IFNET(sc); + + if ((ifp->if_capenable & IFCAP_WOL) == 0) { + re_phy_power_down(sc->dev); + return; + } + + if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) != 0) + return; + + /* Enable config register write. */ + re_enable_cfg9346_write(sc); + + /* Enable PME. */ + if (sc->re_device_id==RT_DEVICEID_8169 || sc->re_device_id==RT_DEVICEID_8169SC) { + v = CSR_READ_1(sc, RE_CFG1); + v &= ~RE_CFG1_PME; + if ((ifp->if_capenable & IFCAP_WOL) != 0) + v |= RE_CFG1_PME; + CSR_WRITE_1(sc, RE_CFG1, v); + } + + if (ifp->if_capenable & IFCAP_WOL_MAGIC) + re_enable_magic_packet(sc); + else + re_disable_magic_packet(sc); + + v = CSR_READ_1(sc, RE_CFG5); + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); + + if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) + v |= RL_CFG5_WOL_UCAST; + if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) + v |= RL_CFG5_WOL_MCAST | RL_CFG5_WOL_BCAST; + if ((ifp->if_capenable & IFCAP_WOL) != 0) + v |= RL_CFG5_WOL_LANWAKE; + CSR_WRITE_1(sc, RE_CFG5, v); + + /* Config register write done. */ + re_disable_cfg9346_write(sc); + + /* + * It seems that hardware resets its link speed to 100Mbps in + * power down mode so switching to 100Mbps in driver is not + * needed. + */ + + /* Request PME if WOL is requested. */ + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL) != 0) + pmstat |= PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + + /* Put controller into sleep mode. */ + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rx_packet_filter_in_sleep_state(sc); + re_set_wol_linkspeed(sc); + if (sc->re_type == MACFG_21 || sc->re_type == MACFG_22) + CSR_WRITE_1(sc, RE_COMMAND, RE_CMD_RX_ENB); + } +} + +static void +re_clrwol(struct re_softc *sc) +{ + int pmc; + uint16_t pmstat; + uint8_t v; + + RE_LOCK_ASSERT(sc); + + if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) != 0) + return; + + /* Disable PME and clear PME status. */ + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + + /* Enable config register write. */ + re_enable_cfg9346_write(sc); + + if (sc->re_device_id==RT_DEVICEID_8169 || sc->re_device_id==RT_DEVICEID_8169SC) { + v = CSR_READ_1(sc, RE_CFG1); + v &= ~RE_CFG1_PME; + CSR_WRITE_1(sc, RE_CFG1, v); + } + + v = CSR_READ_1(sc, RE_CFG3); + v &= ~(RL_CFG3_WOL_LINK); + CSR_WRITE_1(sc, RE_CFG3, v); + + re_disable_magic_packet(sc); + + v = CSR_READ_1(sc, RE_CFG5); + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); + v &= ~RL_CFG5_WOL_LANWAKE; + CSR_WRITE_1(sc, RE_CFG5, v); + + /* Config register write done. */ + re_disable_cfg9346_write(sc); +} + +/* + * Stop the adapter and free any mbufs allocated to the + * RX and TX lists. + */ +static void re_stop(struct re_softc *sc) /* Stop Driver */ +{ + struct ifnet *ifp; + + /* RE_LOCK_ASSERT(sc);*/ + + ifp = RE_GET_IFNET(sc); +#if OS_VER < VERSION(9,0) + ifp->if_timer = 0; +#endif + + re_stop_timer(sc); + + /* + * Disable accepting frames to put RX MAC into idle state. + * Otherwise it's possible to get frames while stop command + * execution is in progress and controller can DMA the frame + * to already freed RX buffer during that period. + */ + CSR_WRITE_4(sc, RE_RXCFG, CSR_READ_4(sc, RE_RXCFG) & + ~(RE_RXCFG_RX_ALLPHYS | RE_RXCFG_RX_INDIV | RE_RXCFG_RX_MULTI | + RE_RXCFG_RX_BROAD | RE_RXCFG_RX_RUNT | RE_RXCFG_RX_ERRPKT)); + + if (sc->re_device_id==RT_DEVICEID_8125) { + CSR_WRITE_4(sc, RE_IMR0_8125, 0x00000000); + CSR_WRITE_4(sc, RE_ISR0_8125, 0xffffffff); + } else { + CSR_WRITE_2(sc, RE_IMR, 0x0000); + CSR_WRITE_2(sc, RE_ISR, 0xffff); + } + if (sc->re_type == MACFG_50 || sc->re_type == MACFG_51 || sc->re_type == MACFG_52) { + re_eri_write(sc, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x0000002d, ERIAR_ExGMAC); + } else if (sc->re_type == MACFG_38) { + re_eri_write(sc, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x0000003f, ERIAR_ExGMAC); + } + + switch (sc->re_type) { + case MACFG_74: + SetMcuAccessRegBit(sc, 0xD438, BIT_3); + SetMcuAccessRegBit(sc, 0xDE38, BIT_2); + ClearMcuAccessRegBit(sc, 0xDE28, (BIT_1 | BIT_0)); + SetMcuAccessRegBit(sc, 0xD438, (BIT_1 | BIT_0)); + break; + } + + re_reset(sc); + + /* + * Free the TX list buffers. + */ + while (sc->re_desc.tx_last_index!=sc->re_desc.tx_cur_index) { + if (sc->re_desc.re_tx_mtag) { + bus_dmamap_sync(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[sc->re_desc.tx_last_index], + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[sc->re_desc.tx_last_index]); + } + + if (sc->re_desc.tx_buf[sc->re_desc.tx_last_index]!=NULL) { + m_freem(sc->re_desc.tx_buf[sc->re_desc.tx_last_index]); + sc->re_desc.tx_buf[sc->re_desc.tx_last_index] = NULL; + } + sc->re_desc.tx_last_index = (sc->re_desc.tx_last_index+1)%RE_TX_BUF_NUM; + } + + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + return; +} + +/* + * Main transmit routine. + */ +static void re_start(struct ifnet *ifp) /* Transmit Packet*/ +{ + struct re_softc *sc; + struct mbuf *m_head = NULL; + + sc = ifp->if_softc; /* Paste to ifp in function re_attach(dev) */ + + RE_LOCK(sc); + + /* RE_LOCK_ASSERT(sc);*/ + + if ((sc->driver_detach == 1) || (sc->rx_fifo_overflow != 0)) { + RE_UNLOCK(sc); + return; + } + + while (1) { + int fs = 1, ls = 0, TxLen = 0, PktLen; + struct mbuf *ptr; + uint32_t opts1 =0; + uint32_t opts2 =0; + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); /* Remove(get) data from system transmit queue */ + if (m_head == NULL) { + break; + } + + if (sc->re_device_id == RT_DEVICEID_8125) { + if (re_8125_pad(sc, m_head) != 0) { + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + } + + if (sc->re_coalesce_tx_pkt) { + if (re_encap(sc, m_head)) { + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + + m_head = sc->re_desc.tx_buf[sc->re_desc.tx_cur_index]; + } + + if (CountMbufNum(m_head) > CountFreeTxDescNum(sc->re_desc)) { /* No enough descriptor */ + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + + if (ifp->if_bpf) { /* If there's a BPF listener, bounce a copy of this frame to him. */ + //printf("If there's a BPF listener, bounce a copy of this frame to him. \n"); + + /*#if OS_VER < VERSION(5, 1)*/ +#if OS_VER < VERSION(4,9) + bpf_mtap(ifp, m_head); +#else + bpf_mtap(ifp->if_bpf, m_head); +#endif + } + + //hw checksum + if (ifp->if_capenable & IFCAP_TXCSUM) { + if ((m_head->m_pkthdr.csum_flags & RE_CSUM_FEATURES) !=0) { + if (!(sc->re_if_flags & RL_FLAG_DESCV2)) { + opts1 |= RL_IPV4CS1; + if ((m_head->m_pkthdr.csum_flags & CSUM_TCP)!=0) + opts1 |=RL_TCPCS1; + if ((m_head->m_pkthdr.csum_flags & CSUM_UDP)!=0) + opts1 |=RL_UDPCS1; + } else { + opts2 |= RL_IPV4CS; + if ((m_head->m_pkthdr.csum_flags & CSUM_TCP)!=0) + opts2 |= RL_TCPCS; + else if ((m_head->m_pkthdr.csum_flags & CSUM_UDP)!=0) + opts2 |= RL_UDPCS; + } + } + } + + //vlan + if (m_head->m_flags & M_VLANTAG) + opts2 |= bswap16(m_head->m_pkthdr.ether_vtag) | RL_TDESC_VLANCTL_TAG; + ptr = m_head; + PktLen = ptr->m_pkthdr.len; +#ifdef _DEBUG_ + printf("PktLen=%d",PktLen); +#endif + while (ptr!=NULL) { + if (ptr->m_len >0) { +#ifdef _DEBUG_ + printf(", len=%d T=%d F=%d",ptr->m_len,ptr->m_type,ptr->m_flags); +#endif + TxLen += ptr->m_len; + if (TxLen >= PktLen) { + ls=1; + sc->re_desc.tx_buf[sc->re_desc.tx_cur_index] = m_head; + } else + sc->re_desc.tx_buf[sc->re_desc.tx_cur_index] = NULL; + + //vlan + WritePacket(sc,ptr->m_data,ptr->m_len,fs,ls,opts2,opts1); + + fs=0; + } + ptr = ptr->m_next; + } +#ifdef _DEBUG_ + printf("\n"); +#endif + } +#if OS_VER < VERSION(9,0) + ifp->if_timer = 5; +#endif + + RE_UNLOCK(sc); + + return; +} + +/* + * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data + * pointers to the fragment pointers. + */ +static int re_encap(struct re_softc *sc,struct mbuf *m_head) +{ + struct mbuf *m_new = NULL; + + m_new = m_defrag(m_head, M_DONTWAIT); + + if (m_new == NULL) { + printf("re%d: no memory for tx list", sc->re_unit); + return (1); + } + m_head = m_new; + + /* Pad frames to at least 60 bytes. */ + if (m_head->m_pkthdr.len < RE_MIN_FRAMELEN) { /* Case length < 60 bytes */ + /* + * Make security concious people happy: zero out the + * bytes in the pad area, since we don't know what + * this mbuf cluster buffer's previous user might + * have left in it. + */ + bzero(mtod(m_head, char *) + m_head->m_pkthdr.len, + RE_MIN_FRAMELEN - m_head->m_pkthdr.len); + m_head->m_pkthdr.len = RE_MIN_FRAMELEN; + m_head->m_len = m_head->m_pkthdr.len; + } + + sc->re_desc.tx_buf[sc->re_desc.tx_cur_index] = m_head; + + return(0); +} + +#define MIN_IPV4_PATCH_PKT_LEN (121) +#define MIN_IPV6_PATCH_PKT_LEN (147) +static int re_8125_pad(struct re_softc *sc,struct mbuf *m_head) +{ + struct ether_header *eh = mtod(m_head, struct ether_header *); + uint32_t min_pkt_len; + uint16_t ether_type = ntohs(eh->ether_type); + + if ((m_head->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) != 0) + goto out; + + min_pkt_len = RE_MIN_FRAMELEN; + if (ether_type == ETHERTYPE_IP) { + struct ip *ip = (struct ip *)mtodo(m_head, ETHER_HDR_LEN); + if (ip->ip_p == IPPROTO_UDP) + min_pkt_len = MIN_IPV4_PATCH_PKT_LEN; + } else if (ether_type == ETHERTYPE_IPV6) { + struct ip6_hdr *ip6 = (struct ip6_hdr *)mtodo(m_head, ETHER_HDR_LEN); + if (ip6->ip6_nxt == IPPROTO_UDP) + min_pkt_len = MIN_IPV6_PATCH_PKT_LEN; + } + + if (m_head->m_pkthdr.len < min_pkt_len) { + static const uint8_t pad[MIN_IPV4_PATCH_PKT_LEN]; + uint16_t pad_len = min_pkt_len - m_head->m_pkthdr.len; + if (!m_append(m_head, pad_len, pad)) + return (1); + + if (ether_type == ETHERTYPE_IP && + m_head->m_pkthdr.csum_flags & CSUM_IP) { + struct ip *ip; + m_head->m_data += ETHER_HDR_LEN; + ip = mtod(m_head, struct ip *); + ip->ip_sum = in_cksum(m_head, ip->ip_hl << 2); + m_head->m_data -= ETHER_HDR_LEN; + m_head->m_pkthdr.csum_flags &= ~CSUM_IP; + } + } + +out: + return(0); +} + +static void WritePacket(struct re_softc *sc, caddr_t addr, int len,int fs_flag,int ls_flag, uint32_t opts2,uint32_t opts1) +{ + union TxDesc *txptr; + uint32_t status; + uint32_t tx_cur_index = sc->re_desc.tx_cur_index; + + txptr =&(sc->re_desc.tx_desc[tx_cur_index]); + + status = RL_TDESC_CMD_OWN | opts1 | len; + + if (fs_flag) + status |= RL_TDESC_CMD_SOF; + if (ls_flag) + status |= RL_TDESC_CMD_EOF; + if (tx_cur_index == (RE_TX_BUF_NUM - 1)) + status |= RL_TDESC_CMD_EOR; + + bus_dmamap_load(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[tx_cur_index], + addr, + len, + re_tx_dma_map_buf, txptr, + 0); + bus_dmamap_sync(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[tx_cur_index], + BUS_DMASYNC_PREWRITE); + txptr->ul[1] = htole32(opts2); + txptr->ul[0] = htole32(status); + + bus_dmamap_sync(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc_dmamap, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + + if (ls_flag) { + if (sc->re_device_id==RT_DEVICEID_8125) { + CSR_WRITE_2(sc, RE_TPPOLL_8125, RE_NPQ_8125); + CSR_WRITE_2(sc, RE_TPPOLL_8125, RE_NPQ_8125); + } else { + CSR_WRITE_1(sc, RE_TPPOLL, RE_NPQ); + CSR_WRITE_1(sc, RE_TPPOLL, RE_NPQ); + } + } + + sc->re_desc.tx_cur_index = (tx_cur_index+1)%RE_TX_BUF_NUM; +} + +static int CountFreeTxDescNum(struct re_descriptor desc) +{ + int ret=desc.tx_last_index-desc.tx_cur_index; + if (ret<=0) + ret+=RE_TX_BUF_NUM; + ret--; + return ret; +} + +static int CountMbufNum(struct mbuf *m_head) +{ + int ret=0; + struct mbuf *ptr = m_head; + + while (ptr!=NULL) { + if (ptr->m_len >0) + ret++; + ptr=ptr->m_next; + } + + return ret; +} + +#ifdef RE_FIXUP_RX +static __inline void re_fixup_rx(struct mbuf *m) +{ + int i; + uint16_t *src, *dst; + + src = mtod(m, uint16_t *); + dst = src - (RE_ETHER_ALIGN - ETHER_ALIGN) / sizeof *src; + + for (i = 0; i < (m->m_len / sizeof(uint16_t) + 1); i++) + *dst++ = *src++; + + m->m_data -= RE_ETHER_ALIGN - ETHER_ALIGN; +} +#endif + +/* + * A frame was downloaded to the chip. It's safe for us to clean up + * the list buffers. + */ +static void re_txeof(struct re_softc *sc) /* Transmit OK/ERR handler */ +{ + union TxDesc *txptr; + struct ifnet *ifp; + u_int32_t txstat; + + /* printf("X");*/ + + ifp = RE_GET_IFNET(sc); + +#if OS_VER < VERSION(9,0) + /* Clear the timeout timer. */ + ifp->if_timer = 0; +#endif + + bus_dmamap_sync(sc->re_desc.tx_desc_tag, + sc->re_desc.tx_desc_dmamap, + BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + + while (sc->re_desc.tx_last_index!=sc->re_desc.tx_cur_index) { + txptr=&(sc->re_desc.tx_desc[sc->re_desc.tx_last_index]); + txstat = le32toh(txptr->ul[0]); + if (txstat & RL_TDESC_STAT_OWN) + break; +#ifdef _DEBUG_ + printf("**** Tx OK ****\n"); +#endif + bus_dmamap_sync(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[sc->re_desc.tx_last_index], + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->re_desc.re_tx_mtag, + sc->re_desc.re_tx_dmamap[sc->re_desc.tx_last_index]); + + if (sc->re_desc.tx_buf[sc->re_desc.tx_last_index]!=NULL) { + m_freem(sc->re_desc.tx_buf[sc->re_desc.tx_last_index]); /* Free Current MBuf in a Mbuf list*/ + sc->re_desc.tx_buf[sc->re_desc.tx_last_index] = NULL; + } + + sc->re_desc.tx_last_index = (sc->re_desc.tx_last_index+1)%RE_TX_BUF_NUM; +#if OS_VER < VERSION(11,0) + if (txstat & (RL_TDESC_STAT_EXCESSCOL| + RL_TDESC_STAT_COLCNT)) + ifp->if_collisions++; + if (txstat & RL_TDESC_STAT_TXERRSUM) + ifp->if_oerrors++; + else + ifp->if_opackets++; +#else + if (txstat & (RL_TDESC_STAT_EXCESSCOL| + RL_TDESC_STAT_COLCNT)) + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); + if (txstat & RL_TDESC_STAT_TXERRSUM) + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + else + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); +#endif + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + } + + return; +} + +/* + * A frame has been uploaded: pass the resulting mbuf chain up to + * the higher level protocols. + * + * You know there's something wrong with a PCI bus-master chip design + * when you have to use m_devget(). + * + * The receive operation is badly documented in the datasheet, so I'll + * attempt to document it here. The driver provides a buffer area and + * places its base address in the RX buffer start address register. + * The chip then begins copying frames into the RX buffer. Each frame + * is preceeded by a 32-bit RX status word which specifies the length + * of the frame and certain other status bits. Each frame (starting with + * the status word) is also 32-bit aligned. The frame length is in the + * first 16 bits of the status word; the lower 15 bits correspond with + * the 'rx status register' mentioned in the datasheet. + * + * Note: to make the Alpha happy, the frame payload needs to be aligned + * on a 32-bit boundary. To achieve this, we cheat a bit by copying from + * the ring buffer starting at an address two bytes before the actual + * data location. We can then shave off the first two bytes using m_adj(). + * The reason we do this is because m_devget() doesn't let us specify an + * offset into the mbuf storage space, so we have to artificially create + * one. The ring is allocated in such a way that there are a few unused + * bytes of space preceecing it so that it will be safe for us to do the + * 2-byte backstep even if reading from the ring at offset 0. + */ +static void re_rxeof(sc) /* Receive Data OK/ERR handler */ +struct re_softc *sc; +{ + struct ether_header *eh; + struct mbuf *m; + struct ifnet *ifp; + union RxDesc *rxptr; + int bError; + struct mbuf *buf; + int size; + int maxpkt = RE_RX_BUF_NUM; + u_int32_t rx_cur_index; + u_int32_t opts2,opts1,status; + + /* RE_LOCK_ASSERT(sc);*/ + + ifp = RE_GET_IFNET(sc); + + bus_dmamap_sync(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc_dmamap, + BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); + + rx_cur_index = sc->re_desc.rx_cur_index; + rxptr=&(sc->re_desc.rx_desc[rx_cur_index]); + opts1 = le32toh(rxptr->ul[0]); + while ((opts1&RL_RDESC_STAT_OWN)==0) { /* Receive OK */ + bError = 0; + + sc->re_desc.rx_cur_index = (rx_cur_index+1)%RE_RX_BUF_NUM; + + /* Check if this packet is received correctly*/ + if (opts1&0x200000) { /*Check RES bit*/ + bError=1; +#if OS_VER < VERSION(11,0) + ifp->if_ierrors++; +#else + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); +#endif + goto update_desc; + } + opts2 = le32toh(rxptr->ul[1]); + + //buf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); /* Alloc a new mbuf */ + + if (sc->re_rx_mbuf_sz <= MCLBYTES) + size = MCLBYTES; + else if (sc->re_rx_mbuf_sz <= MJUMPAGESIZE) + size = MJUMPAGESIZE; + else + size = MJUM9BYTES; + + buf = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, size); + if (buf==NULL) { + bError=1; +#if OS_VER < VERSION(11,0) + ifp->if_iqdrops++; +#else + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); +#endif + goto update_desc; + } + + buf->m_len = buf->m_pkthdr.len = size; +#ifdef RE_FIXUP_RX + /* + * This is part of an evil trick to deal with non-x86 platforms. + * The RealTek chip requires RX buffers to be aligned on 64-bit + * boundaries, but that will hose non-x86 machines. To get around + * this, we leave some empty space at the start of each buffer + * and for non-x86 hosts, we copy the buffer back six bytes + * to achieve word alignment. This is slightly more efficient + * than allocating a new buffer, copying the contents, and + * discarding the old buffer. + */ + m_adj(buf, RE_ETHER_ALIGN); +#endif + + bus_dmamap_sync(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[rx_cur_index], + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[rx_cur_index]); + + m = sc->re_desc.rx_buf[rx_cur_index]; + sc->re_desc.rx_buf[rx_cur_index] = buf; + m->m_pkthdr.len = m->m_len = (opts1&RL_RDESC_STAT_GFRAGLEN)-ETHER_CRC_LEN; + m->m_pkthdr.rcvif = ifp; + +#ifdef RE_FIXUP_RX + re_fixup_rx(m); +#endif + + //vlan + if (opts2 & RL_RDESC_VLANCTL_TAG) { + m->m_pkthdr.ether_vtag = + bswap16((opts2 & RL_RDESC_VLANCTL_DATA)); + m->m_flags |= M_VLANTAG; + } + if (ifp->if_capenable & IFCAP_RXCSUM) { + if (!(sc->re_if_flags & RL_FLAG_DESCV2)) { + if (opts1 & RL_ProtoIP) + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if (!(opts1 & RL_IPF)) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + if ((((opts1 & RL_ProtoIP)==(1<<17)) && !(opts1 & RL_TCPF)) || (((opts1 & RL_ProtoIP)==(1<<18)) && !(opts1 & RL_UDPF))) { + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID|CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } else { + if ((opts1 & RL_ProtoIP) && (opts2 & RL_V4F)) + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if (!(opts1 & RL_IPF) && (opts2 & RL_V4F)) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + if (((opts1 & RL_TCPT) && !(opts2 & RL_TCPF)) || ((opts1 & RL_UDPT) && !(opts2 & RL_UDPF))) { + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID|CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } + } + + eh = mtod(m, struct ether_header *); +#if OS_VER < VERSION(11,0) + ifp->if_ipackets++; +#else + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); +#endif +#ifdef _DEBUG_ + printf("Rcv Packet, Len=%d \n", m->m_len); +#endif + + RE_UNLOCK(sc); + + /*#if OS_VER < VERSION(5, 1)*/ +#if OS_VER < VERSION(4,9) + /* Remove header from mbuf and pass it on. */ + m_adj(m, sizeof(struct ether_header)); + ether_input(ifp, eh, m); +#else + (*ifp->if_input)(ifp, m); +#endif + RE_LOCK(sc); + +update_desc: + //rxptr->ul[0]&=htole32(0x40000000); /* keep EOR bit */ + rxptr->ul[1]=0; + + status = RL_RDESC_CMD_OWN | sc->re_rx_desc_buf_sz; + if (rx_cur_index == (RE_RX_BUF_NUM - 1)) + status |= RL_RDESC_CMD_EOR; + if (!bError) { + bus_dmamap_load(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[rx_cur_index], + sc->re_desc.rx_buf[rx_cur_index]->m_data, + sc->re_rx_desc_buf_sz, + re_rx_dma_map_buf, rxptr, + 0); + bus_dmamap_sync(sc->re_desc.re_rx_mtag, + sc->re_desc.re_rx_dmamap[rx_cur_index], + BUS_DMASYNC_PREREAD); + } + rxptr->ul[0] = htole32(status); + rx_cur_index = sc->re_desc.rx_cur_index; + rxptr=&sc->re_desc.rx_desc[rx_cur_index]; + opts1 = le32toh(rxptr->ul[0]); + + maxpkt--; + if (maxpkt==0) + break; + } + + bus_dmamap_sync(sc->re_desc.rx_desc_tag, + sc->re_desc.rx_desc_dmamap, + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + + return; +} + +#if OS_VER < VERSION(7,0) +static void re_intr(void *arg) /* Interrupt Handler */ +#else +static int re_intr(void *arg) /* Interrupt Handler */ +#endif //OS_VER < VERSION(7,0) +{ + struct re_softc *sc; + + sc = arg; + + if ((sc->re_if_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0) { + if ((CSR_READ_2(sc, RE_ISR) & RE_INTRS) == 0) { +#if OS_VER < VERSION(7,0) + return; +#else + return (FILTER_STRAY); +#endif + } + } + + /* Disable interrupts. */ + CSR_WRITE_2(sc, RE_IMR, 0x0000); + +#if OS_VER < VERSION(7,0) + re_int_task(arg, 0); +#else //OS_VER < VERSION(7,0) +#if OS_VER < VERSION(11,0) + taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask); +#else ////OS_VER < VERSION(11,0) + taskqueue_enqueue(taskqueue_fast, &sc->re_inttask); +#endif //OS_VER < VERSION(11,0) + return (FILTER_HANDLED); +#endif //OS_VER < VERSION(7,0) +} + +#if OS_VER < VERSION(7,0) +static void re_intr_8125(void *arg) /* Interrupt Handler */ +#else +static int re_intr_8125(void *arg) /* Interrupt Handler */ +#endif //OS_VER < VERSION(7,0) +{ + struct re_softc *sc; + + sc = arg; + + if ((sc->re_if_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0) { + if ((CSR_READ_4(sc, RE_ISR0_8125) & RE_INTRS) == 0) { +#if OS_VER < VERSION(7,0) + return; +#else + return (FILTER_STRAY); +#endif + } + } + + /* Disable interrupts. */ + CSR_WRITE_4(sc, RE_IMR0_8125, 0x00000000); + +#if OS_VER < VERSION(7,0) + re_int_task_8125(arg, 0); +#else //OS_VER < VERSION(7,0) +#if OS_VER < VERSION(11,0) + taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask); +#else ////OS_VER < VERSION(11,0) + taskqueue_enqueue(taskqueue_fast, &sc->re_inttask); +#endif //OS_VER < VERSION(11,0) + return (FILTER_HANDLED); +#endif //OS_VER < VERSION(7,0) +} + +static void re_int_task(void *arg, int npending) +{ + struct re_softc *sc; + struct ifnet *ifp; + u_int32_t status; + + sc = arg; + + RE_LOCK(sc); + + ifp = RE_GET_IFNET(sc); + + status = CSR_READ_2(sc, RE_ISR); + + if (status) { + CSR_WRITE_2(sc, RE_ISR, status & ~RE_ISR_FIFO_OFLOW); + } + + if (sc->suspended || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + RE_UNLOCK(sc); + return; + } + + re_rxeof(sc); + + if (sc->re_type == MACFG_21) { + if (status & RE_ISR_FIFO_OFLOW) { + sc->rx_fifo_overflow = 1; + CSR_WRITE_2(sc, RE_IntrMitigate, 0x0000); + CSR_WRITE_4(sc, RE_TIMERCNT, 0x4000); + CSR_WRITE_4(sc, RE_TIMERINT, 0x4000); + } else { + sc->rx_fifo_overflow = 0; + CSR_WRITE_4(sc,RE_CPlusCmd, 0x51512082); + } + + if (status & RE_ISR_PCS_TIMEOUT) { + if ((status & RE_ISR_FIFO_OFLOW) && + (!(status & (RE_ISR_RX_OK | RE_ISR_TX_OK | RE_ISR_RX_OVERRUN)))) { + re_reset(sc); + re_init(sc); + sc->rx_fifo_overflow = 0; + CSR_WRITE_2(sc, RE_ISR, RE_ISR_FIFO_OFLOW); + } + } + } + + re_txeof(sc); + + if (status & RE_ISR_SYSTEM_ERR) { + re_reset(sc); + re_init(sc); + } + + switch(sc->re_type) { + case MACFG_21: + case MACFG_22: + case MACFG_23: + case MACFG_24: + CSR_WRITE_1(sc, RE_TPPOLL, RE_NPQ); + break; + + default: + break; + } + + RE_UNLOCK(sc); + + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + re_start(ifp); + +#if OS_VER>=VERSION(7,0) + if (CSR_READ_2(sc, RE_ISR) & RE_INTRS) { +#if OS_VER < VERSION(11,0) + taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask); +#else ////OS_VER < VERSION(11,0) + taskqueue_enqueue(taskqueue_fast, &sc->re_inttask); +#endif //OS_VER < VERSION(11,0) + return; + } +#endif //OS_VER>=VERSION(7,0) + + /* Re-enable interrupts. */ + CSR_WRITE_2(sc, RE_IMR, RE_INTRS); +} + +static void re_int_task_8125(void *arg, int npending) +{ + struct re_softc *sc; + struct ifnet *ifp; + u_int32_t status; + + sc = arg; + + RE_LOCK(sc); + + ifp = RE_GET_IFNET(sc); + + status = CSR_READ_4(sc, RE_ISR0_8125); + + if (status) { + CSR_WRITE_4(sc, RE_ISR0_8125, status & ~RE_ISR_FIFO_OFLOW); + } + + if (sc->suspended || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + RE_UNLOCK(sc); + return; + } + + re_rxeof(sc); + + re_txeof(sc); + + if (status & RE_ISR_SYSTEM_ERR) { + re_reset(sc); + re_init(sc); + } + + RE_UNLOCK(sc); + + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + re_start(ifp); + +#if OS_VER>=VERSION(7,0) + if (CSR_READ_4(sc, RE_ISR0_8125) & RE_INTRS) { +#if OS_VER < VERSION(11,0) + taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask); +#else ////OS_VER < VERSION(11,0) + taskqueue_enqueue(taskqueue_fast, &sc->re_inttask); +#endif //OS_VER < VERSION(11,0) + return; + } +#endif //OS_VER>=VERSION(7,0) + + /* Re-enable interrupts. */ + CSR_WRITE_4(sc, RE_IMR0_8125, RE_INTRS); +} + +static void re_set_multicast_reg(sc, mask0, mask4) +struct re_softc *sc; +u_int32_t mask0; +u_int32_t mask4; +{ + u_int8_t enable_cfg_reg_write = 0; + + if (sc->re_type == MACFG_5 || sc->re_type == MACFG_6) + enable_cfg_reg_write = 1; + + if (enable_cfg_reg_write) + re_enable_cfg9346_write(sc); + CSR_WRITE_4(sc, RE_MAR0, mask0); + CSR_WRITE_4(sc, RE_MAR4, mask4); + if (enable_cfg_reg_write) + re_disable_cfg9346_write(sc); + + return; +} + +static void re_set_rx_packet_filter_in_sleep_state(sc) +struct re_softc *sc; +{ + struct ifnet *ifp; + u_int32_t rxfilt; + + ifp = RE_GET_IFNET(sc); + + rxfilt = CSR_READ_4(sc, RE_RXCFG); + + rxfilt &= ~(RE_RXCFG_RX_ALLPHYS | RE_RXCFG_RX_INDIV | RE_RXCFG_RX_MULTI | RE_RXCFG_RX_BROAD | RE_RXCFG_RX_RUNT | RE_RXCFG_RX_ERRPKT); + rxfilt |= (RE_RXCFG_RX_INDIV | RE_RXCFG_RX_MULTI | RE_RXCFG_RX_BROAD); + + CSR_WRITE_4(sc, RE_RXCFG, rxfilt); + + re_set_multicast_reg(sc, 0xFFFFFFFF, 0xFFFFFFFF); + + return; +} + +static void re_set_rx_packet_filter(sc) +struct re_softc *sc; +{ + struct ifnet *ifp; + u_int32_t rxfilt; + + ifp = RE_GET_IFNET(sc); + + rxfilt = CSR_READ_4(sc, RE_RXCFG); + + rxfilt |= RE_RXCFG_RX_INDIV; + + if (ifp->if_flags & (IFF_MULTICAST | IFF_ALLMULTI | IFF_PROMISC)) { + rxfilt |= (RE_RXCFG_RX_ALLPHYS | RE_RXCFG_RX_MULTI); + } else { + rxfilt &= ~(RE_RXCFG_RX_MULTI); + } + + if (ifp->if_flags & IFF_PROMISC) { + rxfilt |= (RE_RXCFG_RX_ALLPHYS | RE_RXCFG_RX_RUNT | RE_RXCFG_RX_ERRPKT); + } else { + rxfilt &= ~(RE_RXCFG_RX_ALLPHYS | RE_RXCFG_RX_RUNT | RE_RXCFG_RX_ERRPKT); + } + + if (ifp->if_flags & (IFF_BROADCAST | IFF_PROMISC)) { + rxfilt |= RE_RXCFG_RX_BROAD; + } else { + rxfilt &= ~RE_RXCFG_RX_BROAD; + } + + CSR_WRITE_4(sc, RE_RXCFG, rxfilt); + + re_setmulti(sc); + + return; +} + +/* + * Program the 64-bit multicast hash filter. + */ +static void re_setmulti(sc) +struct re_softc *sc; +{ + struct ifnet *ifp; + int h = 0; + u_int32_t hashes[2] = { 0, 0 }; + struct ifmultiaddr *ifma; + u_int32_t rxfilt; + int mcnt = 0; + + ifp = RE_GET_IFNET(sc); + + rxfilt = CSR_READ_4(sc, RE_RXCFG); + + if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { + rxfilt |= RE_RXCFG_RX_MULTI; + CSR_WRITE_4(sc, RE_RXCFG, rxfilt); + re_set_multicast_reg(sc, 0xFFFFFFFF, 0xFFFFFFFF); + + return; + } + + /* now program new ones */ +#if OS_VER > VERSION(6,0) + IF_ADDR_LOCK(ifp); +#endif +#if OS_VER < VERSION(4,9) + for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; + ifma = ifma->ifma_link.le_next) +#elif OS_VER < VERSION(12,0) + TAILQ_FOREACH(ifma,&ifp->if_multiaddrs,ifma_link) +#else + CK_STAILQ_FOREACH(ifma,&ifp->if_multiaddrs,ifma_link) +#endif + { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + h = ether_crc32_be(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + mcnt++; + } +#if OS_VER > VERSION(6,0) + IF_ADDR_UNLOCK(ifp); +#endif + + if (mcnt) { + if ((sc->re_if_flags & RL_FLAG_PCIE) != 0) { + h = bswap32(hashes[0]); + hashes[0] = bswap32(hashes[1]); + hashes[1] = h; + } + rxfilt |= RE_RXCFG_RX_MULTI; + } else + rxfilt &= ~RE_RXCFG_RX_MULTI; + + CSR_WRITE_4(sc, RE_RXCFG, rxfilt); + re_set_multicast_reg(sc, hashes[0], hashes[1]); + + return; +} + +static int re_ioctl(ifp, command, data) +struct ifnet *ifp; +u_long command; +caddr_t data; +{ + struct re_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *) data; + /*int s;*/ + int error = 0; + int mask, reinit; + /*s = splimp();*/ + + switch(command) { + case SIOCSIFADDR: + case SIOCGIFADDR: + error = ether_ioctl(ifp, command, data); + + break; + case SIOCSIFMTU: + + //printf("before mtu =%d\n",(int)ifp->if_mtu); + if (ifr->ifr_mtu > sc->max_jumbo_frame_size) + error = EINVAL; + else { + ifp->if_mtu = ifr->ifr_mtu; + + //if running + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + //printf("set mtu when running\n"); + + RE_LOCK(sc); + re_stop(sc); + + re_release_buf(sc); + set_rxbufsize(sc); + error =re_alloc_buf(sc); + + if (error == 0) { + re_init(sc); + } + RE_UNLOCK(sc); + + } else { + //if not running + RE_LOCK(sc); + re_release_buf(sc); + set_rxbufsize(sc); + error =re_alloc_buf(sc); + if (error == 0) { + /* Init descriptors. */ + re_var_init(sc); + } + RE_UNLOCK(sc); + } + + } + // printf("after mtu =%d\n",(int)ifp->if_mtu); + break; + case SIOCSIFFLAGS: + RE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + re_init(sc); + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + re_stop(sc); + } + error = 0; + RE_UNLOCK(sc); + break; + case SIOCADDMULTI: + case SIOCDELMULTI: + RE_LOCK(sc); + re_set_rx_packet_filter(sc); + RE_UNLOCK(sc); + error = 0; + break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &sc->media, command); + break; + case SIOCSIFCAP: + + + mask = ifr->ifr_reqcap ^ ifp->if_capenable; + reinit = 0; + + if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) { + if ((sc->re_type == MACFG_24) || (sc->re_type == MACFG_25) || (sc->re_type == MACFG_26)) + ifp->if_hwassist |= CSUM_TCP | CSUM_UDP; + else + ifp->if_hwassist |= RE_CSUM_FEATURES; + } else + ifp->if_hwassist &= ~RE_CSUM_FEATURES; + reinit = 1; + } + + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_RXCSUM; + reinit = 1; + } + + if ((ifp->if_mtu <= ETHERMTU) || ((sc->re_type>= MACFG_3) &&(sc->re_type <=MACFG_6)) || ((sc->re_type>= MACFG_21) && (sc->re_type <=MACFG_23))) { + if (ifp->if_capenable & IFCAP_TXCSUM) + sc->re_tx_cstag = 1; + else + sc->re_tx_cstag = 0; + + if (ifp->if_capenable & IFCAP_RXCSUM) + sc->re_rx_cstag = 1; + else + sc->re_rx_cstag = 0; + } + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) { + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + /* TSO over VLAN requires VLAN hardware tagging. */ + //if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) + // ifp->if_capenable &= ~IFCAP_VLAN_HWTSO; + reinit = 1; + } + + if ((mask & IFCAP_WOL) != 0 && + (ifp->if_capabilities & IFCAP_WOL) != 0) { + if ((mask & IFCAP_WOL_UCAST) != 0) + ifp->if_capenable ^= IFCAP_WOL_UCAST; + if ((mask & IFCAP_WOL_MCAST) != 0) + ifp->if_capenable ^= IFCAP_WOL_MCAST; + if ((mask & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; + } + if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + re_init(sc); + } + VLAN_CAPABILITIES(ifp); + break; + default: + error = EINVAL; + break; + } + + /*(void)splx(s);*/ + + return(error); +} + +static void re_link_on_patch(struct re_softc *sc) +{ + struct ifnet *ifp; + + ifp = RE_GET_IFNET(sc); + + if (sc->re_type == MACFG_50 || sc->re_type == MACFG_51 || sc->re_type == MACFG_52) { + if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_1000MF) { + re_eri_write(sc, 0x1bc, 4, 0x00000011, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x0000001f, ERIAR_ExGMAC); + } else if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_100M) { + re_eri_write(sc, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x0000001f, ERIAR_ExGMAC); + } else { + re_eri_write(sc, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x0000002d, ERIAR_ExGMAC); + } + } else if ((sc->re_type == MACFG_38 || sc->re_type == MACFG_39) && (ifp->if_flags & IFF_UP)) { + if (sc->re_type == MACFG_38 && (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_10M)) { + CSR_WRITE_4(sc, RE_RXCFG, CSR_READ_4(sc, RE_RXCFG) | RE_RXCFG_RX_ALLPHYS); + } else if (sc->re_type == MACFG_39) { + if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_1000MF) { + re_eri_write(sc, 0x1bc, 4, 0x00000011, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x00000005, ERIAR_ExGMAC); + } else if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_100M) { + re_eri_write(sc, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x00000005, ERIAR_ExGMAC); + } else { + re_eri_write(sc, 0x1bc, 4, 0x0000001f, ERIAR_ExGMAC); + re_eri_write(sc, 0x1dc, 4, 0x0000003f, ERIAR_ExGMAC); + } + } + } else if ((sc->re_type == MACFG_36 || sc->re_type == MACFG_37) && eee_enable == 1) { + /*Full -Duplex mode*/ + if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_FULL_DUP) { + MP_WritePhyUshort(sc, 0x1F, 0x0006); + MP_WritePhyUshort(sc, 0x00, 0x5a30); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + if (CSR_READ_1(sc, RE_PHY_STATUS) & (RL_PHY_STATUS_10M | RL_PHY_STATUS_100M)) + CSR_WRITE_4(sc, RE_TXCFG, (CSR_READ_4(sc, RE_TXCFG) & ~BIT_19) | BIT_25); + + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0006); + MP_WritePhyUshort(sc, 0x00, 0x5a00); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + if (CSR_READ_1(sc, RE_PHY_STATUS) & (RL_PHY_STATUS_10M | RL_PHY_STATUS_100M)) + CSR_WRITE_4(sc, RE_TXCFG, (CSR_READ_4(sc, RE_TXCFG) & ~BIT_19) | RE_TXCFG_IFG); + } + } else if ((sc->re_type == MACFG_56 || sc->re_type == MACFG_57 || + sc->re_type == MACFG_58 || sc->re_type == MACFG_59 || + sc->re_type == MACFG_60 || sc->re_type == MACFG_61 || + sc->re_type == MACFG_62 || sc->re_type == MACFG_67 || + sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73 || + sc->re_type == MACFG_73 || sc->re_type == MACFG_80 || + sc->re_type == MACFG_81 || sc->re_type == MACFG_82 || + sc->re_type == MACFG_83) && (ifp->if_flags & IFF_UP)) { + if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_FULL_DUP) + CSR_WRITE_4(sc, RE_TXCFG, (CSR_READ_4(sc, RE_TXCFG) | (BIT_24 | BIT_25)) & ~BIT_19); + else + CSR_WRITE_4(sc, RE_TXCFG, (CSR_READ_4(sc, RE_TXCFG) | BIT_25) & ~(BIT_19 | BIT_24)); + } + + if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57 || + sc->re_type == MACFG_61 || sc->re_type == MACFG_62) { + /*half mode*/ + if (!(CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_FULL_DUP)) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, MII_ANAR, MP_ReadPhyUshort(sc, MII_ANAR)&~(ANAR_PAUSE_SYM |ANAR_PAUSE_ASYM)); + } + } + + if (CSR_READ_1(sc, RE_PHY_STATUS) & RL_PHY_STATUS_10M) { + if (sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73) { + uint32_t Data32; + + Data32 = re_eri_read(sc, 0x1D0, 1, ERIAR_ExGMAC); + Data32 |= BIT_1; + re_eri_write(sc, 0x1D0, 1, Data32, ERIAR_ExGMAC); + } else if (sc->re_type == MACFG_80 || sc->re_type == MACFG_81 || + sc->re_type == MACFG_82 || sc->re_type == MACFG_83) { + MP_WriteMcuAccessRegWord(sc, 0xE080, MP_ReadMcuAccessRegWord(sc, 0xE080)|BIT_1); + } + } + + re_init_unlock(sc); +} + +static void re_link_down_patch(struct re_softc *sc) +{ + struct ifnet *ifp; + + ifp = RE_GET_IFNET(sc); + + re_txeof(sc); + re_rxeof(sc); + re_stop(sc); + + sc->ifmedia_upd(ifp); +} + +/* + * Check Link Status. + */ +static void re_check_link_status(struct re_softc *sc) +{ + u_int8_t link_state; + struct ifnet *ifp; + + ifp = RE_GET_IFNET(sc); + + if (re_link_ok(sc)) { + link_state = LINK_STATE_UP; + } else { + link_state = LINK_STATE_DOWN; + } + + if (link_state != sc->link_state) { + sc->link_state = link_state; + if (link_state == LINK_STATE_UP) { + re_link_on_patch(sc); + re_link_state_change(ifp, LINK_STATE_UP); + } else { + re_link_state_change(ifp, LINK_STATE_DOWN); + re_link_down_patch(sc); + } + } +} + +static void re_init_timer(struct re_softc *sc) +{ +#ifdef RE_USE_NEW_CALLOUT_FUN + callout_init(&sc->re_stat_ch, CALLOUT_MPSAFE); +#else + callout_handle_init(&sc->re_stat_ch); +#endif +} + +static void re_stop_timer(struct re_softc *sc) +{ +#ifdef RE_USE_NEW_CALLOUT_FUN + callout_stop(&sc->re_stat_ch); +#else + untimeout(re_tick, sc, sc->re_stat_ch); +#endif +} + +static void re_start_timer(struct re_softc *sc) +{ +#ifdef RE_USE_NEW_CALLOUT_FUN + callout_reset(&sc->re_stat_ch, hz, re_tick, sc); +#else + re_stop_timer(sc); + sc->re_stat_ch = timeout(re_tick, sc, hz); +#endif +} + +static void re_tick(xsc) +void *xsc; +{ + /*called per second*/ + struct re_softc *sc; + int s; + + s = splimp(); + + sc = xsc; + /*mii = device_get_softc(sc->re_miibus); + + mii_tick(mii);*/ + + splx(s); + + RE_LOCK(sc); + + if (sc->re_link_chg_det == 1) { + re_check_link_status(sc); + re_start_timer(sc); + } + + RE_UNLOCK(sc); + + return; +} + +#if OS_VER < VERSION(7,0) +static void re_watchdog(ifp) +struct ifnet *ifp; +{ + struct re_softc *sc; + + sc = ifp->if_softc; + + printf("re%d: watchdog timeout\n", sc->re_unit); +#if OS_VER < VERSION(11,0) + ifp->if_oerrors++; +#else + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); +#endif + + re_txeof(sc); + re_rxeof(sc); + re_init(sc); + + return; +} +#endif + +/* + * Set media options. + */ +static int re_ifmedia_upd(struct ifnet *ifp) +{ + struct re_softc *sc = ifp->if_softc; + struct ifmedia *ifm = &sc->media; + int anar; + int gbcr; + + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + return(EINVAL); + + if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73 || + sc->re_type == MACFG_74) { + //Disable Giga Lite + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + ClearEthPhyBit(sc, 0x14, BIT_9); + if (sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73) + ClearEthPhyBit(sc, 0x14, BIT_7); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + + switch (IFM_SUBTYPE(ifm->ifm_media)) { + case IFM_AUTO: + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + gbcr = GTCR_ADV_1000TFDX | + GTCR_ADV_1000THDX; + break; + case IFM_1000_SX: +#if OS_VER < 500000 + case IFM_1000_TX: +#else + case IFM_1000_T: +#endif + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + gbcr = GTCR_ADV_1000TFDX | + GTCR_ADV_1000THDX; + break; + case IFM_100_TX: + gbcr = MP_ReadPhyUshort(sc, MII_100T2CR) & + ~(GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX); + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + } else { + anar = ANAR_TX | + ANAR_10_FD | + ANAR_10; + } + break; + case IFM_10_T: + gbcr = MP_ReadPhyUshort(sc, MII_100T2CR) & + ~(GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX); + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + anar = ANAR_10_FD | + ANAR_10; + } else { + anar = ANAR_10; + } + + if (sc->re_type == MACFG_13) { + MP_WritePhyUshort(sc, MII_BMCR, 0x8000); + } + + break; + default: + printf("re%d: Unsupported media type\n", sc->re_unit); + return(0); + } + + if (sc->re_device_id==RT_DEVICEID_8162) + ClearEthPhyOcpBit(sc, 0xA5D4, RTK_ADVERTISE_2500FULL); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + if (sc->re_device_id==RT_DEVICEID_8169 || sc->re_device_id==RT_DEVICEID_8169SC || + sc->re_device_id==RT_DEVICEID_8168 || sc->re_device_id==RT_DEVICEID_8161 || + sc->re_device_id==RT_DEVICEID_8162) { + MP_WritePhyUshort(sc, MII_ANAR, anar | 0x0800 | ANAR_FC); + MP_WritePhyUshort(sc, MII_100T2CR, gbcr); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + } else if (sc->re_type == MACFG_36) { + MP_WritePhyUshort(sc, MII_ANAR, anar | 0x0800 | ANAR_FC); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + } else { + MP_WritePhyUshort(sc, MII_ANAR, anar | 1); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + } + + return(0); +} + +static int re_ifmedia_upd_8125(struct ifnet *ifp) +{ + struct re_softc *sc = ifp->if_softc; + struct ifmedia *ifm = &sc->media; + int anar; + int gbcr; + int cr2500 = 0; + + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + return(EINVAL); + + //Disable Giga Lite + ClearEthPhyOcpBit(sc, 0xA428, BIT_9); + ClearEthPhyOcpBit(sc, 0xA5EA, BIT_0); + + cr2500 = MP_RealReadPhyOcpRegWord(sc, 0xA5D4); + cr2500 &= ~RTK_ADVERTISE_2500FULL; + + switch (IFM_SUBTYPE(ifm->ifm_media)) { + case IFM_AUTO: + cr2500 |= RTK_ADVERTISE_2500FULL; + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + gbcr = GTCR_ADV_1000TFDX | + GTCR_ADV_1000THDX; + break; + case IFM_2500_SX: + case IFM_2500_X: + case IFM_2500_T: + cr2500 |= RTK_ADVERTISE_2500FULL; + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + gbcr = GTCR_ADV_1000TFDX | + GTCR_ADV_1000THDX; + break; + case IFM_1000_SX: +#if OS_VER < 500000 + case IFM_1000_TX: +#else + case IFM_1000_T: +#endif + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + gbcr = GTCR_ADV_1000TFDX | + GTCR_ADV_1000THDX; + break; + case IFM_100_TX: + gbcr = MP_ReadPhyUshort(sc, MII_100T2CR) & + ~(GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX); + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + anar = ANAR_TX_FD | + ANAR_TX | + ANAR_10_FD | + ANAR_10; + } else { + anar = ANAR_TX | + ANAR_10_FD | + ANAR_10; + } + break; + case IFM_10_T: + gbcr = MP_ReadPhyUshort(sc, MII_100T2CR) & + ~(GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX); + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + anar = ANAR_10_FD | + ANAR_10; + } else { + anar = ANAR_10; + } + + if (sc->re_type == MACFG_13) { + MP_WritePhyUshort(sc, MII_BMCR, 0x8000); + } + + break; + default: + printf("re%d: Unsupported media type\n", sc->re_unit); + return(0); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA5D4, cr2500); + MP_WritePhyUshort(sc, MII_ANAR, anar | 0x0800 | ANAR_FC); + MP_WritePhyUshort(sc, MII_100T2CR, gbcr); + MP_WritePhyUshort(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG); + + return(0); +} + +/* + * Report current media status. + */ +static void re_ifmedia_sts(ifp, ifmr) +struct ifnet *ifp; +struct ifmediareq *ifmr; +{ + struct re_softc *sc; + + sc = ifp->if_softc; + + RE_LOCK(sc); + + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + if (re_link_ok(sc)) { + unsigned char msr; + + ifmr->ifm_status |= IFM_ACTIVE; + + msr = CSR_READ_1(sc, RE_PHY_STATUS); + if (msr & RL_PHY_STATUS_FULL_DUP) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; + + if (msr & RL_PHY_STATUS_10M) + ifmr->ifm_active |= IFM_10_T; + else if (msr & RL_PHY_STATUS_100M) + ifmr->ifm_active |= IFM_100_TX; + else if (msr & RL_PHY_STATUS_1000MF) + ifmr->ifm_active |= IFM_1000_T; + } + + RE_UNLOCK(sc); + + return; +} + +static void re_ifmedia_sts_8125(ifp, ifmr) +struct ifnet *ifp; +struct ifmediareq *ifmr; +{ + struct re_softc *sc; + + sc = ifp->if_softc; + + RE_LOCK(sc); + + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + if (re_link_ok(sc)) { + u_int32_t msr; + + ifmr->ifm_status |= IFM_ACTIVE; + + msr = CSR_READ_4(sc, RE_PHY_STATUS); + + if (msr & RL_PHY_STATUS_FULL_DUP) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; + + if (msr & RL_PHY_STATUS_10M) + ifmr->ifm_active |= IFM_10_T; + else if (msr & RL_PHY_STATUS_100M) + ifmr->ifm_active |= IFM_100_TX; + else if (msr & RL_PHY_STATUS_1000MF) + ifmr->ifm_active |= IFM_1000_T; + else if (msr & RL_PHY_STATUS_500MF) + ifmr->ifm_active |= IFM_1000_T; + else if (msr & RL_PHY_STATUS_1250MF) + ifmr->ifm_active |= IFM_1000_T; + else if (msr & RL_PHY_STATUS_2500MF) + ifmr->ifm_active |= IFM_2500_T; + } + + RE_UNLOCK(sc); + + return; +} + +static int re_enable_EEE(struct re_softc *sc) +{ + int ret; + u_int16_t data; + + ret = 0; + switch (sc->re_type) { + case MACFG_42: + case MACFG_43: + re_eri_write(sc, 0x1B0, 2, 0xED03, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + if (CSR_READ_1(sc, 0xEF) & 0x02) { + MP_WritePhyUshort(sc, 0x10, 0x731F); + MP_WritePhyUshort(sc, 0x19, 0x7630); + } else { + MP_WritePhyUshort(sc, 0x10, 0x711F); + MP_WritePhyUshort(sc, 0x19, 0x7030); + } + MP_WritePhyUshort(sc, 0x1A, 0x1506); + MP_WritePhyUshort(sc, 0x1B, 0x0551); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0002); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0003); + MP_WritePhyUshort(sc, 0x0E, 0x0015); + MP_WritePhyUshort(sc, 0x0D, 0x4003); + MP_WritePhyUshort(sc, 0x0E, 0x0002); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + break; + + case MACFG_53: + case MACFG_54: + case MACFG_55: + re_eri_write(sc, 0x1B0, 2, 0xED03, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x10, 0x731F); + MP_WritePhyUshort(sc, 0x19, 0x7630); + MP_WritePhyUshort(sc, 0x1A, 0x1506); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0002); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + break; + + case MACFG_36: + case MACFG_37: + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0020); + data = MP_ReadPhyUshort(sc, 0x15) | 0x0100; + MP_WritePhyUshort(sc, 0x15, data); + MP_WritePhyUshort(sc, 0x1F, 0x0006); + MP_WritePhyUshort(sc, 0x00, 0x5A30); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0006); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + if ((CSR_READ_1(sc, RE_CFG4)&RL_CFG4_CUSTOMIZED_LED) && (CSR_READ_1(sc, RE_MACDBG) & BIT_7)) { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8AC8); + MP_WritePhyUshort(sc, 0x06, CSR_READ_1(sc, RE_CUSTOM_LED)); + MP_WritePhyUshort(sc, 0x05, 0x8B82); + data = MP_ReadPhyUshort(sc, 0x06) | 0x0010; + MP_WritePhyUshort(sc, 0x05, 0x8B82); + MP_WritePhyUshort(sc, 0x06, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + break; + + case MACFG_50: + case MACFG_51: + case MACFG_52: + data = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC) | 0x0003; + re_eri_write(sc, 0x1B0, 4, data, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0020); + data = MP_ReadPhyUshort(sc, 0x15)|0x0100; + MP_WritePhyUshort(sc, 0x15, data); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + data = MP_ReadPhyUshort(sc, 0x06)|0x2000; + MP_WritePhyUshort(sc, 0x06, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0006); + MP_WritePhyUshort(sc, 0x1D, 0x0000); + break; + + case MACFG_38: + case MACFG_39: + data = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + data |= BIT_1 | BIT_0; + re_eri_write(sc, 0x1B0, 4, data, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0020); + data = MP_ReadPhyUshort(sc, 0x15); + data |= BIT_8; + MP_WritePhyUshort(sc, 0x15, data); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + data = MP_ReadPhyUshort(sc, 0x06); + data |= BIT_13; + MP_WritePhyUshort(sc, 0x06, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0006); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + break; + + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + data = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + data |= BIT_1 | BIT_0; + re_eri_write(sc, 0x1B0, 4, data, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + data = MP_ReadPhyUshort(sc, 0x11); + MP_WritePhyUshort(sc, 0x11, data | BIT_4); + MP_WritePhyUshort(sc, 0x1F, 0x0A5D); + MP_WritePhyUshort(sc, 0x10, 0x0006); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + + case MACFG_80: + case MACFG_81: + SetMcuAccessRegBit(sc, 0xE040, (BIT_1|BIT_0)); + SetMcuAccessRegBit(sc, 0xEB62, (BIT_2|BIT_1)); + + SetEthPhyOcpBit(sc, 0xA432, BIT_4); + SetEthPhyOcpBit(sc, 0xA5D0, (BIT_2 | BIT_1)); + ClearEthPhyOcpBit(sc, 0xA6D4, BIT_0); + + ClearEthPhyOcpBit(sc, 0xA6D8, BIT_4); + ClearEthPhyOcpBit(sc, 0xA428, BIT_7); + ClearEthPhyOcpBit(sc, 0xA4A2, BIT_9); + break; + + case MACFG_82: + case MACFG_83: + SetMcuAccessRegBit(sc, 0xE040, (BIT_1|BIT_0)); + + SetEthPhyOcpBit(sc, 0xA5D0, (BIT_2 | BIT_1)); + ClearEthPhyOcpBit(sc, 0xA6D4, BIT_0); + + ClearEthPhyOcpBit(sc, 0xA6D8, BIT_4); + ClearEthPhyOcpBit(sc, 0xA428, BIT_7); + ClearEthPhyOcpBit(sc, 0xA4A2, BIT_9); + break; + + default: + ret = -EOPNOTSUPP; + break; + } + + switch (sc->re_type) { + case MACFG_68: + case MACFG_69: + case MACFG_74: + MP_WritePhyUshort(sc, 0x1F, 0x0A4A); + SetEthPhyBit(sc, 0x11, BIT_9); + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + SetEthPhyBit(sc, 0x14, BIT_7); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + } + + /*Advanced EEE*/ + switch (sc->re_type) { + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_set_phy_mcu_patch_request(sc); + break; + } + + switch (sc->re_type) { + case MACFG_59: + re_eri_write(sc, 0x1EA, 1, 0xFA, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + data = MP_ReadPhyUshort(sc, 0x10); + if (data & BIT_10) { + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + data = MP_ReadPhyUshort(sc, 0x16); + data &= ~(BIT_1); + MP_WritePhyUshort(sc, 0x16, data); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + data = MP_ReadPhyUshort(sc, 0x16); + data |= BIT_1; + MP_WritePhyUshort(sc, 0x16, data); + } + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_60: + data = MP_ReadMcuAccessRegWord(sc, 0xE052); + data |= BIT_0; + MP_WriteMcuAccessRegWord(sc, 0xE052, data); + data = MP_ReadMcuAccessRegWord(sc, 0xE056); + data &= 0xFF0F; + data |= (BIT_4 | BIT_5 | BIT_6); + MP_WriteMcuAccessRegWord(sc, 0xE056, data); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + data = MP_ReadPhyUshort(sc, 0x10); + if (data & BIT_10) { + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + data = MP_ReadPhyUshort(sc, 0x16); + data &= ~(BIT_1); + MP_WritePhyUshort(sc, 0x16, data); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + data = MP_ReadPhyUshort(sc, 0x16); + data |= BIT_1; + MP_WritePhyUshort(sc, 0x16, data); + } + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_61: + case MACFG_62: + case MACFG_67: + OOB_mutex_lock(sc); + data = MP_ReadMcuAccessRegWord(sc, 0xE052); + data &= ~BIT_0; + MP_WriteMcuAccessRegWord(sc, 0xE052, data); + OOB_mutex_unlock(sc); + data = MP_ReadMcuAccessRegWord(sc, 0xE056); + data &= 0xFF0F; + data |= (BIT_4 | BIT_5 | BIT_6); + MP_WriteMcuAccessRegWord(sc, 0xE056, data); + break; + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + OOB_mutex_lock(sc); + if (sc->HwPkgDet == 0x0F) + SetMcuAccessRegBit(sc, 0xE052, BIT_0); + else + ClearMcuAccessRegBit(sc, 0xE052, BIT_0); + OOB_mutex_unlock(sc); + break; + case MACFG_68: + case MACFG_69: + case MACFG_74: + ClearMcuAccessRegBit(sc, 0xE052, BIT_0); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + data = MP_ReadPhyUshort(sc, 0x10) | BIT_15; + MP_WritePhyUshort(sc, 0x10, data); + + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + data = MP_ReadPhyUshort(sc, 0x11) | BIT_13 | BIT_14; + data &= ~(BIT_12); + MP_WritePhyUshort(sc, 0x11, data); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + ClearMcuAccessRegBit(sc, 0xE052, BIT_0); + ClearEthPhyOcpBit(sc, 0xA442, BIT_12 | BIT_13); + ClearEthPhyOcpBit(sc, 0xA430, BIT_15); + break; + } + + switch (sc->re_type) { + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_clear_phy_mcu_patch_request(sc); + break; + } + + return ret; +} + +static int re_disable_EEE(struct re_softc *sc) +{ + int ret; + u_int16_t data; + + ret = 0; + switch (sc->re_type) { + case MACFG_42: + case MACFG_43: + re_eri_write(sc, 0x1B0, 2, 0, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x10, 0x401F); + MP_WritePhyUshort(sc, 0x19, 0x7030); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0003); + MP_WritePhyUshort(sc, 0x0E, 0x0015); + MP_WritePhyUshort(sc, 0x0D, 0x4003); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + break; + + case MACFG_53: + re_eri_write(sc, 0x1B0, 2, 0, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x10, 0x401F); + MP_WritePhyUshort(sc, 0x19, 0x7030); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + break; + + case MACFG_54: + case MACFG_55: + re_eri_write(sc, 0x1B0, 2, 0, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x10, 0xC07F); + MP_WritePhyUshort(sc, 0x19, 0x7030); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + MP_WritePhyUshort(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + break; + + case MACFG_36: + case MACFG_37: + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0020); + data = MP_ReadPhyUshort(sc, 0x15) & ~0x0100; + MP_WritePhyUshort(sc, 0x15, data); + MP_WritePhyUshort(sc, 0x1F, 0x0006); + MP_WritePhyUshort(sc, 0x00, 0x5A00); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + if (CSR_READ_1(sc, RE_CFG4) & RL_CFG4_CUSTOMIZED_LED) { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B82); + data = MP_ReadPhyUshort(sc, 0x06) & ~0x0010; + MP_WritePhyUshort(sc, 0x05, 0x8B82); + MP_WritePhyUshort(sc, 0x06, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + break; + + case MACFG_50: + case MACFG_51: + case MACFG_52: + data = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC)& ~0x0003; + re_eri_write(sc, 0x1B0, 4, data, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + data = MP_ReadPhyUshort(sc, 0x06) & ~0x2000; + MP_WritePhyUshort(sc, 0x06, data); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0020); + data = MP_ReadPhyUshort(sc, 0x15) & ~0x0100; + MP_WritePhyUshort(sc, 0x15, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + + case MACFG_38: + case MACFG_39: + data = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + data &= ~(BIT_1 | BIT_0); + re_eri_write(sc, 0x1B0, 4, data, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + data = MP_ReadPhyUshort(sc, 0x06); + data &= ~BIT_13; + MP_WritePhyUshort(sc, 0x06, data); + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0020); + data = MP_ReadPhyUshort(sc, 0x15); + data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x15, data); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + data = re_eri_read(sc, 0x1B0, 4, ERIAR_ExGMAC); + data &= ~(BIT_1 | BIT_0); + re_eri_write(sc, 0x1B0, 4, data, ERIAR_ExGMAC); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + data = MP_ReadPhyUshort(sc, 0x11); + MP_WritePhyUshort(sc, 0x11, data & ~BIT_4); + MP_WritePhyUshort(sc, 0x1F, 0x0A5D); + MP_WritePhyUshort(sc, 0x10, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + + case MACFG_80: + case MACFG_81: + ClearMcuAccessRegBit(sc, 0xE040, (BIT_1|BIT_0)); + ClearMcuAccessRegBit(sc, 0xEB62, (BIT_2|BIT_1)); + + ClearEthPhyOcpBit(sc, 0xA432, BIT_4); + ClearEthPhyOcpBit(sc, 0xA5D0, (BIT_2 | BIT_1)); + ClearEthPhyOcpBit(sc, 0xA6D4, BIT_0); + + ClearEthPhyOcpBit(sc, 0xA6D8, BIT_4); + ClearEthPhyOcpBit(sc, 0xA428, BIT_7); + ClearEthPhyOcpBit(sc, 0xA4A2, BIT_9); + break; + + case MACFG_82: + case MACFG_83: + ClearMcuAccessRegBit(sc, 0xE040, (BIT_1|BIT_0)); + + ClearEthPhyOcpBit(sc, 0xA5D0, (BIT_2 | BIT_1)); + ClearEthPhyOcpBit(sc, 0xA6D4, BIT_0); + + ClearEthPhyOcpBit(sc, 0xA6D8, BIT_4); + ClearEthPhyOcpBit(sc, 0xA428, BIT_7); + ClearEthPhyOcpBit(sc, 0xA4A2, BIT_9); + break; + + default: + ret = -EOPNOTSUPP; + break; + } + + switch (sc->re_type) { + case MACFG_68: + case MACFG_69: + case MACFG_74: + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + ClearEthPhyBit(sc, 0x14, BIT_7); + MP_WritePhyUshort(sc, 0x1F, 0x0A4A); + ClearEthPhyBit(sc, 0x11, BIT_9); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + } + + /*Advanced EEE*/ + switch (sc->re_type) { + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_set_phy_mcu_patch_request(sc); + break; + } + + switch (sc->re_type) { + case MACFG_59: + re_eri_write(sc, 0x1EA, 1, 0x00, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + data = MP_ReadPhyUshort(sc, 0x16); + data &= ~(BIT_1); + MP_WritePhyUshort(sc, 0x16, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_60: + data = MP_ReadMcuAccessRegWord(sc, 0xE052); + data &= ~(BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE052, data); + + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + data = MP_ReadPhyUshort(sc, 0x16); + data &= ~(BIT_1); + MP_WritePhyUshort(sc, 0x16, data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + data = MP_ReadMcuAccessRegWord(sc, 0xE052); + data &= ~(BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE052, data); + break; + case MACFG_68: + case MACFG_69: + case MACFG_74: + data = MP_ReadMcuAccessRegWord(sc, 0xE052); + data &= ~(BIT_0); + MP_WriteMcuAccessRegWord(sc, 0xE052, data); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + data = MP_ReadPhyUshort(sc, 0x10) & ~(BIT_15); + MP_WritePhyUshort(sc, 0x10, data); + + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + data = MP_ReadPhyUshort(sc, 0x11) & ~(BIT_12 | BIT_13 | BIT_14); + MP_WritePhyUshort(sc, 0x11, data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + ClearMcuAccessRegBit(sc, 0xE052, BIT_0); + ClearEthPhyOcpBit(sc, 0xA442, BIT_12 | BIT_13); + ClearEthPhyOcpBit(sc, 0xA430, BIT_15); + break; + } + + switch (sc->re_type) { + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_clear_phy_mcu_patch_request(sc); + break; + } + + return ret; +} + +static int re_phy_ram_code_check(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int retval = TRUE; + + switch(sc->re_type) { + case MACFG_56: + MP_WritePhyUshort(sc, 0x1f, 0x0A40); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~(BIT_11); + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + + + MP_WritePhyUshort(sc, 0x1f, 0x0A00); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~(BIT_12 | BIT_13 | BIT_14 | BIT_15); + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8010); + PhyRegValue = MP_ReadPhyUshort(sc, 0x14); + PhyRegValue &= ~(BIT_11); + MP_WritePhyUshort(sc, 0x14, PhyRegValue); + + retval = re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A40); + MP_WritePhyUshort(sc, 0x10, 0x0140); + + MP_WritePhyUshort(sc, 0x1f, 0x0A4A); + PhyRegValue = MP_ReadPhyUshort(sc, 0x13); + PhyRegValue &= ~(BIT_6); + PhyRegValue |= (BIT_7); + MP_WritePhyUshort(sc, 0x13, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0A44); + PhyRegValue = MP_ReadPhyUshort(sc, 0x14); + PhyRegValue |= (BIT_2); + MP_WritePhyUshort(sc, 0x14, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0A50); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue |= (BIT_11|BIT_12); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + + retval = re_clear_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A40); + MP_WritePhyUshort(sc, 0x10, 0x1040); + + MP_WritePhyUshort(sc, 0x1f, 0x0A4A); + PhyRegValue = MP_ReadPhyUshort(sc, 0x13); + PhyRegValue &= ~(BIT_6|BIT_7); + MP_WritePhyUshort(sc, 0x13, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0A44); + PhyRegValue = MP_ReadPhyUshort(sc, 0x14); + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x14, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0A50); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_11|BIT_12); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8010); + PhyRegValue = MP_ReadPhyUshort(sc, 0x14); + PhyRegValue |= (BIT_11); + MP_WritePhyUshort(sc, 0x14, PhyRegValue); + + retval = re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A20); + PhyRegValue = MP_ReadPhyUshort(sc, 0x13); + if (PhyRegValue & BIT_11) { + if (PhyRegValue & BIT_10) { + retval = FALSE; + } + } + + retval = re_clear_phy_mcu_patch_request(sc); + + //delay 2ms + DELAY(2000); + break; + default: + break; + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + return retval; +} + +static void re_set_phy_ram_code_check_fail_flag(struct re_softc *sc) +{ + u_int16_t TmpUshort; + + switch(sc->re_type) { + case MACFG_56: + TmpUshort = MP_ReadMcuAccessRegWord(sc, 0xD3C0); + TmpUshort |= BIT_0; + MP_WriteMcuAccessRegWord(sc, 0xD3C0, TmpUshort); + break; + } +} + +static int re_hw_phy_mcu_code_ver_matched(struct re_softc *sc) +{ + int ram_code_ver_match = 0; + + switch (sc->re_type) { + case MACFG_36: + case MACFG_37: + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B60); + sc->re_hw_ram_code_ver = MP_ReadPhyUshort(sc, 0x06); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_38: + case MACFG_39: + case MACFG_50: + case MACFG_51: + case MACFG_52: + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B30); + sc->re_hw_ram_code_ver = MP_ReadPhyUshort(sc, 0x06); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x801E); + sc->re_hw_ram_code_ver = MP_ReadPhyUshort(sc, 0x14); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x801E); + sc->re_hw_ram_code_ver = MP_RealReadPhyOcpRegWord(sc, 0xA438); + break; + default: + sc->re_hw_ram_code_ver = ~0; + break; + } + + if (sc->re_hw_ram_code_ver == sc->re_sw_ram_code_ver) + ram_code_ver_match = 1; + + return ram_code_ver_match; +} + +static void re_write_hw_phy_mcu_code_ver(struct re_softc *sc) +{ + switch (sc->re_type) { + case MACFG_36: + case MACFG_37: + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B60); + MP_WritePhyUshort(sc, 0x06, sc->re_sw_ram_code_ver); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + sc->re_hw_ram_code_ver = sc->re_sw_ram_code_ver; + break; + case MACFG_38: + case MACFG_39: + case MACFG_50: + case MACFG_51: + case MACFG_52: + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B30); + MP_WritePhyUshort(sc, 0x06, sc->re_sw_ram_code_ver); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + sc->re_hw_ram_code_ver = sc->re_sw_ram_code_ver; + break; + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x801E); + MP_WritePhyUshort(sc, 0x14, sc->re_sw_ram_code_ver); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + sc->re_hw_ram_code_ver = sc->re_sw_ram_code_ver; + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x801E); + MP_RealWritePhyOcpRegWord(sc, 0xA438, sc->re_sw_ram_code_ver); + sc->re_hw_ram_code_ver = sc->re_sw_ram_code_ver; + break; + } +} + +static void +re_acquire_phy_mcu_patch_key_lock(struct re_softc *sc) +{ + u_int16_t PatchKey; + + switch (sc->re_type) { + case MACFG_80: + PatchKey = 0x8600; + break; + case MACFG_81: + PatchKey = 0x8601; + break; + case MACFG_82: + PatchKey = 0x3700; + break; + case MACFG_83: + PatchKey = 0x3701; + break; + default: + return; + } + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8024); + MP_RealWritePhyOcpRegWord(sc, 0xA438, PatchKey); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xB82E); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0001); +} + +static void +re_release_phy_mcu_patch_key_lock(struct re_softc *sc) +{ + switch (sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + ClearEthPhyOcpBit(sc, 0xB82E, BIT_0); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8024); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + break; + default: + break; + } +} + +bool +re_set_phy_mcu_patch_request(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + u_int16_t WaitCount = 0; + bool bSuccess = TRUE; + + switch (sc->re_type) { + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + SetEthPhyBit(sc, 0x10, BIT_4); + + MP_WritePhyUshort(sc, 0x1f, 0x0B80); + WaitCount = 0; + do { + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + DELAY(50); + DELAY(50); + WaitCount++; + } while (!(PhyRegValue & BIT_6) && (WaitCount < 1000)); + + if (!(PhyRegValue & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + SetEthPhyOcpBit(sc, 0xB820, BIT_4); + + WaitCount = 0; + do { + PhyRegValue = MP_RealReadPhyOcpRegWord(sc, 0xB800); + DELAY(50); + DELAY(50); + WaitCount++; + } while (!(PhyRegValue & BIT_6) && (WaitCount < 1000)); + + if (!(PhyRegValue & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; + + break; + } + + return bSuccess; +} + +bool +re_clear_phy_mcu_patch_request(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + u_int16_t WaitCount = 0; + bool bSuccess = TRUE; + + switch (sc->re_type) { + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + ClearEthPhyBit(sc, 0x10, BIT_4); + + MP_WritePhyUshort(sc, 0x1f, 0x0B80); + WaitCount = 0; + do { + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + DELAY(50); + DELAY(50); + WaitCount++; + } while ((PhyRegValue & BIT_6) && (WaitCount < 1000)); + + if ((PhyRegValue & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + ClearEthPhyOcpBit(sc, 0xB820, BIT_4); + + WaitCount = 0; + do { + PhyRegValue = MP_RealReadPhyOcpRegWord(sc, 0xB800); + DELAY(50); + DELAY(50); + WaitCount++; + } while ((PhyRegValue & BIT_6) && (WaitCount < 1000)); + + if ((PhyRegValue & BIT_6) && (WaitCount == 1000)) bSuccess = FALSE; + + break; + } + + return bSuccess; +} + +static void +re_set_phy_mcu_ram_code(struct re_softc *sc, const u_int16_t *ramcode, u_int16_t codesize) +{ + u_int16_t i; + u_int16_t addr; + u_int16_t val; + + if (ramcode == NULL || codesize % 2) { + goto out; + } + + for (i = 0; i < codesize; i += 2) { + addr = ramcode[i]; + val = ramcode[i + 1]; + if (addr == 0xFFFF && val == 0xFFFF) { + break; + } + MP_RealWritePhyOcpRegWord(sc, addr, val); + } + +out: + return; +} + +static void re_set_phy_mcu_8168e_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x17, 0x0117); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002C); + MP_WritePhyUshort(sc, 0x1B, 0x5000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x4104); + for (i=0; i<200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1E); + PhyRegValue &= 0x03FF; + if (PhyRegValue== 0x000C) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i=0; i<200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if ((PhyRegValue&0x0020)==0) + break; + } + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if (PhyRegValue & 0x0020) { + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x00a1); + MP_WritePhyUshort(sc, 0x17, 0x1000); + MP_WritePhyUshort(sc, 0x17, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2000); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + MP_WritePhyUshort(sc, 0x18, 0x9bfb); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x07, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue &= ~(BIT_7); + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x08); + PhyRegValue &= ~(BIT_7); + MP_WritePhyUshort(sc, 0x08, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x000e); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x0010); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x0018); + MP_WritePhyUshort(sc, 0x19, 0x4801); + MP_WritePhyUshort(sc, 0x15, 0x0019); + MP_WritePhyUshort(sc, 0x19, 0x6801); + MP_WritePhyUshort(sc, 0x15, 0x001a); + MP_WritePhyUshort(sc, 0x19, 0x66a1); + MP_WritePhyUshort(sc, 0x15, 0x001f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0020); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0021); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0022); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0023); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0024); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0025); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0026); + MP_WritePhyUshort(sc, 0x19, 0x40ea); + MP_WritePhyUshort(sc, 0x15, 0x0027); + MP_WritePhyUshort(sc, 0x19, 0x4503); + MP_WritePhyUshort(sc, 0x15, 0x0028); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0029); + MP_WritePhyUshort(sc, 0x19, 0xa631); + MP_WritePhyUshort(sc, 0x15, 0x002a); + MP_WritePhyUshort(sc, 0x19, 0x9717); + MP_WritePhyUshort(sc, 0x15, 0x002b); + MP_WritePhyUshort(sc, 0x19, 0x302c); + MP_WritePhyUshort(sc, 0x15, 0x002c); + MP_WritePhyUshort(sc, 0x19, 0x4802); + MP_WritePhyUshort(sc, 0x15, 0x002d); + MP_WritePhyUshort(sc, 0x19, 0x58da); + MP_WritePhyUshort(sc, 0x15, 0x002e); + MP_WritePhyUshort(sc, 0x19, 0x400d); + MP_WritePhyUshort(sc, 0x15, 0x002f); + MP_WritePhyUshort(sc, 0x19, 0x4488); + MP_WritePhyUshort(sc, 0x15, 0x0030); + MP_WritePhyUshort(sc, 0x19, 0x9e00); + MP_WritePhyUshort(sc, 0x15, 0x0031); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0032); + MP_WritePhyUshort(sc, 0x19, 0x6481); + MP_WritePhyUshort(sc, 0x15, 0x0033); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0034); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0035); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0036); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0037); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0038); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0039); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x003a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x003b); + MP_WritePhyUshort(sc, 0x19, 0x63e8); + MP_WritePhyUshort(sc, 0x15, 0x003c); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x003d); + MP_WritePhyUshort(sc, 0x19, 0x59d4); + MP_WritePhyUshort(sc, 0x15, 0x003e); + MP_WritePhyUshort(sc, 0x19, 0x63f8); + MP_WritePhyUshort(sc, 0x15, 0x0040); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0041); + MP_WritePhyUshort(sc, 0x19, 0x30de); + MP_WritePhyUshort(sc, 0x15, 0x0044); + MP_WritePhyUshort(sc, 0x19, 0x480f); + MP_WritePhyUshort(sc, 0x15, 0x0045); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x0046); + MP_WritePhyUshort(sc, 0x19, 0x6680); + MP_WritePhyUshort(sc, 0x15, 0x0047); + MP_WritePhyUshort(sc, 0x19, 0x7c10); + MP_WritePhyUshort(sc, 0x15, 0x0048); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0049); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004f); + MP_WritePhyUshort(sc, 0x19, 0x40ea); + MP_WritePhyUshort(sc, 0x15, 0x0050); + MP_WritePhyUshort(sc, 0x19, 0x4503); + MP_WritePhyUshort(sc, 0x15, 0x0051); + MP_WritePhyUshort(sc, 0x19, 0x58ca); + MP_WritePhyUshort(sc, 0x15, 0x0052); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0053); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x0054); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x0055); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0056); + MP_WritePhyUshort(sc, 0x19, 0x3000); + MP_WritePhyUshort(sc, 0x15, 0x006E); + MP_WritePhyUshort(sc, 0x19, 0x9afa); + MP_WritePhyUshort(sc, 0x15, 0x00a1); + MP_WritePhyUshort(sc, 0x19, 0x3044); + MP_WritePhyUshort(sc, 0x15, 0x00ab); + MP_WritePhyUshort(sc, 0x19, 0x5820); + MP_WritePhyUshort(sc, 0x15, 0x00ac); + MP_WritePhyUshort(sc, 0x19, 0x5e04); + MP_WritePhyUshort(sc, 0x15, 0x00ad); + MP_WritePhyUshort(sc, 0x19, 0xb60c); + MP_WritePhyUshort(sc, 0x15, 0x00af); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x00b2); + MP_WritePhyUshort(sc, 0x19, 0x30b9); + MP_WritePhyUshort(sc, 0x15, 0x00b9); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x00ba); + MP_WritePhyUshort(sc, 0x19, 0x480b); + MP_WritePhyUshort(sc, 0x15, 0x00bb); + MP_WritePhyUshort(sc, 0x19, 0x5e00); + MP_WritePhyUshort(sc, 0x15, 0x00bc); + MP_WritePhyUshort(sc, 0x19, 0x405f); + MP_WritePhyUshort(sc, 0x15, 0x00bd); + MP_WritePhyUshort(sc, 0x19, 0x4448); + MP_WritePhyUshort(sc, 0x15, 0x00be); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x00bf); + MP_WritePhyUshort(sc, 0x19, 0x4468); + MP_WritePhyUshort(sc, 0x15, 0x00c0); + MP_WritePhyUshort(sc, 0x19, 0x9c02); + MP_WritePhyUshort(sc, 0x15, 0x00c1); + MP_WritePhyUshort(sc, 0x19, 0x58a0); + MP_WritePhyUshort(sc, 0x15, 0x00c2); + MP_WritePhyUshort(sc, 0x19, 0xb605); + MP_WritePhyUshort(sc, 0x15, 0x00c3); + MP_WritePhyUshort(sc, 0x19, 0xc0d3); + MP_WritePhyUshort(sc, 0x15, 0x00c4); + MP_WritePhyUshort(sc, 0x19, 0x00e6); + MP_WritePhyUshort(sc, 0x15, 0x00c5); + MP_WritePhyUshort(sc, 0x19, 0xdaec); + MP_WritePhyUshort(sc, 0x15, 0x00c6); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00c7); + MP_WritePhyUshort(sc, 0x19, 0x9df9); + MP_WritePhyUshort(sc, 0x15, 0x00c8); + MP_WritePhyUshort(sc, 0x19, 0x307a); + MP_WritePhyUshort(sc, 0x15, 0x0112); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0113); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0114); + MP_WritePhyUshort(sc, 0x19, 0x63f0); + MP_WritePhyUshort(sc, 0x15, 0x0115); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0116); + MP_WritePhyUshort(sc, 0x19, 0x4418); + MP_WritePhyUshort(sc, 0x15, 0x0117); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x15, 0x0118); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0119); + MP_WritePhyUshort(sc, 0x19, 0x64e1); + MP_WritePhyUshort(sc, 0x15, 0x011a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0150); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0151); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0152); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0153); + MP_WritePhyUshort(sc, 0x19, 0x4540); + MP_WritePhyUshort(sc, 0x15, 0x0154); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0155); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x15, 0x0156); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0157); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0158); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0159); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x015a); + MP_WritePhyUshort(sc, 0x19, 0x30fe); + MP_WritePhyUshort(sc, 0x15, 0x021e); + MP_WritePhyUshort(sc, 0x19, 0x5410); + MP_WritePhyUshort(sc, 0x15, 0x0225); + MP_WritePhyUshort(sc, 0x19, 0x5400); + MP_WritePhyUshort(sc, 0x15, 0x023D); + MP_WritePhyUshort(sc, 0x19, 0x4050); + MP_WritePhyUshort(sc, 0x15, 0x0295); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x02bd); + MP_WritePhyUshort(sc, 0x19, 0xa523); + MP_WritePhyUshort(sc, 0x15, 0x02be); + MP_WritePhyUshort(sc, 0x19, 0x32ca); + MP_WritePhyUshort(sc, 0x15, 0x02ca); + MP_WritePhyUshort(sc, 0x19, 0x48b3); + MP_WritePhyUshort(sc, 0x15, 0x02cb); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x02cc); + MP_WritePhyUshort(sc, 0x19, 0x4823); + MP_WritePhyUshort(sc, 0x15, 0x02cd); + MP_WritePhyUshort(sc, 0x19, 0x4510); + MP_WritePhyUshort(sc, 0x15, 0x02ce); + MP_WritePhyUshort(sc, 0x19, 0xb63a); + MP_WritePhyUshort(sc, 0x15, 0x02cf); + MP_WritePhyUshort(sc, 0x19, 0x7dc8); + MP_WritePhyUshort(sc, 0x15, 0x02d6); + MP_WritePhyUshort(sc, 0x19, 0x9bf8); + MP_WritePhyUshort(sc, 0x15, 0x02d8); + MP_WritePhyUshort(sc, 0x19, 0x85f6); + MP_WritePhyUshort(sc, 0x15, 0x02d9); + MP_WritePhyUshort(sc, 0x19, 0x32e0); + MP_WritePhyUshort(sc, 0x15, 0x02e0); + MP_WritePhyUshort(sc, 0x19, 0x4834); + MP_WritePhyUshort(sc, 0x15, 0x02e1); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x02e2); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x02e3); + MP_WritePhyUshort(sc, 0x19, 0x4824); + MP_WritePhyUshort(sc, 0x15, 0x02e4); + MP_WritePhyUshort(sc, 0x19, 0x4520); + MP_WritePhyUshort(sc, 0x15, 0x02e5); + MP_WritePhyUshort(sc, 0x19, 0x4008); + MP_WritePhyUshort(sc, 0x15, 0x02e6); + MP_WritePhyUshort(sc, 0x19, 0x4560); + MP_WritePhyUshort(sc, 0x15, 0x02e7); + MP_WritePhyUshort(sc, 0x19, 0x9d04); + MP_WritePhyUshort(sc, 0x15, 0x02e8); + MP_WritePhyUshort(sc, 0x19, 0x48c4); + MP_WritePhyUshort(sc, 0x15, 0x02e9); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02ea); + MP_WritePhyUshort(sc, 0x19, 0x4844); + MP_WritePhyUshort(sc, 0x15, 0x02eb); + MP_WritePhyUshort(sc, 0x19, 0x7dc8); + MP_WritePhyUshort(sc, 0x15, 0x02f0); + MP_WritePhyUshort(sc, 0x19, 0x9cf7); + MP_WritePhyUshort(sc, 0x15, 0x02f1); + MP_WritePhyUshort(sc, 0x19, 0xdf94); + MP_WritePhyUshort(sc, 0x15, 0x02f2); + MP_WritePhyUshort(sc, 0x19, 0x0002); + MP_WritePhyUshort(sc, 0x15, 0x02f3); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x02f4); + MP_WritePhyUshort(sc, 0x19, 0xb614); + MP_WritePhyUshort(sc, 0x15, 0x02f5); + MP_WritePhyUshort(sc, 0x19, 0xc42b); + MP_WritePhyUshort(sc, 0x15, 0x02f6); + MP_WritePhyUshort(sc, 0x19, 0x00d4); + MP_WritePhyUshort(sc, 0x15, 0x02f7); + MP_WritePhyUshort(sc, 0x19, 0xc455); + MP_WritePhyUshort(sc, 0x15, 0x02f8); + MP_WritePhyUshort(sc, 0x19, 0x0093); + MP_WritePhyUshort(sc, 0x15, 0x02f9); + MP_WritePhyUshort(sc, 0x19, 0x92ee); + MP_WritePhyUshort(sc, 0x15, 0x02fa); + MP_WritePhyUshort(sc, 0x19, 0xefed); + MP_WritePhyUshort(sc, 0x15, 0x02fb); + MP_WritePhyUshort(sc, 0x19, 0x3312); + MP_WritePhyUshort(sc, 0x15, 0x0312); + MP_WritePhyUshort(sc, 0x19, 0x49b5); + MP_WritePhyUshort(sc, 0x15, 0x0313); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x0314); + MP_WritePhyUshort(sc, 0x19, 0x4d00); + MP_WritePhyUshort(sc, 0x15, 0x0315); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x031e); + MP_WritePhyUshort(sc, 0x19, 0x404f); + MP_WritePhyUshort(sc, 0x15, 0x031f); + MP_WritePhyUshort(sc, 0x19, 0x44c8); + MP_WritePhyUshort(sc, 0x15, 0x0320); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0321); + MP_WritePhyUshort(sc, 0x19, 0x00e7); + MP_WritePhyUshort(sc, 0x15, 0x0322); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0323); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x0324); + MP_WritePhyUshort(sc, 0x19, 0x4d48); + MP_WritePhyUshort(sc, 0x15, 0x0325); + MP_WritePhyUshort(sc, 0x19, 0x3327); + MP_WritePhyUshort(sc, 0x15, 0x0326); + MP_WritePhyUshort(sc, 0x19, 0x4d40); + MP_WritePhyUshort(sc, 0x15, 0x0327); + MP_WritePhyUshort(sc, 0x19, 0xc8d7); + MP_WritePhyUshort(sc, 0x15, 0x0328); + MP_WritePhyUshort(sc, 0x19, 0x0003); + MP_WritePhyUshort(sc, 0x15, 0x0329); + MP_WritePhyUshort(sc, 0x19, 0x7c20); + MP_WritePhyUshort(sc, 0x15, 0x032a); + MP_WritePhyUshort(sc, 0x19, 0x4c20); + MP_WritePhyUshort(sc, 0x15, 0x032b); + MP_WritePhyUshort(sc, 0x19, 0xc8ed); + MP_WritePhyUshort(sc, 0x15, 0x032c); + MP_WritePhyUshort(sc, 0x19, 0x00f4); + MP_WritePhyUshort(sc, 0x15, 0x032d); + MP_WritePhyUshort(sc, 0x19, 0x82b3); + MP_WritePhyUshort(sc, 0x15, 0x032e); + MP_WritePhyUshort(sc, 0x19, 0xd11d); + MP_WritePhyUshort(sc, 0x15, 0x032f); + MP_WritePhyUshort(sc, 0x19, 0x00b1); + MP_WritePhyUshort(sc, 0x15, 0x0330); + MP_WritePhyUshort(sc, 0x19, 0xde18); + MP_WritePhyUshort(sc, 0x15, 0x0331); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x0332); + MP_WritePhyUshort(sc, 0x19, 0x91ee); + MP_WritePhyUshort(sc, 0x15, 0x0333); + MP_WritePhyUshort(sc, 0x19, 0x3339); + MP_WritePhyUshort(sc, 0x15, 0x033a); + MP_WritePhyUshort(sc, 0x19, 0x4064); + MP_WritePhyUshort(sc, 0x15, 0x0340); + MP_WritePhyUshort(sc, 0x19, 0x9e06); + MP_WritePhyUshort(sc, 0x15, 0x0341); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0342); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x0343); + MP_WritePhyUshort(sc, 0x19, 0x4d48); + MP_WritePhyUshort(sc, 0x15, 0x0344); + MP_WritePhyUshort(sc, 0x19, 0x3346); + MP_WritePhyUshort(sc, 0x15, 0x0345); + MP_WritePhyUshort(sc, 0x19, 0x4d40); + MP_WritePhyUshort(sc, 0x15, 0x0346); + MP_WritePhyUshort(sc, 0x19, 0xd11d); + MP_WritePhyUshort(sc, 0x15, 0x0347); + MP_WritePhyUshort(sc, 0x19, 0x0099); + MP_WritePhyUshort(sc, 0x15, 0x0348); + MP_WritePhyUshort(sc, 0x19, 0xbb17); + MP_WritePhyUshort(sc, 0x15, 0x0349); + MP_WritePhyUshort(sc, 0x19, 0x8102); + MP_WritePhyUshort(sc, 0x15, 0x034a); + MP_WritePhyUshort(sc, 0x19, 0x334d); + MP_WritePhyUshort(sc, 0x15, 0x034b); + MP_WritePhyUshort(sc, 0x19, 0xa22c); + MP_WritePhyUshort(sc, 0x15, 0x034c); + MP_WritePhyUshort(sc, 0x19, 0x3397); + MP_WritePhyUshort(sc, 0x15, 0x034d); + MP_WritePhyUshort(sc, 0x19, 0x91f2); + MP_WritePhyUshort(sc, 0x15, 0x034e); + MP_WritePhyUshort(sc, 0x19, 0xc218); + MP_WritePhyUshort(sc, 0x15, 0x034f); + MP_WritePhyUshort(sc, 0x19, 0x00f0); + MP_WritePhyUshort(sc, 0x15, 0x0350); + MP_WritePhyUshort(sc, 0x19, 0x3397); + MP_WritePhyUshort(sc, 0x15, 0x0351); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0364); + MP_WritePhyUshort(sc, 0x19, 0xbc05); + MP_WritePhyUshort(sc, 0x15, 0x0367); + MP_WritePhyUshort(sc, 0x19, 0xa1fc); + MP_WritePhyUshort(sc, 0x15, 0x0368); + MP_WritePhyUshort(sc, 0x19, 0x3377); + MP_WritePhyUshort(sc, 0x15, 0x0369); + MP_WritePhyUshort(sc, 0x19, 0x328b); + MP_WritePhyUshort(sc, 0x15, 0x036a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0377); + MP_WritePhyUshort(sc, 0x19, 0x4b97); + MP_WritePhyUshort(sc, 0x15, 0x0378); + MP_WritePhyUshort(sc, 0x19, 0x6818); + MP_WritePhyUshort(sc, 0x15, 0x0379); + MP_WritePhyUshort(sc, 0x19, 0x4b07); + MP_WritePhyUshort(sc, 0x15, 0x037a); + MP_WritePhyUshort(sc, 0x19, 0x40ac); + MP_WritePhyUshort(sc, 0x15, 0x037b); + MP_WritePhyUshort(sc, 0x19, 0x4445); + MP_WritePhyUshort(sc, 0x15, 0x037c); + MP_WritePhyUshort(sc, 0x19, 0x404e); + MP_WritePhyUshort(sc, 0x15, 0x037d); + MP_WritePhyUshort(sc, 0x19, 0x4461); + MP_WritePhyUshort(sc, 0x15, 0x037e); + MP_WritePhyUshort(sc, 0x19, 0x9c09); + MP_WritePhyUshort(sc, 0x15, 0x037f); + MP_WritePhyUshort(sc, 0x19, 0x63da); + MP_WritePhyUshort(sc, 0x15, 0x0380); + MP_WritePhyUshort(sc, 0x19, 0x5440); + MP_WritePhyUshort(sc, 0x15, 0x0381); + MP_WritePhyUshort(sc, 0x19, 0x4b98); + MP_WritePhyUshort(sc, 0x15, 0x0382); + MP_WritePhyUshort(sc, 0x19, 0x7c60); + MP_WritePhyUshort(sc, 0x15, 0x0383); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x0384); + MP_WritePhyUshort(sc, 0x19, 0x4b08); + MP_WritePhyUshort(sc, 0x15, 0x0385); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x0386); + MP_WritePhyUshort(sc, 0x19, 0x338d); + MP_WritePhyUshort(sc, 0x15, 0x0387); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0388); + MP_WritePhyUshort(sc, 0x19, 0x0080); + MP_WritePhyUshort(sc, 0x15, 0x0389); + MP_WritePhyUshort(sc, 0x19, 0x820c); + MP_WritePhyUshort(sc, 0x15, 0x038a); + MP_WritePhyUshort(sc, 0x19, 0xa10b); + MP_WritePhyUshort(sc, 0x15, 0x038b); + MP_WritePhyUshort(sc, 0x19, 0x9df3); + MP_WritePhyUshort(sc, 0x15, 0x038c); + MP_WritePhyUshort(sc, 0x19, 0x3395); + MP_WritePhyUshort(sc, 0x15, 0x038d); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x038e); + MP_WritePhyUshort(sc, 0x19, 0x00f9); + MP_WritePhyUshort(sc, 0x15, 0x038f); + MP_WritePhyUshort(sc, 0x19, 0xc017); + MP_WritePhyUshort(sc, 0x15, 0x0390); + MP_WritePhyUshort(sc, 0x19, 0x0005); + MP_WritePhyUshort(sc, 0x15, 0x0391); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x0392); + MP_WritePhyUshort(sc, 0x19, 0xa103); + MP_WritePhyUshort(sc, 0x15, 0x0393); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x0394); + MP_WritePhyUshort(sc, 0x19, 0x9df9); + MP_WritePhyUshort(sc, 0x15, 0x0395); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x0396); + MP_WritePhyUshort(sc, 0x19, 0x3397); + MP_WritePhyUshort(sc, 0x15, 0x0399); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x03a4); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x03a5); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x03a6); + MP_WritePhyUshort(sc, 0x19, 0x4d08); + MP_WritePhyUshort(sc, 0x15, 0x03a7); + MP_WritePhyUshort(sc, 0x19, 0x33a9); + MP_WritePhyUshort(sc, 0x15, 0x03a8); + MP_WritePhyUshort(sc, 0x19, 0x4d00); + MP_WritePhyUshort(sc, 0x15, 0x03a9); + MP_WritePhyUshort(sc, 0x19, 0x9bfa); + MP_WritePhyUshort(sc, 0x15, 0x03aa); + MP_WritePhyUshort(sc, 0x19, 0x33b6); + MP_WritePhyUshort(sc, 0x15, 0x03bb); + MP_WritePhyUshort(sc, 0x19, 0x4056); + MP_WritePhyUshort(sc, 0x15, 0x03bc); + MP_WritePhyUshort(sc, 0x19, 0x44e9); + MP_WritePhyUshort(sc, 0x15, 0x03bd); + MP_WritePhyUshort(sc, 0x19, 0x405e); + MP_WritePhyUshort(sc, 0x15, 0x03be); + MP_WritePhyUshort(sc, 0x19, 0x44f8); + MP_WritePhyUshort(sc, 0x15, 0x03bf); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x03c0); + MP_WritePhyUshort(sc, 0x19, 0x0037); + MP_WritePhyUshort(sc, 0x15, 0x03c1); + MP_WritePhyUshort(sc, 0x19, 0xbd37); + MP_WritePhyUshort(sc, 0x15, 0x03c2); + MP_WritePhyUshort(sc, 0x19, 0x9cfd); + MP_WritePhyUshort(sc, 0x15, 0x03c3); + MP_WritePhyUshort(sc, 0x19, 0xc639); + MP_WritePhyUshort(sc, 0x15, 0x03c4); + MP_WritePhyUshort(sc, 0x19, 0x0011); + MP_WritePhyUshort(sc, 0x15, 0x03c5); + MP_WritePhyUshort(sc, 0x19, 0x9b03); + MP_WritePhyUshort(sc, 0x15, 0x03c6); + MP_WritePhyUshort(sc, 0x19, 0x7c01); + MP_WritePhyUshort(sc, 0x15, 0x03c7); + MP_WritePhyUshort(sc, 0x19, 0x4c01); + MP_WritePhyUshort(sc, 0x15, 0x03c8); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x03c9); + MP_WritePhyUshort(sc, 0x19, 0x7c20); + MP_WritePhyUshort(sc, 0x15, 0x03ca); + MP_WritePhyUshort(sc, 0x19, 0x4c20); + MP_WritePhyUshort(sc, 0x15, 0x03cb); + MP_WritePhyUshort(sc, 0x19, 0x9af4); + MP_WritePhyUshort(sc, 0x15, 0x03cc); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03cd); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03ce); + MP_WritePhyUshort(sc, 0x19, 0x4470); + MP_WritePhyUshort(sc, 0x15, 0x03cf); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03d0); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03d1); + MP_WritePhyUshort(sc, 0x19, 0x33bf); + MP_WritePhyUshort(sc, 0x15, 0x03d6); + MP_WritePhyUshort(sc, 0x19, 0x4047); + MP_WritePhyUshort(sc, 0x15, 0x03d7); + MP_WritePhyUshort(sc, 0x19, 0x4469); + MP_WritePhyUshort(sc, 0x15, 0x03d8); + MP_WritePhyUshort(sc, 0x19, 0x492b); + MP_WritePhyUshort(sc, 0x15, 0x03d9); + MP_WritePhyUshort(sc, 0x19, 0x4479); + MP_WritePhyUshort(sc, 0x15, 0x03da); + MP_WritePhyUshort(sc, 0x19, 0x7c09); + MP_WritePhyUshort(sc, 0x15, 0x03db); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x03dc); + MP_WritePhyUshort(sc, 0x19, 0x4d48); + MP_WritePhyUshort(sc, 0x15, 0x03dd); + MP_WritePhyUshort(sc, 0x19, 0x33df); + MP_WritePhyUshort(sc, 0x15, 0x03de); + MP_WritePhyUshort(sc, 0x19, 0x4d40); + MP_WritePhyUshort(sc, 0x15, 0x03df); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x03e0); + MP_WritePhyUshort(sc, 0x19, 0x0017); + MP_WritePhyUshort(sc, 0x15, 0x03e1); + MP_WritePhyUshort(sc, 0x19, 0xbd17); + MP_WritePhyUshort(sc, 0x15, 0x03e2); + MP_WritePhyUshort(sc, 0x19, 0x9b03); + MP_WritePhyUshort(sc, 0x15, 0x03e3); + MP_WritePhyUshort(sc, 0x19, 0x7c20); + MP_WritePhyUshort(sc, 0x15, 0x03e4); + MP_WritePhyUshort(sc, 0x19, 0x4c20); + MP_WritePhyUshort(sc, 0x15, 0x03e5); + MP_WritePhyUshort(sc, 0x19, 0x88f5); + MP_WritePhyUshort(sc, 0x15, 0x03e6); + MP_WritePhyUshort(sc, 0x19, 0xc428); + MP_WritePhyUshort(sc, 0x15, 0x03e7); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x03e8); + MP_WritePhyUshort(sc, 0x19, 0x9af2); + MP_WritePhyUshort(sc, 0x15, 0x03e9); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03ea); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03eb); + MP_WritePhyUshort(sc, 0x19, 0x4470); + MP_WritePhyUshort(sc, 0x15, 0x03ec); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03ed); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03ee); + MP_WritePhyUshort(sc, 0x19, 0x33da); + MP_WritePhyUshort(sc, 0x15, 0x03ef); + MP_WritePhyUshort(sc, 0x19, 0x3312); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2179); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0040); + MP_WritePhyUshort(sc, 0x18, 0x0645); + MP_WritePhyUshort(sc, 0x19, 0xe200); + MP_WritePhyUshort(sc, 0x18, 0x0655); + MP_WritePhyUshort(sc, 0x19, 0x9000); + MP_WritePhyUshort(sc, 0x18, 0x0d05); + MP_WritePhyUshort(sc, 0x19, 0xbe00); + MP_WritePhyUshort(sc, 0x18, 0x0d15); + MP_WritePhyUshort(sc, 0x19, 0xd300); + MP_WritePhyUshort(sc, 0x18, 0x0d25); + MP_WritePhyUshort(sc, 0x19, 0xfe00); + MP_WritePhyUshort(sc, 0x18, 0x0d35); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x0d45); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x0d55); + MP_WritePhyUshort(sc, 0x19, 0x1000); + MP_WritePhyUshort(sc, 0x18, 0x0d65); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0d75); + MP_WritePhyUshort(sc, 0x19, 0x8200); + MP_WritePhyUshort(sc, 0x18, 0x0d85); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0d95); + MP_WritePhyUshort(sc, 0x19, 0x7000); + MP_WritePhyUshort(sc, 0x18, 0x0da5); + MP_WritePhyUshort(sc, 0x19, 0x0f00); + MP_WritePhyUshort(sc, 0x18, 0x0db5); + MP_WritePhyUshort(sc, 0x19, 0x0100); + MP_WritePhyUshort(sc, 0x18, 0x0dc5); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x18, 0x0dd5); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x0de5); + MP_WritePhyUshort(sc, 0x19, 0xe000); + MP_WritePhyUshort(sc, 0x18, 0x0df5); + MP_WritePhyUshort(sc, 0x19, 0xef00); + MP_WritePhyUshort(sc, 0x18, 0x16d5); + MP_WritePhyUshort(sc, 0x19, 0xe200); + MP_WritePhyUshort(sc, 0x18, 0x16e5); + MP_WritePhyUshort(sc, 0x19, 0xab00); + MP_WritePhyUshort(sc, 0x18, 0x2904); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x2914); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x2924); + MP_WritePhyUshort(sc, 0x19, 0x0100); + MP_WritePhyUshort(sc, 0x18, 0x2934); + MP_WritePhyUshort(sc, 0x19, 0x2000); + MP_WritePhyUshort(sc, 0x18, 0x2944); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2954); + MP_WritePhyUshort(sc, 0x19, 0x4600); + MP_WritePhyUshort(sc, 0x18, 0x2964); + MP_WritePhyUshort(sc, 0x19, 0xfc00); + MP_WritePhyUshort(sc, 0x18, 0x2974); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2984); + MP_WritePhyUshort(sc, 0x19, 0x5000); + MP_WritePhyUshort(sc, 0x18, 0x2994); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x18, 0x29a4); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x29b4); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x29c4); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x29d4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x29e4); + MP_WritePhyUshort(sc, 0x19, 0x2000); + MP_WritePhyUshort(sc, 0x18, 0x29f4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2a04); + MP_WritePhyUshort(sc, 0x19, 0xe600); + MP_WritePhyUshort(sc, 0x18, 0x2a14); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x2a24); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2a34); + MP_WritePhyUshort(sc, 0x19, 0x5000); + MP_WritePhyUshort(sc, 0x18, 0x2a44); + MP_WritePhyUshort(sc, 0x19, 0x8500); + MP_WritePhyUshort(sc, 0x18, 0x2a54); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x2a64); + MP_WritePhyUshort(sc, 0x19, 0xac00); + MP_WritePhyUshort(sc, 0x18, 0x2a74); + MP_WritePhyUshort(sc, 0x19, 0x0800); + MP_WritePhyUshort(sc, 0x18, 0x2a84); + MP_WritePhyUshort(sc, 0x19, 0xfc00); + MP_WritePhyUshort(sc, 0x18, 0x2a94); + MP_WritePhyUshort(sc, 0x19, 0xe000); + MP_WritePhyUshort(sc, 0x18, 0x2aa4); + MP_WritePhyUshort(sc, 0x19, 0x7400); + MP_WritePhyUshort(sc, 0x18, 0x2ab4); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x2ac4); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x2ad4); + MP_WritePhyUshort(sc, 0x19, 0x0100); + MP_WritePhyUshort(sc, 0x18, 0x2ae4); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x2af4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2b04); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x18, 0x2b14); + MP_WritePhyUshort(sc, 0x19, 0xfc00); + MP_WritePhyUshort(sc, 0x18, 0x2b24); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2b34); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x2b44); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x18, 0x2b54); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x2b64); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x2b74); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x2b84); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2b94); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x2ba4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2bb4); + MP_WritePhyUshort(sc, 0x19, 0xfc00); + MP_WritePhyUshort(sc, 0x18, 0x2bc4); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x2bd4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2be4); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x2bf4); + MP_WritePhyUshort(sc, 0x19, 0x8900); + MP_WritePhyUshort(sc, 0x18, 0x2c04); + MP_WritePhyUshort(sc, 0x19, 0x8300); + MP_WritePhyUshort(sc, 0x18, 0x2c14); + MP_WritePhyUshort(sc, 0x19, 0xe000); + MP_WritePhyUshort(sc, 0x18, 0x2c24); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x2c34); + MP_WritePhyUshort(sc, 0x19, 0xac00); + MP_WritePhyUshort(sc, 0x18, 0x2c44); + MP_WritePhyUshort(sc, 0x19, 0x0800); + MP_WritePhyUshort(sc, 0x18, 0x2c54); + MP_WritePhyUshort(sc, 0x19, 0xfa00); + MP_WritePhyUshort(sc, 0x18, 0x2c64); + MP_WritePhyUshort(sc, 0x19, 0xe100); + MP_WritePhyUshort(sc, 0x18, 0x2c74); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x18, 0x0001); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2100); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8b88); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0xd480); + MP_WritePhyUshort(sc, 0x06, 0xc1e4); + MP_WritePhyUshort(sc, 0x06, 0x8b9a); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x9bee); + MP_WritePhyUshort(sc, 0x06, 0x8b83); + MP_WritePhyUshort(sc, 0x06, 0x41bf); + MP_WritePhyUshort(sc, 0x06, 0x8b88); + MP_WritePhyUshort(sc, 0x06, 0xec00); + MP_WritePhyUshort(sc, 0x06, 0x19a9); + MP_WritePhyUshort(sc, 0x06, 0x8b90); + MP_WritePhyUshort(sc, 0x06, 0xf9ee); + MP_WritePhyUshort(sc, 0x06, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x41f7); + MP_WritePhyUshort(sc, 0x06, 0x2ff6); + MP_WritePhyUshort(sc, 0x06, 0x28e4); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xe5e1); + MP_WritePhyUshort(sc, 0x06, 0x41f7); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x020c); + MP_WritePhyUshort(sc, 0x06, 0x0202); + MP_WritePhyUshort(sc, 0x06, 0x1d02); + MP_WritePhyUshort(sc, 0x06, 0x0230); + MP_WritePhyUshort(sc, 0x06, 0x0202); + MP_WritePhyUshort(sc, 0x06, 0x4002); + MP_WritePhyUshort(sc, 0x06, 0x028b); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x6c02); + MP_WritePhyUshort(sc, 0x06, 0x8085); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaec3); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x10ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x1310); + MP_WritePhyUshort(sc, 0x06, 0x021f); + MP_WritePhyUshort(sc, 0x06, 0x9d02); + MP_WritePhyUshort(sc, 0x06, 0x1f0c); + MP_WritePhyUshort(sc, 0x06, 0x0227); + MP_WritePhyUshort(sc, 0x06, 0x49fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x200b); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x830e); + MP_WritePhyUshort(sc, 0x06, 0x021b); + MP_WritePhyUshort(sc, 0x06, 0x67ad); + MP_WritePhyUshort(sc, 0x06, 0x2211); + MP_WritePhyUshort(sc, 0x06, 0xf622); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x2ba5); + MP_WritePhyUshort(sc, 0x06, 0x022a); + MP_WritePhyUshort(sc, 0x06, 0x2402); + MP_WritePhyUshort(sc, 0x06, 0x80c6); + MP_WritePhyUshort(sc, 0x06, 0x022a); + MP_WritePhyUshort(sc, 0x06, 0xf0ad); + MP_WritePhyUshort(sc, 0x06, 0x2511); + MP_WritePhyUshort(sc, 0x06, 0xf625); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x8226); + MP_WritePhyUshort(sc, 0x06, 0x0204); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x19cc); + MP_WritePhyUshort(sc, 0x06, 0x022b); + MP_WritePhyUshort(sc, 0x06, 0x5bfc); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x0105); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b83); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x44e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x23ad); + MP_WritePhyUshort(sc, 0x06, 0x223b); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xbea0); + MP_WritePhyUshort(sc, 0x06, 0x0005); + MP_WritePhyUshort(sc, 0x06, 0x0228); + MP_WritePhyUshort(sc, 0x06, 0xdeae); + MP_WritePhyUshort(sc, 0x06, 0x42a0); + MP_WritePhyUshort(sc, 0x06, 0x0105); + MP_WritePhyUshort(sc, 0x06, 0x0228); + MP_WritePhyUshort(sc, 0x06, 0xf1ae); + MP_WritePhyUshort(sc, 0x06, 0x3aa0); + MP_WritePhyUshort(sc, 0x06, 0x0205); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x25ae); + MP_WritePhyUshort(sc, 0x06, 0x32a0); + MP_WritePhyUshort(sc, 0x06, 0x0305); + MP_WritePhyUshort(sc, 0x06, 0x0229); + MP_WritePhyUshort(sc, 0x06, 0x9aae); + MP_WritePhyUshort(sc, 0x06, 0x2aa0); + MP_WritePhyUshort(sc, 0x06, 0x0405); + MP_WritePhyUshort(sc, 0x06, 0x0229); + MP_WritePhyUshort(sc, 0x06, 0xaeae); + MP_WritePhyUshort(sc, 0x06, 0x22a0); + MP_WritePhyUshort(sc, 0x06, 0x0505); + MP_WritePhyUshort(sc, 0x06, 0x0229); + MP_WritePhyUshort(sc, 0x06, 0xd7ae); + MP_WritePhyUshort(sc, 0x06, 0x1aa0); + MP_WritePhyUshort(sc, 0x06, 0x0605); + MP_WritePhyUshort(sc, 0x06, 0x0229); + MP_WritePhyUshort(sc, 0x06, 0xfeae); + MP_WritePhyUshort(sc, 0x06, 0x12ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac0); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac1); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x00fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0x022a); + MP_WritePhyUshort(sc, 0x06, 0x67e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x230d); + MP_WritePhyUshort(sc, 0x06, 0x0658); + MP_WritePhyUshort(sc, 0x06, 0x03a0); + MP_WritePhyUshort(sc, 0x06, 0x0202); + MP_WritePhyUshort(sc, 0x06, 0xae2d); + MP_WritePhyUshort(sc, 0x06, 0xa001); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x2da0); + MP_WritePhyUshort(sc, 0x06, 0x004d); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe201); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x44e0); + MP_WritePhyUshort(sc, 0x06, 0x8ac2); + MP_WritePhyUshort(sc, 0x06, 0xe48a); + MP_WritePhyUshort(sc, 0x06, 0xc4e0); + MP_WritePhyUshort(sc, 0x06, 0x8ac3); + MP_WritePhyUshort(sc, 0x06, 0xe48a); + MP_WritePhyUshort(sc, 0x06, 0xc5ee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x03e0); + MP_WritePhyUshort(sc, 0x06, 0x8b83); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x3aee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x05ae); + MP_WritePhyUshort(sc, 0x06, 0x34e0); + MP_WritePhyUshort(sc, 0x06, 0x8ace); + MP_WritePhyUshort(sc, 0x06, 0xae03); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xcfe1); + MP_WritePhyUshort(sc, 0x06, 0x8ac2); + MP_WritePhyUshort(sc, 0x06, 0x4905); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xc4e1); + MP_WritePhyUshort(sc, 0x06, 0x8ac3); + MP_WritePhyUshort(sc, 0x06, 0x4905); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xc5ee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x2ab6); + MP_WritePhyUshort(sc, 0x06, 0xac20); + MP_WritePhyUshort(sc, 0x06, 0x1202); + MP_WritePhyUshort(sc, 0x06, 0x819b); + MP_WritePhyUshort(sc, 0x06, 0xac20); + MP_WritePhyUshort(sc, 0x06, 0x0cee); + MP_WritePhyUshort(sc, 0x06, 0x8ac1); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x02fc); + MP_WritePhyUshort(sc, 0x06, 0x04d0); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x590f); + MP_WritePhyUshort(sc, 0x06, 0x3902); + MP_WritePhyUshort(sc, 0x06, 0xaa04); + MP_WritePhyUshort(sc, 0x06, 0xd001); + MP_WritePhyUshort(sc, 0x06, 0xae02); + MP_WritePhyUshort(sc, 0x06, 0xd000); + MP_WritePhyUshort(sc, 0x06, 0x04f9); + MP_WritePhyUshort(sc, 0x06, 0xfae2); + MP_WritePhyUshort(sc, 0x06, 0xe2d2); + MP_WritePhyUshort(sc, 0x06, 0xe3e2); + MP_WritePhyUshort(sc, 0x06, 0xd3f9); + MP_WritePhyUshort(sc, 0x06, 0x5af7); + MP_WritePhyUshort(sc, 0x06, 0xe6e2); + MP_WritePhyUshort(sc, 0x06, 0xd2e7); + MP_WritePhyUshort(sc, 0x06, 0xe2d3); + MP_WritePhyUshort(sc, 0x06, 0xe2e0); + MP_WritePhyUshort(sc, 0x06, 0x2ce3); + MP_WritePhyUshort(sc, 0x06, 0xe02d); + MP_WritePhyUshort(sc, 0x06, 0xf95b); + MP_WritePhyUshort(sc, 0x06, 0xe01e); + MP_WritePhyUshort(sc, 0x06, 0x30e6); + MP_WritePhyUshort(sc, 0x06, 0xe02c); + MP_WritePhyUshort(sc, 0x06, 0xe7e0); + MP_WritePhyUshort(sc, 0x06, 0x2de2); + MP_WritePhyUshort(sc, 0x06, 0xe2cc); + MP_WritePhyUshort(sc, 0x06, 0xe3e2); + MP_WritePhyUshort(sc, 0x06, 0xcdf9); + MP_WritePhyUshort(sc, 0x06, 0x5a0f); + MP_WritePhyUshort(sc, 0x06, 0x6a50); + MP_WritePhyUshort(sc, 0x06, 0xe6e2); + MP_WritePhyUshort(sc, 0x06, 0xcce7); + MP_WritePhyUshort(sc, 0x06, 0xe2cd); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x3ce1); + MP_WritePhyUshort(sc, 0x06, 0xe03d); + MP_WritePhyUshort(sc, 0x06, 0xef64); + MP_WritePhyUshort(sc, 0x06, 0xfde0); + MP_WritePhyUshort(sc, 0x06, 0xe2cc); + MP_WritePhyUshort(sc, 0x06, 0xe1e2); + MP_WritePhyUshort(sc, 0x06, 0xcd58); + MP_WritePhyUshort(sc, 0x06, 0x0f5a); + MP_WritePhyUshort(sc, 0x06, 0xf01e); + MP_WritePhyUshort(sc, 0x06, 0x02e4); + MP_WritePhyUshort(sc, 0x06, 0xe2cc); + MP_WritePhyUshort(sc, 0x06, 0xe5e2); + MP_WritePhyUshort(sc, 0x06, 0xcdfd); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x2ce1); + MP_WritePhyUshort(sc, 0x06, 0xe02d); + MP_WritePhyUshort(sc, 0x06, 0x59e0); + MP_WritePhyUshort(sc, 0x06, 0x5b1f); + MP_WritePhyUshort(sc, 0x06, 0x1e13); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x2ce5); + MP_WritePhyUshort(sc, 0x06, 0xe02d); + MP_WritePhyUshort(sc, 0x06, 0xfde0); + MP_WritePhyUshort(sc, 0x06, 0xe2d2); + MP_WritePhyUshort(sc, 0x06, 0xe1e2); + MP_WritePhyUshort(sc, 0x06, 0xd358); + MP_WritePhyUshort(sc, 0x06, 0xf75a); + MP_WritePhyUshort(sc, 0x06, 0x081e); + MP_WritePhyUshort(sc, 0x06, 0x02e4); + MP_WritePhyUshort(sc, 0x06, 0xe2d2); + MP_WritePhyUshort(sc, 0x06, 0xe5e2); + MP_WritePhyUshort(sc, 0x06, 0xd3ef); + MP_WritePhyUshort(sc, 0x06, 0x46fe); + MP_WritePhyUshort(sc, 0x06, 0xfd04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xc4e1); + MP_WritePhyUshort(sc, 0x06, 0x8b6e); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e58); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x6ead); + MP_WritePhyUshort(sc, 0x06, 0x2222); + MP_WritePhyUshort(sc, 0x06, 0xac27); + MP_WritePhyUshort(sc, 0x06, 0x55ac); + MP_WritePhyUshort(sc, 0x06, 0x2602); + MP_WritePhyUshort(sc, 0x06, 0xae1a); + MP_WritePhyUshort(sc, 0x06, 0xd106); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xba02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd107); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xbd02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd107); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xc002); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xae30); + MP_WritePhyUshort(sc, 0x06, 0xd103); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xc302); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xc602); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xca02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd10f); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xba02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xbd02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xc002); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xc302); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd011); + MP_WritePhyUshort(sc, 0x06, 0x022b); + MP_WritePhyUshort(sc, 0x06, 0xfb59); + MP_WritePhyUshort(sc, 0x06, 0x03ef); + MP_WritePhyUshort(sc, 0x06, 0x01d1); + MP_WritePhyUshort(sc, 0x06, 0x00a0); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0xc602); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xd111); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x020c); + MP_WritePhyUshort(sc, 0x06, 0x11ad); + MP_WritePhyUshort(sc, 0x06, 0x2102); + MP_WritePhyUshort(sc, 0x06, 0x0c12); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xca02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xaec8); + MP_WritePhyUshort(sc, 0x06, 0x70e4); + MP_WritePhyUshort(sc, 0x06, 0x2602); + MP_WritePhyUshort(sc, 0x06, 0x82d1); + MP_WritePhyUshort(sc, 0x06, 0x05f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0xe2fe); + MP_WritePhyUshort(sc, 0x06, 0xe1e2); + MP_WritePhyUshort(sc, 0x06, 0xffad); + MP_WritePhyUshort(sc, 0x06, 0x2d1a); + MP_WritePhyUshort(sc, 0x06, 0xe0e1); + MP_WritePhyUshort(sc, 0x06, 0x4ee1); + MP_WritePhyUshort(sc, 0x06, 0xe14f); + MP_WritePhyUshort(sc, 0x06, 0xac2d); + MP_WritePhyUshort(sc, 0x06, 0x22f6); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x033b); + MP_WritePhyUshort(sc, 0x06, 0xf703); + MP_WritePhyUshort(sc, 0x06, 0xf706); + MP_WritePhyUshort(sc, 0x06, 0xbf84); + MP_WritePhyUshort(sc, 0x06, 0x4402); + MP_WritePhyUshort(sc, 0x06, 0x2d21); + MP_WritePhyUshort(sc, 0x06, 0xae11); + MP_WritePhyUshort(sc, 0x06, 0xe0e1); + MP_WritePhyUshort(sc, 0x06, 0x4ee1); + MP_WritePhyUshort(sc, 0x06, 0xe14f); + MP_WritePhyUshort(sc, 0x06, 0xad2d); + MP_WritePhyUshort(sc, 0x06, 0x08bf); + MP_WritePhyUshort(sc, 0x06, 0x844f); + MP_WritePhyUshort(sc, 0x06, 0x022d); + MP_WritePhyUshort(sc, 0x06, 0x21f6); + MP_WritePhyUshort(sc, 0x06, 0x06ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0x4502); + MP_WritePhyUshort(sc, 0x06, 0x83a2); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe001); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x1fd1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x843b); + MP_WritePhyUshort(sc, 0x06, 0x022d); + MP_WritePhyUshort(sc, 0x06, 0xc1e0); + MP_WritePhyUshort(sc, 0x06, 0xe020); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x21ad); + MP_WritePhyUshort(sc, 0x06, 0x200e); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf84); + MP_WritePhyUshort(sc, 0x06, 0x3b02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xbf3b); + MP_WritePhyUshort(sc, 0x06, 0x9602); + MP_WritePhyUshort(sc, 0x06, 0x2d21); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x204c); + MP_WritePhyUshort(sc, 0x06, 0xd200); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x0058); + MP_WritePhyUshort(sc, 0x06, 0x010c); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0x5810); + MP_WritePhyUshort(sc, 0x06, 0x1e20); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x3658); + MP_WritePhyUshort(sc, 0x06, 0x031e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xe01e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0x8b64); + MP_WritePhyUshort(sc, 0x06, 0x1f02); + MP_WritePhyUshort(sc, 0x06, 0x9e22); + MP_WritePhyUshort(sc, 0x06, 0xe68b); + MP_WritePhyUshort(sc, 0x06, 0x64ad); + MP_WritePhyUshort(sc, 0x06, 0x3214); + MP_WritePhyUshort(sc, 0x06, 0xad34); + MP_WritePhyUshort(sc, 0x06, 0x11ef); + MP_WritePhyUshort(sc, 0x06, 0x0258); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x07ad); + MP_WritePhyUshort(sc, 0x06, 0x3508); + MP_WritePhyUshort(sc, 0x06, 0x5ac0); + MP_WritePhyUshort(sc, 0x06, 0x9f04); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xae02); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf84); + MP_WritePhyUshort(sc, 0x06, 0x3e02); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfbe0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x22e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x23e2); + MP_WritePhyUshort(sc, 0x06, 0xe036); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0x375a); + MP_WritePhyUshort(sc, 0x06, 0xc40d); + MP_WritePhyUshort(sc, 0x06, 0x0158); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x20e3); + MP_WritePhyUshort(sc, 0x06, 0x8ae7); + MP_WritePhyUshort(sc, 0x06, 0xac31); + MP_WritePhyUshort(sc, 0x06, 0x60ac); + MP_WritePhyUshort(sc, 0x06, 0x3a08); + MP_WritePhyUshort(sc, 0x06, 0xac3e); + MP_WritePhyUshort(sc, 0x06, 0x26ae); + MP_WritePhyUshort(sc, 0x06, 0x67af); + MP_WritePhyUshort(sc, 0x06, 0x8437); + MP_WritePhyUshort(sc, 0x06, 0xad37); + MP_WritePhyUshort(sc, 0x06, 0x61e0); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xe91b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x51d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8441); + MP_WritePhyUshort(sc, 0x06, 0x022d); + MP_WritePhyUshort(sc, 0x06, 0xc1ee); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x43ad); + MP_WritePhyUshort(sc, 0x06, 0x3627); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xeee1); + MP_WritePhyUshort(sc, 0x06, 0x8aef); + MP_WritePhyUshort(sc, 0x06, 0xef74); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xeae1); + MP_WritePhyUshort(sc, 0x06, 0x8aeb); + MP_WritePhyUshort(sc, 0x06, 0x1b74); + MP_WritePhyUshort(sc, 0x06, 0x9e2e); + MP_WritePhyUshort(sc, 0x06, 0x14e4); + MP_WritePhyUshort(sc, 0x06, 0x8aea); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xebef); + MP_WritePhyUshort(sc, 0x06, 0x74e0); + MP_WritePhyUshort(sc, 0x06, 0x8aee); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xef1b); + MP_WritePhyUshort(sc, 0x06, 0x479e); + MP_WritePhyUshort(sc, 0x06, 0x0fae); + MP_WritePhyUshort(sc, 0x06, 0x19ee); + MP_WritePhyUshort(sc, 0x06, 0x8aea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8aeb); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x0fac); + MP_WritePhyUshort(sc, 0x06, 0x390c); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf84); + MP_WritePhyUshort(sc, 0x06, 0x4102); + MP_WritePhyUshort(sc, 0x06, 0x2dc1); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe800); + MP_WritePhyUshort(sc, 0x06, 0xe68a); + MP_WritePhyUshort(sc, 0x06, 0xe7ff); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x0400); + MP_WritePhyUshort(sc, 0x06, 0xe234); + MP_WritePhyUshort(sc, 0x06, 0xcce2); + MP_WritePhyUshort(sc, 0x06, 0x0088); + MP_WritePhyUshort(sc, 0x06, 0xe200); + MP_WritePhyUshort(sc, 0x06, 0xa725); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x1de5); + MP_WritePhyUshort(sc, 0x06, 0x0a2c); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x6de5); + MP_WritePhyUshort(sc, 0x06, 0x0a1d); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x1ce5); + MP_WritePhyUshort(sc, 0x06, 0x0a2d); + MP_WritePhyUshort(sc, 0x06, 0xa755); + MP_WritePhyUshort(sc, 0x05, 0x8b64); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8b94); + MP_WritePhyUshort(sc, 0x06, 0x82cd); + MP_WritePhyUshort(sc, 0x05, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0x2000); + MP_WritePhyUshort(sc, 0x05, 0x8aee); + MP_WritePhyUshort(sc, 0x06, 0x03b8); + MP_WritePhyUshort(sc, 0x05, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x01); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x01, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i=0; i<200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue&0x0080) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0028); + MP_WritePhyUshort(sc, 0x15, 0x0010); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0041); + MP_WritePhyUshort(sc, 0x15, 0x0802); + MP_WritePhyUshort(sc, 0x16, 0x2185); + MP_WritePhyUshort(sc, 0x1f, 0x0000); +} + +static void re_set_phy_mcu_8168e_2(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + if (MP_ReadEfuse(sc, 0x22) == 0x0c) { + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x17, 0x0117); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002C); + MP_WritePhyUshort(sc, 0x1B, 0x5000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x4104); + for (i=0; i<200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1E); + PhyRegValue &= 0x03FF; + if (PhyRegValue== 0x000C) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i=0; i<200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if ((PhyRegValue&0x0020)==0) + break; + } + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if (PhyRegValue & 0x0020) { + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x00a1); + MP_WritePhyUshort(sc, 0x17, 0x1000); + MP_WritePhyUshort(sc, 0x17, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2000); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + MP_WritePhyUshort(sc, 0x18, 0x9bfb); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x07, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue &= ~(BIT_7); + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x08); + PhyRegValue &= ~(BIT_7); + MP_WritePhyUshort(sc, 0x08, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x000e); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x0010); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x0018); + MP_WritePhyUshort(sc, 0x19, 0x4801); + MP_WritePhyUshort(sc, 0x15, 0x0019); + MP_WritePhyUshort(sc, 0x19, 0x6801); + MP_WritePhyUshort(sc, 0x15, 0x001a); + MP_WritePhyUshort(sc, 0x19, 0x66a1); + MP_WritePhyUshort(sc, 0x15, 0x001f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0020); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0021); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0022); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0023); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0024); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0025); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0026); + MP_WritePhyUshort(sc, 0x19, 0x40ea); + MP_WritePhyUshort(sc, 0x15, 0x0027); + MP_WritePhyUshort(sc, 0x19, 0x4503); + MP_WritePhyUshort(sc, 0x15, 0x0028); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0029); + MP_WritePhyUshort(sc, 0x19, 0xa631); + MP_WritePhyUshort(sc, 0x15, 0x002a); + MP_WritePhyUshort(sc, 0x19, 0x9717); + MP_WritePhyUshort(sc, 0x15, 0x002b); + MP_WritePhyUshort(sc, 0x19, 0x302c); + MP_WritePhyUshort(sc, 0x15, 0x002c); + MP_WritePhyUshort(sc, 0x19, 0x4802); + MP_WritePhyUshort(sc, 0x15, 0x002d); + MP_WritePhyUshort(sc, 0x19, 0x58da); + MP_WritePhyUshort(sc, 0x15, 0x002e); + MP_WritePhyUshort(sc, 0x19, 0x400d); + MP_WritePhyUshort(sc, 0x15, 0x002f); + MP_WritePhyUshort(sc, 0x19, 0x4488); + MP_WritePhyUshort(sc, 0x15, 0x0030); + MP_WritePhyUshort(sc, 0x19, 0x9e00); + MP_WritePhyUshort(sc, 0x15, 0x0031); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0032); + MP_WritePhyUshort(sc, 0x19, 0x6481); + MP_WritePhyUshort(sc, 0x15, 0x0033); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0034); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0035); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0036); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0037); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0038); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0039); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x003a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x003b); + MP_WritePhyUshort(sc, 0x19, 0x63e8); + MP_WritePhyUshort(sc, 0x15, 0x003c); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x003d); + MP_WritePhyUshort(sc, 0x19, 0x59d4); + MP_WritePhyUshort(sc, 0x15, 0x003e); + MP_WritePhyUshort(sc, 0x19, 0x63f8); + MP_WritePhyUshort(sc, 0x15, 0x0040); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0041); + MP_WritePhyUshort(sc, 0x19, 0x30de); + MP_WritePhyUshort(sc, 0x15, 0x0044); + MP_WritePhyUshort(sc, 0x19, 0x480f); + MP_WritePhyUshort(sc, 0x15, 0x0045); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x0046); + MP_WritePhyUshort(sc, 0x19, 0x6680); + MP_WritePhyUshort(sc, 0x15, 0x0047); + MP_WritePhyUshort(sc, 0x19, 0x7c10); + MP_WritePhyUshort(sc, 0x15, 0x0048); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0049); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004f); + MP_WritePhyUshort(sc, 0x19, 0x40ea); + MP_WritePhyUshort(sc, 0x15, 0x0050); + MP_WritePhyUshort(sc, 0x19, 0x4503); + MP_WritePhyUshort(sc, 0x15, 0x0051); + MP_WritePhyUshort(sc, 0x19, 0x58ca); + MP_WritePhyUshort(sc, 0x15, 0x0052); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0053); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x0054); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x0055); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0056); + MP_WritePhyUshort(sc, 0x19, 0x3000); + MP_WritePhyUshort(sc, 0x15, 0x00a1); + MP_WritePhyUshort(sc, 0x19, 0x3044); + MP_WritePhyUshort(sc, 0x15, 0x00ab); + MP_WritePhyUshort(sc, 0x19, 0x5820); + MP_WritePhyUshort(sc, 0x15, 0x00ac); + MP_WritePhyUshort(sc, 0x19, 0x5e04); + MP_WritePhyUshort(sc, 0x15, 0x00ad); + MP_WritePhyUshort(sc, 0x19, 0xb60c); + MP_WritePhyUshort(sc, 0x15, 0x00af); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x00b2); + MP_WritePhyUshort(sc, 0x19, 0x30b9); + MP_WritePhyUshort(sc, 0x15, 0x00b9); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x00ba); + MP_WritePhyUshort(sc, 0x19, 0x480b); + MP_WritePhyUshort(sc, 0x15, 0x00bb); + MP_WritePhyUshort(sc, 0x19, 0x5e00); + MP_WritePhyUshort(sc, 0x15, 0x00bc); + MP_WritePhyUshort(sc, 0x19, 0x405f); + MP_WritePhyUshort(sc, 0x15, 0x00bd); + MP_WritePhyUshort(sc, 0x19, 0x4448); + MP_WritePhyUshort(sc, 0x15, 0x00be); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x00bf); + MP_WritePhyUshort(sc, 0x19, 0x4468); + MP_WritePhyUshort(sc, 0x15, 0x00c0); + MP_WritePhyUshort(sc, 0x19, 0x9c02); + MP_WritePhyUshort(sc, 0x15, 0x00c1); + MP_WritePhyUshort(sc, 0x19, 0x58a0); + MP_WritePhyUshort(sc, 0x15, 0x00c2); + MP_WritePhyUshort(sc, 0x19, 0xb605); + MP_WritePhyUshort(sc, 0x15, 0x00c3); + MP_WritePhyUshort(sc, 0x19, 0xc0d3); + MP_WritePhyUshort(sc, 0x15, 0x00c4); + MP_WritePhyUshort(sc, 0x19, 0x00e6); + MP_WritePhyUshort(sc, 0x15, 0x00c5); + MP_WritePhyUshort(sc, 0x19, 0xdaec); + MP_WritePhyUshort(sc, 0x15, 0x00c6); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00c7); + MP_WritePhyUshort(sc, 0x19, 0x9df9); + MP_WritePhyUshort(sc, 0x15, 0x0112); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0113); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0114); + MP_WritePhyUshort(sc, 0x19, 0x63f0); + MP_WritePhyUshort(sc, 0x15, 0x0115); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0116); + MP_WritePhyUshort(sc, 0x19, 0x4418); + MP_WritePhyUshort(sc, 0x15, 0x0117); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x15, 0x0118); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0119); + MP_WritePhyUshort(sc, 0x19, 0x64e1); + MP_WritePhyUshort(sc, 0x15, 0x011a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0150); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0151); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0152); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0153); + MP_WritePhyUshort(sc, 0x19, 0x4540); + MP_WritePhyUshort(sc, 0x15, 0x0154); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0155); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x15, 0x0156); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0157); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0158); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0159); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x015a); + MP_WritePhyUshort(sc, 0x19, 0x30fe); + MP_WritePhyUshort(sc, 0x15, 0x029c); + MP_WritePhyUshort(sc, 0x19, 0x0070); + MP_WritePhyUshort(sc, 0x15, 0x02b2); + MP_WritePhyUshort(sc, 0x19, 0x005a); + MP_WritePhyUshort(sc, 0x15, 0x02bd); + MP_WritePhyUshort(sc, 0x19, 0xa522); + MP_WritePhyUshort(sc, 0x15, 0x02ce); + MP_WritePhyUshort(sc, 0x19, 0xb63e); + MP_WritePhyUshort(sc, 0x15, 0x02d9); + MP_WritePhyUshort(sc, 0x19, 0x32df); + MP_WritePhyUshort(sc, 0x15, 0x02df); + MP_WritePhyUshort(sc, 0x19, 0x4500); + MP_WritePhyUshort(sc, 0x15, 0x02e7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02f4); + MP_WritePhyUshort(sc, 0x19, 0xb618); + MP_WritePhyUshort(sc, 0x15, 0x02fb); + MP_WritePhyUshort(sc, 0x19, 0xb900); + MP_WritePhyUshort(sc, 0x15, 0x02fc); + MP_WritePhyUshort(sc, 0x19, 0x49b5); + MP_WritePhyUshort(sc, 0x15, 0x02fd); + MP_WritePhyUshort(sc, 0x19, 0x6812); + MP_WritePhyUshort(sc, 0x15, 0x02fe); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x02ff); + MP_WritePhyUshort(sc, 0x19, 0x9900); + MP_WritePhyUshort(sc, 0x15, 0x0300); + MP_WritePhyUshort(sc, 0x19, 0x64a0); + MP_WritePhyUshort(sc, 0x15, 0x0301); + MP_WritePhyUshort(sc, 0x19, 0x3316); + MP_WritePhyUshort(sc, 0x15, 0x0308); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030c); + MP_WritePhyUshort(sc, 0x19, 0x3000); + MP_WritePhyUshort(sc, 0x15, 0x0312); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0313); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0314); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0315); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0316); + MP_WritePhyUshort(sc, 0x19, 0x49b5); + MP_WritePhyUshort(sc, 0x15, 0x0317); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x0318); + MP_WritePhyUshort(sc, 0x19, 0x4d00); + MP_WritePhyUshort(sc, 0x15, 0x0319); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x031a); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x031b); + MP_WritePhyUshort(sc, 0x19, 0x4925); + MP_WritePhyUshort(sc, 0x15, 0x031c); + MP_WritePhyUshort(sc, 0x19, 0x403b); + MP_WritePhyUshort(sc, 0x15, 0x031d); + MP_WritePhyUshort(sc, 0x19, 0xa602); + MP_WritePhyUshort(sc, 0x15, 0x031e); + MP_WritePhyUshort(sc, 0x19, 0x402f); + MP_WritePhyUshort(sc, 0x15, 0x031f); + MP_WritePhyUshort(sc, 0x19, 0x4484); + MP_WritePhyUshort(sc, 0x15, 0x0320); + MP_WritePhyUshort(sc, 0x19, 0x40c8); + MP_WritePhyUshort(sc, 0x15, 0x0321); + MP_WritePhyUshort(sc, 0x19, 0x44c4); + MP_WritePhyUshort(sc, 0x15, 0x0322); + MP_WritePhyUshort(sc, 0x19, 0x404f); + MP_WritePhyUshort(sc, 0x15, 0x0323); + MP_WritePhyUshort(sc, 0x19, 0x44c8); + MP_WritePhyUshort(sc, 0x15, 0x0324); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0325); + MP_WritePhyUshort(sc, 0x19, 0x00e7); + MP_WritePhyUshort(sc, 0x15, 0x0326); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0327); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x0328); + MP_WritePhyUshort(sc, 0x19, 0x4d48); + MP_WritePhyUshort(sc, 0x15, 0x0329); + MP_WritePhyUshort(sc, 0x19, 0x332b); + MP_WritePhyUshort(sc, 0x15, 0x032a); + MP_WritePhyUshort(sc, 0x19, 0x4d40); + MP_WritePhyUshort(sc, 0x15, 0x032c); + MP_WritePhyUshort(sc, 0x19, 0x00f8); + MP_WritePhyUshort(sc, 0x15, 0x032d); + MP_WritePhyUshort(sc, 0x19, 0x82b2); + MP_WritePhyUshort(sc, 0x15, 0x032f); + MP_WritePhyUshort(sc, 0x19, 0x00b0); + MP_WritePhyUshort(sc, 0x15, 0x0332); + MP_WritePhyUshort(sc, 0x19, 0x91f2); + MP_WritePhyUshort(sc, 0x15, 0x033f); + MP_WritePhyUshort(sc, 0x19, 0xb6cd); + MP_WritePhyUshort(sc, 0x15, 0x0340); + MP_WritePhyUshort(sc, 0x19, 0x9e01); + MP_WritePhyUshort(sc, 0x15, 0x0341); + MP_WritePhyUshort(sc, 0x19, 0xd11d); + MP_WritePhyUshort(sc, 0x15, 0x0342); + MP_WritePhyUshort(sc, 0x19, 0x009d); + MP_WritePhyUshort(sc, 0x15, 0x0343); + MP_WritePhyUshort(sc, 0x19, 0xbb1c); + MP_WritePhyUshort(sc, 0x15, 0x0344); + MP_WritePhyUshort(sc, 0x19, 0x8102); + MP_WritePhyUshort(sc, 0x15, 0x0345); + MP_WritePhyUshort(sc, 0x19, 0x3348); + MP_WritePhyUshort(sc, 0x15, 0x0346); + MP_WritePhyUshort(sc, 0x19, 0xa231); + MP_WritePhyUshort(sc, 0x15, 0x0347); + MP_WritePhyUshort(sc, 0x19, 0x335b); + MP_WritePhyUshort(sc, 0x15, 0x0348); + MP_WritePhyUshort(sc, 0x19, 0x91f7); + MP_WritePhyUshort(sc, 0x15, 0x0349); + MP_WritePhyUshort(sc, 0x19, 0xc218); + MP_WritePhyUshort(sc, 0x15, 0x034a); + MP_WritePhyUshort(sc, 0x19, 0x00f5); + MP_WritePhyUshort(sc, 0x15, 0x034b); + MP_WritePhyUshort(sc, 0x19, 0x335b); + MP_WritePhyUshort(sc, 0x15, 0x034c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x034d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x034e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x034f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0350); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x035b); + MP_WritePhyUshort(sc, 0x19, 0xa23c); + MP_WritePhyUshort(sc, 0x15, 0x035c); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x035d); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x035e); + MP_WritePhyUshort(sc, 0x19, 0x3397); + MP_WritePhyUshort(sc, 0x15, 0x0363); + MP_WritePhyUshort(sc, 0x19, 0xb6a9); + MP_WritePhyUshort(sc, 0x15, 0x0366); + MP_WritePhyUshort(sc, 0x19, 0x00f5); + MP_WritePhyUshort(sc, 0x15, 0x0382); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0388); + MP_WritePhyUshort(sc, 0x19, 0x0084); + MP_WritePhyUshort(sc, 0x15, 0x0389); + MP_WritePhyUshort(sc, 0x19, 0xdd17); + MP_WritePhyUshort(sc, 0x15, 0x038a); + MP_WritePhyUshort(sc, 0x19, 0x000b); + MP_WritePhyUshort(sc, 0x15, 0x038b); + MP_WritePhyUshort(sc, 0x19, 0xa10a); + MP_WritePhyUshort(sc, 0x15, 0x038c); + MP_WritePhyUshort(sc, 0x19, 0x337e); + MP_WritePhyUshort(sc, 0x15, 0x038d); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x038e); + MP_WritePhyUshort(sc, 0x19, 0xa107); + MP_WritePhyUshort(sc, 0x15, 0x038f); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x0390); + MP_WritePhyUshort(sc, 0x19, 0xc017); + MP_WritePhyUshort(sc, 0x15, 0x0391); + MP_WritePhyUshort(sc, 0x19, 0x0004); + MP_WritePhyUshort(sc, 0x15, 0x0392); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0393); + MP_WritePhyUshort(sc, 0x19, 0x00f4); + MP_WritePhyUshort(sc, 0x15, 0x0397); + MP_WritePhyUshort(sc, 0x19, 0x4098); + MP_WritePhyUshort(sc, 0x15, 0x0398); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x0399); + MP_WritePhyUshort(sc, 0x19, 0x55bf); + MP_WritePhyUshort(sc, 0x15, 0x039a); + MP_WritePhyUshort(sc, 0x19, 0x4bb9); + MP_WritePhyUshort(sc, 0x15, 0x039b); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x039c); + MP_WritePhyUshort(sc, 0x19, 0x4b29); + MP_WritePhyUshort(sc, 0x15, 0x039d); + MP_WritePhyUshort(sc, 0x19, 0x4041); + MP_WritePhyUshort(sc, 0x15, 0x039e); + MP_WritePhyUshort(sc, 0x19, 0x442a); + MP_WritePhyUshort(sc, 0x15, 0x039f); + MP_WritePhyUshort(sc, 0x19, 0x4029); + MP_WritePhyUshort(sc, 0x15, 0x03aa); + MP_WritePhyUshort(sc, 0x19, 0x33b8); + MP_WritePhyUshort(sc, 0x15, 0x03b6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b8); + MP_WritePhyUshort(sc, 0x19, 0x543f); + MP_WritePhyUshort(sc, 0x15, 0x03b9); + MP_WritePhyUshort(sc, 0x19, 0x499a); + MP_WritePhyUshort(sc, 0x15, 0x03ba); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x03bb); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03bc); + MP_WritePhyUshort(sc, 0x19, 0x490a); + MP_WritePhyUshort(sc, 0x15, 0x03bd); + MP_WritePhyUshort(sc, 0x19, 0x405e); + MP_WritePhyUshort(sc, 0x15, 0x03c2); + MP_WritePhyUshort(sc, 0x19, 0x9a03); + MP_WritePhyUshort(sc, 0x15, 0x03c4); + MP_WritePhyUshort(sc, 0x19, 0x0015); + MP_WritePhyUshort(sc, 0x15, 0x03c5); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x03c8); + MP_WritePhyUshort(sc, 0x19, 0x9cf7); + MP_WritePhyUshort(sc, 0x15, 0x03c9); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03ca); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03cb); + MP_WritePhyUshort(sc, 0x19, 0x4458); + MP_WritePhyUshort(sc, 0x15, 0x03cd); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03ce); + MP_WritePhyUshort(sc, 0x19, 0x33bf); + MP_WritePhyUshort(sc, 0x15, 0x03cf); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d0); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d1); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d9); + MP_WritePhyUshort(sc, 0x19, 0x49bb); + MP_WritePhyUshort(sc, 0x15, 0x03da); + MP_WritePhyUshort(sc, 0x19, 0x4478); + MP_WritePhyUshort(sc, 0x15, 0x03db); + MP_WritePhyUshort(sc, 0x19, 0x492b); + MP_WritePhyUshort(sc, 0x15, 0x03dc); + MP_WritePhyUshort(sc, 0x19, 0x7c01); + MP_WritePhyUshort(sc, 0x15, 0x03dd); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x03de); + MP_WritePhyUshort(sc, 0x19, 0xbd1a); + MP_WritePhyUshort(sc, 0x15, 0x03df); + MP_WritePhyUshort(sc, 0x19, 0xc428); + MP_WritePhyUshort(sc, 0x15, 0x03e0); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x03e1); + MP_WritePhyUshort(sc, 0x19, 0x9cfd); + MP_WritePhyUshort(sc, 0x15, 0x03e2); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03e3); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03e4); + MP_WritePhyUshort(sc, 0x19, 0x4458); + MP_WritePhyUshort(sc, 0x15, 0x03e5); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03e6); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03e7); + MP_WritePhyUshort(sc, 0x19, 0x33de); + MP_WritePhyUshort(sc, 0x15, 0x03e8); + MP_WritePhyUshort(sc, 0x19, 0xc218); + MP_WritePhyUshort(sc, 0x15, 0x03e9); + MP_WritePhyUshort(sc, 0x19, 0x0002); + MP_WritePhyUshort(sc, 0x15, 0x03ea); + MP_WritePhyUshort(sc, 0x19, 0x32df); + MP_WritePhyUshort(sc, 0x15, 0x03eb); + MP_WritePhyUshort(sc, 0x19, 0x3316); + MP_WritePhyUshort(sc, 0x15, 0x03ec); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ed); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ee); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ef); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03f7); + MP_WritePhyUshort(sc, 0x19, 0x330c); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x0200); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x9002); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x0202); + MP_WritePhyUshort(sc, 0x06, 0x3402); + MP_WritePhyUshort(sc, 0x06, 0x027f); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0xa602); + MP_WritePhyUshort(sc, 0x06, 0x80bf); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe600); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xee03); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xefb8); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe902); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8285); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8520); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8701); + MP_WritePhyUshort(sc, 0x06, 0xd481); + MP_WritePhyUshort(sc, 0x06, 0x35e4); + MP_WritePhyUshort(sc, 0x06, 0x8b94); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x95bf); + MP_WritePhyUshort(sc, 0x06, 0x8b88); + MP_WritePhyUshort(sc, 0x06, 0xec00); + MP_WritePhyUshort(sc, 0x06, 0x19a9); + MP_WritePhyUshort(sc, 0x06, 0x8b90); + MP_WritePhyUshort(sc, 0x06, 0xf9ee); + MP_WritePhyUshort(sc, 0x06, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x41f7); + MP_WritePhyUshort(sc, 0x06, 0x2ff6); + MP_WritePhyUshort(sc, 0x06, 0x28e4); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xe5e1); + MP_WritePhyUshort(sc, 0x06, 0x4104); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x0dee); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x82f4); + MP_WritePhyUshort(sc, 0x06, 0x021f); + MP_WritePhyUshort(sc, 0x06, 0x4102); + MP_WritePhyUshort(sc, 0x06, 0x2812); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x10ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x139d); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xd602); + MP_WritePhyUshort(sc, 0x06, 0x1f99); + MP_WritePhyUshort(sc, 0x06, 0x0227); + MP_WritePhyUshort(sc, 0x06, 0xeafc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2014); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x8104); + MP_WritePhyUshort(sc, 0x06, 0x021b); + MP_WritePhyUshort(sc, 0x06, 0xf402); + MP_WritePhyUshort(sc, 0x06, 0x2c9c); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x7902); + MP_WritePhyUshort(sc, 0x06, 0x8443); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x11f6); + MP_WritePhyUshort(sc, 0x06, 0x22e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x022c); + MP_WritePhyUshort(sc, 0x06, 0x4602); + MP_WritePhyUshort(sc, 0x06, 0x2ac5); + MP_WritePhyUshort(sc, 0x06, 0x0229); + MP_WritePhyUshort(sc, 0x06, 0x2002); + MP_WritePhyUshort(sc, 0x06, 0x2b91); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x11f6); + MP_WritePhyUshort(sc, 0x06, 0x25e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0xe202); + MP_WritePhyUshort(sc, 0x06, 0x043a); + MP_WritePhyUshort(sc, 0x06, 0x021a); + MP_WritePhyUshort(sc, 0x06, 0x5902); + MP_WritePhyUshort(sc, 0x06, 0x2bfc); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe001); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x1fd1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8638); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50e0); + MP_WritePhyUshort(sc, 0x06, 0xe020); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x21ad); + MP_WritePhyUshort(sc, 0x06, 0x200e); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xbf3d); + MP_WritePhyUshort(sc, 0x06, 0x3902); + MP_WritePhyUshort(sc, 0x06, 0x2eb0); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x0402); + MP_WritePhyUshort(sc, 0x06, 0x8591); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x3c05); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xfee1); + MP_WritePhyUshort(sc, 0x06, 0xe2ff); + MP_WritePhyUshort(sc, 0x06, 0xad2d); + MP_WritePhyUshort(sc, 0x06, 0x1ae0); + MP_WritePhyUshort(sc, 0x06, 0xe14e); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x4fac); + MP_WritePhyUshort(sc, 0x06, 0x2d22); + MP_WritePhyUshort(sc, 0x06, 0xf603); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x36f7); + MP_WritePhyUshort(sc, 0x06, 0x03f7); + MP_WritePhyUshort(sc, 0x06, 0x06bf); + MP_WritePhyUshort(sc, 0x06, 0x8622); + MP_WritePhyUshort(sc, 0x06, 0x022e); + MP_WritePhyUshort(sc, 0x06, 0xb0ae); + MP_WritePhyUshort(sc, 0x06, 0x11e0); + MP_WritePhyUshort(sc, 0x06, 0xe14e); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x4fad); + MP_WritePhyUshort(sc, 0x06, 0x2d08); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x2d02); + MP_WritePhyUshort(sc, 0x06, 0x2eb0); + MP_WritePhyUshort(sc, 0x06, 0xf606); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x204c); + MP_WritePhyUshort(sc, 0x06, 0xd200); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x0058); + MP_WritePhyUshort(sc, 0x06, 0x010c); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0x5810); + MP_WritePhyUshort(sc, 0x06, 0x1e20); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x3658); + MP_WritePhyUshort(sc, 0x06, 0x031e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xe01e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0x8ae6); + MP_WritePhyUshort(sc, 0x06, 0x1f02); + MP_WritePhyUshort(sc, 0x06, 0x9e22); + MP_WritePhyUshort(sc, 0x06, 0xe68a); + MP_WritePhyUshort(sc, 0x06, 0xe6ad); + MP_WritePhyUshort(sc, 0x06, 0x3214); + MP_WritePhyUshort(sc, 0x06, 0xad34); + MP_WritePhyUshort(sc, 0x06, 0x11ef); + MP_WritePhyUshort(sc, 0x06, 0x0258); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x07ad); + MP_WritePhyUshort(sc, 0x06, 0x3508); + MP_WritePhyUshort(sc, 0x06, 0x5ac0); + MP_WritePhyUshort(sc, 0x06, 0x9f04); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xae02); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x3e02); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfae0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac26); + MP_WritePhyUshort(sc, 0x06, 0x0ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xac24); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x6bee); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xe0eb); + MP_WritePhyUshort(sc, 0x06, 0x00e2); + MP_WritePhyUshort(sc, 0x06, 0xe07c); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0x7da5); + MP_WritePhyUshort(sc, 0x06, 0x1111); + MP_WritePhyUshort(sc, 0x06, 0x15d2); + MP_WritePhyUshort(sc, 0x06, 0x60d6); + MP_WritePhyUshort(sc, 0x06, 0x6666); + MP_WritePhyUshort(sc, 0x06, 0x0207); + MP_WritePhyUshort(sc, 0x06, 0xf9d2); + MP_WritePhyUshort(sc, 0x06, 0xa0d6); + MP_WritePhyUshort(sc, 0x06, 0xaaaa); + MP_WritePhyUshort(sc, 0x06, 0x0207); + MP_WritePhyUshort(sc, 0x06, 0xf902); + MP_WritePhyUshort(sc, 0x06, 0x825c); + MP_WritePhyUshort(sc, 0x06, 0xae44); + MP_WritePhyUshort(sc, 0x06, 0xa566); + MP_WritePhyUshort(sc, 0x06, 0x6602); + MP_WritePhyUshort(sc, 0x06, 0xae38); + MP_WritePhyUshort(sc, 0x06, 0xa5aa); + MP_WritePhyUshort(sc, 0x06, 0xaa02); + MP_WritePhyUshort(sc, 0x06, 0xae32); + MP_WritePhyUshort(sc, 0x06, 0xeee0); + MP_WritePhyUshort(sc, 0x06, 0xea04); + MP_WritePhyUshort(sc, 0x06, 0xeee0); + MP_WritePhyUshort(sc, 0x06, 0xeb06); + MP_WritePhyUshort(sc, 0x06, 0xe2e0); + MP_WritePhyUshort(sc, 0x06, 0x7ce3); + MP_WritePhyUshort(sc, 0x06, 0xe07d); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x38e1); + MP_WritePhyUshort(sc, 0x06, 0xe039); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x21ad); + MP_WritePhyUshort(sc, 0x06, 0x3f13); + MP_WritePhyUshort(sc, 0x06, 0xe0e4); + MP_WritePhyUshort(sc, 0x06, 0x14e1); + MP_WritePhyUshort(sc, 0x06, 0xe415); + MP_WritePhyUshort(sc, 0x06, 0x6880); + MP_WritePhyUshort(sc, 0x06, 0xe4e4); + MP_WritePhyUshort(sc, 0x06, 0x14e5); + MP_WritePhyUshort(sc, 0x06, 0xe415); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x5cae); + MP_WritePhyUshort(sc, 0x06, 0x0bac); + MP_WritePhyUshort(sc, 0x06, 0x3e02); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x8602); + MP_WritePhyUshort(sc, 0x06, 0x82b0); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2605); + MP_WritePhyUshort(sc, 0x06, 0x0221); + MP_WritePhyUshort(sc, 0x06, 0xf3f7); + MP_WritePhyUshort(sc, 0x06, 0x28e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xad21); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x22f8); + MP_WritePhyUshort(sc, 0x06, 0xf729); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2405); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xebf7); + MP_WritePhyUshort(sc, 0x06, 0x2ae5); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x2134); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2109); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x2eac); + MP_WritePhyUshort(sc, 0x06, 0x2003); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0x52e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x09e0); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x8337); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2608); + MP_WritePhyUshort(sc, 0x06, 0xe085); + MP_WritePhyUshort(sc, 0x06, 0xd2ad); + MP_WritePhyUshort(sc, 0x06, 0x2502); + MP_WritePhyUshort(sc, 0x06, 0xf628); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x210a); + MP_WritePhyUshort(sc, 0x06, 0xe086); + MP_WritePhyUshort(sc, 0x06, 0x0af6); + MP_WritePhyUshort(sc, 0x06, 0x27a0); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0xf629); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2408); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xedad); + MP_WritePhyUshort(sc, 0x06, 0x2002); + MP_WritePhyUshort(sc, 0x06, 0xf62a); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x2ea1); + MP_WritePhyUshort(sc, 0x06, 0x0003); + MP_WritePhyUshort(sc, 0x06, 0x0221); + MP_WritePhyUshort(sc, 0x06, 0x11fc); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x8aed); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8aec); + MP_WritePhyUshort(sc, 0x06, 0x0004); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x3ae0); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xeb58); + MP_WritePhyUshort(sc, 0x06, 0xf8d1); + MP_WritePhyUshort(sc, 0x06, 0x01e4); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0xebe0); + MP_WritePhyUshort(sc, 0x06, 0xe07c); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x7d5c); + MP_WritePhyUshort(sc, 0x06, 0x00ff); + MP_WritePhyUshort(sc, 0x06, 0x3c00); + MP_WritePhyUshort(sc, 0x06, 0x1eab); + MP_WritePhyUshort(sc, 0x06, 0x1ce0); + MP_WritePhyUshort(sc, 0x06, 0xe04c); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x4d58); + MP_WritePhyUshort(sc, 0x06, 0xc1e4); + MP_WritePhyUshort(sc, 0x06, 0xe04c); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0x4de0); + MP_WritePhyUshort(sc, 0x06, 0xe0ee); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0x3ce4); + MP_WritePhyUshort(sc, 0x06, 0xe0ee); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0xeffc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2412); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0xeee1); + MP_WritePhyUshort(sc, 0x06, 0xe0ef); + MP_WritePhyUshort(sc, 0x06, 0x59c3); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0xeee5); + MP_WritePhyUshort(sc, 0x06, 0xe0ef); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xed01); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac25); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x8363); + MP_WritePhyUshort(sc, 0x06, 0xae03); + MP_WritePhyUshort(sc, 0x06, 0x0225); + MP_WritePhyUshort(sc, 0x06, 0x16fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfae0); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0xa000); + MP_WritePhyUshort(sc, 0x06, 0x19e0); + MP_WritePhyUshort(sc, 0x06, 0x860b); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x331b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x04aa); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x06ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0xe602); + MP_WritePhyUshort(sc, 0x06, 0x241e); + MP_WritePhyUshort(sc, 0x06, 0xae14); + MP_WritePhyUshort(sc, 0x06, 0xa001); + MP_WritePhyUshort(sc, 0x06, 0x1402); + MP_WritePhyUshort(sc, 0x06, 0x2426); + MP_WritePhyUshort(sc, 0x06, 0xbf26); + MP_WritePhyUshort(sc, 0x06, 0x6d02); + MP_WritePhyUshort(sc, 0x06, 0x2eb0); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0b00); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0a02); + MP_WritePhyUshort(sc, 0x06, 0xaf84); + MP_WritePhyUshort(sc, 0x06, 0x3ca0); + MP_WritePhyUshort(sc, 0x06, 0x0252); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0400); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0500); + MP_WritePhyUshort(sc, 0x06, 0xe086); + MP_WritePhyUshort(sc, 0x06, 0x0be1); + MP_WritePhyUshort(sc, 0x06, 0x8b32); + MP_WritePhyUshort(sc, 0x06, 0x1b10); + MP_WritePhyUshort(sc, 0x06, 0x9e04); + MP_WritePhyUshort(sc, 0x06, 0xaa02); + MP_WritePhyUshort(sc, 0x06, 0xaecb); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0b00); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x3ae2); + MP_WritePhyUshort(sc, 0x06, 0x8604); + MP_WritePhyUshort(sc, 0x06, 0xe386); + MP_WritePhyUshort(sc, 0x06, 0x05ef); + MP_WritePhyUshort(sc, 0x06, 0x65e2); + MP_WritePhyUshort(sc, 0x06, 0x8606); + MP_WritePhyUshort(sc, 0x06, 0xe386); + MP_WritePhyUshort(sc, 0x06, 0x071b); + MP_WritePhyUshort(sc, 0x06, 0x56aa); + MP_WritePhyUshort(sc, 0x06, 0x0eef); + MP_WritePhyUshort(sc, 0x06, 0x56e6); + MP_WritePhyUshort(sc, 0x06, 0x8606); + MP_WritePhyUshort(sc, 0x06, 0xe786); + MP_WritePhyUshort(sc, 0x06, 0x07e2); + MP_WritePhyUshort(sc, 0x06, 0x8609); + MP_WritePhyUshort(sc, 0x06, 0xe686); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8609); + MP_WritePhyUshort(sc, 0x06, 0xa000); + MP_WritePhyUshort(sc, 0x06, 0x07ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x03af); + MP_WritePhyUshort(sc, 0x06, 0x8369); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x2426); + MP_WritePhyUshort(sc, 0x06, 0xae48); + MP_WritePhyUshort(sc, 0x06, 0xa003); + MP_WritePhyUshort(sc, 0x06, 0x21e0); + MP_WritePhyUshort(sc, 0x06, 0x8608); + MP_WritePhyUshort(sc, 0x06, 0xe186); + MP_WritePhyUshort(sc, 0x06, 0x091b); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x0caa); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x249d); + MP_WritePhyUshort(sc, 0x06, 0xaee7); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x8eae); + MP_WritePhyUshort(sc, 0x06, 0xe2ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x860b); + MP_WritePhyUshort(sc, 0x06, 0x00af); + MP_WritePhyUshort(sc, 0x06, 0x8369); + MP_WritePhyUshort(sc, 0x06, 0xa004); + MP_WritePhyUshort(sc, 0x06, 0x15e0); + MP_WritePhyUshort(sc, 0x06, 0x860b); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x341b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x05aa); + MP_WritePhyUshort(sc, 0x06, 0x03af); + MP_WritePhyUshort(sc, 0x06, 0x8383); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0a05); + MP_WritePhyUshort(sc, 0x06, 0xae0c); + MP_WritePhyUshort(sc, 0x06, 0xa005); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x0702); + MP_WritePhyUshort(sc, 0x06, 0x2309); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0a00); + MP_WritePhyUshort(sc, 0x06, 0xfeef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfbe0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x22e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x23e2); + MP_WritePhyUshort(sc, 0x06, 0xe036); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0x375a); + MP_WritePhyUshort(sc, 0x06, 0xc40d); + MP_WritePhyUshort(sc, 0x06, 0x0158); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x20e3); + MP_WritePhyUshort(sc, 0x06, 0x8ae7); + MP_WritePhyUshort(sc, 0x06, 0xac31); + MP_WritePhyUshort(sc, 0x06, 0x60ac); + MP_WritePhyUshort(sc, 0x06, 0x3a08); + MP_WritePhyUshort(sc, 0x06, 0xac3e); + MP_WritePhyUshort(sc, 0x06, 0x26ae); + MP_WritePhyUshort(sc, 0x06, 0x67af); + MP_WritePhyUshort(sc, 0x06, 0x84db); + MP_WritePhyUshort(sc, 0x06, 0xad37); + MP_WritePhyUshort(sc, 0x06, 0x61e0); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xe91b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x51d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x863b); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50ee); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x43ad); + MP_WritePhyUshort(sc, 0x06, 0x3627); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xeee1); + MP_WritePhyUshort(sc, 0x06, 0x8aef); + MP_WritePhyUshort(sc, 0x06, 0xef74); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xeae1); + MP_WritePhyUshort(sc, 0x06, 0x8aeb); + MP_WritePhyUshort(sc, 0x06, 0x1b74); + MP_WritePhyUshort(sc, 0x06, 0x9e2e); + MP_WritePhyUshort(sc, 0x06, 0x14e4); + MP_WritePhyUshort(sc, 0x06, 0x8aea); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xebef); + MP_WritePhyUshort(sc, 0x06, 0x74e0); + MP_WritePhyUshort(sc, 0x06, 0x8aee); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xef1b); + MP_WritePhyUshort(sc, 0x06, 0x479e); + MP_WritePhyUshort(sc, 0x06, 0x0fae); + MP_WritePhyUshort(sc, 0x06, 0x19ee); + MP_WritePhyUshort(sc, 0x06, 0x8aea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8aeb); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x0fac); + MP_WritePhyUshort(sc, 0x06, 0x390c); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x3b02); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe800); + MP_WritePhyUshort(sc, 0x06, 0xe68a); + MP_WritePhyUshort(sc, 0x06, 0xe7ff); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xc4e1); + MP_WritePhyUshort(sc, 0x06, 0x8b6e); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e24); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x6ead); + MP_WritePhyUshort(sc, 0x06, 0x2218); + MP_WritePhyUshort(sc, 0x06, 0xac27); + MP_WritePhyUshort(sc, 0x06, 0x0dac); + MP_WritePhyUshort(sc, 0x06, 0x2605); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x8fae); + MP_WritePhyUshort(sc, 0x06, 0x1302); + MP_WritePhyUshort(sc, 0x06, 0x03c8); + MP_WritePhyUshort(sc, 0x06, 0xae0e); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0xe102); + MP_WritePhyUshort(sc, 0x06, 0x8520); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x8f02); + MP_WritePhyUshort(sc, 0x06, 0x8566); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x82ad); + MP_WritePhyUshort(sc, 0x06, 0x2737); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4402); + MP_WritePhyUshort(sc, 0x06, 0x2f23); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x2ed1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8647); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50bf); + MP_WritePhyUshort(sc, 0x06, 0x8641); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x23e5); + MP_WritePhyUshort(sc, 0x06, 0x8af0); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x22e1); + MP_WritePhyUshort(sc, 0x06, 0xe023); + MP_WritePhyUshort(sc, 0x06, 0xac2e); + MP_WritePhyUshort(sc, 0x06, 0x04d1); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0x02d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8641); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50d1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8644); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4702); + MP_WritePhyUshort(sc, 0x06, 0x2f23); + MP_WritePhyUshort(sc, 0x06, 0xad28); + MP_WritePhyUshort(sc, 0x06, 0x19d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8644); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50e1); + MP_WritePhyUshort(sc, 0x06, 0x8af0); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4102); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4702); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xfee1); + MP_WritePhyUshort(sc, 0x06, 0xe2ff); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x63e0); + MP_WritePhyUshort(sc, 0x06, 0xe038); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x39ad); + MP_WritePhyUshort(sc, 0x06, 0x2f10); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xf726); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xae0e); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e1); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xf728); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e5); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xf72b); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xd07d); + MP_WritePhyUshort(sc, 0x06, 0xb0fe); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xf62b); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xf626); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e1); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xf628); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e5); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xae20); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0xa725); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x1de5); + MP_WritePhyUshort(sc, 0x06, 0x0a2c); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x6de5); + MP_WritePhyUshort(sc, 0x06, 0x0a1d); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x1ce5); + MP_WritePhyUshort(sc, 0x06, 0x0a2d); + MP_WritePhyUshort(sc, 0x06, 0xa755); + MP_WritePhyUshort(sc, 0x06, 0x00e2); + MP_WritePhyUshort(sc, 0x06, 0x3488); + MP_WritePhyUshort(sc, 0x06, 0xe200); + MP_WritePhyUshort(sc, 0x06, 0xcce2); + MP_WritePhyUshort(sc, 0x06, 0x0055); + MP_WritePhyUshort(sc, 0x06, 0xe020); + MP_WritePhyUshort(sc, 0x06, 0x55e2); + MP_WritePhyUshort(sc, 0x06, 0xd600); + MP_WritePhyUshort(sc, 0x06, 0xe24a); + PhyRegValue = MP_ReadPhyUshort(sc, 0x01); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x01, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2179); + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x10, 0xf274); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0042); + MP_WritePhyUshort(sc, 0x15, 0x0f00); + MP_WritePhyUshort(sc, 0x15, 0x0f00); + MP_WritePhyUshort(sc, 0x16, 0x7408); + MP_WritePhyUshort(sc, 0x15, 0x0e00); + MP_WritePhyUshort(sc, 0x15, 0x0f00); + MP_WritePhyUshort(sc, 0x15, 0x0f01); + MP_WritePhyUshort(sc, 0x16, 0x4000); + MP_WritePhyUshort(sc, 0x15, 0x0e01); + MP_WritePhyUshort(sc, 0x15, 0x0f01); + MP_WritePhyUshort(sc, 0x15, 0x0f02); + MP_WritePhyUshort(sc, 0x16, 0x9400); + MP_WritePhyUshort(sc, 0x15, 0x0e02); + MP_WritePhyUshort(sc, 0x15, 0x0f02); + MP_WritePhyUshort(sc, 0x15, 0x0f03); + MP_WritePhyUshort(sc, 0x16, 0x7408); + MP_WritePhyUshort(sc, 0x15, 0x0e03); + MP_WritePhyUshort(sc, 0x15, 0x0f03); + MP_WritePhyUshort(sc, 0x15, 0x0f04); + MP_WritePhyUshort(sc, 0x16, 0x4008); + MP_WritePhyUshort(sc, 0x15, 0x0e04); + MP_WritePhyUshort(sc, 0x15, 0x0f04); + MP_WritePhyUshort(sc, 0x15, 0x0f05); + MP_WritePhyUshort(sc, 0x16, 0x9400); + MP_WritePhyUshort(sc, 0x15, 0x0e05); + MP_WritePhyUshort(sc, 0x15, 0x0f05); + MP_WritePhyUshort(sc, 0x15, 0x0f06); + MP_WritePhyUshort(sc, 0x16, 0x0803); + MP_WritePhyUshort(sc, 0x15, 0x0e06); + MP_WritePhyUshort(sc, 0x15, 0x0f06); + MP_WritePhyUshort(sc, 0x15, 0x0d00); + MP_WritePhyUshort(sc, 0x15, 0x0100); + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x10, 0xf074); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2149); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i=0; i<200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue&0x0080) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue |= BIT_14; + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1e, 0x0020); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1b); + PhyRegValue |= BIT_7; + MP_WritePhyUshort(sc, 0x1b, PhyRegValue); + MP_WritePhyUshort(sc, 0x1e, 0x0041); + MP_WritePhyUshort(sc, 0x15, 0x0e02); + MP_WritePhyUshort(sc, 0x1e, 0x0028); + PhyRegValue = MP_ReadPhyUshort(sc, 0x19); + PhyRegValue |= BIT_15; + MP_WritePhyUshort(sc, 0x19, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x17, 0x0117); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002C); + MP_WritePhyUshort(sc, 0x1B, 0x5000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x4104); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1E); + PhyRegValue &= 0x03FF; + if (PhyRegValue==0x000C) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if ((PhyRegValue & BIT_5) == 0) + break; + } + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if (PhyRegValue & BIT_5) { + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x00a1); + MP_WritePhyUshort(sc, 0x17, 0x1000); + MP_WritePhyUshort(sc, 0x17, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2000); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + MP_WritePhyUshort(sc, 0x18, 0x9bfb); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x07, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue &= ~(BIT_7); + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x08); + PhyRegValue &= ~(BIT_7); + MP_WritePhyUshort(sc, 0x08, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x000e); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x0010); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x0018); + MP_WritePhyUshort(sc, 0x19, 0x4801); + MP_WritePhyUshort(sc, 0x15, 0x0019); + MP_WritePhyUshort(sc, 0x19, 0x6801); + MP_WritePhyUshort(sc, 0x15, 0x001a); + MP_WritePhyUshort(sc, 0x19, 0x66a1); + MP_WritePhyUshort(sc, 0x15, 0x001f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0020); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0021); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0022); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0023); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0024); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0025); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0026); + MP_WritePhyUshort(sc, 0x19, 0x40ea); + MP_WritePhyUshort(sc, 0x15, 0x0027); + MP_WritePhyUshort(sc, 0x19, 0x4503); + MP_WritePhyUshort(sc, 0x15, 0x0028); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0029); + MP_WritePhyUshort(sc, 0x19, 0xa631); + MP_WritePhyUshort(sc, 0x15, 0x002a); + MP_WritePhyUshort(sc, 0x19, 0x9717); + MP_WritePhyUshort(sc, 0x15, 0x002b); + MP_WritePhyUshort(sc, 0x19, 0x302c); + MP_WritePhyUshort(sc, 0x15, 0x002c); + MP_WritePhyUshort(sc, 0x19, 0x4802); + MP_WritePhyUshort(sc, 0x15, 0x002d); + MP_WritePhyUshort(sc, 0x19, 0x58da); + MP_WritePhyUshort(sc, 0x15, 0x002e); + MP_WritePhyUshort(sc, 0x19, 0x400d); + MP_WritePhyUshort(sc, 0x15, 0x002f); + MP_WritePhyUshort(sc, 0x19, 0x4488); + MP_WritePhyUshort(sc, 0x15, 0x0030); + MP_WritePhyUshort(sc, 0x19, 0x9e00); + MP_WritePhyUshort(sc, 0x15, 0x0031); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0032); + MP_WritePhyUshort(sc, 0x19, 0x6481); + MP_WritePhyUshort(sc, 0x15, 0x0033); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0034); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0035); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0036); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0037); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0038); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0039); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x003a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x003b); + MP_WritePhyUshort(sc, 0x19, 0x63e8); + MP_WritePhyUshort(sc, 0x15, 0x003c); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x003d); + MP_WritePhyUshort(sc, 0x19, 0x59d4); + MP_WritePhyUshort(sc, 0x15, 0x003e); + MP_WritePhyUshort(sc, 0x19, 0x63f8); + MP_WritePhyUshort(sc, 0x15, 0x0040); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0041); + MP_WritePhyUshort(sc, 0x19, 0x30de); + MP_WritePhyUshort(sc, 0x15, 0x0044); + MP_WritePhyUshort(sc, 0x19, 0x480f); + MP_WritePhyUshort(sc, 0x15, 0x0045); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x0046); + MP_WritePhyUshort(sc, 0x19, 0x6680); + MP_WritePhyUshort(sc, 0x15, 0x0047); + MP_WritePhyUshort(sc, 0x19, 0x7c10); + MP_WritePhyUshort(sc, 0x15, 0x0048); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0049); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004f); + MP_WritePhyUshort(sc, 0x19, 0x40ea); + MP_WritePhyUshort(sc, 0x15, 0x0050); + MP_WritePhyUshort(sc, 0x19, 0x4503); + MP_WritePhyUshort(sc, 0x15, 0x0051); + MP_WritePhyUshort(sc, 0x19, 0x58ca); + MP_WritePhyUshort(sc, 0x15, 0x0052); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x0053); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x0054); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x0055); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0056); + MP_WritePhyUshort(sc, 0x19, 0x3000); + MP_WritePhyUshort(sc, 0x15, 0x00a1); + MP_WritePhyUshort(sc, 0x19, 0x3044); + MP_WritePhyUshort(sc, 0x15, 0x00ab); + MP_WritePhyUshort(sc, 0x19, 0x5820); + MP_WritePhyUshort(sc, 0x15, 0x00ac); + MP_WritePhyUshort(sc, 0x19, 0x5e04); + MP_WritePhyUshort(sc, 0x15, 0x00ad); + MP_WritePhyUshort(sc, 0x19, 0xb60c); + MP_WritePhyUshort(sc, 0x15, 0x00af); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x00b2); + MP_WritePhyUshort(sc, 0x19, 0x30b9); + MP_WritePhyUshort(sc, 0x15, 0x00b9); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x00ba); + MP_WritePhyUshort(sc, 0x19, 0x480b); + MP_WritePhyUshort(sc, 0x15, 0x00bb); + MP_WritePhyUshort(sc, 0x19, 0x5e00); + MP_WritePhyUshort(sc, 0x15, 0x00bc); + MP_WritePhyUshort(sc, 0x19, 0x405f); + MP_WritePhyUshort(sc, 0x15, 0x00bd); + MP_WritePhyUshort(sc, 0x19, 0x4448); + MP_WritePhyUshort(sc, 0x15, 0x00be); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x00bf); + MP_WritePhyUshort(sc, 0x19, 0x4468); + MP_WritePhyUshort(sc, 0x15, 0x00c0); + MP_WritePhyUshort(sc, 0x19, 0x9c02); + MP_WritePhyUshort(sc, 0x15, 0x00c1); + MP_WritePhyUshort(sc, 0x19, 0x58a0); + MP_WritePhyUshort(sc, 0x15, 0x00c2); + MP_WritePhyUshort(sc, 0x19, 0xb605); + MP_WritePhyUshort(sc, 0x15, 0x00c3); + MP_WritePhyUshort(sc, 0x19, 0xc0d3); + MP_WritePhyUshort(sc, 0x15, 0x00c4); + MP_WritePhyUshort(sc, 0x19, 0x00e6); + MP_WritePhyUshort(sc, 0x15, 0x00c5); + MP_WritePhyUshort(sc, 0x19, 0xdaec); + MP_WritePhyUshort(sc, 0x15, 0x00c6); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00c7); + MP_WritePhyUshort(sc, 0x19, 0x9df9); + MP_WritePhyUshort(sc, 0x15, 0x0112); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0113); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0114); + MP_WritePhyUshort(sc, 0x19, 0x63f0); + MP_WritePhyUshort(sc, 0x15, 0x0115); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0116); + MP_WritePhyUshort(sc, 0x19, 0x4418); + MP_WritePhyUshort(sc, 0x15, 0x0117); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x15, 0x0118); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0119); + MP_WritePhyUshort(sc, 0x19, 0x64e1); + MP_WritePhyUshort(sc, 0x15, 0x011a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0150); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0151); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0152); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0153); + MP_WritePhyUshort(sc, 0x19, 0x4540); + MP_WritePhyUshort(sc, 0x15, 0x0154); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0155); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x15, 0x0156); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0157); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0158); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0159); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x015a); + MP_WritePhyUshort(sc, 0x19, 0x30fe); + MP_WritePhyUshort(sc, 0x15, 0x029c); + MP_WritePhyUshort(sc, 0x19, 0x0070); + MP_WritePhyUshort(sc, 0x15, 0x02b2); + MP_WritePhyUshort(sc, 0x19, 0x005a); + MP_WritePhyUshort(sc, 0x15, 0x02bd); + MP_WritePhyUshort(sc, 0x19, 0xa522); + MP_WritePhyUshort(sc, 0x15, 0x02ce); + MP_WritePhyUshort(sc, 0x19, 0xb63e); + MP_WritePhyUshort(sc, 0x15, 0x02d9); + MP_WritePhyUshort(sc, 0x19, 0x32df); + MP_WritePhyUshort(sc, 0x15, 0x02df); + MP_WritePhyUshort(sc, 0x19, 0x4500); + MP_WritePhyUshort(sc, 0x15, 0x02f4); + MP_WritePhyUshort(sc, 0x19, 0xb618); + MP_WritePhyUshort(sc, 0x15, 0x02fb); + MP_WritePhyUshort(sc, 0x19, 0xb900); + MP_WritePhyUshort(sc, 0x15, 0x02fc); + MP_WritePhyUshort(sc, 0x19, 0x49b5); + MP_WritePhyUshort(sc, 0x15, 0x02fd); + MP_WritePhyUshort(sc, 0x19, 0x6812); + MP_WritePhyUshort(sc, 0x15, 0x02fe); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x02ff); + MP_WritePhyUshort(sc, 0x19, 0x9900); + MP_WritePhyUshort(sc, 0x15, 0x0300); + MP_WritePhyUshort(sc, 0x19, 0x64a0); + MP_WritePhyUshort(sc, 0x15, 0x0301); + MP_WritePhyUshort(sc, 0x19, 0x3316); + MP_WritePhyUshort(sc, 0x15, 0x0308); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030c); + MP_WritePhyUshort(sc, 0x19, 0x3000); + MP_WritePhyUshort(sc, 0x15, 0x0312); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0313); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0314); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0315); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0316); + MP_WritePhyUshort(sc, 0x19, 0x49b5); + MP_WritePhyUshort(sc, 0x15, 0x0317); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x0318); + MP_WritePhyUshort(sc, 0x19, 0x4d00); + MP_WritePhyUshort(sc, 0x15, 0x0319); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x031a); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x031b); + MP_WritePhyUshort(sc, 0x19, 0x4925); + MP_WritePhyUshort(sc, 0x15, 0x031c); + MP_WritePhyUshort(sc, 0x19, 0x403b); + MP_WritePhyUshort(sc, 0x15, 0x031d); + MP_WritePhyUshort(sc, 0x19, 0xa602); + MP_WritePhyUshort(sc, 0x15, 0x031e); + MP_WritePhyUshort(sc, 0x19, 0x402f); + MP_WritePhyUshort(sc, 0x15, 0x031f); + MP_WritePhyUshort(sc, 0x19, 0x4484); + MP_WritePhyUshort(sc, 0x15, 0x0320); + MP_WritePhyUshort(sc, 0x19, 0x40c8); + MP_WritePhyUshort(sc, 0x15, 0x0321); + MP_WritePhyUshort(sc, 0x19, 0x44c4); + MP_WritePhyUshort(sc, 0x15, 0x0322); + MP_WritePhyUshort(sc, 0x19, 0x404f); + MP_WritePhyUshort(sc, 0x15, 0x0323); + MP_WritePhyUshort(sc, 0x19, 0x44c8); + MP_WritePhyUshort(sc, 0x15, 0x0324); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0325); + MP_WritePhyUshort(sc, 0x19, 0x00e7); + MP_WritePhyUshort(sc, 0x15, 0x0326); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0327); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x0328); + MP_WritePhyUshort(sc, 0x19, 0x4d48); + MP_WritePhyUshort(sc, 0x15, 0x0329); + MP_WritePhyUshort(sc, 0x19, 0x332b); + MP_WritePhyUshort(sc, 0x15, 0x032a); + MP_WritePhyUshort(sc, 0x19, 0x4d40); + MP_WritePhyUshort(sc, 0x15, 0x032c); + MP_WritePhyUshort(sc, 0x19, 0x00f8); + MP_WritePhyUshort(sc, 0x15, 0x032d); + MP_WritePhyUshort(sc, 0x19, 0x82b2); + MP_WritePhyUshort(sc, 0x15, 0x032f); + MP_WritePhyUshort(sc, 0x19, 0x00b0); + MP_WritePhyUshort(sc, 0x15, 0x0332); + MP_WritePhyUshort(sc, 0x19, 0x91f2); + MP_WritePhyUshort(sc, 0x15, 0x033f); + MP_WritePhyUshort(sc, 0x19, 0xb6cd); + MP_WritePhyUshort(sc, 0x15, 0x0340); + MP_WritePhyUshort(sc, 0x19, 0x9e01); + MP_WritePhyUshort(sc, 0x15, 0x0341); + MP_WritePhyUshort(sc, 0x19, 0xd11d); + MP_WritePhyUshort(sc, 0x15, 0x0342); + MP_WritePhyUshort(sc, 0x19, 0x009d); + MP_WritePhyUshort(sc, 0x15, 0x0343); + MP_WritePhyUshort(sc, 0x19, 0xbb1c); + MP_WritePhyUshort(sc, 0x15, 0x0344); + MP_WritePhyUshort(sc, 0x19, 0x8102); + MP_WritePhyUshort(sc, 0x15, 0x0345); + MP_WritePhyUshort(sc, 0x19, 0x3348); + MP_WritePhyUshort(sc, 0x15, 0x0346); + MP_WritePhyUshort(sc, 0x19, 0xa231); + MP_WritePhyUshort(sc, 0x15, 0x0347); + MP_WritePhyUshort(sc, 0x19, 0x335b); + MP_WritePhyUshort(sc, 0x15, 0x0348); + MP_WritePhyUshort(sc, 0x19, 0x91f7); + MP_WritePhyUshort(sc, 0x15, 0x0349); + MP_WritePhyUshort(sc, 0x19, 0xc218); + MP_WritePhyUshort(sc, 0x15, 0x034a); + MP_WritePhyUshort(sc, 0x19, 0x00f5); + MP_WritePhyUshort(sc, 0x15, 0x034b); + MP_WritePhyUshort(sc, 0x19, 0x335b); + MP_WritePhyUshort(sc, 0x15, 0x034c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x034d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x034e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x034f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0350); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x035b); + MP_WritePhyUshort(sc, 0x19, 0xa23c); + MP_WritePhyUshort(sc, 0x15, 0x035c); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x035d); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x035e); + MP_WritePhyUshort(sc, 0x19, 0x3397); + MP_WritePhyUshort(sc, 0x15, 0x0363); + MP_WritePhyUshort(sc, 0x19, 0xb6a9); + MP_WritePhyUshort(sc, 0x15, 0x0366); + MP_WritePhyUshort(sc, 0x19, 0x00f5); + MP_WritePhyUshort(sc, 0x15, 0x0382); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0388); + MP_WritePhyUshort(sc, 0x19, 0x0084); + MP_WritePhyUshort(sc, 0x15, 0x0389); + MP_WritePhyUshort(sc, 0x19, 0xdd17); + MP_WritePhyUshort(sc, 0x15, 0x038a); + MP_WritePhyUshort(sc, 0x19, 0x000b); + MP_WritePhyUshort(sc, 0x15, 0x038b); + MP_WritePhyUshort(sc, 0x19, 0xa10a); + MP_WritePhyUshort(sc, 0x15, 0x038c); + MP_WritePhyUshort(sc, 0x19, 0x337e); + MP_WritePhyUshort(sc, 0x15, 0x038d); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x038e); + MP_WritePhyUshort(sc, 0x19, 0xa107); + MP_WritePhyUshort(sc, 0x15, 0x038f); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x0390); + MP_WritePhyUshort(sc, 0x19, 0xc017); + MP_WritePhyUshort(sc, 0x15, 0x0391); + MP_WritePhyUshort(sc, 0x19, 0x0004); + MP_WritePhyUshort(sc, 0x15, 0x0392); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0393); + MP_WritePhyUshort(sc, 0x19, 0x00f4); + MP_WritePhyUshort(sc, 0x15, 0x0397); + MP_WritePhyUshort(sc, 0x19, 0x4098); + MP_WritePhyUshort(sc, 0x15, 0x0398); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x0399); + MP_WritePhyUshort(sc, 0x19, 0x55bf); + MP_WritePhyUshort(sc, 0x15, 0x039a); + MP_WritePhyUshort(sc, 0x19, 0x4bb9); + MP_WritePhyUshort(sc, 0x15, 0x039b); + MP_WritePhyUshort(sc, 0x19, 0x6810); + MP_WritePhyUshort(sc, 0x15, 0x039c); + MP_WritePhyUshort(sc, 0x19, 0x4b29); + MP_WritePhyUshort(sc, 0x15, 0x039d); + MP_WritePhyUshort(sc, 0x19, 0x4041); + MP_WritePhyUshort(sc, 0x15, 0x039e); + MP_WritePhyUshort(sc, 0x19, 0x442a); + MP_WritePhyUshort(sc, 0x15, 0x039f); + MP_WritePhyUshort(sc, 0x19, 0x4029); + MP_WritePhyUshort(sc, 0x15, 0x03aa); + MP_WritePhyUshort(sc, 0x19, 0x33b8); + MP_WritePhyUshort(sc, 0x15, 0x03b6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b8); + MP_WritePhyUshort(sc, 0x19, 0x543f); + MP_WritePhyUshort(sc, 0x15, 0x03b9); + MP_WritePhyUshort(sc, 0x19, 0x499a); + MP_WritePhyUshort(sc, 0x15, 0x03ba); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x03bb); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03bc); + MP_WritePhyUshort(sc, 0x19, 0x490a); + MP_WritePhyUshort(sc, 0x15, 0x03bd); + MP_WritePhyUshort(sc, 0x19, 0x405e); + MP_WritePhyUshort(sc, 0x15, 0x03c2); + MP_WritePhyUshort(sc, 0x19, 0x9a03); + MP_WritePhyUshort(sc, 0x15, 0x03c4); + MP_WritePhyUshort(sc, 0x19, 0x0015); + MP_WritePhyUshort(sc, 0x15, 0x03c5); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x03c8); + MP_WritePhyUshort(sc, 0x19, 0x9cf7); + MP_WritePhyUshort(sc, 0x15, 0x03c9); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03ca); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03cb); + MP_WritePhyUshort(sc, 0x19, 0x4458); + MP_WritePhyUshort(sc, 0x15, 0x03cd); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03ce); + MP_WritePhyUshort(sc, 0x19, 0x33bf); + MP_WritePhyUshort(sc, 0x15, 0x03cf); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d0); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d1); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03d9); + MP_WritePhyUshort(sc, 0x19, 0x49bb); + MP_WritePhyUshort(sc, 0x15, 0x03da); + MP_WritePhyUshort(sc, 0x19, 0x4478); + MP_WritePhyUshort(sc, 0x15, 0x03db); + MP_WritePhyUshort(sc, 0x19, 0x492b); + MP_WritePhyUshort(sc, 0x15, 0x03dc); + MP_WritePhyUshort(sc, 0x19, 0x7c01); + MP_WritePhyUshort(sc, 0x15, 0x03dd); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x03de); + MP_WritePhyUshort(sc, 0x19, 0xbd1a); + MP_WritePhyUshort(sc, 0x15, 0x03df); + MP_WritePhyUshort(sc, 0x19, 0xc428); + MP_WritePhyUshort(sc, 0x15, 0x03e0); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x03e1); + MP_WritePhyUshort(sc, 0x19, 0x9cfd); + MP_WritePhyUshort(sc, 0x15, 0x03e2); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03e3); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03e4); + MP_WritePhyUshort(sc, 0x19, 0x4458); + MP_WritePhyUshort(sc, 0x15, 0x03e5); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03e6); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03e7); + MP_WritePhyUshort(sc, 0x19, 0x33de); + MP_WritePhyUshort(sc, 0x15, 0x03e8); + MP_WritePhyUshort(sc, 0x19, 0xc218); + MP_WritePhyUshort(sc, 0x15, 0x03e9); + MP_WritePhyUshort(sc, 0x19, 0x0002); + MP_WritePhyUshort(sc, 0x15, 0x03ea); + MP_WritePhyUshort(sc, 0x19, 0x32df); + MP_WritePhyUshort(sc, 0x15, 0x03eb); + MP_WritePhyUshort(sc, 0x19, 0x3316); + MP_WritePhyUshort(sc, 0x15, 0x03ec); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ed); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ee); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ef); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03f7); + MP_WritePhyUshort(sc, 0x19, 0x330c); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x0200); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x9002); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x0202); + MP_WritePhyUshort(sc, 0x06, 0x3402); + MP_WritePhyUshort(sc, 0x06, 0x027f); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0xa602); + MP_WritePhyUshort(sc, 0x06, 0x80bf); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe600); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xee03); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xefb8); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe902); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8285); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8520); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8701); + MP_WritePhyUshort(sc, 0x06, 0xd481); + MP_WritePhyUshort(sc, 0x06, 0x35e4); + MP_WritePhyUshort(sc, 0x06, 0x8b94); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x95bf); + MP_WritePhyUshort(sc, 0x06, 0x8b88); + MP_WritePhyUshort(sc, 0x06, 0xec00); + MP_WritePhyUshort(sc, 0x06, 0x19a9); + MP_WritePhyUshort(sc, 0x06, 0x8b90); + MP_WritePhyUshort(sc, 0x06, 0xf9ee); + MP_WritePhyUshort(sc, 0x06, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x41f7); + MP_WritePhyUshort(sc, 0x06, 0x2ff6); + MP_WritePhyUshort(sc, 0x06, 0x28e4); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xe5e1); + MP_WritePhyUshort(sc, 0x06, 0x4104); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x0dee); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x82f4); + MP_WritePhyUshort(sc, 0x06, 0x021f); + MP_WritePhyUshort(sc, 0x06, 0x4102); + MP_WritePhyUshort(sc, 0x06, 0x2812); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x10ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x139d); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xd602); + MP_WritePhyUshort(sc, 0x06, 0x1f99); + MP_WritePhyUshort(sc, 0x06, 0x0227); + MP_WritePhyUshort(sc, 0x06, 0xeafc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2014); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x8104); + MP_WritePhyUshort(sc, 0x06, 0x021b); + MP_WritePhyUshort(sc, 0x06, 0xf402); + MP_WritePhyUshort(sc, 0x06, 0x2c9c); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x7902); + MP_WritePhyUshort(sc, 0x06, 0x8443); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x11f6); + MP_WritePhyUshort(sc, 0x06, 0x22e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x022c); + MP_WritePhyUshort(sc, 0x06, 0x4602); + MP_WritePhyUshort(sc, 0x06, 0x2ac5); + MP_WritePhyUshort(sc, 0x06, 0x0229); + MP_WritePhyUshort(sc, 0x06, 0x2002); + MP_WritePhyUshort(sc, 0x06, 0x2b91); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x11f6); + MP_WritePhyUshort(sc, 0x06, 0x25e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0xe202); + MP_WritePhyUshort(sc, 0x06, 0x043a); + MP_WritePhyUshort(sc, 0x06, 0x021a); + MP_WritePhyUshort(sc, 0x06, 0x5902); + MP_WritePhyUshort(sc, 0x06, 0x2bfc); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe001); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x1fd1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8638); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50e0); + MP_WritePhyUshort(sc, 0x06, 0xe020); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x21ad); + MP_WritePhyUshort(sc, 0x06, 0x200e); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xbf3d); + MP_WritePhyUshort(sc, 0x06, 0x3902); + MP_WritePhyUshort(sc, 0x06, 0x2eb0); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x0402); + MP_WritePhyUshort(sc, 0x06, 0x8591); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x3c05); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xfee1); + MP_WritePhyUshort(sc, 0x06, 0xe2ff); + MP_WritePhyUshort(sc, 0x06, 0xad2d); + MP_WritePhyUshort(sc, 0x06, 0x1ae0); + MP_WritePhyUshort(sc, 0x06, 0xe14e); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x4fac); + MP_WritePhyUshort(sc, 0x06, 0x2d22); + MP_WritePhyUshort(sc, 0x06, 0xf603); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x36f7); + MP_WritePhyUshort(sc, 0x06, 0x03f7); + MP_WritePhyUshort(sc, 0x06, 0x06bf); + MP_WritePhyUshort(sc, 0x06, 0x8622); + MP_WritePhyUshort(sc, 0x06, 0x022e); + MP_WritePhyUshort(sc, 0x06, 0xb0ae); + MP_WritePhyUshort(sc, 0x06, 0x11e0); + MP_WritePhyUshort(sc, 0x06, 0xe14e); + MP_WritePhyUshort(sc, 0x06, 0xe1e1); + MP_WritePhyUshort(sc, 0x06, 0x4fad); + MP_WritePhyUshort(sc, 0x06, 0x2d08); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x2d02); + MP_WritePhyUshort(sc, 0x06, 0x2eb0); + MP_WritePhyUshort(sc, 0x06, 0xf606); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x204c); + MP_WritePhyUshort(sc, 0x06, 0xd200); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x0058); + MP_WritePhyUshort(sc, 0x06, 0x010c); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0x5810); + MP_WritePhyUshort(sc, 0x06, 0x1e20); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x3658); + MP_WritePhyUshort(sc, 0x06, 0x031e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xe01e); + MP_WritePhyUshort(sc, 0x06, 0x20e0); + MP_WritePhyUshort(sc, 0x06, 0x8ae6); + MP_WritePhyUshort(sc, 0x06, 0x1f02); + MP_WritePhyUshort(sc, 0x06, 0x9e22); + MP_WritePhyUshort(sc, 0x06, 0xe68a); + MP_WritePhyUshort(sc, 0x06, 0xe6ad); + MP_WritePhyUshort(sc, 0x06, 0x3214); + MP_WritePhyUshort(sc, 0x06, 0xad34); + MP_WritePhyUshort(sc, 0x06, 0x11ef); + MP_WritePhyUshort(sc, 0x06, 0x0258); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x07ad); + MP_WritePhyUshort(sc, 0x06, 0x3508); + MP_WritePhyUshort(sc, 0x06, 0x5ac0); + MP_WritePhyUshort(sc, 0x06, 0x9f04); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xae02); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x3e02); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfae0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac26); + MP_WritePhyUshort(sc, 0x06, 0x0ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xac24); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x6bee); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xe0eb); + MP_WritePhyUshort(sc, 0x06, 0x00e2); + MP_WritePhyUshort(sc, 0x06, 0xe07c); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0x7da5); + MP_WritePhyUshort(sc, 0x06, 0x1111); + MP_WritePhyUshort(sc, 0x06, 0x15d2); + MP_WritePhyUshort(sc, 0x06, 0x60d6); + MP_WritePhyUshort(sc, 0x06, 0x6666); + MP_WritePhyUshort(sc, 0x06, 0x0207); + MP_WritePhyUshort(sc, 0x06, 0xf9d2); + MP_WritePhyUshort(sc, 0x06, 0xa0d6); + MP_WritePhyUshort(sc, 0x06, 0xaaaa); + MP_WritePhyUshort(sc, 0x06, 0x0207); + MP_WritePhyUshort(sc, 0x06, 0xf902); + MP_WritePhyUshort(sc, 0x06, 0x825c); + MP_WritePhyUshort(sc, 0x06, 0xae44); + MP_WritePhyUshort(sc, 0x06, 0xa566); + MP_WritePhyUshort(sc, 0x06, 0x6602); + MP_WritePhyUshort(sc, 0x06, 0xae38); + MP_WritePhyUshort(sc, 0x06, 0xa5aa); + MP_WritePhyUshort(sc, 0x06, 0xaa02); + MP_WritePhyUshort(sc, 0x06, 0xae32); + MP_WritePhyUshort(sc, 0x06, 0xeee0); + MP_WritePhyUshort(sc, 0x06, 0xea04); + MP_WritePhyUshort(sc, 0x06, 0xeee0); + MP_WritePhyUshort(sc, 0x06, 0xeb06); + MP_WritePhyUshort(sc, 0x06, 0xe2e0); + MP_WritePhyUshort(sc, 0x06, 0x7ce3); + MP_WritePhyUshort(sc, 0x06, 0xe07d); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x38e1); + MP_WritePhyUshort(sc, 0x06, 0xe039); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x21ad); + MP_WritePhyUshort(sc, 0x06, 0x3f13); + MP_WritePhyUshort(sc, 0x06, 0xe0e4); + MP_WritePhyUshort(sc, 0x06, 0x14e1); + MP_WritePhyUshort(sc, 0x06, 0xe415); + MP_WritePhyUshort(sc, 0x06, 0x6880); + MP_WritePhyUshort(sc, 0x06, 0xe4e4); + MP_WritePhyUshort(sc, 0x06, 0x14e5); + MP_WritePhyUshort(sc, 0x06, 0xe415); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x5cae); + MP_WritePhyUshort(sc, 0x06, 0x0bac); + MP_WritePhyUshort(sc, 0x06, 0x3e02); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x8602); + MP_WritePhyUshort(sc, 0x06, 0x82b0); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2605); + MP_WritePhyUshort(sc, 0x06, 0x0221); + MP_WritePhyUshort(sc, 0x06, 0xf3f7); + MP_WritePhyUshort(sc, 0x06, 0x28e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xad21); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x22f8); + MP_WritePhyUshort(sc, 0x06, 0xf729); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2405); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xebf7); + MP_WritePhyUshort(sc, 0x06, 0x2ae5); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x2134); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2109); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x2eac); + MP_WritePhyUshort(sc, 0x06, 0x2003); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0x52e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x09e0); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x8337); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8b2e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2608); + MP_WritePhyUshort(sc, 0x06, 0xe085); + MP_WritePhyUshort(sc, 0x06, 0xd2ad); + MP_WritePhyUshort(sc, 0x06, 0x2502); + MP_WritePhyUshort(sc, 0x06, 0xf628); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x210a); + MP_WritePhyUshort(sc, 0x06, 0xe086); + MP_WritePhyUshort(sc, 0x06, 0x0af6); + MP_WritePhyUshort(sc, 0x06, 0x27a0); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0xf629); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2408); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xedad); + MP_WritePhyUshort(sc, 0x06, 0x2002); + MP_WritePhyUshort(sc, 0x06, 0xf62a); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x2ea1); + MP_WritePhyUshort(sc, 0x06, 0x0003); + MP_WritePhyUshort(sc, 0x06, 0x0221); + MP_WritePhyUshort(sc, 0x06, 0x11fc); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x8aed); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8aec); + MP_WritePhyUshort(sc, 0x06, 0x0004); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x3ae0); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xeb58); + MP_WritePhyUshort(sc, 0x06, 0xf8d1); + MP_WritePhyUshort(sc, 0x06, 0x01e4); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0xebe0); + MP_WritePhyUshort(sc, 0x06, 0xe07c); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x7d5c); + MP_WritePhyUshort(sc, 0x06, 0x00ff); + MP_WritePhyUshort(sc, 0x06, 0x3c00); + MP_WritePhyUshort(sc, 0x06, 0x1eab); + MP_WritePhyUshort(sc, 0x06, 0x1ce0); + MP_WritePhyUshort(sc, 0x06, 0xe04c); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x4d58); + MP_WritePhyUshort(sc, 0x06, 0xc1e4); + MP_WritePhyUshort(sc, 0x06, 0xe04c); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0x4de0); + MP_WritePhyUshort(sc, 0x06, 0xe0ee); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0x3ce4); + MP_WritePhyUshort(sc, 0x06, 0xe0ee); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0xeffc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2412); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0xeee1); + MP_WritePhyUshort(sc, 0x06, 0xe0ef); + MP_WritePhyUshort(sc, 0x06, 0x59c3); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0xeee5); + MP_WritePhyUshort(sc, 0x06, 0xe0ef); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xed01); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac25); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x8363); + MP_WritePhyUshort(sc, 0x06, 0xae03); + MP_WritePhyUshort(sc, 0x06, 0x0225); + MP_WritePhyUshort(sc, 0x06, 0x16fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfae0); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0xa000); + MP_WritePhyUshort(sc, 0x06, 0x19e0); + MP_WritePhyUshort(sc, 0x06, 0x860b); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x331b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x04aa); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x06ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0xe602); + MP_WritePhyUshort(sc, 0x06, 0x241e); + MP_WritePhyUshort(sc, 0x06, 0xae14); + MP_WritePhyUshort(sc, 0x06, 0xa001); + MP_WritePhyUshort(sc, 0x06, 0x1402); + MP_WritePhyUshort(sc, 0x06, 0x2426); + MP_WritePhyUshort(sc, 0x06, 0xbf26); + MP_WritePhyUshort(sc, 0x06, 0x6d02); + MP_WritePhyUshort(sc, 0x06, 0x2eb0); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0b00); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0a02); + MP_WritePhyUshort(sc, 0x06, 0xaf84); + MP_WritePhyUshort(sc, 0x06, 0x3ca0); + MP_WritePhyUshort(sc, 0x06, 0x0252); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0400); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0500); + MP_WritePhyUshort(sc, 0x06, 0xe086); + MP_WritePhyUshort(sc, 0x06, 0x0be1); + MP_WritePhyUshort(sc, 0x06, 0x8b32); + MP_WritePhyUshort(sc, 0x06, 0x1b10); + MP_WritePhyUshort(sc, 0x06, 0x9e04); + MP_WritePhyUshort(sc, 0x06, 0xaa02); + MP_WritePhyUshort(sc, 0x06, 0xaecb); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0b00); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x3ae2); + MP_WritePhyUshort(sc, 0x06, 0x8604); + MP_WritePhyUshort(sc, 0x06, 0xe386); + MP_WritePhyUshort(sc, 0x06, 0x05ef); + MP_WritePhyUshort(sc, 0x06, 0x65e2); + MP_WritePhyUshort(sc, 0x06, 0x8606); + MP_WritePhyUshort(sc, 0x06, 0xe386); + MP_WritePhyUshort(sc, 0x06, 0x071b); + MP_WritePhyUshort(sc, 0x06, 0x56aa); + MP_WritePhyUshort(sc, 0x06, 0x0eef); + MP_WritePhyUshort(sc, 0x06, 0x56e6); + MP_WritePhyUshort(sc, 0x06, 0x8606); + MP_WritePhyUshort(sc, 0x06, 0xe786); + MP_WritePhyUshort(sc, 0x06, 0x07e2); + MP_WritePhyUshort(sc, 0x06, 0x8609); + MP_WritePhyUshort(sc, 0x06, 0xe686); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8609); + MP_WritePhyUshort(sc, 0x06, 0xa000); + MP_WritePhyUshort(sc, 0x06, 0x07ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x03af); + MP_WritePhyUshort(sc, 0x06, 0x8369); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x2426); + MP_WritePhyUshort(sc, 0x06, 0xae48); + MP_WritePhyUshort(sc, 0x06, 0xa003); + MP_WritePhyUshort(sc, 0x06, 0x21e0); + MP_WritePhyUshort(sc, 0x06, 0x8608); + MP_WritePhyUshort(sc, 0x06, 0xe186); + MP_WritePhyUshort(sc, 0x06, 0x091b); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x0caa); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x249d); + MP_WritePhyUshort(sc, 0x06, 0xaee7); + MP_WritePhyUshort(sc, 0x06, 0x0224); + MP_WritePhyUshort(sc, 0x06, 0x8eae); + MP_WritePhyUshort(sc, 0x06, 0xe2ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x860b); + MP_WritePhyUshort(sc, 0x06, 0x00af); + MP_WritePhyUshort(sc, 0x06, 0x8369); + MP_WritePhyUshort(sc, 0x06, 0xa004); + MP_WritePhyUshort(sc, 0x06, 0x15e0); + MP_WritePhyUshort(sc, 0x06, 0x860b); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x341b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x05aa); + MP_WritePhyUshort(sc, 0x06, 0x03af); + MP_WritePhyUshort(sc, 0x06, 0x8383); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0a05); + MP_WritePhyUshort(sc, 0x06, 0xae0c); + MP_WritePhyUshort(sc, 0x06, 0xa005); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x0702); + MP_WritePhyUshort(sc, 0x06, 0x2309); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0a00); + MP_WritePhyUshort(sc, 0x06, 0xfeef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfbe0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x22e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x23e2); + MP_WritePhyUshort(sc, 0x06, 0xe036); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0x375a); + MP_WritePhyUshort(sc, 0x06, 0xc40d); + MP_WritePhyUshort(sc, 0x06, 0x0158); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x20e3); + MP_WritePhyUshort(sc, 0x06, 0x8ae7); + MP_WritePhyUshort(sc, 0x06, 0xac31); + MP_WritePhyUshort(sc, 0x06, 0x60ac); + MP_WritePhyUshort(sc, 0x06, 0x3a08); + MP_WritePhyUshort(sc, 0x06, 0xac3e); + MP_WritePhyUshort(sc, 0x06, 0x26ae); + MP_WritePhyUshort(sc, 0x06, 0x67af); + MP_WritePhyUshort(sc, 0x06, 0x84db); + MP_WritePhyUshort(sc, 0x06, 0xad37); + MP_WritePhyUshort(sc, 0x06, 0x61e0); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xe91b); + MP_WritePhyUshort(sc, 0x06, 0x109e); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x51d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x863b); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50ee); + MP_WritePhyUshort(sc, 0x06, 0x8ae8); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x43ad); + MP_WritePhyUshort(sc, 0x06, 0x3627); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xeee1); + MP_WritePhyUshort(sc, 0x06, 0x8aef); + MP_WritePhyUshort(sc, 0x06, 0xef74); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xeae1); + MP_WritePhyUshort(sc, 0x06, 0x8aeb); + MP_WritePhyUshort(sc, 0x06, 0x1b74); + MP_WritePhyUshort(sc, 0x06, 0x9e2e); + MP_WritePhyUshort(sc, 0x06, 0x14e4); + MP_WritePhyUshort(sc, 0x06, 0x8aea); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xebef); + MP_WritePhyUshort(sc, 0x06, 0x74e0); + MP_WritePhyUshort(sc, 0x06, 0x8aee); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xef1b); + MP_WritePhyUshort(sc, 0x06, 0x479e); + MP_WritePhyUshort(sc, 0x06, 0x0fae); + MP_WritePhyUshort(sc, 0x06, 0x19ee); + MP_WritePhyUshort(sc, 0x06, 0x8aea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8aeb); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0x0fac); + MP_WritePhyUshort(sc, 0x06, 0x390c); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x3b02); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xe800); + MP_WritePhyUshort(sc, 0x06, 0xe68a); + MP_WritePhyUshort(sc, 0x06, 0xe7ff); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xc4e1); + MP_WritePhyUshort(sc, 0x06, 0x8b6e); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e24); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x6ead); + MP_WritePhyUshort(sc, 0x06, 0x2218); + MP_WritePhyUshort(sc, 0x06, 0xac27); + MP_WritePhyUshort(sc, 0x06, 0x0dac); + MP_WritePhyUshort(sc, 0x06, 0x2605); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x8fae); + MP_WritePhyUshort(sc, 0x06, 0x1302); + MP_WritePhyUshort(sc, 0x06, 0x03c8); + MP_WritePhyUshort(sc, 0x06, 0xae0e); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0xe102); + MP_WritePhyUshort(sc, 0x06, 0x8520); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x8f02); + MP_WritePhyUshort(sc, 0x06, 0x8566); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x82ad); + MP_WritePhyUshort(sc, 0x06, 0x2737); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4402); + MP_WritePhyUshort(sc, 0x06, 0x2f23); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x2ed1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8647); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50bf); + MP_WritePhyUshort(sc, 0x06, 0x8641); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x23e5); + MP_WritePhyUshort(sc, 0x06, 0x8af0); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x22e1); + MP_WritePhyUshort(sc, 0x06, 0xe023); + MP_WritePhyUshort(sc, 0x06, 0xac2e); + MP_WritePhyUshort(sc, 0x06, 0x04d1); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0x02d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8641); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50d1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8644); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4702); + MP_WritePhyUshort(sc, 0x06, 0x2f23); + MP_WritePhyUshort(sc, 0x06, 0xad28); + MP_WritePhyUshort(sc, 0x06, 0x19d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8644); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x50e1); + MP_WritePhyUshort(sc, 0x06, 0x8af0); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4102); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x4702); + MP_WritePhyUshort(sc, 0x06, 0x2f50); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xfee1); + MP_WritePhyUshort(sc, 0x06, 0xe2ff); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x63e0); + MP_WritePhyUshort(sc, 0x06, 0xe038); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x39ad); + MP_WritePhyUshort(sc, 0x06, 0x2f10); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xf726); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xae0e); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e1); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xf728); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e5); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xf72b); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xd07d); + MP_WritePhyUshort(sc, 0x06, 0xb0fe); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xf62b); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xf626); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe035); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e1); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xf628); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0xd6e5); + MP_WritePhyUshort(sc, 0x06, 0xe2d7); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xae20); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0xa725); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x1de5); + MP_WritePhyUshort(sc, 0x06, 0x0a2c); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x6de5); + MP_WritePhyUshort(sc, 0x06, 0x0a1d); + MP_WritePhyUshort(sc, 0x06, 0xe50a); + MP_WritePhyUshort(sc, 0x06, 0x1ce5); + MP_WritePhyUshort(sc, 0x06, 0x0a2d); + MP_WritePhyUshort(sc, 0x06, 0xa755); + MP_WritePhyUshort(sc, 0x06, 0x00e2); + MP_WritePhyUshort(sc, 0x06, 0x3488); + MP_WritePhyUshort(sc, 0x06, 0xe200); + MP_WritePhyUshort(sc, 0x06, 0xcce2); + MP_WritePhyUshort(sc, 0x06, 0x0055); + MP_WritePhyUshort(sc, 0x06, 0xe020); + MP_WritePhyUshort(sc, 0x06, 0x55e2); + MP_WritePhyUshort(sc, 0x06, 0xd600); + MP_WritePhyUshort(sc, 0x06, 0xe24a); + PhyRegValue = MP_ReadPhyUshort(sc, 0x01); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x01, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue & BIT_7) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } +} + +static void re_set_phy_mcu_8168evl_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + PhyRegValue= MP_ReadPhyUshort(sc, 0x15); + PhyRegValue &= ~BIT_12; + MP_WritePhyUshort(sc, 0x15, PhyRegValue); + DELAY(200); + DELAY(200); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + if ((PhyRegValue & BIT_11) == 0x0000) { + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + if (PhyRegValue & BIT_11) + break; + } + } + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue |= BIT_11; + MP_WritePhyUshort(sc, 0x17,PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002C); + MP_WritePhyUshort(sc, 0x1B, 0x5000); + MP_WritePhyUshort(sc, 0x1E, 0x002d); + MP_WritePhyUshort(sc, 0x19, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue= MP_ReadPhyUshort(sc, 0x1E); + if ((PhyRegValue& 0x03FF) == 0x0014) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue= MP_ReadPhyUshort(sc, 0x07); + if ((PhyRegValue& BIT_5) == 0) + break; + } + PhyRegValue = MP_ReadPhyUshort(sc, 0x07); + if (PhyRegValue & BIT_5) { + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x00a1); + MP_WritePhyUshort(sc, 0x17, 0x1000); + MP_WritePhyUshort(sc, 0x17, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2000); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + MP_WritePhyUshort(sc, 0x18, 0x9bfb); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x07, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + PhyRegValue &= ~BIT_7; + MP_WritePhyUshort(sc, 0x00, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x0000); + MP_WritePhyUshort(sc, 0x19, 0x407d); + MP_WritePhyUshort(sc, 0x15, 0x0001); + MP_WritePhyUshort(sc, 0x19, 0x440f); + MP_WritePhyUshort(sc, 0x15, 0x0002); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0003); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x0004); + MP_WritePhyUshort(sc, 0x19, 0xc4d5); + MP_WritePhyUshort(sc, 0x15, 0x0005); + MP_WritePhyUshort(sc, 0x19, 0x00ff); + MP_WritePhyUshort(sc, 0x15, 0x0006); + MP_WritePhyUshort(sc, 0x19, 0x74f0); + MP_WritePhyUshort(sc, 0x15, 0x0007); + MP_WritePhyUshort(sc, 0x19, 0x4880); + MP_WritePhyUshort(sc, 0x15, 0x0008); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x0009); + MP_WritePhyUshort(sc, 0x19, 0x4800); + MP_WritePhyUshort(sc, 0x15, 0x000a); + MP_WritePhyUshort(sc, 0x19, 0x5000); + MP_WritePhyUshort(sc, 0x15, 0x000b); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x000c); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x000d); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x15, 0x000e); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x000f); + MP_WritePhyUshort(sc, 0x19, 0x7010); + MP_WritePhyUshort(sc, 0x15, 0x0010); + MP_WritePhyUshort(sc, 0x19, 0x6804); + MP_WritePhyUshort(sc, 0x15, 0x0011); + MP_WritePhyUshort(sc, 0x19, 0x64a0); + MP_WritePhyUshort(sc, 0x15, 0x0012); + MP_WritePhyUshort(sc, 0x19, 0x63da); + MP_WritePhyUshort(sc, 0x15, 0x0013); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x0014); + MP_WritePhyUshort(sc, 0x19, 0x6f05); + MP_WritePhyUshort(sc, 0x15, 0x0015); + MP_WritePhyUshort(sc, 0x19, 0x5420); + MP_WritePhyUshort(sc, 0x15, 0x0016); + MP_WritePhyUshort(sc, 0x19, 0x58ce); + MP_WritePhyUshort(sc, 0x15, 0x0017); + MP_WritePhyUshort(sc, 0x19, 0x5cf3); + MP_WritePhyUshort(sc, 0x15, 0x0018); + MP_WritePhyUshort(sc, 0x19, 0xb600); + MP_WritePhyUshort(sc, 0x15, 0x0019); + MP_WritePhyUshort(sc, 0x19, 0xc659); + MP_WritePhyUshort(sc, 0x15, 0x001a); + MP_WritePhyUshort(sc, 0x19, 0x0018); + MP_WritePhyUshort(sc, 0x15, 0x001b); + MP_WritePhyUshort(sc, 0x19, 0xc403); + MP_WritePhyUshort(sc, 0x15, 0x001c); + MP_WritePhyUshort(sc, 0x19, 0x0016); + MP_WritePhyUshort(sc, 0x15, 0x001d); + MP_WritePhyUshort(sc, 0x19, 0xaa05); + MP_WritePhyUshort(sc, 0x15, 0x001e); + MP_WritePhyUshort(sc, 0x19, 0xc503); + MP_WritePhyUshort(sc, 0x15, 0x001f); + MP_WritePhyUshort(sc, 0x19, 0x0003); + MP_WritePhyUshort(sc, 0x15, 0x0020); + MP_WritePhyUshort(sc, 0x19, 0x89f8); + MP_WritePhyUshort(sc, 0x15, 0x0021); + MP_WritePhyUshort(sc, 0x19, 0x32ae); + MP_WritePhyUshort(sc, 0x15, 0x0022); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0023); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x0024); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0025); + MP_WritePhyUshort(sc, 0x19, 0x6801); + MP_WritePhyUshort(sc, 0x15, 0x0026); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x0027); + MP_WritePhyUshort(sc, 0x19, 0xa300); + MP_WritePhyUshort(sc, 0x15, 0x0028); + MP_WritePhyUshort(sc, 0x19, 0x64a0); + MP_WritePhyUshort(sc, 0x15, 0x0029); + MP_WritePhyUshort(sc, 0x19, 0x76f0); + MP_WritePhyUshort(sc, 0x15, 0x002a); + MP_WritePhyUshort(sc, 0x19, 0x7670); + MP_WritePhyUshort(sc, 0x15, 0x002b); + MP_WritePhyUshort(sc, 0x19, 0x7630); + MP_WritePhyUshort(sc, 0x15, 0x002c); + MP_WritePhyUshort(sc, 0x19, 0x31a6); + MP_WritePhyUshort(sc, 0x15, 0x002d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x002e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x002f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0030); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0031); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0032); + MP_WritePhyUshort(sc, 0x19, 0x4801); + MP_WritePhyUshort(sc, 0x15, 0x0033); + MP_WritePhyUshort(sc, 0x19, 0x6803); + MP_WritePhyUshort(sc, 0x15, 0x0034); + MP_WritePhyUshort(sc, 0x19, 0x66a1); + MP_WritePhyUshort(sc, 0x15, 0x0035); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0036); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x0037); + MP_WritePhyUshort(sc, 0x19, 0xa300); + MP_WritePhyUshort(sc, 0x15, 0x0038); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0039); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x003a); + MP_WritePhyUshort(sc, 0x19, 0x74f8); + MP_WritePhyUshort(sc, 0x15, 0x003b); + MP_WritePhyUshort(sc, 0x19, 0x63d0); + MP_WritePhyUshort(sc, 0x15, 0x003c); + MP_WritePhyUshort(sc, 0x19, 0x7ff0); + MP_WritePhyUshort(sc, 0x15, 0x003d); + MP_WritePhyUshort(sc, 0x19, 0x77f0); + MP_WritePhyUshort(sc, 0x15, 0x003e); + MP_WritePhyUshort(sc, 0x19, 0x7ff0); + MP_WritePhyUshort(sc, 0x15, 0x003f); + MP_WritePhyUshort(sc, 0x19, 0x7750); + MP_WritePhyUshort(sc, 0x15, 0x0040); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x0041); + MP_WritePhyUshort(sc, 0x19, 0x7cf0); + MP_WritePhyUshort(sc, 0x15, 0x0042); + MP_WritePhyUshort(sc, 0x19, 0x7708); + MP_WritePhyUshort(sc, 0x15, 0x0043); + MP_WritePhyUshort(sc, 0x19, 0xa654); + MP_WritePhyUshort(sc, 0x15, 0x0044); + MP_WritePhyUshort(sc, 0x19, 0x304a); + MP_WritePhyUshort(sc, 0x15, 0x0045); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0046); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0047); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0048); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0049); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x004a); + MP_WritePhyUshort(sc, 0x19, 0x4802); + MP_WritePhyUshort(sc, 0x15, 0x004b); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x004c); + MP_WritePhyUshort(sc, 0x19, 0x4440); + MP_WritePhyUshort(sc, 0x15, 0x004d); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x004e); + MP_WritePhyUshort(sc, 0x19, 0x6481); + MP_WritePhyUshort(sc, 0x15, 0x004f); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x15, 0x0050); + MP_WritePhyUshort(sc, 0x19, 0x63e8); + MP_WritePhyUshort(sc, 0x15, 0x0051); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x0052); + MP_WritePhyUshort(sc, 0x19, 0x5900); + MP_WritePhyUshort(sc, 0x15, 0x0053); + MP_WritePhyUshort(sc, 0x19, 0x63f8); + MP_WritePhyUshort(sc, 0x15, 0x0054); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0055); + MP_WritePhyUshort(sc, 0x19, 0x3116); + MP_WritePhyUshort(sc, 0x15, 0x0056); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0057); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0058); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0059); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x005a); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x005b); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x005c); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x005d); + MP_WritePhyUshort(sc, 0x19, 0x6000); + MP_WritePhyUshort(sc, 0x15, 0x005e); + MP_WritePhyUshort(sc, 0x19, 0x59ce); + MP_WritePhyUshort(sc, 0x15, 0x005f); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x0060); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x0061); + MP_WritePhyUshort(sc, 0x19, 0x72b0); + MP_WritePhyUshort(sc, 0x15, 0x0062); + MP_WritePhyUshort(sc, 0x19, 0x400e); + MP_WritePhyUshort(sc, 0x15, 0x0063); + MP_WritePhyUshort(sc, 0x19, 0x4440); + MP_WritePhyUshort(sc, 0x15, 0x0064); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x15, 0x0065); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x15, 0x0066); + MP_WritePhyUshort(sc, 0x19, 0x70b0); + MP_WritePhyUshort(sc, 0x15, 0x0067); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0068); + MP_WritePhyUshort(sc, 0x19, 0x6008); + MP_WritePhyUshort(sc, 0x15, 0x0069); + MP_WritePhyUshort(sc, 0x19, 0x7cf0); + MP_WritePhyUshort(sc, 0x15, 0x006a); + MP_WritePhyUshort(sc, 0x19, 0x7750); + MP_WritePhyUshort(sc, 0x15, 0x006b); + MP_WritePhyUshort(sc, 0x19, 0x4007); + MP_WritePhyUshort(sc, 0x15, 0x006c); + MP_WritePhyUshort(sc, 0x19, 0x4500); + MP_WritePhyUshort(sc, 0x15, 0x006d); + MP_WritePhyUshort(sc, 0x19, 0x4023); + MP_WritePhyUshort(sc, 0x15, 0x006e); + MP_WritePhyUshort(sc, 0x19, 0x4580); + MP_WritePhyUshort(sc, 0x15, 0x006f); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x0070); + MP_WritePhyUshort(sc, 0x19, 0xcd78); + MP_WritePhyUshort(sc, 0x15, 0x0071); + MP_WritePhyUshort(sc, 0x19, 0x0003); + MP_WritePhyUshort(sc, 0x15, 0x0072); + MP_WritePhyUshort(sc, 0x19, 0xbe02); + MP_WritePhyUshort(sc, 0x15, 0x0073); + MP_WritePhyUshort(sc, 0x19, 0x3070); + MP_WritePhyUshort(sc, 0x15, 0x0074); + MP_WritePhyUshort(sc, 0x19, 0x7cf0); + MP_WritePhyUshort(sc, 0x15, 0x0075); + MP_WritePhyUshort(sc, 0x19, 0x77f0); + MP_WritePhyUshort(sc, 0x15, 0x0076); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x0077); + MP_WritePhyUshort(sc, 0x19, 0x4007); + MP_WritePhyUshort(sc, 0x15, 0x0078); + MP_WritePhyUshort(sc, 0x19, 0x4500); + MP_WritePhyUshort(sc, 0x15, 0x0079); + MP_WritePhyUshort(sc, 0x19, 0x4023); + MP_WritePhyUshort(sc, 0x15, 0x007a); + MP_WritePhyUshort(sc, 0x19, 0x4580); + MP_WritePhyUshort(sc, 0x15, 0x007b); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x007c); + MP_WritePhyUshort(sc, 0x19, 0xce80); + MP_WritePhyUshort(sc, 0x15, 0x007d); + MP_WritePhyUshort(sc, 0x19, 0x0004); + MP_WritePhyUshort(sc, 0x15, 0x007e); + MP_WritePhyUshort(sc, 0x19, 0xce80); + MP_WritePhyUshort(sc, 0x15, 0x007f); + MP_WritePhyUshort(sc, 0x19, 0x0002); + MP_WritePhyUshort(sc, 0x15, 0x0080); + MP_WritePhyUshort(sc, 0x19, 0x307c); + MP_WritePhyUshort(sc, 0x15, 0x0081); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x0082); + MP_WritePhyUshort(sc, 0x19, 0x480f); + MP_WritePhyUshort(sc, 0x15, 0x0083); + MP_WritePhyUshort(sc, 0x19, 0x6802); + MP_WritePhyUshort(sc, 0x15, 0x0084); + MP_WritePhyUshort(sc, 0x19, 0x6680); + MP_WritePhyUshort(sc, 0x15, 0x0085); + MP_WritePhyUshort(sc, 0x19, 0x7c10); + MP_WritePhyUshort(sc, 0x15, 0x0086); + MP_WritePhyUshort(sc, 0x19, 0x6010); + MP_WritePhyUshort(sc, 0x15, 0x0087); + MP_WritePhyUshort(sc, 0x19, 0x400a); + MP_WritePhyUshort(sc, 0x15, 0x0088); + MP_WritePhyUshort(sc, 0x19, 0x4580); + MP_WritePhyUshort(sc, 0x15, 0x0089); + MP_WritePhyUshort(sc, 0x19, 0x9e00); + MP_WritePhyUshort(sc, 0x15, 0x008a); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x008b); + MP_WritePhyUshort(sc, 0x19, 0x5800); + MP_WritePhyUshort(sc, 0x15, 0x008c); + MP_WritePhyUshort(sc, 0x19, 0x63c8); + MP_WritePhyUshort(sc, 0x15, 0x008d); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x008e); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x008f); + MP_WritePhyUshort(sc, 0x19, 0x8300); + MP_WritePhyUshort(sc, 0x15, 0x0090); + MP_WritePhyUshort(sc, 0x19, 0x7ff0); + MP_WritePhyUshort(sc, 0x15, 0x0091); + MP_WritePhyUshort(sc, 0x19, 0x74f0); + MP_WritePhyUshort(sc, 0x15, 0x0092); + MP_WritePhyUshort(sc, 0x19, 0x3006); + MP_WritePhyUshort(sc, 0x15, 0x0093); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0094); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0095); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0096); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0097); + MP_WritePhyUshort(sc, 0x19, 0x4803); + MP_WritePhyUshort(sc, 0x15, 0x0098); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0099); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x009a); + MP_WritePhyUshort(sc, 0x19, 0xa203); + MP_WritePhyUshort(sc, 0x15, 0x009b); + MP_WritePhyUshort(sc, 0x19, 0x64b1); + MP_WritePhyUshort(sc, 0x15, 0x009c); + MP_WritePhyUshort(sc, 0x19, 0x309e); + MP_WritePhyUshort(sc, 0x15, 0x009d); + MP_WritePhyUshort(sc, 0x19, 0x64b3); + MP_WritePhyUshort(sc, 0x15, 0x009e); + MP_WritePhyUshort(sc, 0x19, 0x4030); + MP_WritePhyUshort(sc, 0x15, 0x009f); + MP_WritePhyUshort(sc, 0x19, 0x440e); + MP_WritePhyUshort(sc, 0x15, 0x00a0); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x00a1); + MP_WritePhyUshort(sc, 0x19, 0x4419); + MP_WritePhyUshort(sc, 0x15, 0x00a2); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x00a3); + MP_WritePhyUshort(sc, 0x19, 0xc520); + MP_WritePhyUshort(sc, 0x15, 0x00a4); + MP_WritePhyUshort(sc, 0x19, 0x000b); + MP_WritePhyUshort(sc, 0x15, 0x00a5); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x00a6); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x00a7); + MP_WritePhyUshort(sc, 0x19, 0x58a4); + MP_WritePhyUshort(sc, 0x15, 0x00a8); + MP_WritePhyUshort(sc, 0x19, 0x63da); + MP_WritePhyUshort(sc, 0x15, 0x00a9); + MP_WritePhyUshort(sc, 0x19, 0x5cb0); + MP_WritePhyUshort(sc, 0x15, 0x00aa); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x00ab); + MP_WritePhyUshort(sc, 0x19, 0x72b0); + MP_WritePhyUshort(sc, 0x15, 0x00ac); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x15, 0x00ad); + MP_WritePhyUshort(sc, 0x19, 0x70b0); + MP_WritePhyUshort(sc, 0x15, 0x00ae); + MP_WritePhyUshort(sc, 0x19, 0x30b8); + MP_WritePhyUshort(sc, 0x15, 0x00AF); + MP_WritePhyUshort(sc, 0x19, 0x4060); + MP_WritePhyUshort(sc, 0x15, 0x00B0); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x00B1); + MP_WritePhyUshort(sc, 0x19, 0x7e00); + MP_WritePhyUshort(sc, 0x15, 0x00B2); + MP_WritePhyUshort(sc, 0x19, 0x72B0); + MP_WritePhyUshort(sc, 0x15, 0x00B3); + MP_WritePhyUshort(sc, 0x19, 0x7F00); + MP_WritePhyUshort(sc, 0x15, 0x00B4); + MP_WritePhyUshort(sc, 0x19, 0x73B0); + MP_WritePhyUshort(sc, 0x15, 0x00b5); + MP_WritePhyUshort(sc, 0x19, 0x58a0); + MP_WritePhyUshort(sc, 0x15, 0x00b6); + MP_WritePhyUshort(sc, 0x19, 0x63d2); + MP_WritePhyUshort(sc, 0x15, 0x00b7); + MP_WritePhyUshort(sc, 0x19, 0x5c00); + MP_WritePhyUshort(sc, 0x15, 0x00b8); + MP_WritePhyUshort(sc, 0x19, 0x5780); + MP_WritePhyUshort(sc, 0x15, 0x00b9); + MP_WritePhyUshort(sc, 0x19, 0xb60d); + MP_WritePhyUshort(sc, 0x15, 0x00ba); + MP_WritePhyUshort(sc, 0x19, 0x9bff); + MP_WritePhyUshort(sc, 0x15, 0x00bb); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x00bc); + MP_WritePhyUshort(sc, 0x19, 0x6001); + MP_WritePhyUshort(sc, 0x15, 0x00bd); + MP_WritePhyUshort(sc, 0x19, 0xc020); + MP_WritePhyUshort(sc, 0x15, 0x00be); + MP_WritePhyUshort(sc, 0x19, 0x002b); + MP_WritePhyUshort(sc, 0x15, 0x00bf); + MP_WritePhyUshort(sc, 0x19, 0xc137); + MP_WritePhyUshort(sc, 0x15, 0x00c0); + MP_WritePhyUshort(sc, 0x19, 0x0006); + MP_WritePhyUshort(sc, 0x15, 0x00c1); + MP_WritePhyUshort(sc, 0x19, 0x9af8); + MP_WritePhyUshort(sc, 0x15, 0x00c2); + MP_WritePhyUshort(sc, 0x19, 0x30c6); + MP_WritePhyUshort(sc, 0x15, 0x00c3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00c4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00c5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00c6); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x00c7); + MP_WritePhyUshort(sc, 0x19, 0x70b0); + MP_WritePhyUshort(sc, 0x15, 0x00c8); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x00c9); + MP_WritePhyUshort(sc, 0x19, 0x4804); + MP_WritePhyUshort(sc, 0x15, 0x00ca); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x00cb); + MP_WritePhyUshort(sc, 0x19, 0x5c80); + MP_WritePhyUshort(sc, 0x15, 0x00cc); + MP_WritePhyUshort(sc, 0x19, 0x4010); + MP_WritePhyUshort(sc, 0x15, 0x00cd); + MP_WritePhyUshort(sc, 0x19, 0x4415); + MP_WritePhyUshort(sc, 0x15, 0x00ce); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x15, 0x00cf); + MP_WritePhyUshort(sc, 0x19, 0x7f00); + MP_WritePhyUshort(sc, 0x15, 0x00d0); + MP_WritePhyUshort(sc, 0x19, 0x70b0); + MP_WritePhyUshort(sc, 0x15, 0x00d1); + MP_WritePhyUshort(sc, 0x19, 0x3177); + MP_WritePhyUshort(sc, 0x15, 0x00d2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00d3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00d4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00d5); + MP_WritePhyUshort(sc, 0x19, 0x4808); + MP_WritePhyUshort(sc, 0x15, 0x00d6); + MP_WritePhyUshort(sc, 0x19, 0x4007); + MP_WritePhyUshort(sc, 0x15, 0x00d7); + MP_WritePhyUshort(sc, 0x19, 0x4420); + MP_WritePhyUshort(sc, 0x15, 0x00d8); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x00d9); + MP_WritePhyUshort(sc, 0x19, 0xb608); + MP_WritePhyUshort(sc, 0x15, 0x00da); + MP_WritePhyUshort(sc, 0x19, 0xbcbd); + MP_WritePhyUshort(sc, 0x15, 0x00db); + MP_WritePhyUshort(sc, 0x19, 0xc60b); + MP_WritePhyUshort(sc, 0x15, 0x00dc); + MP_WritePhyUshort(sc, 0x19, 0x00fd); + MP_WritePhyUshort(sc, 0x15, 0x00dd); + MP_WritePhyUshort(sc, 0x19, 0x30e1); + MP_WritePhyUshort(sc, 0x15, 0x00de); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00df); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00e0); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00e1); + MP_WritePhyUshort(sc, 0x19, 0x4809); + MP_WritePhyUshort(sc, 0x15, 0x00e2); + MP_WritePhyUshort(sc, 0x19, 0x7e40); + MP_WritePhyUshort(sc, 0x15, 0x00e3); + MP_WritePhyUshort(sc, 0x19, 0x5a40); + MP_WritePhyUshort(sc, 0x15, 0x00e4); + MP_WritePhyUshort(sc, 0x19, 0x305a); + MP_WritePhyUshort(sc, 0x15, 0x00e5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00e6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00e7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00e8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00e9); + MP_WritePhyUshort(sc, 0x19, 0x480a); + MP_WritePhyUshort(sc, 0x15, 0x00ea); + MP_WritePhyUshort(sc, 0x19, 0x5820); + MP_WritePhyUshort(sc, 0x15, 0x00eb); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x00ec); + MP_WritePhyUshort(sc, 0x19, 0xb60a); + MP_WritePhyUshort(sc, 0x15, 0x00ed); + MP_WritePhyUshort(sc, 0x19, 0xda07); + MP_WritePhyUshort(sc, 0x15, 0x00ee); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x00ef); + MP_WritePhyUshort(sc, 0x19, 0xc60b); + MP_WritePhyUshort(sc, 0x15, 0x00f0); + MP_WritePhyUshort(sc, 0x19, 0x00fc); + MP_WritePhyUshort(sc, 0x15, 0x00f1); + MP_WritePhyUshort(sc, 0x19, 0x30f6); + MP_WritePhyUshort(sc, 0x15, 0x00f2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00f3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00f4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00f5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x00f6); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x00f7); + MP_WritePhyUshort(sc, 0x19, 0x480b); + MP_WritePhyUshort(sc, 0x15, 0x00f8); + MP_WritePhyUshort(sc, 0x19, 0x6f03); + MP_WritePhyUshort(sc, 0x15, 0x00f9); + MP_WritePhyUshort(sc, 0x19, 0x405f); + MP_WritePhyUshort(sc, 0x15, 0x00fa); + MP_WritePhyUshort(sc, 0x19, 0x4448); + MP_WritePhyUshort(sc, 0x15, 0x00fb); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x00fc); + MP_WritePhyUshort(sc, 0x19, 0x4468); + MP_WritePhyUshort(sc, 0x15, 0x00fd); + MP_WritePhyUshort(sc, 0x19, 0x9c03); + MP_WritePhyUshort(sc, 0x15, 0x00fe); + MP_WritePhyUshort(sc, 0x19, 0x6f07); + MP_WritePhyUshort(sc, 0x15, 0x00ff); + MP_WritePhyUshort(sc, 0x19, 0x58a0); + MP_WritePhyUshort(sc, 0x15, 0x0100); + MP_WritePhyUshort(sc, 0x19, 0xd6d1); + MP_WritePhyUshort(sc, 0x15, 0x0101); + MP_WritePhyUshort(sc, 0x19, 0x0004); + MP_WritePhyUshort(sc, 0x15, 0x0102); + MP_WritePhyUshort(sc, 0x19, 0xc137); + MP_WritePhyUshort(sc, 0x15, 0x0103); + MP_WritePhyUshort(sc, 0x19, 0x0002); + MP_WritePhyUshort(sc, 0x15, 0x0104); + MP_WritePhyUshort(sc, 0x19, 0xa0e5); + MP_WritePhyUshort(sc, 0x15, 0x0105); + MP_WritePhyUshort(sc, 0x19, 0x9df8); + MP_WritePhyUshort(sc, 0x15, 0x0106); + MP_WritePhyUshort(sc, 0x19, 0x30c6); + MP_WritePhyUshort(sc, 0x15, 0x0107); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0108); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0109); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x010a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x010b); + MP_WritePhyUshort(sc, 0x19, 0x4808); + MP_WritePhyUshort(sc, 0x15, 0x010c); + MP_WritePhyUshort(sc, 0x19, 0xc32d); + MP_WritePhyUshort(sc, 0x15, 0x010d); + MP_WritePhyUshort(sc, 0x19, 0x0003); + MP_WritePhyUshort(sc, 0x15, 0x010e); + MP_WritePhyUshort(sc, 0x19, 0xc8b3); + MP_WritePhyUshort(sc, 0x15, 0x010f); + MP_WritePhyUshort(sc, 0x19, 0x00fc); + MP_WritePhyUshort(sc, 0x15, 0x0110); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x0111); + MP_WritePhyUshort(sc, 0x19, 0x3116); + MP_WritePhyUshort(sc, 0x15, 0x0112); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0113); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0114); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0115); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0116); + MP_WritePhyUshort(sc, 0x19, 0x4803); + MP_WritePhyUshort(sc, 0x15, 0x0117); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0118); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x0119); + MP_WritePhyUshort(sc, 0x19, 0x7c04); + MP_WritePhyUshort(sc, 0x15, 0x011a); + MP_WritePhyUshort(sc, 0x19, 0x6000); + MP_WritePhyUshort(sc, 0x15, 0x011b); + MP_WritePhyUshort(sc, 0x19, 0x5cf7); + MP_WritePhyUshort(sc, 0x15, 0x011c); + MP_WritePhyUshort(sc, 0x19, 0x7c2a); + MP_WritePhyUshort(sc, 0x15, 0x011d); + MP_WritePhyUshort(sc, 0x19, 0x5800); + MP_WritePhyUshort(sc, 0x15, 0x011e); + MP_WritePhyUshort(sc, 0x19, 0x5400); + MP_WritePhyUshort(sc, 0x15, 0x011f); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0120); + MP_WritePhyUshort(sc, 0x19, 0x74f0); + MP_WritePhyUshort(sc, 0x15, 0x0121); + MP_WritePhyUshort(sc, 0x19, 0x4019); + MP_WritePhyUshort(sc, 0x15, 0x0122); + MP_WritePhyUshort(sc, 0x19, 0x440d); + MP_WritePhyUshort(sc, 0x15, 0x0123); + MP_WritePhyUshort(sc, 0x19, 0xb6c1); + MP_WritePhyUshort(sc, 0x15, 0x0124); + MP_WritePhyUshort(sc, 0x19, 0xc05b); + MP_WritePhyUshort(sc, 0x15, 0x0125); + MP_WritePhyUshort(sc, 0x19, 0x00bf); + MP_WritePhyUshort(sc, 0x15, 0x0126); + MP_WritePhyUshort(sc, 0x19, 0xc025); + MP_WritePhyUshort(sc, 0x15, 0x0127); + MP_WritePhyUshort(sc, 0x19, 0x00bd); + MP_WritePhyUshort(sc, 0x15, 0x0128); + MP_WritePhyUshort(sc, 0x19, 0xc603); + MP_WritePhyUshort(sc, 0x15, 0x0129); + MP_WritePhyUshort(sc, 0x19, 0x00bb); + MP_WritePhyUshort(sc, 0x15, 0x012a); + MP_WritePhyUshort(sc, 0x19, 0x8805); + MP_WritePhyUshort(sc, 0x15, 0x012b); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x012c); + MP_WritePhyUshort(sc, 0x19, 0x4001); + MP_WritePhyUshort(sc, 0x15, 0x012d); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x012e); + MP_WritePhyUshort(sc, 0x19, 0xa3dd); + MP_WritePhyUshort(sc, 0x15, 0x012f); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0130); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x0131); + MP_WritePhyUshort(sc, 0x19, 0x8407); + MP_WritePhyUshort(sc, 0x15, 0x0132); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0133); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x0134); + MP_WritePhyUshort(sc, 0x19, 0xd9b8); + MP_WritePhyUshort(sc, 0x15, 0x0135); + MP_WritePhyUshort(sc, 0x19, 0x0003); + MP_WritePhyUshort(sc, 0x15, 0x0136); + MP_WritePhyUshort(sc, 0x19, 0xc240); + MP_WritePhyUshort(sc, 0x15, 0x0137); + MP_WritePhyUshort(sc, 0x19, 0x0015); + MP_WritePhyUshort(sc, 0x15, 0x0138); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0139); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x013a); + MP_WritePhyUshort(sc, 0x19, 0x9ae9); + MP_WritePhyUshort(sc, 0x15, 0x013b); + MP_WritePhyUshort(sc, 0x19, 0x3140); + MP_WritePhyUshort(sc, 0x15, 0x013c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x013d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x013e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x013f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0140); + MP_WritePhyUshort(sc, 0x19, 0x4807); + MP_WritePhyUshort(sc, 0x15, 0x0141); + MP_WritePhyUshort(sc, 0x19, 0x4004); + MP_WritePhyUshort(sc, 0x15, 0x0142); + MP_WritePhyUshort(sc, 0x19, 0x4410); + MP_WritePhyUshort(sc, 0x15, 0x0143); + MP_WritePhyUshort(sc, 0x19, 0x7c0c); + MP_WritePhyUshort(sc, 0x15, 0x0144); + MP_WritePhyUshort(sc, 0x19, 0x600c); + MP_WritePhyUshort(sc, 0x15, 0x0145); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x15, 0x0146); + MP_WritePhyUshort(sc, 0x19, 0xa68f); + MP_WritePhyUshort(sc, 0x15, 0x0147); + MP_WritePhyUshort(sc, 0x19, 0x3116); + MP_WritePhyUshort(sc, 0x15, 0x0148); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0149); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x014a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x014b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x014c); + MP_WritePhyUshort(sc, 0x19, 0x4804); + MP_WritePhyUshort(sc, 0x15, 0x014d); + MP_WritePhyUshort(sc, 0x19, 0x54c0); + MP_WritePhyUshort(sc, 0x15, 0x014e); + MP_WritePhyUshort(sc, 0x19, 0xb703); + MP_WritePhyUshort(sc, 0x15, 0x014f); + MP_WritePhyUshort(sc, 0x19, 0x5cff); + MP_WritePhyUshort(sc, 0x15, 0x0150); + MP_WritePhyUshort(sc, 0x19, 0x315f); + MP_WritePhyUshort(sc, 0x15, 0x0151); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0152); + MP_WritePhyUshort(sc, 0x19, 0x74f8); + MP_WritePhyUshort(sc, 0x15, 0x0153); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0154); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0155); + MP_WritePhyUshort(sc, 0x19, 0x6000); + MP_WritePhyUshort(sc, 0x15, 0x0156); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x0157); + MP_WritePhyUshort(sc, 0x19, 0x4418); + MP_WritePhyUshort(sc, 0x15, 0x0158); + MP_WritePhyUshort(sc, 0x19, 0x9b00); + MP_WritePhyUshort(sc, 0x15, 0x0159); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x015a); + MP_WritePhyUshort(sc, 0x19, 0x64e1); + MP_WritePhyUshort(sc, 0x15, 0x015b); + MP_WritePhyUshort(sc, 0x19, 0x7c20); + MP_WritePhyUshort(sc, 0x15, 0x015c); + MP_WritePhyUshort(sc, 0x19, 0x5820); + MP_WritePhyUshort(sc, 0x15, 0x015d); + MP_WritePhyUshort(sc, 0x19, 0x5ccf); + MP_WritePhyUshort(sc, 0x15, 0x015e); + MP_WritePhyUshort(sc, 0x19, 0x7050); + MP_WritePhyUshort(sc, 0x15, 0x015f); + MP_WritePhyUshort(sc, 0x19, 0xd9b8); + MP_WritePhyUshort(sc, 0x15, 0x0160); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x0161); + MP_WritePhyUshort(sc, 0x19, 0xdab1); + MP_WritePhyUshort(sc, 0x15, 0x0162); + MP_WritePhyUshort(sc, 0x19, 0x0015); + MP_WritePhyUshort(sc, 0x15, 0x0163); + MP_WritePhyUshort(sc, 0x19, 0xc244); + MP_WritePhyUshort(sc, 0x15, 0x0164); + MP_WritePhyUshort(sc, 0x19, 0x0013); + MP_WritePhyUshort(sc, 0x15, 0x0165); + MP_WritePhyUshort(sc, 0x19, 0xc021); + MP_WritePhyUshort(sc, 0x15, 0x0166); + MP_WritePhyUshort(sc, 0x19, 0x00f9); + MP_WritePhyUshort(sc, 0x15, 0x0167); + MP_WritePhyUshort(sc, 0x19, 0x3177); + MP_WritePhyUshort(sc, 0x15, 0x0168); + MP_WritePhyUshort(sc, 0x19, 0x5cf7); + MP_WritePhyUshort(sc, 0x15, 0x0169); + MP_WritePhyUshort(sc, 0x19, 0x4010); + MP_WritePhyUshort(sc, 0x15, 0x016a); + MP_WritePhyUshort(sc, 0x19, 0x4428); + MP_WritePhyUshort(sc, 0x15, 0x016b); + MP_WritePhyUshort(sc, 0x19, 0x9c00); + MP_WritePhyUshort(sc, 0x15, 0x016c); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x016d); + MP_WritePhyUshort(sc, 0x19, 0x6008); + MP_WritePhyUshort(sc, 0x15, 0x016e); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x016f); + MP_WritePhyUshort(sc, 0x19, 0x74f0); + MP_WritePhyUshort(sc, 0x15, 0x0170); + MP_WritePhyUshort(sc, 0x19, 0x6461); + MP_WritePhyUshort(sc, 0x15, 0x0171); + MP_WritePhyUshort(sc, 0x19, 0x6421); + MP_WritePhyUshort(sc, 0x15, 0x0172); + MP_WritePhyUshort(sc, 0x19, 0x64a1); + MP_WritePhyUshort(sc, 0x15, 0x0173); + MP_WritePhyUshort(sc, 0x19, 0x3116); + MP_WritePhyUshort(sc, 0x15, 0x0174); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0175); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0176); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0177); + MP_WritePhyUshort(sc, 0x19, 0x4805); + MP_WritePhyUshort(sc, 0x15, 0x0178); + MP_WritePhyUshort(sc, 0x19, 0xa103); + MP_WritePhyUshort(sc, 0x15, 0x0179); + MP_WritePhyUshort(sc, 0x19, 0x7c02); + MP_WritePhyUshort(sc, 0x15, 0x017a); + MP_WritePhyUshort(sc, 0x19, 0x6002); + MP_WritePhyUshort(sc, 0x15, 0x017b); + MP_WritePhyUshort(sc, 0x19, 0x7e00); + MP_WritePhyUshort(sc, 0x15, 0x017c); + MP_WritePhyUshort(sc, 0x19, 0x5400); + MP_WritePhyUshort(sc, 0x15, 0x017d); + MP_WritePhyUshort(sc, 0x19, 0x7c6b); + MP_WritePhyUshort(sc, 0x15, 0x017e); + MP_WritePhyUshort(sc, 0x19, 0x5c63); + MP_WritePhyUshort(sc, 0x15, 0x017f); + MP_WritePhyUshort(sc, 0x19, 0x407d); + MP_WritePhyUshort(sc, 0x15, 0x0180); + MP_WritePhyUshort(sc, 0x19, 0xa602); + MP_WritePhyUshort(sc, 0x15, 0x0181); + MP_WritePhyUshort(sc, 0x19, 0x4001); + MP_WritePhyUshort(sc, 0x15, 0x0182); + MP_WritePhyUshort(sc, 0x19, 0x4420); + MP_WritePhyUshort(sc, 0x15, 0x0183); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x0184); + MP_WritePhyUshort(sc, 0x19, 0x44a1); + MP_WritePhyUshort(sc, 0x15, 0x0185); + MP_WritePhyUshort(sc, 0x19, 0xd6e0); + MP_WritePhyUshort(sc, 0x15, 0x0186); + MP_WritePhyUshort(sc, 0x19, 0x0009); + MP_WritePhyUshort(sc, 0x15, 0x0187); + MP_WritePhyUshort(sc, 0x19, 0x9efe); + MP_WritePhyUshort(sc, 0x15, 0x0188); + MP_WritePhyUshort(sc, 0x19, 0x7c02); + MP_WritePhyUshort(sc, 0x15, 0x0189); + MP_WritePhyUshort(sc, 0x19, 0x6000); + MP_WritePhyUshort(sc, 0x15, 0x018a); + MP_WritePhyUshort(sc, 0x19, 0x9c00); + MP_WritePhyUshort(sc, 0x15, 0x018b); + MP_WritePhyUshort(sc, 0x19, 0x318f); + MP_WritePhyUshort(sc, 0x15, 0x018c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x018d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x018e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x018f); + MP_WritePhyUshort(sc, 0x19, 0x4806); + MP_WritePhyUshort(sc, 0x15, 0x0190); + MP_WritePhyUshort(sc, 0x19, 0x7c10); + MP_WritePhyUshort(sc, 0x15, 0x0191); + MP_WritePhyUshort(sc, 0x19, 0x5c10); + MP_WritePhyUshort(sc, 0x15, 0x0192); + MP_WritePhyUshort(sc, 0x19, 0x40fa); + MP_WritePhyUshort(sc, 0x15, 0x0193); + MP_WritePhyUshort(sc, 0x19, 0xa602); + MP_WritePhyUshort(sc, 0x15, 0x0194); + MP_WritePhyUshort(sc, 0x19, 0x4010); + MP_WritePhyUshort(sc, 0x15, 0x0195); + MP_WritePhyUshort(sc, 0x19, 0x4440); + MP_WritePhyUshort(sc, 0x15, 0x0196); + MP_WritePhyUshort(sc, 0x19, 0x9d00); + MP_WritePhyUshort(sc, 0x15, 0x0197); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x0198); + MP_WritePhyUshort(sc, 0x19, 0x6400); + MP_WritePhyUshort(sc, 0x15, 0x0199); + MP_WritePhyUshort(sc, 0x19, 0x4003); + MP_WritePhyUshort(sc, 0x15, 0x019a); + MP_WritePhyUshort(sc, 0x19, 0x4540); + MP_WritePhyUshort(sc, 0x15, 0x019b); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x019c); + MP_WritePhyUshort(sc, 0x19, 0x6008); + MP_WritePhyUshort(sc, 0x15, 0x019d); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x019e); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x019f); + MP_WritePhyUshort(sc, 0x19, 0x6400); + MP_WritePhyUshort(sc, 0x15, 0x01a0); + MP_WritePhyUshort(sc, 0x19, 0x7c80); + MP_WritePhyUshort(sc, 0x15, 0x01a1); + MP_WritePhyUshort(sc, 0x19, 0x6480); + MP_WritePhyUshort(sc, 0x15, 0x01a2); + MP_WritePhyUshort(sc, 0x19, 0x3140); + MP_WritePhyUshort(sc, 0x15, 0x01a3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01a4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01a5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01a6); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x01a7); + MP_WritePhyUshort(sc, 0x19, 0x7c0b); + MP_WritePhyUshort(sc, 0x15, 0x01a8); + MP_WritePhyUshort(sc, 0x19, 0x6c01); + MP_WritePhyUshort(sc, 0x15, 0x01a9); + MP_WritePhyUshort(sc, 0x19, 0x64a8); + MP_WritePhyUshort(sc, 0x15, 0x01aa); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x01ab); + MP_WritePhyUshort(sc, 0x19, 0x5cf0); + MP_WritePhyUshort(sc, 0x15, 0x01ac); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x01ad); + MP_WritePhyUshort(sc, 0x19, 0xb628); + MP_WritePhyUshort(sc, 0x15, 0x01ae); + MP_WritePhyUshort(sc, 0x19, 0xc053); + MP_WritePhyUshort(sc, 0x15, 0x01af); + MP_WritePhyUshort(sc, 0x19, 0x0026); + MP_WritePhyUshort(sc, 0x15, 0x01b0); + MP_WritePhyUshort(sc, 0x19, 0xc02d); + MP_WritePhyUshort(sc, 0x15, 0x01b1); + MP_WritePhyUshort(sc, 0x19, 0x0024); + MP_WritePhyUshort(sc, 0x15, 0x01b2); + MP_WritePhyUshort(sc, 0x19, 0xc603); + MP_WritePhyUshort(sc, 0x15, 0x01b3); + MP_WritePhyUshort(sc, 0x19, 0x0022); + MP_WritePhyUshort(sc, 0x15, 0x01b4); + MP_WritePhyUshort(sc, 0x19, 0x8cf9); + MP_WritePhyUshort(sc, 0x15, 0x01b5); + MP_WritePhyUshort(sc, 0x19, 0x31ba); + MP_WritePhyUshort(sc, 0x15, 0x01b6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01b7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01b8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01b9); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01ba); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x01bb); + MP_WritePhyUshort(sc, 0x19, 0x5420); + MP_WritePhyUshort(sc, 0x15, 0x01bc); + MP_WritePhyUshort(sc, 0x19, 0x4811); + MP_WritePhyUshort(sc, 0x15, 0x01bd); + MP_WritePhyUshort(sc, 0x19, 0x5000); + MP_WritePhyUshort(sc, 0x15, 0x01be); + MP_WritePhyUshort(sc, 0x19, 0x4801); + MP_WritePhyUshort(sc, 0x15, 0x01bf); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x01c0); + MP_WritePhyUshort(sc, 0x19, 0x31f5); + MP_WritePhyUshort(sc, 0x15, 0x01c1); + MP_WritePhyUshort(sc, 0x19, 0xb614); + MP_WritePhyUshort(sc, 0x15, 0x01c2); + MP_WritePhyUshort(sc, 0x19, 0x8ce4); + MP_WritePhyUshort(sc, 0x15, 0x01c3); + MP_WritePhyUshort(sc, 0x19, 0xb30c); + MP_WritePhyUshort(sc, 0x15, 0x01c4); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x01c5); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x01c6); + MP_WritePhyUshort(sc, 0x19, 0x8206); + MP_WritePhyUshort(sc, 0x15, 0x01c7); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x01c8); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x01c9); + MP_WritePhyUshort(sc, 0x19, 0x7c04); + MP_WritePhyUshort(sc, 0x15, 0x01ca); + MP_WritePhyUshort(sc, 0x19, 0x7404); + MP_WritePhyUshort(sc, 0x15, 0x01cb); + MP_WritePhyUshort(sc, 0x19, 0x31c0); + MP_WritePhyUshort(sc, 0x15, 0x01cc); + MP_WritePhyUshort(sc, 0x19, 0x7c04); + MP_WritePhyUshort(sc, 0x15, 0x01cd); + MP_WritePhyUshort(sc, 0x19, 0x7400); + MP_WritePhyUshort(sc, 0x15, 0x01ce); + MP_WritePhyUshort(sc, 0x19, 0x31c0); + MP_WritePhyUshort(sc, 0x15, 0x01cf); + MP_WritePhyUshort(sc, 0x19, 0x8df1); + MP_WritePhyUshort(sc, 0x15, 0x01d0); + MP_WritePhyUshort(sc, 0x19, 0x3248); + MP_WritePhyUshort(sc, 0x15, 0x01d1); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01d2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01d3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01d4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01d5); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x01d6); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x01d7); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x01d8); + MP_WritePhyUshort(sc, 0x19, 0x7670); + MP_WritePhyUshort(sc, 0x15, 0x01d9); + MP_WritePhyUshort(sc, 0x19, 0x4023); + MP_WritePhyUshort(sc, 0x15, 0x01da); + MP_WritePhyUshort(sc, 0x19, 0x4500); + MP_WritePhyUshort(sc, 0x15, 0x01db); + MP_WritePhyUshort(sc, 0x19, 0x4069); + MP_WritePhyUshort(sc, 0x15, 0x01dc); + MP_WritePhyUshort(sc, 0x19, 0x4580); + MP_WritePhyUshort(sc, 0x15, 0x01dd); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x01de); + MP_WritePhyUshort(sc, 0x19, 0xcff5); + MP_WritePhyUshort(sc, 0x15, 0x01df); + MP_WritePhyUshort(sc, 0x19, 0x00ff); + MP_WritePhyUshort(sc, 0x15, 0x01e0); + MP_WritePhyUshort(sc, 0x19, 0x76f0); + MP_WritePhyUshort(sc, 0x15, 0x01e1); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x01e2); + MP_WritePhyUshort(sc, 0x19, 0x4023); + MP_WritePhyUshort(sc, 0x15, 0x01e3); + MP_WritePhyUshort(sc, 0x19, 0x4500); + MP_WritePhyUshort(sc, 0x15, 0x01e4); + MP_WritePhyUshort(sc, 0x19, 0x4069); + MP_WritePhyUshort(sc, 0x15, 0x01e5); + MP_WritePhyUshort(sc, 0x19, 0x4580); + MP_WritePhyUshort(sc, 0x15, 0x01e6); + MP_WritePhyUshort(sc, 0x19, 0x9f00); + MP_WritePhyUshort(sc, 0x15, 0x01e7); + MP_WritePhyUshort(sc, 0x19, 0xd0f5); + MP_WritePhyUshort(sc, 0x15, 0x01e8); + MP_WritePhyUshort(sc, 0x19, 0x00ff); + MP_WritePhyUshort(sc, 0x15, 0x01e9); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x01ea); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x01eb); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x01ec); + MP_WritePhyUshort(sc, 0x19, 0x66a0); + MP_WritePhyUshort(sc, 0x15, 0x01ed); + MP_WritePhyUshort(sc, 0x19, 0x8300); + MP_WritePhyUshort(sc, 0x15, 0x01ee); + MP_WritePhyUshort(sc, 0x19, 0x74f0); + MP_WritePhyUshort(sc, 0x15, 0x01ef); + MP_WritePhyUshort(sc, 0x19, 0x3006); + MP_WritePhyUshort(sc, 0x15, 0x01f0); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01f1); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01f2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01f3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01f4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x01f5); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x01f6); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x01f7); + MP_WritePhyUshort(sc, 0x19, 0x409d); + MP_WritePhyUshort(sc, 0x15, 0x01f8); + MP_WritePhyUshort(sc, 0x19, 0x7c87); + MP_WritePhyUshort(sc, 0x15, 0x01f9); + MP_WritePhyUshort(sc, 0x19, 0xae14); + MP_WritePhyUshort(sc, 0x15, 0x01fa); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x01fb); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x01fc); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x01fd); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x01fe); + MP_WritePhyUshort(sc, 0x19, 0x980e); + MP_WritePhyUshort(sc, 0x15, 0x01ff); + MP_WritePhyUshort(sc, 0x19, 0x930c); + MP_WritePhyUshort(sc, 0x15, 0x0200); + MP_WritePhyUshort(sc, 0x19, 0x9206); + MP_WritePhyUshort(sc, 0x15, 0x0201); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0202); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0203); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0204); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0205); + MP_WritePhyUshort(sc, 0x19, 0x320c); + MP_WritePhyUshort(sc, 0x15, 0x0206); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x15, 0x0207); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0208); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x0209); + MP_WritePhyUshort(sc, 0x19, 0x5500); + MP_WritePhyUshort(sc, 0x15, 0x020a); + MP_WritePhyUshort(sc, 0x19, 0x320c); + MP_WritePhyUshort(sc, 0x15, 0x020b); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x020c); + MP_WritePhyUshort(sc, 0x19, 0x3220); + MP_WritePhyUshort(sc, 0x15, 0x020d); + MP_WritePhyUshort(sc, 0x19, 0x4480); + MP_WritePhyUshort(sc, 0x15, 0x020e); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x020f); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0210); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x0211); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0212); + MP_WritePhyUshort(sc, 0x19, 0x980e); + MP_WritePhyUshort(sc, 0x15, 0x0213); + MP_WritePhyUshort(sc, 0x19, 0x930c); + MP_WritePhyUshort(sc, 0x15, 0x0214); + MP_WritePhyUshort(sc, 0x19, 0x9206); + MP_WritePhyUshort(sc, 0x15, 0x0215); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x15, 0x0216); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0217); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0218); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0219); + MP_WritePhyUshort(sc, 0x19, 0x3220); + MP_WritePhyUshort(sc, 0x15, 0x021a); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x021b); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x021c); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x021d); + MP_WritePhyUshort(sc, 0x19, 0x5540); + MP_WritePhyUshort(sc, 0x15, 0x021e); + MP_WritePhyUshort(sc, 0x19, 0x3220); + MP_WritePhyUshort(sc, 0x15, 0x021f); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x15, 0x0220); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0221); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0222); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0223); + MP_WritePhyUshort(sc, 0x19, 0x3231); + MP_WritePhyUshort(sc, 0x15, 0x0224); + MP_WritePhyUshort(sc, 0x19, 0xab06); + MP_WritePhyUshort(sc, 0x15, 0x0225); + MP_WritePhyUshort(sc, 0x19, 0xbf08); + MP_WritePhyUshort(sc, 0x15, 0x0226); + MP_WritePhyUshort(sc, 0x19, 0x4076); + MP_WritePhyUshort(sc, 0x15, 0x0227); + MP_WritePhyUshort(sc, 0x19, 0x7d07); + MP_WritePhyUshort(sc, 0x15, 0x0228); + MP_WritePhyUshort(sc, 0x19, 0x4502); + MP_WritePhyUshort(sc, 0x15, 0x0229); + MP_WritePhyUshort(sc, 0x19, 0x3231); + MP_WritePhyUshort(sc, 0x15, 0x022a); + MP_WritePhyUshort(sc, 0x19, 0x7d80); + MP_WritePhyUshort(sc, 0x15, 0x022b); + MP_WritePhyUshort(sc, 0x19, 0x5180); + MP_WritePhyUshort(sc, 0x15, 0x022c); + MP_WritePhyUshort(sc, 0x19, 0x322f); + MP_WritePhyUshort(sc, 0x15, 0x022d); + MP_WritePhyUshort(sc, 0x19, 0x7d80); + MP_WritePhyUshort(sc, 0x15, 0x022e); + MP_WritePhyUshort(sc, 0x19, 0x5000); + MP_WritePhyUshort(sc, 0x15, 0x022f); + MP_WritePhyUshort(sc, 0x19, 0x7d07); + MP_WritePhyUshort(sc, 0x15, 0x0230); + MP_WritePhyUshort(sc, 0x19, 0x4402); + MP_WritePhyUshort(sc, 0x15, 0x0231); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0232); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x0233); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0234); + MP_WritePhyUshort(sc, 0x19, 0xb309); + MP_WritePhyUshort(sc, 0x15, 0x0235); + MP_WritePhyUshort(sc, 0x19, 0xb204); + MP_WritePhyUshort(sc, 0x15, 0x0236); + MP_WritePhyUshort(sc, 0x19, 0xb105); + MP_WritePhyUshort(sc, 0x15, 0x0237); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0238); + MP_WritePhyUshort(sc, 0x19, 0x31c1); + MP_WritePhyUshort(sc, 0x15, 0x0239); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x023a); + MP_WritePhyUshort(sc, 0x19, 0x3261); + MP_WritePhyUshort(sc, 0x15, 0x023b); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x023c); + MP_WritePhyUshort(sc, 0x19, 0x3250); + MP_WritePhyUshort(sc, 0x15, 0x023d); + MP_WritePhyUshort(sc, 0x19, 0xb203); + MP_WritePhyUshort(sc, 0x15, 0x023e); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x023f); + MP_WritePhyUshort(sc, 0x19, 0x327a); + MP_WritePhyUshort(sc, 0x15, 0x0240); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0241); + MP_WritePhyUshort(sc, 0x19, 0x3293); + MP_WritePhyUshort(sc, 0x15, 0x0242); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0243); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0244); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0245); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0246); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0247); + MP_WritePhyUshort(sc, 0x19, 0x32a3); + MP_WritePhyUshort(sc, 0x15, 0x0248); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0249); + MP_WritePhyUshort(sc, 0x19, 0x403d); + MP_WritePhyUshort(sc, 0x15, 0x024a); + MP_WritePhyUshort(sc, 0x19, 0x440c); + MP_WritePhyUshort(sc, 0x15, 0x024b); + MP_WritePhyUshort(sc, 0x19, 0x4812); + MP_WritePhyUshort(sc, 0x15, 0x024c); + MP_WritePhyUshort(sc, 0x19, 0x5001); + MP_WritePhyUshort(sc, 0x15, 0x024d); + MP_WritePhyUshort(sc, 0x19, 0x4802); + MP_WritePhyUshort(sc, 0x15, 0x024e); + MP_WritePhyUshort(sc, 0x19, 0x6880); + MP_WritePhyUshort(sc, 0x15, 0x024f); + MP_WritePhyUshort(sc, 0x19, 0x31f5); + MP_WritePhyUshort(sc, 0x15, 0x0250); + MP_WritePhyUshort(sc, 0x19, 0xb685); + MP_WritePhyUshort(sc, 0x15, 0x0251); + MP_WritePhyUshort(sc, 0x19, 0x801c); + MP_WritePhyUshort(sc, 0x15, 0x0252); + MP_WritePhyUshort(sc, 0x19, 0xbaf5); + MP_WritePhyUshort(sc, 0x15, 0x0253); + MP_WritePhyUshort(sc, 0x19, 0xc07c); + MP_WritePhyUshort(sc, 0x15, 0x0254); + MP_WritePhyUshort(sc, 0x19, 0x00fb); + MP_WritePhyUshort(sc, 0x15, 0x0255); + MP_WritePhyUshort(sc, 0x19, 0x325a); + MP_WritePhyUshort(sc, 0x15, 0x0256); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0257); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0258); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0259); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x025a); + MP_WritePhyUshort(sc, 0x19, 0x481a); + MP_WritePhyUshort(sc, 0x15, 0x025b); + MP_WritePhyUshort(sc, 0x19, 0x5001); + MP_WritePhyUshort(sc, 0x15, 0x025c); + MP_WritePhyUshort(sc, 0x19, 0x401b); + MP_WritePhyUshort(sc, 0x15, 0x025d); + MP_WritePhyUshort(sc, 0x19, 0x480a); + MP_WritePhyUshort(sc, 0x15, 0x025e); + MP_WritePhyUshort(sc, 0x19, 0x4418); + MP_WritePhyUshort(sc, 0x15, 0x025f); + MP_WritePhyUshort(sc, 0x19, 0x6900); + MP_WritePhyUshort(sc, 0x15, 0x0260); + MP_WritePhyUshort(sc, 0x19, 0x31f5); + MP_WritePhyUshort(sc, 0x15, 0x0261); + MP_WritePhyUshort(sc, 0x19, 0xb64b); + MP_WritePhyUshort(sc, 0x15, 0x0262); + MP_WritePhyUshort(sc, 0x19, 0xdb00); + MP_WritePhyUshort(sc, 0x15, 0x0263); + MP_WritePhyUshort(sc, 0x19, 0x0048); + MP_WritePhyUshort(sc, 0x15, 0x0264); + MP_WritePhyUshort(sc, 0x19, 0xdb7d); + MP_WritePhyUshort(sc, 0x15, 0x0265); + MP_WritePhyUshort(sc, 0x19, 0x0002); + MP_WritePhyUshort(sc, 0x15, 0x0266); + MP_WritePhyUshort(sc, 0x19, 0xa0fa); + MP_WritePhyUshort(sc, 0x15, 0x0267); + MP_WritePhyUshort(sc, 0x19, 0x4408); + MP_WritePhyUshort(sc, 0x15, 0x0268); + MP_WritePhyUshort(sc, 0x19, 0x3248); + MP_WritePhyUshort(sc, 0x15, 0x0269); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x026a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x026b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x026c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x026d); + MP_WritePhyUshort(sc, 0x19, 0xb806); + MP_WritePhyUshort(sc, 0x15, 0x026e); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x026f); + MP_WritePhyUshort(sc, 0x19, 0x5500); + MP_WritePhyUshort(sc, 0x15, 0x0270); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0271); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0272); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0273); + MP_WritePhyUshort(sc, 0x19, 0x4814); + MP_WritePhyUshort(sc, 0x15, 0x0274); + MP_WritePhyUshort(sc, 0x19, 0x500b); + MP_WritePhyUshort(sc, 0x15, 0x0275); + MP_WritePhyUshort(sc, 0x19, 0x4804); + MP_WritePhyUshort(sc, 0x15, 0x0276); + MP_WritePhyUshort(sc, 0x19, 0x40c4); + MP_WritePhyUshort(sc, 0x15, 0x0277); + MP_WritePhyUshort(sc, 0x19, 0x4425); + MP_WritePhyUshort(sc, 0x15, 0x0278); + MP_WritePhyUshort(sc, 0x19, 0x6a00); + MP_WritePhyUshort(sc, 0x15, 0x0279); + MP_WritePhyUshort(sc, 0x19, 0x31f5); + MP_WritePhyUshort(sc, 0x15, 0x027a); + MP_WritePhyUshort(sc, 0x19, 0xb632); + MP_WritePhyUshort(sc, 0x15, 0x027b); + MP_WritePhyUshort(sc, 0x19, 0xdc03); + MP_WritePhyUshort(sc, 0x15, 0x027c); + MP_WritePhyUshort(sc, 0x19, 0x0027); + MP_WritePhyUshort(sc, 0x15, 0x027d); + MP_WritePhyUshort(sc, 0x19, 0x80fc); + MP_WritePhyUshort(sc, 0x15, 0x027e); + MP_WritePhyUshort(sc, 0x19, 0x3283); + MP_WritePhyUshort(sc, 0x15, 0x027f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0280); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0281); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0282); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0283); + MP_WritePhyUshort(sc, 0x19, 0xb806); + MP_WritePhyUshort(sc, 0x15, 0x0284); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0285); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0286); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0287); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x15, 0x0288); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0289); + MP_WritePhyUshort(sc, 0x19, 0x4818); + MP_WritePhyUshort(sc, 0x15, 0x028a); + MP_WritePhyUshort(sc, 0x19, 0x5051); + MP_WritePhyUshort(sc, 0x15, 0x028b); + MP_WritePhyUshort(sc, 0x19, 0x4808); + MP_WritePhyUshort(sc, 0x15, 0x028c); + MP_WritePhyUshort(sc, 0x19, 0x4050); + MP_WritePhyUshort(sc, 0x15, 0x028d); + MP_WritePhyUshort(sc, 0x19, 0x4462); + MP_WritePhyUshort(sc, 0x15, 0x028e); + MP_WritePhyUshort(sc, 0x19, 0x40c4); + MP_WritePhyUshort(sc, 0x15, 0x028f); + MP_WritePhyUshort(sc, 0x19, 0x4473); + MP_WritePhyUshort(sc, 0x15, 0x0290); + MP_WritePhyUshort(sc, 0x19, 0x5041); + MP_WritePhyUshort(sc, 0x15, 0x0291); + MP_WritePhyUshort(sc, 0x19, 0x6b00); + MP_WritePhyUshort(sc, 0x15, 0x0292); + MP_WritePhyUshort(sc, 0x19, 0x31f5); + MP_WritePhyUshort(sc, 0x15, 0x0293); + MP_WritePhyUshort(sc, 0x19, 0xb619); + MP_WritePhyUshort(sc, 0x15, 0x0294); + MP_WritePhyUshort(sc, 0x19, 0x80d9); + MP_WritePhyUshort(sc, 0x15, 0x0295); + MP_WritePhyUshort(sc, 0x19, 0xbd06); + MP_WritePhyUshort(sc, 0x15, 0x0296); + MP_WritePhyUshort(sc, 0x19, 0xbb0d); + MP_WritePhyUshort(sc, 0x15, 0x0297); + MP_WritePhyUshort(sc, 0x19, 0xaf14); + MP_WritePhyUshort(sc, 0x15, 0x0298); + MP_WritePhyUshort(sc, 0x19, 0x8efa); + MP_WritePhyUshort(sc, 0x15, 0x0299); + MP_WritePhyUshort(sc, 0x19, 0x5049); + MP_WritePhyUshort(sc, 0x15, 0x029a); + MP_WritePhyUshort(sc, 0x19, 0x3248); + MP_WritePhyUshort(sc, 0x15, 0x029b); + MP_WritePhyUshort(sc, 0x19, 0x4c10); + MP_WritePhyUshort(sc, 0x15, 0x029c); + MP_WritePhyUshort(sc, 0x19, 0x44b0); + MP_WritePhyUshort(sc, 0x15, 0x029d); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x029e); + MP_WritePhyUshort(sc, 0x19, 0x3292); + MP_WritePhyUshort(sc, 0x15, 0x029f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02a0); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02a1); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02a2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02a3); + MP_WritePhyUshort(sc, 0x19, 0x481f); + MP_WritePhyUshort(sc, 0x15, 0x02a4); + MP_WritePhyUshort(sc, 0x19, 0x5005); + MP_WritePhyUshort(sc, 0x15, 0x02a5); + MP_WritePhyUshort(sc, 0x19, 0x480f); + MP_WritePhyUshort(sc, 0x15, 0x02a6); + MP_WritePhyUshort(sc, 0x19, 0xac00); + MP_WritePhyUshort(sc, 0x15, 0x02a7); + MP_WritePhyUshort(sc, 0x19, 0x31a6); + MP_WritePhyUshort(sc, 0x15, 0x02a8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02a9); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02aa); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02ab); + MP_WritePhyUshort(sc, 0x19, 0x31ba); + MP_WritePhyUshort(sc, 0x15, 0x02ac); + MP_WritePhyUshort(sc, 0x19, 0x31d5); + MP_WritePhyUshort(sc, 0x15, 0x02ad); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02ae); + MP_WritePhyUshort(sc, 0x19, 0x5cf0); + MP_WritePhyUshort(sc, 0x15, 0x02af); + MP_WritePhyUshort(sc, 0x19, 0x588c); + MP_WritePhyUshort(sc, 0x15, 0x02b0); + MP_WritePhyUshort(sc, 0x19, 0x542f); + MP_WritePhyUshort(sc, 0x15, 0x02b1); + MP_WritePhyUshort(sc, 0x19, 0x7ffb); + MP_WritePhyUshort(sc, 0x15, 0x02b2); + MP_WritePhyUshort(sc, 0x19, 0x6ff8); + MP_WritePhyUshort(sc, 0x15, 0x02b3); + MP_WritePhyUshort(sc, 0x19, 0x64a4); + MP_WritePhyUshort(sc, 0x15, 0x02b4); + MP_WritePhyUshort(sc, 0x19, 0x64a0); + MP_WritePhyUshort(sc, 0x15, 0x02b5); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x02b6); + MP_WritePhyUshort(sc, 0x19, 0x4400); + MP_WritePhyUshort(sc, 0x15, 0x02b7); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x02b8); + MP_WritePhyUshort(sc, 0x19, 0x4480); + MP_WritePhyUshort(sc, 0x15, 0x02b9); + MP_WritePhyUshort(sc, 0x19, 0x9e00); + MP_WritePhyUshort(sc, 0x15, 0x02ba); + MP_WritePhyUshort(sc, 0x19, 0x4891); + MP_WritePhyUshort(sc, 0x15, 0x02bb); + MP_WritePhyUshort(sc, 0x19, 0x4cc0); + MP_WritePhyUshort(sc, 0x15, 0x02bc); + MP_WritePhyUshort(sc, 0x19, 0x4801); + MP_WritePhyUshort(sc, 0x15, 0x02bd); + MP_WritePhyUshort(sc, 0x19, 0xa609); + MP_WritePhyUshort(sc, 0x15, 0x02be); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x02bf); + MP_WritePhyUshort(sc, 0x19, 0x004e); + MP_WritePhyUshort(sc, 0x15, 0x02c0); + MP_WritePhyUshort(sc, 0x19, 0x87fe); + MP_WritePhyUshort(sc, 0x15, 0x02c1); + MP_WritePhyUshort(sc, 0x19, 0x32c6); + MP_WritePhyUshort(sc, 0x15, 0x02c2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02c3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02c4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02c5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02c6); + MP_WritePhyUshort(sc, 0x19, 0x48b2); + MP_WritePhyUshort(sc, 0x15, 0x02c7); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x02c8); + MP_WritePhyUshort(sc, 0x19, 0x4822); + MP_WritePhyUshort(sc, 0x15, 0x02c9); + MP_WritePhyUshort(sc, 0x19, 0x4488); + MP_WritePhyUshort(sc, 0x15, 0x02ca); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x02cb); + MP_WritePhyUshort(sc, 0x19, 0x0042); + MP_WritePhyUshort(sc, 0x15, 0x02cc); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x02cd); + MP_WritePhyUshort(sc, 0x19, 0x4cc8); + MP_WritePhyUshort(sc, 0x15, 0x02ce); + MP_WritePhyUshort(sc, 0x19, 0x32d0); + MP_WritePhyUshort(sc, 0x15, 0x02cf); + MP_WritePhyUshort(sc, 0x19, 0x4cc0); + MP_WritePhyUshort(sc, 0x15, 0x02d0); + MP_WritePhyUshort(sc, 0x19, 0xc4d4); + MP_WritePhyUshort(sc, 0x15, 0x02d1); + MP_WritePhyUshort(sc, 0x19, 0x00f9); + MP_WritePhyUshort(sc, 0x15, 0x02d2); + MP_WritePhyUshort(sc, 0x19, 0xa51a); + MP_WritePhyUshort(sc, 0x15, 0x02d3); + MP_WritePhyUshort(sc, 0x19, 0x32d9); + MP_WritePhyUshort(sc, 0x15, 0x02d4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02d5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02d6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02d7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02d8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02d9); + MP_WritePhyUshort(sc, 0x19, 0x48b3); + MP_WritePhyUshort(sc, 0x15, 0x02da); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x02db); + MP_WritePhyUshort(sc, 0x19, 0x4823); + MP_WritePhyUshort(sc, 0x15, 0x02dc); + MP_WritePhyUshort(sc, 0x19, 0x4410); + MP_WritePhyUshort(sc, 0x15, 0x02dd); + MP_WritePhyUshort(sc, 0x19, 0xb630); + MP_WritePhyUshort(sc, 0x15, 0x02de); + MP_WritePhyUshort(sc, 0x19, 0x7dc8); + MP_WritePhyUshort(sc, 0x15, 0x02df); + MP_WritePhyUshort(sc, 0x19, 0x8203); + MP_WritePhyUshort(sc, 0x15, 0x02e0); + MP_WritePhyUshort(sc, 0x19, 0x4c48); + MP_WritePhyUshort(sc, 0x15, 0x02e1); + MP_WritePhyUshort(sc, 0x19, 0x32e3); + MP_WritePhyUshort(sc, 0x15, 0x02e2); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x02e3); + MP_WritePhyUshort(sc, 0x19, 0x9bfa); + MP_WritePhyUshort(sc, 0x15, 0x02e4); + MP_WritePhyUshort(sc, 0x19, 0x84ca); + MP_WritePhyUshort(sc, 0x15, 0x02e5); + MP_WritePhyUshort(sc, 0x19, 0x85f8); + MP_WritePhyUshort(sc, 0x15, 0x02e6); + MP_WritePhyUshort(sc, 0x19, 0x32ec); + MP_WritePhyUshort(sc, 0x15, 0x02e7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02e8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02e9); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02ea); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02eb); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x02ec); + MP_WritePhyUshort(sc, 0x19, 0x48d4); + MP_WritePhyUshort(sc, 0x15, 0x02ed); + MP_WritePhyUshort(sc, 0x19, 0x4020); + MP_WritePhyUshort(sc, 0x15, 0x02ee); + MP_WritePhyUshort(sc, 0x19, 0x4844); + MP_WritePhyUshort(sc, 0x15, 0x02ef); + MP_WritePhyUshort(sc, 0x19, 0x4420); + MP_WritePhyUshort(sc, 0x15, 0x02f0); + MP_WritePhyUshort(sc, 0x19, 0x6800); + MP_WritePhyUshort(sc, 0x15, 0x02f1); + MP_WritePhyUshort(sc, 0x19, 0x7dc0); + MP_WritePhyUshort(sc, 0x15, 0x02f2); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x02f3); + MP_WritePhyUshort(sc, 0x19, 0x7c0b); + MP_WritePhyUshort(sc, 0x15, 0x02f4); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x02f5); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x02f6); + MP_WritePhyUshort(sc, 0x19, 0x9cfd); + MP_WritePhyUshort(sc, 0x15, 0x02f7); + MP_WritePhyUshort(sc, 0x19, 0xb616); + MP_WritePhyUshort(sc, 0x15, 0x02f8); + MP_WritePhyUshort(sc, 0x19, 0xc42b); + MP_WritePhyUshort(sc, 0x15, 0x02f9); + MP_WritePhyUshort(sc, 0x19, 0x00e0); + MP_WritePhyUshort(sc, 0x15, 0x02fa); + MP_WritePhyUshort(sc, 0x19, 0xc455); + MP_WritePhyUshort(sc, 0x15, 0x02fb); + MP_WritePhyUshort(sc, 0x19, 0x00b3); + MP_WritePhyUshort(sc, 0x15, 0x02fc); + MP_WritePhyUshort(sc, 0x19, 0xb20a); + MP_WritePhyUshort(sc, 0x15, 0x02fd); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x02fe); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x02ff); + MP_WritePhyUshort(sc, 0x19, 0x8204); + MP_WritePhyUshort(sc, 0x15, 0x0300); + MP_WritePhyUshort(sc, 0x19, 0x7c04); + MP_WritePhyUshort(sc, 0x15, 0x0301); + MP_WritePhyUshort(sc, 0x19, 0x7404); + MP_WritePhyUshort(sc, 0x15, 0x0302); + MP_WritePhyUshort(sc, 0x19, 0x32f3); + MP_WritePhyUshort(sc, 0x15, 0x0303); + MP_WritePhyUshort(sc, 0x19, 0x7c04); + MP_WritePhyUshort(sc, 0x15, 0x0304); + MP_WritePhyUshort(sc, 0x19, 0x7400); + MP_WritePhyUshort(sc, 0x15, 0x0305); + MP_WritePhyUshort(sc, 0x19, 0x32f3); + MP_WritePhyUshort(sc, 0x15, 0x0306); + MP_WritePhyUshort(sc, 0x19, 0xefed); + MP_WritePhyUshort(sc, 0x15, 0x0307); + MP_WritePhyUshort(sc, 0x19, 0x3342); + MP_WritePhyUshort(sc, 0x15, 0x0308); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0309); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030d); + MP_WritePhyUshort(sc, 0x19, 0x3006); + MP_WritePhyUshort(sc, 0x15, 0x030e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x030f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0310); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0311); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0312); + MP_WritePhyUshort(sc, 0x19, 0xa207); + MP_WritePhyUshort(sc, 0x15, 0x0313); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x0314); + MP_WritePhyUshort(sc, 0x19, 0x3322); + MP_WritePhyUshort(sc, 0x15, 0x0315); + MP_WritePhyUshort(sc, 0x19, 0x4041); + MP_WritePhyUshort(sc, 0x15, 0x0316); + MP_WritePhyUshort(sc, 0x19, 0x7d07); + MP_WritePhyUshort(sc, 0x15, 0x0317); + MP_WritePhyUshort(sc, 0x19, 0x4502); + MP_WritePhyUshort(sc, 0x15, 0x0318); + MP_WritePhyUshort(sc, 0x19, 0x3322); + MP_WritePhyUshort(sc, 0x15, 0x0319); + MP_WritePhyUshort(sc, 0x19, 0x4c08); + MP_WritePhyUshort(sc, 0x15, 0x031a); + MP_WritePhyUshort(sc, 0x19, 0x3322); + MP_WritePhyUshort(sc, 0x15, 0x031b); + MP_WritePhyUshort(sc, 0x19, 0x7d80); + MP_WritePhyUshort(sc, 0x15, 0x031c); + MP_WritePhyUshort(sc, 0x19, 0x5180); + MP_WritePhyUshort(sc, 0x15, 0x031d); + MP_WritePhyUshort(sc, 0x19, 0x3320); + MP_WritePhyUshort(sc, 0x15, 0x031e); + MP_WritePhyUshort(sc, 0x19, 0x7d80); + MP_WritePhyUshort(sc, 0x15, 0x031f); + MP_WritePhyUshort(sc, 0x19, 0x5000); + MP_WritePhyUshort(sc, 0x15, 0x0320); + MP_WritePhyUshort(sc, 0x19, 0x7d07); + MP_WritePhyUshort(sc, 0x15, 0x0321); + MP_WritePhyUshort(sc, 0x19, 0x4402); + MP_WritePhyUshort(sc, 0x15, 0x0322); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0323); + MP_WritePhyUshort(sc, 0x19, 0x6c02); + MP_WritePhyUshort(sc, 0x15, 0x0324); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x0325); + MP_WritePhyUshort(sc, 0x19, 0xb30c); + MP_WritePhyUshort(sc, 0x15, 0x0326); + MP_WritePhyUshort(sc, 0x19, 0xb206); + MP_WritePhyUshort(sc, 0x15, 0x0327); + MP_WritePhyUshort(sc, 0x19, 0xb103); + MP_WritePhyUshort(sc, 0x15, 0x0328); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0329); + MP_WritePhyUshort(sc, 0x19, 0x32f6); + MP_WritePhyUshort(sc, 0x15, 0x032a); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x032b); + MP_WritePhyUshort(sc, 0x19, 0x3352); + MP_WritePhyUshort(sc, 0x15, 0x032c); + MP_WritePhyUshort(sc, 0x19, 0xb103); + MP_WritePhyUshort(sc, 0x15, 0x032d); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x032e); + MP_WritePhyUshort(sc, 0x19, 0x336a); + MP_WritePhyUshort(sc, 0x15, 0x032f); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0330); + MP_WritePhyUshort(sc, 0x19, 0x3382); + MP_WritePhyUshort(sc, 0x15, 0x0331); + MP_WritePhyUshort(sc, 0x19, 0xb206); + MP_WritePhyUshort(sc, 0x15, 0x0332); + MP_WritePhyUshort(sc, 0x19, 0xb103); + MP_WritePhyUshort(sc, 0x15, 0x0333); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0334); + MP_WritePhyUshort(sc, 0x19, 0x3395); + MP_WritePhyUshort(sc, 0x15, 0x0335); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0336); + MP_WritePhyUshort(sc, 0x19, 0x33c6); + MP_WritePhyUshort(sc, 0x15, 0x0337); + MP_WritePhyUshort(sc, 0x19, 0xb103); + MP_WritePhyUshort(sc, 0x15, 0x0338); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x0339); + MP_WritePhyUshort(sc, 0x19, 0x33d7); + MP_WritePhyUshort(sc, 0x15, 0x033a); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x033b); + MP_WritePhyUshort(sc, 0x19, 0x33f2); + MP_WritePhyUshort(sc, 0x15, 0x033c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x033d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x033e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x033f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0340); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0341); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0342); + MP_WritePhyUshort(sc, 0x19, 0x49b5); + MP_WritePhyUshort(sc, 0x15, 0x0343); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x15, 0x0344); + MP_WritePhyUshort(sc, 0x19, 0x4d00); + MP_WritePhyUshort(sc, 0x15, 0x0345); + MP_WritePhyUshort(sc, 0x19, 0x6880); + MP_WritePhyUshort(sc, 0x15, 0x0346); + MP_WritePhyUshort(sc, 0x19, 0x7c08); + MP_WritePhyUshort(sc, 0x15, 0x0347); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x0348); + MP_WritePhyUshort(sc, 0x19, 0x4925); + MP_WritePhyUshort(sc, 0x15, 0x0349); + MP_WritePhyUshort(sc, 0x19, 0x403b); + MP_WritePhyUshort(sc, 0x15, 0x034a); + MP_WritePhyUshort(sc, 0x19, 0xa602); + MP_WritePhyUshort(sc, 0x15, 0x034b); + MP_WritePhyUshort(sc, 0x19, 0x402f); + MP_WritePhyUshort(sc, 0x15, 0x034c); + MP_WritePhyUshort(sc, 0x19, 0x4484); + MP_WritePhyUshort(sc, 0x15, 0x034d); + MP_WritePhyUshort(sc, 0x19, 0x40c8); + MP_WritePhyUshort(sc, 0x15, 0x034e); + MP_WritePhyUshort(sc, 0x19, 0x44c4); + MP_WritePhyUshort(sc, 0x15, 0x034f); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x0350); + MP_WritePhyUshort(sc, 0x19, 0x00bd); + MP_WritePhyUshort(sc, 0x15, 0x0351); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x0352); + MP_WritePhyUshort(sc, 0x19, 0xc8ed); + MP_WritePhyUshort(sc, 0x15, 0x0353); + MP_WritePhyUshort(sc, 0x19, 0x00fc); + MP_WritePhyUshort(sc, 0x15, 0x0354); + MP_WritePhyUshort(sc, 0x19, 0x8221); + MP_WritePhyUshort(sc, 0x15, 0x0355); + MP_WritePhyUshort(sc, 0x19, 0xd11d); + MP_WritePhyUshort(sc, 0x15, 0x0356); + MP_WritePhyUshort(sc, 0x19, 0x001f); + MP_WritePhyUshort(sc, 0x15, 0x0357); + MP_WritePhyUshort(sc, 0x19, 0xde18); + MP_WritePhyUshort(sc, 0x15, 0x0358); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x0359); + MP_WritePhyUshort(sc, 0x19, 0x91f6); + MP_WritePhyUshort(sc, 0x15, 0x035a); + MP_WritePhyUshort(sc, 0x19, 0x3360); + MP_WritePhyUshort(sc, 0x15, 0x035b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x035c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x035d); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x035e); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x035f); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0360); + MP_WritePhyUshort(sc, 0x19, 0x4bb6); + MP_WritePhyUshort(sc, 0x15, 0x0361); + MP_WritePhyUshort(sc, 0x19, 0x4064); + MP_WritePhyUshort(sc, 0x15, 0x0362); + MP_WritePhyUshort(sc, 0x19, 0x4b26); + MP_WritePhyUshort(sc, 0x15, 0x0363); + MP_WritePhyUshort(sc, 0x19, 0x4410); + MP_WritePhyUshort(sc, 0x15, 0x0364); + MP_WritePhyUshort(sc, 0x19, 0x4006); + MP_WritePhyUshort(sc, 0x15, 0x0365); + MP_WritePhyUshort(sc, 0x19, 0x4490); + MP_WritePhyUshort(sc, 0x15, 0x0366); + MP_WritePhyUshort(sc, 0x19, 0x6900); + MP_WritePhyUshort(sc, 0x15, 0x0367); + MP_WritePhyUshort(sc, 0x19, 0xb6a6); + MP_WritePhyUshort(sc, 0x15, 0x0368); + MP_WritePhyUshort(sc, 0x19, 0x9e02); + MP_WritePhyUshort(sc, 0x15, 0x0369); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x036a); + MP_WritePhyUshort(sc, 0x19, 0xd11d); + MP_WritePhyUshort(sc, 0x15, 0x036b); + MP_WritePhyUshort(sc, 0x19, 0x000a); + MP_WritePhyUshort(sc, 0x15, 0x036c); + MP_WritePhyUshort(sc, 0x19, 0xbb0f); + MP_WritePhyUshort(sc, 0x15, 0x036d); + MP_WritePhyUshort(sc, 0x19, 0x8102); + MP_WritePhyUshort(sc, 0x15, 0x036e); + MP_WritePhyUshort(sc, 0x19, 0x3371); + MP_WritePhyUshort(sc, 0x15, 0x036f); + MP_WritePhyUshort(sc, 0x19, 0xa21e); + MP_WritePhyUshort(sc, 0x15, 0x0370); + MP_WritePhyUshort(sc, 0x19, 0x33b6); + MP_WritePhyUshort(sc, 0x15, 0x0371); + MP_WritePhyUshort(sc, 0x19, 0x91f6); + MP_WritePhyUshort(sc, 0x15, 0x0372); + MP_WritePhyUshort(sc, 0x19, 0xc218); + MP_WritePhyUshort(sc, 0x15, 0x0373); + MP_WritePhyUshort(sc, 0x19, 0x00f4); + MP_WritePhyUshort(sc, 0x15, 0x0374); + MP_WritePhyUshort(sc, 0x19, 0x33b6); + MP_WritePhyUshort(sc, 0x15, 0x0375); + MP_WritePhyUshort(sc, 0x19, 0x32ec); + MP_WritePhyUshort(sc, 0x15, 0x0376); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0377); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0378); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x0379); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x037a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x037b); + MP_WritePhyUshort(sc, 0x19, 0x4b97); + MP_WritePhyUshort(sc, 0x15, 0x037c); + MP_WritePhyUshort(sc, 0x19, 0x402b); + MP_WritePhyUshort(sc, 0x15, 0x037d); + MP_WritePhyUshort(sc, 0x19, 0x4b07); + MP_WritePhyUshort(sc, 0x15, 0x037e); + MP_WritePhyUshort(sc, 0x19, 0x4422); + MP_WritePhyUshort(sc, 0x15, 0x037f); + MP_WritePhyUshort(sc, 0x19, 0x6980); + MP_WritePhyUshort(sc, 0x15, 0x0380); + MP_WritePhyUshort(sc, 0x19, 0xb608); + MP_WritePhyUshort(sc, 0x15, 0x0381); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x0382); + MP_WritePhyUshort(sc, 0x19, 0xbc05); + MP_WritePhyUshort(sc, 0x15, 0x0383); + MP_WritePhyUshort(sc, 0x19, 0xc21c); + MP_WritePhyUshort(sc, 0x15, 0x0384); + MP_WritePhyUshort(sc, 0x19, 0x0032); + MP_WritePhyUshort(sc, 0x15, 0x0385); + MP_WritePhyUshort(sc, 0x19, 0xa1fb); + MP_WritePhyUshort(sc, 0x15, 0x0386); + MP_WritePhyUshort(sc, 0x19, 0x338d); + MP_WritePhyUshort(sc, 0x15, 0x0387); + MP_WritePhyUshort(sc, 0x19, 0x32ae); + MP_WritePhyUshort(sc, 0x15, 0x0388); + MP_WritePhyUshort(sc, 0x19, 0x330d); + MP_WritePhyUshort(sc, 0x15, 0x0389); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x038a); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x038b); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x038c); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x038d); + MP_WritePhyUshort(sc, 0x19, 0x4b97); + MP_WritePhyUshort(sc, 0x15, 0x038e); + MP_WritePhyUshort(sc, 0x19, 0x6a08); + MP_WritePhyUshort(sc, 0x15, 0x038f); + MP_WritePhyUshort(sc, 0x19, 0x4b07); + MP_WritePhyUshort(sc, 0x15, 0x0390); + MP_WritePhyUshort(sc, 0x19, 0x40ac); + MP_WritePhyUshort(sc, 0x15, 0x0391); + MP_WritePhyUshort(sc, 0x19, 0x4445); + MP_WritePhyUshort(sc, 0x15, 0x0392); + MP_WritePhyUshort(sc, 0x19, 0x404e); + MP_WritePhyUshort(sc, 0x15, 0x0393); + MP_WritePhyUshort(sc, 0x19, 0x4461); + MP_WritePhyUshort(sc, 0x15, 0x0394); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x0395); + MP_WritePhyUshort(sc, 0x19, 0x9c0a); + MP_WritePhyUshort(sc, 0x15, 0x0396); + MP_WritePhyUshort(sc, 0x19, 0x63da); + MP_WritePhyUshort(sc, 0x15, 0x0397); + MP_WritePhyUshort(sc, 0x19, 0x6f0c); + MP_WritePhyUshort(sc, 0x15, 0x0398); + MP_WritePhyUshort(sc, 0x19, 0x5440); + MP_WritePhyUshort(sc, 0x15, 0x0399); + MP_WritePhyUshort(sc, 0x19, 0x4b98); + MP_WritePhyUshort(sc, 0x15, 0x039a); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x039b); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x039c); + MP_WritePhyUshort(sc, 0x19, 0x4b08); + MP_WritePhyUshort(sc, 0x15, 0x039d); + MP_WritePhyUshort(sc, 0x19, 0x63d8); + MP_WritePhyUshort(sc, 0x15, 0x039e); + MP_WritePhyUshort(sc, 0x19, 0x33a5); + MP_WritePhyUshort(sc, 0x15, 0x039f); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x03a0); + MP_WritePhyUshort(sc, 0x19, 0x00e8); + MP_WritePhyUshort(sc, 0x15, 0x03a1); + MP_WritePhyUshort(sc, 0x19, 0x820e); + MP_WritePhyUshort(sc, 0x15, 0x03a2); + MP_WritePhyUshort(sc, 0x19, 0xa10d); + MP_WritePhyUshort(sc, 0x15, 0x03a3); + MP_WritePhyUshort(sc, 0x19, 0x9df1); + MP_WritePhyUshort(sc, 0x15, 0x03a4); + MP_WritePhyUshort(sc, 0x19, 0x33af); + MP_WritePhyUshort(sc, 0x15, 0x03a5); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x03a6); + MP_WritePhyUshort(sc, 0x19, 0x00f9); + MP_WritePhyUshort(sc, 0x15, 0x03a7); + MP_WritePhyUshort(sc, 0x19, 0xc017); + MP_WritePhyUshort(sc, 0x15, 0x03a8); + MP_WritePhyUshort(sc, 0x19, 0x0007); + MP_WritePhyUshort(sc, 0x15, 0x03a9); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x03aa); + MP_WritePhyUshort(sc, 0x19, 0x6c03); + MP_WritePhyUshort(sc, 0x15, 0x03ab); + MP_WritePhyUshort(sc, 0x19, 0xa104); + MP_WritePhyUshort(sc, 0x15, 0x03ac); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x03ad); + MP_WritePhyUshort(sc, 0x19, 0x6c00); + MP_WritePhyUshort(sc, 0x15, 0x03ae); + MP_WritePhyUshort(sc, 0x19, 0x9df7); + MP_WritePhyUshort(sc, 0x15, 0x03af); + MP_WritePhyUshort(sc, 0x19, 0x7c03); + MP_WritePhyUshort(sc, 0x15, 0x03b0); + MP_WritePhyUshort(sc, 0x19, 0x6c08); + MP_WritePhyUshort(sc, 0x15, 0x03b1); + MP_WritePhyUshort(sc, 0x19, 0x33b6); + MP_WritePhyUshort(sc, 0x15, 0x03b2); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b3); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b4); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03b6); + MP_WritePhyUshort(sc, 0x19, 0x55af); + MP_WritePhyUshort(sc, 0x15, 0x03b7); + MP_WritePhyUshort(sc, 0x19, 0x7ff0); + MP_WritePhyUshort(sc, 0x15, 0x03b8); + MP_WritePhyUshort(sc, 0x19, 0x6ff0); + MP_WritePhyUshort(sc, 0x15, 0x03b9); + MP_WritePhyUshort(sc, 0x19, 0x4bb9); + MP_WritePhyUshort(sc, 0x15, 0x03ba); + MP_WritePhyUshort(sc, 0x19, 0x6a80); + MP_WritePhyUshort(sc, 0x15, 0x03bb); + MP_WritePhyUshort(sc, 0x19, 0x4b29); + MP_WritePhyUshort(sc, 0x15, 0x03bc); + MP_WritePhyUshort(sc, 0x19, 0x4041); + MP_WritePhyUshort(sc, 0x15, 0x03bd); + MP_WritePhyUshort(sc, 0x19, 0x440a); + MP_WritePhyUshort(sc, 0x15, 0x03be); + MP_WritePhyUshort(sc, 0x19, 0x4029); + MP_WritePhyUshort(sc, 0x15, 0x03bf); + MP_WritePhyUshort(sc, 0x19, 0x4418); + MP_WritePhyUshort(sc, 0x15, 0x03c0); + MP_WritePhyUshort(sc, 0x19, 0x4090); + MP_WritePhyUshort(sc, 0x15, 0x03c1); + MP_WritePhyUshort(sc, 0x19, 0x4438); + MP_WritePhyUshort(sc, 0x15, 0x03c2); + MP_WritePhyUshort(sc, 0x19, 0x40c4); + MP_WritePhyUshort(sc, 0x15, 0x03c3); + MP_WritePhyUshort(sc, 0x19, 0x447b); + MP_WritePhyUshort(sc, 0x15, 0x03c4); + MP_WritePhyUshort(sc, 0x19, 0xb6c4); + MP_WritePhyUshort(sc, 0x15, 0x03c5); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x03c6); + MP_WritePhyUshort(sc, 0x19, 0x9bfe); + MP_WritePhyUshort(sc, 0x15, 0x03c7); + MP_WritePhyUshort(sc, 0x19, 0x33cc); + MP_WritePhyUshort(sc, 0x15, 0x03c8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03c9); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03ca); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03cb); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03cc); + MP_WritePhyUshort(sc, 0x19, 0x542f); + MP_WritePhyUshort(sc, 0x15, 0x03cd); + MP_WritePhyUshort(sc, 0x19, 0x499a); + MP_WritePhyUshort(sc, 0x15, 0x03ce); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x03cf); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03d0); + MP_WritePhyUshort(sc, 0x19, 0x490a); + MP_WritePhyUshort(sc, 0x15, 0x03d1); + MP_WritePhyUshort(sc, 0x19, 0x405e); + MP_WritePhyUshort(sc, 0x15, 0x03d2); + MP_WritePhyUshort(sc, 0x19, 0x44f8); + MP_WritePhyUshort(sc, 0x15, 0x03d3); + MP_WritePhyUshort(sc, 0x19, 0x6b00); + MP_WritePhyUshort(sc, 0x15, 0x03d4); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x03d5); + MP_WritePhyUshort(sc, 0x19, 0x0028); + MP_WritePhyUshort(sc, 0x15, 0x03d6); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x03d7); + MP_WritePhyUshort(sc, 0x19, 0xbd27); + MP_WritePhyUshort(sc, 0x15, 0x03d8); + MP_WritePhyUshort(sc, 0x19, 0x9cfc); + MP_WritePhyUshort(sc, 0x15, 0x03d9); + MP_WritePhyUshort(sc, 0x19, 0xc639); + MP_WritePhyUshort(sc, 0x15, 0x03da); + MP_WritePhyUshort(sc, 0x19, 0x000f); + MP_WritePhyUshort(sc, 0x15, 0x03db); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x03dc); + MP_WritePhyUshort(sc, 0x19, 0x7c01); + MP_WritePhyUshort(sc, 0x15, 0x03dd); + MP_WritePhyUshort(sc, 0x19, 0x4c01); + MP_WritePhyUshort(sc, 0x15, 0x03de); + MP_WritePhyUshort(sc, 0x19, 0x9af6); + MP_WritePhyUshort(sc, 0x15, 0x03df); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03e0); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03e1); + MP_WritePhyUshort(sc, 0x19, 0x4470); + MP_WritePhyUshort(sc, 0x15, 0x03e2); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03e3); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03e4); + MP_WritePhyUshort(sc, 0x19, 0x33d4); + MP_WritePhyUshort(sc, 0x15, 0x03e5); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03e6); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03e7); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03e8); + MP_WritePhyUshort(sc, 0x19, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x03e9); + MP_WritePhyUshort(sc, 0x19, 0x49bb); + MP_WritePhyUshort(sc, 0x15, 0x03ea); + MP_WritePhyUshort(sc, 0x19, 0x4478); + MP_WritePhyUshort(sc, 0x15, 0x03eb); + MP_WritePhyUshort(sc, 0x19, 0x492b); + MP_WritePhyUshort(sc, 0x15, 0x03ec); + MP_WritePhyUshort(sc, 0x19, 0x6b80); + MP_WritePhyUshort(sc, 0x15, 0x03ed); + MP_WritePhyUshort(sc, 0x19, 0x7c01); + MP_WritePhyUshort(sc, 0x15, 0x03ee); + MP_WritePhyUshort(sc, 0x19, 0x4c00); + MP_WritePhyUshort(sc, 0x15, 0x03ef); + MP_WritePhyUshort(sc, 0x19, 0xd64f); + MP_WritePhyUshort(sc, 0x15, 0x03f0); + MP_WritePhyUshort(sc, 0x19, 0x000d); + MP_WritePhyUshort(sc, 0x15, 0x03f1); + MP_WritePhyUshort(sc, 0x19, 0x3311); + MP_WritePhyUshort(sc, 0x15, 0x03f2); + MP_WritePhyUshort(sc, 0x19, 0xbd0c); + MP_WritePhyUshort(sc, 0x15, 0x03f3); + MP_WritePhyUshort(sc, 0x19, 0xc428); + MP_WritePhyUshort(sc, 0x15, 0x03f4); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x15, 0x03f5); + MP_WritePhyUshort(sc, 0x19, 0x9afa); + MP_WritePhyUshort(sc, 0x15, 0x03f6); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03f7); + MP_WritePhyUshort(sc, 0x19, 0x4c52); + MP_WritePhyUshort(sc, 0x15, 0x03f8); + MP_WritePhyUshort(sc, 0x19, 0x4470); + MP_WritePhyUshort(sc, 0x15, 0x03f9); + MP_WritePhyUshort(sc, 0x19, 0x7c12); + MP_WritePhyUshort(sc, 0x15, 0x03fa); + MP_WritePhyUshort(sc, 0x19, 0x4c40); + MP_WritePhyUshort(sc, 0x15, 0x03fb); + MP_WritePhyUshort(sc, 0x19, 0x33ef); + MP_WritePhyUshort(sc, 0x15, 0x03fc); + MP_WritePhyUshort(sc, 0x19, 0x3342); + MP_WritePhyUshort(sc, 0x15, 0x03fd); + MP_WritePhyUshort(sc, 0x19, 0x330d); + MP_WritePhyUshort(sc, 0x15, 0x03fe); + MP_WritePhyUshort(sc, 0x19, 0x32ae); + MP_WritePhyUshort(sc, 0x15, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x0112); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x1f02); + MP_WritePhyUshort(sc, 0x06, 0x012c); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x3c02); + MP_WritePhyUshort(sc, 0x06, 0x0156); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x6d02); + MP_WritePhyUshort(sc, 0x06, 0x809d); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xc702); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd105); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xcd02); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xca02); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd105); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xd002); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd481); + MP_WritePhyUshort(sc, 0x06, 0xc9e4); + MP_WritePhyUshort(sc, 0x06, 0x8b90); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x91d4); + MP_WritePhyUshort(sc, 0x06, 0x81b8); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x92e5); + MP_WritePhyUshort(sc, 0x06, 0x8b93); + MP_WritePhyUshort(sc, 0x06, 0xbf8b); + MP_WritePhyUshort(sc, 0x06, 0x88ec); + MP_WritePhyUshort(sc, 0x06, 0x0019); + MP_WritePhyUshort(sc, 0x06, 0xa98b); + MP_WritePhyUshort(sc, 0x06, 0x90f9); + MP_WritePhyUshort(sc, 0x06, 0xeeff); + MP_WritePhyUshort(sc, 0x06, 0xf600); + MP_WritePhyUshort(sc, 0x06, 0xeeff); + MP_WritePhyUshort(sc, 0x06, 0xf7fc); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xc102); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xc402); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x201a); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x824b); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x1902); + MP_WritePhyUshort(sc, 0x06, 0x2c9d); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x9602); + MP_WritePhyUshort(sc, 0x06, 0x0473); + MP_WritePhyUshort(sc, 0x06, 0x022e); + MP_WritePhyUshort(sc, 0x06, 0x3902); + MP_WritePhyUshort(sc, 0x06, 0x044d); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x210b); + MP_WritePhyUshort(sc, 0x06, 0xf621); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x0416); + MP_WritePhyUshort(sc, 0x06, 0x021b); + MP_WritePhyUshort(sc, 0x06, 0xa4e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x22e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2305); + MP_WritePhyUshort(sc, 0x06, 0xf623); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x24e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2505); + MP_WritePhyUshort(sc, 0x06, 0xf625); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x26e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xdae0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x27e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x5cfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad21); + MP_WritePhyUshort(sc, 0x06, 0x57e0); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x2358); + MP_WritePhyUshort(sc, 0x06, 0xc059); + MP_WritePhyUshort(sc, 0x06, 0x021e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b3c); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e44); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x3cad); + MP_WritePhyUshort(sc, 0x06, 0x211d); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x84f7); + MP_WritePhyUshort(sc, 0x06, 0x29e5); + MP_WritePhyUshort(sc, 0x06, 0x8b84); + MP_WritePhyUshort(sc, 0x06, 0xac27); + MP_WritePhyUshort(sc, 0x06, 0x0dac); + MP_WritePhyUshort(sc, 0x06, 0x2605); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x7fae); + MP_WritePhyUshort(sc, 0x06, 0x2b02); + MP_WritePhyUshort(sc, 0x06, 0x2c23); + MP_WritePhyUshort(sc, 0x06, 0xae26); + MP_WritePhyUshort(sc, 0x06, 0x022c); + MP_WritePhyUshort(sc, 0x06, 0x41ae); + MP_WritePhyUshort(sc, 0x06, 0x21e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x18e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0x58fc); + MP_WritePhyUshort(sc, 0x06, 0xe4ff); + MP_WritePhyUshort(sc, 0x06, 0xf7d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x2eee); + MP_WritePhyUshort(sc, 0x06, 0x0232); + MP_WritePhyUshort(sc, 0x06, 0x0ad1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x82e8); + MP_WritePhyUshort(sc, 0x06, 0x0232); + MP_WritePhyUshort(sc, 0x06, 0x0a02); + MP_WritePhyUshort(sc, 0x06, 0x2bdf); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x04d0); + MP_WritePhyUshort(sc, 0x06, 0x0202); + MP_WritePhyUshort(sc, 0x06, 0x1e97); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2228); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xd302); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd10c); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xd602); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd104); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xd902); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xe802); + MP_WritePhyUshort(sc, 0x06, 0x320a); + MP_WritePhyUshort(sc, 0x06, 0xe0ff); + MP_WritePhyUshort(sc, 0x06, 0xf768); + MP_WritePhyUshort(sc, 0x06, 0x03e4); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xd004); + MP_WritePhyUshort(sc, 0x06, 0x0228); + MP_WritePhyUshort(sc, 0x06, 0x7a04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0xe234); + MP_WritePhyUshort(sc, 0x06, 0xe1e2); + MP_WritePhyUshort(sc, 0x06, 0x35f6); + MP_WritePhyUshort(sc, 0x06, 0x2be4); + MP_WritePhyUshort(sc, 0x06, 0xe234); + MP_WritePhyUshort(sc, 0x06, 0xe5e2); + MP_WritePhyUshort(sc, 0x06, 0x35fc); + MP_WritePhyUshort(sc, 0x06, 0x05f8); + MP_WritePhyUshort(sc, 0x06, 0xe0e2); + MP_WritePhyUshort(sc, 0x06, 0x34e1); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xf72b); + MP_WritePhyUshort(sc, 0x06, 0xe4e2); + MP_WritePhyUshort(sc, 0x06, 0x34e5); + MP_WritePhyUshort(sc, 0x06, 0xe235); + MP_WritePhyUshort(sc, 0x06, 0xfc05); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69ac); + MP_WritePhyUshort(sc, 0x06, 0x1b4c); + MP_WritePhyUshort(sc, 0x06, 0xbf2e); + MP_WritePhyUshort(sc, 0x06, 0x3002); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0xef01); + MP_WritePhyUshort(sc, 0x06, 0xe28a); + MP_WritePhyUshort(sc, 0x06, 0x76e4); + MP_WritePhyUshort(sc, 0x06, 0x8a76); + MP_WritePhyUshort(sc, 0x06, 0x1f12); + MP_WritePhyUshort(sc, 0x06, 0x9e3a); + MP_WritePhyUshort(sc, 0x06, 0xef12); + MP_WritePhyUshort(sc, 0x06, 0x5907); + MP_WritePhyUshort(sc, 0x06, 0x9f12); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf721); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40d0); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x287a); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x34fc); + MP_WritePhyUshort(sc, 0x06, 0xa000); + MP_WritePhyUshort(sc, 0x06, 0x1002); + MP_WritePhyUshort(sc, 0x06, 0x2dc3); + MP_WritePhyUshort(sc, 0x06, 0x022e); + MP_WritePhyUshort(sc, 0x06, 0x21e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf621); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40ae); + MP_WritePhyUshort(sc, 0x06, 0x0fbf); + MP_WritePhyUshort(sc, 0x06, 0x3fa5); + MP_WritePhyUshort(sc, 0x06, 0x0231); + MP_WritePhyUshort(sc, 0x06, 0x6cbf); + MP_WritePhyUshort(sc, 0x06, 0x3fa2); + MP_WritePhyUshort(sc, 0x06, 0x0231); + MP_WritePhyUshort(sc, 0x06, 0x6c02); + MP_WritePhyUshort(sc, 0x06, 0x2dc3); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0xe2f4); + MP_WritePhyUshort(sc, 0x06, 0xe1e2); + MP_WritePhyUshort(sc, 0x06, 0xf5e4); + MP_WritePhyUshort(sc, 0x06, 0x8a78); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0x79ee); + MP_WritePhyUshort(sc, 0x06, 0xe2f4); + MP_WritePhyUshort(sc, 0x06, 0xd8ee); + MP_WritePhyUshort(sc, 0x06, 0xe2f5); + MP_WritePhyUshort(sc, 0x06, 0x20fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2065); + MP_WritePhyUshort(sc, 0x06, 0xd200); + MP_WritePhyUshort(sc, 0x06, 0xbf2e); + MP_WritePhyUshort(sc, 0x06, 0xe802); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0x1e21); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xdf02); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0x0c11); + MP_WritePhyUshort(sc, 0x06, 0x1e21); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xe202); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0x0c12); + MP_WritePhyUshort(sc, 0x06, 0x1e21); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xe502); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0x0c13); + MP_WritePhyUshort(sc, 0x06, 0x1e21); + MP_WritePhyUshort(sc, 0x06, 0xbf1f); + MP_WritePhyUshort(sc, 0x06, 0x5302); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0x0c14); + MP_WritePhyUshort(sc, 0x06, 0x1e21); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0xeb02); + MP_WritePhyUshort(sc, 0x06, 0x31dd); + MP_WritePhyUshort(sc, 0x06, 0x0c16); + MP_WritePhyUshort(sc, 0x06, 0x1e21); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0xe01f); + MP_WritePhyUshort(sc, 0x06, 0x029e); + MP_WritePhyUshort(sc, 0x06, 0x22e6); + MP_WritePhyUshort(sc, 0x06, 0x83e0); + MP_WritePhyUshort(sc, 0x06, 0xad31); + MP_WritePhyUshort(sc, 0x06, 0x14ad); + MP_WritePhyUshort(sc, 0x06, 0x3011); + MP_WritePhyUshort(sc, 0x06, 0xef02); + MP_WritePhyUshort(sc, 0x06, 0x580c); + MP_WritePhyUshort(sc, 0x06, 0x9e07); + MP_WritePhyUshort(sc, 0x06, 0xad36); + MP_WritePhyUshort(sc, 0x06, 0x085a); + MP_WritePhyUshort(sc, 0x06, 0x309f); + MP_WritePhyUshort(sc, 0x06, 0x04d1); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0x02d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x82dc); + MP_WritePhyUshort(sc, 0x06, 0x0232); + MP_WritePhyUshort(sc, 0x06, 0x0aef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x0400); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0x77e1); + MP_WritePhyUshort(sc, 0x06, 0x4010); + MP_WritePhyUshort(sc, 0x06, 0xe150); + MP_WritePhyUshort(sc, 0x06, 0x32e1); + MP_WritePhyUshort(sc, 0x06, 0x5030); + MP_WritePhyUshort(sc, 0x06, 0xe144); + MP_WritePhyUshort(sc, 0x06, 0x74e1); + MP_WritePhyUshort(sc, 0x06, 0x44bb); + MP_WritePhyUshort(sc, 0x06, 0xe2d2); + MP_WritePhyUshort(sc, 0x06, 0x40e0); + MP_WritePhyUshort(sc, 0x06, 0x2cfc); + MP_WritePhyUshort(sc, 0x06, 0xe2cc); + MP_WritePhyUshort(sc, 0x06, 0xcce2); + MP_WritePhyUshort(sc, 0x06, 0x00cc); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0x99e0); + MP_WritePhyUshort(sc, 0x06, 0x3688); + MP_WritePhyUshort(sc, 0x06, 0xe036); + MP_WritePhyUshort(sc, 0x06, 0x99e1); + MP_WritePhyUshort(sc, 0x06, 0x40dd); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x05, 0xe142); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x05, 0xe140); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue & BIT_7) + break; + } + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0x6C14); + MP_WritePhyUshort(sc, 0x14, 0x7F3D); + MP_WritePhyUshort(sc, 0x1C, 0xFAFE); + MP_WritePhyUshort(sc, 0x08, 0x07C5); + MP_WritePhyUshort(sc, 0x10, 0xF090); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x14, 0x641A); + MP_WritePhyUshort(sc, 0x1A, 0x0606); + MP_WritePhyUshort(sc, 0x12, 0xF480); + MP_WritePhyUshort(sc, 0x13, 0x0747); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x0D, 0x0207); + MP_WritePhyUshort(sc, 0x02, 0x5FD0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + PhyRegValue = MP_ReadPhyUshort(sc, 0x19); + PhyRegValue &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~BIT_0; + PhyRegValue |= BIT_2; + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); +} + +static void re_set_phy_mcu_8168evl_2(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + PhyRegValue = MP_ReadPhyUshort(sc, 0x15); + PhyRegValue &= ~(BIT_12); + MP_WritePhyUshort(sc, 0x15, PhyRegValue); + MP_WritePhyUshort(sc, 0x00, 0x4800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + for (i = 0; i < 1000; i++) { + if (MP_ReadPhyUshort(sc, 0x1c) & BIT_7) + break; + DELAY(100); + } + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + for (i = 0; i < 200; i++) { + if ((MP_ReadPhyUshort(sc, 0x17) & BIT_0) == 0) + break; + DELAY(100); + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x00AF); + MP_WritePhyUshort(sc, 0x19, 0x4060); + MP_WritePhyUshort(sc, 0x15, 0x00B0); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x00B1); + MP_WritePhyUshort(sc, 0x19, 0x7e00); + MP_WritePhyUshort(sc, 0x15, 0x00B2); + MP_WritePhyUshort(sc, 0x19, 0x72B0); + MP_WritePhyUshort(sc, 0x15, 0x00B3); + MP_WritePhyUshort(sc, 0x19, 0x7F00); + MP_WritePhyUshort(sc, 0x15, 0x00B4); + MP_WritePhyUshort(sc, 0x19, 0x73B0); + MP_WritePhyUshort(sc, 0x15, 0x0101); + MP_WritePhyUshort(sc, 0x19, 0x0005); + MP_WritePhyUshort(sc, 0x15, 0x0103); + MP_WritePhyUshort(sc, 0x19, 0x0003); + MP_WritePhyUshort(sc, 0x15, 0x0105); + MP_WritePhyUshort(sc, 0x19, 0x30FD); + MP_WritePhyUshort(sc, 0x15, 0x0106); + MP_WritePhyUshort(sc, 0x19, 0x9DF7); + MP_WritePhyUshort(sc, 0x15, 0x0107); + MP_WritePhyUshort(sc, 0x19, 0x30C6); + MP_WritePhyUshort(sc, 0x15, 0x0098); + MP_WritePhyUshort(sc, 0x19, 0x7c0b); + MP_WritePhyUshort(sc, 0x15, 0x0099); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00eb); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00f8); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00fe); + MP_WritePhyUshort(sc, 0x19, 0x6f0f); + MP_WritePhyUshort(sc, 0x15, 0x00db); + MP_WritePhyUshort(sc, 0x19, 0x6f09); + MP_WritePhyUshort(sc, 0x15, 0x00dc); + MP_WritePhyUshort(sc, 0x19, 0xaefd); + MP_WritePhyUshort(sc, 0x15, 0x00dd); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00de); + MP_WritePhyUshort(sc, 0x19, 0xc60b); + MP_WritePhyUshort(sc, 0x15, 0x00df); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00e0); + MP_WritePhyUshort(sc, 0x19, 0x30e1); + MP_WritePhyUshort(sc, 0x15, 0x020c); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x020e); + MP_WritePhyUshort(sc, 0x19, 0x9813); + MP_WritePhyUshort(sc, 0x15, 0x020f); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0210); + MP_WritePhyUshort(sc, 0x19, 0x930f); + MP_WritePhyUshort(sc, 0x15, 0x0211); + MP_WritePhyUshort(sc, 0x19, 0x9206); + MP_WritePhyUshort(sc, 0x15, 0x0212); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0213); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0214); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0215); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0216); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0217); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0218); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0219); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x021a); + MP_WritePhyUshort(sc, 0x19, 0x5540); + MP_WritePhyUshort(sc, 0x15, 0x021b); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x021c); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x021d); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x021e); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x021f); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0220); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0221); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x0222); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0223); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x0224); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0225); + MP_WritePhyUshort(sc, 0x19, 0x3231); + MP_WritePhyUshort(sc, 0x15, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2160); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0040); + MP_WritePhyUshort(sc, 0x18, 0x0004); + MP_WritePhyUshort(sc, 0x18, 0x09d4); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x09e4); + MP_WritePhyUshort(sc, 0x19, 0x0800); + MP_WritePhyUshort(sc, 0x18, 0x09f4); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x0a04); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x0a14); + MP_WritePhyUshort(sc, 0x19, 0x0c00); + MP_WritePhyUshort(sc, 0x18, 0x0a24); + MP_WritePhyUshort(sc, 0x19, 0xff00); + MP_WritePhyUshort(sc, 0x18, 0x0a74); + MP_WritePhyUshort(sc, 0x19, 0xf600); + MP_WritePhyUshort(sc, 0x18, 0x1a24); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x18, 0x1a64); + MP_WritePhyUshort(sc, 0x19, 0x0500); + MP_WritePhyUshort(sc, 0x18, 0x1a74); + MP_WritePhyUshort(sc, 0x19, 0x9500); + MP_WritePhyUshort(sc, 0x18, 0x1a84); + MP_WritePhyUshort(sc, 0x19, 0x8000); + MP_WritePhyUshort(sc, 0x18, 0x1a94); + MP_WritePhyUshort(sc, 0x19, 0x7d00); + MP_WritePhyUshort(sc, 0x18, 0x1aa4); + MP_WritePhyUshort(sc, 0x19, 0x9600); + MP_WritePhyUshort(sc, 0x18, 0x1ac4); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x1ad4); + MP_WritePhyUshort(sc, 0x19, 0x0800); + MP_WritePhyUshort(sc, 0x18, 0x1af4); + MP_WritePhyUshort(sc, 0x19, 0xc400); + MP_WritePhyUshort(sc, 0x18, 0x1b04); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x1b14); + MP_WritePhyUshort(sc, 0x19, 0x0800); + MP_WritePhyUshort(sc, 0x18, 0x1b24); + MP_WritePhyUshort(sc, 0x19, 0xfd00); + MP_WritePhyUshort(sc, 0x18, 0x1b34); + MP_WritePhyUshort(sc, 0x19, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x1b44); + MP_WritePhyUshort(sc, 0x19, 0x0400); + MP_WritePhyUshort(sc, 0x18, 0x1b94); + MP_WritePhyUshort(sc, 0x19, 0xf100); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x17, 0x2100); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0040); + MP_WritePhyUshort(sc, 0x18, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x0115); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x2202); + MP_WritePhyUshort(sc, 0x06, 0x80a0); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x3f02); + MP_WritePhyUshort(sc, 0x06, 0x0159); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0xbd02); + MP_WritePhyUshort(sc, 0x06, 0x80da); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xd481); + MP_WritePhyUshort(sc, 0x06, 0xd2e4); + MP_WritePhyUshort(sc, 0x06, 0x8b92); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x93d1); + MP_WritePhyUshort(sc, 0x06, 0x03bf); + MP_WritePhyUshort(sc, 0x06, 0x859e); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23d1); + MP_WritePhyUshort(sc, 0x06, 0x02bf); + MP_WritePhyUshort(sc, 0x06, 0x85a1); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23ee); + MP_WritePhyUshort(sc, 0x06, 0x8608); + MP_WritePhyUshort(sc, 0x06, 0x03ee); + MP_WritePhyUshort(sc, 0x06, 0x860a); + MP_WritePhyUshort(sc, 0x06, 0x60ee); + MP_WritePhyUshort(sc, 0x06, 0x8610); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8611); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x07ee); + MP_WritePhyUshort(sc, 0x06, 0x8abf); + MP_WritePhyUshort(sc, 0x06, 0x73ee); + MP_WritePhyUshort(sc, 0x06, 0x8a95); + MP_WritePhyUshort(sc, 0x06, 0x02bf); + MP_WritePhyUshort(sc, 0x06, 0x8b88); + MP_WritePhyUshort(sc, 0x06, 0xec00); + MP_WritePhyUshort(sc, 0x06, 0x19a9); + MP_WritePhyUshort(sc, 0x06, 0x8b90); + MP_WritePhyUshort(sc, 0x06, 0xf9ee); + MP_WritePhyUshort(sc, 0x06, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xfed1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8595); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23d1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x8598); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x2304); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8a); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x14ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8a); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x1f9a); + MP_WritePhyUshort(sc, 0x06, 0xe0e4); + MP_WritePhyUshort(sc, 0x06, 0x26e1); + MP_WritePhyUshort(sc, 0x06, 0xe427); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x2623); + MP_WritePhyUshort(sc, 0x06, 0xe5e4); + MP_WritePhyUshort(sc, 0x06, 0x27fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8dad); + MP_WritePhyUshort(sc, 0x06, 0x2014); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8d00); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0x5a78); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x0902); + MP_WritePhyUshort(sc, 0x06, 0x05db); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x7b02); + MP_WritePhyUshort(sc, 0x06, 0x3231); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x1df6); + MP_WritePhyUshort(sc, 0x06, 0x20e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x5c02); + MP_WritePhyUshort(sc, 0x06, 0x2bcb); + MP_WritePhyUshort(sc, 0x06, 0x022d); + MP_WritePhyUshort(sc, 0x06, 0x2902); + MP_WritePhyUshort(sc, 0x06, 0x03b4); + MP_WritePhyUshort(sc, 0x06, 0x0285); + MP_WritePhyUshort(sc, 0x06, 0x6402); + MP_WritePhyUshort(sc, 0x06, 0x2eca); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0xcd02); + MP_WritePhyUshort(sc, 0x06, 0x046f); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x210b); + MP_WritePhyUshort(sc, 0x06, 0xf621); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x8520); + MP_WritePhyUshort(sc, 0x06, 0x021b); + MP_WritePhyUshort(sc, 0x06, 0xe8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x22e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2308); + MP_WritePhyUshort(sc, 0x06, 0xf623); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x311c); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2405); + MP_WritePhyUshort(sc, 0x06, 0xf624); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x25e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2608); + MP_WritePhyUshort(sc, 0x06, 0xf626); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x2df5); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2705); + MP_WritePhyUshort(sc, 0x06, 0xf627); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x037a); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x65d2); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x2fe9); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf61e); + MP_WritePhyUshort(sc, 0x06, 0x21bf); + MP_WritePhyUshort(sc, 0x06, 0x2ff5); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf60c); + MP_WritePhyUshort(sc, 0x06, 0x111e); + MP_WritePhyUshort(sc, 0x06, 0x21bf); + MP_WritePhyUshort(sc, 0x06, 0x2ff8); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf60c); + MP_WritePhyUshort(sc, 0x06, 0x121e); + MP_WritePhyUshort(sc, 0x06, 0x21bf); + MP_WritePhyUshort(sc, 0x06, 0x2ffb); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf60c); + MP_WritePhyUshort(sc, 0x06, 0x131e); + MP_WritePhyUshort(sc, 0x06, 0x21bf); + MP_WritePhyUshort(sc, 0x06, 0x1f97); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf60c); + MP_WritePhyUshort(sc, 0x06, 0x141e); + MP_WritePhyUshort(sc, 0x06, 0x21bf); + MP_WritePhyUshort(sc, 0x06, 0x859b); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf60c); + MP_WritePhyUshort(sc, 0x06, 0x161e); + MP_WritePhyUshort(sc, 0x06, 0x21e0); + MP_WritePhyUshort(sc, 0x06, 0x8a8c); + MP_WritePhyUshort(sc, 0x06, 0x1f02); + MP_WritePhyUshort(sc, 0x06, 0x9e22); + MP_WritePhyUshort(sc, 0x06, 0xe68a); + MP_WritePhyUshort(sc, 0x06, 0x8cad); + MP_WritePhyUshort(sc, 0x06, 0x3114); + MP_WritePhyUshort(sc, 0x06, 0xad30); + MP_WritePhyUshort(sc, 0x06, 0x11ef); + MP_WritePhyUshort(sc, 0x06, 0x0258); + MP_WritePhyUshort(sc, 0x06, 0x0c9e); + MP_WritePhyUshort(sc, 0x06, 0x07ad); + MP_WritePhyUshort(sc, 0x06, 0x3608); + MP_WritePhyUshort(sc, 0x06, 0x5a30); + MP_WritePhyUshort(sc, 0x06, 0x9f04); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xae02); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf2f); + MP_WritePhyUshort(sc, 0x06, 0xf202); + MP_WritePhyUshort(sc, 0x06, 0x3723); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xface); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69fa); + MP_WritePhyUshort(sc, 0x06, 0xd401); + MP_WritePhyUshort(sc, 0x06, 0x55b4); + MP_WritePhyUshort(sc, 0x06, 0xfebf); + MP_WritePhyUshort(sc, 0x06, 0x85a7); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf6ac); + MP_WritePhyUshort(sc, 0x06, 0x280b); + MP_WritePhyUshort(sc, 0x06, 0xbf85); + MP_WritePhyUshort(sc, 0x06, 0xa402); + MP_WritePhyUshort(sc, 0x06, 0x36f6); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x49ae); + MP_WritePhyUshort(sc, 0x06, 0x64bf); + MP_WritePhyUshort(sc, 0x06, 0x85a4); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf6ac); + MP_WritePhyUshort(sc, 0x06, 0x285b); + MP_WritePhyUshort(sc, 0x06, 0xd000); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x60ac); + MP_WritePhyUshort(sc, 0x06, 0x2105); + MP_WritePhyUshort(sc, 0x06, 0xac22); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x4ebf); + MP_WritePhyUshort(sc, 0x06, 0xe0c4); + MP_WritePhyUshort(sc, 0x06, 0xbe86); + MP_WritePhyUshort(sc, 0x06, 0x14d2); + MP_WritePhyUshort(sc, 0x06, 0x04d8); + MP_WritePhyUshort(sc, 0x06, 0x19d9); + MP_WritePhyUshort(sc, 0x06, 0x1907); + MP_WritePhyUshort(sc, 0x06, 0xdc19); + MP_WritePhyUshort(sc, 0x06, 0xdd19); + MP_WritePhyUshort(sc, 0x06, 0x0789); + MP_WritePhyUshort(sc, 0x06, 0x89ef); + MP_WritePhyUshort(sc, 0x06, 0x645e); + MP_WritePhyUshort(sc, 0x06, 0x07ff); + MP_WritePhyUshort(sc, 0x06, 0x0d65); + MP_WritePhyUshort(sc, 0x06, 0x5cf8); + MP_WritePhyUshort(sc, 0x06, 0x001e); + MP_WritePhyUshort(sc, 0x06, 0x46dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0x19b2); + MP_WritePhyUshort(sc, 0x06, 0xe2d4); + MP_WritePhyUshort(sc, 0x06, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0xbf85); + MP_WritePhyUshort(sc, 0x06, 0xa402); + MP_WritePhyUshort(sc, 0x06, 0x3723); + MP_WritePhyUshort(sc, 0x06, 0xae1d); + MP_WritePhyUshort(sc, 0x06, 0xbee0); + MP_WritePhyUshort(sc, 0x06, 0xc4bf); + MP_WritePhyUshort(sc, 0x06, 0x8614); + MP_WritePhyUshort(sc, 0x06, 0xd204); + MP_WritePhyUshort(sc, 0x06, 0xd819); + MP_WritePhyUshort(sc, 0x06, 0xd919); + MP_WritePhyUshort(sc, 0x06, 0x07dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0x1907); + MP_WritePhyUshort(sc, 0x06, 0xb2f4); + MP_WritePhyUshort(sc, 0x06, 0xd400); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x85a4); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23fe); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfec6); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc05); + MP_WritePhyUshort(sc, 0x06, 0xf9e2); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0xeb5a); + MP_WritePhyUshort(sc, 0x06, 0x070c); + MP_WritePhyUshort(sc, 0x06, 0x031e); + MP_WritePhyUshort(sc, 0x06, 0x20e6); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe7e0); + MP_WritePhyUshort(sc, 0x06, 0xebe0); + MP_WritePhyUshort(sc, 0x06, 0xe0fc); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xfdfd); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac26); + MP_WritePhyUshort(sc, 0x06, 0x1ae0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x14e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xac20); + MP_WritePhyUshort(sc, 0x06, 0x0ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xac23); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xac24); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0x1ab5); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x1c04); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x1d04); + MP_WritePhyUshort(sc, 0x06, 0xe2e0); + MP_WritePhyUshort(sc, 0x06, 0x7ce3); + MP_WritePhyUshort(sc, 0x06, 0xe07d); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x38e1); + MP_WritePhyUshort(sc, 0x06, 0xe039); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x1bad); + MP_WritePhyUshort(sc, 0x06, 0x390d); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf21); + MP_WritePhyUshort(sc, 0x06, 0xd502); + MP_WritePhyUshort(sc, 0x06, 0x3723); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xd8ae); + MP_WritePhyUshort(sc, 0x06, 0x0bac); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0x1802); + MP_WritePhyUshort(sc, 0x06, 0x8360); + MP_WritePhyUshort(sc, 0x06, 0x021a); + MP_WritePhyUshort(sc, 0x06, 0xc6fd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2605); + MP_WritePhyUshort(sc, 0x06, 0x0222); + MP_WritePhyUshort(sc, 0x06, 0xa4f7); + MP_WritePhyUshort(sc, 0x06, 0x28e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xad21); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x23a9); + MP_WritePhyUshort(sc, 0x06, 0xf729); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2005); + MP_WritePhyUshort(sc, 0x06, 0x0214); + MP_WritePhyUshort(sc, 0x06, 0xabf7); + MP_WritePhyUshort(sc, 0x06, 0x2ae0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad23); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x12e7); + MP_WritePhyUshort(sc, 0x06, 0xf72b); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2405); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0xbcf7); + MP_WritePhyUshort(sc, 0x06, 0x2ce5); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x21e5); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2109); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xf4ac); + MP_WritePhyUshort(sc, 0x06, 0x2003); + MP_WritePhyUshort(sc, 0x06, 0x0223); + MP_WritePhyUshort(sc, 0x06, 0x98e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x09e0); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x13fb); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2309); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xf4ac); + MP_WritePhyUshort(sc, 0x06, 0x2203); + MP_WritePhyUshort(sc, 0x06, 0x0212); + MP_WritePhyUshort(sc, 0x06, 0xfae0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x09e0); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xac23); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x83c1); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2608); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0xd2ad); + MP_WritePhyUshort(sc, 0x06, 0x2502); + MP_WritePhyUshort(sc, 0x06, 0xf628); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x210a); + MP_WritePhyUshort(sc, 0x06, 0xe084); + MP_WritePhyUshort(sc, 0x06, 0x0af6); + MP_WritePhyUshort(sc, 0x06, 0x27a0); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0xf629); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2008); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xe8ad); + MP_WritePhyUshort(sc, 0x06, 0x2102); + MP_WritePhyUshort(sc, 0x06, 0xf62a); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2308); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x20a0); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0xf62b); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2408); + MP_WritePhyUshort(sc, 0x06, 0xe086); + MP_WritePhyUshort(sc, 0x06, 0x02a0); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0xf62c); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xf4a1); + MP_WritePhyUshort(sc, 0x06, 0x0008); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf21); + MP_WritePhyUshort(sc, 0x06, 0xd502); + MP_WritePhyUshort(sc, 0x06, 0x3723); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x0200); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x241e); + MP_WritePhyUshort(sc, 0x06, 0xe086); + MP_WritePhyUshort(sc, 0x06, 0x02a0); + MP_WritePhyUshort(sc, 0x06, 0x0005); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0xe8ae); + MP_WritePhyUshort(sc, 0x06, 0xf5a0); + MP_WritePhyUshort(sc, 0x06, 0x0105); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0xf8ae); + MP_WritePhyUshort(sc, 0x06, 0x0ba0); + MP_WritePhyUshort(sc, 0x06, 0x0205); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0x14ae); + MP_WritePhyUshort(sc, 0x06, 0x03a0); + MP_WritePhyUshort(sc, 0x06, 0x0300); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0x2bee); + MP_WritePhyUshort(sc, 0x06, 0x8602); + MP_WritePhyUshort(sc, 0x06, 0x01ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8ee); + MP_WritePhyUshort(sc, 0x06, 0x8609); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x8461); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xae10); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8608); + MP_WritePhyUshort(sc, 0x06, 0xe186); + MP_WritePhyUshort(sc, 0x06, 0x091f); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x0611); + MP_WritePhyUshort(sc, 0x06, 0xe586); + MP_WritePhyUshort(sc, 0x06, 0x09ae); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x8602); + MP_WritePhyUshort(sc, 0x06, 0x01fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfbbf); + MP_WritePhyUshort(sc, 0x06, 0x8604); + MP_WritePhyUshort(sc, 0x06, 0xef79); + MP_WritePhyUshort(sc, 0x06, 0xd200); + MP_WritePhyUshort(sc, 0x06, 0xd400); + MP_WritePhyUshort(sc, 0x06, 0x221e); + MP_WritePhyUshort(sc, 0x06, 0x02bf); + MP_WritePhyUshort(sc, 0x06, 0x2fec); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23bf); + MP_WritePhyUshort(sc, 0x06, 0x13f2); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf60d); + MP_WritePhyUshort(sc, 0x06, 0x4559); + MP_WritePhyUshort(sc, 0x06, 0x1fef); + MP_WritePhyUshort(sc, 0x06, 0x97dd); + MP_WritePhyUshort(sc, 0x06, 0xd308); + MP_WritePhyUshort(sc, 0x06, 0x1a93); + MP_WritePhyUshort(sc, 0x06, 0xdd12); + MP_WritePhyUshort(sc, 0x06, 0x17a2); + MP_WritePhyUshort(sc, 0x06, 0x04de); + MP_WritePhyUshort(sc, 0x06, 0xffef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfbee); + MP_WritePhyUshort(sc, 0x06, 0x8602); + MP_WritePhyUshort(sc, 0x06, 0x03d5); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x06, 0xbf86); + MP_WritePhyUshort(sc, 0x06, 0x04ef); + MP_WritePhyUshort(sc, 0x06, 0x79ef); + MP_WritePhyUshort(sc, 0x06, 0x45bf); + MP_WritePhyUshort(sc, 0x06, 0x2fec); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23bf); + MP_WritePhyUshort(sc, 0x06, 0x13f2); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf6ad); + MP_WritePhyUshort(sc, 0x06, 0x2702); + MP_WritePhyUshort(sc, 0x06, 0x78ff); + MP_WritePhyUshort(sc, 0x06, 0xe186); + MP_WritePhyUshort(sc, 0x06, 0x0a1b); + MP_WritePhyUshort(sc, 0x06, 0x01aa); + MP_WritePhyUshort(sc, 0x06, 0x2eef); + MP_WritePhyUshort(sc, 0x06, 0x97d9); + MP_WritePhyUshort(sc, 0x06, 0x7900); + MP_WritePhyUshort(sc, 0x06, 0x9e2b); + MP_WritePhyUshort(sc, 0x06, 0x81dd); + MP_WritePhyUshort(sc, 0x06, 0xbf85); + MP_WritePhyUshort(sc, 0x06, 0xad02); + MP_WritePhyUshort(sc, 0x06, 0x3723); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xef02); + MP_WritePhyUshort(sc, 0x06, 0x100c); + MP_WritePhyUshort(sc, 0x06, 0x11b0); + MP_WritePhyUshort(sc, 0x06, 0xfc0d); + MP_WritePhyUshort(sc, 0x06, 0x11bf); + MP_WritePhyUshort(sc, 0x06, 0x85aa); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x85aa); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x23ee); + MP_WritePhyUshort(sc, 0x06, 0x8602); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x0413); + MP_WritePhyUshort(sc, 0x06, 0xa38b); + MP_WritePhyUshort(sc, 0x06, 0xb4d3); + MP_WritePhyUshort(sc, 0x06, 0x8012); + MP_WritePhyUshort(sc, 0x06, 0x17a2); + MP_WritePhyUshort(sc, 0x06, 0x04ad); + MP_WritePhyUshort(sc, 0x06, 0xffef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x48e0); + MP_WritePhyUshort(sc, 0x06, 0x8a96); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0x977c); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x9e35); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x9600); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x9700); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xbee1); + MP_WritePhyUshort(sc, 0x06, 0x8abf); + MP_WritePhyUshort(sc, 0x06, 0xe286); + MP_WritePhyUshort(sc, 0x06, 0x10e3); + MP_WritePhyUshort(sc, 0x06, 0x8611); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0x1aad); + MP_WritePhyUshort(sc, 0x06, 0x2012); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x9603); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x97b7); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x1000); + MP_WritePhyUshort(sc, 0x06, 0xee86); + MP_WritePhyUshort(sc, 0x06, 0x1100); + MP_WritePhyUshort(sc, 0x06, 0xae11); + MP_WritePhyUshort(sc, 0x06, 0x15e6); + MP_WritePhyUshort(sc, 0x06, 0x8610); + MP_WritePhyUshort(sc, 0x06, 0xe786); + MP_WritePhyUshort(sc, 0x06, 0x11ae); + MP_WritePhyUshort(sc, 0x06, 0x08ee); + MP_WritePhyUshort(sc, 0x06, 0x8610); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8611); + MP_WritePhyUshort(sc, 0x06, 0x00fd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe001); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x32e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf720); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40bf); + MP_WritePhyUshort(sc, 0x06, 0x31f5); + MP_WritePhyUshort(sc, 0x06, 0x0236); + MP_WritePhyUshort(sc, 0x06, 0xf6ad); + MP_WritePhyUshort(sc, 0x06, 0x2821); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x20e1); + MP_WritePhyUshort(sc, 0x06, 0xe021); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x18e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40ee); + MP_WritePhyUshort(sc, 0x06, 0x8b3b); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0x8a8a); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0x8be4); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0x01ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x80ad); + MP_WritePhyUshort(sc, 0x06, 0x2722); + MP_WritePhyUshort(sc, 0x06, 0xbf44); + MP_WritePhyUshort(sc, 0x06, 0xfc02); + MP_WritePhyUshort(sc, 0x06, 0x36f6); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x441f); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x15e5); + MP_WritePhyUshort(sc, 0x06, 0x8b44); + MP_WritePhyUshort(sc, 0x06, 0xad29); + MP_WritePhyUshort(sc, 0x06, 0x07ac); + MP_WritePhyUshort(sc, 0x06, 0x2804); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xae02); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf85); + MP_WritePhyUshort(sc, 0x06, 0xb002); + MP_WritePhyUshort(sc, 0x06, 0x3723); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x0400); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0x77e1); + MP_WritePhyUshort(sc, 0x06, 0x40dd); + MP_WritePhyUshort(sc, 0x06, 0xe022); + MP_WritePhyUshort(sc, 0x06, 0x32e1); + MP_WritePhyUshort(sc, 0x06, 0x5074); + MP_WritePhyUshort(sc, 0x06, 0xe144); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0xdaff); + MP_WritePhyUshort(sc, 0x06, 0xe0c0); + MP_WritePhyUshort(sc, 0x06, 0x52e0); + MP_WritePhyUshort(sc, 0x06, 0xeed9); + MP_WritePhyUshort(sc, 0x06, 0xe04c); + MP_WritePhyUshort(sc, 0x06, 0xbbe0); + MP_WritePhyUshort(sc, 0x06, 0x2a00); + MP_WritePhyUshort(sc, 0x05, 0xe142); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x05, 0xe140); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue & BIT_7) + break; + } + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + PhyRegValue = MP_ReadPhyUshort(sc, 0x19); + PhyRegValue &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0042); + MP_WritePhyUshort(sc, 0x18, 0x2300); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); +} + +static void re_set_phy_mcu_8168f_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + PhyRegValue = MP_ReadPhyUshort(sc, 0x15); + PhyRegValue &= ~(BIT_12); + MP_WritePhyUshort(sc, 0x15, PhyRegValue); + MP_WritePhyUshort(sc, 0x00, 0x4800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + for (i = 0; i < 1000; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1c); + if (PhyRegValue & BIT_7) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x18); + if (!(PhyRegValue & BIT_0)) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x0194); + MP_WritePhyUshort(sc, 0x19, 0x407D); + MP_WritePhyUshort(sc, 0x15, 0x0098); + MP_WritePhyUshort(sc, 0x19, 0x7c0b); + MP_WritePhyUshort(sc, 0x15, 0x0099); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00eb); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00f8); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00fe); + MP_WritePhyUshort(sc, 0x19, 0x6f0f); + MP_WritePhyUshort(sc, 0x15, 0x00db); + MP_WritePhyUshort(sc, 0x19, 0x6f09); + MP_WritePhyUshort(sc, 0x15, 0x00dc); + MP_WritePhyUshort(sc, 0x19, 0xaefd); + MP_WritePhyUshort(sc, 0x15, 0x00dd); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00de); + MP_WritePhyUshort(sc, 0x19, 0xc60b); + MP_WritePhyUshort(sc, 0x15, 0x00df); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00e0); + MP_WritePhyUshort(sc, 0x19, 0x30e1); + MP_WritePhyUshort(sc, 0x15, 0x020c); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x020e); + MP_WritePhyUshort(sc, 0x19, 0x9813); + MP_WritePhyUshort(sc, 0x15, 0x020f); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0210); + MP_WritePhyUshort(sc, 0x19, 0x930f); + MP_WritePhyUshort(sc, 0x15, 0x0211); + MP_WritePhyUshort(sc, 0x19, 0x9206); + MP_WritePhyUshort(sc, 0x15, 0x0212); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0213); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0214); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0215); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0216); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0217); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0218); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0219); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x021a); + MP_WritePhyUshort(sc, 0x19, 0x5540); + MP_WritePhyUshort(sc, 0x15, 0x021b); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x021c); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x021d); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x021e); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x021f); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0220); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0221); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x0222); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0223); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x0224); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0225); + MP_WritePhyUshort(sc, 0x19, 0x3231); + MP_WritePhyUshort(sc, 0x15, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x0118); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x2502); + MP_WritePhyUshort(sc, 0x06, 0x8090); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x4202); + MP_WritePhyUshort(sc, 0x06, 0x015c); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0xad02); + MP_WritePhyUshort(sc, 0x06, 0x80ca); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xd484); + MP_WritePhyUshort(sc, 0x06, 0x3ce4); + MP_WritePhyUshort(sc, 0x06, 0x8b92); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x93ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac8); + MP_WritePhyUshort(sc, 0x06, 0x03ee); + MP_WritePhyUshort(sc, 0x06, 0x8aca); + MP_WritePhyUshort(sc, 0x06, 0x60ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac0); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac1); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8abe); + MP_WritePhyUshort(sc, 0x06, 0x07ee); + MP_WritePhyUshort(sc, 0x06, 0x8abf); + MP_WritePhyUshort(sc, 0x06, 0x73ee); + MP_WritePhyUshort(sc, 0x06, 0x8a95); + MP_WritePhyUshort(sc, 0x06, 0x02bf); + MP_WritePhyUshort(sc, 0x06, 0x8b88); + MP_WritePhyUshort(sc, 0x06, 0xec00); + MP_WritePhyUshort(sc, 0x06, 0x19a9); + MP_WritePhyUshort(sc, 0x06, 0x8b90); + MP_WritePhyUshort(sc, 0x06, 0xf9ee); + MP_WritePhyUshort(sc, 0x06, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xfed1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x85a4); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7dd1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x85a7); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7d04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8a); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x14ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8a); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x204b); + MP_WritePhyUshort(sc, 0x06, 0xe0e4); + MP_WritePhyUshort(sc, 0x06, 0x26e1); + MP_WritePhyUshort(sc, 0x06, 0xe427); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x2623); + MP_WritePhyUshort(sc, 0x06, 0xe5e4); + MP_WritePhyUshort(sc, 0x06, 0x27fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8dad); + MP_WritePhyUshort(sc, 0x06, 0x2014); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8d00); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0x5a78); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x0902); + MP_WritePhyUshort(sc, 0x06, 0x05e8); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x4f02); + MP_WritePhyUshort(sc, 0x06, 0x326c); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x1df6); + MP_WritePhyUshort(sc, 0x06, 0x20e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x0902); + MP_WritePhyUshort(sc, 0x06, 0x2ab0); + MP_WritePhyUshort(sc, 0x06, 0x0285); + MP_WritePhyUshort(sc, 0x06, 0x1602); + MP_WritePhyUshort(sc, 0x06, 0x03ba); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0xe502); + MP_WritePhyUshort(sc, 0x06, 0x2df1); + MP_WritePhyUshort(sc, 0x06, 0x0283); + MP_WritePhyUshort(sc, 0x06, 0x8302); + MP_WritePhyUshort(sc, 0x06, 0x0475); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x210b); + MP_WritePhyUshort(sc, 0x06, 0xf621); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x83f8); + MP_WritePhyUshort(sc, 0x06, 0x021c); + MP_WritePhyUshort(sc, 0x06, 0x99e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x22e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0235); + MP_WritePhyUshort(sc, 0x06, 0x63e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad23); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x23e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0231); + MP_WritePhyUshort(sc, 0x06, 0x57e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x24e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2505); + MP_WritePhyUshort(sc, 0x06, 0xf625); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x26e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x022d); + MP_WritePhyUshort(sc, 0x06, 0x1ce0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x27e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x80fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac26); + MP_WritePhyUshort(sc, 0x06, 0x1ae0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x14e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xac20); + MP_WritePhyUshort(sc, 0x06, 0x0ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xac23); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xac24); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0x1ac2); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x1c04); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x1d04); + MP_WritePhyUshort(sc, 0x06, 0xe2e0); + MP_WritePhyUshort(sc, 0x06, 0x7ce3); + MP_WritePhyUshort(sc, 0x06, 0xe07d); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x38e1); + MP_WritePhyUshort(sc, 0x06, 0xe039); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x1bad); + MP_WritePhyUshort(sc, 0x06, 0x390d); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf22); + MP_WritePhyUshort(sc, 0x06, 0x7a02); + MP_WritePhyUshort(sc, 0x06, 0x387d); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xacae); + MP_WritePhyUshort(sc, 0x06, 0x0bac); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xe902); + MP_WritePhyUshort(sc, 0x06, 0x822e); + MP_WritePhyUshort(sc, 0x06, 0x021a); + MP_WritePhyUshort(sc, 0x06, 0xd3fd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2602); + MP_WritePhyUshort(sc, 0x06, 0xf728); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2105); + MP_WritePhyUshort(sc, 0x06, 0x0222); + MP_WritePhyUshort(sc, 0x06, 0x8ef7); + MP_WritePhyUshort(sc, 0x06, 0x29e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x14b8); + MP_WritePhyUshort(sc, 0x06, 0xf72a); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2305); + MP_WritePhyUshort(sc, 0x06, 0x0212); + MP_WritePhyUshort(sc, 0x06, 0xf4f7); + MP_WritePhyUshort(sc, 0x06, 0x2be0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0x8284); + MP_WritePhyUshort(sc, 0x06, 0xf72c); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xf4fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2600); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2109); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xf4ac); + MP_WritePhyUshort(sc, 0x06, 0x2003); + MP_WritePhyUshort(sc, 0x06, 0x0222); + MP_WritePhyUshort(sc, 0x06, 0x7de0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x09e0); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x1408); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2309); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xf4ac); + MP_WritePhyUshort(sc, 0x06, 0x2203); + MP_WritePhyUshort(sc, 0x06, 0x0213); + MP_WritePhyUshort(sc, 0x06, 0x07e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x09e0); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xac23); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0x8289); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e1); + MP_WritePhyUshort(sc, 0x06, 0x8af4); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x2602); + MP_WritePhyUshort(sc, 0x06, 0xf628); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ad); + MP_WritePhyUshort(sc, 0x06, 0x210a); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0xecf6); + MP_WritePhyUshort(sc, 0x06, 0x27a0); + MP_WritePhyUshort(sc, 0x06, 0x0502); + MP_WritePhyUshort(sc, 0x06, 0xf629); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2008); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xe8ad); + MP_WritePhyUshort(sc, 0x06, 0x2102); + MP_WritePhyUshort(sc, 0x06, 0xf62a); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ad); + MP_WritePhyUshort(sc, 0x06, 0x2308); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x20a0); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0xf62b); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x2408); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xc2a0); + MP_WritePhyUshort(sc, 0x06, 0x0302); + MP_WritePhyUshort(sc, 0x06, 0xf62c); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xf4a1); + MP_WritePhyUshort(sc, 0x06, 0x0008); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf22); + MP_WritePhyUshort(sc, 0x06, 0x7a02); + MP_WritePhyUshort(sc, 0x06, 0x387d); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xc200); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ad); + MP_WritePhyUshort(sc, 0x06, 0x241e); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xc2a0); + MP_WritePhyUshort(sc, 0x06, 0x0005); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xb0ae); + MP_WritePhyUshort(sc, 0x06, 0xf5a0); + MP_WritePhyUshort(sc, 0x06, 0x0105); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xc0ae); + MP_WritePhyUshort(sc, 0x06, 0x0ba0); + MP_WritePhyUshort(sc, 0x06, 0x0205); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xcaae); + MP_WritePhyUshort(sc, 0x06, 0x03a0); + MP_WritePhyUshort(sc, 0x06, 0x0300); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xe1ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac2); + MP_WritePhyUshort(sc, 0x06, 0x01ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac9); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x8317); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8ac8); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xc91f); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x0611); + MP_WritePhyUshort(sc, 0x06, 0xe58a); + MP_WritePhyUshort(sc, 0x06, 0xc9ae); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac2); + MP_WritePhyUshort(sc, 0x06, 0x01fc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfbbf); + MP_WritePhyUshort(sc, 0x06, 0x8ac4); + MP_WritePhyUshort(sc, 0x06, 0xef79); + MP_WritePhyUshort(sc, 0x06, 0xd200); + MP_WritePhyUshort(sc, 0x06, 0xd400); + MP_WritePhyUshort(sc, 0x06, 0x221e); + MP_WritePhyUshort(sc, 0x06, 0x02bf); + MP_WritePhyUshort(sc, 0x06, 0x3024); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7dbf); + MP_WritePhyUshort(sc, 0x06, 0x13ff); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x500d); + MP_WritePhyUshort(sc, 0x06, 0x4559); + MP_WritePhyUshort(sc, 0x06, 0x1fef); + MP_WritePhyUshort(sc, 0x06, 0x97dd); + MP_WritePhyUshort(sc, 0x06, 0xd308); + MP_WritePhyUshort(sc, 0x06, 0x1a93); + MP_WritePhyUshort(sc, 0x06, 0xdd12); + MP_WritePhyUshort(sc, 0x06, 0x17a2); + MP_WritePhyUshort(sc, 0x06, 0x04de); + MP_WritePhyUshort(sc, 0x06, 0xffef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xfbee); + MP_WritePhyUshort(sc, 0x06, 0x8ac2); + MP_WritePhyUshort(sc, 0x06, 0x03d5); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x06, 0xbf8a); + MP_WritePhyUshort(sc, 0x06, 0xc4ef); + MP_WritePhyUshort(sc, 0x06, 0x79ef); + MP_WritePhyUshort(sc, 0x06, 0x45bf); + MP_WritePhyUshort(sc, 0x06, 0x3024); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7dbf); + MP_WritePhyUshort(sc, 0x06, 0x13ff); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x50ad); + MP_WritePhyUshort(sc, 0x06, 0x2702); + MP_WritePhyUshort(sc, 0x06, 0x78ff); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0xca1b); + MP_WritePhyUshort(sc, 0x06, 0x01aa); + MP_WritePhyUshort(sc, 0x06, 0x2eef); + MP_WritePhyUshort(sc, 0x06, 0x97d9); + MP_WritePhyUshort(sc, 0x06, 0x7900); + MP_WritePhyUshort(sc, 0x06, 0x9e2b); + MP_WritePhyUshort(sc, 0x06, 0x81dd); + MP_WritePhyUshort(sc, 0x06, 0xbf85); + MP_WritePhyUshort(sc, 0x06, 0xad02); + MP_WritePhyUshort(sc, 0x06, 0x387d); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xef02); + MP_WritePhyUshort(sc, 0x06, 0x100c); + MP_WritePhyUshort(sc, 0x06, 0x11b0); + MP_WritePhyUshort(sc, 0x06, 0xfc0d); + MP_WritePhyUshort(sc, 0x06, 0x11bf); + MP_WritePhyUshort(sc, 0x06, 0x85aa); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7dd1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x85aa); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7dee); + MP_WritePhyUshort(sc, 0x06, 0x8ac2); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x0413); + MP_WritePhyUshort(sc, 0x06, 0xa38b); + MP_WritePhyUshort(sc, 0x06, 0xb4d3); + MP_WritePhyUshort(sc, 0x06, 0x8012); + MP_WritePhyUshort(sc, 0x06, 0x17a2); + MP_WritePhyUshort(sc, 0x06, 0x04ad); + MP_WritePhyUshort(sc, 0x06, 0xffef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x48e0); + MP_WritePhyUshort(sc, 0x06, 0x8a96); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0x977c); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x9e35); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x9600); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x9700); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0xbee1); + MP_WritePhyUshort(sc, 0x06, 0x8abf); + MP_WritePhyUshort(sc, 0x06, 0xe28a); + MP_WritePhyUshort(sc, 0x06, 0xc0e3); + MP_WritePhyUshort(sc, 0x06, 0x8ac1); + MP_WritePhyUshort(sc, 0x06, 0x0237); + MP_WritePhyUshort(sc, 0x06, 0x74ad); + MP_WritePhyUshort(sc, 0x06, 0x2012); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x9603); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0x97b7); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xc000); + MP_WritePhyUshort(sc, 0x06, 0xee8a); + MP_WritePhyUshort(sc, 0x06, 0xc100); + MP_WritePhyUshort(sc, 0x06, 0xae11); + MP_WritePhyUshort(sc, 0x06, 0x15e6); + MP_WritePhyUshort(sc, 0x06, 0x8ac0); + MP_WritePhyUshort(sc, 0x06, 0xe78a); + MP_WritePhyUshort(sc, 0x06, 0xc1ae); + MP_WritePhyUshort(sc, 0x06, 0x08ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac0); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8ac1); + MP_WritePhyUshort(sc, 0x06, 0x00fd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xae20); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe001); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x32e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf720); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40bf); + MP_WritePhyUshort(sc, 0x06, 0x3230); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x50ad); + MP_WritePhyUshort(sc, 0x06, 0x2821); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x20e1); + MP_WritePhyUshort(sc, 0x06, 0xe021); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x18e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40ee); + MP_WritePhyUshort(sc, 0x06, 0x8b3b); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0x8a8a); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0x8be4); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0x01ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xface); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69fa); + MP_WritePhyUshort(sc, 0x06, 0xd401); + MP_WritePhyUshort(sc, 0x06, 0x55b4); + MP_WritePhyUshort(sc, 0x06, 0xfebf); + MP_WritePhyUshort(sc, 0x06, 0x1c1e); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x50ac); + MP_WritePhyUshort(sc, 0x06, 0x280b); + MP_WritePhyUshort(sc, 0x06, 0xbf1c); + MP_WritePhyUshort(sc, 0x06, 0x1b02); + MP_WritePhyUshort(sc, 0x06, 0x3850); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x49ae); + MP_WritePhyUshort(sc, 0x06, 0x64bf); + MP_WritePhyUshort(sc, 0x06, 0x1c1b); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x50ac); + MP_WritePhyUshort(sc, 0x06, 0x285b); + MP_WritePhyUshort(sc, 0x06, 0xd000); + MP_WritePhyUshort(sc, 0x06, 0x0284); + MP_WritePhyUshort(sc, 0x06, 0xcaac); + MP_WritePhyUshort(sc, 0x06, 0x2105); + MP_WritePhyUshort(sc, 0x06, 0xac22); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x4ebf); + MP_WritePhyUshort(sc, 0x06, 0xe0c4); + MP_WritePhyUshort(sc, 0x06, 0xbe85); + MP_WritePhyUshort(sc, 0x06, 0xf6d2); + MP_WritePhyUshort(sc, 0x06, 0x04d8); + MP_WritePhyUshort(sc, 0x06, 0x19d9); + MP_WritePhyUshort(sc, 0x06, 0x1907); + MP_WritePhyUshort(sc, 0x06, 0xdc19); + MP_WritePhyUshort(sc, 0x06, 0xdd19); + MP_WritePhyUshort(sc, 0x06, 0x0789); + MP_WritePhyUshort(sc, 0x06, 0x89ef); + MP_WritePhyUshort(sc, 0x06, 0x645e); + MP_WritePhyUshort(sc, 0x06, 0x07ff); + MP_WritePhyUshort(sc, 0x06, 0x0d65); + MP_WritePhyUshort(sc, 0x06, 0x5cf8); + MP_WritePhyUshort(sc, 0x06, 0x001e); + MP_WritePhyUshort(sc, 0x06, 0x46dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0x19b2); + MP_WritePhyUshort(sc, 0x06, 0xe2d4); + MP_WritePhyUshort(sc, 0x06, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0xbf1c); + MP_WritePhyUshort(sc, 0x06, 0x1b02); + MP_WritePhyUshort(sc, 0x06, 0x387d); + MP_WritePhyUshort(sc, 0x06, 0xae1d); + MP_WritePhyUshort(sc, 0x06, 0xbee0); + MP_WritePhyUshort(sc, 0x06, 0xc4bf); + MP_WritePhyUshort(sc, 0x06, 0x85f6); + MP_WritePhyUshort(sc, 0x06, 0xd204); + MP_WritePhyUshort(sc, 0x06, 0xd819); + MP_WritePhyUshort(sc, 0x06, 0xd919); + MP_WritePhyUshort(sc, 0x06, 0x07dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0x1907); + MP_WritePhyUshort(sc, 0x06, 0xb2f4); + MP_WritePhyUshort(sc, 0x06, 0xd400); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x1c1b); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7dfe); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfec6); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc05); + MP_WritePhyUshort(sc, 0x06, 0xf9e2); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0xeb5a); + MP_WritePhyUshort(sc, 0x06, 0x070c); + MP_WritePhyUshort(sc, 0x06, 0x031e); + MP_WritePhyUshort(sc, 0x06, 0x20e6); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe7e0); + MP_WritePhyUshort(sc, 0x06, 0xebe0); + MP_WritePhyUshort(sc, 0x06, 0xe0fc); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xfdfd); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0x8b80); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x22bf); + MP_WritePhyUshort(sc, 0x06, 0x4616); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x50e0); + MP_WritePhyUshort(sc, 0x06, 0x8b44); + MP_WritePhyUshort(sc, 0x06, 0x1f01); + MP_WritePhyUshort(sc, 0x06, 0x9e15); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x44ad); + MP_WritePhyUshort(sc, 0x06, 0x2907); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x04d1); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0x02d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x85b0); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7def); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x30e0); + MP_WritePhyUshort(sc, 0x06, 0xe036); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x37e1); + MP_WritePhyUshort(sc, 0x06, 0x8b3f); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e23); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x3fac); + MP_WritePhyUshort(sc, 0x06, 0x200b); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x0dac); + MP_WritePhyUshort(sc, 0x06, 0x250f); + MP_WritePhyUshort(sc, 0x06, 0xac27); + MP_WritePhyUshort(sc, 0x06, 0x11ae); + MP_WritePhyUshort(sc, 0x06, 0x1202); + MP_WritePhyUshort(sc, 0x06, 0x2c47); + MP_WritePhyUshort(sc, 0x06, 0xae0d); + MP_WritePhyUshort(sc, 0x06, 0x0285); + MP_WritePhyUshort(sc, 0x06, 0x4fae); + MP_WritePhyUshort(sc, 0x06, 0x0802); + MP_WritePhyUshort(sc, 0x06, 0x2c69); + MP_WritePhyUshort(sc, 0x06, 0xae03); + MP_WritePhyUshort(sc, 0x06, 0x022c); + MP_WritePhyUshort(sc, 0x06, 0x7cfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x6902); + MP_WritePhyUshort(sc, 0x06, 0x856c); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x14e1); + MP_WritePhyUshort(sc, 0x06, 0xe015); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x08d1); + MP_WritePhyUshort(sc, 0x06, 0x1ebf); + MP_WritePhyUshort(sc, 0x06, 0x2cd9); + MP_WritePhyUshort(sc, 0x06, 0x0238); + MP_WritePhyUshort(sc, 0x06, 0x7def); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x2fd0); + MP_WritePhyUshort(sc, 0x06, 0x0b02); + MP_WritePhyUshort(sc, 0x06, 0x3682); + MP_WritePhyUshort(sc, 0x06, 0x5882); + MP_WritePhyUshort(sc, 0x06, 0x7882); + MP_WritePhyUshort(sc, 0x06, 0x9f24); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x32e1); + MP_WritePhyUshort(sc, 0x06, 0x8b33); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e1a); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x8b32); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x28e1); + MP_WritePhyUshort(sc, 0x06, 0xe029); + MP_WritePhyUshort(sc, 0x06, 0xf72c); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x28e5); + MP_WritePhyUshort(sc, 0x06, 0xe029); + MP_WritePhyUshort(sc, 0x06, 0xf62c); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x28e5); + MP_WritePhyUshort(sc, 0x06, 0xe029); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0x4077); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0x52e0); + MP_WritePhyUshort(sc, 0x06, 0xeed9); + MP_WritePhyUshort(sc, 0x06, 0xe04c); + MP_WritePhyUshort(sc, 0x06, 0xbbe0); + MP_WritePhyUshort(sc, 0x06, 0x2a00); + MP_WritePhyUshort(sc, 0x05, 0xe142); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x05, 0xe140); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue & BIT_7) + break; + } + + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue |= BIT_1; + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x01, 0x328A); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + PhyRegValue = MP_ReadPhyUshort(sc, 0x19); + PhyRegValue &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); +} + +static void re_set_phy_mcu_8168f_2(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + PhyRegValue = MP_ReadPhyUshort(sc, 0x15); + PhyRegValue &= ~(BIT_12); + MP_WritePhyUshort(sc, 0x15, PhyRegValue); + MP_WritePhyUshort(sc, 0x00, 0x4800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + for (i = 0; i < 1000; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1c); + if (PhyRegValue & BIT_7) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x18); + if (!(PhyRegValue & BIT_0)) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x0098); + MP_WritePhyUshort(sc, 0x19, 0x7c0b); + MP_WritePhyUshort(sc, 0x15, 0x0099); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00eb); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00f8); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00fe); + MP_WritePhyUshort(sc, 0x19, 0x6f0f); + MP_WritePhyUshort(sc, 0x15, 0x00db); + MP_WritePhyUshort(sc, 0x19, 0x6f09); + MP_WritePhyUshort(sc, 0x15, 0x00dc); + MP_WritePhyUshort(sc, 0x19, 0xaefd); + MP_WritePhyUshort(sc, 0x15, 0x00dd); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00de); + MP_WritePhyUshort(sc, 0x19, 0xc60b); + MP_WritePhyUshort(sc, 0x15, 0x00df); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00e0); + MP_WritePhyUshort(sc, 0x19, 0x30e1); + MP_WritePhyUshort(sc, 0x15, 0x020c); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x020e); + MP_WritePhyUshort(sc, 0x19, 0x9813); + MP_WritePhyUshort(sc, 0x15, 0x020f); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0210); + MP_WritePhyUshort(sc, 0x19, 0x930f); + MP_WritePhyUshort(sc, 0x15, 0x0211); + MP_WritePhyUshort(sc, 0x19, 0x9206); + MP_WritePhyUshort(sc, 0x15, 0x0212); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0213); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0214); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0215); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0216); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0217); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0218); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0219); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x021a); + MP_WritePhyUshort(sc, 0x19, 0x5540); + MP_WritePhyUshort(sc, 0x15, 0x021b); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x021c); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x021d); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x021e); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x021f); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0220); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0221); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x0222); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0223); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x0224); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0225); + MP_WritePhyUshort(sc, 0x19, 0x3231); + MP_WritePhyUshort(sc, 0x15, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x011b); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x2802); + MP_WritePhyUshort(sc, 0x06, 0x0135); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x4502); + MP_WritePhyUshort(sc, 0x06, 0x015f); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x6b02); + MP_WritePhyUshort(sc, 0x06, 0x80e5); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xbf8b); + MP_WritePhyUshort(sc, 0x06, 0x88ec); + MP_WritePhyUshort(sc, 0x06, 0x0019); + MP_WritePhyUshort(sc, 0x06, 0xa98b); + MP_WritePhyUshort(sc, 0x06, 0x90f9); + MP_WritePhyUshort(sc, 0x06, 0xeeff); + MP_WritePhyUshort(sc, 0x06, 0xf600); + MP_WritePhyUshort(sc, 0x06, 0xeeff); + MP_WritePhyUshort(sc, 0x06, 0xf7fe); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf81); + MP_WritePhyUshort(sc, 0x06, 0x9802); + MP_WritePhyUshort(sc, 0x06, 0x39f3); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf81); + MP_WritePhyUshort(sc, 0x06, 0x9b02); + MP_WritePhyUshort(sc, 0x06, 0x39f3); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8dad); + MP_WritePhyUshort(sc, 0x06, 0x2014); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8d00); + MP_WritePhyUshort(sc, 0x06, 0xe08a); + MP_WritePhyUshort(sc, 0x06, 0x5a78); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x0902); + MP_WritePhyUshort(sc, 0x06, 0x05fc); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x8802); + MP_WritePhyUshort(sc, 0x06, 0x32dd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ac); + MP_WritePhyUshort(sc, 0x06, 0x261a); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x81ac); + MP_WritePhyUshort(sc, 0x06, 0x2114); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ac); + MP_WritePhyUshort(sc, 0x06, 0x200e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x85ac); + MP_WritePhyUshort(sc, 0x06, 0x2308); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x87ac); + MP_WritePhyUshort(sc, 0x06, 0x2402); + MP_WritePhyUshort(sc, 0x06, 0xae38); + MP_WritePhyUshort(sc, 0x06, 0x021a); + MP_WritePhyUshort(sc, 0x06, 0xd6ee); + MP_WritePhyUshort(sc, 0x06, 0xe41c); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0xe41d); + MP_WritePhyUshort(sc, 0x06, 0x04e2); + MP_WritePhyUshort(sc, 0x06, 0xe07c); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0x7de0); + MP_WritePhyUshort(sc, 0x06, 0xe038); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x39ad); + MP_WritePhyUshort(sc, 0x06, 0x2e1b); + MP_WritePhyUshort(sc, 0x06, 0xad39); + MP_WritePhyUshort(sc, 0x06, 0x0dd1); + MP_WritePhyUshort(sc, 0x06, 0x01bf); + MP_WritePhyUshort(sc, 0x06, 0x22c8); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xf302); + MP_WritePhyUshort(sc, 0x06, 0x21f0); + MP_WritePhyUshort(sc, 0x06, 0xae0b); + MP_WritePhyUshort(sc, 0x06, 0xac38); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x0602); + MP_WritePhyUshort(sc, 0x06, 0x222d); + MP_WritePhyUshort(sc, 0x06, 0x0222); + MP_WritePhyUshort(sc, 0x06, 0x7202); + MP_WritePhyUshort(sc, 0x06, 0x1ae7); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x201a); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x2afe); + MP_WritePhyUshort(sc, 0x06, 0x022c); + MP_WritePhyUshort(sc, 0x06, 0x5c02); + MP_WritePhyUshort(sc, 0x06, 0x03c5); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x6702); + MP_WritePhyUshort(sc, 0x06, 0x2e4f); + MP_WritePhyUshort(sc, 0x06, 0x0204); + MP_WritePhyUshort(sc, 0x06, 0x8902); + MP_WritePhyUshort(sc, 0x06, 0x2f7a); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x210b); + MP_WritePhyUshort(sc, 0x06, 0xf621); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x0445); + MP_WritePhyUshort(sc, 0x06, 0x021c); + MP_WritePhyUshort(sc, 0x06, 0xb8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad22); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x22e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0235); + MP_WritePhyUshort(sc, 0x06, 0xd4e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad23); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x23e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0231); + MP_WritePhyUshort(sc, 0x06, 0xc8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad24); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x24e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2505); + MP_WritePhyUshort(sc, 0x06, 0xf625); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x08f6); + MP_WritePhyUshort(sc, 0x06, 0x26e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x022d); + MP_WritePhyUshort(sc, 0x06, 0x6ae0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x27e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0x8bfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0x8b80); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x22bf); + MP_WritePhyUshort(sc, 0x06, 0x479a); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xc6e0); + MP_WritePhyUshort(sc, 0x06, 0x8b44); + MP_WritePhyUshort(sc, 0x06, 0x1f01); + MP_WritePhyUshort(sc, 0x06, 0x9e15); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x44ad); + MP_WritePhyUshort(sc, 0x06, 0x2907); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x04d1); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0x02d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x819e); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xf3ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0x4077); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xbbe0); + MP_WritePhyUshort(sc, 0x06, 0x2a00); + MP_WritePhyUshort(sc, 0x05, 0xe142); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x05, 0xe140); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue & BIT_7) + break; + } + + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue |= BIT_1; + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + PhyRegValue = MP_ReadPhyUshort(sc, 0x19); + PhyRegValue &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); +} + +static void re_set_phy_mcu_8411_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + int i; + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + PhyRegValue = MP_ReadPhyUshort(sc, 0x15); + PhyRegValue &= ~(BIT_12); + MP_WritePhyUshort(sc, 0x15, PhyRegValue); + MP_WritePhyUshort(sc, 0x00, 0x4800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x002f); + for (i = 0; i < 1000; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x1c); + if (PhyRegValue & BIT_7) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x1800); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x18); + if (!(PhyRegValue & BIT_0)) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0307); + MP_WritePhyUshort(sc, 0x15, 0x0098); + MP_WritePhyUshort(sc, 0x19, 0x7c0b); + MP_WritePhyUshort(sc, 0x15, 0x0099); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00eb); + MP_WritePhyUshort(sc, 0x19, 0x6c0b); + MP_WritePhyUshort(sc, 0x15, 0x00f8); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00fe); + MP_WritePhyUshort(sc, 0x19, 0x6f0f); + MP_WritePhyUshort(sc, 0x15, 0x00db); + MP_WritePhyUshort(sc, 0x19, 0x6f09); + MP_WritePhyUshort(sc, 0x15, 0x00dc); + MP_WritePhyUshort(sc, 0x19, 0xaefd); + MP_WritePhyUshort(sc, 0x15, 0x00dd); + MP_WritePhyUshort(sc, 0x19, 0x6f0b); + MP_WritePhyUshort(sc, 0x15, 0x00de); + MP_WritePhyUshort(sc, 0x19, 0xc60b); + MP_WritePhyUshort(sc, 0x15, 0x00df); + MP_WritePhyUshort(sc, 0x19, 0x00fa); + MP_WritePhyUshort(sc, 0x15, 0x00e0); + MP_WritePhyUshort(sc, 0x19, 0x30e1); + MP_WritePhyUshort(sc, 0x15, 0x020c); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x020e); + MP_WritePhyUshort(sc, 0x19, 0x9813); + MP_WritePhyUshort(sc, 0x15, 0x020f); + MP_WritePhyUshort(sc, 0x19, 0x7801); + MP_WritePhyUshort(sc, 0x15, 0x0210); + MP_WritePhyUshort(sc, 0x19, 0x930f); + MP_WritePhyUshort(sc, 0x15, 0x0211); + MP_WritePhyUshort(sc, 0x19, 0x9206); + MP_WritePhyUshort(sc, 0x15, 0x0212); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0213); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0214); + MP_WritePhyUshort(sc, 0x19, 0x588f); + MP_WritePhyUshort(sc, 0x15, 0x0215); + MP_WritePhyUshort(sc, 0x19, 0x5520); + MP_WritePhyUshort(sc, 0x15, 0x0216); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0217); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0218); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0219); + MP_WritePhyUshort(sc, 0x19, 0x588d); + MP_WritePhyUshort(sc, 0x15, 0x021a); + MP_WritePhyUshort(sc, 0x19, 0x5540); + MP_WritePhyUshort(sc, 0x15, 0x021b); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x021c); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x021d); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x021e); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x021f); + MP_WritePhyUshort(sc, 0x19, 0x4002); + MP_WritePhyUshort(sc, 0x15, 0x0220); + MP_WritePhyUshort(sc, 0x19, 0x3224); + MP_WritePhyUshort(sc, 0x15, 0x0221); + MP_WritePhyUshort(sc, 0x19, 0x9e03); + MP_WritePhyUshort(sc, 0x15, 0x0222); + MP_WritePhyUshort(sc, 0x19, 0x7c40); + MP_WritePhyUshort(sc, 0x15, 0x0223); + MP_WritePhyUshort(sc, 0x19, 0x6840); + MP_WritePhyUshort(sc, 0x15, 0x0224); + MP_WritePhyUshort(sc, 0x19, 0x7800); + MP_WritePhyUshort(sc, 0x15, 0x0225); + MP_WritePhyUshort(sc, 0x19, 0x3231); + MP_WritePhyUshort(sc, 0x15, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x0306); + MP_WritePhyUshort(sc, 0x16, 0x0300); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x48f7); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xfff7); + MP_WritePhyUshort(sc, 0x06, 0xa080); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0xf602); + MP_WritePhyUshort(sc, 0x06, 0x011e); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x2b02); + MP_WritePhyUshort(sc, 0x06, 0x8077); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x4802); + MP_WritePhyUshort(sc, 0x06, 0x0162); + MP_WritePhyUshort(sc, 0x06, 0x0280); + MP_WritePhyUshort(sc, 0x06, 0x9402); + MP_WritePhyUshort(sc, 0x06, 0x810e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x88e1); + MP_WritePhyUshort(sc, 0x06, 0x8b89); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8a1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8b); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8c1e); + MP_WritePhyUshort(sc, 0x06, 0x01e1); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x1e01); + MP_WritePhyUshort(sc, 0x06, 0xe18b); + MP_WritePhyUshort(sc, 0x06, 0x8e1e); + MP_WritePhyUshort(sc, 0x06, 0x01a0); + MP_WritePhyUshort(sc, 0x06, 0x00c7); + MP_WritePhyUshort(sc, 0x06, 0xaebb); + MP_WritePhyUshort(sc, 0x06, 0xd481); + MP_WritePhyUshort(sc, 0x06, 0xd4e4); + MP_WritePhyUshort(sc, 0x06, 0x8b92); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x9302); + MP_WritePhyUshort(sc, 0x06, 0x2e5a); + MP_WritePhyUshort(sc, 0x06, 0xbf8b); + MP_WritePhyUshort(sc, 0x06, 0x88ec); + MP_WritePhyUshort(sc, 0x06, 0x0019); + MP_WritePhyUshort(sc, 0x06, 0xa98b); + MP_WritePhyUshort(sc, 0x06, 0x90f9); + MP_WritePhyUshort(sc, 0x06, 0xeeff); + MP_WritePhyUshort(sc, 0x06, 0xf600); + MP_WritePhyUshort(sc, 0x06, 0xeeff); + MP_WritePhyUshort(sc, 0x06, 0xf7fc); + MP_WritePhyUshort(sc, 0x06, 0xd100); + MP_WritePhyUshort(sc, 0x06, 0xbf83); + MP_WritePhyUshort(sc, 0x06, 0x3c02); + MP_WritePhyUshort(sc, 0x06, 0x3a21); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf83); + MP_WritePhyUshort(sc, 0x06, 0x3f02); + MP_WritePhyUshort(sc, 0x06, 0x3a21); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8aad); + MP_WritePhyUshort(sc, 0x06, 0x2014); + MP_WritePhyUshort(sc, 0x06, 0xee8b); + MP_WritePhyUshort(sc, 0x06, 0x8a00); + MP_WritePhyUshort(sc, 0x06, 0x0220); + MP_WritePhyUshort(sc, 0x06, 0x8be0); + MP_WritePhyUshort(sc, 0x06, 0xe426); + MP_WritePhyUshort(sc, 0x06, 0xe1e4); + MP_WritePhyUshort(sc, 0x06, 0x27ee); + MP_WritePhyUshort(sc, 0x06, 0xe426); + MP_WritePhyUshort(sc, 0x06, 0x23e5); + MP_WritePhyUshort(sc, 0x06, 0xe427); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x14ee); + MP_WritePhyUshort(sc, 0x06, 0x8b8d); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0x8a5a); + MP_WritePhyUshort(sc, 0x06, 0x7803); + MP_WritePhyUshort(sc, 0x06, 0x9e09); + MP_WritePhyUshort(sc, 0x06, 0x0206); + MP_WritePhyUshort(sc, 0x06, 0x2802); + MP_WritePhyUshort(sc, 0x06, 0x80b1); + MP_WritePhyUshort(sc, 0x06, 0x0232); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xf9e0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac26); + MP_WritePhyUshort(sc, 0x06, 0x1ae0); + MP_WritePhyUshort(sc, 0x06, 0x8b81); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x14e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xac20); + MP_WritePhyUshort(sc, 0x06, 0x0ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xac23); + MP_WritePhyUshort(sc, 0x06, 0x08e0); + MP_WritePhyUshort(sc, 0x06, 0x8b87); + MP_WritePhyUshort(sc, 0x06, 0xac24); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0x1b02); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x1c04); + MP_WritePhyUshort(sc, 0x06, 0xeee4); + MP_WritePhyUshort(sc, 0x06, 0x1d04); + MP_WritePhyUshort(sc, 0x06, 0xe2e0); + MP_WritePhyUshort(sc, 0x06, 0x7ce3); + MP_WritePhyUshort(sc, 0x06, 0xe07d); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x38e1); + MP_WritePhyUshort(sc, 0x06, 0xe039); + MP_WritePhyUshort(sc, 0x06, 0xad2e); + MP_WritePhyUshort(sc, 0x06, 0x1bad); + MP_WritePhyUshort(sc, 0x06, 0x390d); + MP_WritePhyUshort(sc, 0x06, 0xd101); + MP_WritePhyUshort(sc, 0x06, 0xbf22); + MP_WritePhyUshort(sc, 0x06, 0xe802); + MP_WritePhyUshort(sc, 0x06, 0x3a21); + MP_WritePhyUshort(sc, 0x06, 0x0222); + MP_WritePhyUshort(sc, 0x06, 0x10ae); + MP_WritePhyUshort(sc, 0x06, 0x0bac); + MP_WritePhyUshort(sc, 0x06, 0x3802); + MP_WritePhyUshort(sc, 0x06, 0xae06); + MP_WritePhyUshort(sc, 0x06, 0x0222); + MP_WritePhyUshort(sc, 0x06, 0x4d02); + MP_WritePhyUshort(sc, 0x06, 0x2292); + MP_WritePhyUshort(sc, 0x06, 0x021b); + MP_WritePhyUshort(sc, 0x06, 0x13fd); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x1af6); + MP_WritePhyUshort(sc, 0x06, 0x20e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x022b); + MP_WritePhyUshort(sc, 0x06, 0x1e02); + MP_WritePhyUshort(sc, 0x06, 0x82ae); + MP_WritePhyUshort(sc, 0x06, 0x0203); + MP_WritePhyUshort(sc, 0x06, 0xc002); + MP_WritePhyUshort(sc, 0x06, 0x827d); + MP_WritePhyUshort(sc, 0x06, 0x022e); + MP_WritePhyUshort(sc, 0x06, 0x6f02); + MP_WritePhyUshort(sc, 0x06, 0x047b); + MP_WritePhyUshort(sc, 0x06, 0x022f); + MP_WritePhyUshort(sc, 0x06, 0x9ae0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad21); + MP_WritePhyUshort(sc, 0x06, 0x0bf6); + MP_WritePhyUshort(sc, 0x06, 0x21e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0x9002); + MP_WritePhyUshort(sc, 0x06, 0x1cd9); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2208); + MP_WritePhyUshort(sc, 0x06, 0xf622); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x35f4); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2308); + MP_WritePhyUshort(sc, 0x06, 0xf623); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x31e8); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2405); + MP_WritePhyUshort(sc, 0x06, 0xf624); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8ee0); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xad25); + MP_WritePhyUshort(sc, 0x06, 0x05f6); + MP_WritePhyUshort(sc, 0x06, 0x25e4); + MP_WritePhyUshort(sc, 0x06, 0x8b8e); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2608); + MP_WritePhyUshort(sc, 0x06, 0xf626); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x2d8a); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x8ead); + MP_WritePhyUshort(sc, 0x06, 0x2705); + MP_WritePhyUshort(sc, 0x06, 0xf627); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x8e02); + MP_WritePhyUshort(sc, 0x06, 0x0386); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xef69); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0xe001); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x32e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf720); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40bf); + MP_WritePhyUshort(sc, 0x06, 0x32c1); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xf4ad); + MP_WritePhyUshort(sc, 0x06, 0x2821); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x20e1); + MP_WritePhyUshort(sc, 0x06, 0xe021); + MP_WritePhyUshort(sc, 0x06, 0xad20); + MP_WritePhyUshort(sc, 0x06, 0x18e0); + MP_WritePhyUshort(sc, 0x06, 0x8b40); + MP_WritePhyUshort(sc, 0x06, 0xf620); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x40ee); + MP_WritePhyUshort(sc, 0x06, 0x8b3b); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0x8a8a); + MP_WritePhyUshort(sc, 0x06, 0xe18a); + MP_WritePhyUshort(sc, 0x06, 0x8be4); + MP_WritePhyUshort(sc, 0x06, 0xe000); + MP_WritePhyUshort(sc, 0x06, 0xe5e0); + MP_WritePhyUshort(sc, 0x06, 0x01ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xface); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69fa); + MP_WritePhyUshort(sc, 0x06, 0xd401); + MP_WritePhyUshort(sc, 0x06, 0x55b4); + MP_WritePhyUshort(sc, 0x06, 0xfebf); + MP_WritePhyUshort(sc, 0x06, 0x1c5e); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xf4ac); + MP_WritePhyUshort(sc, 0x06, 0x280b); + MP_WritePhyUshort(sc, 0x06, 0xbf1c); + MP_WritePhyUshort(sc, 0x06, 0x5b02); + MP_WritePhyUshort(sc, 0x06, 0x39f4); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x49ae); + MP_WritePhyUshort(sc, 0x06, 0x64bf); + MP_WritePhyUshort(sc, 0x06, 0x1c5b); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xf4ac); + MP_WritePhyUshort(sc, 0x06, 0x285b); + MP_WritePhyUshort(sc, 0x06, 0xd000); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x62ac); + MP_WritePhyUshort(sc, 0x06, 0x2105); + MP_WritePhyUshort(sc, 0x06, 0xac22); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x4ebf); + MP_WritePhyUshort(sc, 0x06, 0xe0c4); + MP_WritePhyUshort(sc, 0x06, 0xbe85); + MP_WritePhyUshort(sc, 0x06, 0xecd2); + MP_WritePhyUshort(sc, 0x06, 0x04d8); + MP_WritePhyUshort(sc, 0x06, 0x19d9); + MP_WritePhyUshort(sc, 0x06, 0x1907); + MP_WritePhyUshort(sc, 0x06, 0xdc19); + MP_WritePhyUshort(sc, 0x06, 0xdd19); + MP_WritePhyUshort(sc, 0x06, 0x0789); + MP_WritePhyUshort(sc, 0x06, 0x89ef); + MP_WritePhyUshort(sc, 0x06, 0x645e); + MP_WritePhyUshort(sc, 0x06, 0x07ff); + MP_WritePhyUshort(sc, 0x06, 0x0d65); + MP_WritePhyUshort(sc, 0x06, 0x5cf8); + MP_WritePhyUshort(sc, 0x06, 0x001e); + MP_WritePhyUshort(sc, 0x06, 0x46dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0x19b2); + MP_WritePhyUshort(sc, 0x06, 0xe2d4); + MP_WritePhyUshort(sc, 0x06, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0xbf1c); + MP_WritePhyUshort(sc, 0x06, 0x5b02); + MP_WritePhyUshort(sc, 0x06, 0x3a21); + MP_WritePhyUshort(sc, 0x06, 0xae1d); + MP_WritePhyUshort(sc, 0x06, 0xbee0); + MP_WritePhyUshort(sc, 0x06, 0xc4bf); + MP_WritePhyUshort(sc, 0x06, 0x85ec); + MP_WritePhyUshort(sc, 0x06, 0xd204); + MP_WritePhyUshort(sc, 0x06, 0xd819); + MP_WritePhyUshort(sc, 0x06, 0xd919); + MP_WritePhyUshort(sc, 0x06, 0x07dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0x1907); + MP_WritePhyUshort(sc, 0x06, 0xb2f4); + MP_WritePhyUshort(sc, 0x06, 0xd400); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x1c5b); + MP_WritePhyUshort(sc, 0x06, 0x023a); + MP_WritePhyUshort(sc, 0x06, 0x21fe); + MP_WritePhyUshort(sc, 0x06, 0xef96); + MP_WritePhyUshort(sc, 0x06, 0xfec6); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc05); + MP_WritePhyUshort(sc, 0x06, 0xf9e2); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe3e0); + MP_WritePhyUshort(sc, 0x06, 0xeb5a); + MP_WritePhyUshort(sc, 0x06, 0x070c); + MP_WritePhyUshort(sc, 0x06, 0x031e); + MP_WritePhyUshort(sc, 0x06, 0x20e6); + MP_WritePhyUshort(sc, 0x06, 0xe0ea); + MP_WritePhyUshort(sc, 0x06, 0xe7e0); + MP_WritePhyUshort(sc, 0x06, 0xebe0); + MP_WritePhyUshort(sc, 0x06, 0xe0fc); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0xfdfd); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x69e0); + MP_WritePhyUshort(sc, 0x06, 0x8b80); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x22bf); + MP_WritePhyUshort(sc, 0x06, 0x47ba); + MP_WritePhyUshort(sc, 0x06, 0x0239); + MP_WritePhyUshort(sc, 0x06, 0xf4e0); + MP_WritePhyUshort(sc, 0x06, 0x8b44); + MP_WritePhyUshort(sc, 0x06, 0x1f01); + MP_WritePhyUshort(sc, 0x06, 0x9e15); + MP_WritePhyUshort(sc, 0x06, 0xe58b); + MP_WritePhyUshort(sc, 0x06, 0x44ad); + MP_WritePhyUshort(sc, 0x06, 0x2907); + MP_WritePhyUshort(sc, 0x06, 0xac28); + MP_WritePhyUshort(sc, 0x06, 0x04d1); + MP_WritePhyUshort(sc, 0x06, 0x01ae); + MP_WritePhyUshort(sc, 0x06, 0x02d1); + MP_WritePhyUshort(sc, 0x06, 0x00bf); + MP_WritePhyUshort(sc, 0x06, 0x8342); + MP_WritePhyUshort(sc, 0x06, 0x023a); + MP_WritePhyUshort(sc, 0x06, 0x21ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x30e0); + MP_WritePhyUshort(sc, 0x06, 0xe036); + MP_WritePhyUshort(sc, 0x06, 0xe1e0); + MP_WritePhyUshort(sc, 0x06, 0x37e1); + MP_WritePhyUshort(sc, 0x06, 0x8b3f); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e23); + MP_WritePhyUshort(sc, 0x06, 0xe48b); + MP_WritePhyUshort(sc, 0x06, 0x3fac); + MP_WritePhyUshort(sc, 0x06, 0x200b); + MP_WritePhyUshort(sc, 0x06, 0xac21); + MP_WritePhyUshort(sc, 0x06, 0x0dac); + MP_WritePhyUshort(sc, 0x06, 0x250f); + MP_WritePhyUshort(sc, 0x06, 0xac27); + MP_WritePhyUshort(sc, 0x06, 0x11ae); + MP_WritePhyUshort(sc, 0x06, 0x1202); + MP_WritePhyUshort(sc, 0x06, 0x2cb5); + MP_WritePhyUshort(sc, 0x06, 0xae0d); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0xe7ae); + MP_WritePhyUshort(sc, 0x06, 0x0802); + MP_WritePhyUshort(sc, 0x06, 0x2cd7); + MP_WritePhyUshort(sc, 0x06, 0xae03); + MP_WritePhyUshort(sc, 0x06, 0x022c); + MP_WritePhyUshort(sc, 0x06, 0xeafc); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x6902); + MP_WritePhyUshort(sc, 0x06, 0x8304); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x14e1); + MP_WritePhyUshort(sc, 0x06, 0xe015); + MP_WritePhyUshort(sc, 0x06, 0xad26); + MP_WritePhyUshort(sc, 0x06, 0x08d1); + MP_WritePhyUshort(sc, 0x06, 0x1ebf); + MP_WritePhyUshort(sc, 0x06, 0x2d47); + MP_WritePhyUshort(sc, 0x06, 0x023a); + MP_WritePhyUshort(sc, 0x06, 0x21ef); + MP_WritePhyUshort(sc, 0x06, 0x96fe); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0x8b85); + MP_WritePhyUshort(sc, 0x06, 0xad27); + MP_WritePhyUshort(sc, 0x06, 0x2fd0); + MP_WritePhyUshort(sc, 0x06, 0x0b02); + MP_WritePhyUshort(sc, 0x06, 0x3826); + MP_WritePhyUshort(sc, 0x06, 0x5882); + MP_WritePhyUshort(sc, 0x06, 0x7882); + MP_WritePhyUshort(sc, 0x06, 0x9f24); + MP_WritePhyUshort(sc, 0x06, 0xe08b); + MP_WritePhyUshort(sc, 0x06, 0x32e1); + MP_WritePhyUshort(sc, 0x06, 0x8b33); + MP_WritePhyUshort(sc, 0x06, 0x1f10); + MP_WritePhyUshort(sc, 0x06, 0x9e1a); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x8b32); + MP_WritePhyUshort(sc, 0x06, 0xe0e0); + MP_WritePhyUshort(sc, 0x06, 0x28e1); + MP_WritePhyUshort(sc, 0x06, 0xe029); + MP_WritePhyUshort(sc, 0x06, 0xf72c); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x28e5); + MP_WritePhyUshort(sc, 0x06, 0xe029); + MP_WritePhyUshort(sc, 0x06, 0xf62c); + MP_WritePhyUshort(sc, 0x06, 0xe4e0); + MP_WritePhyUshort(sc, 0x06, 0x28e5); + MP_WritePhyUshort(sc, 0x06, 0xe029); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0x00e1); + MP_WritePhyUshort(sc, 0x06, 0x4077); + MP_WritePhyUshort(sc, 0x06, 0xe140); + MP_WritePhyUshort(sc, 0x06, 0xbbe0); + MP_WritePhyUshort(sc, 0x06, 0x2a00); + MP_WritePhyUshort(sc, 0x05, 0xe142); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06,PhyRegValue); + MP_WritePhyUshort(sc, 0x05, 0xe140); + PhyRegValue = MP_ReadPhyUshort(sc, 0x06); + PhyRegValue |= BIT_0; + MP_WritePhyUshort(sc, 0x06, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + for (i = 0; i < 200; i++) { + DELAY(100); + PhyRegValue = MP_ReadPhyUshort(sc, 0x00); + if (PhyRegValue & BIT_7) + break; + } + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x0023); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue |= BIT_1; + if (sc->RequiredSecLanDonglePatch) + PhyRegValue &= ~(BIT_2); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x01, 0x328A); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0003); + PhyRegValue = MP_ReadPhyUshort(sc, 0x19); + PhyRegValue &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, PhyRegValue); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); +} + +static void re_set_phy_mcu_8168g_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8146); + MP_WritePhyUshort(sc, 0x14, 0x2300); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0210); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0290); + MP_WritePhyUshort(sc, 0x13, 0xA012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA014); + MP_WritePhyUshort(sc, 0x14, 0x2c04); + MP_WritePhyUshort(sc, 0x14, 0x2c0c); + MP_WritePhyUshort(sc, 0x14, 0x2c6c); + MP_WritePhyUshort(sc, 0x14, 0x2d0d); + MP_WritePhyUshort(sc, 0x14, 0x31ce); + MP_WritePhyUshort(sc, 0x14, 0x506d); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x3108); + MP_WritePhyUshort(sc, 0x14, 0x106d); + MP_WritePhyUshort(sc, 0x14, 0x1560); + MP_WritePhyUshort(sc, 0x14, 0x15a9); + MP_WritePhyUshort(sc, 0x14, 0x206e); + MP_WritePhyUshort(sc, 0x14, 0x175b); + MP_WritePhyUshort(sc, 0x14, 0x6062); + MP_WritePhyUshort(sc, 0x14, 0xd700); + MP_WritePhyUshort(sc, 0x14, 0x5fae); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x3107); + MP_WritePhyUshort(sc, 0x14, 0x4c1e); + MP_WritePhyUshort(sc, 0x14, 0x4169); + MP_WritePhyUshort(sc, 0x14, 0x316a); + MP_WritePhyUshort(sc, 0x14, 0x0c19); + MP_WritePhyUshort(sc, 0x14, 0x31aa); + MP_WritePhyUshort(sc, 0x14, 0x0c19); + MP_WritePhyUshort(sc, 0x14, 0x2c1b); + MP_WritePhyUshort(sc, 0x14, 0x5e62); + MP_WritePhyUshort(sc, 0x14, 0x26b5); + MP_WritePhyUshort(sc, 0x14, 0x31ab); + MP_WritePhyUshort(sc, 0x14, 0x5c1e); + MP_WritePhyUshort(sc, 0x14, 0x2c0c); + MP_WritePhyUshort(sc, 0x14, 0xc040); + MP_WritePhyUshort(sc, 0x14, 0x8808); + MP_WritePhyUshort(sc, 0x14, 0xc520); + MP_WritePhyUshort(sc, 0x14, 0xc421); + MP_WritePhyUshort(sc, 0x14, 0xd05a); + MP_WritePhyUshort(sc, 0x14, 0xd19a); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x608f); + MP_WritePhyUshort(sc, 0x14, 0xd06b); + MP_WritePhyUshort(sc, 0x14, 0xd18a); + MP_WritePhyUshort(sc, 0x14, 0x2c2c); + MP_WritePhyUshort(sc, 0x14, 0xd0be); + MP_WritePhyUshort(sc, 0x14, 0xd188); + MP_WritePhyUshort(sc, 0x14, 0x2c2c); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x4072); + MP_WritePhyUshort(sc, 0x14, 0xc104); + MP_WritePhyUshort(sc, 0x14, 0x2c3e); + MP_WritePhyUshort(sc, 0x14, 0x4076); + MP_WritePhyUshort(sc, 0x14, 0xc110); + MP_WritePhyUshort(sc, 0x14, 0x2c3e); + MP_WritePhyUshort(sc, 0x14, 0x4071); + MP_WritePhyUshort(sc, 0x14, 0xc102); + MP_WritePhyUshort(sc, 0x14, 0x2c3e); + MP_WritePhyUshort(sc, 0x14, 0x4070); + MP_WritePhyUshort(sc, 0x14, 0xc101); + MP_WritePhyUshort(sc, 0x14, 0x2c3e); + MP_WritePhyUshort(sc, 0x14, 0x175b); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x3390); + MP_WritePhyUshort(sc, 0x14, 0x5c39); + MP_WritePhyUshort(sc, 0x14, 0x2c4e); + MP_WritePhyUshort(sc, 0x14, 0x175b); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x6193); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x5f9d); + MP_WritePhyUshort(sc, 0x14, 0x408b); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x6042); + MP_WritePhyUshort(sc, 0x14, 0xb401); + MP_WritePhyUshort(sc, 0x14, 0x175b); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x6073); + MP_WritePhyUshort(sc, 0x14, 0x5fbc); + MP_WritePhyUshort(sc, 0x14, 0x2c4d); + MP_WritePhyUshort(sc, 0x14, 0x26ed); + MP_WritePhyUshort(sc, 0x14, 0xb280); + MP_WritePhyUshort(sc, 0x14, 0xa841); + MP_WritePhyUshort(sc, 0x14, 0x9420); + MP_WritePhyUshort(sc, 0x14, 0x8710); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x42ec); + MP_WritePhyUshort(sc, 0x14, 0x606d); + MP_WritePhyUshort(sc, 0x14, 0xd207); + MP_WritePhyUshort(sc, 0x14, 0x2c57); + MP_WritePhyUshort(sc, 0x14, 0xd203); + MP_WritePhyUshort(sc, 0x14, 0x33ff); + MP_WritePhyUshort(sc, 0x14, 0x563b); + MP_WritePhyUshort(sc, 0x14, 0x3275); + MP_WritePhyUshort(sc, 0x14, 0x7c5e); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0xb402); + MP_WritePhyUshort(sc, 0x14, 0x263b); + MP_WritePhyUshort(sc, 0x14, 0x6096); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0xb406); + MP_WritePhyUshort(sc, 0x14, 0x263b); + MP_WritePhyUshort(sc, 0x14, 0x31d7); + MP_WritePhyUshort(sc, 0x14, 0x7c67); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0xb40e); + MP_WritePhyUshort(sc, 0x14, 0x263b); + MP_WritePhyUshort(sc, 0x14, 0xb410); + MP_WritePhyUshort(sc, 0x14, 0x8802); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0x940e); + MP_WritePhyUshort(sc, 0x14, 0x263b); + MP_WritePhyUshort(sc, 0x14, 0xba04); + MP_WritePhyUshort(sc, 0x14, 0x1cd6); + MP_WritePhyUshort(sc, 0x14, 0xa902); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x4045); + MP_WritePhyUshort(sc, 0x14, 0xa980); + MP_WritePhyUshort(sc, 0x14, 0x3003); + MP_WritePhyUshort(sc, 0x14, 0x59b1); + MP_WritePhyUshort(sc, 0x14, 0xa540); + MP_WritePhyUshort(sc, 0x14, 0xa601); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4043); + MP_WritePhyUshort(sc, 0x14, 0xa910); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x60a0); + MP_WritePhyUshort(sc, 0x14, 0xca33); + MP_WritePhyUshort(sc, 0x14, 0xcb33); + MP_WritePhyUshort(sc, 0x14, 0xa941); + MP_WritePhyUshort(sc, 0x14, 0x2c82); + MP_WritePhyUshort(sc, 0x14, 0xcaff); + MP_WritePhyUshort(sc, 0x14, 0xcbff); + MP_WritePhyUshort(sc, 0x14, 0xa921); + MP_WritePhyUshort(sc, 0x14, 0xce02); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f10); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0x1766); + MP_WritePhyUshort(sc, 0x14, 0x8e02); + MP_WritePhyUshort(sc, 0x14, 0x1787); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x609c); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0x1ce9); + MP_WritePhyUshort(sc, 0x14, 0xce04); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f20); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0x1766); + MP_WritePhyUshort(sc, 0x14, 0x8e04); + MP_WritePhyUshort(sc, 0x14, 0x6044); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0xa520); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4043); + MP_WritePhyUshort(sc, 0x14, 0x2cc1); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0501); + MP_WritePhyUshort(sc, 0x14, 0x1cef); + MP_WritePhyUshort(sc, 0x14, 0xb801); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x4060); + MP_WritePhyUshort(sc, 0x14, 0x7fc4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0x1cf5); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x1cef); + MP_WritePhyUshort(sc, 0x14, 0xb802); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x4061); + MP_WritePhyUshort(sc, 0x14, 0x7fc4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0x1cf5); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0504); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6099); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0xc17f); + MP_WritePhyUshort(sc, 0x14, 0xc200); + MP_WritePhyUshort(sc, 0x14, 0xc43f); + MP_WritePhyUshort(sc, 0x14, 0xcc03); + MP_WritePhyUshort(sc, 0x14, 0xa701); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4018); + MP_WritePhyUshort(sc, 0x14, 0x9910); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x2860); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0504); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6099); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0xa608); + MP_WritePhyUshort(sc, 0x14, 0xc17d); + MP_WritePhyUshort(sc, 0x14, 0xc200); + MP_WritePhyUshort(sc, 0x14, 0xc43f); + MP_WritePhyUshort(sc, 0x14, 0xcc03); + MP_WritePhyUshort(sc, 0x14, 0xa701); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4018); + MP_WritePhyUshort(sc, 0x14, 0x9910); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x2926); + MP_WritePhyUshort(sc, 0x14, 0x1792); + MP_WritePhyUshort(sc, 0x14, 0x27db); + MP_WritePhyUshort(sc, 0x14, 0xc000); + MP_WritePhyUshort(sc, 0x14, 0xc100); + MP_WritePhyUshort(sc, 0x14, 0xc200); + MP_WritePhyUshort(sc, 0x14, 0xc300); + MP_WritePhyUshort(sc, 0x14, 0xc400); + MP_WritePhyUshort(sc, 0x14, 0xc500); + MP_WritePhyUshort(sc, 0x14, 0xc600); + MP_WritePhyUshort(sc, 0x14, 0xc7c1); + MP_WritePhyUshort(sc, 0x14, 0xc800); + MP_WritePhyUshort(sc, 0x14, 0xcc00); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xca0f); + MP_WritePhyUshort(sc, 0x14, 0xcbff); + MP_WritePhyUshort(sc, 0x14, 0xa901); + MP_WritePhyUshort(sc, 0x14, 0x8902); + MP_WritePhyUshort(sc, 0x14, 0xc900); + MP_WritePhyUshort(sc, 0x14, 0xca00); + MP_WritePhyUshort(sc, 0x14, 0xcb00); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xb804); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x6044); + MP_WritePhyUshort(sc, 0x14, 0x9804); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6099); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6098); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cd4); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3003); + MP_WritePhyUshort(sc, 0x14, 0x1d01); + MP_WritePhyUshort(sc, 0x14, 0x2d0b); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x60be); + MP_WritePhyUshort(sc, 0x14, 0xe060); + MP_WritePhyUshort(sc, 0x14, 0x0920); + MP_WritePhyUshort(sc, 0x14, 0x1cd6); + MP_WritePhyUshort(sc, 0x14, 0x2c89); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x3063); + MP_WritePhyUshort(sc, 0x14, 0x1948); + MP_WritePhyUshort(sc, 0x14, 0x288a); + MP_WritePhyUshort(sc, 0x14, 0x1cd6); + MP_WritePhyUshort(sc, 0x14, 0x29bd); + MP_WritePhyUshort(sc, 0x14, 0xa802); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0x843f); + MP_WritePhyUshort(sc, 0x14, 0x81ff); + MP_WritePhyUshort(sc, 0x14, 0x8208); + MP_WritePhyUshort(sc, 0x14, 0xa201); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x30a0); + MP_WritePhyUshort(sc, 0x14, 0x0d1c); + MP_WritePhyUshort(sc, 0x14, 0x30a0); + MP_WritePhyUshort(sc, 0x14, 0x3d13); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f4c); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0xe003); + MP_WritePhyUshort(sc, 0x14, 0x0202); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6090); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0xa20c); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6091); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0x820e); + MP_WritePhyUshort(sc, 0x14, 0xa3e0); + MP_WritePhyUshort(sc, 0x14, 0xa520); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x609d); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0x8520); + MP_WritePhyUshort(sc, 0x14, 0x6703); + MP_WritePhyUshort(sc, 0x14, 0x2d34); + MP_WritePhyUshort(sc, 0x14, 0xa13e); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x6046); + MP_WritePhyUshort(sc, 0x14, 0x2d0d); + MP_WritePhyUshort(sc, 0x14, 0xa43f); + MP_WritePhyUshort(sc, 0x14, 0xa101); + MP_WritePhyUshort(sc, 0x14, 0xc020); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x3121); + MP_WritePhyUshort(sc, 0x14, 0x0d45); + MP_WritePhyUshort(sc, 0x14, 0x30c0); + MP_WritePhyUshort(sc, 0x14, 0x3d0d); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f4c); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0xa540); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4001); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0501); + MP_WritePhyUshort(sc, 0x14, 0x1dac); + MP_WritePhyUshort(sc, 0x14, 0xc1c4); + MP_WritePhyUshort(sc, 0x14, 0xa268); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0x8420); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x1dac); + MP_WritePhyUshort(sc, 0x14, 0xc002); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x8208); + MP_WritePhyUshort(sc, 0x14, 0x8410); + MP_WritePhyUshort(sc, 0x14, 0xa121); + MP_WritePhyUshort(sc, 0x14, 0xc002); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x8120); + MP_WritePhyUshort(sc, 0x14, 0x8180); + MP_WritePhyUshort(sc, 0x14, 0x1d97); + MP_WritePhyUshort(sc, 0x14, 0xa180); + MP_WritePhyUshort(sc, 0x14, 0xa13a); + MP_WritePhyUshort(sc, 0x14, 0x8240); + MP_WritePhyUshort(sc, 0x14, 0xa430); + MP_WritePhyUshort(sc, 0x14, 0xc010); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x30e1); + MP_WritePhyUshort(sc, 0x14, 0x0abc); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f8c); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0xa480); + MP_WritePhyUshort(sc, 0x14, 0xa230); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd70c); + MP_WritePhyUshort(sc, 0x14, 0x4124); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6120); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3128); + MP_WritePhyUshort(sc, 0x14, 0x3d76); + MP_WritePhyUshort(sc, 0x14, 0x2d70); + MP_WritePhyUshort(sc, 0x14, 0xa801); + MP_WritePhyUshort(sc, 0x14, 0x2d6c); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0xe018); + MP_WritePhyUshort(sc, 0x14, 0x0208); + MP_WritePhyUshort(sc, 0x14, 0xa1f8); + MP_WritePhyUshort(sc, 0x14, 0x8480); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x6046); + MP_WritePhyUshort(sc, 0x14, 0x2d0d); + MP_WritePhyUshort(sc, 0x14, 0xa43f); + MP_WritePhyUshort(sc, 0x14, 0xa105); + MP_WritePhyUshort(sc, 0x14, 0x8228); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x81bc); + MP_WritePhyUshort(sc, 0x14, 0xa220); + MP_WritePhyUshort(sc, 0x14, 0x1d97); + MP_WritePhyUshort(sc, 0x14, 0x8220); + MP_WritePhyUshort(sc, 0x14, 0xa1bc); + MP_WritePhyUshort(sc, 0x14, 0xc040); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x30e1); + MP_WritePhyUshort(sc, 0x14, 0x0abc); + MP_WritePhyUshort(sc, 0x14, 0x30e1); + MP_WritePhyUshort(sc, 0x14, 0x3d0d); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f4c); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0xa802); + MP_WritePhyUshort(sc, 0x14, 0xd70c); + MP_WritePhyUshort(sc, 0x14, 0x4244); + MP_WritePhyUshort(sc, 0x14, 0xa301); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3128); + MP_WritePhyUshort(sc, 0x14, 0x3da5); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x5f80); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3109); + MP_WritePhyUshort(sc, 0x14, 0x3da7); + MP_WritePhyUshort(sc, 0x14, 0x2dab); + MP_WritePhyUshort(sc, 0x14, 0xa801); + MP_WritePhyUshort(sc, 0x14, 0x2d9a); + MP_WritePhyUshort(sc, 0x14, 0xa802); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x609a); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2ab6); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x13, 0xA01A); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA006); + MP_WritePhyUshort(sc, 0x14, 0x0ad6); + MP_WritePhyUshort(sc, 0x13, 0xA004); + MP_WritePhyUshort(sc, 0x14, 0x07f5); + MP_WritePhyUshort(sc, 0x13, 0xA002); + MP_WritePhyUshort(sc, 0x14, 0x06a9); + MP_WritePhyUshort(sc, 0x13, 0xA000); + MP_WritePhyUshort(sc, 0x14, 0xf069); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0210); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x83a0); + MP_WritePhyUshort(sc, 0x14, 0xaf83); + MP_WritePhyUshort(sc, 0x14, 0xacaf); + MP_WritePhyUshort(sc, 0x14, 0x83b8); + MP_WritePhyUshort(sc, 0x14, 0xaf83); + MP_WritePhyUshort(sc, 0x14, 0xcdaf); + MP_WritePhyUshort(sc, 0x14, 0x83d3); + MP_WritePhyUshort(sc, 0x14, 0x0204); + MP_WritePhyUshort(sc, 0x14, 0x9a02); + MP_WritePhyUshort(sc, 0x14, 0x09a9); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0x61af); + MP_WritePhyUshort(sc, 0x14, 0x02fc); + MP_WritePhyUshort(sc, 0x14, 0xad20); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x867c); + MP_WritePhyUshort(sc, 0x14, 0xad21); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x85c9); + MP_WritePhyUshort(sc, 0x14, 0xad22); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x1bc0); + MP_WritePhyUshort(sc, 0x14, 0xaf17); + MP_WritePhyUshort(sc, 0x14, 0xe302); + MP_WritePhyUshort(sc, 0x14, 0x8703); + MP_WritePhyUshort(sc, 0x14, 0xaf18); + MP_WritePhyUshort(sc, 0x14, 0x6201); + MP_WritePhyUshort(sc, 0x14, 0x06e0); + MP_WritePhyUshort(sc, 0x14, 0x8148); + MP_WritePhyUshort(sc, 0x14, 0xaf3c); + MP_WritePhyUshort(sc, 0x14, 0x69f8); + MP_WritePhyUshort(sc, 0x14, 0xf9fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x10f7); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x131f); + MP_WritePhyUshort(sc, 0x14, 0xd104); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0xf302); + MP_WritePhyUshort(sc, 0x14, 0x4259); + MP_WritePhyUshort(sc, 0x14, 0x0287); + MP_WritePhyUshort(sc, 0x14, 0x88bf); + MP_WritePhyUshort(sc, 0x14, 0x87cf); + MP_WritePhyUshort(sc, 0x14, 0xd7b8); + MP_WritePhyUshort(sc, 0x14, 0x22d0); + MP_WritePhyUshort(sc, 0x14, 0x0c02); + MP_WritePhyUshort(sc, 0x14, 0x4252); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xcda0); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xce8b); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xd1f5); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xd2a9); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xd30a); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xf010); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xf38f); + MP_WritePhyUshort(sc, 0x14, 0xee81); + MP_WritePhyUshort(sc, 0x14, 0x011e); + MP_WritePhyUshort(sc, 0x14, 0xee81); + MP_WritePhyUshort(sc, 0x14, 0x0b4a); + MP_WritePhyUshort(sc, 0x14, 0xee81); + MP_WritePhyUshort(sc, 0x14, 0x0c7c); + MP_WritePhyUshort(sc, 0x14, 0xee81); + MP_WritePhyUshort(sc, 0x14, 0x127f); + MP_WritePhyUshort(sc, 0x14, 0xd100); + MP_WritePhyUshort(sc, 0x14, 0x0210); + MP_WritePhyUshort(sc, 0x14, 0xb5ee); + MP_WritePhyUshort(sc, 0x14, 0x8088); + MP_WritePhyUshort(sc, 0x14, 0xa4ee); + MP_WritePhyUshort(sc, 0x14, 0x8089); + MP_WritePhyUshort(sc, 0x14, 0x44ee); + MP_WritePhyUshort(sc, 0x14, 0x809a); + MP_WritePhyUshort(sc, 0x14, 0xa4ee); + MP_WritePhyUshort(sc, 0x14, 0x809b); + MP_WritePhyUshort(sc, 0x14, 0x44ee); + MP_WritePhyUshort(sc, 0x14, 0x809c); + MP_WritePhyUshort(sc, 0x14, 0xa7ee); + MP_WritePhyUshort(sc, 0x14, 0x80a5); + MP_WritePhyUshort(sc, 0x14, 0xa7d2); + MP_WritePhyUshort(sc, 0x14, 0x0002); + MP_WritePhyUshort(sc, 0x14, 0x0e66); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0xc0ee); + MP_WritePhyUshort(sc, 0x14, 0x87fc); + MP_WritePhyUshort(sc, 0x14, 0x00e0); + MP_WritePhyUshort(sc, 0x14, 0x8245); + MP_WritePhyUshort(sc, 0x14, 0xf622); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x45ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x0402); + MP_WritePhyUshort(sc, 0x14, 0x847a); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0xb302); + MP_WritePhyUshort(sc, 0x14, 0x0cab); + MP_WritePhyUshort(sc, 0x14, 0x020c); + MP_WritePhyUshort(sc, 0x14, 0xc402); + MP_WritePhyUshort(sc, 0x14, 0x0cef); + MP_WritePhyUshort(sc, 0x14, 0x020d); + MP_WritePhyUshort(sc, 0x14, 0x0802); + MP_WritePhyUshort(sc, 0x14, 0x0d33); + MP_WritePhyUshort(sc, 0x14, 0x020c); + MP_WritePhyUshort(sc, 0x14, 0x3d04); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe182); + MP_WritePhyUshort(sc, 0x14, 0x2fac); + MP_WritePhyUshort(sc, 0x14, 0x291a); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x24ac); + MP_WritePhyUshort(sc, 0x14, 0x2102); + MP_WritePhyUshort(sc, 0x14, 0xae22); + MP_WritePhyUshort(sc, 0x14, 0x0210); + MP_WritePhyUshort(sc, 0x14, 0x57f6); + MP_WritePhyUshort(sc, 0x14, 0x21e4); + MP_WritePhyUshort(sc, 0x14, 0x8224); + MP_WritePhyUshort(sc, 0x14, 0xd101); + MP_WritePhyUshort(sc, 0x14, 0xbf44); + MP_WritePhyUshort(sc, 0x14, 0xd202); + MP_WritePhyUshort(sc, 0x14, 0x4259); + MP_WritePhyUshort(sc, 0x14, 0xae10); + MP_WritePhyUshort(sc, 0x14, 0x0212); + MP_WritePhyUshort(sc, 0x14, 0x4cf6); + MP_WritePhyUshort(sc, 0x14, 0x29e5); + MP_WritePhyUshort(sc, 0x14, 0x822f); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x24f6); + MP_WritePhyUshort(sc, 0x14, 0x21e4); + MP_WritePhyUshort(sc, 0x14, 0x8224); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xe182); + MP_WritePhyUshort(sc, 0x14, 0x2fac); + MP_WritePhyUshort(sc, 0x14, 0x2a18); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x24ac); + MP_WritePhyUshort(sc, 0x14, 0x2202); + MP_WritePhyUshort(sc, 0x14, 0xae26); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0xf802); + MP_WritePhyUshort(sc, 0x14, 0x8565); + MP_WritePhyUshort(sc, 0x14, 0xd101); + MP_WritePhyUshort(sc, 0x14, 0xbf44); + MP_WritePhyUshort(sc, 0x14, 0xd502); + MP_WritePhyUshort(sc, 0x14, 0x4259); + MP_WritePhyUshort(sc, 0x14, 0xae0e); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0xea02); + MP_WritePhyUshort(sc, 0x14, 0x85a9); + MP_WritePhyUshort(sc, 0x14, 0xe182); + MP_WritePhyUshort(sc, 0x14, 0x2ff6); + MP_WritePhyUshort(sc, 0x14, 0x2ae5); + MP_WritePhyUshort(sc, 0x14, 0x822f); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x24f6); + MP_WritePhyUshort(sc, 0x14, 0x22e4); + MP_WritePhyUshort(sc, 0x14, 0x8224); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf9e2); + MP_WritePhyUshort(sc, 0x14, 0x8011); + MP_WritePhyUshort(sc, 0x14, 0xad31); + MP_WritePhyUshort(sc, 0x14, 0x05d2); + MP_WritePhyUshort(sc, 0x14, 0x0002); + MP_WritePhyUshort(sc, 0x14, 0x0e66); + MP_WritePhyUshort(sc, 0x14, 0xfd04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x8011); + MP_WritePhyUshort(sc, 0x14, 0xad21); + MP_WritePhyUshort(sc, 0x14, 0x5cbf); + MP_WritePhyUshort(sc, 0x14, 0x43be); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97ac); + MP_WritePhyUshort(sc, 0x14, 0x281b); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0xc102); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x12bf); + MP_WritePhyUshort(sc, 0x14, 0x43c7); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97ac); + MP_WritePhyUshort(sc, 0x14, 0x2804); + MP_WritePhyUshort(sc, 0x14, 0xd300); + MP_WritePhyUshort(sc, 0x14, 0xae07); + MP_WritePhyUshort(sc, 0x14, 0xd306); + MP_WritePhyUshort(sc, 0x14, 0xaf85); + MP_WritePhyUshort(sc, 0x14, 0x56d3); + MP_WritePhyUshort(sc, 0x14, 0x03e0); + MP_WritePhyUshort(sc, 0x14, 0x8011); + MP_WritePhyUshort(sc, 0x14, 0xad26); + MP_WritePhyUshort(sc, 0x14, 0x25bf); + MP_WritePhyUshort(sc, 0x14, 0x4559); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97e2); + MP_WritePhyUshort(sc, 0x14, 0x8073); + MP_WritePhyUshort(sc, 0x14, 0x0d21); + MP_WritePhyUshort(sc, 0x14, 0xf637); + MP_WritePhyUshort(sc, 0x14, 0x0d11); + MP_WritePhyUshort(sc, 0x14, 0xf62f); + MP_WritePhyUshort(sc, 0x14, 0x1b21); + MP_WritePhyUshort(sc, 0x14, 0xaa02); + MP_WritePhyUshort(sc, 0x14, 0xae10); + MP_WritePhyUshort(sc, 0x14, 0xe280); + MP_WritePhyUshort(sc, 0x14, 0x740d); + MP_WritePhyUshort(sc, 0x14, 0x21f6); + MP_WritePhyUshort(sc, 0x14, 0x371b); + MP_WritePhyUshort(sc, 0x14, 0x21aa); + MP_WritePhyUshort(sc, 0x14, 0x0313); + MP_WritePhyUshort(sc, 0x14, 0xae02); + MP_WritePhyUshort(sc, 0x14, 0x2b02); + MP_WritePhyUshort(sc, 0x14, 0x020e); + MP_WritePhyUshort(sc, 0x14, 0x5102); + MP_WritePhyUshort(sc, 0x14, 0x0e66); + MP_WritePhyUshort(sc, 0x14, 0x020f); + MP_WritePhyUshort(sc, 0x14, 0xa3ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xf9fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x12ad); + MP_WritePhyUshort(sc, 0x14, 0x2733); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0xbe02); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x09bf); + MP_WritePhyUshort(sc, 0x14, 0x43c1); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97ad); + MP_WritePhyUshort(sc, 0x14, 0x2821); + MP_WritePhyUshort(sc, 0x14, 0xbf45); + MP_WritePhyUshort(sc, 0x14, 0x5902); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0xe387); + MP_WritePhyUshort(sc, 0x14, 0xffd2); + MP_WritePhyUshort(sc, 0x14, 0x001b); + MP_WritePhyUshort(sc, 0x14, 0x45ac); + MP_WritePhyUshort(sc, 0x14, 0x2711); + MP_WritePhyUshort(sc, 0x14, 0xe187); + MP_WritePhyUshort(sc, 0x14, 0xfebf); + MP_WritePhyUshort(sc, 0x14, 0x87e4); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x590d); + MP_WritePhyUshort(sc, 0x14, 0x11bf); + MP_WritePhyUshort(sc, 0x14, 0x87e7); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69d1); + MP_WritePhyUshort(sc, 0x14, 0x00bf); + MP_WritePhyUshort(sc, 0x14, 0x87e4); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59bf); + MP_WritePhyUshort(sc, 0x14, 0x87e7); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xee87); + MP_WritePhyUshort(sc, 0x14, 0xff46); + MP_WritePhyUshort(sc, 0x14, 0xee87); + MP_WritePhyUshort(sc, 0x14, 0xfe01); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x8241); + MP_WritePhyUshort(sc, 0x14, 0xa000); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x85eb); + MP_WritePhyUshort(sc, 0x14, 0xae0e); + MP_WritePhyUshort(sc, 0x14, 0xa001); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x1a5a); + MP_WritePhyUshort(sc, 0x14, 0xae06); + MP_WritePhyUshort(sc, 0x14, 0xa002); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x1ae6); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xf9fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x29f6); + MP_WritePhyUshort(sc, 0x14, 0x21e4); + MP_WritePhyUshort(sc, 0x14, 0x8229); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x10ac); + MP_WritePhyUshort(sc, 0x14, 0x2202); + MP_WritePhyUshort(sc, 0x14, 0xae76); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x27f7); + MP_WritePhyUshort(sc, 0x14, 0x21e4); + MP_WritePhyUshort(sc, 0x14, 0x8227); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0x1302); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0xef21); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0x1602); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0x0c11); + MP_WritePhyUshort(sc, 0x14, 0x1e21); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0x1902); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0x0c12); + MP_WritePhyUshort(sc, 0x14, 0x1e21); + MP_WritePhyUshort(sc, 0x14, 0xe682); + MP_WritePhyUshort(sc, 0x14, 0x43a2); + MP_WritePhyUshort(sc, 0x14, 0x000a); + MP_WritePhyUshort(sc, 0x14, 0xe182); + MP_WritePhyUshort(sc, 0x14, 0x27f6); + MP_WritePhyUshort(sc, 0x14, 0x29e5); + MP_WritePhyUshort(sc, 0x14, 0x8227); + MP_WritePhyUshort(sc, 0x14, 0xae42); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x44f7); + MP_WritePhyUshort(sc, 0x14, 0x21e4); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x0246); + MP_WritePhyUshort(sc, 0x14, 0xaebf); + MP_WritePhyUshort(sc, 0x14, 0x4325); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97ef); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x431c); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x970c); + MP_WritePhyUshort(sc, 0x14, 0x121e); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x431f); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x970c); + MP_WritePhyUshort(sc, 0x14, 0x131e); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x4328); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x970c); + MP_WritePhyUshort(sc, 0x14, 0x141e); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x44b1); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x970c); + MP_WritePhyUshort(sc, 0x14, 0x161e); + MP_WritePhyUshort(sc, 0x14, 0x21e6); + MP_WritePhyUshort(sc, 0x14, 0x8242); + MP_WritePhyUshort(sc, 0x14, 0xee82); + MP_WritePhyUshort(sc, 0x14, 0x4101); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x46a0); + MP_WritePhyUshort(sc, 0x14, 0x0005); + MP_WritePhyUshort(sc, 0x14, 0x0286); + MP_WritePhyUshort(sc, 0x14, 0x96ae); + MP_WritePhyUshort(sc, 0x14, 0x06a0); + MP_WritePhyUshort(sc, 0x14, 0x0103); + MP_WritePhyUshort(sc, 0x14, 0x0219); + MP_WritePhyUshort(sc, 0x14, 0x19ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x29f6); + MP_WritePhyUshort(sc, 0x14, 0x20e4); + MP_WritePhyUshort(sc, 0x14, 0x8229); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x10ac); + MP_WritePhyUshort(sc, 0x14, 0x2102); + MP_WritePhyUshort(sc, 0x14, 0xae54); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x27f7); + MP_WritePhyUshort(sc, 0x14, 0x20e4); + MP_WritePhyUshort(sc, 0x14, 0x8227); + MP_WritePhyUshort(sc, 0x14, 0xbf42); + MP_WritePhyUshort(sc, 0x14, 0xe602); + MP_WritePhyUshort(sc, 0x14, 0x4297); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x22bf); + MP_WritePhyUshort(sc, 0x14, 0x430d); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97e5); + MP_WritePhyUshort(sc, 0x14, 0x8247); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x20d1); + MP_WritePhyUshort(sc, 0x14, 0x03bf); + MP_WritePhyUshort(sc, 0x14, 0x4307); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59ee); + MP_WritePhyUshort(sc, 0x14, 0x8246); + MP_WritePhyUshort(sc, 0x14, 0x00e1); + MP_WritePhyUshort(sc, 0x14, 0x8227); + MP_WritePhyUshort(sc, 0x14, 0xf628); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x27ae); + MP_WritePhyUshort(sc, 0x14, 0x21d1); + MP_WritePhyUshort(sc, 0x14, 0x04bf); + MP_WritePhyUshort(sc, 0x14, 0x4307); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59ae); + MP_WritePhyUshort(sc, 0x14, 0x08d1); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x4307); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59e0); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0xf720); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x4402); + MP_WritePhyUshort(sc, 0x14, 0x46ae); + MP_WritePhyUshort(sc, 0x14, 0xee82); + MP_WritePhyUshort(sc, 0x14, 0x4601); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x8013); + MP_WritePhyUshort(sc, 0x14, 0xad24); + MP_WritePhyUshort(sc, 0x14, 0x1cbf); + MP_WritePhyUshort(sc, 0x14, 0x87f0); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x97ad); + MP_WritePhyUshort(sc, 0x14, 0x2813); + MP_WritePhyUshort(sc, 0x14, 0xe087); + MP_WritePhyUshort(sc, 0x14, 0xfca0); + MP_WritePhyUshort(sc, 0x14, 0x0005); + MP_WritePhyUshort(sc, 0x14, 0x0287); + MP_WritePhyUshort(sc, 0x14, 0x36ae); + MP_WritePhyUshort(sc, 0x14, 0x10a0); + MP_WritePhyUshort(sc, 0x14, 0x0105); + MP_WritePhyUshort(sc, 0x14, 0x0287); + MP_WritePhyUshort(sc, 0x14, 0x48ae); + MP_WritePhyUshort(sc, 0x14, 0x08e0); + MP_WritePhyUshort(sc, 0x14, 0x8230); + MP_WritePhyUshort(sc, 0x14, 0xf626); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x30ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8e0); + MP_WritePhyUshort(sc, 0x14, 0x8245); + MP_WritePhyUshort(sc, 0x14, 0xf722); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x4502); + MP_WritePhyUshort(sc, 0x14, 0x46ae); + MP_WritePhyUshort(sc, 0x14, 0xee87); + MP_WritePhyUshort(sc, 0x14, 0xfc01); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xfb02); + MP_WritePhyUshort(sc, 0x14, 0x46d3); + MP_WritePhyUshort(sc, 0x14, 0xad50); + MP_WritePhyUshort(sc, 0x14, 0x2fbf); + MP_WritePhyUshort(sc, 0x14, 0x87ed); + MP_WritePhyUshort(sc, 0x14, 0xd101); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59bf); + MP_WritePhyUshort(sc, 0x14, 0x87ed); + MP_WritePhyUshort(sc, 0x14, 0xd100); + MP_WritePhyUshort(sc, 0x14, 0x0242); + MP_WritePhyUshort(sc, 0x14, 0x59e0); + MP_WritePhyUshort(sc, 0x14, 0x8245); + MP_WritePhyUshort(sc, 0x14, 0xf622); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x4502); + MP_WritePhyUshort(sc, 0x14, 0x46ae); + MP_WritePhyUshort(sc, 0x14, 0xd100); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0xf002); + MP_WritePhyUshort(sc, 0x14, 0x4259); + MP_WritePhyUshort(sc, 0x14, 0xee87); + MP_WritePhyUshort(sc, 0x14, 0xfc00); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x30f6); + MP_WritePhyUshort(sc, 0x14, 0x26e4); + MP_WritePhyUshort(sc, 0x14, 0x8230); + MP_WritePhyUshort(sc, 0x14, 0xffef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xface); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69fb); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0xb3d7); + MP_WritePhyUshort(sc, 0x14, 0x001c); + MP_WritePhyUshort(sc, 0x14, 0xd819); + MP_WritePhyUshort(sc, 0x14, 0xd919); + MP_WritePhyUshort(sc, 0x14, 0xda19); + MP_WritePhyUshort(sc, 0x14, 0xdb19); + MP_WritePhyUshort(sc, 0x14, 0x07ef); + MP_WritePhyUshort(sc, 0x14, 0x9502); + MP_WritePhyUshort(sc, 0x14, 0x4259); + MP_WritePhyUshort(sc, 0x14, 0x073f); + MP_WritePhyUshort(sc, 0x14, 0x0004); + MP_WritePhyUshort(sc, 0x14, 0x9fec); + MP_WritePhyUshort(sc, 0x14, 0xffef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xc6fe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x0400); + MP_WritePhyUshort(sc, 0x14, 0x0145); + MP_WritePhyUshort(sc, 0x14, 0x7d00); + MP_WritePhyUshort(sc, 0x14, 0x0345); + MP_WritePhyUshort(sc, 0x14, 0x5c00); + MP_WritePhyUshort(sc, 0x14, 0x0143); + MP_WritePhyUshort(sc, 0x14, 0x4f00); + MP_WritePhyUshort(sc, 0x14, 0x0387); + MP_WritePhyUshort(sc, 0x14, 0xdb00); + MP_WritePhyUshort(sc, 0x14, 0x0987); + MP_WritePhyUshort(sc, 0x14, 0xde00); + MP_WritePhyUshort(sc, 0x14, 0x0987); + MP_WritePhyUshort(sc, 0x14, 0xe100); + MP_WritePhyUshort(sc, 0x14, 0x0087); + MP_WritePhyUshort(sc, 0x14, 0xeaa4); + MP_WritePhyUshort(sc, 0x14, 0x00b8); + MP_WritePhyUshort(sc, 0x14, 0x20c4); + MP_WritePhyUshort(sc, 0x14, 0x1600); + MP_WritePhyUshort(sc, 0x14, 0x000f); + MP_WritePhyUshort(sc, 0x14, 0xf800); + MP_WritePhyUshort(sc, 0x14, 0x7098); + MP_WritePhyUshort(sc, 0x14, 0xa58a); + MP_WritePhyUshort(sc, 0x14, 0xb6a8); + MP_WritePhyUshort(sc, 0x14, 0x3e50); + MP_WritePhyUshort(sc, 0x14, 0xa83e); + MP_WritePhyUshort(sc, 0x14, 0x33bc); + MP_WritePhyUshort(sc, 0x14, 0xc622); + MP_WritePhyUshort(sc, 0x14, 0xbcc6); + MP_WritePhyUshort(sc, 0x14, 0xaaa4); + MP_WritePhyUshort(sc, 0x14, 0x42ff); + MP_WritePhyUshort(sc, 0x14, 0xc408); + MP_WritePhyUshort(sc, 0x14, 0x00c4); + MP_WritePhyUshort(sc, 0x14, 0x16a8); + MP_WritePhyUshort(sc, 0x14, 0xbcc0); + MP_WritePhyUshort(sc, 0x13, 0xb818); + MP_WritePhyUshort(sc, 0x14, 0x02f3); + MP_WritePhyUshort(sc, 0x13, 0xb81a); + MP_WritePhyUshort(sc, 0x14, 0x17d1); + MP_WritePhyUshort(sc, 0x13, 0xb81c); + MP_WritePhyUshort(sc, 0x14, 0x185a); + MP_WritePhyUshort(sc, 0x13, 0xb81e); + MP_WritePhyUshort(sc, 0x14, 0x3c66); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x021f); + MP_WritePhyUshort(sc, 0x13, 0xc416); + MP_WritePhyUshort(sc, 0x14, 0x0500); + MP_WritePhyUshort(sc, 0x13, 0xb82e); + MP_WritePhyUshort(sc, 0x14, 0xfffc); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + PhyRegValue &= ~(BIT_9); + MP_WritePhyUshort(sc, 0x10, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8146); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); + if (sc->RequiredSecLanDonglePatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_6); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + } +} + +static void re_set_phy_mcu_8168gu_2(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8146); + MP_WritePhyUshort(sc, 0x14, 0x0300); + MP_WritePhyUshort(sc, 0x13, 0xB82E); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x0290); + MP_WritePhyUshort(sc, 0x13, 0xa012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xa014); + MP_WritePhyUshort(sc, 0x14, 0x2c04); + MP_WritePhyUshort(sc, 0x14, 0x2c07); + MP_WritePhyUshort(sc, 0x14, 0x2c07); + MP_WritePhyUshort(sc, 0x14, 0x2c07); + MP_WritePhyUshort(sc, 0x14, 0xa304); + MP_WritePhyUshort(sc, 0x14, 0xa301); + MP_WritePhyUshort(sc, 0x14, 0x207e); + MP_WritePhyUshort(sc, 0x13, 0xa01a); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xa006); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xa004); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xa002); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xa000); + MP_WritePhyUshort(sc, 0x14, 0x107c); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x0210); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8146); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); + if (sc->RequiredSecLanDonglePatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_6); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + } +} + +static void re_set_phy_mcu_8411b_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8146); + MP_WritePhyUshort(sc, 0x14, 0x0100); + MP_WritePhyUshort(sc, 0x13, 0xB82E); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x0290); + MP_WritePhyUshort(sc, 0x13, 0xa012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xa014); + MP_WritePhyUshort(sc, 0x14, 0x2c04); + MP_WritePhyUshort(sc, 0x14, 0x2c07); + MP_WritePhyUshort(sc, 0x14, 0x2c07); + MP_WritePhyUshort(sc, 0x14, 0x2c07); + MP_WritePhyUshort(sc, 0x14, 0xa304); + MP_WritePhyUshort(sc, 0x14, 0xa301); + MP_WritePhyUshort(sc, 0x14, 0x207e); + MP_WritePhyUshort(sc, 0x13, 0xa01a); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xa006); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xa004); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xa002); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xa000); + MP_WritePhyUshort(sc, 0x14, 0x107c); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x0210); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8146); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); + if (sc->RequiredSecLanDonglePatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_6); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + } +} + +static void re_set_phy_mcu_8168h_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8028); + MP_WritePhyUshort(sc, 0x14, 0x6200); + MP_WritePhyUshort(sc, 0x13, 0xB82E); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0290); + MP_WritePhyUshort(sc, 0x13, 0xA012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA014); + MP_WritePhyUshort(sc, 0x14, 0x2c04); + MP_WritePhyUshort(sc, 0x14, 0x2c10); + MP_WritePhyUshort(sc, 0x14, 0x2c10); + MP_WritePhyUshort(sc, 0x14, 0x2c10); + MP_WritePhyUshort(sc, 0x14, 0xa210); + MP_WritePhyUshort(sc, 0x14, 0xa101); + MP_WritePhyUshort(sc, 0x14, 0xce10); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f40); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0x183e); + MP_WritePhyUshort(sc, 0x14, 0x8e10); + MP_WritePhyUshort(sc, 0x14, 0x8101); + MP_WritePhyUshort(sc, 0x14, 0x8210); + MP_WritePhyUshort(sc, 0x14, 0x28da); + MP_WritePhyUshort(sc, 0x13, 0xA01A); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA006); + MP_WritePhyUshort(sc, 0x14, 0x0017); + MP_WritePhyUshort(sc, 0x13, 0xA004); + MP_WritePhyUshort(sc, 0x14, 0x0015); + MP_WritePhyUshort(sc, 0x13, 0xA002); + MP_WritePhyUshort(sc, 0x14, 0x0013); + MP_WritePhyUshort(sc, 0x13, 0xA000); + MP_WritePhyUshort(sc, 0x14, 0x18d1); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0210); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8028); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); + if (sc->RequiredSecLanDonglePatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_6); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + } +} + +static void re_set_phy_mcu_8168h_2(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8028); + MP_WritePhyUshort(sc, 0x14, 0x6201); + MP_WritePhyUshort(sc, 0x13, 0xB82E); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0290); + MP_WritePhyUshort(sc, 0x13, 0xA012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA014); + MP_WritePhyUshort(sc, 0x14, 0x2c04); + MP_WritePhyUshort(sc, 0x14, 0x2c09); + MP_WritePhyUshort(sc, 0x14, 0x2c09); + MP_WritePhyUshort(sc, 0x14, 0x2c09); + MP_WritePhyUshort(sc, 0x14, 0xad01); + MP_WritePhyUshort(sc, 0x14, 0xad01); + MP_WritePhyUshort(sc, 0x14, 0xad01); + MP_WritePhyUshort(sc, 0x14, 0xad01); + MP_WritePhyUshort(sc, 0x14, 0x236c); + MP_WritePhyUshort(sc, 0x13, 0xA01A); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA006); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xA004); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xA002); + MP_WritePhyUshort(sc, 0x14, 0x0fff); + MP_WritePhyUshort(sc, 0x13, 0xA000); + MP_WritePhyUshort(sc, 0x14, 0x136b); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0210); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8323); + MP_WritePhyUshort(sc, 0x14, 0xaf83); + MP_WritePhyUshort(sc, 0x14, 0x2faf); + MP_WritePhyUshort(sc, 0x14, 0x853d); + MP_WritePhyUshort(sc, 0x14, 0xaf85); + MP_WritePhyUshort(sc, 0x14, 0x3daf); + MP_WritePhyUshort(sc, 0x14, 0x853d); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x45ad); + MP_WritePhyUshort(sc, 0x14, 0x2052); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7ae3); + MP_WritePhyUshort(sc, 0x14, 0x85fe); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f6); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7a1b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fa); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7be3); + MP_WritePhyUshort(sc, 0x14, 0x85fe); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f7); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7b1b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fb); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7ce3); + MP_WritePhyUshort(sc, 0x14, 0x85fe); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f8); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7c1b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fc); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7de3); + MP_WritePhyUshort(sc, 0x14, 0x85fe); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f9); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7d1b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fd); + MP_WritePhyUshort(sc, 0x14, 0xae50); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7ee3); + MP_WritePhyUshort(sc, 0x14, 0x85ff); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f6); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7e1b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fa); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7fe3); + MP_WritePhyUshort(sc, 0x14, 0x85ff); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f7); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x7f1b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fb); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x80e3); + MP_WritePhyUshort(sc, 0x14, 0x85ff); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f8); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x801b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fc); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x81e3); + MP_WritePhyUshort(sc, 0x14, 0x85ff); + MP_WritePhyUshort(sc, 0x14, 0x1a03); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x85f9); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x811b); + MP_WritePhyUshort(sc, 0x14, 0x03e4); + MP_WritePhyUshort(sc, 0x14, 0x85fd); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf6ad); + MP_WritePhyUshort(sc, 0x14, 0x2404); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xf610); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf7ad); + MP_WritePhyUshort(sc, 0x14, 0x2404); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xf710); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf8ad); + MP_WritePhyUshort(sc, 0x14, 0x2404); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xf810); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf9ad); + MP_WritePhyUshort(sc, 0x14, 0x2404); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xf910); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfaad); + MP_WritePhyUshort(sc, 0x14, 0x2704); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xfa00); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfbad); + MP_WritePhyUshort(sc, 0x14, 0x2704); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xfb00); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfcad); + MP_WritePhyUshort(sc, 0x14, 0x2704); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xfc00); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfdad); + MP_WritePhyUshort(sc, 0x14, 0x2704); + MP_WritePhyUshort(sc, 0x14, 0xee85); + MP_WritePhyUshort(sc, 0x14, 0xfd00); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x44ad); + MP_WritePhyUshort(sc, 0x14, 0x203f); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf6e4); + MP_WritePhyUshort(sc, 0x14, 0x8288); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfae4); + MP_WritePhyUshort(sc, 0x14, 0x8289); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x440d); + MP_WritePhyUshort(sc, 0x14, 0x0458); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x8264); + MP_WritePhyUshort(sc, 0x14, 0x0215); + MP_WritePhyUshort(sc, 0x14, 0x38bf); + MP_WritePhyUshort(sc, 0x14, 0x824e); + MP_WritePhyUshort(sc, 0x14, 0x0213); + MP_WritePhyUshort(sc, 0x14, 0x06a0); + MP_WritePhyUshort(sc, 0x14, 0x010f); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x44f6); + MP_WritePhyUshort(sc, 0x14, 0x20e4); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x580f); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x5aae); + MP_WritePhyUshort(sc, 0x14, 0x0ebf); + MP_WritePhyUshort(sc, 0x14, 0x825e); + MP_WritePhyUshort(sc, 0x14, 0xe382); + MP_WritePhyUshort(sc, 0x14, 0x44f7); + MP_WritePhyUshort(sc, 0x14, 0x3ce7); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x0212); + MP_WritePhyUshort(sc, 0x14, 0xf0ad); + MP_WritePhyUshort(sc, 0x14, 0x213f); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf7e4); + MP_WritePhyUshort(sc, 0x14, 0x8288); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfbe4); + MP_WritePhyUshort(sc, 0x14, 0x8289); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x440d); + MP_WritePhyUshort(sc, 0x14, 0x0558); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x826b); + MP_WritePhyUshort(sc, 0x14, 0x0215); + MP_WritePhyUshort(sc, 0x14, 0x38bf); + MP_WritePhyUshort(sc, 0x14, 0x824f); + MP_WritePhyUshort(sc, 0x14, 0x0213); + MP_WritePhyUshort(sc, 0x14, 0x06a0); + MP_WritePhyUshort(sc, 0x14, 0x010f); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x44f6); + MP_WritePhyUshort(sc, 0x14, 0x21e4); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x580f); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x5bae); + MP_WritePhyUshort(sc, 0x14, 0x0ebf); + MP_WritePhyUshort(sc, 0x14, 0x8265); + MP_WritePhyUshort(sc, 0x14, 0xe382); + MP_WritePhyUshort(sc, 0x14, 0x44f7); + MP_WritePhyUshort(sc, 0x14, 0x3de7); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x0212); + MP_WritePhyUshort(sc, 0x14, 0xf0ad); + MP_WritePhyUshort(sc, 0x14, 0x223f); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf8e4); + MP_WritePhyUshort(sc, 0x14, 0x8288); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfce4); + MP_WritePhyUshort(sc, 0x14, 0x8289); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x440d); + MP_WritePhyUshort(sc, 0x14, 0x0658); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x8272); + MP_WritePhyUshort(sc, 0x14, 0x0215); + MP_WritePhyUshort(sc, 0x14, 0x38bf); + MP_WritePhyUshort(sc, 0x14, 0x8250); + MP_WritePhyUshort(sc, 0x14, 0x0213); + MP_WritePhyUshort(sc, 0x14, 0x06a0); + MP_WritePhyUshort(sc, 0x14, 0x010f); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x44f6); + MP_WritePhyUshort(sc, 0x14, 0x22e4); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x580f); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x5cae); + MP_WritePhyUshort(sc, 0x14, 0x0ebf); + MP_WritePhyUshort(sc, 0x14, 0x826c); + MP_WritePhyUshort(sc, 0x14, 0xe382); + MP_WritePhyUshort(sc, 0x14, 0x44f7); + MP_WritePhyUshort(sc, 0x14, 0x3ee7); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x0212); + MP_WritePhyUshort(sc, 0x14, 0xf0ad); + MP_WritePhyUshort(sc, 0x14, 0x233f); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xf9e4); + MP_WritePhyUshort(sc, 0x14, 0x8288); + MP_WritePhyUshort(sc, 0x14, 0xe085); + MP_WritePhyUshort(sc, 0x14, 0xfde4); + MP_WritePhyUshort(sc, 0x14, 0x8289); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x440d); + MP_WritePhyUshort(sc, 0x14, 0x0758); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x8279); + MP_WritePhyUshort(sc, 0x14, 0x0215); + MP_WritePhyUshort(sc, 0x14, 0x38bf); + MP_WritePhyUshort(sc, 0x14, 0x8251); + MP_WritePhyUshort(sc, 0x14, 0x0213); + MP_WritePhyUshort(sc, 0x14, 0x06a0); + MP_WritePhyUshort(sc, 0x14, 0x010f); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x44f6); + MP_WritePhyUshort(sc, 0x14, 0x23e4); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x580f); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x5dae); + MP_WritePhyUshort(sc, 0x14, 0x0ebf); + MP_WritePhyUshort(sc, 0x14, 0x8273); + MP_WritePhyUshort(sc, 0x14, 0xe382); + MP_WritePhyUshort(sc, 0x14, 0x44f7); + MP_WritePhyUshort(sc, 0x14, 0x3fe7); + MP_WritePhyUshort(sc, 0x14, 0x8244); + MP_WritePhyUshort(sc, 0x14, 0x0212); + MP_WritePhyUshort(sc, 0x14, 0xf0ee); + MP_WritePhyUshort(sc, 0x14, 0x8288); + MP_WritePhyUshort(sc, 0x14, 0x10ee); + MP_WritePhyUshort(sc, 0x14, 0x8289); + MP_WritePhyUshort(sc, 0x14, 0x00af); + MP_WritePhyUshort(sc, 0x14, 0x14aa); + MP_WritePhyUshort(sc, 0x13, 0xb818); + MP_WritePhyUshort(sc, 0x14, 0x13cf); + MP_WritePhyUshort(sc, 0x13, 0xb81a); + MP_WritePhyUshort(sc, 0x14, 0xfffd); + MP_WritePhyUshort(sc, 0x13, 0xb81c); + MP_WritePhyUshort(sc, 0x14, 0xfffd); + MP_WritePhyUshort(sc, 0x13, 0xb81e); + MP_WritePhyUshort(sc, 0x14, 0xfffd); + MP_WritePhyUshort(sc, 0x13, 0xb832); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8028); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); + if (sc->RequiredSecLanDonglePatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_6); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + } +} + +static void re_set_phy_mcu_8168h_3(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8042); + MP_WritePhyUshort(sc, 0x14, 0x3800); + MP_WritePhyUshort(sc, 0x13, 0xB82E); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0090); + MP_WritePhyUshort(sc, 0x13, 0xA016); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xA014); + MP_WritePhyUshort(sc, 0x14, 0x1800); + MP_WritePhyUshort(sc, 0x14, 0x8002); + MP_WritePhyUshort(sc, 0x14, 0x2b5d); + MP_WritePhyUshort(sc, 0x14, 0x0c68); + MP_WritePhyUshort(sc, 0x14, 0x1800); + MP_WritePhyUshort(sc, 0x14, 0x0b3c); + MP_WritePhyUshort(sc, 0x13, 0xA000); + MP_WritePhyUshort(sc, 0x14, 0x0b3a); + MP_WritePhyUshort(sc, 0x13, 0xA008); + MP_WritePhyUshort(sc, 0x14, 0x0100); + MP_WritePhyUshort(sc, 0x13, 0xB820); + MP_WritePhyUshort(sc, 0x14, 0x0010); + + MP_WritePhyUshort(sc, 0x13, 0x83f3); + MP_WritePhyUshort(sc, 0x14, 0xaf84); + MP_WritePhyUshort(sc, 0x14, 0x0baf); + MP_WritePhyUshort(sc, 0x14, 0x8466); + MP_WritePhyUshort(sc, 0x14, 0xaf84); + MP_WritePhyUshort(sc, 0x14, 0xcdaf); + MP_WritePhyUshort(sc, 0x14, 0x8736); + MP_WritePhyUshort(sc, 0x14, 0xaf87); + MP_WritePhyUshort(sc, 0x14, 0x39af); + MP_WritePhyUshort(sc, 0x14, 0x8739); + MP_WritePhyUshort(sc, 0x14, 0xaf87); + MP_WritePhyUshort(sc, 0x14, 0x39af); + MP_WritePhyUshort(sc, 0x14, 0x8739); + MP_WritePhyUshort(sc, 0x14, 0xef79); + MP_WritePhyUshort(sc, 0x14, 0xfb89); + MP_WritePhyUshort(sc, 0x14, 0xe987); + MP_WritePhyUshort(sc, 0x14, 0xffd7); + MP_WritePhyUshort(sc, 0x14, 0x0017); + MP_WritePhyUshort(sc, 0x14, 0xd400); + MP_WritePhyUshort(sc, 0x14, 0x051c); + MP_WritePhyUshort(sc, 0x14, 0x421a); + MP_WritePhyUshort(sc, 0x14, 0x741b); + MP_WritePhyUshort(sc, 0x14, 0x97e9); + MP_WritePhyUshort(sc, 0x14, 0x87fe); + MP_WritePhyUshort(sc, 0x14, 0xffef); + MP_WritePhyUshort(sc, 0x14, 0x97e0); + MP_WritePhyUshort(sc, 0x14, 0x82aa); + MP_WritePhyUshort(sc, 0x14, 0xa000); + MP_WritePhyUshort(sc, 0x14, 0x08ef); + MP_WritePhyUshort(sc, 0x14, 0x46dc); + MP_WritePhyUshort(sc, 0x14, 0x19dd); + MP_WritePhyUshort(sc, 0x14, 0xaf1a); + MP_WritePhyUshort(sc, 0x14, 0x37a0); + MP_WritePhyUshort(sc, 0x14, 0x012d); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0xa7ac); + MP_WritePhyUshort(sc, 0x14, 0x2013); + MP_WritePhyUshort(sc, 0x14, 0xe087); + MP_WritePhyUshort(sc, 0x14, 0xffe1); + MP_WritePhyUshort(sc, 0x14, 0x87fe); + MP_WritePhyUshort(sc, 0x14, 0xac27); + MP_WritePhyUshort(sc, 0x14, 0x05a1); + MP_WritePhyUshort(sc, 0x14, 0x0807); + MP_WritePhyUshort(sc, 0x14, 0xae0f); + MP_WritePhyUshort(sc, 0x14, 0xa107); + MP_WritePhyUshort(sc, 0x14, 0x02ae); + MP_WritePhyUshort(sc, 0x14, 0x0aef); + MP_WritePhyUshort(sc, 0x14, 0x4619); + MP_WritePhyUshort(sc, 0x14, 0x19dc); + MP_WritePhyUshort(sc, 0x14, 0x19dd); + MP_WritePhyUshort(sc, 0x14, 0xaf1a); + MP_WritePhyUshort(sc, 0x14, 0x37d8); + MP_WritePhyUshort(sc, 0x14, 0x19d9); + MP_WritePhyUshort(sc, 0x14, 0x19dc); + MP_WritePhyUshort(sc, 0x14, 0x19dd); + MP_WritePhyUshort(sc, 0x14, 0xaf1a); + MP_WritePhyUshort(sc, 0x14, 0x3719); + MP_WritePhyUshort(sc, 0x14, 0x19ae); + MP_WritePhyUshort(sc, 0x14, 0xcfbf); + MP_WritePhyUshort(sc, 0x14, 0x8763); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdc3c); + MP_WritePhyUshort(sc, 0x14, 0x0005); + MP_WritePhyUshort(sc, 0x14, 0xaaf5); + MP_WritePhyUshort(sc, 0x14, 0x0249); + MP_WritePhyUshort(sc, 0x14, 0xcaef); + MP_WritePhyUshort(sc, 0x14, 0x67d7); + MP_WritePhyUshort(sc, 0x14, 0x0014); + MP_WritePhyUshort(sc, 0x14, 0x0249); + MP_WritePhyUshort(sc, 0x14, 0xe5ad); + MP_WritePhyUshort(sc, 0x14, 0x50f7); + MP_WritePhyUshort(sc, 0x14, 0xd400); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x46a7); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0x98bf); + MP_WritePhyUshort(sc, 0x14, 0x465c); + MP_WritePhyUshort(sc, 0x14, 0x024a); + MP_WritePhyUshort(sc, 0x14, 0x5fd4); + MP_WritePhyUshort(sc, 0x14, 0x0003); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x7502); + MP_WritePhyUshort(sc, 0x14, 0x4498); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x7202); + MP_WritePhyUshort(sc, 0x14, 0x4a5f); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6602); + MP_WritePhyUshort(sc, 0x14, 0x4a5f); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6902); + MP_WritePhyUshort(sc, 0x14, 0x44dc); + MP_WritePhyUshort(sc, 0x14, 0xad28); + MP_WritePhyUshort(sc, 0x14, 0xf7bf); + MP_WritePhyUshort(sc, 0x14, 0x876f); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdcad); + MP_WritePhyUshort(sc, 0x14, 0x28f7); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6c02); + MP_WritePhyUshort(sc, 0x14, 0x4a5f); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6c02); + MP_WritePhyUshort(sc, 0x14, 0x4a56); + MP_WritePhyUshort(sc, 0x14, 0xbf46); + MP_WritePhyUshort(sc, 0x14, 0x5c02); + MP_WritePhyUshort(sc, 0x14, 0x4a56); + MP_WritePhyUshort(sc, 0x14, 0xbf45); + MP_WritePhyUshort(sc, 0x14, 0x21af); + MP_WritePhyUshort(sc, 0x14, 0x020e); + MP_WritePhyUshort(sc, 0x14, 0xee82); + MP_WritePhyUshort(sc, 0x14, 0x5000); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0xdd02); + MP_WritePhyUshort(sc, 0x14, 0x8521); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0x36af); + MP_WritePhyUshort(sc, 0x14, 0x03d2); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfafb); + MP_WritePhyUshort(sc, 0x14, 0xef59); + MP_WritePhyUshort(sc, 0x14, 0xbf45); + MP_WritePhyUshort(sc, 0x14, 0x3002); + MP_WritePhyUshort(sc, 0x14, 0x44dc); + MP_WritePhyUshort(sc, 0x14, 0x3c00); + MP_WritePhyUshort(sc, 0x14, 0x03aa); + MP_WritePhyUshort(sc, 0x14, 0x2cbf); + MP_WritePhyUshort(sc, 0x14, 0x8769); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdcad); + MP_WritePhyUshort(sc, 0x14, 0x2823); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6f02); + MP_WritePhyUshort(sc, 0x14, 0x44dc); + MP_WritePhyUshort(sc, 0x14, 0xad28); + MP_WritePhyUshort(sc, 0x14, 0x1a02); + MP_WritePhyUshort(sc, 0x14, 0x49ca); + MP_WritePhyUshort(sc, 0x14, 0xef67); + MP_WritePhyUshort(sc, 0x14, 0xd700); + MP_WritePhyUshort(sc, 0x14, 0x0202); + MP_WritePhyUshort(sc, 0x14, 0x49e5); + MP_WritePhyUshort(sc, 0x14, 0xad50); + MP_WritePhyUshort(sc, 0x14, 0xf7bf); + MP_WritePhyUshort(sc, 0x14, 0x876c); + MP_WritePhyUshort(sc, 0x14, 0x024a); + MP_WritePhyUshort(sc, 0x14, 0x5fbf); + MP_WritePhyUshort(sc, 0x14, 0x876c); + MP_WritePhyUshort(sc, 0x14, 0x024a); + MP_WritePhyUshort(sc, 0x14, 0x56ef); + MP_WritePhyUshort(sc, 0x14, 0x95ff); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x15ad); + MP_WritePhyUshort(sc, 0x14, 0x2406); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6002); + MP_WritePhyUshort(sc, 0x14, 0x4a56); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xe087); + MP_WritePhyUshort(sc, 0x14, 0xf9e1); + MP_WritePhyUshort(sc, 0x14, 0x87fa); + MP_WritePhyUshort(sc, 0x14, 0x1b10); + MP_WritePhyUshort(sc, 0x14, 0x9f1e); + MP_WritePhyUshort(sc, 0x14, 0xee87); + MP_WritePhyUshort(sc, 0x14, 0xf900); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x15ac); + MP_WritePhyUshort(sc, 0x14, 0x2606); + MP_WritePhyUshort(sc, 0x14, 0xee87); + MP_WritePhyUshort(sc, 0x14, 0xf700); + MP_WritePhyUshort(sc, 0x14, 0xae12); + MP_WritePhyUshort(sc, 0x14, 0x0286); + MP_WritePhyUshort(sc, 0x14, 0x9702); + MP_WritePhyUshort(sc, 0x14, 0x8565); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0x9d02); + MP_WritePhyUshort(sc, 0x14, 0x865a); + MP_WritePhyUshort(sc, 0x14, 0xae04); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x87f9); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69fa); + MP_WritePhyUshort(sc, 0x14, 0xbf45); + MP_WritePhyUshort(sc, 0x14, 0x3002); + MP_WritePhyUshort(sc, 0x14, 0x44dc); + MP_WritePhyUshort(sc, 0x14, 0xa103); + MP_WritePhyUshort(sc, 0x14, 0x22e0); + MP_WritePhyUshort(sc, 0x14, 0x87eb); + MP_WritePhyUshort(sc, 0x14, 0xe187); + MP_WritePhyUshort(sc, 0x14, 0xecef); + MP_WritePhyUshort(sc, 0x14, 0x64bf); + MP_WritePhyUshort(sc, 0x14, 0x8748); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdc1b); + MP_WritePhyUshort(sc, 0x14, 0x46aa); + MP_WritePhyUshort(sc, 0x14, 0x0abf); + MP_WritePhyUshort(sc, 0x14, 0x874b); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdc1b); + MP_WritePhyUshort(sc, 0x14, 0x46ab); + MP_WritePhyUshort(sc, 0x14, 0x06bf); + MP_WritePhyUshort(sc, 0x14, 0x8745); + MP_WritePhyUshort(sc, 0x14, 0x024a); + MP_WritePhyUshort(sc, 0x14, 0x5ffe); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xef59); + MP_WritePhyUshort(sc, 0x14, 0xf9bf); + MP_WritePhyUshort(sc, 0x14, 0x4530); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdca1); + MP_WritePhyUshort(sc, 0x14, 0x0310); + MP_WritePhyUshort(sc, 0x14, 0xe087); + MP_WritePhyUshort(sc, 0x14, 0xf7ac); + MP_WritePhyUshort(sc, 0x14, 0x2605); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0xc9ae); + MP_WritePhyUshort(sc, 0x14, 0x0d02); + MP_WritePhyUshort(sc, 0x14, 0x860d); + MP_WritePhyUshort(sc, 0x14, 0xae08); + MP_WritePhyUshort(sc, 0x14, 0xe287); + MP_WritePhyUshort(sc, 0x14, 0xf7f6); + MP_WritePhyUshort(sc, 0x14, 0x36e6); + MP_WritePhyUshort(sc, 0x14, 0x87f7); + MP_WritePhyUshort(sc, 0x14, 0xfdef); + MP_WritePhyUshort(sc, 0x14, 0x95fd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfafb); + MP_WritePhyUshort(sc, 0x14, 0xef79); + MP_WritePhyUshort(sc, 0x14, 0xfbbf); + MP_WritePhyUshort(sc, 0x14, 0x8748); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdcef); + MP_WritePhyUshort(sc, 0x14, 0x64e2); + MP_WritePhyUshort(sc, 0x14, 0x87e9); + MP_WritePhyUshort(sc, 0x14, 0xe387); + MP_WritePhyUshort(sc, 0x14, 0xea1b); + MP_WritePhyUshort(sc, 0x14, 0x659e); + MP_WritePhyUshort(sc, 0x14, 0x10e4); + MP_WritePhyUshort(sc, 0x14, 0x87e9); + MP_WritePhyUshort(sc, 0x14, 0xe587); + MP_WritePhyUshort(sc, 0x14, 0xeae2); + MP_WritePhyUshort(sc, 0x14, 0x87f7); + MP_WritePhyUshort(sc, 0x14, 0xf636); + MP_WritePhyUshort(sc, 0x14, 0xe687); + MP_WritePhyUshort(sc, 0x14, 0xf7ae); + MP_WritePhyUshort(sc, 0x14, 0x13e2); + MP_WritePhyUshort(sc, 0x14, 0x87f7); + MP_WritePhyUshort(sc, 0x14, 0xf736); + MP_WritePhyUshort(sc, 0x14, 0xe687); + MP_WritePhyUshort(sc, 0x14, 0xf702); + MP_WritePhyUshort(sc, 0x14, 0x49ca); + MP_WritePhyUshort(sc, 0x14, 0xef57); + MP_WritePhyUshort(sc, 0x14, 0xe687); + MP_WritePhyUshort(sc, 0x14, 0xe7e7); + MP_WritePhyUshort(sc, 0x14, 0x87e8); + MP_WritePhyUshort(sc, 0x14, 0xffef); + MP_WritePhyUshort(sc, 0x14, 0x97ff); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfafb); + MP_WritePhyUshort(sc, 0x14, 0xef79); + MP_WritePhyUshort(sc, 0x14, 0xfbe2); + MP_WritePhyUshort(sc, 0x14, 0x87e7); + MP_WritePhyUshort(sc, 0x14, 0xe387); + MP_WritePhyUshort(sc, 0x14, 0xe8ef); + MP_WritePhyUshort(sc, 0x14, 0x65e2); + MP_WritePhyUshort(sc, 0x14, 0x87fb); + MP_WritePhyUshort(sc, 0x14, 0xe387); + MP_WritePhyUshort(sc, 0x14, 0xfcef); + MP_WritePhyUshort(sc, 0x14, 0x7502); + MP_WritePhyUshort(sc, 0x14, 0x49e5); + MP_WritePhyUshort(sc, 0x14, 0xac50); + MP_WritePhyUshort(sc, 0x14, 0x1abf); + MP_WritePhyUshort(sc, 0x14, 0x8748); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdcef); + MP_WritePhyUshort(sc, 0x14, 0x64e2); + MP_WritePhyUshort(sc, 0x14, 0x87e9); + MP_WritePhyUshort(sc, 0x14, 0xe387); + MP_WritePhyUshort(sc, 0x14, 0xea1b); + MP_WritePhyUshort(sc, 0x14, 0x659e); + MP_WritePhyUshort(sc, 0x14, 0x16e4); + MP_WritePhyUshort(sc, 0x14, 0x87e9); + MP_WritePhyUshort(sc, 0x14, 0xe587); + MP_WritePhyUshort(sc, 0x14, 0xeaae); + MP_WritePhyUshort(sc, 0x14, 0x06bf); + MP_WritePhyUshort(sc, 0x14, 0x8745); + MP_WritePhyUshort(sc, 0x14, 0x024a); + MP_WritePhyUshort(sc, 0x14, 0x5fe2); + MP_WritePhyUshort(sc, 0x14, 0x87f7); + MP_WritePhyUshort(sc, 0x14, 0xf636); + MP_WritePhyUshort(sc, 0x14, 0xe687); + MP_WritePhyUshort(sc, 0x14, 0xf7ff); + MP_WritePhyUshort(sc, 0x14, 0xef97); + MP_WritePhyUshort(sc, 0x14, 0xfffe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xf9fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x3f02); + MP_WritePhyUshort(sc, 0x14, 0x44dc); + MP_WritePhyUshort(sc, 0x14, 0xad28); + MP_WritePhyUshort(sc, 0x14, 0x29bf); + MP_WritePhyUshort(sc, 0x14, 0x873c); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdcef); + MP_WritePhyUshort(sc, 0x14, 0x54bf); + MP_WritePhyUshort(sc, 0x14, 0x8739); + MP_WritePhyUshort(sc, 0x14, 0x0244); + MP_WritePhyUshort(sc, 0x14, 0xdcac); + MP_WritePhyUshort(sc, 0x14, 0x290d); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x05a3); + MP_WritePhyUshort(sc, 0x14, 0x020c); + MP_WritePhyUshort(sc, 0x14, 0xae10); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0x07ae); + MP_WritePhyUshort(sc, 0x14, 0x0ba3); + MP_WritePhyUshort(sc, 0x14, 0x0402); + MP_WritePhyUshort(sc, 0x14, 0xae06); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x4502); + MP_WritePhyUshort(sc, 0x14, 0x4a5f); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfafb); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xfae0); + MP_WritePhyUshort(sc, 0x14, 0x8015); + MP_WritePhyUshort(sc, 0x14, 0xad25); + MP_WritePhyUshort(sc, 0x14, 0x41d2); + MP_WritePhyUshort(sc, 0x14, 0x0002); + MP_WritePhyUshort(sc, 0x14, 0x86ed); + MP_WritePhyUshort(sc, 0x14, 0xe087); + MP_WritePhyUshort(sc, 0x14, 0xebe1); + MP_WritePhyUshort(sc, 0x14, 0x87ec); + MP_WritePhyUshort(sc, 0x14, 0x1b46); + MP_WritePhyUshort(sc, 0x14, 0xab26); + MP_WritePhyUshort(sc, 0x14, 0xd40b); + MP_WritePhyUshort(sc, 0x14, 0xff1b); + MP_WritePhyUshort(sc, 0x14, 0x46aa); + MP_WritePhyUshort(sc, 0x14, 0x1fac); + MP_WritePhyUshort(sc, 0x14, 0x3204); + MP_WritePhyUshort(sc, 0x14, 0xef32); + MP_WritePhyUshort(sc, 0x14, 0xae02); + MP_WritePhyUshort(sc, 0x14, 0xd304); + MP_WritePhyUshort(sc, 0x14, 0x0c31); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0xeb1a); + MP_WritePhyUshort(sc, 0x14, 0x93d8); + MP_WritePhyUshort(sc, 0x14, 0x19d9); + MP_WritePhyUshort(sc, 0x14, 0x1b46); + MP_WritePhyUshort(sc, 0x14, 0xab0e); + MP_WritePhyUshort(sc, 0x14, 0x19d8); + MP_WritePhyUshort(sc, 0x14, 0x19d9); + MP_WritePhyUshort(sc, 0x14, 0x1b46); + MP_WritePhyUshort(sc, 0x14, 0xaa06); + MP_WritePhyUshort(sc, 0x14, 0x12a2); + MP_WritePhyUshort(sc, 0x14, 0x08c9); + MP_WritePhyUshort(sc, 0x14, 0xae06); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x4202); + MP_WritePhyUshort(sc, 0x14, 0x4a5f); + MP_WritePhyUshort(sc, 0x14, 0xfeef); + MP_WritePhyUshort(sc, 0x14, 0x96ff); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8fb); + MP_WritePhyUshort(sc, 0x14, 0xef79); + MP_WritePhyUshort(sc, 0x14, 0xa200); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x8748); + MP_WritePhyUshort(sc, 0x14, 0xae33); + MP_WritePhyUshort(sc, 0x14, 0xa201); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x874b); + MP_WritePhyUshort(sc, 0x14, 0xae2b); + MP_WritePhyUshort(sc, 0x14, 0xa202); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x874e); + MP_WritePhyUshort(sc, 0x14, 0xae23); + MP_WritePhyUshort(sc, 0x14, 0xa203); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x8751); + MP_WritePhyUshort(sc, 0x14, 0xae1b); + MP_WritePhyUshort(sc, 0x14, 0xa204); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x8754); + MP_WritePhyUshort(sc, 0x14, 0xae13); + MP_WritePhyUshort(sc, 0x14, 0xa205); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x8757); + MP_WritePhyUshort(sc, 0x14, 0xae0b); + MP_WritePhyUshort(sc, 0x14, 0xa206); + MP_WritePhyUshort(sc, 0x14, 0x05bf); + MP_WritePhyUshort(sc, 0x14, 0x875a); + MP_WritePhyUshort(sc, 0x14, 0xae03); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x5d02); + MP_WritePhyUshort(sc, 0x14, 0x44dc); + MP_WritePhyUshort(sc, 0x14, 0xef64); + MP_WritePhyUshort(sc, 0x14, 0xef97); + MP_WritePhyUshort(sc, 0x14, 0xfffc); + MP_WritePhyUshort(sc, 0x14, 0x04af); + MP_WritePhyUshort(sc, 0x14, 0x00ed); + MP_WritePhyUshort(sc, 0x14, 0x54a4); + MP_WritePhyUshort(sc, 0x14, 0x3474); + MP_WritePhyUshort(sc, 0x14, 0xa600); + MP_WritePhyUshort(sc, 0x14, 0x22a4); + MP_WritePhyUshort(sc, 0x14, 0x3411); + MP_WritePhyUshort(sc, 0x14, 0xb842); + MP_WritePhyUshort(sc, 0x14, 0x22b8); + MP_WritePhyUshort(sc, 0x14, 0x42f0); + MP_WritePhyUshort(sc, 0x14, 0xa200); + MP_WritePhyUshort(sc, 0x14, 0xf0a2); + MP_WritePhyUshort(sc, 0x14, 0x02f0); + MP_WritePhyUshort(sc, 0x14, 0xa204); + MP_WritePhyUshort(sc, 0x14, 0xf0a2); + MP_WritePhyUshort(sc, 0x14, 0x06f0); + MP_WritePhyUshort(sc, 0x14, 0xa208); + MP_WritePhyUshort(sc, 0x14, 0xf0a2); + MP_WritePhyUshort(sc, 0x14, 0x0af0); + MP_WritePhyUshort(sc, 0x14, 0xa20c); + MP_WritePhyUshort(sc, 0x14, 0xf0a2); + MP_WritePhyUshort(sc, 0x14, 0x0e55); + MP_WritePhyUshort(sc, 0x14, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0xd9c6); + MP_WritePhyUshort(sc, 0x14, 0x08aa); + MP_WritePhyUshort(sc, 0x14, 0xc430); + MP_WritePhyUshort(sc, 0x14, 0x00c6); + MP_WritePhyUshort(sc, 0x14, 0x1433); + MP_WritePhyUshort(sc, 0x14, 0xc41a); + MP_WritePhyUshort(sc, 0x14, 0x88c4); + MP_WritePhyUshort(sc, 0x14, 0x2e22); + MP_WritePhyUshort(sc, 0x14, 0xc42e); + MP_WritePhyUshort(sc, 0x14, 0x54c4); + MP_WritePhyUshort(sc, 0x14, 0x1a00); + MP_WritePhyUshort(sc, 0x13, 0xb818); + MP_WritePhyUshort(sc, 0x14, 0x1a01); + MP_WritePhyUshort(sc, 0x13, 0xb81a); + MP_WritePhyUshort(sc, 0x14, 0x020b); + MP_WritePhyUshort(sc, 0x13, 0xb81c); + MP_WritePhyUshort(sc, 0x14, 0x03ce); + MP_WritePhyUshort(sc, 0x13, 0xb81e); + MP_WritePhyUshort(sc, 0x14, 0x00e7); + MP_WritePhyUshort(sc, 0x13, 0xb846); + MP_WritePhyUshort(sc, 0x14, 0xffff); + MP_WritePhyUshort(sc, 0x13, 0xb848); + MP_WritePhyUshort(sc, 0x14, 0xffff); + MP_WritePhyUshort(sc, 0x13, 0xb84a); + MP_WritePhyUshort(sc, 0x14, 0xffff); + MP_WritePhyUshort(sc, 0x13, 0xb84c); + MP_WritePhyUshort(sc, 0x14, 0xffff); + MP_WritePhyUshort(sc, 0x13, 0xb832); + MP_WritePhyUshort(sc, 0x14, 0x000f); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1f, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8042); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); + if (sc->RequiredSecLanDonglePatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + PhyRegValue = MP_ReadPhyUshort(sc, 0x11); + PhyRegValue &= ~(BIT_6); + MP_WritePhyUshort(sc, 0x11, PhyRegValue); + } +} + +static void re_set_phy_mcu_8168ep_1(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc,0x1f, 0x0A43); + MP_WritePhyUshort(sc,0x13, 0x8146); + MP_WritePhyUshort(sc,0x14, 0x2700); + MP_WritePhyUshort(sc,0x13, 0xB82E); + MP_WritePhyUshort(sc,0x14, 0x0001); + + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x0090); + MP_WritePhyUshort(sc, 0x13, 0xa012); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xa014); + MP_WritePhyUshort(sc, 0x14, 0x2c04); + MP_WritePhyUshort(sc, 0x14, 0x2c1b); + MP_WritePhyUshort(sc, 0x14, 0x2c65); + MP_WritePhyUshort(sc, 0x14, 0x2d14); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x4092); + MP_WritePhyUshort(sc, 0x14, 0xba04); + MP_WritePhyUshort(sc, 0x14, 0x3084); + MP_WritePhyUshort(sc, 0x14, 0x1d04); + MP_WritePhyUshort(sc, 0x14, 0x1cdd); + MP_WritePhyUshort(sc, 0x14, 0x1ce8); + MP_WritePhyUshort(sc, 0x14, 0xaeff); + MP_WritePhyUshort(sc, 0x14, 0xaf02); + MP_WritePhyUshort(sc, 0x14, 0x8f02); + MP_WritePhyUshort(sc, 0x14, 0x8eff); + MP_WritePhyUshort(sc, 0x14, 0xce01); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f00); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0xd712); + MP_WritePhyUshort(sc, 0x14, 0x5fe8); + MP_WritePhyUshort(sc, 0x14, 0xaf02); + MP_WritePhyUshort(sc, 0x14, 0x8f02); + MP_WritePhyUshort(sc, 0x14, 0x8e01); + MP_WritePhyUshort(sc, 0x14, 0x1cf2); + MP_WritePhyUshort(sc, 0x14, 0x2825); + MP_WritePhyUshort(sc, 0x14, 0xd05a); + MP_WritePhyUshort(sc, 0x14, 0xd19a); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x608f); + MP_WritePhyUshort(sc, 0x14, 0xd06b); + MP_WritePhyUshort(sc, 0x14, 0xd18a); + MP_WritePhyUshort(sc, 0x14, 0x2c25); + MP_WritePhyUshort(sc, 0x14, 0xd0be); + MP_WritePhyUshort(sc, 0x14, 0xd188); + MP_WritePhyUshort(sc, 0x14, 0x2c25); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x4072); + MP_WritePhyUshort(sc, 0x14, 0xc104); + MP_WritePhyUshort(sc, 0x14, 0x2c37); + MP_WritePhyUshort(sc, 0x14, 0x4076); + MP_WritePhyUshort(sc, 0x14, 0xc110); + MP_WritePhyUshort(sc, 0x14, 0x2c37); + MP_WritePhyUshort(sc, 0x14, 0x4071); + MP_WritePhyUshort(sc, 0x14, 0xc102); + MP_WritePhyUshort(sc, 0x14, 0x2c37); + MP_WritePhyUshort(sc, 0x14, 0x4070); + MP_WritePhyUshort(sc, 0x14, 0xc101); + MP_WritePhyUshort(sc, 0x14, 0x2c37); + MP_WritePhyUshort(sc, 0x14, 0x1786); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x3390); + MP_WritePhyUshort(sc, 0x14, 0x5c32); + MP_WritePhyUshort(sc, 0x14, 0x2c47); + MP_WritePhyUshort(sc, 0x14, 0x1786); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x6193); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x5f9d); + MP_WritePhyUshort(sc, 0x14, 0x408b); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x6042); + MP_WritePhyUshort(sc, 0x14, 0xb401); + MP_WritePhyUshort(sc, 0x14, 0x1786); + MP_WritePhyUshort(sc, 0x14, 0xd708); + MP_WritePhyUshort(sc, 0x14, 0x6073); + MP_WritePhyUshort(sc, 0x14, 0x5fbc); + MP_WritePhyUshort(sc, 0x14, 0x2c46); + MP_WritePhyUshort(sc, 0x14, 0x26fe); + MP_WritePhyUshort(sc, 0x14, 0xb280); + MP_WritePhyUshort(sc, 0x14, 0xa841); + MP_WritePhyUshort(sc, 0x14, 0x94e0); + MP_WritePhyUshort(sc, 0x14, 0x8710); + MP_WritePhyUshort(sc, 0x14, 0xd709); + MP_WritePhyUshort(sc, 0x14, 0x42ec); + MP_WritePhyUshort(sc, 0x14, 0x606d); + MP_WritePhyUshort(sc, 0x14, 0xd207); + MP_WritePhyUshort(sc, 0x14, 0x2c50); + MP_WritePhyUshort(sc, 0x14, 0xd203); + MP_WritePhyUshort(sc, 0x14, 0x33ff); + MP_WritePhyUshort(sc, 0x14, 0x5647); + MP_WritePhyUshort(sc, 0x14, 0x3275); + MP_WritePhyUshort(sc, 0x14, 0x7c57); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0xb402); + MP_WritePhyUshort(sc, 0x14, 0x2647); + MP_WritePhyUshort(sc, 0x14, 0x6096); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0xb406); + MP_WritePhyUshort(sc, 0x14, 0x2647); + MP_WritePhyUshort(sc, 0x14, 0x31d7); + MP_WritePhyUshort(sc, 0x14, 0x7c60); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0xb40e); + MP_WritePhyUshort(sc, 0x14, 0x2647); + MP_WritePhyUshort(sc, 0x14, 0xb410); + MP_WritePhyUshort(sc, 0x14, 0x8802); + MP_WritePhyUshort(sc, 0x14, 0xb240); + MP_WritePhyUshort(sc, 0x14, 0x940e); + MP_WritePhyUshort(sc, 0x14, 0x2647); + MP_WritePhyUshort(sc, 0x14, 0xba04); + MP_WritePhyUshort(sc, 0x14, 0x1cdd); + MP_WritePhyUshort(sc, 0x14, 0xa902); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x4045); + MP_WritePhyUshort(sc, 0x14, 0xa980); + MP_WritePhyUshort(sc, 0x14, 0x3003); + MP_WritePhyUshort(sc, 0x14, 0x5a19); + MP_WritePhyUshort(sc, 0x14, 0xa540); + MP_WritePhyUshort(sc, 0x14, 0xa601); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4043); + MP_WritePhyUshort(sc, 0x14, 0xa910); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x60a0); + MP_WritePhyUshort(sc, 0x14, 0xca33); + MP_WritePhyUshort(sc, 0x14, 0xcb33); + MP_WritePhyUshort(sc, 0x14, 0xa941); + MP_WritePhyUshort(sc, 0x14, 0x2c7b); + MP_WritePhyUshort(sc, 0x14, 0xcaff); + MP_WritePhyUshort(sc, 0x14, 0xcbff); + MP_WritePhyUshort(sc, 0x14, 0xa921); + MP_WritePhyUshort(sc, 0x14, 0xce02); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f10); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0x1791); + MP_WritePhyUshort(sc, 0x14, 0x8e02); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x41a3); + MP_WritePhyUshort(sc, 0x14, 0xa140); + MP_WritePhyUshort(sc, 0x14, 0xa220); + MP_WritePhyUshort(sc, 0x14, 0xce10); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f40); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0x1791); + MP_WritePhyUshort(sc, 0x14, 0x8e10); + MP_WritePhyUshort(sc, 0x14, 0x8140); + MP_WritePhyUshort(sc, 0x14, 0x8220); + MP_WritePhyUshort(sc, 0x14, 0xa301); + MP_WritePhyUshort(sc, 0x14, 0x17b2); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x609c); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0x1cf0); + MP_WritePhyUshort(sc, 0x14, 0xce04); + MP_WritePhyUshort(sc, 0x14, 0xe070); + MP_WritePhyUshort(sc, 0x14, 0x0f20); + MP_WritePhyUshort(sc, 0x14, 0xaf01); + MP_WritePhyUshort(sc, 0x14, 0x8f01); + MP_WritePhyUshort(sc, 0x14, 0x1791); + MP_WritePhyUshort(sc, 0x14, 0x8e04); + MP_WritePhyUshort(sc, 0x14, 0x6044); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0xa520); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4043); + MP_WritePhyUshort(sc, 0x14, 0x2cc8); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0501); + MP_WritePhyUshort(sc, 0x14, 0x1cf6); + MP_WritePhyUshort(sc, 0x14, 0xb801); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x4060); + MP_WritePhyUshort(sc, 0x14, 0x7fc4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0x1cfc); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x1cf6); + MP_WritePhyUshort(sc, 0x14, 0xb802); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x4061); + MP_WritePhyUshort(sc, 0x14, 0x7fc4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0x1cfc); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0504); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6099); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0xc17f); + MP_WritePhyUshort(sc, 0x14, 0xc200); + MP_WritePhyUshort(sc, 0x14, 0xc43f); + MP_WritePhyUshort(sc, 0x14, 0xcc03); + MP_WritePhyUshort(sc, 0x14, 0xa701); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4018); + MP_WritePhyUshort(sc, 0x14, 0x9910); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x28a1); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0504); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6099); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0xa608); + MP_WritePhyUshort(sc, 0x14, 0xc17d); + MP_WritePhyUshort(sc, 0x14, 0xc200); + MP_WritePhyUshort(sc, 0x14, 0xc43f); + MP_WritePhyUshort(sc, 0x14, 0xcc03); + MP_WritePhyUshort(sc, 0x14, 0xa701); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4018); + MP_WritePhyUshort(sc, 0x14, 0x9910); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x298e); + MP_WritePhyUshort(sc, 0x14, 0x17bd); + MP_WritePhyUshort(sc, 0x14, 0x2815); + MP_WritePhyUshort(sc, 0x14, 0xc000); + MP_WritePhyUshort(sc, 0x14, 0xc100); + MP_WritePhyUshort(sc, 0x14, 0xc200); + MP_WritePhyUshort(sc, 0x14, 0xc300); + MP_WritePhyUshort(sc, 0x14, 0xc400); + MP_WritePhyUshort(sc, 0x14, 0xc500); + MP_WritePhyUshort(sc, 0x14, 0xc600); + MP_WritePhyUshort(sc, 0x14, 0xc7c1); + MP_WritePhyUshort(sc, 0x14, 0xc800); + MP_WritePhyUshort(sc, 0x14, 0xcc00); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xca0f); + MP_WritePhyUshort(sc, 0x14, 0xcbff); + MP_WritePhyUshort(sc, 0x14, 0xa901); + MP_WritePhyUshort(sc, 0x14, 0x8902); + MP_WritePhyUshort(sc, 0x14, 0xc900); + MP_WritePhyUshort(sc, 0x14, 0xca00); + MP_WritePhyUshort(sc, 0x14, 0xcb00); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xb804); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x6044); + MP_WritePhyUshort(sc, 0x14, 0x9804); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6099); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6098); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fa4); + MP_WritePhyUshort(sc, 0x14, 0x2cdb); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3003); + MP_WritePhyUshort(sc, 0x14, 0x1d08); + MP_WritePhyUshort(sc, 0x14, 0x2d12); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x60be); + MP_WritePhyUshort(sc, 0x14, 0xe060); + MP_WritePhyUshort(sc, 0x14, 0x0920); + MP_WritePhyUshort(sc, 0x14, 0x1cdd); + MP_WritePhyUshort(sc, 0x14, 0x2c90); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x3063); + MP_WritePhyUshort(sc, 0x14, 0x19b0); + MP_WritePhyUshort(sc, 0x14, 0x28d5); + MP_WritePhyUshort(sc, 0x14, 0x1cdd); + MP_WritePhyUshort(sc, 0x14, 0x2a25); + MP_WritePhyUshort(sc, 0x14, 0xa802); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0x843f); + MP_WritePhyUshort(sc, 0x14, 0x81ff); + MP_WritePhyUshort(sc, 0x14, 0x8208); + MP_WritePhyUshort(sc, 0x14, 0xa201); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x30a0); + MP_WritePhyUshort(sc, 0x14, 0x0d23); + MP_WritePhyUshort(sc, 0x14, 0x30a0); + MP_WritePhyUshort(sc, 0x14, 0x3d1a); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f4c); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0xe003); + MP_WritePhyUshort(sc, 0x14, 0x0202); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6090); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0xa20c); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6091); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0x820e); + MP_WritePhyUshort(sc, 0x14, 0xa3e0); + MP_WritePhyUshort(sc, 0x14, 0xa520); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x609d); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0x8520); + MP_WritePhyUshort(sc, 0x14, 0x6703); + MP_WritePhyUshort(sc, 0x14, 0x2d3b); + MP_WritePhyUshort(sc, 0x14, 0xa13e); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x6046); + MP_WritePhyUshort(sc, 0x14, 0x2d14); + MP_WritePhyUshort(sc, 0x14, 0xa43f); + MP_WritePhyUshort(sc, 0x14, 0xa101); + MP_WritePhyUshort(sc, 0x14, 0xc020); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x3121); + MP_WritePhyUshort(sc, 0x14, 0x0d4c); + MP_WritePhyUshort(sc, 0x14, 0x30c0); + MP_WritePhyUshort(sc, 0x14, 0x3d14); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f4c); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0xa540); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4001); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0501); + MP_WritePhyUshort(sc, 0x14, 0x1db3); + MP_WritePhyUshort(sc, 0x14, 0xc1c4); + MP_WritePhyUshort(sc, 0x14, 0xa268); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0x8420); + MP_WritePhyUshort(sc, 0x14, 0xe00f); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x1db3); + MP_WritePhyUshort(sc, 0x14, 0xc002); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x8208); + MP_WritePhyUshort(sc, 0x14, 0x8410); + MP_WritePhyUshort(sc, 0x14, 0xa121); + MP_WritePhyUshort(sc, 0x14, 0xc002); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x8120); + MP_WritePhyUshort(sc, 0x14, 0x8180); + MP_WritePhyUshort(sc, 0x14, 0x1d9e); + MP_WritePhyUshort(sc, 0x14, 0xa180); + MP_WritePhyUshort(sc, 0x14, 0xa13a); + MP_WritePhyUshort(sc, 0x14, 0x8240); + MP_WritePhyUshort(sc, 0x14, 0xa430); + MP_WritePhyUshort(sc, 0x14, 0xc010); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x30e1); + MP_WritePhyUshort(sc, 0x14, 0x0b24); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f8c); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0xa480); + MP_WritePhyUshort(sc, 0x14, 0xa230); + MP_WritePhyUshort(sc, 0x14, 0xa303); + MP_WritePhyUshort(sc, 0x14, 0xc001); + MP_WritePhyUshort(sc, 0x14, 0xd70c); + MP_WritePhyUshort(sc, 0x14, 0x4124); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x6120); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3128); + MP_WritePhyUshort(sc, 0x14, 0x3d7d); + MP_WritePhyUshort(sc, 0x14, 0x2d77); + MP_WritePhyUshort(sc, 0x14, 0xa801); + MP_WritePhyUshort(sc, 0x14, 0x2d73); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0xe018); + MP_WritePhyUshort(sc, 0x14, 0x0208); + MP_WritePhyUshort(sc, 0x14, 0xa1f8); + MP_WritePhyUshort(sc, 0x14, 0x8480); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x6046); + MP_WritePhyUshort(sc, 0x14, 0x2d14); + MP_WritePhyUshort(sc, 0x14, 0xa43f); + MP_WritePhyUshort(sc, 0x14, 0xa105); + MP_WritePhyUshort(sc, 0x14, 0x8228); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x81bc); + MP_WritePhyUshort(sc, 0x14, 0xa220); + MP_WritePhyUshort(sc, 0x14, 0x1d9e); + MP_WritePhyUshort(sc, 0x14, 0x8220); + MP_WritePhyUshort(sc, 0x14, 0xa1bc); + MP_WritePhyUshort(sc, 0x14, 0xc040); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x30e1); + MP_WritePhyUshort(sc, 0x14, 0x0b24); + MP_WritePhyUshort(sc, 0x14, 0x30e1); + MP_WritePhyUshort(sc, 0x14, 0x3d14); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7f4c); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0xa802); + MP_WritePhyUshort(sc, 0x14, 0xd70c); + MP_WritePhyUshort(sc, 0x14, 0x4244); + MP_WritePhyUshort(sc, 0x14, 0xa301); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3128); + MP_WritePhyUshort(sc, 0x14, 0x3dac); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x5f80); + MP_WritePhyUshort(sc, 0x14, 0xd711); + MP_WritePhyUshort(sc, 0x14, 0x3109); + MP_WritePhyUshort(sc, 0x14, 0x3dae); + MP_WritePhyUshort(sc, 0x14, 0x2db2); + MP_WritePhyUshort(sc, 0x14, 0xa801); + MP_WritePhyUshort(sc, 0x14, 0x2da1); + MP_WritePhyUshort(sc, 0x14, 0xa802); + MP_WritePhyUshort(sc, 0x14, 0xc004); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x4000); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xa510); + MP_WritePhyUshort(sc, 0x14, 0xd710); + MP_WritePhyUshort(sc, 0x14, 0x609a); + MP_WritePhyUshort(sc, 0x14, 0xd71e); + MP_WritePhyUshort(sc, 0x14, 0x7fac); + MP_WritePhyUshort(sc, 0x14, 0x2b1e); + MP_WritePhyUshort(sc, 0x14, 0x8510); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x13, 0xa01a); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x13, 0xa006); + MP_WritePhyUshort(sc, 0x14, 0x0b3e); + MP_WritePhyUshort(sc, 0x13, 0xa004); + MP_WritePhyUshort(sc, 0x14, 0x0828); + MP_WritePhyUshort(sc, 0x13, 0xa002); + MP_WritePhyUshort(sc, 0x14, 0x06dd); + MP_WritePhyUshort(sc, 0x13, 0xa000); + MP_WritePhyUshort(sc, 0x14, 0xf815); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x0010); + + + MP_WritePhyUshort(sc,0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x83b0); + MP_WritePhyUshort(sc, 0x14, 0xaf83); + MP_WritePhyUshort(sc, 0x14, 0xbcaf); + MP_WritePhyUshort(sc, 0x14, 0x83c8); + MP_WritePhyUshort(sc, 0x14, 0xaf83); + MP_WritePhyUshort(sc, 0x14, 0xddaf); + MP_WritePhyUshort(sc, 0x14, 0x83e0); + MP_WritePhyUshort(sc, 0x14, 0x0204); + MP_WritePhyUshort(sc, 0x14, 0xa102); + MP_WritePhyUshort(sc, 0x14, 0x09b4); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0x62af); + MP_WritePhyUshort(sc, 0x14, 0x02ec); + MP_WritePhyUshort(sc, 0x14, 0xad20); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x867d); + MP_WritePhyUshort(sc, 0x14, 0xad21); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x85ca); + MP_WritePhyUshort(sc, 0x14, 0xad22); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x1bce); + MP_WritePhyUshort(sc, 0x14, 0xaf18); + MP_WritePhyUshort(sc, 0x14, 0x11af); + MP_WritePhyUshort(sc, 0x14, 0x1811); + MP_WritePhyUshort(sc, 0x14, 0x0106); + MP_WritePhyUshort(sc, 0x14, 0xe081); + MP_WritePhyUshort(sc, 0x14, 0x48af); + MP_WritePhyUshort(sc, 0x14, 0x3b1f); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69ee); + MP_WritePhyUshort(sc, 0x14, 0x8010); + MP_WritePhyUshort(sc, 0x14, 0xf7d1); + MP_WritePhyUshort(sc, 0x14, 0x04bf); + MP_WritePhyUshort(sc, 0x14, 0x8776); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x0a02); + MP_WritePhyUshort(sc, 0x14, 0x8704); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x4fd7); + MP_WritePhyUshort(sc, 0x14, 0xb822); + MP_WritePhyUshort(sc, 0x14, 0xd00c); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x03ee); + MP_WritePhyUshort(sc, 0x14, 0x80cd); + MP_WritePhyUshort(sc, 0x14, 0xa0ee); + MP_WritePhyUshort(sc, 0x14, 0x80ce); + MP_WritePhyUshort(sc, 0x14, 0x8bee); + MP_WritePhyUshort(sc, 0x14, 0x80d1); + MP_WritePhyUshort(sc, 0x14, 0xf5ee); + MP_WritePhyUshort(sc, 0x14, 0x80d2); + MP_WritePhyUshort(sc, 0x14, 0xa9ee); + MP_WritePhyUshort(sc, 0x14, 0x80d3); + MP_WritePhyUshort(sc, 0x14, 0x0aee); + MP_WritePhyUshort(sc, 0x14, 0x80f0); + MP_WritePhyUshort(sc, 0x14, 0x10ee); + MP_WritePhyUshort(sc, 0x14, 0x80f3); + MP_WritePhyUshort(sc, 0x14, 0x8fee); + MP_WritePhyUshort(sc, 0x14, 0x8101); + MP_WritePhyUshort(sc, 0x14, 0x1eee); + MP_WritePhyUshort(sc, 0x14, 0x810b); + MP_WritePhyUshort(sc, 0x14, 0x4aee); + MP_WritePhyUshort(sc, 0x14, 0x810c); + MP_WritePhyUshort(sc, 0x14, 0x7cee); + MP_WritePhyUshort(sc, 0x14, 0x8112); + MP_WritePhyUshort(sc, 0x14, 0x7fd1); + MP_WritePhyUshort(sc, 0x14, 0x0002); + MP_WritePhyUshort(sc, 0x14, 0x10e3); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x8892); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x8922); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x9a80); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x9b22); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0x9ca7); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xa010); + MP_WritePhyUshort(sc, 0x14, 0xee80); + MP_WritePhyUshort(sc, 0x14, 0xa5a7); + MP_WritePhyUshort(sc, 0x14, 0xd200); + MP_WritePhyUshort(sc, 0x14, 0x020e); + MP_WritePhyUshort(sc, 0x14, 0x4b02); + MP_WritePhyUshort(sc, 0x14, 0x85c1); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0x0284); + MP_WritePhyUshort(sc, 0x14, 0x7b02); + MP_WritePhyUshort(sc, 0x14, 0x84b4); + MP_WritePhyUshort(sc, 0x14, 0x020c); + MP_WritePhyUshort(sc, 0x14, 0x9202); + MP_WritePhyUshort(sc, 0x14, 0x0cab); + MP_WritePhyUshort(sc, 0x14, 0x020c); + MP_WritePhyUshort(sc, 0x14, 0xd602); + MP_WritePhyUshort(sc, 0x14, 0x0cef); + MP_WritePhyUshort(sc, 0x14, 0x020d); + MP_WritePhyUshort(sc, 0x14, 0x1a02); + MP_WritePhyUshort(sc, 0x14, 0x0c24); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e1); + MP_WritePhyUshort(sc, 0x14, 0x8234); + MP_WritePhyUshort(sc, 0x14, 0xac29); + MP_WritePhyUshort(sc, 0x14, 0x1ae0); + MP_WritePhyUshort(sc, 0x14, 0x8229); + MP_WritePhyUshort(sc, 0x14, 0xac21); + MP_WritePhyUshort(sc, 0x14, 0x02ae); + MP_WritePhyUshort(sc, 0x14, 0x2202); + MP_WritePhyUshort(sc, 0x14, 0x1085); + MP_WritePhyUshort(sc, 0x14, 0xf621); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x29d1); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x4364); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x0aae); + MP_WritePhyUshort(sc, 0x14, 0x1002); + MP_WritePhyUshort(sc, 0x14, 0x127a); + MP_WritePhyUshort(sc, 0x14, 0xf629); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x34e0); + MP_WritePhyUshort(sc, 0x14, 0x8229); + MP_WritePhyUshort(sc, 0x14, 0xf621); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x29ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8e1); + MP_WritePhyUshort(sc, 0x14, 0x8234); + MP_WritePhyUshort(sc, 0x14, 0xac2a); + MP_WritePhyUshort(sc, 0x14, 0x18e0); + MP_WritePhyUshort(sc, 0x14, 0x8229); + MP_WritePhyUshort(sc, 0x14, 0xac22); + MP_WritePhyUshort(sc, 0x14, 0x02ae); + MP_WritePhyUshort(sc, 0x14, 0x2602); + MP_WritePhyUshort(sc, 0x14, 0x84f9); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0x66d1); + MP_WritePhyUshort(sc, 0x14, 0x01bf); + MP_WritePhyUshort(sc, 0x14, 0x4367); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x0aae); + MP_WritePhyUshort(sc, 0x14, 0x0e02); + MP_WritePhyUshort(sc, 0x14, 0x84eb); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0xaae1); + MP_WritePhyUshort(sc, 0x14, 0x8234); + MP_WritePhyUshort(sc, 0x14, 0xf62a); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x34e0); + MP_WritePhyUshort(sc, 0x14, 0x8229); + MP_WritePhyUshort(sc, 0x14, 0xf622); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x29fc); + MP_WritePhyUshort(sc, 0x14, 0x04f9); + MP_WritePhyUshort(sc, 0x14, 0xe280); + MP_WritePhyUshort(sc, 0x14, 0x11ad); + MP_WritePhyUshort(sc, 0x14, 0x3105); + MP_WritePhyUshort(sc, 0x14, 0xd200); + MP_WritePhyUshort(sc, 0x14, 0x020e); + MP_WritePhyUshort(sc, 0x14, 0x4bfd); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xf9fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x11ad); + MP_WritePhyUshort(sc, 0x14, 0x215c); + MP_WritePhyUshort(sc, 0x14, 0xbf42); + MP_WritePhyUshort(sc, 0x14, 0x5002); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x1bbf); + MP_WritePhyUshort(sc, 0x14, 0x4253); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x48ac); + MP_WritePhyUshort(sc, 0x14, 0x2812); + MP_WritePhyUshort(sc, 0x14, 0xbf42); + MP_WritePhyUshort(sc, 0x14, 0x5902); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0xac28); + MP_WritePhyUshort(sc, 0x14, 0x04d3); + MP_WritePhyUshort(sc, 0x14, 0x00ae); + MP_WritePhyUshort(sc, 0x14, 0x07d3); + MP_WritePhyUshort(sc, 0x14, 0x06af); + MP_WritePhyUshort(sc, 0x14, 0x8557); + MP_WritePhyUshort(sc, 0x14, 0xd303); + MP_WritePhyUshort(sc, 0x14, 0xe080); + MP_WritePhyUshort(sc, 0x14, 0x11ad); + MP_WritePhyUshort(sc, 0x14, 0x2625); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0xeb02); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0xe280); + MP_WritePhyUshort(sc, 0x14, 0x730d); + MP_WritePhyUshort(sc, 0x14, 0x21f6); + MP_WritePhyUshort(sc, 0x14, 0x370d); + MP_WritePhyUshort(sc, 0x14, 0x11f6); + MP_WritePhyUshort(sc, 0x14, 0x2f1b); + MP_WritePhyUshort(sc, 0x14, 0x21aa); + MP_WritePhyUshort(sc, 0x14, 0x02ae); + MP_WritePhyUshort(sc, 0x14, 0x10e2); + MP_WritePhyUshort(sc, 0x14, 0x8074); + MP_WritePhyUshort(sc, 0x14, 0x0d21); + MP_WritePhyUshort(sc, 0x14, 0xf637); + MP_WritePhyUshort(sc, 0x14, 0x1b21); + MP_WritePhyUshort(sc, 0x14, 0xaa03); + MP_WritePhyUshort(sc, 0x14, 0x13ae); + MP_WritePhyUshort(sc, 0x14, 0x022b); + MP_WritePhyUshort(sc, 0x14, 0x0202); + MP_WritePhyUshort(sc, 0x14, 0x0e36); + MP_WritePhyUshort(sc, 0x14, 0x020e); + MP_WritePhyUshort(sc, 0x14, 0x4b02); + MP_WritePhyUshort(sc, 0x14, 0x0f91); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x8012); + MP_WritePhyUshort(sc, 0x14, 0xad27); + MP_WritePhyUshort(sc, 0x14, 0x33bf); + MP_WritePhyUshort(sc, 0x14, 0x4250); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x48ac); + MP_WritePhyUshort(sc, 0x14, 0x2809); + MP_WritePhyUshort(sc, 0x14, 0xbf42); + MP_WritePhyUshort(sc, 0x14, 0x5302); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0xad28); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x43eb); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x48e3); + MP_WritePhyUshort(sc, 0x14, 0x87ff); + MP_WritePhyUshort(sc, 0x14, 0xd200); + MP_WritePhyUshort(sc, 0x14, 0x1b45); + MP_WritePhyUshort(sc, 0x14, 0xac27); + MP_WritePhyUshort(sc, 0x14, 0x11e1); + MP_WritePhyUshort(sc, 0x14, 0x87fe); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6702); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0x0d11); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6a02); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefd); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xd100); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6702); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x6a02); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefc); + MP_WritePhyUshort(sc, 0x14, 0x04ee); + MP_WritePhyUshort(sc, 0x14, 0x87ff); + MP_WritePhyUshort(sc, 0x14, 0x46ee); + MP_WritePhyUshort(sc, 0x14, 0x87fe); + MP_WritePhyUshort(sc, 0x14, 0x0104); + MP_WritePhyUshort(sc, 0x14, 0xf8fa); + MP_WritePhyUshort(sc, 0x14, 0xef69); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x46a0); + MP_WritePhyUshort(sc, 0x14, 0x0005); + MP_WritePhyUshort(sc, 0x14, 0x0285); + MP_WritePhyUshort(sc, 0x14, 0xecae); + MP_WritePhyUshort(sc, 0x14, 0x0ea0); + MP_WritePhyUshort(sc, 0x14, 0x0105); + MP_WritePhyUshort(sc, 0x14, 0x021a); + MP_WritePhyUshort(sc, 0x14, 0x68ae); + MP_WritePhyUshort(sc, 0x14, 0x06a0); + MP_WritePhyUshort(sc, 0x14, 0x0203); + MP_WritePhyUshort(sc, 0x14, 0x021a); + MP_WritePhyUshort(sc, 0x14, 0xf4ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x822e); + MP_WritePhyUshort(sc, 0x14, 0xf621); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x2ee0); + MP_WritePhyUshort(sc, 0x14, 0x8010); + MP_WritePhyUshort(sc, 0x14, 0xac22); + MP_WritePhyUshort(sc, 0x14, 0x02ae); + MP_WritePhyUshort(sc, 0x14, 0x76e0); + MP_WritePhyUshort(sc, 0x14, 0x822c); + MP_WritePhyUshort(sc, 0x14, 0xf721); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x2cbf); + MP_WritePhyUshort(sc, 0x14, 0x41a5); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x48ef); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x41a8); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x480c); + MP_WritePhyUshort(sc, 0x14, 0x111e); + MP_WritePhyUshort(sc, 0x14, 0x21bf); + MP_WritePhyUshort(sc, 0x14, 0x41ab); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x480c); + MP_WritePhyUshort(sc, 0x14, 0x121e); + MP_WritePhyUshort(sc, 0x14, 0x21e6); + MP_WritePhyUshort(sc, 0x14, 0x8248); + MP_WritePhyUshort(sc, 0x14, 0xa200); + MP_WritePhyUshort(sc, 0x14, 0x0ae1); + MP_WritePhyUshort(sc, 0x14, 0x822c); + MP_WritePhyUshort(sc, 0x14, 0xf629); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x2cae); + MP_WritePhyUshort(sc, 0x14, 0x42e0); + MP_WritePhyUshort(sc, 0x14, 0x8249); + MP_WritePhyUshort(sc, 0x14, 0xf721); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x4902); + MP_WritePhyUshort(sc, 0x14, 0x4520); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0xb702); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0xef21); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0xae02); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0x0c12); + MP_WritePhyUshort(sc, 0x14, 0x1e21); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0xb102); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0x0c13); + MP_WritePhyUshort(sc, 0x14, 0x1e21); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0xba02); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0x0c14); + MP_WritePhyUshort(sc, 0x14, 0x1e21); + MP_WritePhyUshort(sc, 0x14, 0xbf43); + MP_WritePhyUshort(sc, 0x14, 0x4602); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0x0c16); + MP_WritePhyUshort(sc, 0x14, 0x1e21); + MP_WritePhyUshort(sc, 0x14, 0xe682); + MP_WritePhyUshort(sc, 0x14, 0x47ee); + MP_WritePhyUshort(sc, 0x14, 0x8246); + MP_WritePhyUshort(sc, 0x14, 0x01ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x824b); + MP_WritePhyUshort(sc, 0x14, 0xa000); + MP_WritePhyUshort(sc, 0x14, 0x0502); + MP_WritePhyUshort(sc, 0x14, 0x8697); + MP_WritePhyUshort(sc, 0x14, 0xae06); + MP_WritePhyUshort(sc, 0x14, 0xa001); + MP_WritePhyUshort(sc, 0x14, 0x0302); + MP_WritePhyUshort(sc, 0x14, 0x1937); + MP_WritePhyUshort(sc, 0x14, 0xef96); + MP_WritePhyUshort(sc, 0x14, 0xfefc); + MP_WritePhyUshort(sc, 0x14, 0x04f8); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69e0); + MP_WritePhyUshort(sc, 0x14, 0x822e); + MP_WritePhyUshort(sc, 0x14, 0xf620); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x2ee0); + MP_WritePhyUshort(sc, 0x14, 0x8010); + MP_WritePhyUshort(sc, 0x14, 0xac21); + MP_WritePhyUshort(sc, 0x14, 0x02ae); + MP_WritePhyUshort(sc, 0x14, 0x54e0); + MP_WritePhyUshort(sc, 0x14, 0x822c); + MP_WritePhyUshort(sc, 0x14, 0xf720); + MP_WritePhyUshort(sc, 0x14, 0xe482); + MP_WritePhyUshort(sc, 0x14, 0x2cbf); + MP_WritePhyUshort(sc, 0x14, 0x4175); + MP_WritePhyUshort(sc, 0x14, 0x0241); + MP_WritePhyUshort(sc, 0x14, 0x48ac); + MP_WritePhyUshort(sc, 0x14, 0x2822); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0x9f02); + MP_WritePhyUshort(sc, 0x14, 0x4148); + MP_WritePhyUshort(sc, 0x14, 0xe582); + MP_WritePhyUshort(sc, 0x14, 0x4cac); + MP_WritePhyUshort(sc, 0x14, 0x2820); + MP_WritePhyUshort(sc, 0x14, 0xd103); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0x9902); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0xee82); + MP_WritePhyUshort(sc, 0x14, 0x4b00); + MP_WritePhyUshort(sc, 0x14, 0xe182); + MP_WritePhyUshort(sc, 0x14, 0x2cf6); + MP_WritePhyUshort(sc, 0x14, 0x28e5); + MP_WritePhyUshort(sc, 0x14, 0x822c); + MP_WritePhyUshort(sc, 0x14, 0xae21); + MP_WritePhyUshort(sc, 0x14, 0xd104); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0x9902); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0xae08); + MP_WritePhyUshort(sc, 0x14, 0xd105); + MP_WritePhyUshort(sc, 0x14, 0xbf41); + MP_WritePhyUshort(sc, 0x14, 0x9902); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0xe082); + MP_WritePhyUshort(sc, 0x14, 0x49f7); + MP_WritePhyUshort(sc, 0x14, 0x20e4); + MP_WritePhyUshort(sc, 0x14, 0x8249); + MP_WritePhyUshort(sc, 0x14, 0x0245); + MP_WritePhyUshort(sc, 0x14, 0x20ee); + MP_WritePhyUshort(sc, 0x14, 0x824b); + MP_WritePhyUshort(sc, 0x14, 0x01ef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xfc04); + MP_WritePhyUshort(sc, 0x14, 0xf8f9); + MP_WritePhyUshort(sc, 0x14, 0xface); + MP_WritePhyUshort(sc, 0x14, 0xfaef); + MP_WritePhyUshort(sc, 0x14, 0x69fb); + MP_WritePhyUshort(sc, 0x14, 0xbf87); + MP_WritePhyUshort(sc, 0x14, 0x2fd7); + MP_WritePhyUshort(sc, 0x14, 0x0020); + MP_WritePhyUshort(sc, 0x14, 0xd819); + MP_WritePhyUshort(sc, 0x14, 0xd919); + MP_WritePhyUshort(sc, 0x14, 0xda19); + MP_WritePhyUshort(sc, 0x14, 0xdb19); + MP_WritePhyUshort(sc, 0x14, 0x07ef); + MP_WritePhyUshort(sc, 0x14, 0x9502); + MP_WritePhyUshort(sc, 0x14, 0x410a); + MP_WritePhyUshort(sc, 0x14, 0x073f); + MP_WritePhyUshort(sc, 0x14, 0x0004); + MP_WritePhyUshort(sc, 0x14, 0x9fec); + MP_WritePhyUshort(sc, 0x14, 0xffef); + MP_WritePhyUshort(sc, 0x14, 0x96fe); + MP_WritePhyUshort(sc, 0x14, 0xc6fe); + MP_WritePhyUshort(sc, 0x14, 0xfdfc); + MP_WritePhyUshort(sc, 0x14, 0x0400); + MP_WritePhyUshort(sc, 0x14, 0x0144); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0x0343); + MP_WritePhyUshort(sc, 0x14, 0xee00); + MP_WritePhyUshort(sc, 0x14, 0x0087); + MP_WritePhyUshort(sc, 0x14, 0x5b00); + MP_WritePhyUshort(sc, 0x14, 0x0141); + MP_WritePhyUshort(sc, 0x14, 0xe100); + MP_WritePhyUshort(sc, 0x14, 0x0387); + MP_WritePhyUshort(sc, 0x14, 0x5e00); + MP_WritePhyUshort(sc, 0x14, 0x0987); + MP_WritePhyUshort(sc, 0x14, 0x6100); + MP_WritePhyUshort(sc, 0x14, 0x0987); + MP_WritePhyUshort(sc, 0x14, 0x6400); + MP_WritePhyUshort(sc, 0x14, 0x0087); + MP_WritePhyUshort(sc, 0x14, 0x6da4); + MP_WritePhyUshort(sc, 0x14, 0x00b8); + MP_WritePhyUshort(sc, 0x14, 0x20c4); + MP_WritePhyUshort(sc, 0x14, 0x1600); + MP_WritePhyUshort(sc, 0x14, 0x000f); + MP_WritePhyUshort(sc, 0x14, 0xf800); + MP_WritePhyUshort(sc, 0x14, 0x7000); + MP_WritePhyUshort(sc, 0x14, 0xb82e); + MP_WritePhyUshort(sc, 0x14, 0x98a5); + MP_WritePhyUshort(sc, 0x14, 0x8ab6); + MP_WritePhyUshort(sc, 0x14, 0xa83e); + MP_WritePhyUshort(sc, 0x14, 0x50a8); + MP_WritePhyUshort(sc, 0x14, 0x3e33); + MP_WritePhyUshort(sc, 0x14, 0xbcc6); + MP_WritePhyUshort(sc, 0x14, 0x22bc); + MP_WritePhyUshort(sc, 0x14, 0xc6aa); + MP_WritePhyUshort(sc, 0x14, 0xa442); + MP_WritePhyUshort(sc, 0x14, 0xffc4); + MP_WritePhyUshort(sc, 0x14, 0x0800); + MP_WritePhyUshort(sc, 0x14, 0xc416); + MP_WritePhyUshort(sc, 0x14, 0xa8bc); + MP_WritePhyUshort(sc, 0x14, 0xc000); + MP_WritePhyUshort(sc, 0x13, 0xb818); + MP_WritePhyUshort(sc, 0x14, 0x02e3); + MP_WritePhyUshort(sc, 0x13, 0xb81a); + MP_WritePhyUshort(sc, 0x14, 0x17ff); + MP_WritePhyUshort(sc, 0x13, 0xb81e); + MP_WritePhyUshort(sc, 0x14, 0x3b1c); + MP_WritePhyUshort(sc, 0x13, 0xb820); + MP_WritePhyUshort(sc, 0x14, 0x021b); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + + MP_WritePhyUshort(sc,0x1F, 0x0A43); + MP_WritePhyUshort(sc,0x13, 0x0000); + MP_WritePhyUshort(sc,0x14, 0x0000); + MP_WritePhyUshort(sc,0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc,0x17, PhyRegValue); + MP_WritePhyUshort(sc,0x1f, 0x0A43); + MP_WritePhyUshort(sc,0x13, 0x8146); + MP_WritePhyUshort(sc,0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); +} + +static void re_set_phy_mcu_8168ep_2(struct re_softc *sc) +{ + u_int16_t PhyRegValue; + + re_set_phy_mcu_patch_request(sc); + + MP_WritePhyUshort(sc,0x1f, 0x0A43); + MP_WritePhyUshort(sc,0x13, 0x8146); + MP_WritePhyUshort(sc,0x14, 0x8700); + MP_WritePhyUshort(sc,0x13, 0xB82E); + MP_WritePhyUshort(sc,0x14, 0x0001); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + + MP_WritePhyUshort(sc, 0x13, 0x83DD); + MP_WritePhyUshort(sc, 0x14, 0xAF83); + MP_WritePhyUshort(sc, 0x14, 0xE9AF); + MP_WritePhyUshort(sc, 0x14, 0x83EE); + MP_WritePhyUshort(sc, 0x14, 0xAF83); + MP_WritePhyUshort(sc, 0x14, 0xF1A1); + MP_WritePhyUshort(sc, 0x14, 0x83F4); + MP_WritePhyUshort(sc, 0x14, 0xD149); + MP_WritePhyUshort(sc, 0x14, 0xAF06); + MP_WritePhyUshort(sc, 0x14, 0x47AF); + MP_WritePhyUshort(sc, 0x14, 0x0000); + MP_WritePhyUshort(sc, 0x14, 0xAF00); + MP_WritePhyUshort(sc, 0x14, 0x00AF); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + MP_WritePhyUshort(sc, 0x13, 0xB818); + MP_WritePhyUshort(sc, 0x14, 0x0645); + + MP_WritePhyUshort(sc, 0x13, 0xB81A); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + MP_WritePhyUshort(sc, 0x13, 0xB81C); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + MP_WritePhyUshort(sc, 0x13, 0xB81E); + MP_WritePhyUshort(sc, 0x14, 0x0000); + + MP_WritePhyUshort(sc, 0x13, 0xB832); + MP_WritePhyUshort(sc, 0x14, 0x0001); + + MP_WritePhyUshort(sc,0x1F, 0x0A43); + MP_WritePhyUshort(sc,0x13, 0x0000); + MP_WritePhyUshort(sc,0x14, 0x0000); + MP_WritePhyUshort(sc,0x1f, 0x0B82); + PhyRegValue = MP_ReadPhyUshort(sc, 0x17); + PhyRegValue &= ~(BIT_0); + MP_WritePhyUshort(sc,0x17, PhyRegValue); + MP_WritePhyUshort(sc,0x1f, 0x0A43); + MP_WritePhyUshort(sc,0x13, 0x8146); + MP_WritePhyUshort(sc,0x14, 0x0000); + + re_clear_phy_mcu_patch_request(sc); +} + +static void +re_real_set_phy_mcu_8125a_1(struct re_softc *sc) +{ + re_acquire_phy_mcu_patch_key_lock(sc); + + + SetEthPhyOcpBit(sc, 0xB820, BIT_7); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA016); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8013); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8021); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x802f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x803d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8042); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8051); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8051); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa088); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a50); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8008); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd1a3); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x401a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd707); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40c2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60a6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f8b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a6c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8080); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd019); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd1a2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x401a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd707); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40c4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60a6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f8b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a84); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8970); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c07); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0901); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcf09); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd705); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xceff); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf0a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1213); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8401); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8580); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1253); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd064); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd181); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4018); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc50f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd706); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2c59); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x804d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc60f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc605); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x10fd); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA026); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA024); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA022); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x10f4); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA020); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1252); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA006); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1206); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA004); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a78); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a60); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a4f); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA008); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3f00); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA016); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0010); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8066); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x807c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8089); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x808e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80b2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80c2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x62db); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x655c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd73e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60e9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x614a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x61ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0505); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0509); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x653c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd73e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60e9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x614a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x61ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0502); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0506); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x050a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd73e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60e9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x614a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x61ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0505); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0506); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x050c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd73e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60e9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x614a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x61ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0509); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x050a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x050c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0508); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0304); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd73e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60e9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x614a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x61ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0321); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0502); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0321); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0321); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0508); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0321); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0346); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8208); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x609d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa50f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x001a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x001a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x607d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00ab); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60fd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa50f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaa0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x017b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a05); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x017b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60fd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa50f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaa0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x01e0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a05); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x01e0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60fd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa50f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaa0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0231); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0503); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a05); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0231); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA08E); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA08C); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0221); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA08A); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x01ce); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA088); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0169); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA086); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00a6); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA084); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x000d); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA082); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0308); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA080); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x029f); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA090); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x007f); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA016); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0020); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8017); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8029); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8054); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x805a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8064); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80a7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9430); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9480); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb408); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd120); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd057); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x064b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcb80); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9906); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0567); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcb94); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x82a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x800a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8406); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8dff); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa840); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0773); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcb91); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4063); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd139); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd140); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd040); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07dc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa110); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa2a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4045); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa180); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x405d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa720); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0742); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07ec); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f74); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0742); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7fb6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x82a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07dc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x064b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07c0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5fa7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0481); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x94bc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x870c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa00a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa280); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8220); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x078e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcb92); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa840); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4063); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd140); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd150); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd040); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd703); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6121); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x61a2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6223); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf02f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d10); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf00f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d20); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf00a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d30); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf005); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d40); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa008); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4046); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x405d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa720); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0742); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07f7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f74); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0742); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7fb5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x800a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3ad4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0537); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8840); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x064b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8301); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x800a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x82a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa70c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9402); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x890c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8840); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x064b); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA10E); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0642); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA10C); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0686); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA10A); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0788); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA108); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x047b); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA106); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x065c); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA104); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0769); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA102); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0565); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA100); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x06f9); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA110); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00ff); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb87c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8530); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb87e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf85); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3caf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8593); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf85); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9caf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x85a5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5afb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe083); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfb0c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x020d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x021b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x10bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86d7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbe0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x83fc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1b10); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xda02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xdd02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5afb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe083); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfd0c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x020d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x021b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x10bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86dd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86e0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbe0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x83fe); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1b10); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf2f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbd02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2cac); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0286); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x65af); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x212b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x022c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86b6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf21); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cd1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x03bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8710); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x870d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8719); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8716); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x871f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x871c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8728); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8725); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8707); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbad); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x281c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd100); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1302); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2202); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2b02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae1a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd101); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1302); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2202); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2b02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd101); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3402); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3102); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3d02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3a02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4302); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4c02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4902); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd100); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2e02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4602); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf87); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4f02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ab7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf35); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7ff8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfaef); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x69bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86e3); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86fb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86e6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86fe); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86e9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86ec); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfbbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x025a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7bf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86ef); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0262); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7cbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86f2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0262); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7cbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86f5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0262); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7cbf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x86f8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0262); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7cef); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x96fe); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfc04); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf8fa); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xef69); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xef02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6273); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf202); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6273); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf502); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6273); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbf86); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf802); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6273); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xef96); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfefc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0420); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb540); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x53b5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4086); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb540); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb9b5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40c8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb03a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc8b0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbac8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb13a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc8b1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xba77); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbd26); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffbd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2677); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbd28); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffbd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2840); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbd26); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc8bd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2640); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbd28); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc8bd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x28bb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa430); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x98b0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1eba); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb01e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xdcb0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1e98); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb09e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbab0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9edc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb09e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x98b1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1eba); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb11e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xdcb1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1e98); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb19e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbab1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9edc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb19e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x11b0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1e22); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb01e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x33b0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1e11); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb09e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x22b0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9e33); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb09e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x11b1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1e22); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb11e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x33b1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1e11); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb19e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x22b1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9e33); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb19e); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb85e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2f71); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb860); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x20d9); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb862); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2109); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb864); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x34e7); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb878); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x000f); + + + ClearEthPhyOcpBit(sc, 0xB820, BIT_7); + + + re_release_phy_mcu_patch_key_lock(sc); +} + +static void +re_set_phy_mcu_8125a_1(struct re_softc *sc) +{ + re_set_phy_mcu_patch_request(sc); + + re_real_set_phy_mcu_8125a_1(sc); + + re_clear_phy_mcu_patch_request(sc); +} + +static void +re_real_set_phy_mcu_8125a_2(struct re_softc *sc) +{ + re_acquire_phy_mcu_patch_key_lock(sc); + + + SetEthPhyOcpBit(sc, 0xB820, BIT_7); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA016); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x808b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x808f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8093); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8097); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x809d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80a1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80aa); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x607b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf00e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x42da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf01e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x615b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1456); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14a4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14bc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f2e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf01c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1456); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14a4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14bc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f2e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf024); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1456); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14a4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14bc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f2e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf02c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1456); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14a4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x14bc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f2e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf034); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd719); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4118); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac11); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa410); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4779); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1444); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf034); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd719); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4118); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac22); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa420); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4559); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1444); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf023); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd719); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4118); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac44); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa440); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4339); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1444); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd719); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4118); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac88); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa480); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xce00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4119); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xac0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1444); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf001); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1456); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd718); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5fac); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc48f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x141b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd504); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x121a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd0b4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd1bb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0898); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd0b4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd1bb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a0e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd064); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd18a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0b7e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x401c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd501); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa804); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8804); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x053b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd500); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa301); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0648); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc520); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa201); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x252d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1646); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd708); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4006); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1646); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0308); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA026); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0307); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA024); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1645); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA022); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0647); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA020); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x053a); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA006); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0b7c); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA004); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0a0c); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0896); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x11a1); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA008); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xff00); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA016); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0010); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8015); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x801a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xad02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x02d7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00ed); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0509); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xc100); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x008f); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA08E); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA08C); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA08A); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA088); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA086); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA084); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA082); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x008d); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA080); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00eb); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA090); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0103); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA016); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0020); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA012); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8014); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8018); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8024); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8051); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8055); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8072); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x80dc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfffd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfffd); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8301); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x800a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x82a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa70c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x9402); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x890c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8840); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa380); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x066e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcb91); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4063); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd139); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd140); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd040); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa110); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa2a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4085); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa180); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8280); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x405d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa720); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0743); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07f0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5f74); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0743); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7fb6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x82a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0c0f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x066e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd158); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd04d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x03d4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x94bc); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x870c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8380); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd10d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd040); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07c4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5fb4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa190); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa00a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa280); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa404); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa220); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd130); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd040); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07c4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5fb4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xbb80); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd1c4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd074); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa301); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x604b); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa90c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0556); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xcb92); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4063); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd116); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd119); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd040); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd703); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x60a0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6241); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x63e2); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6583); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf054); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x611e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d10); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf02f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d50); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf02a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x611e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d20); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf021); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d60); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf01c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x611e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d30); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf013); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d70); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf00e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x611e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x40da); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d40); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf005); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d80); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x405d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa720); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd700); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x5ff4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa008); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd704); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x4046); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0743); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07fb); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd703); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7f6f); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7f4e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7f2d); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7f0c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x800a); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0cf0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0d00); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07e8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8010); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa740); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0743); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7fb5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd701); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3ad4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0556); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8610); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x066e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd1f5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xd049); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x1800); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x01ec); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA10E); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x01ea); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA10C); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x06a9); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA10A); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x078a); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA108); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x03d2); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA106); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x067f); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA104); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0665); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA102); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA100); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xA110); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00fc); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb87c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8530); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb87e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf85); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x3caf); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8545); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf85); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x45af); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8545); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xee82); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf900); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0103); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xaf03); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb7f8); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe0a6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00e1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa601); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xef01); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x58f0); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa080); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x37a1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8402); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae16); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa185); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x02ae); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x11a1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8702); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae0c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xa188); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x02ae); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x07a1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8902); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae02); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xae1c); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe0b4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x62e1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb463); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6901); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe4b4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x62e5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb463); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe0b4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x62e1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb463); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6901); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xe4b4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x62e5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xb463); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xfc04); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb85e); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x03b3); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb860); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb862); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb864); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xffff); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0xb878); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0001); + + + ClearEthPhyOcpBit(sc, 0xB820, BIT_7); + + + re_release_phy_mcu_patch_key_lock(sc); +} + +static void +re_set_phy_mcu_8125a_2(struct re_softc *sc) +{ + re_set_phy_mcu_patch_request(sc); + + re_real_set_phy_mcu_8125a_2(sc); + + re_clear_phy_mcu_patch_request(sc); +} + +static const u_int16_t phy_mcu_ram_code_8125b_1[] = { + 0xa436, 0x8024, 0xa438, 0x3700, 0xa436, 0xB82E, 0xa438, 0x0001, + 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, + 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, + 0xa438, 0x1800, 0xa438, 0x8025, 0xa438, 0x1800, 0xa438, 0x803a, + 0xa438, 0x1800, 0xa438, 0x8044, 0xa438, 0x1800, 0xa438, 0x8083, + 0xa438, 0x1800, 0xa438, 0x808d, 0xa438, 0x1800, 0xa438, 0x808d, + 0xa438, 0x1800, 0xa438, 0x808d, 0xa438, 0xd712, 0xa438, 0x4077, + 0xa438, 0xd71e, 0xa438, 0x4159, 0xa438, 0xd71e, 0xa438, 0x6099, + 0xa438, 0x7f44, 0xa438, 0x1800, 0xa438, 0x1a14, 0xa438, 0x9040, + 0xa438, 0x9201, 0xa438, 0x1800, 0xa438, 0x1b1a, 0xa438, 0xd71e, + 0xa438, 0x2425, 0xa438, 0x1a14, 0xa438, 0xd71f, 0xa438, 0x3ce5, + 0xa438, 0x1afb, 0xa438, 0x1800, 0xa438, 0x1b00, 0xa438, 0xd712, + 0xa438, 0x4077, 0xa438, 0xd71e, 0xa438, 0x4159, 0xa438, 0xd71e, + 0xa438, 0x60b9, 0xa438, 0x2421, 0xa438, 0x1c17, 0xa438, 0x1800, + 0xa438, 0x1a14, 0xa438, 0x9040, 0xa438, 0x1800, 0xa438, 0x1c2c, + 0xa438, 0xd71e, 0xa438, 0x2425, 0xa438, 0x1a14, 0xa438, 0xd71f, + 0xa438, 0x3ce5, 0xa438, 0x1c0f, 0xa438, 0x1800, 0xa438, 0x1c13, + 0xa438, 0xd702, 0xa438, 0xd501, 0xa438, 0x6072, 0xa438, 0x8401, + 0xa438, 0xf002, 0xa438, 0xa401, 0xa438, 0x1000, 0xa438, 0x146e, + 0xa438, 0x1800, 0xa438, 0x0b77, 0xa438, 0xd703, 0xa438, 0x665d, + 0xa438, 0x653e, 0xa438, 0x641f, 0xa438, 0xd700, 0xa438, 0x62c4, + 0xa438, 0x6185, 0xa438, 0x6066, 0xa438, 0x1800, 0xa438, 0x165a, + 0xa438, 0xc101, 0xa438, 0xcb00, 0xa438, 0x1000, 0xa438, 0x1945, + 0xa438, 0xd700, 0xa438, 0x7fa6, 0xa438, 0x1800, 0xa438, 0x807d, + 0xa438, 0xc102, 0xa438, 0xcb00, 0xa438, 0x1000, 0xa438, 0x1945, + 0xa438, 0xd700, 0xa438, 0x2569, 0xa438, 0x8058, 0xa438, 0x1800, + 0xa438, 0x807d, 0xa438, 0xc104, 0xa438, 0xcb00, 0xa438, 0x1000, + 0xa438, 0x1945, 0xa438, 0xd700, 0xa438, 0x7fa4, 0xa438, 0x1800, + 0xa438, 0x807d, 0xa438, 0xc120, 0xa438, 0xcb00, 0xa438, 0x1000, + 0xa438, 0x1945, 0xa438, 0xd703, 0xa438, 0x7fbf, 0xa438, 0x1800, + 0xa438, 0x807d, 0xa438, 0xc140, 0xa438, 0xcb00, 0xa438, 0x1000, + 0xa438, 0x1945, 0xa438, 0xd703, 0xa438, 0x7fbe, 0xa438, 0x1800, + 0xa438, 0x807d, 0xa438, 0xc180, 0xa438, 0xcb00, 0xa438, 0x1000, + 0xa438, 0x1945, 0xa438, 0xd703, 0xa438, 0x7fbd, 0xa438, 0xc100, + 0xa438, 0xcb00, 0xa438, 0xd708, 0xa438, 0x6018, 0xa438, 0x1800, + 0xa438, 0x165a, 0xa438, 0x1000, 0xa438, 0x14f6, 0xa438, 0xd014, + 0xa438, 0xd1e3, 0xa438, 0x1000, 0xa438, 0x1356, 0xa438, 0xd705, + 0xa438, 0x5fbe, 0xa438, 0x1800, 0xa438, 0x1559, 0xa436, 0xA026, + 0xa438, 0xffff, 0xa436, 0xA024, 0xa438, 0xffff, 0xa436, 0xA022, + 0xa438, 0xffff, 0xa436, 0xA020, 0xa438, 0x1557, 0xa436, 0xA006, + 0xa438, 0x1677, 0xa436, 0xA004, 0xa438, 0x0b75, 0xa436, 0xA002, + 0xa438, 0x1c17, 0xa436, 0xA000, 0xa438, 0x1b04, 0xa436, 0xA008, + 0xa438, 0x1f00, 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, + 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, + 0xa438, 0x1800, 0xa438, 0x817f, 0xa438, 0x1800, 0xa438, 0x82ab, + 0xa438, 0x1800, 0xa438, 0x83f8, 0xa438, 0x1800, 0xa438, 0x8444, + 0xa438, 0x1800, 0xa438, 0x8454, 0xa438, 0x1800, 0xa438, 0x8459, + 0xa438, 0x1800, 0xa438, 0x8465, 0xa438, 0xcb11, 0xa438, 0xa50c, + 0xa438, 0x8310, 0xa438, 0xd701, 0xa438, 0x4076, 0xa438, 0x0c03, + 0xa438, 0x0903, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, + 0xa438, 0x0d00, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d00, + 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0x1000, 0xa438, 0x0a4d, + 0xa438, 0xcb12, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x5f84, 0xa438, 0xd102, 0xa438, 0xd040, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd701, + 0xa438, 0x60f3, 0xa438, 0xd413, 0xa438, 0x1000, 0xa438, 0x0a37, + 0xa438, 0xd410, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xcb13, + 0xa438, 0xa108, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8108, + 0xa438, 0xa00a, 0xa438, 0xa910, 0xa438, 0xa780, 0xa438, 0xd14a, + 0xa438, 0xd048, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd701, + 0xa438, 0x6255, 0xa438, 0xd700, 0xa438, 0x5f74, 0xa438, 0x6326, + 0xa438, 0xd702, 0xa438, 0x5f07, 0xa438, 0x800a, 0xa438, 0xa004, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0x0c03, + 0xa438, 0x0902, 0xa438, 0xffe2, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x5fab, 0xa438, 0xba08, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8b, 0xa438, 0x9a08, + 0xa438, 0x800a, 0xa438, 0xd702, 0xa438, 0x6535, 0xa438, 0xd40d, + 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xcb14, 0xa438, 0xa004, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0xa00a, + 0xa438, 0xa780, 0xa438, 0xd14a, 0xa438, 0xd048, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x6206, + 0xa438, 0xd702, 0xa438, 0x5f47, 0xa438, 0x800a, 0xa438, 0xa004, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0x0c03, + 0xa438, 0x0902, 0xa438, 0x1800, 0xa438, 0x8064, 0xa438, 0x800a, + 0xa438, 0xd40e, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xb920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, + 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x7f8c, 0xa438, 0xd701, 0xa438, 0x6073, 0xa438, 0xd701, + 0xa438, 0x4216, 0xa438, 0xa004, 0xa438, 0x1000, 0xa438, 0x0a42, + 0xa438, 0x8004, 0xa438, 0xa001, 0xa438, 0x1000, 0xa438, 0x0a42, + 0xa438, 0x8001, 0xa438, 0xd120, 0xa438, 0xd040, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x8504, + 0xa438, 0xcb21, 0xa438, 0xa301, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd700, 0xa438, 0x5f9f, 0xa438, 0x8301, 0xa438, 0xd704, + 0xa438, 0x40e0, 0xa438, 0xd196, 0xa438, 0xd04d, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb22, + 0xa438, 0x1000, 0xa438, 0x0a6d, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xa640, 0xa438, 0x9503, 0xa438, 0x8910, 0xa438, 0x8720, + 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d01, + 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0x1000, + 0xa438, 0x0a7d, 0xa438, 0x0c1f, 0xa438, 0x0f14, 0xa438, 0xcb23, + 0xa438, 0x8fc0, 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xaf40, + 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0x0cc0, 0xa438, 0x0f80, + 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xafc0, 0xa438, 0x1000, + 0xa438, 0x0a25, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd701, + 0xa438, 0x5dee, 0xa438, 0xcb24, 0xa438, 0x8f1f, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd701, 0xa438, 0x7f6e, 0xa438, 0xa111, + 0xa438, 0xa215, 0xa438, 0xa401, 0xa438, 0x8404, 0xa438, 0xa720, + 0xa438, 0xcb25, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8640, + 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x0b43, 0xa438, 0x1000, + 0xa438, 0x0b86, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xb920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, + 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x7f8c, 0xa438, 0xcb26, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x5f82, 0xa438, 0x8111, 0xa438, 0x8205, + 0xa438, 0x8404, 0xa438, 0xcb27, 0xa438, 0xd404, 0xa438, 0x1000, + 0xa438, 0x0a37, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, + 0xa438, 0x0d02, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, + 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xa710, 0xa438, 0xa104, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8104, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0xa120, + 0xa438, 0xaa0f, 0xa438, 0x8110, 0xa438, 0xa284, 0xa438, 0xa404, + 0xa438, 0xa00a, 0xa438, 0xd193, 0xa438, 0xd046, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb28, + 0xa438, 0xa110, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fa8, 0xa438, 0x8110, 0xa438, 0x8284, 0xa438, 0xa404, + 0xa438, 0x800a, 0xa438, 0x8710, 0xa438, 0xb804, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f82, 0xa438, 0x9804, + 0xa438, 0xcb29, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x5f85, 0xa438, 0xa710, 0xa438, 0xb820, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f65, 0xa438, 0x9820, + 0xa438, 0xcb2a, 0xa438, 0xa190, 0xa438, 0xa284, 0xa438, 0xa404, + 0xa438, 0xa00a, 0xa438, 0xd13d, 0xa438, 0xd04a, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x8149, + 0xa438, 0xa220, 0xa438, 0xd1a0, 0xa438, 0xd040, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x8151, + 0xa438, 0xd702, 0xa438, 0x5f51, 0xa438, 0xcb2f, 0xa438, 0xa302, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd708, 0xa438, 0x5f63, + 0xa438, 0xd411, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0x8302, + 0xa438, 0xd409, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xb920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, + 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x7f8c, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x5fa3, 0xa438, 0x8190, 0xa438, 0x82a4, 0xa438, 0x8404, + 0xa438, 0x800a, 0xa438, 0xb808, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x7fa3, 0xa438, 0x9808, 0xa438, 0x1800, + 0xa438, 0x0433, 0xa438, 0xcb15, 0xa438, 0xa508, 0xa438, 0xd700, + 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0xf003, + 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0x1000, 0xa438, 0x0a7d, + 0xa438, 0x1000, 0xa438, 0x0a4d, 0xa438, 0xa301, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5f9f, 0xa438, 0x8301, + 0xa438, 0xd704, 0xa438, 0x40e0, 0xa438, 0xd115, 0xa438, 0xd04f, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0xd413, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xcb16, + 0xa438, 0x1000, 0xa438, 0x0a6d, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xa640, 0xa438, 0x9503, 0xa438, 0x8720, 0xa438, 0xd17a, + 0xa438, 0xd04c, 0xa438, 0x0c1f, 0xa438, 0x0f14, 0xa438, 0xcb17, + 0xa438, 0x8fc0, 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xaf40, + 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0x0cc0, 0xa438, 0x0f80, + 0xa438, 0x1000, 0xa438, 0x0a25, 0xa438, 0xafc0, 0xa438, 0x1000, + 0xa438, 0x0a25, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd701, + 0xa438, 0x61ce, 0xa438, 0xd700, 0xa438, 0x5db4, 0xa438, 0xcb18, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8640, 0xa438, 0x9503, + 0xa438, 0xa720, 0xa438, 0x1000, 0xa438, 0x0b43, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xffd6, 0xa438, 0x8f1f, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd701, 0xa438, 0x7f8e, 0xa438, 0xa131, + 0xa438, 0xaa0f, 0xa438, 0xa2d5, 0xa438, 0xa407, 0xa438, 0xa720, + 0xa438, 0x8310, 0xa438, 0xa308, 0xa438, 0x8308, 0xa438, 0xcb19, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x8640, 0xa438, 0x9503, + 0xa438, 0x1000, 0xa438, 0x0b43, 0xa438, 0x1000, 0xa438, 0x0b86, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xb920, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, 0xa438, 0x9920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8c, + 0xa438, 0xcb1a, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x5f82, 0xa438, 0x8111, 0xa438, 0x82c5, 0xa438, 0xa404, + 0xa438, 0x8402, 0xa438, 0xb804, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x7f82, 0xa438, 0x9804, 0xa438, 0xcb1b, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5f85, + 0xa438, 0xa710, 0xa438, 0xb820, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x7f65, 0xa438, 0x9820, 0xa438, 0xcb1c, + 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d02, + 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, 0xa438, 0x1000, + 0xa438, 0x0a7d, 0xa438, 0xa110, 0xa438, 0xa284, 0xa438, 0xa404, + 0xa438, 0x8402, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fa8, 0xa438, 0xcb1d, 0xa438, 0xa180, 0xa438, 0xa402, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa8, + 0xa438, 0xa220, 0xa438, 0xd1f5, 0xa438, 0xd049, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x8221, + 0xa438, 0xd702, 0xa438, 0x5f51, 0xa438, 0xb920, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, 0xa438, 0x9920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8c, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fa3, + 0xa438, 0xa504, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, + 0xa438, 0x0d00, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d00, + 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xa00a, 0xa438, 0x8190, + 0xa438, 0x82a4, 0xa438, 0x8402, 0xa438, 0xa404, 0xa438, 0xb808, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7fa3, + 0xa438, 0x9808, 0xa438, 0xcb2b, 0xa438, 0xcb2c, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5f84, 0xa438, 0xd14a, + 0xa438, 0xd048, 0xa438, 0xa780, 0xa438, 0xcb2d, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5f94, 0xa438, 0x6208, + 0xa438, 0xd702, 0xa438, 0x5f27, 0xa438, 0x800a, 0xa438, 0xa004, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, 0xa438, 0x0c03, + 0xa438, 0x0902, 0xa438, 0xa00a, 0xa438, 0xffe9, 0xa438, 0xcb2e, + 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d02, + 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, 0xa438, 0x1000, + 0xa438, 0x0a7d, 0xa438, 0xa190, 0xa438, 0xa284, 0xa438, 0xa406, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa8, + 0xa438, 0xa220, 0xa438, 0xd1a0, 0xa438, 0xd040, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x3444, 0xa438, 0x827d, + 0xa438, 0xd702, 0xa438, 0x5f51, 0xa438, 0xcb2f, 0xa438, 0xa302, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd708, 0xa438, 0x5f63, + 0xa438, 0xd411, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0x8302, + 0xa438, 0xd409, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0xb920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, + 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x7f8c, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x5fa3, 0xa438, 0x8190, 0xa438, 0x82a4, 0xa438, 0x8406, + 0xa438, 0x800a, 0xa438, 0xb808, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x7fa3, 0xa438, 0x9808, 0xa438, 0x1800, + 0xa438, 0x0433, 0xa438, 0xcb30, 0xa438, 0x8380, 0xa438, 0xcb31, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5f86, + 0xa438, 0x9308, 0xa438, 0xb204, 0xa438, 0xb301, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd701, 0xa438, 0x5fa2, 0xa438, 0xb302, + 0xa438, 0x9204, 0xa438, 0xcb32, 0xa438, 0xd408, 0xa438, 0x1000, + 0xa438, 0x0a37, 0xa438, 0xd141, 0xa438, 0xd043, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd704, + 0xa438, 0x4ccc, 0xa438, 0xd700, 0xa438, 0x4c81, 0xa438, 0xd702, + 0xa438, 0x609e, 0xa438, 0xd1e5, 0xa438, 0xd04d, 0xa438, 0xf003, + 0xa438, 0xd1e5, 0xa438, 0xd04d, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd700, 0xa438, 0x6083, + 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0xf003, 0xa438, 0x0c1f, + 0xa438, 0x0d01, 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0x8710, + 0xa438, 0xa108, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8108, + 0xa438, 0xa203, 0xa438, 0x8120, 0xa438, 0x8a0f, 0xa438, 0xa111, + 0xa438, 0x8204, 0xa438, 0xa140, 0xa438, 0x1000, 0xa438, 0x0a42, + 0xa438, 0x8140, 0xa438, 0xd17a, 0xa438, 0xd04b, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xa204, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa7, + 0xa438, 0xb920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x5fac, 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x7f8c, 0xa438, 0xd404, 0xa438, 0x1000, + 0xa438, 0x0a37, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, + 0xa438, 0x0d02, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, + 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xa710, 0xa438, 0x8101, + 0xa438, 0x8201, 0xa438, 0xa104, 0xa438, 0x1000, 0xa438, 0x0a42, + 0xa438, 0x8104, 0xa438, 0xa120, 0xa438, 0xaa0f, 0xa438, 0x8110, + 0xa438, 0xa284, 0xa438, 0xa404, 0xa438, 0xa00a, 0xa438, 0xd193, + 0xa438, 0xd047, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0xa110, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd700, 0xa438, 0x5fa8, 0xa438, 0xa180, 0xa438, 0xd13d, + 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0xf024, 0xa438, 0xa710, 0xa438, 0xa00a, + 0xa438, 0x8190, 0xa438, 0x8204, 0xa438, 0xa280, 0xa438, 0xa404, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fa7, + 0xa438, 0x8710, 0xa438, 0xb920, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x5fac, 0xa438, 0x9920, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f8c, 0xa438, 0x800a, + 0xa438, 0x8190, 0xa438, 0x8284, 0xa438, 0x8406, 0xa438, 0xd700, + 0xa438, 0x4121, 0xa438, 0xd701, 0xa438, 0x60f3, 0xa438, 0xd1e5, + 0xa438, 0xd04d, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0x8710, 0xa438, 0xa00a, 0xa438, 0x8190, + 0xa438, 0x8204, 0xa438, 0xa280, 0xa438, 0xa404, 0xa438, 0xb920, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x5fac, + 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, + 0xa438, 0x7f8c, 0xa438, 0xcb33, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd71f, 0xa438, 0x5f85, 0xa438, 0xa710, 0xa438, 0xb820, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd71f, 0xa438, 0x7f65, + 0xa438, 0x9820, 0xa438, 0xcb34, 0xa438, 0xa00a, 0xa438, 0xa190, + 0xa438, 0xa284, 0xa438, 0xa404, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd700, 0xa438, 0x5fa9, 0xa438, 0xd701, 0xa438, 0x6853, + 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d00, + 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d00, 0xa438, 0x1000, + 0xa438, 0x0a7d, 0xa438, 0x8190, 0xa438, 0x8284, 0xa438, 0xcb35, + 0xa438, 0xd407, 0xa438, 0x1000, 0xa438, 0x0a37, 0xa438, 0x8110, + 0xa438, 0x8204, 0xa438, 0xa280, 0xa438, 0xa00a, 0xa438, 0xd704, + 0xa438, 0x4215, 0xa438, 0xa304, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd700, 0xa438, 0x5fb8, 0xa438, 0xd1c3, 0xa438, 0xd043, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0x8304, 0xa438, 0xd700, 0xa438, 0x4109, 0xa438, 0xf01e, + 0xa438, 0xcb36, 0xa438, 0xd412, 0xa438, 0x1000, 0xa438, 0x0a37, + 0xa438, 0xd700, 0xa438, 0x6309, 0xa438, 0xd702, 0xa438, 0x42c7, + 0xa438, 0x800a, 0xa438, 0x8180, 0xa438, 0x8280, 0xa438, 0x8404, + 0xa438, 0xa004, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8004, + 0xa438, 0xa001, 0xa438, 0x1000, 0xa438, 0x0a42, 0xa438, 0x8001, + 0xa438, 0x0c03, 0xa438, 0x0902, 0xa438, 0xa00a, 0xa438, 0xd14a, + 0xa438, 0xd048, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0xd700, 0xa438, 0x6083, 0xa438, 0x0c1f, + 0xa438, 0x0d02, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0d02, + 0xa438, 0x1000, 0xa438, 0x0a7d, 0xa438, 0xcc55, 0xa438, 0xcb37, + 0xa438, 0xa00a, 0xa438, 0xa190, 0xa438, 0xa2a4, 0xa438, 0xa404, + 0xa438, 0xd700, 0xa438, 0x6041, 0xa438, 0xa402, 0xa438, 0xd13d, + 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, + 0xa438, 0x5fa9, 0xa438, 0xd702, 0xa438, 0x5f71, 0xa438, 0xcb38, + 0xa438, 0x8224, 0xa438, 0xa288, 0xa438, 0x8180, 0xa438, 0xa110, + 0xa438, 0xa404, 0xa438, 0x800a, 0xa438, 0xd700, 0xa438, 0x6041, + 0xa438, 0x8402, 0xa438, 0xd415, 0xa438, 0x1000, 0xa438, 0x0a37, + 0xa438, 0xd13d, 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x0a5e, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb39, 0xa438, 0xa00a, + 0xa438, 0xa190, 0xa438, 0xa2a0, 0xa438, 0xa404, 0xa438, 0xd700, + 0xa438, 0x6041, 0xa438, 0xa402, 0xa438, 0xd17a, 0xa438, 0xd047, + 0xa438, 0x1000, 0xa438, 0x0a5e, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0x1800, 0xa438, 0x0560, 0xa438, 0xa111, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0xd3f5, + 0xa438, 0xd219, 0xa438, 0x1000, 0xa438, 0x0c31, 0xa438, 0xd708, + 0xa438, 0x5fa5, 0xa438, 0xa215, 0xa438, 0xd30e, 0xa438, 0xd21a, + 0xa438, 0x1000, 0xa438, 0x0c31, 0xa438, 0xd708, 0xa438, 0x63e9, + 0xa438, 0xd708, 0xa438, 0x5f65, 0xa438, 0xd708, 0xa438, 0x7f36, + 0xa438, 0xa004, 0xa438, 0x1000, 0xa438, 0x0c35, 0xa438, 0x8004, + 0xa438, 0xa001, 0xa438, 0x1000, 0xa438, 0x0c35, 0xa438, 0x8001, + 0xa438, 0xd708, 0xa438, 0x4098, 0xa438, 0xd102, 0xa438, 0x9401, + 0xa438, 0xf003, 0xa438, 0xd103, 0xa438, 0xb401, 0xa438, 0x1000, + 0xa438, 0x0c27, 0xa438, 0xa108, 0xa438, 0x1000, 0xa438, 0x0c35, + 0xa438, 0x8108, 0xa438, 0x8110, 0xa438, 0x8294, 0xa438, 0xa202, + 0xa438, 0x1800, 0xa438, 0x0bdb, 0xa438, 0xd39c, 0xa438, 0xd210, + 0xa438, 0x1000, 0xa438, 0x0c31, 0xa438, 0xd708, 0xa438, 0x5fa5, + 0xa438, 0xd39c, 0xa438, 0xd210, 0xa438, 0x1000, 0xa438, 0x0c31, + 0xa438, 0xd708, 0xa438, 0x5fa5, 0xa438, 0x1000, 0xa438, 0x0c31, + 0xa438, 0xd708, 0xa438, 0x29b5, 0xa438, 0x840e, 0xa438, 0xd708, + 0xa438, 0x5f4a, 0xa438, 0x0c1f, 0xa438, 0x1014, 0xa438, 0x1000, + 0xa438, 0x0c31, 0xa438, 0xd709, 0xa438, 0x7fa4, 0xa438, 0x901f, + 0xa438, 0x1800, 0xa438, 0x0c23, 0xa438, 0xcb43, 0xa438, 0xa508, + 0xa438, 0xd701, 0xa438, 0x3699, 0xa438, 0x844a, 0xa438, 0xa504, + 0xa438, 0xa190, 0xa438, 0xa2a0, 0xa438, 0xa404, 0xa438, 0xa00a, + 0xa438, 0xd700, 0xa438, 0x2109, 0xa438, 0x05ea, 0xa438, 0xa402, + 0xa438, 0x1800, 0xa438, 0x05ea, 0xa438, 0xcb90, 0xa438, 0x0cf0, + 0xa438, 0x0ca0, 0xa438, 0x1800, 0xa438, 0x06db, 0xa438, 0xd1ff, + 0xa438, 0xd052, 0xa438, 0xa508, 0xa438, 0x8718, 0xa438, 0xa00a, + 0xa438, 0xa190, 0xa438, 0xa2a0, 0xa438, 0xa404, 0xa438, 0x0cf0, + 0xa438, 0x0c50, 0xa438, 0x1800, 0xa438, 0x09ef, 0xa438, 0x1000, + 0xa438, 0x0a5e, 0xa438, 0xd704, 0xa438, 0x2e70, 0xa438, 0x06da, + 0xa438, 0xd700, 0xa438, 0x5f55, 0xa438, 0xa90c, 0xa438, 0x1800, + 0xa438, 0x0645, 0xa436, 0xA10E, 0xa438, 0x0644, 0xa436, 0xA10C, + 0xa438, 0x09e9, 0xa436, 0xA10A, 0xa438, 0x06da, 0xa436, 0xA108, + 0xa438, 0x05e1, 0xa436, 0xA106, 0xa438, 0x0be4, 0xa436, 0xA104, + 0xa438, 0x0435, 0xa436, 0xA102, 0xa438, 0x0141, 0xa436, 0xA100, + 0xa438, 0x026d, 0xa436, 0xA110, 0xa438, 0x00ff, 0xa436, 0xb87c, + 0xa438, 0x85fe, 0xa436, 0xb87e, 0xa438, 0xaf86, 0xa438, 0x16af, + 0xa438, 0x8699, 0xa438, 0xaf86, 0xa438, 0xe5af, 0xa438, 0x86f9, + 0xa438, 0xaf87, 0xa438, 0x7aaf, 0xa438, 0x883a, 0xa438, 0xaf88, + 0xa438, 0x58af, 0xa438, 0x8b6c, 0xa438, 0xd48b, 0xa438, 0x7c02, + 0xa438, 0x8644, 0xa438, 0x2c00, 0xa438, 0x503c, 0xa438, 0xffd6, + 0xa438, 0xac27, 0xa438, 0x18e1, 0xa438, 0x82fe, 0xa438, 0xad28, + 0xa438, 0x0cd4, 0xa438, 0x8b84, 0xa438, 0x0286, 0xa438, 0x442c, + 0xa438, 0x003c, 0xa438, 0xac27, 0xa438, 0x06ee, 0xa438, 0x8299, + 0xa438, 0x01ae, 0xa438, 0x04ee, 0xa438, 0x8299, 0xa438, 0x00af, + 0xa438, 0x23dc, 0xa438, 0xf9fa, 0xa438, 0xcefa, 0xa438, 0xfbef, + 0xa438, 0x79fb, 0xa438, 0xc4bf, 0xa438, 0x8b76, 0xa438, 0x026c, + 0xa438, 0x6dac, 0xa438, 0x2804, 0xa438, 0xd203, 0xa438, 0xae02, + 0xa438, 0xd201, 0xa438, 0xbdd8, 0xa438, 0x19d9, 0xa438, 0xef94, + 0xa438, 0x026c, 0xa438, 0x6d78, 0xa438, 0x03ef, 0xa438, 0x648a, + 0xa438, 0x0002, 0xa438, 0xbdd8, 0xa438, 0x19d9, 0xa438, 0xef94, + 0xa438, 0x026c, 0xa438, 0x6d78, 0xa438, 0x03ef, 0xa438, 0x7402, + 0xa438, 0x72cd, 0xa438, 0xac50, 0xa438, 0x02ef, 0xa438, 0x643a, + 0xa438, 0x019f, 0xa438, 0xe4ef, 0xa438, 0x4678, 0xa438, 0x03ac, + 0xa438, 0x2002, 0xa438, 0xae02, 0xa438, 0xd0ff, 0xa438, 0xffef, + 0xa438, 0x97ff, 0xa438, 0xfec6, 0xa438, 0xfefd, 0xa438, 0x041f, + 0xa438, 0x771f, 0xa438, 0x221c, 0xa438, 0x450d, 0xa438, 0x481f, + 0xa438, 0x00ac, 0xa438, 0x7f04, 0xa438, 0x1a94, 0xa438, 0xae08, + 0xa438, 0x1a94, 0xa438, 0xac7f, 0xa438, 0x03d7, 0xa438, 0x0100, + 0xa438, 0xef46, 0xa438, 0x0d48, 0xa438, 0x1f00, 0xa438, 0x1c45, + 0xa438, 0xef69, 0xa438, 0xef57, 0xa438, 0xef74, 0xa438, 0x0272, + 0xa438, 0xe8a7, 0xa438, 0xffff, 0xa438, 0x0d1a, 0xa438, 0x941b, + 0xa438, 0x979e, 0xa438, 0x072d, 0xa438, 0x0100, 0xa438, 0x1a64, + 0xa438, 0xef76, 0xa438, 0xef97, 0xa438, 0x0d98, 0xa438, 0xd400, + 0xa438, 0xff1d, 0xa438, 0x941a, 0xa438, 0x89cf, 0xa438, 0x1a75, + 0xa438, 0xaf74, 0xa438, 0xf9bf, 0xa438, 0x8b79, 0xa438, 0x026c, + 0xa438, 0x6da1, 0xa438, 0x0005, 0xa438, 0xe180, 0xa438, 0xa0ae, + 0xa438, 0x03e1, 0xa438, 0x80a1, 0xa438, 0xaf26, 0xa438, 0x9aac, + 0xa438, 0x284d, 0xa438, 0xe08f, 0xa438, 0xffef, 0xa438, 0x10c0, + 0xa438, 0xe08f, 0xa438, 0xfe10, 0xa438, 0x1b08, 0xa438, 0xa000, + 0xa438, 0x04c8, 0xa438, 0xaf40, 0xa438, 0x67c8, 0xa438, 0xbf8b, + 0xa438, 0x8c02, 0xa438, 0x6c4e, 0xa438, 0xc4bf, 0xa438, 0x8b8f, + 0xa438, 0x026c, 0xa438, 0x6def, 0xa438, 0x74e0, 0xa438, 0x830c, + 0xa438, 0xad20, 0xa438, 0x0302, 0xa438, 0x74ac, 0xa438, 0xccef, + 0xa438, 0x971b, 0xa438, 0x76ad, 0xa438, 0x5f02, 0xa438, 0xae13, + 0xa438, 0xef69, 0xa438, 0xef30, 0xa438, 0x1b32, 0xa438, 0xc4ef, + 0xa438, 0x46e4, 0xa438, 0x8ffb, 0xa438, 0xe58f, 0xa438, 0xfce7, + 0xa438, 0x8ffd, 0xa438, 0xcc10, 0xa438, 0x11ae, 0xa438, 0xb8d1, + 0xa438, 0x00a1, 0xa438, 0x1f03, 0xa438, 0xaf40, 0xa438, 0x4fbf, + 0xa438, 0x8b8c, 0xa438, 0x026c, 0xa438, 0x4ec4, 0xa438, 0xbf8b, + 0xa438, 0x8f02, 0xa438, 0x6c6d, 0xa438, 0xef74, 0xa438, 0xe083, + 0xa438, 0x0cad, 0xa438, 0x2003, 0xa438, 0x0274, 0xa438, 0xaccc, + 0xa438, 0xef97, 0xa438, 0x1b76, 0xa438, 0xad5f, 0xa438, 0x02ae, + 0xa438, 0x04ef, 0xa438, 0x69ef, 0xa438, 0x3111, 0xa438, 0xaed1, + 0xa438, 0x0287, 0xa438, 0x80af, 0xa438, 0x2293, 0xa438, 0xf8f9, + 0xa438, 0xfafb, 0xa438, 0xef59, 0xa438, 0xe080, 0xa438, 0x13ad, + 0xa438, 0x252f, 0xa438, 0xbf88, 0xa438, 0x2802, 0xa438, 0x6c6d, + 0xa438, 0xef64, 0xa438, 0x1f44, 0xa438, 0xe18f, 0xa438, 0xb91b, + 0xa438, 0x64ad, 0xa438, 0x4f1d, 0xa438, 0xd688, 0xa438, 0x2bd7, + 0xa438, 0x882e, 0xa438, 0x0274, 0xa438, 0x73ad, 0xa438, 0x5008, + 0xa438, 0xbf88, 0xa438, 0x3102, 0xa438, 0x737c, 0xa438, 0xae03, + 0xa438, 0x0287, 0xa438, 0xd0bf, 0xa438, 0x882b, 0xa438, 0x0273, + 0xa438, 0x73e0, 0xa438, 0x824c, 0xa438, 0xf621, 0xa438, 0xe482, + 0xa438, 0x4cbf, 0xa438, 0x8834, 0xa438, 0x0273, 0xa438, 0x7cef, + 0xa438, 0x95ff, 0xa438, 0xfefd, 0xa438, 0xfc04, 0xa438, 0xf8f9, + 0xa438, 0xfafb, 0xa438, 0xef79, 0xa438, 0xbf88, 0xa438, 0x1f02, + 0xa438, 0x737c, 0xa438, 0x1f22, 0xa438, 0xac32, 0xa438, 0x31ef, + 0xa438, 0x12bf, 0xa438, 0x8822, 0xa438, 0x026c, 0xa438, 0x4ed6, + 0xa438, 0x8fba, 0xa438, 0x1f33, 0xa438, 0xac3c, 0xa438, 0x1eef, + 0xa438, 0x13bf, 0xa438, 0x8837, 0xa438, 0x026c, 0xa438, 0x4eef, + 0xa438, 0x96d8, 0xa438, 0x19d9, 0xa438, 0xbf88, 0xa438, 0x2502, + 0xa438, 0x6c4e, 0xa438, 0xbf88, 0xa438, 0x2502, 0xa438, 0x6c4e, + 0xa438, 0x1616, 0xa438, 0x13ae, 0xa438, 0xdf12, 0xa438, 0xaecc, + 0xa438, 0xbf88, 0xa438, 0x1f02, 0xa438, 0x7373, 0xa438, 0xef97, + 0xa438, 0xfffe, 0xa438, 0xfdfc, 0xa438, 0x0466, 0xa438, 0xac88, + 0xa438, 0x54ac, 0xa438, 0x88f0, 0xa438, 0xac8a, 0xa438, 0x92ac, + 0xa438, 0xbadd, 0xa438, 0xac6c, 0xa438, 0xeeac, 0xa438, 0x6cff, + 0xa438, 0xad02, 0xa438, 0x99ac, 0xa438, 0x0030, 0xa438, 0xac88, + 0xa438, 0xd4c3, 0xa438, 0x5000, 0xa438, 0x0000, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x00b4, 0xa438, 0xecee, + 0xa438, 0x8298, 0xa438, 0x00af, 0xa438, 0x1412, 0xa438, 0xf8bf, + 0xa438, 0x8b5d, 0xa438, 0x026c, 0xa438, 0x6d58, 0xa438, 0x03e1, + 0xa438, 0x8fb8, 0xa438, 0x2901, 0xa438, 0xe58f, 0xa438, 0xb8a0, + 0xa438, 0x0049, 0xa438, 0xef47, 0xa438, 0xe483, 0xa438, 0x02e5, + 0xa438, 0x8303, 0xa438, 0xbfc2, 0xa438, 0x5f1a, 0xa438, 0x95f7, + 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00d8, 0xa438, 0xf605, + 0xa438, 0x1f11, 0xa438, 0xef60, 0xa438, 0xbf8b, 0xa438, 0x3002, + 0xa438, 0x6c4e, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c6d, + 0xa438, 0xf728, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, + 0xa438, 0xf628, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, + 0xa438, 0x0c64, 0xa438, 0xef46, 0xa438, 0xbf8b, 0xa438, 0x6002, + 0xa438, 0x6c4e, 0xa438, 0x0289, 0xa438, 0x9902, 0xa438, 0x3920, + 0xa438, 0xaf89, 0xa438, 0x96a0, 0xa438, 0x0149, 0xa438, 0xef47, + 0xa438, 0xe483, 0xa438, 0x04e5, 0xa438, 0x8305, 0xa438, 0xbfc2, + 0xa438, 0x5f1a, 0xa438, 0x95f7, 0xa438, 0x05ee, 0xa438, 0xffd2, + 0xa438, 0x00d8, 0xa438, 0xf605, 0xa438, 0x1f11, 0xa438, 0xef60, + 0xa438, 0xbf8b, 0xa438, 0x3002, 0xa438, 0x6c4e, 0xa438, 0xbf8b, + 0xa438, 0x3302, 0xa438, 0x6c6d, 0xa438, 0xf729, 0xa438, 0xbf8b, + 0xa438, 0x3302, 0xa438, 0x6c4e, 0xa438, 0xf629, 0xa438, 0xbf8b, + 0xa438, 0x3302, 0xa438, 0x6c4e, 0xa438, 0x0c64, 0xa438, 0xef46, + 0xa438, 0xbf8b, 0xa438, 0x6302, 0xa438, 0x6c4e, 0xa438, 0x0289, + 0xa438, 0x9902, 0xa438, 0x3920, 0xa438, 0xaf89, 0xa438, 0x96a0, + 0xa438, 0x0249, 0xa438, 0xef47, 0xa438, 0xe483, 0xa438, 0x06e5, + 0xa438, 0x8307, 0xa438, 0xbfc2, 0xa438, 0x5f1a, 0xa438, 0x95f7, + 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00d8, 0xa438, 0xf605, + 0xa438, 0x1f11, 0xa438, 0xef60, 0xa438, 0xbf8b, 0xa438, 0x3002, + 0xa438, 0x6c4e, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c6d, + 0xa438, 0xf72a, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, + 0xa438, 0xf62a, 0xa438, 0xbf8b, 0xa438, 0x3302, 0xa438, 0x6c4e, + 0xa438, 0x0c64, 0xa438, 0xef46, 0xa438, 0xbf8b, 0xa438, 0x6602, + 0xa438, 0x6c4e, 0xa438, 0x0289, 0xa438, 0x9902, 0xa438, 0x3920, + 0xa438, 0xaf89, 0xa438, 0x96ef, 0xa438, 0x47e4, 0xa438, 0x8308, + 0xa438, 0xe583, 0xa438, 0x09bf, 0xa438, 0xc25f, 0xa438, 0x1a95, + 0xa438, 0xf705, 0xa438, 0xeeff, 0xa438, 0xd200, 0xa438, 0xd8f6, + 0xa438, 0x051f, 0xa438, 0x11ef, 0xa438, 0x60bf, 0xa438, 0x8b30, + 0xa438, 0x026c, 0xa438, 0x4ebf, 0xa438, 0x8b33, 0xa438, 0x026c, + 0xa438, 0x6df7, 0xa438, 0x2bbf, 0xa438, 0x8b33, 0xa438, 0x026c, + 0xa438, 0x4ef6, 0xa438, 0x2bbf, 0xa438, 0x8b33, 0xa438, 0x026c, + 0xa438, 0x4e0c, 0xa438, 0x64ef, 0xa438, 0x46bf, 0xa438, 0x8b69, + 0xa438, 0x026c, 0xa438, 0x4e02, 0xa438, 0x8999, 0xa438, 0x0239, + 0xa438, 0x20af, 0xa438, 0x8996, 0xa438, 0xaf39, 0xa438, 0x1ef8, + 0xa438, 0xf9fa, 0xa438, 0xe08f, 0xa438, 0xb838, 0xa438, 0x02ad, + 0xa438, 0x2702, 0xa438, 0xae03, 0xa438, 0xaf8b, 0xa438, 0x201f, + 0xa438, 0x66ef, 0xa438, 0x65bf, 0xa438, 0xc21f, 0xa438, 0x1a96, + 0xa438, 0xf705, 0xa438, 0xeeff, 0xa438, 0xd200, 0xa438, 0xdaf6, + 0xa438, 0x05bf, 0xa438, 0xc22f, 0xa438, 0x1a96, 0xa438, 0xf705, + 0xa438, 0xeeff, 0xa438, 0xd200, 0xa438, 0xdbf6, 0xa438, 0x05ef, + 0xa438, 0x021f, 0xa438, 0x110d, 0xa438, 0x42bf, 0xa438, 0x8b3c, + 0xa438, 0x026c, 0xa438, 0x4eef, 0xa438, 0x021b, 0xa438, 0x031f, + 0xa438, 0x110d, 0xa438, 0x42bf, 0xa438, 0x8b36, 0xa438, 0x026c, + 0xa438, 0x4eef, 0xa438, 0x021a, 0xa438, 0x031f, 0xa438, 0x110d, + 0xa438, 0x42bf, 0xa438, 0x8b39, 0xa438, 0x026c, 0xa438, 0x4ebf, + 0xa438, 0xc23f, 0xa438, 0x1a96, 0xa438, 0xf705, 0xa438, 0xeeff, + 0xa438, 0xd200, 0xa438, 0xdaf6, 0xa438, 0x05bf, 0xa438, 0xc24f, + 0xa438, 0x1a96, 0xa438, 0xf705, 0xa438, 0xeeff, 0xa438, 0xd200, + 0xa438, 0xdbf6, 0xa438, 0x05ef, 0xa438, 0x021f, 0xa438, 0x110d, + 0xa438, 0x42bf, 0xa438, 0x8b45, 0xa438, 0x026c, 0xa438, 0x4eef, + 0xa438, 0x021b, 0xa438, 0x031f, 0xa438, 0x110d, 0xa438, 0x42bf, + 0xa438, 0x8b3f, 0xa438, 0x026c, 0xa438, 0x4eef, 0xa438, 0x021a, + 0xa438, 0x031f, 0xa438, 0x110d, 0xa438, 0x42bf, 0xa438, 0x8b42, + 0xa438, 0x026c, 0xa438, 0x4eef, 0xa438, 0x56d0, 0xa438, 0x201f, + 0xa438, 0x11bf, 0xa438, 0x8b4e, 0xa438, 0x026c, 0xa438, 0x4ebf, + 0xa438, 0x8b48, 0xa438, 0x026c, 0xa438, 0x4ebf, 0xa438, 0x8b4b, + 0xa438, 0x026c, 0xa438, 0x4ee1, 0xa438, 0x8578, 0xa438, 0xef03, + 0xa438, 0x480a, 0xa438, 0x2805, 0xa438, 0xef20, 0xa438, 0x1b01, + 0xa438, 0xad27, 0xa438, 0x3f1f, 0xa438, 0x44e0, 0xa438, 0x8560, + 0xa438, 0xe185, 0xa438, 0x61bf, 0xa438, 0x8b51, 0xa438, 0x026c, + 0xa438, 0x4ee0, 0xa438, 0x8566, 0xa438, 0xe185, 0xa438, 0x67bf, + 0xa438, 0x8b54, 0xa438, 0x026c, 0xa438, 0x4ee0, 0xa438, 0x856c, + 0xa438, 0xe185, 0xa438, 0x6dbf, 0xa438, 0x8b57, 0xa438, 0x026c, + 0xa438, 0x4ee0, 0xa438, 0x8572, 0xa438, 0xe185, 0xa438, 0x73bf, + 0xa438, 0x8b5a, 0xa438, 0x026c, 0xa438, 0x4ee1, 0xa438, 0x8fb8, + 0xa438, 0x5900, 0xa438, 0xf728, 0xa438, 0xe58f, 0xa438, 0xb8af, + 0xa438, 0x8b2c, 0xa438, 0xe185, 0xa438, 0x791b, 0xa438, 0x21ad, + 0xa438, 0x373e, 0xa438, 0x1f44, 0xa438, 0xe085, 0xa438, 0x62e1, + 0xa438, 0x8563, 0xa438, 0xbf8b, 0xa438, 0x5102, 0xa438, 0x6c4e, + 0xa438, 0xe085, 0xa438, 0x68e1, 0xa438, 0x8569, 0xa438, 0xbf8b, + 0xa438, 0x5402, 0xa438, 0x6c4e, 0xa438, 0xe085, 0xa438, 0x6ee1, + 0xa438, 0x856f, 0xa438, 0xbf8b, 0xa438, 0x5702, 0xa438, 0x6c4e, + 0xa438, 0xe085, 0xa438, 0x74e1, 0xa438, 0x8575, 0xa438, 0xbf8b, + 0xa438, 0x5a02, 0xa438, 0x6c4e, 0xa438, 0xe18f, 0xa438, 0xb859, + 0xa438, 0x00f7, 0xa438, 0x28e5, 0xa438, 0x8fb8, 0xa438, 0xae4a, + 0xa438, 0x1f44, 0xa438, 0xe085, 0xa438, 0x64e1, 0xa438, 0x8565, + 0xa438, 0xbf8b, 0xa438, 0x5102, 0xa438, 0x6c4e, 0xa438, 0xe085, + 0xa438, 0x6ae1, 0xa438, 0x856b, 0xa438, 0xbf8b, 0xa438, 0x5402, + 0xa438, 0x6c4e, 0xa438, 0xe085, 0xa438, 0x70e1, 0xa438, 0x8571, + 0xa438, 0xbf8b, 0xa438, 0x5702, 0xa438, 0x6c4e, 0xa438, 0xe085, + 0xa438, 0x76e1, 0xa438, 0x8577, 0xa438, 0xbf8b, 0xa438, 0x5a02, + 0xa438, 0x6c4e, 0xa438, 0xe18f, 0xa438, 0xb859, 0xa438, 0x00f7, + 0xa438, 0x28e5, 0xa438, 0x8fb8, 0xa438, 0xae0c, 0xa438, 0xe18f, + 0xa438, 0xb839, 0xa438, 0x04ac, 0xa438, 0x2f04, 0xa438, 0xee8f, + 0xa438, 0xb800, 0xa438, 0xfefd, 0xa438, 0xfc04, 0xa438, 0xf0ac, + 0xa438, 0x8efc, 0xa438, 0xac8c, 0xa438, 0xf0ac, 0xa438, 0xfaf0, + 0xa438, 0xacf8, 0xa438, 0xf0ac, 0xa438, 0xf6f0, 0xa438, 0xad00, + 0xa438, 0xf0ac, 0xa438, 0xfef0, 0xa438, 0xacfc, 0xa438, 0xf0ac, + 0xa438, 0xf4f0, 0xa438, 0xacf2, 0xa438, 0xf0ac, 0xa438, 0xf0f0, + 0xa438, 0xacb0, 0xa438, 0xf0ac, 0xa438, 0xaef0, 0xa438, 0xacac, + 0xa438, 0xf0ac, 0xa438, 0xaaf0, 0xa438, 0xacee, 0xa438, 0xf0b0, + 0xa438, 0x24f0, 0xa438, 0xb0a4, 0xa438, 0xf0b1, 0xa438, 0x24f0, + 0xa438, 0xb1a4, 0xa438, 0xee8f, 0xa438, 0xb800, 0xa438, 0xd400, + 0xa438, 0x00af, 0xa438, 0x3976, 0xa438, 0x66ac, 0xa438, 0xeabb, + 0xa438, 0xa430, 0xa438, 0x6e50, 0xa438, 0x6e53, 0xa438, 0x6e56, + 0xa438, 0x6e59, 0xa438, 0x6e5c, 0xa438, 0x6e5f, 0xa438, 0x6e62, + 0xa438, 0x6e65, 0xa438, 0xd9ac, 0xa438, 0x70f0, 0xa438, 0xac6a, + 0xa436, 0xb85e, 0xa438, 0x23b7, 0xa436, 0xb860, 0xa438, 0x74db, + 0xa436, 0xb862, 0xa438, 0x268c, 0xa436, 0xb864, 0xa438, 0x3FE5, + 0xa436, 0xb886, 0xa438, 0x2250, 0xa436, 0xb888, 0xa438, 0x140e, + 0xa436, 0xb88a, 0xa438, 0x3696, 0xa436, 0xb88c, 0xa438, 0x3973, + 0xa436, 0xb838, 0xa438, 0x00ff, 0xb820, 0x0010, 0xa436, 0x8464, + 0xa438, 0xaf84, 0xa438, 0x7caf, 0xa438, 0x8485, 0xa438, 0xaf85, + 0xa438, 0x13af, 0xa438, 0x851e, 0xa438, 0xaf85, 0xa438, 0xb9af, + 0xa438, 0x8684, 0xa438, 0xaf87, 0xa438, 0x01af, 0xa438, 0x8701, + 0xa438, 0xac38, 0xa438, 0x03af, 0xa438, 0x38bb, 0xa438, 0xaf38, + 0xa438, 0xc302, 0xa438, 0x4618, 0xa438, 0xbf85, 0xa438, 0x0a02, + 0xa438, 0x54b7, 0xa438, 0xbf85, 0xa438, 0x1002, 0xa438, 0x54c0, + 0xa438, 0xd400, 0xa438, 0x0fbf, 0xa438, 0x8507, 0xa438, 0x024f, + 0xa438, 0x48bf, 0xa438, 0x8504, 0xa438, 0x024f, 0xa438, 0x6759, + 0xa438, 0xf0a1, 0xa438, 0x3008, 0xa438, 0xbf85, 0xa438, 0x0d02, + 0xa438, 0x54c0, 0xa438, 0xae06, 0xa438, 0xbf85, 0xa438, 0x0d02, + 0xa438, 0x54b7, 0xa438, 0xbf85, 0xa438, 0x0402, 0xa438, 0x4f67, + 0xa438, 0xa183, 0xa438, 0x02ae, 0xa438, 0x15a1, 0xa438, 0x8502, + 0xa438, 0xae10, 0xa438, 0x59f0, 0xa438, 0xa180, 0xa438, 0x16bf, + 0xa438, 0x8501, 0xa438, 0x024f, 0xa438, 0x67a1, 0xa438, 0x381b, + 0xa438, 0xae0b, 0xa438, 0xe18f, 0xa438, 0xffbf, 0xa438, 0x84fe, + 0xa438, 0x024f, 0xa438, 0x48ae, 0xa438, 0x17bf, 0xa438, 0x84fe, + 0xa438, 0x0254, 0xa438, 0xb7bf, 0xa438, 0x84fb, 0xa438, 0x0254, + 0xa438, 0xb7ae, 0xa438, 0x09a1, 0xa438, 0x5006, 0xa438, 0xbf84, + 0xa438, 0xfb02, 0xa438, 0x54c0, 0xa438, 0xaf04, 0xa438, 0x4700, + 0xa438, 0xad34, 0xa438, 0xfdad, 0xa438, 0x0670, 0xa438, 0xae14, + 0xa438, 0xf0a6, 0xa438, 0x00b8, 0xa438, 0xbd32, 0xa438, 0x30bd, + 0xa438, 0x30aa, 0xa438, 0xbd2c, 0xa438, 0xccbd, 0xa438, 0x2ca1, + 0xa438, 0x0705, 0xa438, 0xec80, 0xa438, 0xaf40, 0xa438, 0xf7af, + 0xa438, 0x40f5, 0xa438, 0xd101, 0xa438, 0xbf85, 0xa438, 0xa402, + 0xa438, 0x4f48, 0xa438, 0xbf85, 0xa438, 0xa702, 0xa438, 0x54c0, + 0xa438, 0xd10f, 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, + 0xa438, 0x024d, 0xa438, 0x6abf, 0xa438, 0x85ad, 0xa438, 0x024f, + 0xa438, 0x67bf, 0xa438, 0x8ff7, 0xa438, 0xddbf, 0xa438, 0x85b0, + 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ff8, 0xa438, 0xddbf, + 0xa438, 0x85b3, 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ff9, + 0xa438, 0xddbf, 0xa438, 0x85b6, 0xa438, 0x024f, 0xa438, 0x67bf, + 0xa438, 0x8ffa, 0xa438, 0xddd1, 0xa438, 0x00bf, 0xa438, 0x85aa, + 0xa438, 0x024f, 0xa438, 0x4802, 0xa438, 0x4d6a, 0xa438, 0xbf85, + 0xa438, 0xad02, 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfbdd, + 0xa438, 0xbf85, 0xa438, 0xb002, 0xa438, 0x4f67, 0xa438, 0xbf8f, + 0xa438, 0xfcdd, 0xa438, 0xbf85, 0xa438, 0xb302, 0xa438, 0x4f67, + 0xa438, 0xbf8f, 0xa438, 0xfddd, 0xa438, 0xbf85, 0xa438, 0xb602, + 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfedd, 0xa438, 0xbf85, + 0xa438, 0xa702, 0xa438, 0x54b7, 0xa438, 0xbf85, 0xa438, 0xa102, + 0xa438, 0x54b7, 0xa438, 0xaf3c, 0xa438, 0x2066, 0xa438, 0xb800, + 0xa438, 0xb8bd, 0xa438, 0x30ee, 0xa438, 0xbd2c, 0xa438, 0xb8bd, + 0xa438, 0x7040, 0xa438, 0xbd86, 0xa438, 0xc8bd, 0xa438, 0x8640, + 0xa438, 0xbd88, 0xa438, 0xc8bd, 0xa438, 0x8802, 0xa438, 0x1929, + 0xa438, 0xa202, 0xa438, 0x02ae, 0xa438, 0x03a2, 0xa438, 0x032e, + 0xa438, 0xd10f, 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, + 0xa438, 0xe18f, 0xa438, 0xf7bf, 0xa438, 0x85ad, 0xa438, 0x024f, + 0xa438, 0x48e1, 0xa438, 0x8ff8, 0xa438, 0xbf85, 0xa438, 0xb002, + 0xa438, 0x4f48, 0xa438, 0xe18f, 0xa438, 0xf9bf, 0xa438, 0x85b3, + 0xa438, 0x024f, 0xa438, 0x48e1, 0xa438, 0x8ffa, 0xa438, 0xbf85, + 0xa438, 0xb602, 0xa438, 0x4f48, 0xa438, 0xae2c, 0xa438, 0xd100, + 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, 0xa438, 0xe18f, + 0xa438, 0xfbbf, 0xa438, 0x85ad, 0xa438, 0x024f, 0xa438, 0x48e1, + 0xa438, 0x8ffc, 0xa438, 0xbf85, 0xa438, 0xb002, 0xa438, 0x4f48, + 0xa438, 0xe18f, 0xa438, 0xfdbf, 0xa438, 0x85b3, 0xa438, 0x024f, + 0xa438, 0x48e1, 0xa438, 0x8ffe, 0xa438, 0xbf85, 0xa438, 0xb602, + 0xa438, 0x4f48, 0xa438, 0xbf86, 0xa438, 0x7e02, 0xa438, 0x4f67, + 0xa438, 0xa100, 0xa438, 0x02ae, 0xa438, 0x25a1, 0xa438, 0x041d, + 0xa438, 0xe18f, 0xa438, 0xf1bf, 0xa438, 0x8675, 0xa438, 0x024f, + 0xa438, 0x48e1, 0xa438, 0x8ff2, 0xa438, 0xbf86, 0xa438, 0x7802, + 0xa438, 0x4f48, 0xa438, 0xe18f, 0xa438, 0xf3bf, 0xa438, 0x867b, + 0xa438, 0x024f, 0xa438, 0x48ae, 0xa438, 0x29a1, 0xa438, 0x070b, + 0xa438, 0xae24, 0xa438, 0xbf86, 0xa438, 0x8102, 0xa438, 0x4f67, + 0xa438, 0xad28, 0xa438, 0x1be1, 0xa438, 0x8ff4, 0xa438, 0xbf86, + 0xa438, 0x7502, 0xa438, 0x4f48, 0xa438, 0xe18f, 0xa438, 0xf5bf, + 0xa438, 0x8678, 0xa438, 0x024f, 0xa438, 0x48e1, 0xa438, 0x8ff6, + 0xa438, 0xbf86, 0xa438, 0x7b02, 0xa438, 0x4f48, 0xa438, 0xaf09, + 0xa438, 0x8420, 0xa438, 0xbc32, 0xa438, 0x20bc, 0xa438, 0x3e76, + 0xa438, 0xbc08, 0xa438, 0xfda6, 0xa438, 0x1a00, 0xa438, 0xb64e, + 0xa438, 0xd101, 0xa438, 0xbf85, 0xa438, 0xa402, 0xa438, 0x4f48, + 0xa438, 0xbf85, 0xa438, 0xa702, 0xa438, 0x54c0, 0xa438, 0xd10f, + 0xa438, 0xbf85, 0xa438, 0xaa02, 0xa438, 0x4f48, 0xa438, 0x024d, + 0xa438, 0x6abf, 0xa438, 0x85ad, 0xa438, 0x024f, 0xa438, 0x67bf, + 0xa438, 0x8ff7, 0xa438, 0xddbf, 0xa438, 0x85b0, 0xa438, 0x024f, + 0xa438, 0x67bf, 0xa438, 0x8ff8, 0xa438, 0xddbf, 0xa438, 0x85b3, + 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ff9, 0xa438, 0xddbf, + 0xa438, 0x85b6, 0xa438, 0x024f, 0xa438, 0x67bf, 0xa438, 0x8ffa, + 0xa438, 0xddd1, 0xa438, 0x00bf, 0xa438, 0x85aa, 0xa438, 0x024f, + 0xa438, 0x4802, 0xa438, 0x4d6a, 0xa438, 0xbf85, 0xa438, 0xad02, + 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfbdd, 0xa438, 0xbf85, + 0xa438, 0xb002, 0xa438, 0x4f67, 0xa438, 0xbf8f, 0xa438, 0xfcdd, + 0xa438, 0xbf85, 0xa438, 0xb302, 0xa438, 0x4f67, 0xa438, 0xbf8f, + 0xa438, 0xfddd, 0xa438, 0xbf85, 0xa438, 0xb602, 0xa438, 0x4f67, + 0xa438, 0xbf8f, 0xa438, 0xfedd, 0xa438, 0xbf85, 0xa438, 0xa702, + 0xa438, 0x54b7, 0xa438, 0xaf00, 0xa438, 0x8800, 0xa436, 0xb818, + 0xa438, 0x38b8, 0xa436, 0xb81a, 0xa438, 0x0444, 0xa436, 0xb81c, + 0xa438, 0x40ee, 0xa436, 0xb81e, 0xa438, 0x3C1A, 0xa436, 0xb850, + 0xa438, 0x0981, 0xa436, 0xb852, 0xa438, 0x0085, 0xa436, 0xb878, + 0xa438, 0xffff, 0xa436, 0xb884, 0xa438, 0xffff, 0xa436, 0xb832, + 0xa438, 0x003f, 0xa436, 0x0000, 0xa438, 0x0000, 0xa436, 0xB82E, + 0xa438, 0x0000, 0xa436, 0x8024, 0xa438, 0x0000, 0xb820, 0x0000, + 0xa436, 0x801E, 0xa438, 0x0021, 0xFFFF, 0xFFFF +}; + +static const u_int16_t phy_mcu_ram_code_8125b_2[] = { + 0xa436, 0x8024, 0xa438, 0x3701, 0xa436, 0xB82E, 0xa438, 0x0001, + 0xb820, 0x0090, 0xa436, 0xA016, 0xa438, 0x0000, 0xa436, 0xA012, + 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, + 0xa438, 0x1800, 0xa438, 0x801a, 0xa438, 0x1800, 0xa438, 0x803f, + 0xa438, 0x1800, 0xa438, 0x8045, 0xa438, 0x1800, 0xa438, 0x8067, + 0xa438, 0x1800, 0xa438, 0x806d, 0xa438, 0x1800, 0xa438, 0x8071, + 0xa438, 0x1800, 0xa438, 0x80b1, 0xa438, 0xd093, 0xa438, 0xd1c4, + 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd704, 0xa438, 0x5fbc, + 0xa438, 0xd504, 0xa438, 0xc9f1, 0xa438, 0x1800, 0xa438, 0x0fc9, + 0xa438, 0xbb50, 0xa438, 0xd505, 0xa438, 0xa202, 0xa438, 0xd504, + 0xa438, 0x8c0f, 0xa438, 0xd500, 0xa438, 0x1000, 0xa438, 0x1519, + 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd75e, 0xa438, 0x5fae, + 0xa438, 0x9b50, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd75e, + 0xa438, 0x7fae, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd707, + 0xa438, 0x40a7, 0xa438, 0xd719, 0xa438, 0x4071, 0xa438, 0x1800, + 0xa438, 0x1557, 0xa438, 0xd719, 0xa438, 0x2f70, 0xa438, 0x803b, + 0xa438, 0x2f73, 0xa438, 0x156a, 0xa438, 0x5e70, 0xa438, 0x1800, + 0xa438, 0x155d, 0xa438, 0xd505, 0xa438, 0xa202, 0xa438, 0xd500, + 0xa438, 0xffed, 0xa438, 0xd709, 0xa438, 0x4054, 0xa438, 0xa788, + 0xa438, 0xd70b, 0xa438, 0x1800, 0xa438, 0x172a, 0xa438, 0xc0c1, + 0xa438, 0xc0c0, 0xa438, 0xd05a, 0xa438, 0xd1ba, 0xa438, 0xd701, + 0xa438, 0x2529, 0xa438, 0x022a, 0xa438, 0xd0a7, 0xa438, 0xd1b9, + 0xa438, 0xa208, 0xa438, 0x1000, 0xa438, 0x080e, 0xa438, 0xd701, + 0xa438, 0x408b, 0xa438, 0x1000, 0xa438, 0x0a65, 0xa438, 0xf003, + 0xa438, 0x1000, 0xa438, 0x0a6b, 0xa438, 0xd701, 0xa438, 0x1000, + 0xa438, 0x0920, 0xa438, 0x1000, 0xa438, 0x0915, 0xa438, 0x1000, + 0xa438, 0x0909, 0xa438, 0x228f, 0xa438, 0x804e, 0xa438, 0x9801, + 0xa438, 0xd71e, 0xa438, 0x5d61, 0xa438, 0xd701, 0xa438, 0x1800, + 0xa438, 0x022a, 0xa438, 0x2005, 0xa438, 0x091a, 0xa438, 0x3bd9, + 0xa438, 0x0919, 0xa438, 0x1800, 0xa438, 0x0916, 0xa438, 0xd090, + 0xa438, 0xd1c9, 0xa438, 0x1800, 0xa438, 0x1064, 0xa438, 0xd096, + 0xa438, 0xd1a9, 0xa438, 0xd503, 0xa438, 0xa104, 0xa438, 0x0c07, + 0xa438, 0x0902, 0xa438, 0xd500, 0xa438, 0xbc10, 0xa438, 0xd501, + 0xa438, 0xce01, 0xa438, 0xa201, 0xa438, 0x8201, 0xa438, 0xce00, + 0xa438, 0xd500, 0xa438, 0xc484, 0xa438, 0xd503, 0xa438, 0xcc02, + 0xa438, 0xcd0d, 0xa438, 0xaf01, 0xa438, 0xd500, 0xa438, 0xd703, + 0xa438, 0x4371, 0xa438, 0xbd08, 0xa438, 0x1000, 0xa438, 0x135c, + 0xa438, 0xd75e, 0xa438, 0x5fb3, 0xa438, 0xd503, 0xa438, 0xd0f5, + 0xa438, 0xd1c6, 0xa438, 0x0cf0, 0xa438, 0x0e50, 0xa438, 0xd704, + 0xa438, 0x401c, 0xa438, 0xd0f5, 0xa438, 0xd1c6, 0xa438, 0x0cf0, + 0xa438, 0x0ea0, 0xa438, 0x401c, 0xa438, 0xd07b, 0xa438, 0xd1c5, + 0xa438, 0x8ef0, 0xa438, 0x401c, 0xa438, 0x9d08, 0xa438, 0x1000, + 0xa438, 0x135c, 0xa438, 0xd75e, 0xa438, 0x7fb3, 0xa438, 0x1000, + 0xa438, 0x135c, 0xa438, 0xd75e, 0xa438, 0x5fad, 0xa438, 0x1000, + 0xa438, 0x14c5, 0xa438, 0xd703, 0xa438, 0x3181, 0xa438, 0x80af, + 0xa438, 0x60ad, 0xa438, 0x1000, 0xa438, 0x135c, 0xa438, 0xd703, + 0xa438, 0x5fba, 0xa438, 0x1800, 0xa438, 0x0cc7, 0xa438, 0xa802, + 0xa438, 0xa301, 0xa438, 0xa801, 0xa438, 0xc004, 0xa438, 0xd710, + 0xa438, 0x4000, 0xa438, 0x1800, 0xa438, 0x1e79, 0xa436, 0xA026, + 0xa438, 0x1e78, 0xa436, 0xA024, 0xa438, 0x0c93, 0xa436, 0xA022, + 0xa438, 0x1062, 0xa436, 0xA020, 0xa438, 0x0915, 0xa436, 0xA006, + 0xa438, 0x020a, 0xa436, 0xA004, 0xa438, 0x1726, 0xa436, 0xA002, + 0xa438, 0x1542, 0xa436, 0xA000, 0xa438, 0x0fc7, 0xa436, 0xA008, + 0xa438, 0xff00, 0xa436, 0xA016, 0xa438, 0x0010, 0xa436, 0xA012, + 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, + 0xa438, 0x1800, 0xa438, 0x801d, 0xa438, 0x1800, 0xa438, 0x802c, + 0xa438, 0x1800, 0xa438, 0x802c, 0xa438, 0x1800, 0xa438, 0x802c, + 0xa438, 0x1800, 0xa438, 0x802c, 0xa438, 0x1800, 0xa438, 0x802c, + 0xa438, 0x1800, 0xa438, 0x802c, 0xa438, 0xd700, 0xa438, 0x6090, + 0xa438, 0x60d1, 0xa438, 0xc95c, 0xa438, 0xf007, 0xa438, 0x60b1, + 0xa438, 0xc95a, 0xa438, 0xf004, 0xa438, 0xc956, 0xa438, 0xf002, + 0xa438, 0xc94e, 0xa438, 0x1800, 0xa438, 0x00cd, 0xa438, 0xd700, + 0xa438, 0x6090, 0xa438, 0x60d1, 0xa438, 0xc95c, 0xa438, 0xf007, + 0xa438, 0x60b1, 0xa438, 0xc95a, 0xa438, 0xf004, 0xa438, 0xc956, + 0xa438, 0xf002, 0xa438, 0xc94e, 0xa438, 0x1000, 0xa438, 0x022a, + 0xa438, 0x1800, 0xa438, 0x0132, 0xa436, 0xA08E, 0xa438, 0xffff, + 0xa436, 0xA08C, 0xa438, 0xffff, 0xa436, 0xA08A, 0xa438, 0xffff, + 0xa436, 0xA088, 0xa438, 0xffff, 0xa436, 0xA086, 0xa438, 0xffff, + 0xa436, 0xA084, 0xa438, 0xffff, 0xa436, 0xA082, 0xa438, 0x012f, + 0xa436, 0xA080, 0xa438, 0x00cc, 0xa436, 0xA090, 0xa438, 0x0103, + 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, 0xa438, 0x0000, + 0xa436, 0xA014, 0xa438, 0x1800, 0xa438, 0x8010, 0xa438, 0x1800, + 0xa438, 0x8020, 0xa438, 0x1800, 0xa438, 0x802a, 0xa438, 0x1800, + 0xa438, 0x8035, 0xa438, 0x1800, 0xa438, 0x803c, 0xa438, 0x1800, + 0xa438, 0x803c, 0xa438, 0x1800, 0xa438, 0x803c, 0xa438, 0x1800, + 0xa438, 0x803c, 0xa438, 0xd107, 0xa438, 0xd042, 0xa438, 0xa404, + 0xa438, 0x1000, 0xa438, 0x09df, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0x8280, 0xa438, 0xd700, 0xa438, 0x6065, 0xa438, 0xd125, + 0xa438, 0xf002, 0xa438, 0xd12b, 0xa438, 0xd040, 0xa438, 0x1800, + 0xa438, 0x077f, 0xa438, 0x0cf0, 0xa438, 0x0c50, 0xa438, 0xd104, + 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x0aa8, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0x1800, 0xa438, 0x0a2e, 0xa438, 0xcb9b, + 0xa438, 0xd110, 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x0b7b, + 0xa438, 0x1000, 0xa438, 0x09df, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0x1800, 0xa438, 0x081b, 0xa438, 0x1000, 0xa438, 0x09df, + 0xa438, 0xd704, 0xa438, 0x7fb8, 0xa438, 0xa718, 0xa438, 0x1800, + 0xa438, 0x074e, 0xa436, 0xA10E, 0xa438, 0xffff, 0xa436, 0xA10C, + 0xa438, 0xffff, 0xa436, 0xA10A, 0xa438, 0xffff, 0xa436, 0xA108, + 0xa438, 0xffff, 0xa436, 0xA106, 0xa438, 0x074d, 0xa436, 0xA104, + 0xa438, 0x0818, 0xa436, 0xA102, 0xa438, 0x0a2c, 0xa436, 0xA100, + 0xa438, 0x077e, 0xa436, 0xA110, 0xa438, 0x000f, 0xa436, 0xb87c, + 0xa438, 0x8625, 0xa436, 0xb87e, 0xa438, 0xaf86, 0xa438, 0x3daf, + 0xa438, 0x8689, 0xa438, 0xaf88, 0xa438, 0x69af, 0xa438, 0x8887, + 0xa438, 0xaf88, 0xa438, 0x9caf, 0xa438, 0x889c, 0xa438, 0xaf88, + 0xa438, 0x9caf, 0xa438, 0x889c, 0xa438, 0xbf86, 0xa438, 0x49d7, + 0xa438, 0x0040, 0xa438, 0x0277, 0xa438, 0x7daf, 0xa438, 0x2727, + 0xa438, 0x0000, 0xa438, 0x7205, 0xa438, 0x0000, 0xa438, 0x7208, + 0xa438, 0x0000, 0xa438, 0x71f3, 0xa438, 0x0000, 0xa438, 0x71f6, + 0xa438, 0x0000, 0xa438, 0x7229, 0xa438, 0x0000, 0xa438, 0x722c, + 0xa438, 0x0000, 0xa438, 0x7217, 0xa438, 0x0000, 0xa438, 0x721a, + 0xa438, 0x0000, 0xa438, 0x721d, 0xa438, 0x0000, 0xa438, 0x7211, + 0xa438, 0x0000, 0xa438, 0x7220, 0xa438, 0x0000, 0xa438, 0x7214, + 0xa438, 0x0000, 0xa438, 0x722f, 0xa438, 0x0000, 0xa438, 0x7223, + 0xa438, 0x0000, 0xa438, 0x7232, 0xa438, 0x0000, 0xa438, 0x7226, + 0xa438, 0xf8f9, 0xa438, 0xfae0, 0xa438, 0x85b3, 0xa438, 0x3802, + 0xa438, 0xad27, 0xa438, 0x02ae, 0xa438, 0x03af, 0xa438, 0x8830, + 0xa438, 0x1f66, 0xa438, 0xef65, 0xa438, 0xbfc2, 0xa438, 0x1f1a, + 0xa438, 0x96f7, 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00da, + 0xa438, 0xf605, 0xa438, 0xbfc2, 0xa438, 0x2f1a, 0xa438, 0x96f7, + 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00db, 0xa438, 0xf605, + 0xa438, 0xef02, 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, + 0xa438, 0x4202, 0xa438, 0x6e7d, 0xa438, 0xef02, 0xa438, 0x1b03, + 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4502, + 0xa438, 0x6e7d, 0xa438, 0xef02, 0xa438, 0x1a03, 0xa438, 0x1f11, + 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4802, 0xa438, 0x6e7d, + 0xa438, 0xbfc2, 0xa438, 0x3f1a, 0xa438, 0x96f7, 0xa438, 0x05ee, + 0xa438, 0xffd2, 0xa438, 0x00da, 0xa438, 0xf605, 0xa438, 0xbfc2, + 0xa438, 0x4f1a, 0xa438, 0x96f7, 0xa438, 0x05ee, 0xa438, 0xffd2, + 0xa438, 0x00db, 0xa438, 0xf605, 0xa438, 0xef02, 0xa438, 0x1f11, + 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4b02, 0xa438, 0x6e7d, + 0xa438, 0xef02, 0xa438, 0x1b03, 0xa438, 0x1f11, 0xa438, 0x0d42, + 0xa438, 0xbf88, 0xa438, 0x4e02, 0xa438, 0x6e7d, 0xa438, 0xef02, + 0xa438, 0x1a03, 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, + 0xa438, 0x5102, 0xa438, 0x6e7d, 0xa438, 0xef56, 0xa438, 0xd020, + 0xa438, 0x1f11, 0xa438, 0xbf88, 0xa438, 0x5402, 0xa438, 0x6e7d, + 0xa438, 0xbf88, 0xa438, 0x5702, 0xa438, 0x6e7d, 0xa438, 0xbf88, + 0xa438, 0x5a02, 0xa438, 0x6e7d, 0xa438, 0xe185, 0xa438, 0xa0ef, + 0xa438, 0x0348, 0xa438, 0x0a28, 0xa438, 0x05ef, 0xa438, 0x201b, + 0xa438, 0x01ad, 0xa438, 0x2735, 0xa438, 0x1f44, 0xa438, 0xe085, + 0xa438, 0x88e1, 0xa438, 0x8589, 0xa438, 0xbf88, 0xa438, 0x5d02, + 0xa438, 0x6e7d, 0xa438, 0xe085, 0xa438, 0x8ee1, 0xa438, 0x858f, + 0xa438, 0xbf88, 0xa438, 0x6002, 0xa438, 0x6e7d, 0xa438, 0xe085, + 0xa438, 0x94e1, 0xa438, 0x8595, 0xa438, 0xbf88, 0xa438, 0x6302, + 0xa438, 0x6e7d, 0xa438, 0xe085, 0xa438, 0x9ae1, 0xa438, 0x859b, + 0xa438, 0xbf88, 0xa438, 0x6602, 0xa438, 0x6e7d, 0xa438, 0xaf88, + 0xa438, 0x3cbf, 0xa438, 0x883f, 0xa438, 0x026e, 0xa438, 0x9cad, + 0xa438, 0x2835, 0xa438, 0x1f44, 0xa438, 0xe08f, 0xa438, 0xf8e1, + 0xa438, 0x8ff9, 0xa438, 0xbf88, 0xa438, 0x5d02, 0xa438, 0x6e7d, + 0xa438, 0xe08f, 0xa438, 0xfae1, 0xa438, 0x8ffb, 0xa438, 0xbf88, + 0xa438, 0x6002, 0xa438, 0x6e7d, 0xa438, 0xe08f, 0xa438, 0xfce1, + 0xa438, 0x8ffd, 0xa438, 0xbf88, 0xa438, 0x6302, 0xa438, 0x6e7d, + 0xa438, 0xe08f, 0xa438, 0xfee1, 0xa438, 0x8fff, 0xa438, 0xbf88, + 0xa438, 0x6602, 0xa438, 0x6e7d, 0xa438, 0xaf88, 0xa438, 0x3ce1, + 0xa438, 0x85a1, 0xa438, 0x1b21, 0xa438, 0xad37, 0xa438, 0x341f, + 0xa438, 0x44e0, 0xa438, 0x858a, 0xa438, 0xe185, 0xa438, 0x8bbf, + 0xa438, 0x885d, 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x8590, + 0xa438, 0xe185, 0xa438, 0x91bf, 0xa438, 0x8860, 0xa438, 0x026e, + 0xa438, 0x7de0, 0xa438, 0x8596, 0xa438, 0xe185, 0xa438, 0x97bf, + 0xa438, 0x8863, 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x859c, + 0xa438, 0xe185, 0xa438, 0x9dbf, 0xa438, 0x8866, 0xa438, 0x026e, + 0xa438, 0x7dae, 0xa438, 0x401f, 0xa438, 0x44e0, 0xa438, 0x858c, + 0xa438, 0xe185, 0xa438, 0x8dbf, 0xa438, 0x885d, 0xa438, 0x026e, + 0xa438, 0x7de0, 0xa438, 0x8592, 0xa438, 0xe185, 0xa438, 0x93bf, + 0xa438, 0x8860, 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x8598, + 0xa438, 0xe185, 0xa438, 0x99bf, 0xa438, 0x8863, 0xa438, 0x026e, + 0xa438, 0x7de0, 0xa438, 0x859e, 0xa438, 0xe185, 0xa438, 0x9fbf, + 0xa438, 0x8866, 0xa438, 0x026e, 0xa438, 0x7dae, 0xa438, 0x0ce1, + 0xa438, 0x85b3, 0xa438, 0x3904, 0xa438, 0xac2f, 0xa438, 0x04ee, + 0xa438, 0x85b3, 0xa438, 0x00af, 0xa438, 0x39d9, 0xa438, 0x22ac, + 0xa438, 0xeaf0, 0xa438, 0xacf6, 0xa438, 0xf0ac, 0xa438, 0xfaf0, + 0xa438, 0xacf8, 0xa438, 0xf0ac, 0xa438, 0xfcf0, 0xa438, 0xad00, + 0xa438, 0xf0ac, 0xa438, 0xfef0, 0xa438, 0xacf0, 0xa438, 0xf0ac, + 0xa438, 0xf4f0, 0xa438, 0xacf2, 0xa438, 0xf0ac, 0xa438, 0xb0f0, + 0xa438, 0xacae, 0xa438, 0xf0ac, 0xa438, 0xacf0, 0xa438, 0xacaa, + 0xa438, 0xa100, 0xa438, 0x0ce1, 0xa438, 0x8ff7, 0xa438, 0xbf88, + 0xa438, 0x8402, 0xa438, 0x6e7d, 0xa438, 0xaf26, 0xa438, 0xe9e1, + 0xa438, 0x8ff6, 0xa438, 0xbf88, 0xa438, 0x8402, 0xa438, 0x6e7d, + 0xa438, 0xaf26, 0xa438, 0xf520, 0xa438, 0xac86, 0xa438, 0xbf88, + 0xa438, 0x3f02, 0xa438, 0x6e9c, 0xa438, 0xad28, 0xa438, 0x03af, + 0xa438, 0x3324, 0xa438, 0xad38, 0xa438, 0x03af, 0xa438, 0x32e6, + 0xa438, 0xaf32, 0xa438, 0xfb00, 0xa436, 0xb87c, 0xa438, 0x8ff6, + 0xa436, 0xb87e, 0xa438, 0x0705, 0xa436, 0xb87c, 0xa438, 0x8ff8, + 0xa436, 0xb87e, 0xa438, 0x19cc, 0xa436, 0xb87c, 0xa438, 0x8ffa, + 0xa436, 0xb87e, 0xa438, 0x28e3, 0xa436, 0xb87c, 0xa438, 0x8ffc, + 0xa436, 0xb87e, 0xa438, 0x1047, 0xa436, 0xb87c, 0xa438, 0x8ffe, + 0xa436, 0xb87e, 0xa438, 0x0a45, 0xa436, 0xb85e, 0xa438, 0x271E, + 0xa436, 0xb860, 0xa438, 0x3846, 0xa436, 0xb862, 0xa438, 0x26E6, + 0xa436, 0xb864, 0xa438, 0x32E3, 0xa436, 0xb886, 0xa438, 0xffff, + 0xa436, 0xb888, 0xa438, 0xffff, 0xa436, 0xb88a, 0xa438, 0xffff, + 0xa436, 0xb88c, 0xa438, 0xffff, 0xa436, 0xb838, 0xa438, 0x000f, + 0xb820, 0x0010, 0xa436, 0x846e, 0xa438, 0xaf84, 0xa438, 0x86af, + 0xa438, 0x8690, 0xa438, 0xaf86, 0xa438, 0xa4af, 0xa438, 0x86a4, + 0xa438, 0xaf86, 0xa438, 0xa4af, 0xa438, 0x86a4, 0xa438, 0xaf86, + 0xa438, 0xa4af, 0xa438, 0x86a4, 0xa438, 0xee82, 0xa438, 0x5f00, + 0xa438, 0x0284, 0xa438, 0x90af, 0xa438, 0x0441, 0xa438, 0xf8e0, + 0xa438, 0x8ff3, 0xa438, 0xa000, 0xa438, 0x0502, 0xa438, 0x84a4, + 0xa438, 0xae06, 0xa438, 0xa001, 0xa438, 0x0302, 0xa438, 0x84c8, + 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef59, 0xa438, 0xe080, + 0xa438, 0x15ad, 0xa438, 0x2702, 0xa438, 0xae03, 0xa438, 0xaf84, + 0xa438, 0xc3bf, 0xa438, 0x53ca, 0xa438, 0x0252, 0xa438, 0xc8ad, + 0xa438, 0x2807, 0xa438, 0x0285, 0xa438, 0x2cee, 0xa438, 0x8ff3, + 0xa438, 0x01ef, 0xa438, 0x95fd, 0xa438, 0xfc04, 0xa438, 0xf8f9, + 0xa438, 0xfaef, 0xa438, 0x69bf, 0xa438, 0x53ca, 0xa438, 0x0252, + 0xa438, 0xc8ac, 0xa438, 0x2822, 0xa438, 0xd480, 0xa438, 0x00bf, + 0xa438, 0x8684, 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x8687, + 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x868a, 0xa438, 0x0252, + 0xa438, 0xa9bf, 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9ee, + 0xa438, 0x8ff3, 0xa438, 0x00af, 0xa438, 0x8526, 0xa438, 0xe08f, + 0xa438, 0xf4e1, 0xa438, 0x8ff5, 0xa438, 0xe28f, 0xa438, 0xf6e3, + 0xa438, 0x8ff7, 0xa438, 0x1b45, 0xa438, 0xac27, 0xa438, 0x0eee, + 0xa438, 0x8ff4, 0xa438, 0x00ee, 0xa438, 0x8ff5, 0xa438, 0x0002, + 0xa438, 0x852c, 0xa438, 0xaf85, 0xa438, 0x26e0, 0xa438, 0x8ff4, + 0xa438, 0xe18f, 0xa438, 0xf52c, 0xa438, 0x0001, 0xa438, 0xe48f, + 0xa438, 0xf4e5, 0xa438, 0x8ff5, 0xa438, 0xef96, 0xa438, 0xfefd, + 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef59, 0xa438, 0xbf53, + 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa18b, 0xa438, 0x02ae, + 0xa438, 0x03af, 0xa438, 0x85da, 0xa438, 0xbf57, 0xa438, 0x7202, + 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xf8e5, 0xa438, 0x8ff9, + 0xa438, 0xbf57, 0xa438, 0x7502, 0xa438, 0x52c8, 0xa438, 0xe48f, + 0xa438, 0xfae5, 0xa438, 0x8ffb, 0xa438, 0xbf57, 0xa438, 0x7802, + 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfce5, 0xa438, 0x8ffd, + 0xa438, 0xbf57, 0xa438, 0x7b02, 0xa438, 0x52c8, 0xa438, 0xe48f, + 0xa438, 0xfee5, 0xa438, 0x8fff, 0xa438, 0xbf57, 0xa438, 0x6c02, + 0xa438, 0x52c8, 0xa438, 0xa102, 0xa438, 0x13ee, 0xa438, 0x8ffc, + 0xa438, 0x80ee, 0xa438, 0x8ffd, 0xa438, 0x00ee, 0xa438, 0x8ffe, + 0xa438, 0x80ee, 0xa438, 0x8fff, 0xa438, 0x00af, 0xa438, 0x8599, + 0xa438, 0xa101, 0xa438, 0x0cbf, 0xa438, 0x534c, 0xa438, 0x0252, + 0xa438, 0xc8a1, 0xa438, 0x0303, 0xa438, 0xaf85, 0xa438, 0x77bf, + 0xa438, 0x5322, 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x8b02, + 0xa438, 0xae03, 0xa438, 0xaf86, 0xa438, 0x64e0, 0xa438, 0x8ff8, + 0xa438, 0xe18f, 0xa438, 0xf9bf, 0xa438, 0x8684, 0xa438, 0x0252, + 0xa438, 0xa9e0, 0xa438, 0x8ffa, 0xa438, 0xe18f, 0xa438, 0xfbbf, + 0xa438, 0x8687, 0xa438, 0x0252, 0xa438, 0xa9e0, 0xa438, 0x8ffc, + 0xa438, 0xe18f, 0xa438, 0xfdbf, 0xa438, 0x868a, 0xa438, 0x0252, + 0xa438, 0xa9e0, 0xa438, 0x8ffe, 0xa438, 0xe18f, 0xa438, 0xffbf, + 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9af, 0xa438, 0x867f, + 0xa438, 0xbf53, 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa144, + 0xa438, 0x3cbf, 0xa438, 0x547b, 0xa438, 0x0252, 0xa438, 0xc8e4, + 0xa438, 0x8ff8, 0xa438, 0xe58f, 0xa438, 0xf9bf, 0xa438, 0x547e, + 0xa438, 0x0252, 0xa438, 0xc8e4, 0xa438, 0x8ffa, 0xa438, 0xe58f, + 0xa438, 0xfbbf, 0xa438, 0x5481, 0xa438, 0x0252, 0xa438, 0xc8e4, + 0xa438, 0x8ffc, 0xa438, 0xe58f, 0xa438, 0xfdbf, 0xa438, 0x5484, + 0xa438, 0x0252, 0xa438, 0xc8e4, 0xa438, 0x8ffe, 0xa438, 0xe58f, + 0xa438, 0xffbf, 0xa438, 0x5322, 0xa438, 0x0252, 0xa438, 0xc8a1, + 0xa438, 0x4448, 0xa438, 0xaf85, 0xa438, 0xa7bf, 0xa438, 0x5322, + 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x313c, 0xa438, 0xbf54, + 0xa438, 0x7b02, 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xf8e5, + 0xa438, 0x8ff9, 0xa438, 0xbf54, 0xa438, 0x7e02, 0xa438, 0x52c8, + 0xa438, 0xe48f, 0xa438, 0xfae5, 0xa438, 0x8ffb, 0xa438, 0xbf54, + 0xa438, 0x8102, 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfce5, + 0xa438, 0x8ffd, 0xa438, 0xbf54, 0xa438, 0x8402, 0xa438, 0x52c8, + 0xa438, 0xe48f, 0xa438, 0xfee5, 0xa438, 0x8fff, 0xa438, 0xbf53, + 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa131, 0xa438, 0x03af, + 0xa438, 0x85a7, 0xa438, 0xd480, 0xa438, 0x00bf, 0xa438, 0x8684, + 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x8687, 0xa438, 0x0252, + 0xa438, 0xa9bf, 0xa438, 0x868a, 0xa438, 0x0252, 0xa438, 0xa9bf, + 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9ef, 0xa438, 0x95fd, + 0xa438, 0xfc04, 0xa438, 0xf0d1, 0xa438, 0x2af0, 0xa438, 0xd12c, + 0xa438, 0xf0d1, 0xa438, 0x44f0, 0xa438, 0xd146, 0xa438, 0xbf86, + 0xa438, 0xa102, 0xa438, 0x52c8, 0xa438, 0xbf86, 0xa438, 0xa102, + 0xa438, 0x52c8, 0xa438, 0xd101, 0xa438, 0xaf06, 0xa438, 0xa570, + 0xa438, 0xce42, 0xa436, 0xb818, 0xa438, 0x043d, 0xa436, 0xb81a, + 0xa438, 0x06a3, 0xa436, 0xb81c, 0xa438, 0xffff, 0xa436, 0xb81e, + 0xa438, 0xffff, 0xa436, 0xb850, 0xa438, 0xffff, 0xa436, 0xb852, + 0xa438, 0xffff, 0xa436, 0xb878, 0xa438, 0xffff, 0xa436, 0xb884, + 0xa438, 0xffff, 0xa436, 0xb832, 0xa438, 0x0003, 0xa436, 0x0000, + 0xa438, 0x0000, 0xa436, 0xB82E, 0xa438, 0x0000, 0xa436, 0x8024, + 0xa438, 0x0000, 0xa436, 0x801E, 0xa438, 0x0021, 0xb820, 0x0000, + 0xFFFF, 0xFFFF +}; + +static void +re_real_set_phy_mcu_8125b_1(struct re_softc *sc) +{ + re_set_phy_mcu_ram_code(sc, + phy_mcu_ram_code_8125b_1, + ARRAY_SIZE(phy_mcu_ram_code_8125b_1) + ); +} + +static void +re_set_phy_mcu_8125b_1(struct re_softc *sc) +{ + re_set_phy_mcu_patch_request(sc); + + re_real_set_phy_mcu_8125b_1(sc); + + re_clear_phy_mcu_patch_request(sc); +} + +static void +re_real_set_phy_mcu_8125b_2(struct re_softc *sc) +{ + re_set_phy_mcu_ram_code(sc, + phy_mcu_ram_code_8125b_2, + ARRAY_SIZE(phy_mcu_ram_code_8125b_2) + ); +} + +static void +re_set_phy_mcu_8125b_2(struct re_softc *sc) +{ + re_set_phy_mcu_patch_request(sc); + + re_real_set_phy_mcu_8125b_2(sc); + + re_clear_phy_mcu_patch_request(sc); +} + +static void re_init_hw_phy_mcu(struct re_softc *sc) +{ + if (re_hw_phy_mcu_code_ver_matched(sc)) return; + + switch (sc->re_type) { + case MACFG_36: + re_set_phy_mcu_8168e_1(sc); + break; + case MACFG_37: + re_set_phy_mcu_8168e_2(sc); + break; + case MACFG_38: + re_set_phy_mcu_8168evl_1(sc); + break; + case MACFG_39: + re_set_phy_mcu_8168evl_2(sc); + break; + case MACFG_50: + re_set_phy_mcu_8168f_1(sc); + break; + case MACFG_51: + re_set_phy_mcu_8168f_2(sc); + break; + case MACFG_52: + re_set_phy_mcu_8411_1(sc); + break; + case MACFG_56: + re_set_phy_mcu_8168g_1(sc); + break; + case MACFG_59: + re_set_phy_mcu_8168gu_2(sc); + break; + case MACFG_60: + re_set_phy_mcu_8411b_1(sc); + break; + case MACFG_61: + re_set_phy_mcu_8168ep_1(sc); + break; + case MACFG_67: + re_set_phy_mcu_8168ep_2(sc); + break; + case MACFG_68: + re_set_phy_mcu_8168h_1(sc); + break; + case MACFG_69: + re_set_phy_mcu_8168h_2(sc); + break; + case MACFG_74: + re_set_phy_mcu_8168h_3(sc); + break; + case MACFG_80: + re_set_phy_mcu_8125a_1(sc); + break; + case MACFG_81: + re_set_phy_mcu_8125a_2(sc); + break; + case MACFG_82: + re_set_phy_mcu_8125b_1(sc); + break; + case MACFG_83: + re_set_phy_mcu_8125b_2(sc); + break; + } + + re_write_hw_phy_mcu_code_ver(sc); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); +} + +static void re_set_hw_phy_before_init_phy_mcu(struct re_softc *sc) +{ + device_t dev = sc->dev; + u_int16_t PhyRegValue; + + switch (sc->re_type) { + case MACFG_82: + MP_RealWritePhyOcpRegWord(sc, 0xBF86, 0x9000); + + SetEthPhyOcpBit(sc, 0xC402, BIT_10); + ClearEthPhyOcpBit(sc, 0xC402, BIT_10); + + PhyRegValue = MP_RealReadPhyOcpRegWord(sc, 0xBF86); + PhyRegValue &= (BIT_1 | BIT_0); + if (PhyRegValue != 0) + device_printf(dev, "PHY watch dog not clear, value = 0x%x \n", PhyRegValue); + + MP_RealWritePhyOcpRegWord(sc, 0xBD86, 0x1010); + MP_RealWritePhyOcpRegWord(sc, 0xBD88, 0x1010); + + ClearAndSetEthPhyOcpBit(sc, + 0xBD4E, + BIT_11 | BIT_10, + BIT_11); + ClearAndSetEthPhyOcpBit(sc, + 0xBF46, + BIT_11 | BIT_10 | BIT_9 | BIT_8, + BIT_10 | BIT_9 | BIT_8); + break; + } +} + +static void re_hw_phy_config(struct re_softc *sc) +{ + u_int16_t Data, PhyRegValue, TmpUshort; + u_int32_t Data_u32; + u_int16_t dout_tapbin; + int i; + struct ifnet *ifp = RE_GET_IFNET(sc); + + switch (sc->re_type) { + case MACFG_59: + case MACFG_60: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + re_disable_ocp_phy_power_saving(sc); + break; + } + + if (HW_DASH_SUPPORT_TYPE_3(sc) && sc->HwPkgDet == 0x06) return; + + re_set_hw_phy_before_init_phy_mcu(sc); + + if (FALSE == re_phy_ram_code_check(sc)) { + re_set_phy_ram_code_check_fail_flag(sc); + return; + } + + re_init_hw_phy_mcu(sc); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (sc->re_type == MACFG_3) { + CSR_WRITE_1(sc, 0x82, CSR_READ_1(sc, 0x82)|BIT_0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0b, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0x006e); + MP_WritePhyUshort(sc, 0x08, 0x0708); + MP_WritePhyUshort(sc, 0x15, 0x4000); + MP_WritePhyUshort(sc, 0x18, 0x65c7); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x03, 0x00a1); + MP_WritePhyUshort(sc, 0x02, 0x0008); + MP_WritePhyUshort(sc, 0x01, 0x0120); + MP_WritePhyUshort(sc, 0x00, 0x1000); + MP_WritePhyUshort(sc, 0x04, 0x0800); + MP_WritePhyUshort(sc, 0x04, 0x0000); + + MP_WritePhyUshort(sc, 0x03, 0xff41); + MP_WritePhyUshort(sc, 0x02, 0xdf60); + MP_WritePhyUshort(sc, 0x01, 0x0140); + MP_WritePhyUshort(sc, 0x00, 0x0077); + MP_WritePhyUshort(sc, 0x04, 0x7800); + MP_WritePhyUshort(sc, 0x04, 0x7000); + + MP_WritePhyUshort(sc, 0x03, 0x802f); + MP_WritePhyUshort(sc, 0x02, 0x4f02); + MP_WritePhyUshort(sc, 0x01, 0x0409); + MP_WritePhyUshort(sc, 0x00, 0xf0f9); + MP_WritePhyUshort(sc, 0x04, 0x9800); + MP_WritePhyUshort(sc, 0x04, 0x9000); + + MP_WritePhyUshort(sc, 0x03, 0xdf01); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0xff95); + MP_WritePhyUshort(sc, 0x00, 0xba00); + MP_WritePhyUshort(sc, 0x04, 0xa800); + MP_WritePhyUshort(sc, 0x04, 0xa000); + + MP_WritePhyUshort(sc, 0x03, 0xff41); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0x0140); + MP_WritePhyUshort(sc, 0x00, 0x00bb); + MP_WritePhyUshort(sc, 0x04, 0xb800); + MP_WritePhyUshort(sc, 0x04, 0xb000); + + MP_WritePhyUshort(sc, 0x03, 0xdf41); + MP_WritePhyUshort(sc, 0x02, 0xdc60); + MP_WritePhyUshort(sc, 0x01, 0x6340); + MP_WritePhyUshort(sc, 0x00, 0x007d); + MP_WritePhyUshort(sc, 0x04, 0xd800); + MP_WritePhyUshort(sc, 0x04, 0xd000); + + MP_WritePhyUshort(sc, 0x03, 0xdf01); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0x100a); + MP_WritePhyUshort(sc, 0x00, 0xa0ff); + MP_WritePhyUshort(sc, 0x04, 0xf800); + MP_WritePhyUshort(sc, 0x04, 0xf000); + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x0b, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + + CSR_WRITE_1(sc, 0x82, 0x0d); + } else if (sc->re_type == MACFG_4) { + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x01, 0x90D0); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + // MP_WritePhyUshort(sc, 0x1e, 0x8c00); /* PHY link down with some Giga switch */ + } else if (sc->re_type == MACFG_5) { + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x04, 0x0000); + MP_WritePhyUshort(sc, 0x03, 0x00a1); + MP_WritePhyUshort(sc, 0x02, 0x0008); + MP_WritePhyUshort(sc, 0x01, 0x0120); + MP_WritePhyUshort(sc, 0x00, 0x1000); + MP_WritePhyUshort(sc, 0x04, 0x0800); + + MP_WritePhyUshort(sc, 0x04, 0x9000); + MP_WritePhyUshort(sc, 0x03, 0x802f); + MP_WritePhyUshort(sc, 0x02, 0x4f02); + MP_WritePhyUshort(sc, 0x01, 0x0409); + MP_WritePhyUshort(sc, 0x00, 0xf099); + MP_WritePhyUshort(sc, 0x04, 0x9800); + + MP_WritePhyUshort(sc, 0x04, 0xa000); + MP_WritePhyUshort(sc, 0x03, 0xdf01); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0xff95); + MP_WritePhyUshort(sc, 0x00, 0xba00); + MP_WritePhyUshort(sc, 0x04, 0xa800); + + MP_WritePhyUshort(sc, 0x04, 0xf000); + MP_WritePhyUshort(sc, 0x03, 0xdf01); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0x101a); + MP_WritePhyUshort(sc, 0x00, 0xa0ff); + MP_WritePhyUshort(sc, 0x04, 0xf800); + MP_WritePhyUshort(sc, 0x04, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x10, 0xf41b); + MP_WritePhyUshort(sc, 0x14, 0xfb54); + MP_WritePhyUshort(sc, 0x18, 0xf5c7); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x10, 0xf01b); + + } else if (sc->re_type == MACFG_6) { + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x04, 0x0000); + MP_WritePhyUshort(sc, 0x03, 0x00a1); + MP_WritePhyUshort(sc, 0x02, 0x0008); + MP_WritePhyUshort(sc, 0x01, 0x0120); + MP_WritePhyUshort(sc, 0x00, 0x1000); + MP_WritePhyUshort(sc, 0x04, 0x0800); + + MP_WritePhyUshort(sc, 0x04, 0x9000); + MP_WritePhyUshort(sc, 0x03, 0x802f); + MP_WritePhyUshort(sc, 0x02, 0x4f02); + MP_WritePhyUshort(sc, 0x01, 0x0409); + MP_WritePhyUshort(sc, 0x00, 0xf099); + MP_WritePhyUshort(sc, 0x04, 0x9800); + + MP_WritePhyUshort(sc, 0x04, 0xa000); + MP_WritePhyUshort(sc, 0x03, 0xdf01); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0xff95); + MP_WritePhyUshort(sc, 0x00, 0xba00); + MP_WritePhyUshort(sc, 0x04, 0xa800); + + MP_WritePhyUshort(sc, 0x04, 0xf000); + MP_WritePhyUshort(sc, 0x03, 0xdf01); + MP_WritePhyUshort(sc, 0x02, 0xdf20); + MP_WritePhyUshort(sc, 0x01, 0x101a); + MP_WritePhyUshort(sc, 0x00, 0xa0ff); + MP_WritePhyUshort(sc, 0x04, 0xf800); + MP_WritePhyUshort(sc, 0x04, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x0b, 0x8480); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x18, 0x67c7); + MP_WritePhyUshort(sc, 0x04, 0x2000); + MP_WritePhyUshort(sc, 0x03, 0x002f); + MP_WritePhyUshort(sc, 0x02, 0x4360); + MP_WritePhyUshort(sc, 0x01, 0x0109); + MP_WritePhyUshort(sc, 0x00, 0x3022); + MP_WritePhyUshort(sc, 0x04, 0x2800); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + } else if (sc->re_type == MACFG_14) { + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x11, MP_ReadPhyUshort(sc, 0x11) | 0x1000); + MP_WritePhyUshort(sc, 0x19, MP_ReadPhyUshort(sc, 0x19) | 0x2000); + MP_WritePhyUshort(sc, 0x10, MP_ReadPhyUshort(sc, 0x10) | 0x8000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x08, 0x441D); + MP_WritePhyUshort(sc, 0x01, 0x9100); + } else if (sc->re_type == MACFG_15) { + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x11, MP_ReadPhyUshort(sc, 0x11) | 0x1000); + MP_WritePhyUshort(sc, 0x19, MP_ReadPhyUshort(sc, 0x19) | 0x2000); + MP_WritePhyUshort(sc, 0x10, MP_ReadPhyUshort(sc, 0x10) | 0x8000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x08, 0x441D); + MP_WritePhyUshort(sc, 0x01, 0x9100); + } else if (sc->re_type == MACFG_17) { + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x11, MP_ReadPhyUshort(sc, 0x11) | 0x1000); + MP_WritePhyUshort(sc, 0x19, MP_ReadPhyUshort(sc, 0x19) | 0x2000); + MP_WritePhyUshort(sc, 0x10, MP_ReadPhyUshort(sc, 0x10) | 0x8000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + MP_WritePhyUshort(sc, 0x08, 0x441D); + + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else if (sc->re_type == MACFG_21) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0x94B0); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0x6096); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_22) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0x94B0); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0x6096); + } else if (sc->re_type == MACFG_23) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0x94B0); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0x6096); + } else if (sc->re_type == MACFG_24) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x12, 0x2300); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x16, 0x000A); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0xC096); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x00, 0x88DE); + MP_WritePhyUshort(sc, 0x01, 0x82B1); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x08, 0x9E30); + MP_WritePhyUshort(sc, 0x09, 0x01F0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0A, 0x5500); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x03, 0x7002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x14, MP_ReadPhyUshort(sc, 0x14) | BIT_5); + MP_WritePhyUshort(sc, 0x0d, MP_ReadPhyUshort(sc, 0x0d) | BIT_5); + } else if (sc->re_type == MACFG_25) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x12, 0x2300); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x16, 0x0F0A); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x00, 0x88DE); + MP_WritePhyUshort(sc, 0x01, 0x82B1); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0C, 0x7EB8); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x0761); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x03, 0x802F); + MP_WritePhyUshort(sc, 0x02, 0x4F02); + MP_WritePhyUshort(sc, 0x01, 0x0409); + MP_WritePhyUshort(sc, 0x00, 0xF099); + MP_WritePhyUshort(sc, 0x04, 0x9800); + MP_WritePhyUshort(sc, 0x04, 0x9000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x16, MP_ReadPhyUshort(sc, 0x16) | BIT_0); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x14, MP_ReadPhyUshort(sc, 0x14) | BIT_5); + MP_WritePhyUshort(sc, 0x0D, MP_ReadPhyUshort(sc, 0x0D) & ~BIT_5); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x1D, 0x3D98); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_26) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x12, 0x2300); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x16, 0x0F0A); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x00, 0x88DE); + MP_WritePhyUshort(sc, 0x01, 0x82B1); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0C, 0x7EB8); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x5461); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x5461); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x16, MP_ReadPhyUshort(sc, 0x16) | BIT_0); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x14, MP_ReadPhyUshort(sc, 0x14) | BIT_5); + MP_WritePhyUshort(sc, 0x0D, MP_ReadPhyUshort(sc, 0x0D) & ~BIT_5); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x1D, 0x3D98); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_27) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0d, MP_ReadPhyUshort(sc, 0x0d) | BIT_5); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x1D, 0x3D98); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x14, 0xCAA3); + MP_WritePhyUshort(sc, 0x1C, 0x000A); + MP_WritePhyUshort(sc, 0x18, 0x65D0); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x17, 0xB580); + MP_WritePhyUshort(sc, 0x18, 0xFF54); + MP_WritePhyUshort(sc, 0x19, 0x3954); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0D, 0x310C); + MP_WritePhyUshort(sc, 0x0E, 0x310C); + MP_WritePhyUshort(sc, 0x0F, 0x311C); + MP_WritePhyUshort(sc, 0x06, 0x0761); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x18, 0xFF55); + MP_WritePhyUshort(sc, 0x19, 0x3955); + MP_WritePhyUshort(sc, 0x18, 0xFF54); + MP_WritePhyUshort(sc, 0x19, 0x3954); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + } else if (sc->re_type == MACFG_28) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x14, MP_ReadPhyUshort(sc, 0x14) | BIT_5); + MP_WritePhyUshort(sc, 0x0d, MP_ReadPhyUshort(sc, 0x0d) | BIT_5); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x14, 0xCAA3); + MP_WritePhyUshort(sc, 0x1C, 0x000A); + MP_WritePhyUshort(sc, 0x18, 0x65D0); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x17, 0xB580); + MP_WritePhyUshort(sc, 0x18, 0xFF54); + MP_WritePhyUshort(sc, 0x19, 0x3954); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0D, 0x310C); + MP_WritePhyUshort(sc, 0x0E, 0x310C); + MP_WritePhyUshort(sc, 0x0F, 0x311C); + MP_WritePhyUshort(sc, 0x06, 0x0761); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x18, 0xFF55); + MP_WritePhyUshort(sc, 0x19, 0x3955); + MP_WritePhyUshort(sc, 0x18, 0xFF54); + MP_WritePhyUshort(sc, 0x19, 0x3954); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x16, MP_ReadPhyUshort(sc, 0x16) | BIT_0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_31) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0x4064); + MP_WritePhyUshort(sc, 0x07, 0x2863); + MP_WritePhyUshort(sc, 0x08, 0x059C); + MP_WritePhyUshort(sc, 0x09, 0x26B4); + MP_WritePhyUshort(sc, 0x0A, 0x6A19); + MP_WritePhyUshort(sc, 0x0B, 0xDCC8); + MP_WritePhyUshort(sc, 0x10, 0xF06D); + MP_WritePhyUshort(sc, 0x14, 0x7F68); + MP_WritePhyUshort(sc, 0x18, 0x7FD9); + MP_WritePhyUshort(sc, 0x1C, 0xF0FF); + MP_WritePhyUshort(sc, 0x1D, 0x3D9C); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0xF49F); + MP_WritePhyUshort(sc, 0x13, 0x070B); + MP_WritePhyUshort(sc, 0x1A, 0x05AD); + MP_WritePhyUshort(sc, 0x14, 0x94C0); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x0B) & 0xFF00; + Data |= 0x10; + MP_WritePhyUshort(sc, 0x0B, Data); + Data = MP_ReadPhyUshort(sc, 0x0C) & 0x00FF; + Data |= 0xA200; + MP_WritePhyUshort(sc, 0x0C, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x5561); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8332); + MP_WritePhyUshort(sc, 0x06, 0x5561); + + if (MP_ReadEfuse(sc, 0x01) == 0xb1) { + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x05, 0x669A); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8330); + MP_WritePhyUshort(sc, 0x06, 0x669A); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x0D); + if ((Data & 0x00FF) != 0x006C) { + Data &= 0xFF00; + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0065); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0066); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0067); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0068); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0069); + MP_WritePhyUshort(sc, 0x0D, Data | 0x006A); + MP_WritePhyUshort(sc, 0x0D, Data | 0x006B); + MP_WritePhyUshort(sc, 0x0D, Data | 0x006C); + } + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x05, 0x6662); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8330); + MP_WritePhyUshort(sc, 0x06, 0x6662); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x0D); + Data |= 0x300; + MP_WritePhyUshort(sc, 0x0D, Data); + Data = MP_ReadPhyUshort(sc, 0x0F); + Data |= 0x10; + MP_WritePhyUshort(sc, 0x0F, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x02); + Data &= ~0x600; + Data |= 0x100; + MP_WritePhyUshort(sc, 0x02, Data); + Data = MP_ReadPhyUshort(sc, 0x03); + Data &= ~0xE000; + MP_WritePhyUshort(sc, 0x03, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x001B); + if (MP_ReadPhyUshort(sc, 0x06) == 0xBF00) { + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaef); + MP_WritePhyUshort(sc, 0x06, 0x59ee); + MP_WritePhyUshort(sc, 0x06, 0xf8ea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xf8eb); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0xf87c); + MP_WritePhyUshort(sc, 0x06, 0xe1f8); + MP_WritePhyUshort(sc, 0x06, 0x7d59); + MP_WritePhyUshort(sc, 0x06, 0x0fef); + MP_WritePhyUshort(sc, 0x06, 0x0139); + MP_WritePhyUshort(sc, 0x06, 0x029e); + MP_WritePhyUshort(sc, 0x06, 0x06ef); + MP_WritePhyUshort(sc, 0x06, 0x1039); + MP_WritePhyUshort(sc, 0x06, 0x089f); + MP_WritePhyUshort(sc, 0x06, 0x2aee); + MP_WritePhyUshort(sc, 0x06, 0xf8ea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xf8eb); + MP_WritePhyUshort(sc, 0x06, 0x01e0); + MP_WritePhyUshort(sc, 0x06, 0xf87c); + MP_WritePhyUshort(sc, 0x06, 0xe1f8); + MP_WritePhyUshort(sc, 0x06, 0x7d58); + MP_WritePhyUshort(sc, 0x06, 0x409e); + MP_WritePhyUshort(sc, 0x06, 0x0f39); + MP_WritePhyUshort(sc, 0x06, 0x46aa); + MP_WritePhyUshort(sc, 0x06, 0x0bbf); + MP_WritePhyUshort(sc, 0x06, 0x8290); + MP_WritePhyUshort(sc, 0x06, 0xd682); + MP_WritePhyUshort(sc, 0x06, 0x9802); + MP_WritePhyUshort(sc, 0x06, 0x014f); + MP_WritePhyUshort(sc, 0x06, 0xae09); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0x98d6); + MP_WritePhyUshort(sc, 0x06, 0x82a0); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x4fef); + MP_WritePhyUshort(sc, 0x06, 0x95fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x05f8); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xeef8); + MP_WritePhyUshort(sc, 0x06, 0xea00); + MP_WritePhyUshort(sc, 0x06, 0xeef8); + MP_WritePhyUshort(sc, 0x06, 0xeb00); + MP_WritePhyUshort(sc, 0x06, 0xe2f8); + MP_WritePhyUshort(sc, 0x06, 0x7ce3); + MP_WritePhyUshort(sc, 0x06, 0xf87d); + MP_WritePhyUshort(sc, 0x06, 0xa511); + MP_WritePhyUshort(sc, 0x06, 0x1112); + MP_WritePhyUshort(sc, 0x06, 0xd240); + MP_WritePhyUshort(sc, 0x06, 0xd644); + MP_WritePhyUshort(sc, 0x06, 0x4402); + MP_WritePhyUshort(sc, 0x06, 0x8217); + MP_WritePhyUshort(sc, 0x06, 0xd2a0); + MP_WritePhyUshort(sc, 0x06, 0xd6aa); + MP_WritePhyUshort(sc, 0x06, 0xaa02); + MP_WritePhyUshort(sc, 0x06, 0x8217); + MP_WritePhyUshort(sc, 0x06, 0xae0f); + MP_WritePhyUshort(sc, 0x06, 0xa544); + MP_WritePhyUshort(sc, 0x06, 0x4402); + MP_WritePhyUshort(sc, 0x06, 0xae4d); + MP_WritePhyUshort(sc, 0x06, 0xa5aa); + MP_WritePhyUshort(sc, 0x06, 0xaa02); + MP_WritePhyUshort(sc, 0x06, 0xae47); + MP_WritePhyUshort(sc, 0x06, 0xaf82); + MP_WritePhyUshort(sc, 0x06, 0x13ee); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0x0fee); + MP_WritePhyUshort(sc, 0x06, 0x834c); + MP_WritePhyUshort(sc, 0x06, 0x0fee); + MP_WritePhyUshort(sc, 0x06, 0x834f); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8351); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x834a); + MP_WritePhyUshort(sc, 0x06, 0xffee); + MP_WritePhyUshort(sc, 0x06, 0x834b); + MP_WritePhyUshort(sc, 0x06, 0xffe0); + MP_WritePhyUshort(sc, 0x06, 0x8330); + MP_WritePhyUshort(sc, 0x06, 0xe183); + MP_WritePhyUshort(sc, 0x06, 0x3158); + MP_WritePhyUshort(sc, 0x06, 0xfee4); + MP_WritePhyUshort(sc, 0x06, 0xf88a); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x8be0); + MP_WritePhyUshort(sc, 0x06, 0x8332); + MP_WritePhyUshort(sc, 0x06, 0xe183); + MP_WritePhyUshort(sc, 0x06, 0x3359); + MP_WritePhyUshort(sc, 0x06, 0x0fe2); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0x0c24); + MP_WritePhyUshort(sc, 0x06, 0x5af0); + MP_WritePhyUshort(sc, 0x06, 0x1e12); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x8ce5); + MP_WritePhyUshort(sc, 0x06, 0xf88d); + MP_WritePhyUshort(sc, 0x06, 0xaf82); + MP_WritePhyUshort(sc, 0x06, 0x13e0); + MP_WritePhyUshort(sc, 0x06, 0x834f); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x834f); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x009f); + MP_WritePhyUshort(sc, 0x06, 0x0ae0); + MP_WritePhyUshort(sc, 0x06, 0x834f); + MP_WritePhyUshort(sc, 0x06, 0xa010); + MP_WritePhyUshort(sc, 0x06, 0xa5ee); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x01e0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7805); + MP_WritePhyUshort(sc, 0x06, 0x9e9a); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x049e); + MP_WritePhyUshort(sc, 0x06, 0x10e0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7803); + MP_WritePhyUshort(sc, 0x06, 0x9e0f); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x05ae); + MP_WritePhyUshort(sc, 0x06, 0x0caf); + MP_WritePhyUshort(sc, 0x06, 0x81f8); + MP_WritePhyUshort(sc, 0x06, 0xaf81); + MP_WritePhyUshort(sc, 0x06, 0xa3af); + MP_WritePhyUshort(sc, 0x06, 0x81dc); + MP_WritePhyUshort(sc, 0x06, 0xaf82); + MP_WritePhyUshort(sc, 0x06, 0x13ee); + MP_WritePhyUshort(sc, 0x06, 0x8348); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0x8349); + MP_WritePhyUshort(sc, 0x06, 0x00e0); + MP_WritePhyUshort(sc, 0x06, 0x8351); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x8351); + MP_WritePhyUshort(sc, 0x06, 0x5801); + MP_WritePhyUshort(sc, 0x06, 0x9fea); + MP_WritePhyUshort(sc, 0x06, 0xd000); + MP_WritePhyUshort(sc, 0x06, 0xd180); + MP_WritePhyUshort(sc, 0x06, 0x1f66); + MP_WritePhyUshort(sc, 0x06, 0xe2f8); + MP_WritePhyUshort(sc, 0x06, 0xeae3); + MP_WritePhyUshort(sc, 0x06, 0xf8eb); + MP_WritePhyUshort(sc, 0x06, 0x5af8); + MP_WritePhyUshort(sc, 0x06, 0x1e20); + MP_WritePhyUshort(sc, 0x06, 0xe6f8); + MP_WritePhyUshort(sc, 0x06, 0xeae5); + MP_WritePhyUshort(sc, 0x06, 0xf8eb); + MP_WritePhyUshort(sc, 0x06, 0xd302); + MP_WritePhyUshort(sc, 0x06, 0xb3fe); + MP_WritePhyUshort(sc, 0x06, 0xe2f8); + MP_WritePhyUshort(sc, 0x06, 0x7cef); + MP_WritePhyUshort(sc, 0x06, 0x325b); + MP_WritePhyUshort(sc, 0x06, 0x80e3); + MP_WritePhyUshort(sc, 0x06, 0xf87d); + MP_WritePhyUshort(sc, 0x06, 0x9e03); + MP_WritePhyUshort(sc, 0x06, 0x7dff); + MP_WritePhyUshort(sc, 0x06, 0xff0d); + MP_WritePhyUshort(sc, 0x06, 0x581c); + MP_WritePhyUshort(sc, 0x06, 0x551a); + MP_WritePhyUshort(sc, 0x06, 0x6511); + MP_WritePhyUshort(sc, 0x06, 0xa190); + MP_WritePhyUshort(sc, 0x06, 0xd3e2); + MP_WritePhyUshort(sc, 0x06, 0x8348); + MP_WritePhyUshort(sc, 0x06, 0xe383); + MP_WritePhyUshort(sc, 0x06, 0x491b); + MP_WritePhyUshort(sc, 0x06, 0x56ab); + MP_WritePhyUshort(sc, 0x06, 0x08ef); + MP_WritePhyUshort(sc, 0x06, 0x56e6); + MP_WritePhyUshort(sc, 0x06, 0x8348); + MP_WritePhyUshort(sc, 0x06, 0xe783); + MP_WritePhyUshort(sc, 0x06, 0x4910); + MP_WritePhyUshort(sc, 0x06, 0xd180); + MP_WritePhyUshort(sc, 0x06, 0x1f66); + MP_WritePhyUshort(sc, 0x06, 0xa004); + MP_WritePhyUshort(sc, 0x06, 0xb9e2); + MP_WritePhyUshort(sc, 0x06, 0x8348); + MP_WritePhyUshort(sc, 0x06, 0xe383); + MP_WritePhyUshort(sc, 0x06, 0x49ef); + MP_WritePhyUshort(sc, 0x06, 0x65e2); + MP_WritePhyUshort(sc, 0x06, 0x834a); + MP_WritePhyUshort(sc, 0x06, 0xe383); + MP_WritePhyUshort(sc, 0x06, 0x4b1b); + MP_WritePhyUshort(sc, 0x06, 0x56aa); + MP_WritePhyUshort(sc, 0x06, 0x0eef); + MP_WritePhyUshort(sc, 0x06, 0x56e6); + MP_WritePhyUshort(sc, 0x06, 0x834a); + MP_WritePhyUshort(sc, 0x06, 0xe783); + MP_WritePhyUshort(sc, 0x06, 0x4be2); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0xe683); + MP_WritePhyUshort(sc, 0x06, 0x4ce0); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0xa000); + MP_WritePhyUshort(sc, 0x06, 0x0caf); + MP_WritePhyUshort(sc, 0x06, 0x81dc); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4d10); + MP_WritePhyUshort(sc, 0x06, 0xe483); + MP_WritePhyUshort(sc, 0x06, 0x4dae); + MP_WritePhyUshort(sc, 0x06, 0x0480); + MP_WritePhyUshort(sc, 0x06, 0xe483); + MP_WritePhyUshort(sc, 0x06, 0x4de0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7803); + MP_WritePhyUshort(sc, 0x06, 0x9e0b); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x049e); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x02e0); + MP_WritePhyUshort(sc, 0x06, 0x8332); + MP_WritePhyUshort(sc, 0x06, 0xe183); + MP_WritePhyUshort(sc, 0x06, 0x3359); + MP_WritePhyUshort(sc, 0x06, 0x0fe2); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0x0c24); + MP_WritePhyUshort(sc, 0x06, 0x5af0); + MP_WritePhyUshort(sc, 0x06, 0x1e12); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x8ce5); + MP_WritePhyUshort(sc, 0x06, 0xf88d); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x30e1); + MP_WritePhyUshort(sc, 0x06, 0x8331); + MP_WritePhyUshort(sc, 0x06, 0x6801); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x8ae5); + MP_WritePhyUshort(sc, 0x06, 0xf88b); + MP_WritePhyUshort(sc, 0x06, 0xae37); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4e03); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4ce1); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0x1b01); + MP_WritePhyUshort(sc, 0x06, 0x9e04); + MP_WritePhyUshort(sc, 0x06, 0xaaa1); + MP_WritePhyUshort(sc, 0x06, 0xaea8); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4e04); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4f00); + MP_WritePhyUshort(sc, 0x06, 0xaeab); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4f78); + MP_WritePhyUshort(sc, 0x06, 0x039f); + MP_WritePhyUshort(sc, 0x06, 0x14ee); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x05d2); + MP_WritePhyUshort(sc, 0x06, 0x40d6); + MP_WritePhyUshort(sc, 0x06, 0x5554); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x17d2); + MP_WritePhyUshort(sc, 0x06, 0xa0d6); + MP_WritePhyUshort(sc, 0x06, 0xba00); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x17fe); + MP_WritePhyUshort(sc, 0x06, 0xfdfc); + MP_WritePhyUshort(sc, 0x06, 0x05f8); + MP_WritePhyUshort(sc, 0x06, 0xe0f8); + MP_WritePhyUshort(sc, 0x06, 0x60e1); + MP_WritePhyUshort(sc, 0x06, 0xf861); + MP_WritePhyUshort(sc, 0x06, 0x6802); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x60e5); + MP_WritePhyUshort(sc, 0x06, 0xf861); + MP_WritePhyUshort(sc, 0x06, 0xe0f8); + MP_WritePhyUshort(sc, 0x06, 0x48e1); + MP_WritePhyUshort(sc, 0x06, 0xf849); + MP_WritePhyUshort(sc, 0x06, 0x580f); + MP_WritePhyUshort(sc, 0x06, 0x1e02); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x48e5); + MP_WritePhyUshort(sc, 0x06, 0xf849); + MP_WritePhyUshort(sc, 0x06, 0xd000); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x5bbf); + MP_WritePhyUshort(sc, 0x06, 0x8350); + MP_WritePhyUshort(sc, 0x06, 0xef46); + MP_WritePhyUshort(sc, 0x06, 0xdc19); + MP_WritePhyUshort(sc, 0x06, 0xddd0); + MP_WritePhyUshort(sc, 0x06, 0x0102); + MP_WritePhyUshort(sc, 0x06, 0x825b); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x77e0); + MP_WritePhyUshort(sc, 0x06, 0xf860); + MP_WritePhyUshort(sc, 0x06, 0xe1f8); + MP_WritePhyUshort(sc, 0x06, 0x6158); + MP_WritePhyUshort(sc, 0x06, 0xfde4); + MP_WritePhyUshort(sc, 0x06, 0xf860); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x61fc); + MP_WritePhyUshort(sc, 0x06, 0x04f9); + MP_WritePhyUshort(sc, 0x06, 0xfafb); + MP_WritePhyUshort(sc, 0x06, 0xc6bf); + MP_WritePhyUshort(sc, 0x06, 0xf840); + MP_WritePhyUshort(sc, 0x06, 0xbe83); + MP_WritePhyUshort(sc, 0x06, 0x50a0); + MP_WritePhyUshort(sc, 0x06, 0x0101); + MP_WritePhyUshort(sc, 0x06, 0x071b); + MP_WritePhyUshort(sc, 0x06, 0x89cf); + MP_WritePhyUshort(sc, 0x06, 0xd208); + MP_WritePhyUshort(sc, 0x06, 0xebdb); + MP_WritePhyUshort(sc, 0x06, 0x19b2); + MP_WritePhyUshort(sc, 0x06, 0xfbff); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0x04f8); + MP_WritePhyUshort(sc, 0x06, 0xe0f8); + MP_WritePhyUshort(sc, 0x06, 0x48e1); + MP_WritePhyUshort(sc, 0x06, 0xf849); + MP_WritePhyUshort(sc, 0x06, 0x6808); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x48e5); + MP_WritePhyUshort(sc, 0x06, 0xf849); + MP_WritePhyUshort(sc, 0x06, 0x58f7); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x48e5); + MP_WritePhyUshort(sc, 0x06, 0xf849); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0x4d20); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x4e22); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x4ddf); + MP_WritePhyUshort(sc, 0x06, 0xff01); + MP_WritePhyUshort(sc, 0x06, 0x4edd); + MP_WritePhyUshort(sc, 0x06, 0xff01); + MP_WritePhyUshort(sc, 0x06, 0xf8fa); + MP_WritePhyUshort(sc, 0x06, 0xfbef); + MP_WritePhyUshort(sc, 0x06, 0x79bf); + MP_WritePhyUshort(sc, 0x06, 0xf822); + MP_WritePhyUshort(sc, 0x06, 0xd819); + MP_WritePhyUshort(sc, 0x06, 0xd958); + MP_WritePhyUshort(sc, 0x06, 0x849f); + MP_WritePhyUshort(sc, 0x06, 0x09bf); + MP_WritePhyUshort(sc, 0x06, 0x82be); + MP_WritePhyUshort(sc, 0x06, 0xd682); + MP_WritePhyUshort(sc, 0x06, 0xc602); + MP_WritePhyUshort(sc, 0x06, 0x014f); + MP_WritePhyUshort(sc, 0x06, 0xef97); + MP_WritePhyUshort(sc, 0x06, 0xfffe); + MP_WritePhyUshort(sc, 0x06, 0xfc05); + MP_WritePhyUshort(sc, 0x06, 0x17ff); + MP_WritePhyUshort(sc, 0x06, 0xfe01); + MP_WritePhyUshort(sc, 0x06, 0x1700); + MP_WritePhyUshort(sc, 0x06, 0x0102); + MP_WritePhyUshort(sc, 0x05, 0x83d8); + MP_WritePhyUshort(sc, 0x06, 0x8051); + MP_WritePhyUshort(sc, 0x05, 0x83d6); + MP_WritePhyUshort(sc, 0x06, 0x82a0); + MP_WritePhyUshort(sc, 0x05, 0x83d4); + MP_WritePhyUshort(sc, 0x06, 0x8000); + MP_WritePhyUshort(sc, 0x02, 0x2010); + MP_WritePhyUshort(sc, 0x03, 0xdc00); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x0b, 0x0600); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00fc); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0xF880); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_32) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0x4064); + MP_WritePhyUshort(sc, 0x07, 0x2863); + MP_WritePhyUshort(sc, 0x08, 0x059C); + MP_WritePhyUshort(sc, 0x09, 0x26B4); + MP_WritePhyUshort(sc, 0x0A, 0x6A19); + MP_WritePhyUshort(sc, 0x0B, 0xBCC0); + MP_WritePhyUshort(sc, 0x10, 0xF06D); + MP_WritePhyUshort(sc, 0x14, 0x7F68); + MP_WritePhyUshort(sc, 0x18, 0x7FD9); + MP_WritePhyUshort(sc, 0x1C, 0xF0FF); + MP_WritePhyUshort(sc, 0x1D, 0x3D9C); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0xF49F); + MP_WritePhyUshort(sc, 0x13, 0x070B); + MP_WritePhyUshort(sc, 0x1A, 0x05AD); + MP_WritePhyUshort(sc, 0x14, 0x94C0); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x5571); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x05, 0x2642); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x02, 0xC107); + MP_WritePhyUshort(sc, 0x03, 0x1002); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x16, 0x0CC0); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0F, 0x0017); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8200); + MP_WritePhyUshort(sc, 0x06, 0xF8F9); + MP_WritePhyUshort(sc, 0x06, 0xFAEF); + MP_WritePhyUshort(sc, 0x06, 0x59EE); + MP_WritePhyUshort(sc, 0x06, 0xF8EA); + MP_WritePhyUshort(sc, 0x06, 0x00EE); + MP_WritePhyUshort(sc, 0x06, 0xF8EB); + MP_WritePhyUshort(sc, 0x06, 0x00E0); + MP_WritePhyUshort(sc, 0x06, 0xF87C); + MP_WritePhyUshort(sc, 0x06, 0xE1F8); + MP_WritePhyUshort(sc, 0x06, 0x7D59); + MP_WritePhyUshort(sc, 0x06, 0x0FEF); + MP_WritePhyUshort(sc, 0x06, 0x0139); + MP_WritePhyUshort(sc, 0x06, 0x029E); + MP_WritePhyUshort(sc, 0x06, 0x06EF); + MP_WritePhyUshort(sc, 0x06, 0x1039); + MP_WritePhyUshort(sc, 0x06, 0x089F); + MP_WritePhyUshort(sc, 0x06, 0x2AEE); + MP_WritePhyUshort(sc, 0x06, 0xF8EA); + MP_WritePhyUshort(sc, 0x06, 0x00EE); + MP_WritePhyUshort(sc, 0x06, 0xF8EB); + MP_WritePhyUshort(sc, 0x06, 0x01E0); + MP_WritePhyUshort(sc, 0x06, 0xF87C); + MP_WritePhyUshort(sc, 0x06, 0xE1F8); + MP_WritePhyUshort(sc, 0x06, 0x7D58); + MP_WritePhyUshort(sc, 0x06, 0x409E); + MP_WritePhyUshort(sc, 0x06, 0x0F39); + MP_WritePhyUshort(sc, 0x06, 0x46AA); + MP_WritePhyUshort(sc, 0x06, 0x0BBF); + MP_WritePhyUshort(sc, 0x06, 0x8251); + MP_WritePhyUshort(sc, 0x06, 0xD682); + MP_WritePhyUshort(sc, 0x06, 0x5902); + MP_WritePhyUshort(sc, 0x06, 0x014F); + MP_WritePhyUshort(sc, 0x06, 0xAE09); + MP_WritePhyUshort(sc, 0x06, 0xBF82); + MP_WritePhyUshort(sc, 0x06, 0x59D6); + MP_WritePhyUshort(sc, 0x06, 0x8261); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x4FEF); + MP_WritePhyUshort(sc, 0x06, 0x95FE); + MP_WritePhyUshort(sc, 0x06, 0xFDFC); + MP_WritePhyUshort(sc, 0x06, 0x054D); + MP_WritePhyUshort(sc, 0x06, 0x2000); + MP_WritePhyUshort(sc, 0x06, 0x024E); + MP_WritePhyUshort(sc, 0x06, 0x2200); + MP_WritePhyUshort(sc, 0x06, 0x024D); + MP_WritePhyUshort(sc, 0x06, 0xDFFF); + MP_WritePhyUshort(sc, 0x06, 0x014E); + MP_WritePhyUshort(sc, 0x06, 0xDDFF); + MP_WritePhyUshort(sc, 0x06, 0x0100); + MP_WritePhyUshort(sc, 0x02, 0x6010); + MP_WritePhyUshort(sc, 0x05, 0xFFF6); + MP_WritePhyUshort(sc, 0x06, 0x00EC); + MP_WritePhyUshort(sc, 0x05, 0x83D4); + MP_WritePhyUshort(sc, 0x06, 0x8200); + + } else if (sc->re_type == MACFG_33) { + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0x4064); + MP_WritePhyUshort(sc, 0x07, 0x2863); + MP_WritePhyUshort(sc, 0x08, 0x059C); + MP_WritePhyUshort(sc, 0x09, 0x26B4); + MP_WritePhyUshort(sc, 0x0A, 0x6A19); + MP_WritePhyUshort(sc, 0x0B, 0xDCC8); + MP_WritePhyUshort(sc, 0x10, 0xF06D); + MP_WritePhyUshort(sc, 0x14, 0x7F68); + MP_WritePhyUshort(sc, 0x18, 0x7FD9); + MP_WritePhyUshort(sc, 0x1C, 0xF0FF); + MP_WritePhyUshort(sc, 0x1D, 0x3D9C); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x12, 0xF49F); + MP_WritePhyUshort(sc, 0x13, 0x070B); + MP_WritePhyUshort(sc, 0x1A, 0x05AD); + MP_WritePhyUshort(sc, 0x14, 0x94C0); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x5561); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8332); + MP_WritePhyUshort(sc, 0x06, 0x5561); + + if (MP_ReadEfuse(sc, 0x01) == 0xb1) { + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x05, 0x669A); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8330); + MP_WritePhyUshort(sc, 0x06, 0x669A); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x0D); + if ((Data & 0x00FF) != 0x006C) { + Data &= 0xFF00; + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0065); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0066); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0067); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0068); + MP_WritePhyUshort(sc, 0x0D, Data | 0x0069); + MP_WritePhyUshort(sc, 0x0D, Data | 0x006A); + MP_WritePhyUshort(sc, 0x0D, Data | 0x006B); + MP_WritePhyUshort(sc, 0x0D, Data | 0x006C); + } + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x05, 0x2642); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8330); + MP_WritePhyUshort(sc, 0x06, 0x2642); + } + + if (MP_ReadEfuse(sc, 0x30) == 0x98) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x11, MP_ReadPhyUshort(sc, 0x11) & ~0x02); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x01, MP_ReadPhyUshort(sc, 0x01) | 0x200); + } else if (MP_ReadEfuse(sc, 0x30) == 0x90) { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x01, MP_ReadPhyUshort(sc, 0x01) & ~0x200); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x16, 0x5101); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x02); + Data &= ~0x600; + Data |= 0x100; + MP_WritePhyUshort(sc, 0x02, Data); + Data = MP_ReadPhyUshort(sc, 0x03); + Data &= ~0xE000; + MP_WritePhyUshort(sc, 0x03, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0CC0); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x0F); + Data |= 0x17; + MP_WritePhyUshort(sc, 0x0F, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x001B); + if (MP_ReadPhyUshort(sc, 0x06) == 0xB300) { + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x0080); + MP_WritePhyUshort(sc, 0x05, 0x8000); + MP_WritePhyUshort(sc, 0x06, 0xf8f9); + MP_WritePhyUshort(sc, 0x06, 0xfaee); + MP_WritePhyUshort(sc, 0x06, 0xf8ea); + MP_WritePhyUshort(sc, 0x06, 0x00ee); + MP_WritePhyUshort(sc, 0x06, 0xf8eb); + MP_WritePhyUshort(sc, 0x06, 0x00e2); + MP_WritePhyUshort(sc, 0x06, 0xf87c); + MP_WritePhyUshort(sc, 0x06, 0xe3f8); + MP_WritePhyUshort(sc, 0x06, 0x7da5); + MP_WritePhyUshort(sc, 0x06, 0x1111); + MP_WritePhyUshort(sc, 0x06, 0x12d2); + MP_WritePhyUshort(sc, 0x06, 0x40d6); + MP_WritePhyUshort(sc, 0x06, 0x4444); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xc6d2); + MP_WritePhyUshort(sc, 0x06, 0xa0d6); + MP_WritePhyUshort(sc, 0x06, 0xaaaa); + MP_WritePhyUshort(sc, 0x06, 0x0281); + MP_WritePhyUshort(sc, 0x06, 0xc6ae); + MP_WritePhyUshort(sc, 0x06, 0x0fa5); + MP_WritePhyUshort(sc, 0x06, 0x4444); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x4da5); + MP_WritePhyUshort(sc, 0x06, 0xaaaa); + MP_WritePhyUshort(sc, 0x06, 0x02ae); + MP_WritePhyUshort(sc, 0x06, 0x47af); + MP_WritePhyUshort(sc, 0x06, 0x81c2); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4e00); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4d0f); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4c0f); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4f00); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x5100); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4aff); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4bff); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x30e1); + MP_WritePhyUshort(sc, 0x06, 0x8331); + MP_WritePhyUshort(sc, 0x06, 0x58fe); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x8ae5); + MP_WritePhyUshort(sc, 0x06, 0xf88b); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x32e1); + MP_WritePhyUshort(sc, 0x06, 0x8333); + MP_WritePhyUshort(sc, 0x06, 0x590f); + MP_WritePhyUshort(sc, 0x06, 0xe283); + MP_WritePhyUshort(sc, 0x06, 0x4d0c); + MP_WritePhyUshort(sc, 0x06, 0x245a); + MP_WritePhyUshort(sc, 0x06, 0xf01e); + MP_WritePhyUshort(sc, 0x06, 0x12e4); + MP_WritePhyUshort(sc, 0x06, 0xf88c); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x8daf); + MP_WritePhyUshort(sc, 0x06, 0x81c2); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4f10); + MP_WritePhyUshort(sc, 0x06, 0xe483); + MP_WritePhyUshort(sc, 0x06, 0x4fe0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7800); + MP_WritePhyUshort(sc, 0x06, 0x9f0a); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4fa0); + MP_WritePhyUshort(sc, 0x06, 0x10a5); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4e01); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x059e); + MP_WritePhyUshort(sc, 0x06, 0x9ae0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7804); + MP_WritePhyUshort(sc, 0x06, 0x9e10); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x0fe0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7801); + MP_WritePhyUshort(sc, 0x06, 0x9e05); + MP_WritePhyUshort(sc, 0x06, 0xae0c); + MP_WritePhyUshort(sc, 0x06, 0xaf81); + MP_WritePhyUshort(sc, 0x06, 0xa7af); + MP_WritePhyUshort(sc, 0x06, 0x8152); + MP_WritePhyUshort(sc, 0x06, 0xaf81); + MP_WritePhyUshort(sc, 0x06, 0x8baf); + MP_WritePhyUshort(sc, 0x06, 0x81c2); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4800); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4900); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x5110); + MP_WritePhyUshort(sc, 0x06, 0xe483); + MP_WritePhyUshort(sc, 0x06, 0x5158); + MP_WritePhyUshort(sc, 0x06, 0x019f); + MP_WritePhyUshort(sc, 0x06, 0xead0); + MP_WritePhyUshort(sc, 0x06, 0x00d1); + MP_WritePhyUshort(sc, 0x06, 0x801f); + MP_WritePhyUshort(sc, 0x06, 0x66e2); + MP_WritePhyUshort(sc, 0x06, 0xf8ea); + MP_WritePhyUshort(sc, 0x06, 0xe3f8); + MP_WritePhyUshort(sc, 0x06, 0xeb5a); + MP_WritePhyUshort(sc, 0x06, 0xf81e); + MP_WritePhyUshort(sc, 0x06, 0x20e6); + MP_WritePhyUshort(sc, 0x06, 0xf8ea); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0xebd3); + MP_WritePhyUshort(sc, 0x06, 0x02b3); + MP_WritePhyUshort(sc, 0x06, 0xfee2); + MP_WritePhyUshort(sc, 0x06, 0xf87c); + MP_WritePhyUshort(sc, 0x06, 0xef32); + MP_WritePhyUshort(sc, 0x06, 0x5b80); + MP_WritePhyUshort(sc, 0x06, 0xe3f8); + MP_WritePhyUshort(sc, 0x06, 0x7d9e); + MP_WritePhyUshort(sc, 0x06, 0x037d); + MP_WritePhyUshort(sc, 0x06, 0xffff); + MP_WritePhyUshort(sc, 0x06, 0x0d58); + MP_WritePhyUshort(sc, 0x06, 0x1c55); + MP_WritePhyUshort(sc, 0x06, 0x1a65); + MP_WritePhyUshort(sc, 0x06, 0x11a1); + MP_WritePhyUshort(sc, 0x06, 0x90d3); + MP_WritePhyUshort(sc, 0x06, 0xe283); + MP_WritePhyUshort(sc, 0x06, 0x48e3); + MP_WritePhyUshort(sc, 0x06, 0x8349); + MP_WritePhyUshort(sc, 0x06, 0x1b56); + MP_WritePhyUshort(sc, 0x06, 0xab08); + MP_WritePhyUshort(sc, 0x06, 0xef56); + MP_WritePhyUshort(sc, 0x06, 0xe683); + MP_WritePhyUshort(sc, 0x06, 0x48e7); + MP_WritePhyUshort(sc, 0x06, 0x8349); + MP_WritePhyUshort(sc, 0x06, 0x10d1); + MP_WritePhyUshort(sc, 0x06, 0x801f); + MP_WritePhyUshort(sc, 0x06, 0x66a0); + MP_WritePhyUshort(sc, 0x06, 0x04b9); + MP_WritePhyUshort(sc, 0x06, 0xe283); + MP_WritePhyUshort(sc, 0x06, 0x48e3); + MP_WritePhyUshort(sc, 0x06, 0x8349); + MP_WritePhyUshort(sc, 0x06, 0xef65); + MP_WritePhyUshort(sc, 0x06, 0xe283); + MP_WritePhyUshort(sc, 0x06, 0x4ae3); + MP_WritePhyUshort(sc, 0x06, 0x834b); + MP_WritePhyUshort(sc, 0x06, 0x1b56); + MP_WritePhyUshort(sc, 0x06, 0xaa0e); + MP_WritePhyUshort(sc, 0x06, 0xef56); + MP_WritePhyUshort(sc, 0x06, 0xe683); + MP_WritePhyUshort(sc, 0x06, 0x4ae7); + MP_WritePhyUshort(sc, 0x06, 0x834b); + MP_WritePhyUshort(sc, 0x06, 0xe283); + MP_WritePhyUshort(sc, 0x06, 0x4de6); + MP_WritePhyUshort(sc, 0x06, 0x834c); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4da0); + MP_WritePhyUshort(sc, 0x06, 0x000c); + MP_WritePhyUshort(sc, 0x06, 0xaf81); + MP_WritePhyUshort(sc, 0x06, 0x8be0); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0x10e4); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0xae04); + MP_WritePhyUshort(sc, 0x06, 0x80e4); + MP_WritePhyUshort(sc, 0x06, 0x834d); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x4e78); + MP_WritePhyUshort(sc, 0x06, 0x039e); + MP_WritePhyUshort(sc, 0x06, 0x0be0); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x7804); + MP_WritePhyUshort(sc, 0x06, 0x9e04); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4e02); + MP_WritePhyUshort(sc, 0x06, 0xe083); + MP_WritePhyUshort(sc, 0x06, 0x32e1); + MP_WritePhyUshort(sc, 0x06, 0x8333); + MP_WritePhyUshort(sc, 0x06, 0x590f); + MP_WritePhyUshort(sc, 0x06, 0xe283); + MP_WritePhyUshort(sc, 0x06, 0x4d0c); + MP_WritePhyUshort(sc, 0x06, 0x245a); + MP_WritePhyUshort(sc, 0x06, 0xf01e); + MP_WritePhyUshort(sc, 0x06, 0x12e4); + MP_WritePhyUshort(sc, 0x06, 0xf88c); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x8de0); + MP_WritePhyUshort(sc, 0x06, 0x8330); + MP_WritePhyUshort(sc, 0x06, 0xe183); + MP_WritePhyUshort(sc, 0x06, 0x3168); + MP_WritePhyUshort(sc, 0x06, 0x01e4); + MP_WritePhyUshort(sc, 0x06, 0xf88a); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x8bae); + MP_WritePhyUshort(sc, 0x06, 0x37ee); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x03e0); + MP_WritePhyUshort(sc, 0x06, 0x834c); + MP_WritePhyUshort(sc, 0x06, 0xe183); + MP_WritePhyUshort(sc, 0x06, 0x4d1b); + MP_WritePhyUshort(sc, 0x06, 0x019e); + MP_WritePhyUshort(sc, 0x06, 0x04aa); + MP_WritePhyUshort(sc, 0x06, 0xa1ae); + MP_WritePhyUshort(sc, 0x06, 0xa8ee); + MP_WritePhyUshort(sc, 0x06, 0x834e); + MP_WritePhyUshort(sc, 0x06, 0x04ee); + MP_WritePhyUshort(sc, 0x06, 0x834f); + MP_WritePhyUshort(sc, 0x06, 0x00ae); + MP_WritePhyUshort(sc, 0x06, 0xabe0); + MP_WritePhyUshort(sc, 0x06, 0x834f); + MP_WritePhyUshort(sc, 0x06, 0x7803); + MP_WritePhyUshort(sc, 0x06, 0x9f14); + MP_WritePhyUshort(sc, 0x06, 0xee83); + MP_WritePhyUshort(sc, 0x06, 0x4e05); + MP_WritePhyUshort(sc, 0x06, 0xd240); + MP_WritePhyUshort(sc, 0x06, 0xd655); + MP_WritePhyUshort(sc, 0x06, 0x5402); + MP_WritePhyUshort(sc, 0x06, 0x81c6); + MP_WritePhyUshort(sc, 0x06, 0xd2a0); + MP_WritePhyUshort(sc, 0x06, 0xd6ba); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x81c6); + MP_WritePhyUshort(sc, 0x06, 0xfefd); + MP_WritePhyUshort(sc, 0x06, 0xfc05); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0xf860); + MP_WritePhyUshort(sc, 0x06, 0xe1f8); + MP_WritePhyUshort(sc, 0x06, 0x6168); + MP_WritePhyUshort(sc, 0x06, 0x02e4); + MP_WritePhyUshort(sc, 0x06, 0xf860); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x61e0); + MP_WritePhyUshort(sc, 0x06, 0xf848); + MP_WritePhyUshort(sc, 0x06, 0xe1f8); + MP_WritePhyUshort(sc, 0x06, 0x4958); + MP_WritePhyUshort(sc, 0x06, 0x0f1e); + MP_WritePhyUshort(sc, 0x06, 0x02e4); + MP_WritePhyUshort(sc, 0x06, 0xf848); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x49d0); + MP_WritePhyUshort(sc, 0x06, 0x0002); + MP_WritePhyUshort(sc, 0x06, 0x820a); + MP_WritePhyUshort(sc, 0x06, 0xbf83); + MP_WritePhyUshort(sc, 0x06, 0x50ef); + MP_WritePhyUshort(sc, 0x06, 0x46dc); + MP_WritePhyUshort(sc, 0x06, 0x19dd); + MP_WritePhyUshort(sc, 0x06, 0xd001); + MP_WritePhyUshort(sc, 0x06, 0x0282); + MP_WritePhyUshort(sc, 0x06, 0x0a02); + MP_WritePhyUshort(sc, 0x06, 0x8226); + MP_WritePhyUshort(sc, 0x06, 0xe0f8); + MP_WritePhyUshort(sc, 0x06, 0x60e1); + MP_WritePhyUshort(sc, 0x06, 0xf861); + MP_WritePhyUshort(sc, 0x06, 0x58fd); + MP_WritePhyUshort(sc, 0x06, 0xe4f8); + MP_WritePhyUshort(sc, 0x06, 0x60e5); + MP_WritePhyUshort(sc, 0x06, 0xf861); + MP_WritePhyUshort(sc, 0x06, 0xfc04); + MP_WritePhyUshort(sc, 0x06, 0xf9fa); + MP_WritePhyUshort(sc, 0x06, 0xfbc6); + MP_WritePhyUshort(sc, 0x06, 0xbff8); + MP_WritePhyUshort(sc, 0x06, 0x40be); + MP_WritePhyUshort(sc, 0x06, 0x8350); + MP_WritePhyUshort(sc, 0x06, 0xa001); + MP_WritePhyUshort(sc, 0x06, 0x0107); + MP_WritePhyUshort(sc, 0x06, 0x1b89); + MP_WritePhyUshort(sc, 0x06, 0xcfd2); + MP_WritePhyUshort(sc, 0x06, 0x08eb); + MP_WritePhyUshort(sc, 0x06, 0xdb19); + MP_WritePhyUshort(sc, 0x06, 0xb2fb); + MP_WritePhyUshort(sc, 0x06, 0xfffe); + MP_WritePhyUshort(sc, 0x06, 0xfd04); + MP_WritePhyUshort(sc, 0x06, 0xf8e0); + MP_WritePhyUshort(sc, 0x06, 0xf848); + MP_WritePhyUshort(sc, 0x06, 0xe1f8); + MP_WritePhyUshort(sc, 0x06, 0x4968); + MP_WritePhyUshort(sc, 0x06, 0x08e4); + MP_WritePhyUshort(sc, 0x06, 0xf848); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x4958); + MP_WritePhyUshort(sc, 0x06, 0xf7e4); + MP_WritePhyUshort(sc, 0x06, 0xf848); + MP_WritePhyUshort(sc, 0x06, 0xe5f8); + MP_WritePhyUshort(sc, 0x06, 0x49fc); + MP_WritePhyUshort(sc, 0x06, 0x044d); + MP_WritePhyUshort(sc, 0x06, 0x2000); + MP_WritePhyUshort(sc, 0x06, 0x024e); + MP_WritePhyUshort(sc, 0x06, 0x2200); + MP_WritePhyUshort(sc, 0x06, 0x024d); + MP_WritePhyUshort(sc, 0x06, 0xdfff); + MP_WritePhyUshort(sc, 0x06, 0x014e); + MP_WritePhyUshort(sc, 0x06, 0xddff); + MP_WritePhyUshort(sc, 0x06, 0x01f8); + MP_WritePhyUshort(sc, 0x06, 0xfafb); + MP_WritePhyUshort(sc, 0x06, 0xef79); + MP_WritePhyUshort(sc, 0x06, 0xbff8); + MP_WritePhyUshort(sc, 0x06, 0x22d8); + MP_WritePhyUshort(sc, 0x06, 0x19d9); + MP_WritePhyUshort(sc, 0x06, 0x5884); + MP_WritePhyUshort(sc, 0x06, 0x9f09); + MP_WritePhyUshort(sc, 0x06, 0xbf82); + MP_WritePhyUshort(sc, 0x06, 0x6dd6); + MP_WritePhyUshort(sc, 0x06, 0x8275); + MP_WritePhyUshort(sc, 0x06, 0x0201); + MP_WritePhyUshort(sc, 0x06, 0x4fef); + MP_WritePhyUshort(sc, 0x06, 0x97ff); + MP_WritePhyUshort(sc, 0x06, 0xfefc); + MP_WritePhyUshort(sc, 0x06, 0x0517); + MP_WritePhyUshort(sc, 0x06, 0xfffe); + MP_WritePhyUshort(sc, 0x06, 0x0117); + MP_WritePhyUshort(sc, 0x06, 0x0001); + MP_WritePhyUshort(sc, 0x06, 0x0200); + MP_WritePhyUshort(sc, 0x05, 0x83d8); + MP_WritePhyUshort(sc, 0x06, 0x8000); + MP_WritePhyUshort(sc, 0x05, 0x83d6); + MP_WritePhyUshort(sc, 0x06, 0x824f); + MP_WritePhyUshort(sc, 0x02, 0x2010); + MP_WritePhyUshort(sc, 0x03, 0xdc00); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x0b, 0x0600); + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0xfff6); + MP_WritePhyUshort(sc, 0x06, 0x00fc); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0xF880); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_36 || sc->re_type == MACFG_37) { + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0023); + Data = MP_ReadPhyUshort(sc, 0x17) | 0x0006; + if (sc->RequiredSecLanDonglePatch) + Data &= ~(BIT_2); + else + Data |= (BIT_2); + MP_WritePhyUshort(sc, 0x17, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8b80); + MP_WritePhyUshort(sc, 0x06, 0xc896); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0x6C20); + MP_WritePhyUshort(sc, 0x07, 0x2872); + MP_WritePhyUshort(sc, 0x1C, 0xEFFF); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x14, 0x6420); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + Data = MP_ReadPhyUshort(sc, 0x08) & 0x00FF; + MP_WritePhyUshort(sc, 0x08, Data | 0x8000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x18); + MP_WritePhyUshort(sc, 0x18, Data | 0x0050); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + Data = MP_ReadPhyUshort(sc, 0x14); + MP_WritePhyUshort(sc, 0x14, Data | 0x8000); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x00, 0x080B); + MP_WritePhyUshort(sc, 0x0B, 0x09D7); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x15, 0x1006); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002F); + MP_WritePhyUshort(sc, 0x15, 0x1919); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x19, 0x7F46); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8AD2); + MP_WritePhyUshort(sc, 0x06, 0x6810); + MP_WritePhyUshort(sc, 0x05, 0x8AD4); + MP_WritePhyUshort(sc, 0x06, 0x8002); + MP_WritePhyUshort(sc, 0x05, 0x8ADE); + MP_WritePhyUshort(sc, 0x06, 0x8025); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_38) { + CSR_WRITE_1(sc, 0x6E, CSR_READ_1(sc, 0x6E)| (1<<6)); + + Data_u32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data_u32 &= ~BIT_1; + re_eri_write(sc, 0x1D0, 4, Data_u32, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B80); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_2 | BIT_1; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x18); + Data |= BIT_4; + MP_WritePhyUshort(sc, 0x18, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + Data = MP_ReadPhyUshort(sc, 0x14); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x14, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B86); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_0; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0x6C14); + MP_WritePhyUshort(sc, 0x14, 0x7F3D); + MP_WritePhyUshort(sc, 0x1C, 0xFAFE); + MP_WritePhyUshort(sc, 0x08, 0x07C5); + MP_WritePhyUshort(sc, 0x10, 0xF090); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x14, 0x641A); + MP_WritePhyUshort(sc, 0x1A, 0x0606); + MP_WritePhyUshort(sc, 0x12, 0xF480); + MP_WritePhyUshort(sc, 0x13, 0x0747); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0078); + MP_WritePhyUshort(sc, 0x15, 0xA408); + MP_WritePhyUshort(sc, 0x17, 0x5100); + MP_WritePhyUshort(sc, 0x19, 0x0008); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x0D, 0x0207); + MP_WritePhyUshort(sc, 0x02, 0x5FD0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x00A1); + Data = MP_ReadPhyUshort(sc, 0x1A); + Data &= ~BIT_2; + MP_WritePhyUshort(sc, 0x1A, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x16); + Data |= BIT_5; + MP_WritePhyUshort(sc, 0x16, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x00AC); + MP_WritePhyUshort(sc, 0x18, 0x0006); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_14; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B54); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8B5D); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7C); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7F); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A82); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A88); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + Data = MP_ReadPhyUshort(sc, 0x19); + Data &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, Data); + Data = MP_ReadPhyUshort(sc, 0x10); + Data &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else if (sc->re_type == MACFG_39) { + Data_u32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data_u32 &= ~BIT_1; + re_eri_write(sc, 0x1D0, 4, Data_u32, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B80); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_2 | BIT_1; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0007); + MP_WritePhyUshort(sc, 0x1e, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x18); + Data |= BIT_4; + MP_WritePhyUshort(sc, 0x18, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + Data = MP_ReadPhyUshort(sc, 0x14); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x14, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B86); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_0; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x00AC); + MP_WritePhyUshort(sc, 0x18, 0x0006); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_14; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B54); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8B5D); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7C); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7F); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A82); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A88); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + Data = MP_ReadPhyUshort(sc, 0x19); + Data &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, Data); + Data = MP_ReadPhyUshort(sc, 0x10); + Data &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else if (sc->re_type == MACFG_41) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x11, MP_ReadPhyUshort(sc, 0x11) | 0x1000); + MP_WritePhyUshort(sc, 0x1F, 0x0002); + MP_WritePhyUshort(sc, 0x0F, MP_ReadPhyUshort(sc, 0x0F) | 0x0003); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + for (Data_u32=0x800E0068; Data_u32<0x800E006D; Data_u32++) { + CSR_WRITE_4(sc, 0xF8, Data_u32); + for (i=0; i<10; i++) { + DELAY(400); + if ((CSR_READ_4(sc, 0xF8)&0x80000000)==0) + break; + } + } + } else if (sc->re_type == MACFG_42 || sc->re_type == MACFG_43) { + Data_u32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data_u32 &= 0xFFFF0000; + re_eri_write(sc, 0x1D0, 4, Data_u32, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x19, 0x7070); + MP_WritePhyUshort(sc, 0x1c, 0x0600); + MP_WritePhyUshort(sc, 0x1d, 0x9700); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6900); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x4899); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x4007); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x4800); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x571f); + MP_WritePhyUshort(sc, 0x1d, 0x5ffb); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x301e); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0xa6fc); + MP_WritePhyUshort(sc, 0x1d, 0xdcdb); + MP_WritePhyUshort(sc, 0x1d, 0x0014); + MP_WritePhyUshort(sc, 0x1d, 0xd9a9); + MP_WritePhyUshort(sc, 0x1d, 0x0013); + MP_WritePhyUshort(sc, 0x1d, 0xd16b); + MP_WritePhyUshort(sc, 0x1d, 0x0011); + MP_WritePhyUshort(sc, 0x1d, 0xb40e); + MP_WritePhyUshort(sc, 0x1d, 0xd06b); + MP_WritePhyUshort(sc, 0x1d, 0x000c); + MP_WritePhyUshort(sc, 0x1d, 0xb206); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c00); + MP_WritePhyUshort(sc, 0x1d, 0x301a); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5801); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c04); + MP_WritePhyUshort(sc, 0x1d, 0x301e); + MP_WritePhyUshort(sc, 0x1d, 0x314d); + MP_WritePhyUshort(sc, 0x1d, 0x31f0); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c20); + MP_WritePhyUshort(sc, 0x1d, 0x6004); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x4833); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c08); + MP_WritePhyUshort(sc, 0x1d, 0x8300); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6600); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xb90c); + MP_WritePhyUshort(sc, 0x1d, 0x30d3); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4de0); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x300b); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c60); + MP_WritePhyUshort(sc, 0x1d, 0x6803); + MP_WritePhyUshort(sc, 0x1d, 0x6520); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xaf03); + MP_WritePhyUshort(sc, 0x1d, 0x6015); + MP_WritePhyUshort(sc, 0x1d, 0x3059); + MP_WritePhyUshort(sc, 0x1d, 0x6017); + MP_WritePhyUshort(sc, 0x1d, 0x57e0); + MP_WritePhyUshort(sc, 0x1d, 0x580c); + MP_WritePhyUshort(sc, 0x1d, 0x588c); + MP_WritePhyUshort(sc, 0x1d, 0x7ffc); + MP_WritePhyUshort(sc, 0x1d, 0x5fa3); + MP_WritePhyUshort(sc, 0x1d, 0x4827); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x7c30); + MP_WritePhyUshort(sc, 0x1d, 0x6020); + MP_WritePhyUshort(sc, 0x1d, 0x48bf); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0xad09); + MP_WritePhyUshort(sc, 0x1d, 0x7c03); + MP_WritePhyUshort(sc, 0x1d, 0x5c03); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0xad2c); + MP_WritePhyUshort(sc, 0x1d, 0xd6cf); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0x80f4); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c80); + MP_WritePhyUshort(sc, 0x1d, 0x7c20); + MP_WritePhyUshort(sc, 0x1d, 0x5c20); + MP_WritePhyUshort(sc, 0x1d, 0x481e); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c02); + MP_WritePhyUshort(sc, 0x1d, 0xad0a); + MP_WritePhyUshort(sc, 0x1d, 0x7c03); + MP_WritePhyUshort(sc, 0x1d, 0x5c03); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x8d02); + MP_WritePhyUshort(sc, 0x1d, 0x4401); + MP_WritePhyUshort(sc, 0x1d, 0x81f4); + MP_WritePhyUshort(sc, 0x1d, 0x3114); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d00); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0xa4b7); + MP_WritePhyUshort(sc, 0x1d, 0xd9b3); + MP_WritePhyUshort(sc, 0x1d, 0xfffe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d20); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0x3045); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d40); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x4401); + MP_WritePhyUshort(sc, 0x1d, 0x5210); + MP_WritePhyUshort(sc, 0x1d, 0x4833); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x4c08); + MP_WritePhyUshort(sc, 0x1d, 0x8300); + MP_WritePhyUshort(sc, 0x1d, 0x5f80); + MP_WritePhyUshort(sc, 0x1d, 0x55e0); + MP_WritePhyUshort(sc, 0x1d, 0xc06f); + MP_WritePhyUshort(sc, 0x1d, 0x0005); + MP_WritePhyUshort(sc, 0x1d, 0xd9b3); + MP_WritePhyUshort(sc, 0x1d, 0xfffd); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x6040); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d60); + MP_WritePhyUshort(sc, 0x1d, 0x57e0); + MP_WritePhyUshort(sc, 0x1d, 0x4814); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7c03); + MP_WritePhyUshort(sc, 0x1d, 0x5c03); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xad02); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0xc0e9); + MP_WritePhyUshort(sc, 0x1d, 0x0003); + MP_WritePhyUshort(sc, 0x1d, 0xadd8); + MP_WritePhyUshort(sc, 0x1d, 0x30c6); + MP_WritePhyUshort(sc, 0x1d, 0x3078); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4dc0); + MP_WritePhyUshort(sc, 0x1d, 0x6730); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xd09d); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0xb4fe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d80); + MP_WritePhyUshort(sc, 0x1d, 0x6802); + MP_WritePhyUshort(sc, 0x1d, 0x6600); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x486c); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x9503); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0x571f); + MP_WritePhyUshort(sc, 0x1d, 0x5fbb); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x30e9); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0xcdab); + MP_WritePhyUshort(sc, 0x1d, 0xff5b); + MP_WritePhyUshort(sc, 0x1d, 0xcd8d); + MP_WritePhyUshort(sc, 0x1d, 0xff59); + MP_WritePhyUshort(sc, 0x1d, 0xd96b); + MP_WritePhyUshort(sc, 0x1d, 0xff57); + MP_WritePhyUshort(sc, 0x1d, 0xd0a0); + MP_WritePhyUshort(sc, 0x1d, 0xffdb); + MP_WritePhyUshort(sc, 0x1d, 0xcba0); + MP_WritePhyUshort(sc, 0x1d, 0x0003); + MP_WritePhyUshort(sc, 0x1d, 0x80f0); + MP_WritePhyUshort(sc, 0x1d, 0x30f6); + MP_WritePhyUshort(sc, 0x1d, 0x3109); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ce0); + MP_WritePhyUshort(sc, 0x1d, 0x7d30); + MP_WritePhyUshort(sc, 0x1d, 0x6530); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7ce0); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c08); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6008); + MP_WritePhyUshort(sc, 0x1d, 0x8300); + MP_WritePhyUshort(sc, 0x1d, 0xb902); + MP_WritePhyUshort(sc, 0x1d, 0x30d3); + MP_WritePhyUshort(sc, 0x1d, 0x308f); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4da0); + MP_WritePhyUshort(sc, 0x1d, 0x57a0); + MP_WritePhyUshort(sc, 0x1d, 0x590c); + MP_WritePhyUshort(sc, 0x1d, 0x5fa2); + MP_WritePhyUshort(sc, 0x1d, 0xcba4); + MP_WritePhyUshort(sc, 0x1d, 0x0005); + MP_WritePhyUshort(sc, 0x1d, 0xcd8d); + MP_WritePhyUshort(sc, 0x1d, 0x0003); + MP_WritePhyUshort(sc, 0x1d, 0x80fc); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ca0); + MP_WritePhyUshort(sc, 0x1d, 0xb603); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6010); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x541f); + MP_WritePhyUshort(sc, 0x1d, 0x7ffc); + MP_WritePhyUshort(sc, 0x1d, 0x5fb3); + MP_WritePhyUshort(sc, 0x1d, 0x9403); + MP_WritePhyUshort(sc, 0x1d, 0x7c03); + MP_WritePhyUshort(sc, 0x1d, 0x5c03); + MP_WritePhyUshort(sc, 0x1d, 0xaa05); + MP_WritePhyUshort(sc, 0x1d, 0x7c80); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x3128); + MP_WritePhyUshort(sc, 0x1d, 0x7c80); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0x4827); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4cc0); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6400); + MP_WritePhyUshort(sc, 0x1d, 0x7ffc); + MP_WritePhyUshort(sc, 0x1d, 0x5fbb); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6a00); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x30f6); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e00); + MP_WritePhyUshort(sc, 0x1d, 0x4007); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x570f); + MP_WritePhyUshort(sc, 0x1d, 0x5fff); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x585b); + MP_WritePhyUshort(sc, 0x1d, 0x315c); + MP_WritePhyUshort(sc, 0x1d, 0x5867); + MP_WritePhyUshort(sc, 0x1d, 0x9402); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0xcda3); + MP_WritePhyUshort(sc, 0x1d, 0x009d); + MP_WritePhyUshort(sc, 0x1d, 0xcd85); + MP_WritePhyUshort(sc, 0x1d, 0x009b); + MP_WritePhyUshort(sc, 0x1d, 0xd96b); + MP_WritePhyUshort(sc, 0x1d, 0x0099); + MP_WritePhyUshort(sc, 0x1d, 0x96e9); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e20); + MP_WritePhyUshort(sc, 0x1d, 0x96e4); + MP_WritePhyUshort(sc, 0x1d, 0x8b04); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x5008); + MP_WritePhyUshort(sc, 0x1d, 0xab03); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x5000); + MP_WritePhyUshort(sc, 0x1d, 0x6801); + MP_WritePhyUshort(sc, 0x1d, 0x6776); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xdb7c); + MP_WritePhyUshort(sc, 0x1d, 0xfff0); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe1); + MP_WritePhyUshort(sc, 0x1d, 0x4e40); + MP_WritePhyUshort(sc, 0x1d, 0x4837); + MP_WritePhyUshort(sc, 0x1d, 0x4418); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e40); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8fc9); + MP_WritePhyUshort(sc, 0x1d, 0xd2a0); + MP_WritePhyUshort(sc, 0x1d, 0x004a); + MP_WritePhyUshort(sc, 0x1d, 0x9203); + MP_WritePhyUshort(sc, 0x1d, 0xa041); + MP_WritePhyUshort(sc, 0x1d, 0x3184); + MP_WritePhyUshort(sc, 0x1d, 0x7fe1); + MP_WritePhyUshort(sc, 0x1d, 0x4e60); + MP_WritePhyUshort(sc, 0x1d, 0x489c); + MP_WritePhyUshort(sc, 0x1d, 0x4628); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e60); + MP_WritePhyUshort(sc, 0x1d, 0x7e28); + MP_WritePhyUshort(sc, 0x1d, 0x4628); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c00); + MP_WritePhyUshort(sc, 0x1d, 0x41e8); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8fb0); + MP_WritePhyUshort(sc, 0x1d, 0xb241); + MP_WritePhyUshort(sc, 0x1d, 0xa02a); + MP_WritePhyUshort(sc, 0x1d, 0x319d); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ea0); + MP_WritePhyUshort(sc, 0x1d, 0x7c02); + MP_WritePhyUshort(sc, 0x1d, 0x4402); + MP_WritePhyUshort(sc, 0x1d, 0x4448); + MP_WritePhyUshort(sc, 0x1d, 0x4894); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c03); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c07); + MP_WritePhyUshort(sc, 0x1d, 0x41ef); + MP_WritePhyUshort(sc, 0x1d, 0x41ff); + MP_WritePhyUshort(sc, 0x1d, 0x4891); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c07); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c17); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x8ef8); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x8f95); + MP_WritePhyUshort(sc, 0x1d, 0x92d5); + MP_WritePhyUshort(sc, 0x1d, 0xa10f); + MP_WritePhyUshort(sc, 0x1d, 0xd480); + MP_WritePhyUshort(sc, 0x1d, 0x0008); + MP_WritePhyUshort(sc, 0x1d, 0xd580); + MP_WritePhyUshort(sc, 0x1d, 0xffb9); + MP_WritePhyUshort(sc, 0x1d, 0xa202); + MP_WritePhyUshort(sc, 0x1d, 0x31b8); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x4404); + MP_WritePhyUshort(sc, 0x1d, 0x31b8); + MP_WritePhyUshort(sc, 0x1d, 0xd484); + MP_WritePhyUshort(sc, 0x1d, 0xfff3); + MP_WritePhyUshort(sc, 0x1d, 0xd484); + MP_WritePhyUshort(sc, 0x1d, 0xfff1); + MP_WritePhyUshort(sc, 0x1d, 0x314d); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ee0); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x4488); + MP_WritePhyUshort(sc, 0x1d, 0x41cf); + MP_WritePhyUshort(sc, 0x1d, 0x314d); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ec0); + MP_WritePhyUshort(sc, 0x1d, 0x48f3); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c09); + MP_WritePhyUshort(sc, 0x1d, 0x4508); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x8f24); + MP_WritePhyUshort(sc, 0x1d, 0xd218); + MP_WritePhyUshort(sc, 0x1d, 0x0022); + MP_WritePhyUshort(sc, 0x1d, 0xd2a4); + MP_WritePhyUshort(sc, 0x1d, 0xff9f); + MP_WritePhyUshort(sc, 0x1d, 0x31d9); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e80); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c11); + MP_WritePhyUshort(sc, 0x1d, 0x4428); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5440); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5801); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c04); + MP_WritePhyUshort(sc, 0x1d, 0x41e8); + MP_WritePhyUshort(sc, 0x1d, 0xa4b3); + MP_WritePhyUshort(sc, 0x1d, 0x31ee); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x570f); + MP_WritePhyUshort(sc, 0x1d, 0x5fff); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x585b); + MP_WritePhyUshort(sc, 0x1d, 0x31fa); + MP_WritePhyUshort(sc, 0x1d, 0x5867); + MP_WritePhyUshort(sc, 0x1d, 0xbcf6); + MP_WritePhyUshort(sc, 0x1d, 0x300b); + MP_WritePhyUshort(sc, 0x1d, 0x300b); + MP_WritePhyUshort(sc, 0x1d, 0x314d); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1c, 0x0200); + MP_WritePhyUshort(sc, 0x19, 0x7030); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + if (CSR_READ_1(sc, 0xEF)&0x08) { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x1A, 0x0004); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x1A, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + if (CSR_READ_1(sc, 0xEF)&0x10) { + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1C, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0004); + MP_WritePhyUshort(sc, 0x1C, 0x0200); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x15, 0x7701); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + ClearEthPhyBit(sc, 0x1A, BIT_14); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x8310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0003); + MP_WritePhyUshort(sc, 0x0E, 0x0015); + MP_WritePhyUshort(sc, 0x0D, 0x4003); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + + } else if (sc->re_type == MACFG_50) { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B80); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_2 | BIT_1; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x18); + Data |= BIT_4; + MP_WritePhyUshort(sc, 0x18, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + Data = MP_ReadPhyUshort(sc, 0x14); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x14, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B86); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_0; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_14; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B55); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8B5E); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8B67); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8B70); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0078); + MP_WritePhyUshort(sc, 0x17, 0x0000); + MP_WritePhyUshort(sc, 0x19, 0x00FB); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B79); + MP_WritePhyUshort(sc, 0x06, 0xAA00); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x01, 0x328A); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B54); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8B5D); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7C); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7F); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A82); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A88); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + Data = MP_ReadPhyUshort(sc, 0x19); + Data &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, Data); + Data = MP_ReadPhyUshort(sc, 0x10); + Data &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else if (sc->re_type == MACFG_51) { + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B80); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_2 | BIT_1; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x18); + Data |= BIT_4; + MP_WritePhyUshort(sc, 0x18, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + Data = MP_ReadPhyUshort(sc, 0x14); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x14, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B86); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_0; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B54); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8B5D); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7C); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7F); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A82); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A88); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + Data = MP_ReadPhyUshort(sc, 0x19); + Data &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, Data); + Data = MP_ReadPhyUshort(sc, 0x10); + Data &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else if (sc->re_type == MACFG_52) { + Data_u32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data_u32 &= ~BIT_1; + re_eri_write(sc, 0x1D0, 4, Data_u32, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B80); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_2 | BIT_1; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002D); + Data = MP_ReadPhyUshort(sc, 0x18); + Data |= BIT_4; + MP_WritePhyUshort(sc, 0x18, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + Data = MP_ReadPhyUshort(sc, 0x14); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x14, Data); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B86); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_0; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_14; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x09, 0xA20F); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B55); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8B5E); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8B67); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x05, 0x8B70); + MP_WritePhyUshort(sc, 0x06, 0x0000); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0078); + MP_WritePhyUshort(sc, 0x17, 0x0000); + MP_WritePhyUshort(sc, 0x19, 0x00FB); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B79); + MP_WritePhyUshort(sc, 0x06, 0xAA00); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x01, 0x328A); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B54); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8B5D); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_11; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7C); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A7F); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A82); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x05, 0x8A88); + Data = MP_ReadPhyUshort(sc, 0x06); + Data &= ~BIT_8; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x05, 0x8B85); + Data = MP_ReadPhyUshort(sc, 0x06); + Data |= BIT_15; + MP_WritePhyUshort(sc, 0x06, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0003); + Data = MP_ReadPhyUshort(sc, 0x19); + Data &= ~BIT_0; + MP_WritePhyUshort(sc, 0x19, Data); + Data = MP_ReadPhyUshort(sc, 0x10); + Data &= ~BIT_10; + MP_WritePhyUshort(sc, 0x10, Data); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } else if (sc->re_type == MACFG_53) { + Data_u32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data_u32 &= 0xFFFF0000; + re_eri_write(sc, 0x1D0, 4, Data_u32, ERIAR_ExGMAC); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x19, 0x7070); + MP_WritePhyUshort(sc, 0x1c, 0x0600); + MP_WritePhyUshort(sc, 0x1d, 0x9700); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6900); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x4899); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x4007); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x4800); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x571f); + MP_WritePhyUshort(sc, 0x1d, 0x5ffb); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x301e); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0xa6fc); + MP_WritePhyUshort(sc, 0x1d, 0xdcdb); + MP_WritePhyUshort(sc, 0x1d, 0x0015); + MP_WritePhyUshort(sc, 0x1d, 0xb915); + MP_WritePhyUshort(sc, 0x1d, 0xb511); + MP_WritePhyUshort(sc, 0x1d, 0xd16b); + MP_WritePhyUshort(sc, 0x1d, 0x000f); + MP_WritePhyUshort(sc, 0x1d, 0xb40f); + MP_WritePhyUshort(sc, 0x1d, 0xd06b); + MP_WritePhyUshort(sc, 0x1d, 0x000d); + MP_WritePhyUshort(sc, 0x1d, 0xb206); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c00); + MP_WritePhyUshort(sc, 0x1d, 0x301a); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5801); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c04); + MP_WritePhyUshort(sc, 0x1d, 0x301e); + MP_WritePhyUshort(sc, 0x1d, 0x3079); + MP_WritePhyUshort(sc, 0x1d, 0x30f1); + MP_WritePhyUshort(sc, 0x1d, 0x3199); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c60); + MP_WritePhyUshort(sc, 0x1d, 0x6803); + MP_WritePhyUshort(sc, 0x1d, 0x6420); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xaf03); + MP_WritePhyUshort(sc, 0x1d, 0x6015); + MP_WritePhyUshort(sc, 0x1d, 0x3040); + MP_WritePhyUshort(sc, 0x1d, 0x6017); + MP_WritePhyUshort(sc, 0x1d, 0x57e0); + MP_WritePhyUshort(sc, 0x1d, 0x580c); + MP_WritePhyUshort(sc, 0x1d, 0x588c); + MP_WritePhyUshort(sc, 0x1d, 0x5fa3); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x4827); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x7c30); + MP_WritePhyUshort(sc, 0x1d, 0x6020); + MP_WritePhyUshort(sc, 0x1d, 0x48bf); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0xd6cf); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0x80fe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c80); + MP_WritePhyUshort(sc, 0x1d, 0x7c20); + MP_WritePhyUshort(sc, 0x1d, 0x5c20); + MP_WritePhyUshort(sc, 0x1d, 0x481e); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c02); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x81ff); + MP_WritePhyUshort(sc, 0x1d, 0x30ba); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d00); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0xa4cc); + MP_WritePhyUshort(sc, 0x1d, 0xd9b3); + MP_WritePhyUshort(sc, 0x1d, 0xfffe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d20); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0x300b); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4dc0); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xd09d); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0xb4fe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d80); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x6004); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6802); + MP_WritePhyUshort(sc, 0x1d, 0x6720); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x486c); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x9503); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0x571f); + MP_WritePhyUshort(sc, 0x1d, 0x5fbb); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x3092); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0xcdab); + MP_WritePhyUshort(sc, 0x1d, 0xff78); + MP_WritePhyUshort(sc, 0x1d, 0xcd8d); + MP_WritePhyUshort(sc, 0x1d, 0xff76); + MP_WritePhyUshort(sc, 0x1d, 0xd96b); + MP_WritePhyUshort(sc, 0x1d, 0xff74); + MP_WritePhyUshort(sc, 0x1d, 0xd0a0); + MP_WritePhyUshort(sc, 0x1d, 0xffd9); + MP_WritePhyUshort(sc, 0x1d, 0xcba0); + MP_WritePhyUshort(sc, 0x1d, 0x0003); + MP_WritePhyUshort(sc, 0x1d, 0x80f0); + MP_WritePhyUshort(sc, 0x1d, 0x309f); + MP_WritePhyUshort(sc, 0x1d, 0x30ac); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ce0); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c08); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6008); + MP_WritePhyUshort(sc, 0x1d, 0x8300); + MP_WritePhyUshort(sc, 0x1d, 0xb902); + MP_WritePhyUshort(sc, 0x1d, 0x3079); + MP_WritePhyUshort(sc, 0x1d, 0x3061); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4da0); + MP_WritePhyUshort(sc, 0x1d, 0x6400); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x57a0); + MP_WritePhyUshort(sc, 0x1d, 0x590c); + MP_WritePhyUshort(sc, 0x1d, 0x5fa3); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xcba4); + MP_WritePhyUshort(sc, 0x1d, 0x0004); + MP_WritePhyUshort(sc, 0x1d, 0xcd8d); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0x80fc); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ca0); + MP_WritePhyUshort(sc, 0x1d, 0xb603); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6010); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x541f); + MP_WritePhyUshort(sc, 0x1d, 0x5fb3); + MP_WritePhyUshort(sc, 0x1d, 0xaa05); + MP_WritePhyUshort(sc, 0x1d, 0x7c80); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x30ca); + MP_WritePhyUshort(sc, 0x1d, 0x7c80); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x4827); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4cc0); + MP_WritePhyUshort(sc, 0x1d, 0x5fbb); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7ce0); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x6720); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6a00); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x309f); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e00); + MP_WritePhyUshort(sc, 0x1d, 0x4007); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x570f); + MP_WritePhyUshort(sc, 0x1d, 0x5fff); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x585b); + MP_WritePhyUshort(sc, 0x1d, 0x3100); + MP_WritePhyUshort(sc, 0x1d, 0x5867); + MP_WritePhyUshort(sc, 0x1d, 0x9403); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0xcda3); + MP_WritePhyUshort(sc, 0x1d, 0x002d); + MP_WritePhyUshort(sc, 0x1d, 0xcd85); + MP_WritePhyUshort(sc, 0x1d, 0x002b); + MP_WritePhyUshort(sc, 0x1d, 0xd96b); + MP_WritePhyUshort(sc, 0x1d, 0x0029); + MP_WritePhyUshort(sc, 0x1d, 0x9629); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x9624); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e20); + MP_WritePhyUshort(sc, 0x1d, 0x8b04); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x5008); + MP_WritePhyUshort(sc, 0x1d, 0xab03); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x5000); + MP_WritePhyUshort(sc, 0x1d, 0x6801); + MP_WritePhyUshort(sc, 0x1d, 0x6776); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xdb7c); + MP_WritePhyUshort(sc, 0x1d, 0xffee); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe1); + MP_WritePhyUshort(sc, 0x1d, 0x4e40); + MP_WritePhyUshort(sc, 0x1d, 0x4837); + MP_WritePhyUshort(sc, 0x1d, 0x4418); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e40); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8f07); + MP_WritePhyUshort(sc, 0x1d, 0xd2a0); + MP_WritePhyUshort(sc, 0x1d, 0x004c); + MP_WritePhyUshort(sc, 0x1d, 0x9205); + MP_WritePhyUshort(sc, 0x1d, 0xa043); + MP_WritePhyUshort(sc, 0x1d, 0x312b); + MP_WritePhyUshort(sc, 0x1d, 0x300b); + MP_WritePhyUshort(sc, 0x1d, 0x30f1); + MP_WritePhyUshort(sc, 0x1d, 0x7fe1); + MP_WritePhyUshort(sc, 0x1d, 0x4e60); + MP_WritePhyUshort(sc, 0x1d, 0x489c); + MP_WritePhyUshort(sc, 0x1d, 0x4628); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e60); + MP_WritePhyUshort(sc, 0x1d, 0x7e28); + MP_WritePhyUshort(sc, 0x1d, 0x4628); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c00); + MP_WritePhyUshort(sc, 0x1d, 0x41e8); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8fec); + MP_WritePhyUshort(sc, 0x1d, 0xb241); + MP_WritePhyUshort(sc, 0x1d, 0xa02a); + MP_WritePhyUshort(sc, 0x1d, 0x3146); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ea0); + MP_WritePhyUshort(sc, 0x1d, 0x7c02); + MP_WritePhyUshort(sc, 0x1d, 0x4402); + MP_WritePhyUshort(sc, 0x1d, 0x4448); + MP_WritePhyUshort(sc, 0x1d, 0x4894); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c03); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c07); + MP_WritePhyUshort(sc, 0x1d, 0x41ef); + MP_WritePhyUshort(sc, 0x1d, 0x41ff); + MP_WritePhyUshort(sc, 0x1d, 0x4891); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c07); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c17); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x8ef8); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x8fd1); + MP_WritePhyUshort(sc, 0x1d, 0x92d5); + MP_WritePhyUshort(sc, 0x1d, 0xa10f); + MP_WritePhyUshort(sc, 0x1d, 0xd480); + MP_WritePhyUshort(sc, 0x1d, 0x0008); + MP_WritePhyUshort(sc, 0x1d, 0xd580); + MP_WritePhyUshort(sc, 0x1d, 0xffb7); + MP_WritePhyUshort(sc, 0x1d, 0xa202); + MP_WritePhyUshort(sc, 0x1d, 0x3161); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x4404); + MP_WritePhyUshort(sc, 0x1d, 0x3161); + MP_WritePhyUshort(sc, 0x1d, 0xd484); + MP_WritePhyUshort(sc, 0x1d, 0xfff3); + MP_WritePhyUshort(sc, 0x1d, 0xd484); + MP_WritePhyUshort(sc, 0x1d, 0xfff1); + MP_WritePhyUshort(sc, 0x1d, 0x30f1); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ee0); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x4488); + MP_WritePhyUshort(sc, 0x1d, 0x41cf); + MP_WritePhyUshort(sc, 0x1d, 0x30f1); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ec0); + MP_WritePhyUshort(sc, 0x1d, 0x48f3); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c09); + MP_WritePhyUshort(sc, 0x1d, 0x4508); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x8fb0); + MP_WritePhyUshort(sc, 0x1d, 0xd218); + MP_WritePhyUshort(sc, 0x1d, 0xffae); + MP_WritePhyUshort(sc, 0x1d, 0xd2a4); + MP_WritePhyUshort(sc, 0x1d, 0xff9d); + MP_WritePhyUshort(sc, 0x1d, 0x3182); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e80); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c11); + MP_WritePhyUshort(sc, 0x1d, 0x4428); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5440); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5801); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c04); + MP_WritePhyUshort(sc, 0x1d, 0x41e8); + MP_WritePhyUshort(sc, 0x1d, 0xa4b3); + MP_WritePhyUshort(sc, 0x1d, 0x3197); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4f20); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x6736); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x570f); + MP_WritePhyUshort(sc, 0x1d, 0x5fff); + MP_WritePhyUshort(sc, 0x1d, 0xaa03); + MP_WritePhyUshort(sc, 0x1d, 0x585b); + MP_WritePhyUshort(sc, 0x1d, 0x31a5); + MP_WritePhyUshort(sc, 0x1d, 0x5867); + MP_WritePhyUshort(sc, 0x1d, 0xbcf4); + MP_WritePhyUshort(sc, 0x1d, 0x300b); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1c, 0x0200); + MP_WritePhyUshort(sc, 0x19, 0x7030); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x8310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + } else if (sc->re_type == MACFG_54 || sc->re_type == MACFG_55) { + Data_u32 = re_eri_read(sc, 0x1D0, 4, ERIAR_ExGMAC); + Data_u32 &= 0xFFFF0000; + re_eri_write(sc, 0x1D0, 4, Data_u32, ERIAR_ExGMAC); + + if (sc->re_type == MACFG_55) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x19, 0x7070); + MP_WritePhyUshort(sc, 0x1c, 0x0600); + MP_WritePhyUshort(sc, 0x1d, 0x9700); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x4007); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x4800); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x673e); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x571f); + MP_WritePhyUshort(sc, 0x1d, 0x5ffb); + MP_WritePhyUshort(sc, 0x1d, 0xaa04); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x6100); + MP_WritePhyUshort(sc, 0x1d, 0x3016); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0x6080); + MP_WritePhyUshort(sc, 0x1d, 0xa6fa); + MP_WritePhyUshort(sc, 0x1d, 0xdcdb); + MP_WritePhyUshort(sc, 0x1d, 0x0015); + MP_WritePhyUshort(sc, 0x1d, 0xb915); + MP_WritePhyUshort(sc, 0x1d, 0xb511); + MP_WritePhyUshort(sc, 0x1d, 0xd16b); + MP_WritePhyUshort(sc, 0x1d, 0x000f); + MP_WritePhyUshort(sc, 0x1d, 0xb40f); + MP_WritePhyUshort(sc, 0x1d, 0xd06b); + MP_WritePhyUshort(sc, 0x1d, 0x000d); + MP_WritePhyUshort(sc, 0x1d, 0xb206); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c00); + MP_WritePhyUshort(sc, 0x1d, 0x3010); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5801); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c04); + MP_WritePhyUshort(sc, 0x1d, 0x3016); + MP_WritePhyUshort(sc, 0x1d, 0x307e); + MP_WritePhyUshort(sc, 0x1d, 0x30f4); + MP_WritePhyUshort(sc, 0x1d, 0x319f); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c60); + MP_WritePhyUshort(sc, 0x1d, 0x6803); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6900); + MP_WritePhyUshort(sc, 0x1d, 0x6520); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xaf03); + MP_WritePhyUshort(sc, 0x1d, 0x6115); + MP_WritePhyUshort(sc, 0x1d, 0x303a); + MP_WritePhyUshort(sc, 0x1d, 0x6097); + MP_WritePhyUshort(sc, 0x1d, 0x57e0); + MP_WritePhyUshort(sc, 0x1d, 0x580c); + MP_WritePhyUshort(sc, 0x1d, 0x588c); + MP_WritePhyUshort(sc, 0x1d, 0x5f80); + MP_WritePhyUshort(sc, 0x1d, 0x4827); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x7c30); + MP_WritePhyUshort(sc, 0x1d, 0x6020); + MP_WritePhyUshort(sc, 0x1d, 0x48bf); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0xb802); + MP_WritePhyUshort(sc, 0x1d, 0x3053); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6808); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6810); + MP_WritePhyUshort(sc, 0x1d, 0xd6cf); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0x80fe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4c80); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7c23); + MP_WritePhyUshort(sc, 0x1d, 0x5c23); + MP_WritePhyUshort(sc, 0x1d, 0x481e); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c02); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x81ff); + MP_WritePhyUshort(sc, 0x1d, 0x30c1); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d00); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0xa4bd); + MP_WritePhyUshort(sc, 0x1d, 0xd9b3); + MP_WritePhyUshort(sc, 0x1d, 0x00fe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d20); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0x3001); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4dc0); + MP_WritePhyUshort(sc, 0x1d, 0xd09d); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0xb4fe); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4d80); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x6004); + MP_WritePhyUshort(sc, 0x1d, 0x6802); + MP_WritePhyUshort(sc, 0x1d, 0x6728); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x486c); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x9503); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0x571f); + MP_WritePhyUshort(sc, 0x1d, 0x5fbb); + MP_WritePhyUshort(sc, 0x1d, 0xaa05); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x7d80); + MP_WritePhyUshort(sc, 0x1d, 0x6100); + MP_WritePhyUshort(sc, 0x1d, 0x309a); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0x7d80); + MP_WritePhyUshort(sc, 0x1d, 0x6080); + MP_WritePhyUshort(sc, 0x1d, 0xcdab); + MP_WritePhyUshort(sc, 0x1d, 0x0058); + MP_WritePhyUshort(sc, 0x1d, 0xcd8d); + MP_WritePhyUshort(sc, 0x1d, 0x0056); + MP_WritePhyUshort(sc, 0x1d, 0xd96b); + MP_WritePhyUshort(sc, 0x1d, 0x0054); + MP_WritePhyUshort(sc, 0x1d, 0xd0a0); + MP_WritePhyUshort(sc, 0x1d, 0x00d8); + MP_WritePhyUshort(sc, 0x1d, 0xcba0); + MP_WritePhyUshort(sc, 0x1d, 0x0003); + MP_WritePhyUshort(sc, 0x1d, 0x80ec); + MP_WritePhyUshort(sc, 0x1d, 0x30a7); + MP_WritePhyUshort(sc, 0x1d, 0x30b4); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ce0); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c08); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6008); + MP_WritePhyUshort(sc, 0x1d, 0x8300); + MP_WritePhyUshort(sc, 0x1d, 0xb902); + MP_WritePhyUshort(sc, 0x1d, 0x307e); + MP_WritePhyUshort(sc, 0x1d, 0x3068); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4da0); + MP_WritePhyUshort(sc, 0x1d, 0x6608); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x56a0); + MP_WritePhyUshort(sc, 0x1d, 0x590c); + MP_WritePhyUshort(sc, 0x1d, 0x5fa0); + MP_WritePhyUshort(sc, 0x1d, 0xcba4); + MP_WritePhyUshort(sc, 0x1d, 0x0004); + MP_WritePhyUshort(sc, 0x1d, 0xcd8d); + MP_WritePhyUshort(sc, 0x1d, 0x0002); + MP_WritePhyUshort(sc, 0x1d, 0x80fc); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ca0); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x6408); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0xb603); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6010); + MP_WritePhyUshort(sc, 0x1d, 0x7d1f); + MP_WritePhyUshort(sc, 0x1d, 0x551f); + MP_WritePhyUshort(sc, 0x1d, 0x5fb3); + MP_WritePhyUshort(sc, 0x1d, 0xaa05); + MP_WritePhyUshort(sc, 0x1d, 0x7c80); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x5b58); + MP_WritePhyUshort(sc, 0x1d, 0x30d7); + MP_WritePhyUshort(sc, 0x1d, 0x7c80); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x5b64); + MP_WritePhyUshort(sc, 0x1d, 0x4827); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c10); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x7c10); + MP_WritePhyUshort(sc, 0x1d, 0x6000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4cc0); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6400); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x5fbb); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c00); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c04); + MP_WritePhyUshort(sc, 0x1d, 0x8200); + MP_WritePhyUshort(sc, 0x1d, 0x7ce0); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7d00); + MP_WritePhyUshort(sc, 0x1d, 0x6500); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x30a7); + MP_WritePhyUshort(sc, 0x1d, 0x3001); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e00); + MP_WritePhyUshort(sc, 0x1d, 0x4007); + MP_WritePhyUshort(sc, 0x1d, 0x4400); + MP_WritePhyUshort(sc, 0x1d, 0x5310); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x673e); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x570f); + MP_WritePhyUshort(sc, 0x1d, 0x5fff); + MP_WritePhyUshort(sc, 0x1d, 0xaa05); + MP_WritePhyUshort(sc, 0x1d, 0x585b); + MP_WritePhyUshort(sc, 0x1d, 0x7d80); + MP_WritePhyUshort(sc, 0x1d, 0x6100); + MP_WritePhyUshort(sc, 0x1d, 0x3107); + MP_WritePhyUshort(sc, 0x1d, 0x5867); + MP_WritePhyUshort(sc, 0x1d, 0x7d80); + MP_WritePhyUshort(sc, 0x1d, 0x6080); + MP_WritePhyUshort(sc, 0x1d, 0x9403); + MP_WritePhyUshort(sc, 0x1d, 0x7e00); + MP_WritePhyUshort(sc, 0x1d, 0x6200); + MP_WritePhyUshort(sc, 0x1d, 0xcda3); + MP_WritePhyUshort(sc, 0x1d, 0x00e8); + MP_WritePhyUshort(sc, 0x1d, 0xcd85); + MP_WritePhyUshort(sc, 0x1d, 0x00e6); + MP_WritePhyUshort(sc, 0x1d, 0xd96b); + MP_WritePhyUshort(sc, 0x1d, 0x00e4); + MP_WritePhyUshort(sc, 0x1d, 0x96e4); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x673e); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e20); + MP_WritePhyUshort(sc, 0x1d, 0x96dd); + MP_WritePhyUshort(sc, 0x1d, 0x8b04); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x5008); + MP_WritePhyUshort(sc, 0x1d, 0xab03); + MP_WritePhyUshort(sc, 0x1d, 0x7c08); + MP_WritePhyUshort(sc, 0x1d, 0x5000); + MP_WritePhyUshort(sc, 0x1d, 0x6801); + MP_WritePhyUshort(sc, 0x1d, 0x677e); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0xdb7c); + MP_WritePhyUshort(sc, 0x1d, 0x00ee); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x7fe1); + MP_WritePhyUshort(sc, 0x1d, 0x4e40); + MP_WritePhyUshort(sc, 0x1d, 0x4837); + MP_WritePhyUshort(sc, 0x1d, 0x4418); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e40); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8fc2); + MP_WritePhyUshort(sc, 0x1d, 0xd2a0); + MP_WritePhyUshort(sc, 0x1d, 0x004b); + MP_WritePhyUshort(sc, 0x1d, 0x9204); + MP_WritePhyUshort(sc, 0x1d, 0xa042); + MP_WritePhyUshort(sc, 0x1d, 0x3132); + MP_WritePhyUshort(sc, 0x1d, 0x30f4); + MP_WritePhyUshort(sc, 0x1d, 0x7fe1); + MP_WritePhyUshort(sc, 0x1d, 0x4e60); + MP_WritePhyUshort(sc, 0x1d, 0x489c); + MP_WritePhyUshort(sc, 0x1d, 0x4628); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e60); + MP_WritePhyUshort(sc, 0x1d, 0x7e28); + MP_WritePhyUshort(sc, 0x1d, 0x4628); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5800); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c00); + MP_WritePhyUshort(sc, 0x1d, 0x41e8); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x8fa8); + MP_WritePhyUshort(sc, 0x1d, 0xb241); + MP_WritePhyUshort(sc, 0x1d, 0xa02a); + MP_WritePhyUshort(sc, 0x1d, 0x314c); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ea0); + MP_WritePhyUshort(sc, 0x1d, 0x7c02); + MP_WritePhyUshort(sc, 0x1d, 0x4402); + MP_WritePhyUshort(sc, 0x1d, 0x4448); + MP_WritePhyUshort(sc, 0x1d, 0x4894); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c03); + MP_WritePhyUshort(sc, 0x1d, 0x4824); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c07); + MP_WritePhyUshort(sc, 0x1d, 0x41ef); + MP_WritePhyUshort(sc, 0x1d, 0x41ff); + MP_WritePhyUshort(sc, 0x1d, 0x4891); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c07); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c17); + MP_WritePhyUshort(sc, 0x1d, 0x8400); + MP_WritePhyUshort(sc, 0x1d, 0x8ef8); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x8f8d); + MP_WritePhyUshort(sc, 0x1d, 0x92d5); + MP_WritePhyUshort(sc, 0x1d, 0xa10f); + MP_WritePhyUshort(sc, 0x1d, 0xd480); + MP_WritePhyUshort(sc, 0x1d, 0x0008); + MP_WritePhyUshort(sc, 0x1d, 0xd580); + MP_WritePhyUshort(sc, 0x1d, 0x00b8); + MP_WritePhyUshort(sc, 0x1d, 0xa202); + MP_WritePhyUshort(sc, 0x1d, 0x3167); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x4404); + MP_WritePhyUshort(sc, 0x1d, 0x3167); + MP_WritePhyUshort(sc, 0x1d, 0xd484); + MP_WritePhyUshort(sc, 0x1d, 0x00f3); + MP_WritePhyUshort(sc, 0x1d, 0xd484); + MP_WritePhyUshort(sc, 0x1d, 0x00f1); + MP_WritePhyUshort(sc, 0x1d, 0x30f4); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ee0); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5400); + MP_WritePhyUshort(sc, 0x1d, 0x4488); + MP_WritePhyUshort(sc, 0x1d, 0x41cf); + MP_WritePhyUshort(sc, 0x1d, 0x30f4); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4ec0); + MP_WritePhyUshort(sc, 0x1d, 0x48f3); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c09); + MP_WritePhyUshort(sc, 0x1d, 0x4508); + MP_WritePhyUshort(sc, 0x1d, 0x41c7); + MP_WritePhyUshort(sc, 0x1d, 0x8fb0); + MP_WritePhyUshort(sc, 0x1d, 0xd218); + MP_WritePhyUshort(sc, 0x1d, 0x00ae); + MP_WritePhyUshort(sc, 0x1d, 0xd2a4); + MP_WritePhyUshort(sc, 0x1d, 0x009e); + MP_WritePhyUshort(sc, 0x1d, 0x3188); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4e80); + MP_WritePhyUshort(sc, 0x1d, 0x4832); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c01); + MP_WritePhyUshort(sc, 0x1d, 0x7c1f); + MP_WritePhyUshort(sc, 0x1d, 0x4c11); + MP_WritePhyUshort(sc, 0x1d, 0x4428); + MP_WritePhyUshort(sc, 0x1d, 0x7c40); + MP_WritePhyUshort(sc, 0x1d, 0x5440); + MP_WritePhyUshort(sc, 0x1d, 0x7c01); + MP_WritePhyUshort(sc, 0x1d, 0x5801); + MP_WritePhyUshort(sc, 0x1d, 0x7c04); + MP_WritePhyUshort(sc, 0x1d, 0x5c04); + MP_WritePhyUshort(sc, 0x1d, 0x41e8); + MP_WritePhyUshort(sc, 0x1d, 0xa4b3); + MP_WritePhyUshort(sc, 0x1d, 0x319d); + MP_WritePhyUshort(sc, 0x1d, 0x7fe0); + MP_WritePhyUshort(sc, 0x1d, 0x4f20); + MP_WritePhyUshort(sc, 0x1d, 0x6800); + MP_WritePhyUshort(sc, 0x1d, 0x673e); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x0000); + MP_WritePhyUshort(sc, 0x1d, 0x570f); + MP_WritePhyUshort(sc, 0x1d, 0x5fff); + MP_WritePhyUshort(sc, 0x1d, 0xaa04); + MP_WritePhyUshort(sc, 0x1d, 0x585b); + MP_WritePhyUshort(sc, 0x1d, 0x6100); + MP_WritePhyUshort(sc, 0x1d, 0x31ad); + MP_WritePhyUshort(sc, 0x1d, 0x5867); + MP_WritePhyUshort(sc, 0x1d, 0x6080); + MP_WritePhyUshort(sc, 0x1d, 0xbcf2); + MP_WritePhyUshort(sc, 0x1d, 0x3001); + MP_WritePhyUshort(sc, 0x1f, 0x0004); + MP_WritePhyUshort(sc, 0x1c, 0x0200); + MP_WritePhyUshort(sc, 0x19, 0x7030); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x11, 0x83BA); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + ClearEthPhyBit(sc, 0x1A, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x8310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x18, 0x0310); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0007); + MP_WritePhyUshort(sc, 0x0E, 0x003C); + MP_WritePhyUshort(sc, 0x0D, 0x4007); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0003); + MP_WritePhyUshort(sc, 0x0E, 0x0015); + MP_WritePhyUshort(sc, 0x0D, 0x4003); + MP_WritePhyUshort(sc, 0x0E, 0x0000); + MP_WritePhyUshort(sc, 0x0D, 0x0000); + } else if (sc->re_type == MACFG_56) { + MP_WritePhyUshort(sc, 0x1F, 0x0A46); + PhyRegValue = MP_ReadPhyUshort(sc, 0x10); + TmpUshort = (PhyRegValue & BIT_8) ? 0 : BIT_15; + + MP_WritePhyUshort(sc, 0x1F, 0x0BCC); + ClearEthPhyBit(sc, 0x12, BIT_15); + SetEthPhyBit(sc, 0x12, TmpUshort); + + + MP_WritePhyUshort(sc, 0x1F, 0x0A46); + PhyRegValue = MP_ReadPhyUshort(sc, 0x13); + TmpUshort = (PhyRegValue & BIT_8) ? BIT_1 : 0; + + MP_WritePhyUshort(sc, 0x1F, 0x0C41); + ClearEthPhyBit(sc, 0x15, BIT_1); + SetEthPhyBit(sc, 0x15, TmpUshort); + + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, (BIT_3 | BIT_2)); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + + MP_WritePhyUshort(sc, 0x1F, 0x0BCC); + ClearEthPhyBit(sc, 0x14, BIT_8); + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_7); + SetEthPhyBit(sc, 0x11, BIT_6); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8084); + ClearEthPhyBit(sc, 0x14, (BIT_14 | BIT_13)); + SetEthPhyBit(sc, 0x10, BIT_12); + SetEthPhyBit(sc, 0x10, BIT_1); + SetEthPhyBit(sc, 0x10, BIT_0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + + MP_WritePhyUshort(sc, 0x1F, 0x0A4B); + SetEthPhyBit(sc, 0x11, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8012); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + + + MP_WritePhyUshort(sc, 0x1F, 0x0C42); + ClearAndSetEthPhyBit(sc, + 0x11, + BIT_13, + BIT_14 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x809A); + MP_WritePhyUshort(sc, 0x14, 0x8022); + MP_WritePhyUshort(sc, 0x13, 0x80A0); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x1000 + ); + MP_WritePhyUshort(sc, 0x13, 0x8088); + MP_WritePhyUshort(sc, 0x14, 0x9222); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + ClearEthPhyBit(sc, 0x14, BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_58) { + MP_WritePhyUshort(sc, 0x1F, 0x0BCC); + ClearEthPhyBit(sc, 0x14, BIT_8); + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_7); + SetEthPhyBit(sc, 0x11, BIT_6); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8084); + ClearEthPhyBit(sc, 0x14, (BIT_14 | BIT_13)); + SetEthPhyBit(sc, 0x10, BIT_12); + SetEthPhyBit(sc, 0x10, BIT_1); + SetEthPhyBit(sc, 0x10, BIT_0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8012); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0C42); + ClearAndSetEthPhyBit(sc, + 0x11, + BIT_13, + BIT_14 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + ClearEthPhyBit(sc, 0x14, BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_59) { + MP_WritePhyUshort(sc, 0x1F, 0x0BCC); + ClearEthPhyBit(sc, 0x14, BIT_8); + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_7); + SetEthPhyBit(sc, 0x11, BIT_6); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8084); + ClearEthPhyBit(sc, 0x14, (BIT_14 | BIT_13)); + SetEthPhyBit(sc, 0x10, BIT_12); + SetEthPhyBit(sc, 0x10, BIT_1); + SetEthPhyBit(sc, 0x10, BIT_0); + + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8012); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0BCE); + MP_WritePhyUshort(sc, 0x12, 0x8860); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80F3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8B00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F0); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x3A00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80EF); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0500 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F6); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80EC); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6800 + ); + MP_WritePhyUshort(sc, 0x13, 0x80ED); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7C00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F2); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xF400 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F4); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8500 + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8110); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xA800 + ); + MP_WritePhyUshort(sc, 0x13, 0x810F); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x1D00 + ); + MP_WritePhyUshort(sc, 0x13, 0x8111); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xF500 + ); + MP_WritePhyUshort(sc, 0x13, 0x8113); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6100 + ); + MP_WritePhyUshort(sc, 0x13, 0x8115); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9200 + ); + MP_WritePhyUshort(sc, 0x13, 0x810E); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0400 + ); + MP_WritePhyUshort(sc, 0x13, 0x810C); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7C00 + ); + MP_WritePhyUshort(sc, 0x13, 0x810B); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x5A00 + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80D1); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xFF00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80CD); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D5); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xCA00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D7); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8400 + ); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + ClearEthPhyBit(sc, 0x14, BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_60) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8012); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0BCE); + MP_WritePhyUshort(sc, 0x12, 0x8860); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80F3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8B00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F0); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x3A00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80EF); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0500 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F6); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80EC); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6800 + ); + MP_WritePhyUshort(sc, 0x13, 0x80ED); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7C00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F2); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xF400 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F4); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8500 + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8110); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xA800 + ); + MP_WritePhyUshort(sc, 0x13, 0x810F); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x1D00 + ); + MP_WritePhyUshort(sc, 0x13, 0x8111); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xF500 + ); + MP_WritePhyUshort(sc, 0x13, 0x8113); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6100 + ); + MP_WritePhyUshort(sc, 0x13, 0x8115); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9200 + ); + MP_WritePhyUshort(sc, 0x13, 0x810E); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0400 + ); + MP_WritePhyUshort(sc, 0x13, 0x810C); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7C00 + ); + MP_WritePhyUshort(sc, 0x13, 0x810B); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x5A00 + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80D1); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xFF00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80CD); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D5); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xCA00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D7); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8400 + ); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + ClearEthPhyBit(sc, 0x14, BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_61) { + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, (BIT_3 | BIT_2)); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + + MP_WritePhyUshort(sc, 0x1F, 0x0BCC); + ClearEthPhyBit(sc, 0x14, BIT_8); + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_7); + SetEthPhyBit(sc, 0x11, BIT_6); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8084); + ClearEthPhyBit(sc, 0x14, (BIT_14 | BIT_13)); + SetEthPhyBit(sc, 0x10, BIT_12); + SetEthPhyBit(sc, 0x10, BIT_1); + SetEthPhyBit(sc, 0x10, BIT_0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A4B); + SetEthPhyBit(sc, 0x11, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8012); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0C42); + ClearAndSetEthPhyBit(sc, + 0x11, + BIT_13, + BIT_14 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + ClearEthPhyBit(sc, 0x14, BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_62 || sc->re_type == MACFG_67) { + MP_WritePhyUshort(sc, 0x1F, 0x0BCC); + ClearEthPhyBit(sc, 0x14, BIT_8); + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_7); + SetEthPhyBit(sc, 0x11, BIT_6); + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8084); + ClearEthPhyBit(sc, 0x14, (BIT_14 | BIT_13)); + SetEthPhyBit(sc, 0x10, BIT_12); + SetEthPhyBit(sc, 0x10, BIT_1); + SetEthPhyBit(sc, 0x10, BIT_0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8012); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0C42); + ClearAndSetEthPhyBit(sc, + 0x11, + BIT_13, + BIT_14 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80F3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8B00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F0); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x3A00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80EF); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0500 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F6); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80EC); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6800 + ); + MP_WritePhyUshort(sc, 0x13, 0x80ED); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7C00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F2); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xF400 + ); + MP_WritePhyUshort(sc, 0x13, 0x80F4); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8500 + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8110); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xA800 + ); + MP_WritePhyUshort(sc, 0x13, 0x810F); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x1D00 + ); + MP_WritePhyUshort(sc, 0x13, 0x8111); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xF500 + ); + MP_WritePhyUshort(sc, 0x13, 0x8113); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6100 + ); + MP_WritePhyUshort(sc, 0x13, 0x8115); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9200 + ); + MP_WritePhyUshort(sc, 0x13, 0x810E); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0400 + ); + MP_WritePhyUshort(sc, 0x13, 0x810C); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7C00 + ); + MP_WritePhyUshort(sc, 0x13, 0x810B); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x5A00 + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80D1); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xFF00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80CD); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x0E00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D5); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xCA00 + ); + MP_WritePhyUshort(sc, 0x13, 0x80D7); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8400 + ); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + ClearEthPhyBit(sc, 0x14, BIT_14); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_63) { + MP_WritePhyUshort(sc, 0x1f, 0x0002); + MP_WritePhyUshort(sc, 0x10, 0x0008); + MP_WritePhyUshort(sc, 0x0d, 0x006c); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0cc0); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x0B, 0xA4D8); + MP_WritePhyUshort(sc, 0x09, 0x281C); + MP_WritePhyUshort(sc, 0x07, 0x2883); + MP_WritePhyUshort(sc, 0x0A, 0x6B35); + MP_WritePhyUshort(sc, 0x1D, 0x3DA4); + MP_WritePhyUshort(sc, 0x1C, 0xEFFD); + MP_WritePhyUshort(sc, 0x14, 0x7F52); + MP_WritePhyUshort(sc, 0x18, 0x7FC6); + MP_WritePhyUshort(sc, 0x08, 0x0601); + MP_WritePhyUshort(sc, 0x06, 0x4063); + MP_WritePhyUshort(sc, 0x10, 0xF074); + MP_WritePhyUshort(sc, 0x1F, 0x0003); + MP_WritePhyUshort(sc, 0x13, 0x0789); + MP_WritePhyUshort(sc, 0x12, 0xF4BD); + MP_WritePhyUshort(sc, 0x1A, 0x04FD); + MP_WritePhyUshort(sc, 0x14, 0x84B0); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x01, 0x0340); + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x04, 0x4000); + MP_WritePhyUshort(sc, 0x03, 0x1D21); + MP_WritePhyUshort(sc, 0x02, 0x0C32); + MP_WritePhyUshort(sc, 0x01, 0x0200); + MP_WritePhyUshort(sc, 0x00, 0x5554); + MP_WritePhyUshort(sc, 0x04, 0x4800); + MP_WritePhyUshort(sc, 0x04, 0x4000); + MP_WritePhyUshort(sc, 0x04, 0xF000); + MP_WritePhyUshort(sc, 0x03, 0xDF01); + MP_WritePhyUshort(sc, 0x02, 0xDF20); + MP_WritePhyUshort(sc, 0x01, 0x101A); + MP_WritePhyUshort(sc, 0x00, 0xA0FF); + MP_WritePhyUshort(sc, 0x04, 0xF800); + MP_WritePhyUshort(sc, 0x04, 0xF000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0D); + PhyRegValue |= (BIT_5); + MP_WritePhyUshort(sc, 0x0D, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0C); + PhyRegValue |= (BIT_10); + MP_WritePhyUshort(sc, 0x0C, PhyRegValue); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_64) { + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0cc0); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x01, 0x0340); + MP_WritePhyUshort(sc, 0x1F, 0x0001); + MP_WritePhyUshort(sc, 0x04, 0x4000); + MP_WritePhyUshort(sc, 0x03, 0x1D21); + MP_WritePhyUshort(sc, 0x02, 0x0C32); + MP_WritePhyUshort(sc, 0x01, 0x0200); + MP_WritePhyUshort(sc, 0x00, 0x5554); + MP_WritePhyUshort(sc, 0x04, 0x4800); + MP_WritePhyUshort(sc, 0x04, 0x4000); + MP_WritePhyUshort(sc, 0x04, 0xF000); + MP_WritePhyUshort(sc, 0x03, 0xDF01); + MP_WritePhyUshort(sc, 0x02, 0xDF20); + MP_WritePhyUshort(sc, 0x01, 0x101A); + MP_WritePhyUshort(sc, 0x00, 0xA0FF); + MP_WritePhyUshort(sc, 0x04, 0xF800); + MP_WritePhyUshort(sc, 0x04, 0xF000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x0023); + MP_WritePhyUshort(sc, 0x16, 0x0000); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0D); + PhyRegValue |= (BIT_5); + MP_WritePhyUshort(sc, 0x0D, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0C); + PhyRegValue |= (BIT_10); + MP_WritePhyUshort(sc, 0x0C, PhyRegValue); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_65) { + MP_WritePhyUshort(sc, 0x1f, 0x0001); + MP_WritePhyUshort(sc, 0x17, 0x0cc0); + MP_WritePhyUshort(sc, 0x1f, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0D); + PhyRegValue |= (BIT_5); + MP_WritePhyUshort(sc, 0x0D, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0C); + PhyRegValue |= (BIT_10); + MP_WritePhyUshort(sc, 0x0C, PhyRegValue); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0007); + MP_WritePhyUshort(sc, 0x1E, 0x002C); + MP_WritePhyUshort(sc, 0x15, 0x035D); + MP_WritePhyUshort(sc, 0x1F, 0x0005); + MP_WritePhyUshort(sc, 0x01, 0x0300); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_66) { + MP_WritePhyUshort(sc, 0x1F, 0x0000); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0D); + PhyRegValue |= (BIT_5); + MP_WritePhyUshort(sc, 0x0D, PhyRegValue); + + MP_WritePhyUshort(sc, 0x1F, 0x0002); + PhyRegValue = MP_ReadPhyUshort(sc, 0x0C); + PhyRegValue |= (BIT_10); + MP_WritePhyUshort(sc, 0x0C, PhyRegValue); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_68) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x809b); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xF800, + 0x8000 + ); + MP_WritePhyUshort(sc, 0x13, 0x80A2); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8000 + ); + MP_WritePhyUshort(sc, 0x13, 0x80A4); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8500 + ); + MP_WritePhyUshort(sc, 0x13, 0x809C); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xbd00 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x80AD); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xF800, + 0x7000 + ); + MP_WritePhyUshort(sc, 0x13, 0x80B4); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x5000 + ); + MP_WritePhyUshort(sc, 0x13, 0x80AC); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x4000 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x808E); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x1200 + ); + MP_WritePhyUshort(sc, 0x13, 0x8090); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xE500 + ); + MP_WritePhyUshort(sc, 0x13, 0x8092); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9F00 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + dout_tapbin = 0x0000; + MP_WritePhyUshort(sc, 0x1F, 0x0A46); + TmpUshort = MP_ReadPhyUshort(sc, 0x13); + TmpUshort &= (BIT_1|BIT_0); + TmpUshort <<= 2; + dout_tapbin |= TmpUshort; + + TmpUshort = MP_ReadPhyUshort(sc, 0x12); + TmpUshort &= (BIT_15|BIT_14); + TmpUshort >>= 14; + dout_tapbin |= TmpUshort; + + dout_tapbin = ~(dout_tapbin^BIT_3); + dout_tapbin <<= 12; + dout_tapbin &= 0xF000; + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + + MP_WritePhyUshort(sc, 0x13, 0x827A); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12, + dout_tapbin + ); + + + MP_WritePhyUshort(sc, 0x13, 0x827B); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12, + dout_tapbin + ); + + + MP_WritePhyUshort(sc, 0x13, 0x827C); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12, + dout_tapbin + ); + + + MP_WritePhyUshort(sc, 0x13, 0x827D); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12, + dout_tapbin + ); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + SetEthPhyBit(sc, 0x14, BIT_11); + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + SetEthPhyBit(sc, 0x16, BIT_1); + + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_11); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0BCA); + ClearAndSetEthPhyBit(sc, + 0x17, + (BIT_13 | BIT_12), + BIT_14 + ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x803F); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x13, 0x8047); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x13, 0x804F); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x13, 0x8057); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x13, 0x805F); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x13, 0x8067); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x13, 0x806F); + ClearEthPhyBit(sc, 0x14, (BIT_13 | BIT_12)); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8045); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x804d); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x805d); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x8011); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_69) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x808A); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0, + 0x0A); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + SetEthPhyBit(sc, 0x14, BIT_11); + MP_WritePhyUshort(sc, 0x1F, 0x0A42); + SetEthPhyBit(sc, 0x16, BIT_1); + + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_11); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (sc->RequireAdcBiasPatch) { + MP_WritePhyUshort(sc, 0x1F, 0x0BCF); + MP_WritePhyUshort(sc, 0x16, sc->AdcBiasPatchIoffset); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + { + u_int16_t rlen; + + MP_WritePhyUshort(sc, 0x1F, 0x0BCD); + PhyRegValue = MP_ReadPhyUshort(sc, 0x16); + PhyRegValue &= 0x000F; + + if (PhyRegValue > 3) { + rlen = PhyRegValue - 3; + } else { + rlen = 0; + } + + PhyRegValue = rlen | (rlen<<4) | (rlen<<8) | (rlen<<12); + + MP_WritePhyUshort(sc, 0x1F, 0x0BCD); + MP_WritePhyUshort(sc, 0x17, PhyRegValue); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x85FE); + ClearAndSetEthPhyBit( + sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12|BIT_11|BIT_10|BIT_8, + BIT_9); + MP_WritePhyUshort(sc, 0x13, 0x85FF); + ClearAndSetEthPhyBit( + sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12, + BIT_11|BIT_10|BIT_9|BIT_8); + MP_WritePhyUshort(sc, 0x13, 0x814B); + ClearAndSetEthPhyBit( + sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_11|BIT_10|BIT_9|BIT_8, + BIT_12); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8045); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x804d); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x805d); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x8011); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x808E); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x4800); + MP_WritePhyUshort(sc, 0x13, 0x8090); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xCC00); + MP_WritePhyUshort(sc, 0x13, 0x8092); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xB000); + MP_WritePhyUshort(sc, 0x13, 0x8088); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6000); + MP_WritePhyUshort(sc, 0x13, 0x808B); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_13|BIT_12|BIT_11|BIT_10|BIT_9|BIT_8, + 0x0B00); + MP_WritePhyUshort(sc, 0x13, 0x808D); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_12|BIT_11|BIT_10|BIT_9|BIT_8, + 0x0600); + MP_WritePhyUshort(sc, 0x13, 0x808C); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0xB000); + + MP_WritePhyUshort(sc, 0x13, 0x80A0); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x2800); + MP_WritePhyUshort(sc, 0x13, 0x80A2); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x5000); + MP_WritePhyUshort(sc, 0x13, 0x809B); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12|BIT_11, + BIT_15|BIT_13|BIT_12); + MP_WritePhyUshort(sc, 0x13, 0x809A); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x4B00); + MP_WritePhyUshort(sc, 0x13, 0x809D); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_13|BIT_12|BIT_11|BIT_10|BIT_9|BIT_8, + 0x0800); + MP_WritePhyUshort(sc, 0x13, 0x80A1); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x7000); + MP_WritePhyUshort(sc, 0x13, 0x809F); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_12|BIT_11|BIT_10|BIT_9|BIT_8, + 0x0300); + MP_WritePhyUshort(sc, 0x13, 0x809E); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x8800); + + MP_WritePhyUshort(sc, 0x13, 0x80B2); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x2200); + MP_WritePhyUshort(sc, 0x13, 0x80AD); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_15|BIT_14|BIT_13|BIT_12|BIT_11, + BIT_15|BIT_12|BIT_11); + MP_WritePhyUshort(sc, 0x13, 0x80AF); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_13|BIT_12|BIT_11|BIT_10|BIT_9|BIT_8, + 0x0800); + MP_WritePhyUshort(sc, 0x13, 0x80B3); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x6F00); + MP_WritePhyUshort(sc, 0x13, 0x80B1); + ClearAndSetEthPhyBit(sc, + 0x14, + BIT_12|BIT_11|BIT_10|BIT_9|BIT_8, + 0x0300); + MP_WritePhyUshort(sc, 0x13, 0x80B0); + ClearAndSetEthPhyBit(sc, + 0x14, + 0xFF00, + 0x9300); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8011); + SetEthPhyBit(sc, 0x14, BIT_11); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit( sc, 0x11, BIT_11 ); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8016); + SetEthPhyBit(sc, 0x14, BIT_10); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1 && !HW_SUPP_SERDES_PHY(sc)) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + MP_WritePhyUshort(sc, 0x13, 0x8045); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x804d); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x805d); + MP_WritePhyUshort(sc, 0x14, 0x2444); + MP_WritePhyUshort(sc, 0x13, 0x8011); + SetEthPhyBit(sc, 0x14, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0A40); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + MP_WritePhyUshort(sc, 0x00, 0x9200); + } else if (sc->re_type == MACFG_74) { + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_11); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + + if (phy_power_saving == 1) { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_2); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + DELAY(20000); + } + + } else if (sc->re_type == MACFG_80) { + ClearAndSetEthPhyOcpBit(sc, + 0xAD40, + 0x03FF, + 0x84 + ); + + SetEthPhyOcpBit(sc, 0xAD4E, BIT_4); + ClearAndSetEthPhyOcpBit(sc, + 0xAD16, + 0x03FF, + 0x0006 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xAD32, + 0x003F, + 0x0006 + ); + ClearEthPhyOcpBit(sc, 0xAC08, BIT_12); + ClearEthPhyOcpBit(sc, 0xAC08, BIT_8); + ClearAndSetEthPhyOcpBit(sc, + 0xAC8A, + BIT_15|BIT_14|BIT_13|BIT_12, + BIT_14|BIT_13|BIT_12 + ); + SetEthPhyOcpBit(sc, 0xAD18, BIT_10); + SetEthPhyOcpBit(sc, 0xAD1A, 0x3FF); + SetEthPhyOcpBit(sc, 0xAD1C, 0x3FF); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80EA); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0xC400 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80EB); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0x0700, + 0x0300 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80F8); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x1C00 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80F1); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x3000 + ); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80FE); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0xA500 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8102); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x5000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8105); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x3300 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8100); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x7000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8104); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0xF000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8106); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x6500 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80DC); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0xED00 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80DF); + SetEthPhyOcpBit(sc, 0xA438, BIT_8); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80E1); + ClearEthPhyOcpBit(sc, 0xA438, BIT_8); + + + ClearAndSetEthPhyOcpBit(sc, + 0xBF06, + 0x003F, + 0x38 + ); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x819F); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xD0B6); + + + MP_RealWritePhyOcpRegWord(sc, 0xBC34, 0x5555); + ClearAndSetEthPhyOcpBit(sc, + 0xBF0A, + BIT_11|BIT_10|BIT_9, + BIT_11|BIT_9 + ); + + + ClearEthPhyOcpBit(sc, 0xA5C0, BIT_10); + + + SetEthPhyOcpBit(sc, 0xA442, BIT_11); + + + if (phy_power_saving == 1) { + SetEthPhyOcpBit(sc, 0xA430, BIT_2); + } else { + ClearEthPhyOcpBit(sc, 0xA430, BIT_2); + DELAY(20000); + } + } else if (sc->re_type == MACFG_81) { + SetEthPhyOcpBit(sc, 0xAD4E, BIT_4); + ClearAndSetEthPhyOcpBit(sc, + 0xAD16, + 0x03FF, + 0x03FF + ); + ClearAndSetEthPhyOcpBit(sc, + 0xAD32, + 0x003F, + 0x0006 + ); + ClearEthPhyOcpBit(sc, 0xAC08, BIT_12); + ClearEthPhyOcpBit(sc, 0xAC08, BIT_8); + ClearAndSetEthPhyOcpBit(sc, + 0xACC0, + BIT_1|BIT_0, + BIT_1 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xAD40, + BIT_7|BIT_6|BIT_5, + BIT_6 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xAD40, + BIT_2|BIT_1|BIT_0, + BIT_2 + ); + ClearEthPhyOcpBit(sc, 0xAC14, BIT_7); + ClearEthPhyOcpBit(sc, 0xAC80, BIT_9|BIT_8); + ClearAndSetEthPhyOcpBit(sc, + 0xAC5E, + BIT_2|BIT_1|BIT_0, + BIT_1 + ); + MP_RealWritePhyOcpRegWord(sc, 0xAD4C, 0x00A8); + MP_RealWritePhyOcpRegWord(sc, 0xAC5C, 0x01FF); + ClearAndSetEthPhyOcpBit(sc, + 0xAC8A, + BIT_7|BIT_6|BIT_5|BIT_4, + BIT_5|BIT_4 + ); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8157); + ClearAndSetEthPhyOcpBit(sc, + 0xB87E, + 0xFF00, + 0x0500 + ); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8159); + ClearAndSetEthPhyOcpBit(sc, + 0xB87E, + 0xFF00, + 0x0700 + ); + + + CSR_WRITE_2(sc, RE_EEE_TXIDLE_TIMER_8125, ifp->if_mtu + ETHER_HDR_LEN + 0x20); + + + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x80A2); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0153); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x809C); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0153); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x81B3); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0043); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00A7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00D6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00EC); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00F6); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00FB); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00FD); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00FF); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x00BB); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0058); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0029); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0013); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0009); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0004); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0002); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0000); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8257); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x020F); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80EA); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x7843); + + + re_set_phy_mcu_patch_request(sc); + + ClearEthPhyOcpBit(sc, 0xB896, BIT_0); + ClearEthPhyOcpBit(sc, 0xB892, 0xFF00); + + + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC091); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x6E12); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC092); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1214); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC094); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1516); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC096); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x171B); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC098); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1B1C); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC09A); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1F1F); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC09C); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x2021); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC09E); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x2224); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC0A0); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x2424); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC0A2); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x2424); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC0A4); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x2424); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC018); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0AF2); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC01A); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0D4A); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC01C); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0F26); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC01E); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x118D); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC020); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x14F3); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC022); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x175A); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC024); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x19C0); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC026); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1C26); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC089); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x6050); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC08A); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x5F6E); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC08C); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x6E6E); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC08E); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x6E6E); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC090); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x6E12); + + SetEthPhyOcpBit(sc, 0xB896, BIT_0); + + re_clear_phy_mcu_patch_request(sc); + + + SetEthPhyOcpBit(sc, 0xD068, BIT_13); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x81A2); + SetEthPhyOcpBit(sc, 0xA438, BIT_8); + ClearAndSetEthPhyOcpBit(sc, + 0xB54C, + 0xFF00, + 0xDB00); + + + ClearEthPhyOcpBit(sc, 0xA454, BIT_0); + + + SetEthPhyOcpBit(sc, 0xA5D4, BIT_5); + ClearEthPhyOcpBit(sc, 0xAD4E, BIT_4); + ClearEthPhyOcpBit(sc, 0xA86A, BIT_0); + + + SetEthPhyOcpBit(sc, 0xA442, BIT_11); + + + if (sc->RequirePhyMdiSwapPatch) { + u_int16_t adccal_offset_p0; + u_int16_t adccal_offset_p1; + u_int16_t adccal_offset_p2; + u_int16_t adccal_offset_p3; + u_int16_t rg_lpf_cap_xg_p0; + u_int16_t rg_lpf_cap_xg_p1; + u_int16_t rg_lpf_cap_xg_p2; + u_int16_t rg_lpf_cap_xg_p3; + u_int16_t rg_lpf_cap_p0; + u_int16_t rg_lpf_cap_p1; + u_int16_t rg_lpf_cap_p2; + u_int16_t rg_lpf_cap_p3; + + // GPHY OCP 0xD068 bit[2:0] = 0x1 ([2:1]:subadc,[0]:offset) + // GPHY OCP 0xD068 bit[4:3] = 0x0 (p0) + // adccal_offset_p0 = GPHY OCP 0xD06A bit[10:0] + // GPHY OCP 0xD068 bit[4:3] = 0x1 (p1) + // adccal_offset_p1 = GPHY OCP 0xD06A bit[10:0] + // GPHY OCP 0xD068 bit[4:3] = 0x2 (p2) + // adccal_offset_p2 = GPHY OCP 0xD06A bit[10:0] + // GPHY OCP 0xD068 bit[4:3] = 0x3 (p3) + // adccal_offset_p3 = GPHY OCP 0xD06A bit[10:0] + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0007, + 0x0001 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0000 + ); + adccal_offset_p0 = MP_RealReadPhyOcpRegWord(sc, 0xD06A); + adccal_offset_p0 &= 0x07FF; + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0008 + ); + adccal_offset_p1 = MP_RealReadPhyOcpRegWord(sc, 0xD06A); + adccal_offset_p1 &= 0x07FF; + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0010 + ); + adccal_offset_p2 = MP_RealReadPhyOcpRegWord(sc, 0xD06A); + adccal_offset_p2 &= 0x07FF; + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0018 + ); + adccal_offset_p3 = MP_RealReadPhyOcpRegWord(sc, 0xD06A); + adccal_offset_p3 &= 0x07FF; + + + // GPHY OCP 0xD068 bit[4:3] = 0x0 (p0) + // GPHY OCP 0xD06A bit[10:0] = adccal_offset_p3 + // GPHY OCP 0xD068 bit[4:3] = 0x1 (p1) + // GPHY OCP 0xD06A bit[10:0] = adccal_offset_p2 + // GPHY OCP 0xD068 bit[4:3] = 0x2 (p2) + // GPHY OCP 0xD06A bit[10:0] = adccal_offset_p1 + // GPHY OCP 0xD068 bit[4:3] = 0x3 (p3) + // GPHY OCP 0xD06A bit[10:0] = adccal_offset_p0 + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0000 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD06A, + 0x07FF, + adccal_offset_p3 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0008 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD06A, + 0x07FF, + adccal_offset_p2 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0010 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD06A, + 0x07FF, + adccal_offset_p1 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD068, + 0x0018, + 0x0018 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xD06A, + 0x07FF, + adccal_offset_p0 + ); + // rg_lpf_cap_xg_p0 = GPHY OCP 0xBD5A bit[4:0] + // rg_lpf_cap_xg_p1 = GPHY OCP 0xBD5A bit[12:8] + // rg_lpf_cap_xg_p2 = GPHY OCP 0xBD5C bit[4:0] + // rg_lpf_cap_xg_p3 = GPHY OCP 0xBD5C bit[12:8] + // rg_lpf_cap_p0 = GPHY OCP 0xBC18 bit[4:0] + // rg_lpf_cap_p1 = GPHY OCP 0xBC18 bit[12:8] + // rg_lpf_cap_p2 = GPHY OCP 0xBC1A bit[4:0] + // rg_lpf_cap_p3 = GPHY OCP 0xBC1A bit[12:8] + rg_lpf_cap_xg_p0 = MP_RealReadPhyOcpRegWord(sc, 0xBD5A); + rg_lpf_cap_xg_p0 &= 0x001F; + rg_lpf_cap_xg_p1 = MP_RealReadPhyOcpRegWord(sc, 0xBD5A); + rg_lpf_cap_xg_p1 &= 0x1F00; + rg_lpf_cap_xg_p2 = MP_RealReadPhyOcpRegWord(sc, 0xBD5C); + rg_lpf_cap_xg_p2 &= 0x001F; + rg_lpf_cap_xg_p3 = MP_RealReadPhyOcpRegWord(sc, 0xBD5C); + rg_lpf_cap_xg_p3 &= 0x1F00; + rg_lpf_cap_p0 = MP_RealReadPhyOcpRegWord(sc, 0xBC18); + rg_lpf_cap_p0 &= 0x001F; + rg_lpf_cap_p1 = MP_RealReadPhyOcpRegWord(sc, 0xBC18); + rg_lpf_cap_p1 &= 0x1F00; + rg_lpf_cap_p2 = MP_RealReadPhyOcpRegWord(sc, 0xBC1A); + rg_lpf_cap_p2 &= 0x001F; + rg_lpf_cap_p3 = MP_RealReadPhyOcpRegWord(sc, 0xBC1A); + rg_lpf_cap_p3 &= 0x1F00; + + // GPHY OCP 0xBD5A bit[4:0] = rg_lpf_cap_xg_p3 + // GPHY OCP 0xBD5A bit[12:8] = rg_lpf_cap_xg_p2 + // GPHY OCP 0xBD5C bit[4:0] = rg_lpf_cap_xg_p1 + // GPHY OCP 0xBD5C bit[12:8] = rg_lpf_cap_xg_p0 + // GPHY OCP 0xBC18 bit[4:0] = rg_lpf_cap_p3 + // GPHY OCP 0xBC18 bit[12:8] = rg_lpf_cap_p2 + // GPHY OCP 0xBC1A bit[4:0] = rg_lpf_cap_p1 + // GPHY OCP 0xBC1A bit[12:8] = rg_lpf_cap_p0 + ClearAndSetEthPhyOcpBit(sc, + 0xBD5A, + 0x001F, + rg_lpf_cap_xg_p3 >> 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBD5A, + 0x1F00, + rg_lpf_cap_xg_p2 << 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBD5C, + 0x001F, + rg_lpf_cap_xg_p1 >> 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBD5C, + 0x1F00, + rg_lpf_cap_xg_p0 << 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBC18, + 0x001F, + rg_lpf_cap_p3 >> 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBC18, + 0x1F00, + rg_lpf_cap_p2 << 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBC1A, + 0x001F, + rg_lpf_cap_p1 >> 8 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xBC1A, + 0x1F00, + rg_lpf_cap_p0 << 8 + ); + } + + + if (phy_power_saving == 1) { + SetEthPhyOcpBit(sc, 0xA430, BIT_2); + } else { + ClearEthPhyOcpBit(sc, 0xA430, BIT_2); + DELAY(20000); + } + } else if (sc->re_type == MACFG_82) { + SetEthPhyOcpBit(sc, 0xA442, BIT_11); + + + SetEthPhyOcpBit(sc, 0xBC08, (BIT_3 | BIT_2)); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8FFF); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x0400 + ); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8560); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x19CC); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8562); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x19CC); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8564); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x19CC); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8566); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x147D); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8568); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x147D); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x856A); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x147D); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FFE); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0907); + ClearAndSetEthPhyOcpBit(sc, + 0xACDA, + 0xFF00, + 0xFF00 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xACDE, + 0xF000, + 0xF000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x80D6); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x2801); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x80F2); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x2801); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x80F4); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x6077); + MP_RealWritePhyOcpRegWord(sc, 0xB506, 0x01E7); + MP_RealWritePhyOcpRegWord(sc, 0xAC8C, 0x0FFC); + MP_RealWritePhyOcpRegWord(sc, 0xAC46, 0xB7B4); + MP_RealWritePhyOcpRegWord(sc, 0xAC50, 0x0FBC); + MP_RealWritePhyOcpRegWord(sc, 0xAC3C, 0x9240); + MP_RealWritePhyOcpRegWord(sc, 0xAC4E, 0x0DB4); + MP_RealWritePhyOcpRegWord(sc, 0xACC6, 0x0707); + MP_RealWritePhyOcpRegWord(sc, 0xACC8, 0xA0D3); + MP_RealWritePhyOcpRegWord(sc, 0xAD08, 0x0007); + + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8013); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0700); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FB9); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x2801); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FBA); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0100); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FBC); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x1900); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FBE); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xE100); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FC0); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0800); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FC2); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xE500); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FC4); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0F00); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FC6); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xF100); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FC8); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0400); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FCa); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xF300); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FCc); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xFD00); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FCe); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xFF00); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FD0); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xFB00); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FD2); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0100); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FD4); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xF400); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FD6); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xFF00); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8FD8); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xF600); + + + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x813D); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x390E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x814F); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x790E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x80B0); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0F31); + SetEthPhyOcpBit(sc, 0xBF4C, BIT_1); + SetEthPhyOcpBit(sc, 0xBCCA, (BIT_9 | BIT_8)); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8141); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x320E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8153); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x720E); + ClearEthPhyOcpBit(sc, 0xA432, BIT_6); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8529); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x050E); + + + CSR_WRITE_2(sc, RE_EEE_TXIDLE_TIMER_8125, ifp->if_mtu + ETHER_HDR_LEN + 0x20); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x816C); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xC4A0); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8170); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xC4A0); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8174); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x04A0); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8178); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x04A0); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x817C); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0719); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8FF4); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0400); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8FF1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0404); + MP_RealWritePhyOcpRegWord(sc, 0xBF4A, 0x001B); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8033); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x7C13); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8037); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x7C13); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x803B); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0xFC32); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x803F); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x7C13); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8043); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x7C13); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8047); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x7C13); + + + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8145); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x370E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8157); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x770E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8169); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x0D0A); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x817B); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x1D0A); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8217); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x5000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x821A); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x5000 + ); + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80DA); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0403); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80DC); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x1000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80B3); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x0384); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80B7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2007); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80BA); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x6C00 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80B5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xF009); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80BD); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x9F00 + ); + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80C7); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xf083); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80DD); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x03f0); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80DF); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x1000 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80CB); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x2007); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80CE); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x6C00 + ); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80C9); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x8009); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80D1); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0x8000 + ); + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80A3); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x200A); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80A5); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0xF0AD); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x809F); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x6073); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80A1); + MP_RealWritePhyOcpRegWord(sc, 0xA438, 0x000B); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x80A9); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + 0xFF00, + 0xC000 + ); + + re_set_phy_mcu_patch_request(sc); + + ClearEthPhyOcpBit(sc, 0xB896, BIT_0); + ClearEthPhyOcpBit(sc, 0xB892, 0xFF00); + + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC23E); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0000); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC240); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0103); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC242); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0507); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC244); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x090B); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC246); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x0C0E); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC248); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1012); + MP_RealWritePhyOcpRegWord(sc, 0xB88E, 0xC24A); + MP_RealWritePhyOcpRegWord(sc, 0xB890, 0x1416); + + SetEthPhyOcpBit(sc, 0xB896, BIT_0); + + re_clear_phy_mcu_patch_request(sc); + + + SetEthPhyOcpBit(sc, 0xA86A, BIT_0); + SetEthPhyOcpBit(sc, 0xA6F0, BIT_0); + + + MP_RealWritePhyOcpRegWord(sc, 0xBFA0, 0xD70D); + MP_RealWritePhyOcpRegWord(sc, 0xBFA2, 0x4100); + MP_RealWritePhyOcpRegWord(sc, 0xBFA4, 0xE868); + MP_RealWritePhyOcpRegWord(sc, 0xBFA6, 0xDC59); + MP_RealWritePhyOcpRegWord(sc, 0xB54C, 0x3C18); + ClearEthPhyOcpBit(sc, 0xBFA4, BIT_5); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x817D); + SetEthPhyOcpBit(sc, 0xA438, BIT_12); + + + if (phy_power_saving == 1) { + SetEthPhyOcpBit(sc, 0xA430, BIT_2); + } else { + ClearEthPhyOcpBit(sc, 0xA430, BIT_2); + DELAY(20000); + } + } else if (sc->re_type == MACFG_83) { + SetEthPhyOcpBit(sc, 0xA442, BIT_11); + + + ClearAndSetEthPhyOcpBit(sc, + 0xAC46, + 0x00F0, + 0x0090 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xAD30, + 0x0003, + 0x0001 + ); + + + CSR_WRITE_2(sc, RE_EEE_TXIDLE_TIMER_8125, ifp->if_mtu + ETHER_HDR_LEN + 0x20); + + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x80F5); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x760E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8107); + MP_RealWritePhyOcpRegWord(sc, 0xB87E, 0x360E); + MP_RealWritePhyOcpRegWord(sc, 0xB87C, 0x8551); + ClearAndSetEthPhyOcpBit(sc, + 0xB87E, + BIT_15 | BIT_14 | BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8, + BIT_11 + ); + + ClearAndSetEthPhyOcpBit(sc, + 0xbf00, + 0xE000, + 0xA000 + ); + ClearAndSetEthPhyOcpBit(sc, + 0xbf46, + 0x0F00, + 0x0300 + ); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x8044); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x804A); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x8050); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x8056); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x805C); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x8062); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x8068); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x806E); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x8074); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + MP_RealWritePhyOcpRegWord(sc, 0xa436, 0x807A); + MP_RealWritePhyOcpRegWord(sc, 0xa438, 0x2417); + + + SetEthPhyOcpBit(sc, 0xA4CA, BIT_6); + + + ClearAndSetEthPhyOcpBit(sc, + 0xBF84, + BIT_15 | BIT_14 | BIT_13, + BIT_15 | BIT_13 + ); + + + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x8170); + ClearAndSetEthPhyOcpBit(sc, + 0xA438, + BIT_13 | BIT_10 | BIT_9 | BIT_8, + BIT_15 | BIT_14 | BIT_12 | BIT_11 + ); + + /* + MP_RealWritePhyOcpRegWord(sc, 0xBFA0, 0xD70D); + MP_RealWritePhyOcpRegWord(sc, 0xBFA2, 0x4100); + MP_RealWritePhyOcpRegWord(sc, 0xBFA4, 0xE868); + MP_RealWritePhyOcpRegWord(sc, 0xBFA6, 0xDC59); + MP_RealWritePhyOcpRegWord(sc, 0xB54C, 0x3C18); + ClearEthPhyOcpBit(sc, 0xBFA4, BIT_5); + MP_RealWritePhyOcpRegWord(sc, 0xA436, 0x817D); + SetEthPhyOcpBit(sc, 0xA438, BIT_12); + */ + + + if (phy_power_saving == 1) { + SetEthPhyOcpBit(sc, 0xA430, BIT_2); + } else { + ClearEthPhyOcpBit(sc, 0xA430, BIT_2); + DELAY(20000); + } + } + +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(sc)) + re_hw_fiber_phy_config(sc); +#endif //ENABLE_FIBER_SUPPORT + + //EthPhyPPSW + if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57 || + sc->re_type == MACFG_58 || sc->re_type == MACFG_59 || + sc->re_type == MACFG_60) { + //disable EthPhyPPSW + MP_WritePhyUshort(sc, 0x1F, 0x0BCD); + MP_WritePhyUshort(sc, 0x14, 0x5065); + MP_WritePhyUshort(sc, 0x14, 0xD065); + MP_WritePhyUshort(sc, 0x1F, 0x0BC8); + MP_WritePhyUshort(sc, 0x12, 0x00ED); + MP_WritePhyUshort(sc, 0x1F, 0x0BCD); + MP_WritePhyUshort(sc, 0x14, 0x1065); + MP_WritePhyUshort(sc, 0x14, 0x9065); + MP_WritePhyUshort(sc, 0x14, 0x1065); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_74) { + //enable EthPhyPPSW + MP_WritePhyUshort(sc, 0x1F, 0x0A44); + SetEthPhyBit(sc, 0x11, BIT_7); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + switch(sc->re_type) { + case MACFG_56: + case MACFG_57: + case MACFG_58: + case MACFG_59: + case MACFG_60: + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + if (phy_mdix_mode == RE_ETH_PHY_FORCE_MDI) { + //Force MDI + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + SetEthPhyBit(sc, 0x10, BIT_8 | BIT_9); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else if (phy_mdix_mode == RE_ETH_PHY_FORCE_MDIX) { + //Force MDIX + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_8); + SetEthPhyBit(sc, 0x10, BIT_9); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } else { + //Auto MDI/MDIX + MP_WritePhyUshort(sc, 0x1F, 0x0A43); + ClearEthPhyBit(sc, 0x10, BIT_8 | BIT_9); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + } + + break; + } + + //legacy force mode(Chap 22) + switch(sc->re_type) { + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + MP_WritePhyUshort(sc, 0x1F, 0x0A5B); + ClearEthPhyBit(sc, 0x12, BIT_15); + MP_WritePhyUshort(sc, 0x1F, 0x0000); + break; + } + + if (phy_power_saving == 1) { + switch (sc->re_type) { + case MACFG_59: + case MACFG_60: + case MACFG_62: + case MACFG_67: + case MACFG_68: + case MACFG_69: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + case MACFG_74: + re_enable_ocp_phy_power_saving(sc); + break; + case MACFG_80: + case MACFG_81: + case MACFG_82: + case MACFG_83: + //re_enable_ocp_phy_power_saving(sc); + break; + } + } + + if (eee_enable == 1) + re_enable_EEE(sc); + else + re_disable_EEE(sc); + + MP_WritePhyUshort(sc, 0x1F, 0x0000); +} + +void MP_WritePhyUshort(struct re_softc *sc,u_int8_t RegAddr,u_int16_t RegData) +{ + u_int32_t TmpUlong=0x80000000; + u_int32_t Timeout=0; + + if (RegAddr == 0x1F) { + sc->cur_page = RegData; + } + + if (sc->re_type == MACFG_63) { + int i; + CSR_WRITE_4(sc, RE_OCPDR, OCPDR_Write | + (RegAddr & OCPDR_Reg_Mask) << OCPDR_GPHY_Reg_shift | + (RegData & OCPDR_Data_Mask)); + CSR_WRITE_4(sc, RE_OCPAR, OCPAR_GPHY_Write); + CSR_WRITE_4(sc, RE_EPHY_RXER_NUM, 0); + + for (i = 0; i < 100; i++) { + DELAY(1000); + if (!(CSR_READ_4(sc, RE_OCPAR) & OCPAR_Flag)) + break; + } + } else if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57 || + sc->re_type == MACFG_58 || sc->re_type == MACFG_59 || + sc->re_type == MACFG_60 || sc->re_type == MACFG_61 || + sc->re_type == MACFG_62 || sc->re_type == MACFG_67 || + sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73 || + sc->re_type == MACFG_74 || sc->re_type == MACFG_80 || + sc->re_type == MACFG_81 || sc->re_type == MACFG_82 || + sc->re_type == MACFG_83) { + if (RegAddr == 0x1F) { + return; + } + + MP_WritePhyOcpRegWord(sc, sc->cur_page, RegAddr, RegData); + } else { + if (sc->re_type == MACFG_65 || sc->re_type == MACFG_66) + CSR_WRITE_4(sc, 0xD0, CSR_READ_4(sc, 0xD0) & ~0x00020000); + + TmpUlong |= (((u_int32_t)RegAddr)<<16 | (u_int32_t)RegData); + + CSR_WRITE_4(sc, RE_PHYAR, TmpUlong); + + /* Wait for writing to Phy ok */ + for (Timeout=0; Timeout<5; Timeout++) { + DELAY(1000); + if ((CSR_READ_4(sc, RE_PHYAR)&PHYAR_Flag)==0) + break; + } + + if (sc->re_type == MACFG_65 || sc->re_type == MACFG_66) + CSR_WRITE_4(sc, 0xD0, CSR_READ_4(sc, 0xD0) | 0x00020000); + } +} + +u_int16_t MP_ReadPhyUshort(struct re_softc *sc,u_int8_t RegAddr) +{ + u_int16_t RegData; + u_int32_t TmpUlong; + u_int32_t Timeout=0; + + if (sc->re_type == MACFG_63) { + int i; + CSR_WRITE_4(sc, RE_OCPDR, OCPDR_Read | + (RegAddr & OCPDR_Reg_Mask) << OCPDR_GPHY_Reg_shift); + CSR_WRITE_4(sc, RE_OCPAR, OCPAR_GPHY_Write); + CSR_WRITE_4(sc, RE_EPHY_RXER_NUM, 0); + + for (i = 0; i < 100; i++) { + DELAY(1000); + if (!(CSR_READ_4(sc, RE_OCPAR) & OCPAR_Flag)) + break; + } + + DELAY(1000); + CSR_WRITE_4(sc, RE_OCPAR, OCPAR_GPHY_Read); + CSR_WRITE_4(sc, RE_EPHY_RXER_NUM, 0); + + for (i = 0; i < 100; i++) { + DELAY(1000); + if (CSR_READ_4(sc, RE_OCPAR) & OCPAR_Flag) + break; + } + + RegData = CSR_READ_4(sc, RE_OCPDR) & OCPDR_Data_Mask; + } else if (sc->re_type == MACFG_56 || sc->re_type == MACFG_57 || + sc->re_type == MACFG_58 || sc->re_type == MACFG_59 || + sc->re_type == MACFG_60 || sc->re_type == MACFG_61 || + sc->re_type == MACFG_62 || sc->re_type == MACFG_67 || + sc->re_type == MACFG_68 || sc->re_type == MACFG_69 || + sc->re_type == MACFG_70 || sc->re_type == MACFG_71 || + sc->re_type == MACFG_72 || sc->re_type == MACFG_73 || + sc->re_type == MACFG_74 || sc->re_type == MACFG_80 || + sc->re_type == MACFG_81 || sc->re_type == MACFG_82 || + sc->re_type == MACFG_83) { + RegData = MP_ReadPhyOcpRegWord(sc, sc->cur_page, RegAddr); + } else { + if (sc->re_type == MACFG_65 || sc->re_type == MACFG_66) + CSR_WRITE_4(sc, 0xD0, CSR_READ_4(sc, 0xD0) & ~0x00020000); + + TmpUlong = ((u_int32_t)RegAddr << 16); + CSR_WRITE_4(sc, RE_PHYAR, TmpUlong); + + /* Wait for writing to Phy ok */ + for (Timeout=0; Timeout<5; Timeout++) { + DELAY(1000); + TmpUlong = CSR_READ_4(sc, RE_PHYAR); + if ((TmpUlong&PHYAR_Flag)!=0) + break; + } + + RegData = (u_int16_t)(TmpUlong & 0x0000ffff); + + if (sc->re_type == MACFG_65 || sc->re_type == MACFG_66) + CSR_WRITE_4(sc, 0xD0, CSR_READ_4(sc, 0xD0) | 0x00020000); + } + + return RegData; +} + +void MP_WriteEPhyUshort(struct re_softc *sc, u_int8_t RegAddr, u_int16_t RegData) +{ + u_int32_t TmpUlong=0x80000000; + u_int32_t Timeout=0; + + TmpUlong |= (((u_int32_t)RegAddr<<16) | (u_int32_t)RegData); + + CSR_WRITE_4(sc, RE_EPHYAR, TmpUlong); + + /* Wait for writing to Phy ok */ + for (Timeout=0; Timeout<5; Timeout++) { + DELAY(1000); + if ((CSR_READ_4(sc, RE_EPHYAR)&PHYAR_Flag)==0) + break; + } +} + +u_int16_t MP_ReadEPhyUshort(struct re_softc *sc, u_int8_t RegAddr) +{ + u_int16_t RegData; + u_int32_t TmpUlong; + u_int32_t Timeout=0; + + TmpUlong = ((u_int32_t)RegAddr << 16); + CSR_WRITE_4(sc, RE_EPHYAR, TmpUlong); + + /* Wait for writing to Phy ok */ + for (Timeout=0; Timeout<5; Timeout++) { + DELAY(1000); + TmpUlong = CSR_READ_4(sc, RE_EPHYAR); + if ((TmpUlong&PHYAR_Flag)!=0) + break; + } + + RegData = (u_int16_t)(TmpUlong & 0x0000ffff); + + return RegData; +} + +static u_int8_t re_calc_efuse_dummy_bit(u_int16_t reg) +{ + int s,a,b; + u_int8_t dummyBitPos = 0; + + + s=reg% 32; + a=s % 16; + b=s/16; + + if (s/16) { + dummyBitPos = (u_int8_t)(16-a); + } else { + dummyBitPos = (u_int8_t)a; + } + + return dummyBitPos; +} + +static u_int32_t re_decode_efuse_cmd(struct re_softc *sc, u_int32_t DwCmd) +{ + u_int16_t reg = (u_int16_t)((DwCmd & 0x00FE0000) >> 17); + u_int32_t DummyPos = re_calc_efuse_dummy_bit(reg); + u_int32_t DeCodeDwCmd = DwCmd; + u_int32_t Dw17BitData; + + + if (sc->re_efuse_ver < 3) { + DeCodeDwCmd = (DwCmd>>(DummyPos+1))< 0) { + DeCodeDwCmd |= ((DwCmd<<(32-DummyPos))>>(32-DummyPos)); + } + } else { + reg = (u_int16_t)((DwCmd & 0x007F0000) >> 16); + DummyPos = re_calc_efuse_dummy_bit(reg); + Dw17BitData = ((DwCmd & BIT_23) >> 23); + Dw17BitData <<= 16; + Dw17BitData |= (DwCmd & 0x0000FFFF); + DeCodeDwCmd = (Dw17BitData>>(DummyPos+1))< 0) { + DeCodeDwCmd |= ((Dw17BitData<<(32-DummyPos))>>(32-DummyPos)); + } + } + + return DeCodeDwCmd; +} + +#define EFUSE_WRITE 0x80000000 +#define EFUSE_WRITE_OK 0x00000000 +#define EFUSE_READ 0x00000000 +#define EFUSE_READ_OK 0x80000000 +#define EFUSE_Reg_Mask 0x03FF +#define EFUSE_Reg_Shift 8 +#define EFUSE_Check_Cnt 300 +#define EFUSE_READ_FAIL 0xFF +#define EFUSE_Data_Mask 0x000000FF + +u_int8_t MP_ReadEfuse(struct re_softc *sc, u_int16_t reg) +{ + u_int8_t efuse_data = 0; + u_int32_t temp; + u_int32_t cnt; + + if (sc->re_efuse_ver == EFUSE_NOT_SUPPORT) + return EFUSE_READ_FAIL; + + if (sc->re_efuse_ver == EFUSE_SUPPORT_V1) { + temp = EFUSE_READ | ((reg & EFUSE_Reg_Mask) << EFUSE_Reg_Shift); + CSR_WRITE_4(sc, RE_EFUSEAR, temp); + + cnt = 0; + do { + DELAY(100); + temp = CSR_READ_4(sc, RE_EFUSEAR); + cnt++; + } while (!(temp & EFUSE_READ_OK) && (cnt < EFUSE_Check_Cnt)); + + if (cnt == EFUSE_Check_Cnt) + efuse_data = EFUSE_READ_FAIL; + else + efuse_data = (u_int8_t)(CSR_READ_4(sc, RE_EFUSEAR) & EFUSE_Data_Mask); + } else if (sc->re_efuse_ver == EFUSE_SUPPORT_V2) { + temp = (reg/2) & 0x03ff; + temp <<= 17; + temp |= EFUSE_READ; + CSR_WRITE_4(sc, RE_EFUSEAR, temp); + + cnt = 0; + do { + DELAY(100); + temp = CSR_READ_4(sc, RE_EFUSEAR); + cnt++; + } while (!(temp & EFUSE_READ_OK) && (cnt < EFUSE_Check_Cnt)); + + if (cnt == EFUSE_Check_Cnt) { + efuse_data = EFUSE_READ_FAIL; + } else { + temp = CSR_READ_4(sc, RE_EFUSEAR); + temp = re_decode_efuse_cmd(sc, temp); + + if (reg%2) { + temp >>= 8; + efuse_data = (u_int8_t)temp; + } else { + efuse_data = (u_int8_t)temp; + } + } + } else if (sc->re_efuse_ver == EFUSE_SUPPORT_V3) { + temp = (reg/2) & 0x03ff; + temp <<= 16; + temp |= EFUSE_READ; + CSR_WRITE_4(sc, RE_EFUSEAR, temp); + + cnt = 0; + do { + DELAY(100); + temp = CSR_READ_4(sc, RE_EFUSEAR); + cnt++; + } while (!(temp & EFUSE_READ_OK) && (cnt < EFUSE_Check_Cnt)); + + if (cnt == EFUSE_Check_Cnt) { + efuse_data = EFUSE_READ_FAIL; + } else { + temp = CSR_READ_4(sc, RE_EFUSEAR); + temp = re_decode_efuse_cmd(sc, temp); + + if (reg%2) { + temp >>= 8; + efuse_data = (u_int8_t)temp; + } else { + efuse_data = (u_int8_t)temp; + } + } + } + + DELAY(20); + + return efuse_data; +} + +void MP_WriteOtherFunPciEConfigSpace( + struct re_softc *sc, + u_int8_t MultiFunSelBit, + u_int16_t ByteEnAndAddr, + u_int32_t RegData) +{ + u_int32_t Timeout = 0, WaitCount = 10; + u_int32_t TmpUlong = 0x80000000; + u_int32_t WriteDone; + + if (MultiFunSelBit > 7) { + return; + } + + TmpUlong |= MultiFunSelBit << 16; + + CSR_WRITE_4(sc, RE_CSIDR, RegData); + TmpUlong |= (u_int32_t) ByteEnAndAddr; + CSR_WRITE_4(sc, RE_CSIAR, TmpUlong); + + do { + DELAY(100); + + WriteDone = CSR_READ_4(sc, RE_CSIAR); + Timeout++; + } while (((WriteDone & 0x80000000) != 0) && (Timeout < WaitCount)); + + + DELAY(50); +} + +u_int32_t MP_ReadOtherFunPciEConfigSpace( + struct re_softc *sc, + u_int8_t MultiFunSelBit, + u_int16_t ByteEnAndAddr) +{ + u_int32_t Timeout = 0, WaitCount = 10; + u_int32_t TmpUlong = 0x00000000; + u_int32_t ReadDone; + u_int32_t RetVal = 0xffffffff; + + if (MultiFunSelBit > 7) { + return 0xffffffff; + } + + TmpUlong |= MultiFunSelBit << 16; + + TmpUlong |= (u_int32_t) ByteEnAndAddr; + CSR_WRITE_4(sc, RE_CSIAR, TmpUlong); + + do { + DELAY(100); + + ReadDone = CSR_READ_4(sc, RE_CSIAR); + Timeout++; + } while (((ReadDone & 0x80000000) == 0)&& (Timeout < WaitCount)); + + DELAY(50); + + return RetVal; +} + +void MP_WritePciEConfigSpace( + struct re_softc *sc, + u_int16_t ByteEnAndAddr, + u_int32_t RegData) +{ + u_int8_t MultiFunSelBit; + + if (sc->re_type == MACFG_52 || sc->re_type == MACFG_53) { + MultiFunSelBit = 2; + } else if (sc->re_type == MACFG_60) { + MultiFunSelBit = 1; + } else { + MultiFunSelBit = 0; + } + + MP_WriteOtherFunPciEConfigSpace(sc, MultiFunSelBit, ByteEnAndAddr, RegData); + +} + +u_int32_t MP_ReadPciEConfigSpace( + struct re_softc *sc, + u_int16_t ByteEnAndAddr) +{ + u_int8_t MultiFunSelBit; + + if (sc->re_type == MACFG_52 || sc->re_type == MACFG_53) { + MultiFunSelBit = 2; + } else if (sc->re_type == MACFG_60) { + MultiFunSelBit = 1; + } else { + MultiFunSelBit = 0; + } + + return MP_ReadOtherFunPciEConfigSpace(sc, MultiFunSelBit, ByteEnAndAddr); +} + +/* +u_int8_t MP_ReadByteFun0PciEConfigSpace( + struct re_softc *sc, + u_int16_t RegAddr) +{ + u_int8_t RetVal = 0; + u_int32_t TmpUlong; + u_int16_t RegAlignAddr; + u_int8_t ShiftByte; + + RegAlignAddr = RegAddr & ~(0x3); + ShiftByte = RegAddr & (0x3); + + TmpUlong = MP_ReadOtherFunPciEConfigSpace(sc, 0, RegAlignAddr | 0xF000); + TmpUlong >>= (8*ShiftByte); + RetVal = (u_int8_t)TmpUlong; + + return RetVal; +} +*/ + +static u_int16_t MappingPhyOcpAddress( + struct re_softc *sc, + u_int16_t PageNum, + u_int8_t RegNum) +{ + u_int16_t OcpPageNum = 0; + u_int8_t OcpRegNum = 0; + u_int16_t OcpPhyAddress = 0; + + if (PageNum == 0) { + OcpPageNum = 0x0A40 + (RegNum / 8); + OcpRegNum = 0x10 + (RegNum % 8); + } else { + OcpPageNum = PageNum; + OcpRegNum = RegNum; + } + + OcpPageNum <<= 4; + + if (OcpRegNum < 16) { + OcpPhyAddress = 0; + } else { + OcpRegNum -= 16; + OcpRegNum <<= 1; + + OcpPhyAddress = OcpPageNum + OcpRegNum; + } + + return OcpPhyAddress; +} + +u_int16_t MP_RealReadPhyOcpRegWord( + struct re_softc *sc, + u_int16_t OcpRegAddr) +{ + u_int32_t Timeout = 0, WaitCount = 100; + u_int32_t TmpUlong; + u_int16_t RetVal = 0xffff; + + TmpUlong = OcpRegAddr / 2; + TmpUlong <<= 16; + + CSR_WRITE_4(sc, RE_PHYOCPACCESS, TmpUlong); + + do { + DELAY(1); + + TmpUlong = CSR_READ_4(sc, RE_PHYOCPACCESS); + + Timeout++; + } while ((!(TmpUlong & PHYAR_Flag)) && (Timeout < WaitCount)); + + RetVal = (u_int16_t)TmpUlong; + + return RetVal; +} + +u_int16_t MP_ReadPhyOcpRegWord( + struct re_softc *sc, + u_int16_t PhyPage, + u_int8_t PhyRegNum) +{ + u_int16_t OcpRegAddr; + u_int16_t RetVal = 0xffff; + + OcpRegAddr = MappingPhyOcpAddress(sc, PhyPage, PhyRegNum); + + if (OcpRegAddr % 2) { + u_int16_t tmpUshort; + + tmpUshort = MP_RealReadPhyOcpRegWord(sc, OcpRegAddr); + tmpUshort &= 0xFF00; + tmpUshort >>= 8; + RetVal = tmpUshort; + + + tmpUshort = MP_RealReadPhyOcpRegWord(sc, OcpRegAddr + 1); + tmpUshort &= 0x00FF; + tmpUshort <<= 8; + RetVal |= tmpUshort; + } else { + RetVal = MP_RealReadPhyOcpRegWord(sc, OcpRegAddr); + } + + return RetVal; +} + +void MP_RealWritePhyOcpRegWord( + struct re_softc *sc, + u_int16_t OcpRegAddr, + u_int16_t RegData) +{ + u_int32_t Timeout = 0, WaitCount = 100; + u_int32_t TmpUlong; + + TmpUlong = OcpRegAddr / 2; + TmpUlong <<= 16; + TmpUlong += RegData; + TmpUlong |= BIT_31; + + CSR_WRITE_4(sc, RE_PHYOCPACCESS, TmpUlong); + + do { + DELAY(1); + + TmpUlong = CSR_READ_4(sc, RE_PHYOCPACCESS); + + Timeout++; + } while ((TmpUlong & PHYAR_Flag) && (Timeout < WaitCount)); +} + +void MP_WritePhyOcpRegWord( + struct re_softc *sc, + u_int16_t PhyPage, + u_int8_t PhyRegNum, + u_int16_t RegData) +{ + u_int16_t OcpRegAddr; + + OcpRegAddr = MappingPhyOcpAddress(sc, PhyPage, PhyRegNum); + + if (OcpRegAddr % 2) { + u_int16_t tmpUshort; + + tmpUshort = MP_RealReadPhyOcpRegWord(sc, OcpRegAddr); + tmpUshort &= 0x00FF; + tmpUshort |= (RegData << 8); + MP_RealWritePhyOcpRegWord(sc, OcpRegAddr, tmpUshort); + tmpUshort = MP_RealReadPhyOcpRegWord(sc, OcpRegAddr + 1); + tmpUshort &= 0xFF00; + tmpUshort |= (RegData >> 8); + MP_RealWritePhyOcpRegWord(sc, OcpRegAddr + 1, tmpUshort); + } else { + MP_RealWritePhyOcpRegWord(sc, OcpRegAddr, RegData); + } +} + +void MP_WriteMcuAccessRegWord( + struct re_softc *sc, + u_int16_t ExtRegAddr, + u_int16_t RegData) +{ + u_int32_t TmpUlong; + + TmpUlong = ExtRegAddr / 2; + TmpUlong <<= 16; + TmpUlong += RegData; + TmpUlong |= BIT_31; + + CSR_WRITE_4(sc, RE_MCUACCESS, TmpUlong); +} + +u_int16_t MP_ReadMcuAccessRegWord( + struct re_softc *sc, + u_int16_t ExtRegAddr) +{ + u_int32_t TmpUlong; + u_int16_t RetVal = 0xffff; + + TmpUlong = ExtRegAddr / 2; + TmpUlong <<= 16; + + CSR_WRITE_4(sc, RE_MCUACCESS, TmpUlong); + TmpUlong = CSR_READ_4(sc, RE_MCUACCESS); + RetVal = (u_int16_t)TmpUlong; + + return RetVal; +} + +static u_int32_t real_ocp_read(struct re_softc *sc, u_int16_t addr, u_int8_t len) +{ + int i, val_shift, shift = 0; + u_int32_t value1 = 0, value2 = 0, mask; + + if (len > 4 || len <= 0) + return -1; + + while (len > 0) { + val_shift = addr % 4; + addr = addr & ~0x3; + + CSR_WRITE_4(sc, RE_OCPAR, (0x0F<<12) | (addr&0xFFF)); + + for (i = 0; i < 20; i++) { + DELAY(100); + if (CSR_READ_4(sc, RE_OCPAR) & OCPAR_Flag) + break; + } + + if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + + value1 = CSR_READ_4(sc, RE_OCPDR) & mask; + value2 |= (value1 >> val_shift * 8) << shift * 8; + + if (len <= 4 - val_shift) { + len = 0; + } else { + len -= (4 - val_shift); + shift = 4 - val_shift; + addr += 4; + } + } + + DELAY(20); + + return value2; +} + +static u_int32_t OCP_read_with_oob_base_address(struct re_softc *sc, u_int16_t addr, u_int8_t len, const u_int32_t base_address) +{ + return re_eri_read_with_oob_base_address(sc, addr, len, ERIAR_OOB, base_address); +} + +static u_int32_t OCP_read(struct re_softc *sc, u_int16_t addr, u_int8_t len) +{ + u_int32_t value = 0; + + if (HW_DASH_SUPPORT_TYPE_2(sc)) + value = re_eri_read(sc, addr, len, ERIAR_OOB); + else if (HW_DASH_SUPPORT_TYPE_3(sc)) + value = OCP_read_with_oob_base_address(sc, addr, len, RTL8168FP_OOBMAC_BASE); + else + value = real_ocp_read(sc, addr, len); + + return value; +} + +static int real_ocp_write(struct re_softc *sc, u_int16_t addr, u_int8_t len, u_int32_t value) +{ + int i, val_shift, shift = 0; + u_int32_t value1 = 0, mask; + + if (len > 4 || len <= 0) + return -1; + + while (len > 0) { + val_shift = addr % 4; + addr = addr & ~0x3; + + if (len == 1) mask = (0xFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 2) mask = (0xFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; + + value1 = OCP_read(sc, addr, 4) & ~mask; + value1 |= ((value << val_shift * 8) >> shift * 8); + + CSR_WRITE_4(sc, RE_OCPDR, value1); + CSR_WRITE_4(sc, RE_OCPAR, OCPAR_Flag | (0x0F<<12) | (addr&0xFFF)); + + for (i = 0; i < 10; i++) { + DELAY(100); + + /* Check if the RTL8168 has completed ERI write */ + if (!(CSR_READ_4(sc, RE_OCPAR) & OCPAR_Flag)) + break; + } + + if (len <= 4 - val_shift) { + len = 0; + } else { + len -= (4 - val_shift); + shift = 4 - val_shift; + addr += 4; + } + } + + DELAY(20); + + return 0; +} + +static int OCP_write_with_oob_base_address(struct re_softc *sc, u_int16_t addr, u_int8_t len, u_int32_t value, const u_int32_t base_address) +{ + return re_eri_write_with_oob_base_address(sc, addr, len, value, ERIAR_OOB, base_address); +} + +static void OCP_write(struct re_softc *sc, u_int16_t addr, u_int8_t len, u_int32_t value) +{ + if (HW_DASH_SUPPORT_TYPE_2(sc)) + re_eri_write(sc, addr, len, value, ERIAR_OOB); + else if (HW_DASH_SUPPORT_TYPE_3(sc)) + OCP_write_with_oob_base_address(sc, addr, len, value, RTL8168FP_OOBMAC_BASE); + else + real_ocp_write(sc, addr, len, value); +} + +static void OOB_mutex_lock(struct re_softc *sc) +{ + u_int8_t reg_16, reg_a0; + u_int32_t wait_cnt_0, wait_Cnt_1; + u_int16_t ocp_reg_mutex_ib; + u_int16_t ocp_reg_mutex_oob; + u_int16_t ocp_reg_mutex_prio; + + switch (sc->re_type) { + case MACFG_63: + case MACFG_64: + case MACFG_65: + ocp_reg_mutex_oob = 0x16; + ocp_reg_mutex_ib = 0x17; + ocp_reg_mutex_prio = 0x9C; + break; + case MACFG_66: + ocp_reg_mutex_oob = 0x06; + ocp_reg_mutex_ib = 0x07; + ocp_reg_mutex_prio = 0x9C; + break; + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + default: + ocp_reg_mutex_oob = 0x110; + ocp_reg_mutex_ib = 0x114; + ocp_reg_mutex_prio = 0x11C; + break; + } + + OCP_write(sc, ocp_reg_mutex_ib, 1, BIT_0); + reg_16 = OCP_read(sc, ocp_reg_mutex_oob, 1); + wait_cnt_0 = 0; + while(reg_16) { + reg_a0 = OCP_read(sc, ocp_reg_mutex_prio, 1); + if (reg_a0) { + OCP_write(sc, ocp_reg_mutex_ib, 1, 0x00); + reg_a0 = OCP_read(sc, ocp_reg_mutex_prio, 1); + wait_Cnt_1 = 0; + while(reg_a0) { + reg_a0 = OCP_read(sc, ocp_reg_mutex_prio, 1); + + wait_Cnt_1++; + + if (wait_Cnt_1 > 2000) + break; + }; + OCP_write(sc, ocp_reg_mutex_ib, 1, BIT_0); + + } + reg_16 = OCP_read(sc, ocp_reg_mutex_oob, 1); + + wait_cnt_0++; + + if (wait_cnt_0 > 2000) + break; + }; +} + +static void OOB_mutex_unlock(struct re_softc *sc) +{ + u_int16_t ocp_reg_mutex_ib; + u_int16_t ocp_reg_mutex_oob; + u_int16_t ocp_reg_mutex_prio; + + switch (sc->re_type) { + case MACFG_63: + case MACFG_64: + case MACFG_65: + ocp_reg_mutex_oob = 0x16; + ocp_reg_mutex_ib = 0x17; + ocp_reg_mutex_prio = 0x9C; + break; + case MACFG_66: + ocp_reg_mutex_oob = 0x06; + ocp_reg_mutex_ib = 0x07; + ocp_reg_mutex_prio = 0x9C; + break; + case MACFG_61: + case MACFG_62: + case MACFG_67: + case MACFG_70: + case MACFG_71: + case MACFG_72: + case MACFG_73: + default: + ocp_reg_mutex_oob = 0x110; + ocp_reg_mutex_ib = 0x114; + ocp_reg_mutex_prio = 0x11C; + break; + } + + OCP_write(sc, ocp_reg_mutex_prio, 1, BIT_0); + OCP_write(sc, ocp_reg_mutex_ib, 1, 0x00); +} + +static int re_check_dash(struct re_softc *sc) +{ + if (HW_DASH_SUPPORT_DASH(sc) == FALSE) + return 0; + + if (HW_DASH_SUPPORT_TYPE_2(sc) || HW_DASH_SUPPORT_TYPE_3(sc)) { + return !!(OCP_read(sc, 0x128, 1) & BIT_0); + } else if (HW_DASH_SUPPORT_TYPE_1(sc)) { + if (sc->re_type == MACFG_66) + return !!(OCP_read(sc, 0xb8, 2) & BIT_15); + else + return !!(OCP_read(sc, 0x10, 2) & BIT_15); + } + + return 0; +} + +static void OOB_notify(struct re_softc *sc, u_int8_t cmd) +{ + int i; + + CSR_WRITE_1(sc, RE_ERIDR, cmd); + CSR_WRITE_4(sc, RE_ERIAR, 0x800010E8); + DELAY(2000); + for (i = 0; i < 5; i++) { + DELAY(100); + if (!(CSR_READ_4(sc, RE_ERIAR) & ERIAR_Flag)) + break; + } + + OCP_write(sc, 0x30, 1, 0x01); +} + +void re_driver_start(struct re_softc *sc) +{ + if (HW_DASH_SUPPORT_TYPE_2(sc) || HW_DASH_SUPPORT_TYPE_3(sc)) { + u_int32_t tmp_value; + + if (!sc->re_dash) + return; + + OCP_write(sc, 0x180, 1, OOB_CMD_DRIVER_START); + tmp_value = OCP_read(sc, 0x30, 1); + tmp_value |= BIT_0; + OCP_write(sc, 0x30, 1, tmp_value); + } else { + int timeout; + u_int32_t reg; + + if (sc->re_type == MACFG_66) { + CSR_WRITE_1(sc, RE_TwiCmdReg, CSR_READ_1(sc, RE_TwiCmdReg) | (BIT_7)); + } + + OOB_notify(sc, OOB_CMD_DRIVER_START); + + if (sc->re_type == MACFG_66) + reg = 0xB8; + else + reg = 0x10; + + for (timeout = 0; timeout < 10; timeout++) { + DELAY(10000); + if (OCP_read(sc, reg, 2) & BIT_11) + break; + } + } +} + +void re_driver_stop(struct re_softc *sc) +{ + if (HW_DASH_SUPPORT_TYPE_2(sc) || HW_DASH_SUPPORT_TYPE_3(sc)) { + u_int32_t tmp_value; + + if (!sc->re_dash) + return; + + Dash2DisableTxRx(sc); + + OCP_write(sc, 0x180, 1, OOB_CMD_DRIVER_STOP); + tmp_value = OCP_read(sc, 0x30, 1); + tmp_value |= BIT_0; + OCP_write(sc, 0x30, 1, tmp_value); + } else { + int timeout; + u_int32_t reg; + + OOB_notify(sc, OOB_CMD_DRIVER_STOP); + + if (sc->re_type == MACFG_66) + reg = 0xB8; + else + reg = 0x10; + + for (timeout = 0; timeout < 10; timeout++) { + DELAY(10000); + if ((OCP_read(sc, reg, 4) & BIT_11) == 0) + break; + } + + if (sc->re_type == MACFG_66) { + CSR_WRITE_1(sc, RE_TwiCmdReg, CSR_READ_1(sc, RE_TwiCmdReg) & ~(BIT_7)); + } + } +} + +/*----------------------------------------------------------------------------*/ +/* 8139 (CR9346) 9346 command register bits (offset 0x50, 1 byte)*/ +/*----------------------------------------------------------------------------*/ +#define CR9346_EEDO 0x01 /* 9346 data out*/ +#define CR9346_EEDI 0x02 /* 9346 data in*/ +#define CR9346_EESK 0x04 /* 9346 serial clock*/ +#define CR9346_EECS 0x08 /* 9346 chip select*/ +#define CR9346_EEM0 0x40 /* select 8139 operating mode*/ +#define CR9346_EEM1 0x80 /* 00: normal*/ +#define CR9346_CFGRW 0xC0 /* Config register write*/ +#define CR9346_NORM 0x00 + +/*----------------------------------------------------------------------------*/ +/* EEPROM bit definitions(EEPROM control register bits)*/ +/*----------------------------------------------------------------------------*/ +#define EN_TRNF 0x10 /* Enable turnoff*/ +#define EEDO CR9346_EEDO /* EEPROM data out*/ +#define EEDI CR9346_EEDI /* EEPROM data in (set for writing data)*/ +#define EECS CR9346_EECS /* EEPROM chip select (1=high, 0=low)*/ +#define EESK CR9346_EESK /* EEPROM shift clock (1=high, 0=low)*/ + +/*----------------------------------------------------------------------------*/ +/* EEPROM opcodes*/ +/*----------------------------------------------------------------------------*/ +#define EEPROM_READ_OPCODE 06 +#define EEPROM_WRITE_OPCODE 05 +#define EEPROM_ERASE_OPCODE 07 +#define EEPROM_EWEN_OPCODE 19 /* Erase/write enable*/ +#define EEPROM_EWDS_OPCODE 16 /* Erase/write disable*/ + +#define CLOCK_RATE 50 /* us*/ + +#define RaiseClock(_sc,_x) \ + (_x) = (_x) | EESK; \ + CSR_WRITE_1((_sc), RE_EECMD, (_x)); \ + DELAY(CLOCK_RATE); + +#define LowerClock(_sc,_x) \ + (_x) = (_x) & ~EESK; \ + CSR_WRITE_1((_sc), RE_EECMD, (_x)); \ + DELAY(CLOCK_RATE); + +/* + * Shift out bit(s) to the EEPROM. + */ +static void re_eeprom_ShiftOutBits(sc, data, count) +struct re_softc *sc; +int data; +int count; +{ + u_int16_t x, mask; + + mask = 0x01 << (count - 1); + x = CSR_READ_1(sc, RE_EECMD); + + x &= ~(EEDO | EEDI); + + do { + x &= ~EEDI; + if (data & mask) + x |= EEDI; + + CSR_WRITE_1(sc, RE_EECMD, x); + DELAY(CLOCK_RATE); + RaiseClock(sc,x); + LowerClock(sc,x); + mask = mask >> 1; + } while (mask); + + x &= ~EEDI; + CSR_WRITE_1(sc, RE_EECMD, x); +} + +/* + * Shift in bit(s) from the EEPROM. + */ +static u_int16_t re_eeprom_ShiftInBits(sc) +struct re_softc *sc; +{ + u_int16_t x,d,i; + x = CSR_READ_1(sc, RE_EECMD); + + x &= ~(EEDO | EEDI); + d = 0; + + for (i=0; i<16; i++) { + d = d << 1; + RaiseClock(sc, x); + + x = CSR_READ_1(sc, RE_EECMD); + + x &= ~(EEDI); + if (x & EEDO) + d |= 1; + + LowerClock(sc, x); + } + + return d; +} + +/* + * Clean up EEprom read/write setting + */ +static void re_eeprom_EEpromCleanup(sc) +struct re_softc *sc; +{ + u_int16_t x; + x = CSR_READ_1(sc, RE_EECMD); + + x &= ~(EECS | EEDI); + CSR_WRITE_1(sc, RE_EECMD, x); + + RaiseClock(sc, x); + LowerClock(sc, x); +} + +/* + * Read a word of data stored in the EEPROM at address 'addr.' + */ +static void re_eeprom_getword(sc, addr, dest) +struct re_softc *sc; +int addr; +u_int16_t *dest; +{ + u_int16_t x; + + /* select EEPROM, reset bits, set EECS*/ + x = CSR_READ_1(sc, RE_EECMD); + + x &= ~(EEDI | EEDO | EESK | CR9346_EEM0); + x |= CR9346_EEM1 | EECS; + CSR_WRITE_1(sc, RE_EECMD, x); + + /* write the read opcode and register number in that order*/ + /* The opcode is 3bits in length, reg is 6 bits long*/ + re_eeprom_ShiftOutBits(sc, EEPROM_READ_OPCODE, 3); + + if (CSR_READ_4(sc, RE_RXCFG) & RE_RXCFG_RX_9356SEL) + re_eeprom_ShiftOutBits(sc, addr,8); /*93c56=8*/ + else + re_eeprom_ShiftOutBits(sc, addr,6); /*93c46=6*/ + + /* Now read the data (16 bits) in from the selected EEPROM word*/ + *dest=re_eeprom_ShiftInBits(sc); + + re_eeprom_EEpromCleanup(sc); + return; +} + +/* + * Read a sequence of words from the EEPROM. + */ +static void re_read_eeprom(sc, dest, off, cnt, swap) +struct re_softc *sc; +caddr_t dest; +int off; +int cnt; +int swap; +{ + int i; + u_int16_t word = 0, *ptr; + + for (i = 0; i < cnt; i++) { + re_eeprom_getword(sc, off + i, &word); + ptr = (u_int16_t *)(dest + (i * 2)); + if (swap) + *ptr = ntohs(word); + else + *ptr = word; + } + + return; +} diff --git a/freebsd/rtl_bsd_drv_v197.00/if_rereg.h b/freebsd/rtl_bsd_drv_v197.00/if_rereg.h new file mode 100755 index 0000000..07a6fe7 --- /dev/null +++ b/freebsd/rtl_bsd_drv_v197.00/if_rereg.h @@ -0,0 +1,1252 @@ +/* + * Copyright (c) 1997, 1998 + * Bill Paul . 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, 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 + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD + * 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. + * + * $FreeBSD: src/sys/dev/re/if_rereg.h,v 1.14.2.1 2001/07/19 18:33:07 wpaul Exp $ + */ + +/*#define VERSION(_MainVer,_MinorVer) ((_MainVer)*10+(_MinorVer))*/ +/*#define OS_VER VERSION(5,1)*/ +#if __FreeBSD_version < 500000 +#define VERSION(_MainVer,_MinorVer) ((_MainVer)*100000+(_MinorVer)*10000) +#else +#define VERSION(_MainVer,_MinorVer) ((_MainVer)*100000+(_MinorVer)*1000) +#endif +#define OS_VER __FreeBSD_version + +#ifndef M_DONTWAIT +#define M_DONTWAIT M_NOWAIT +#endif + +#if OS_VER>=VERSION(4,0) +#define RE_USE_NEW_CALLOUT_FUN 1 +#endif + + +/* + * RealTek RTL8110S/SB/SC register offsets + */ + +#define RE_TPPOLL 0x0038 /* transmit priority polling */ + +/* + * RealTek RTL8110S/SB/SC register contents + */ + +/* Transmit Priority Polling --- 0x40 */ +#define RE_HPQ 0x80 /* high priority queue polling */ +#define RE_NPQ 0x40 /* normal priority queue polling */ +#define RE_FSWInt 0x01 /* Forced Software Interrupt */ +#define RE_NPQ_8125 0x01 + + +/* + * RealTek 8129/8139 register offsets + */ + +#define RE_IDR0 0x0000 /* ID register 0 (station addr) */ +#define RE_IDR1 0x0001 /* Must use 32-bit accesses (?) */ +#define RE_IDR2 0x0002 +#define RE_IDR3 0x0003 +#define RE_IDR4 0x0004 +#define RE_IDR5 0x0005 +/* 0006-0007 reserved */ +#define RE_MAR0 0x0008 /* Multicast hash table */ +#define RE_MAR1 0x0009 +#define RE_MAR2 0x000A +#define RE_MAR3 0x000B +#define RE_MAR4 0x000C +#define RE_MAR5 0x000D +#define RE_MAR6 0x000E +#define RE_MAR7 0x000F + +#define RE_TXSTAT0 0x0010 /* status of TX descriptor 0 */ +#define RE_TXSTAT1 0x0014 /* status of TX descriptor 1 */ +#define RE_TXSTAT2 0x0018 /* status of TX descriptor 2 */ +#define RE_CUSTOM_LED 0x0018 +#define RE_TXSTAT3 0x001C /* status of TX descriptor 3 */ + +#define RE_TXADDR0 0x0020 /* address of TX descriptor 0 */ +#define RE_TXADDR1 0x0024 /* address of TX descriptor 1 */ +#define RE_TXADDR2 0x0028 /* address of TX descriptor 2 */ +#define RE_TXADDR3 0x002C /* address of TX descriptor 3 */ + +#define RE_RXADDR 0x0030 /* RX ring start address */ +#define RE_COMMAND 0x0037 /* command register */ +#define RE_CURRXADDR 0x0038 /* current address of packet read */ +#define RE_CURRXBUF 0x003A /* current RX buffer address */ +#define RE_IMR 0x003C /* interrupt mask register */ +#define RE_ISR 0x003E /* interrupt status register */ +#define RE_TXCFG 0x0040 /* transmit config */ +#define RE_RXCFG 0x0044 /* receive config */ +#define RE_TIMERCNT 0x0048 /* timer count register */ +#define RE_MISSEDPKT 0x004C /* missed packet counter */ +#define RE_EECMD 0x0050 /* EEPROM command register */ +#define RE_CFG0 0x0051 /* config register #0 */ +#define RE_CFG1 0x0052 /* config register #1 */ +#define RE_CFG2 0x0053 /* config register #2 */ +#define RE_CFG3 0x0054 /* config register #3 */ +#define RE_CFG4 0x0055 /* config register #4 */ +#define RE_CFG5 0x0056 /* config register #5 */ +/* 0053-0057 reserved */ +#define RE_TDFNR 0x0057 /* Tx descriptor fetch number */ +#define RE_MEDIASTAT 0x0058 /* media status register (8139) */ +#define RE_TIMERINT 0x0058 /* timer interrupt register */ +/* 0059-005A reserved */ +#define RE_MII 0x005A /* 8129 chip only */ +#define RE_HALTCLK 0x005B +#define RE_MULTIINTR 0x005C /* multiple interrupt */ +#define RE_PCIREV 0x005E /* PCI revision value */ +/* 005F reserved */ +#define RE_PHYAR 0x0060 /* PHY register access */ +#define RE_CSIDR 0x0064 +#define RE_CSIAR 0x0068 +#define RE_PHY_STATUS 0x006C /* PHY status */ +#define RE_MACDBG 0x006D +#define RE_PMCH 0x006F /* 8 bits */ +#define RE_ERIDR 0x0070 +#define RE_ERIAR 0x0074 +#define RE_EPHY_RXER_NUM 0x007C +#define RE_EPHYAR 0x0080 +#define RE_MCUACCESS 0x00B0 +#define RE_OCPDR 0x00B0 +#define RE_OCPAR 0x00B4 +#define RE_SecMAC0 0x00B4 +#define RE_SecMAC4 0x00B8 +#define RE_PHYOCPACCESS 0x00B8 +#define RE_DBG_reg 0x00D1 +#define RE_TwiCmdReg 0x00D2 +#define RE_MCU_CMD 0x00D3 +#define RE_RxMaxSize 0x00DA +#define RE_EFUSEAR 0x00DC +#define RE_CPlusCmd 0x00E0 +#define RE_IntrMitigate 0x00E2 +#define RE_MTPS 0x00EC +#define RE_CMAC_IBCR0 0x00F8 +#define RE_CMAC_IBCR2 0x00F9 +#define RE_CMAC_IBIMR0 0x00FA +#define RE_CMAC_IBISR0 0x00FB +//8125 +#define RE_IMR0_8125 0x38 +#define RE_ISR0_8125 0x3C +#define RE_TPPOLL_8125 0x90 +#define RE_BACKUP_ADDR0_8125 0x19E0 +#define RE_BACKUP_ADDR4_8125 0X19E4 +#define RE_EEE_TXIDLE_TIMER_8125 0x6048 + +/* ERI access */ +#define ERIAR_Flag 0x80000000 +#define ERIAR_Write 0x80000000 +#define ERIAR_Read 0x00000000 +#define ERIAR_Addr_Align 4 /* ERI access register address must be 4 byte alignment */ +#define ERIAR_ExGMAC 0 +#define ERIAR_MSIX 1 +#define ERIAR_ASF 2 +#define ERIAR_Type_shift 16 +#define ERIAR_ByteEn 0x0f +#define ERIAR_ByteEn_shift 12 +#define ERIAR_OOB 2 + + + + + +/* Direct PHY access registers only available on 8139 */ +#define RE_BMCR 0x0062 /* PHY basic mode control */ +#define RE_BMSR 0x0064 /* PHY basic mode status */ +#define RE_ANAR 0x0066 /* PHY autoneg advert */ +#define RE_LPAR 0x0068 /* PHY link partner ability */ +#define RE_ANER 0x006A /* PHY autoneg expansion */ + +#define RE_DISCCNT 0x006C /* disconnect counter */ +#define RE_FALSECAR 0x006E /* false carrier counter */ +#define RE_NWAYTST 0x0070 /* NWAY test register */ +#define RE_RX_ER 0x0072 /* RX_ER counter */ +#define RE_CSCFG 0x0074 /* CS configuration register */ +#define RE_LDPS 0x0082 /* Link Down Power Saving */ +#define RE_CPCR 0x00E0 +#define RE_IM 0x00E2 + + +/* + * TX config register bits + */ +#define RE_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ +#define RE_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RE_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ +#define RE_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ +#define RE_TXCFG_IFG 0x03000000 /* interframe gap */ + +#define RE_TXDMA_16BYTES 0x00000000 +#define RE_TXDMA_32BYTES 0x00000100 +#define RE_TXDMA_64BYTES 0x00000200 +#define RE_TXDMA_128BYTES 0x00000300 +#define RE_TXDMA_256BYTES 0x00000400 +#define RE_TXDMA_512BYTES 0x00000500 +#define RE_TXDMA_1024BYTES 0x00000600 +#define RE_TXDMA_2048BYTES 0x00000700 + +/* + * Transmit descriptor status register bits. + */ +#define RE_TXSTAT_LENMASK 0x00001FFF +#define RE_TXSTAT_OWN 0x00002000 +#define RE_TXSTAT_TX_UNDERRUN 0x00004000 +#define RE_TXSTAT_TX_OK 0x00008000 +#define RE_TXSTAT_COLLCNT 0x0F000000 +#define RE_TXSTAT_CARR_HBEAT 0x10000000 +#define RE_TXSTAT_OUTOFWIN 0x20000000 +#define RE_TXSTAT_TXABRT 0x40000000 +#define RE_TXSTAT_CARRLOSS 0x80000000 + +/* + * Interrupt status register bits. + */ +#define RE_ISR_RX_OK 0x0001 +#define RE_ISR_RX_ERR 0x0002 +#define RE_ISR_TX_OK 0x0004 +#define RE_ISR_TX_ERR 0x0008 +#define RE_ISR_RX_OVERRUN 0x0010 +#define RE_ISR_PKT_UNDERRUN 0x0020 +#define RE_ISR_LINKCHG 0x0020 +#define RE_ISR_FIFO_OFLOW 0x0040 +#define RE_ISR_TDU 0x0080 +#define RE_ISR_PCS_TIMEOUT 0x4000 /* 8129 only */ +#define RE_ISR_SYSTEM_ERR 0x8000 + +/* +#define RE_INTRS \ + (RE_ISR_TX_OK|RE_ISR_RX_OK|RE_ISR_RX_ERR|RE_ISR_TX_ERR| \ + RE_ISR_RX_OVERRUN|RE_ISR_PKT_UNDERRUN|RE_ISR_FIFO_OFLOW| \ + RE_ISR_PCS_TIMEOUT|RE_ISR_SYSTEM_ERR) +*/ + +#define RE_INTRS \ + (RE_ISR_TX_OK|RE_ISR_RX_OK|RE_ISR_RX_ERR|RE_ISR_TX_ERR| \ + RE_ISR_RX_OVERRUN|RE_ISR_PKT_UNDERRUN|RE_ISR_TDU| \ + RE_ISR_PCS_TIMEOUT|RE_ISR_SYSTEM_ERR) + +/* + * Media status register. (8139 only) + */ +#define RE_MEDIASTAT_RXPAUSE 0x01 +#define RE_MEDIASTAT_TXPAUSE 0x02 +#define RE_MEDIASTAT_LINK 0x04 +#define RE_MEDIASTAT_SPEED10 0x08 +#define RE_MEDIASTAT_RXFLOWCTL 0x40 /* duplex mode */ +#define RE_MEDIASTAT_TXFLOWCTL 0x80 /* duplex mode */ + +/* + * Receive config register. + */ +#define RE_RXCFG_RX_ALLPHYS 0x00000001 /* accept all nodes */ +#define RE_RXCFG_RX_INDIV 0x00000002 /* match filter */ +#define RE_RXCFG_RX_MULTI 0x00000004 /* accept all multicast */ +#define RE_RXCFG_RX_BROAD 0x00000008 /* accept all broadcast */ +#define RE_RXCFG_RX_RUNT 0x00000010 +#define RE_RXCFG_RX_ERRPKT 0x00000020 +#define RE_RXCFG_RX_9356SEL 0x00000040 +#define RE_RXCFG_WRAP 0x00000080 +#define RE_RXCFG_MAXDMA 0x00000700 +#define RE_RXCFG_BUFSZ 0x00001800 + +#define RE_RXDMA_16BYTES 0x00000000 +#define RE_RXDMA_32BYTES 0x00000100 +#define RE_RXDMA_64BYTES 0x00000200 +#define RE_RXDMA_128BYTES 0x00000300 +#define RE_RXDMA_256BYTES 0x00000400 +#define RE_RXDMA_512BYTES 0x00000500 +#define RE_RXDMA_1024BYTES 0x00000600 +#define RE_RXDMA_UNLIMITED 0x00000700 + +#define RE_RXBUF_8 0x00000000 +#define RE_RXBUF_16 0x00000800 +#define RE_RXBUF_32 0x00001000 +#define RE_RXBUF_64 0x00001800 + +#define RE_RXRESVERED 0x0000E000 + +/* + * Bits in RX status header (included with RX'ed packet + * in ring buffer). + */ +#define RE_RXSTAT_RXOK 0x00000001 +#define RE_RXSTAT_ALIGNERR 0x00000002 +#define RE_RXSTAT_CRCERR 0x00000004 +#define RE_RXSTAT_GIANT 0x00000008 +#define RE_RXSTAT_RUNT 0x00000010 +#define RE_RXSTAT_BADSYM 0x00000020 +#define RE_RXSTAT_BROAD 0x00002000 +#define RE_RXSTAT_INDIV 0x00004000 +#define RE_RXSTAT_MULTI 0x00008000 +#define RE_RXSTAT_LENMASK 0xFFFF0000 + +#define RE_RXSTAT_UNFINISHED 0xFFF0 /* DMA still in progress */ +/* + * Command register. + */ +#define RE_CMD_EMPTY_RXBUF 0x0001 +#define RE_CMD_TX_ENB 0x0004 +#define RE_CMD_RX_ENB 0x0008 +#define RE_CMD_RESET 0x0010 +#define RE_CMD_STOP_REQ 0x0080 + +/* + * EEPROM control register + */ +#define RE_EE_DATAOUT 0x01 /* Data out */ +#define RE_EE_DATAIN 0x02 /* Data in */ +#define RE_EE_CLK 0x04 /* clock */ +#define RE_EE_SEL 0x08 /* chip select */ +#define RE_EE_MODE (0x40|0x80) + +#define RE_EEMODE_OFF 0x00 +#define RE_EEMODE_AUTOLOAD 0x40 +#define RE_EEMODE_PROGRAM 0x80 +#define RE_EEMODE_WRITECFG (0x80|0x40) + +/* 9346 EEPROM commands */ +#define RE_EECMD_WRITE 0x140 +#define RE_EECMD_READ 0x180 +#define RE_EECMD_ERASE 0x1c0 + +#define RE_EE_ID 0x00 +#define RE_EE_PCI_VID 0x01 +#define RE_EE_PCI_DID 0x02 +/* Location of station address inside EEPROM */ +#define RE_EE_EADDR 0x07 + +/* + * MII register (8129 only) + */ +#define RE_MII_CLK 0x01 +#define RE_MII_DATAIN 0x02 +#define RE_MII_DATAOUT 0x04 +#define RE_MII_DIR 0x80 /* 0 == input, 1 == output */ + +/* + * Config 0 register + */ +#define RE_CFG0_ROM0 0x01 +#define RE_CFG0_ROM1 0x02 +#define RE_CFG0_ROM2 0x04 +#define RE_CFG0_PL0 0x08 +#define RE_CFG0_PL1 0x10 +#define RE_CFG0_10MBPS 0x20 /* 10 Mbps internal mode */ +#define RE_CFG0_PCS 0x40 +#define RE_CFG0_SCR 0x80 + +/* + * Config 1 register + */ +#define RE_CFG1_PME 0x01 +#define RE_CFG1_IOMAP 0x04 +#define RE_CFG1_MEMMAP 0x08 +#define RE_CFG1_RSVD 0x10 +#define RE_CFG1_LED0 0x40 +#define RE_CFG1_LED1 0x80 + +/* + * Config 3 register + */ +#define RL_CFG3_GRANTSEL 0x80 +#define RL_CFG3_WOL_MAGIC 0x20 +#define RL_CFG3_WOL_LINK 0x10 +#define RL_CFG3_JUMBO_EN0 0x04 /* RTL8168C or later. */ +#define RL_CFG3_FAST_B2B 0x01 + +/* + * Config 4 register + */ +#define RL_CFG4_LWPTN 0x04 +#define RL_CFG4_LWPME 0x10 +#define RL_CFG4_JUMBO_EN1 0x02 /* RTL8168C or later. */ +#define RL_CFG4_CUSTOMIZED_LED 0x40 + +/* + * Config 5 register + */ +#define RL_CFG5_WOL_BCAST 0x40 +#define RL_CFG5_WOL_MCAST 0x20 +#define RL_CFG5_WOL_UCAST 0x10 +#define RL_CFG5_WOL_LANWAKE 0x02 +#define RL_CFG5_PME_STS 0x01 + +/* + * PHY Status register + */ +#define RL_PHY_STATUS_500MF 0x80000 +#define RL_PHY_STATUS_2500MF 0x400 +#define RL_PHY_STATUS_1250MF 0x200 +#define RL_PHY_STATUS_CABLE_PLUG 0x80 +#define RL_PHY_STATUS_TX_FLOW_CTRL 0x40 +#define RL_PHY_STATUS_RX_FLOW_CTRL 0x20 +#define RL_PHY_STATUS_1000MF 0x10 +#define RL_PHY_STATUS_100M 0x08 +#define RL_PHY_STATUS_10M 0x04 +#define RL_PHY_STATUS_LINK_STS 0x02 +#define RL_PHY_STATUS_FULL_DUP 0x01 + +/* OCP GPHY access */ +#define OCPDR_Write 0x80000000 +#define OCPDR_Read 0x00000000 +#define OCPDR_Reg_Mask 0xFF +#define OCPDR_Data_Mask 0xFFFF +#define OCPDR_GPHY_Reg_shift 16 +#define OCPAR_Flag 0x80000000 +#define OCPAR_GPHY_Write 0x8000F060 +#define OCPAR_GPHY_Read 0x0000F060 +#define OCPR_Write 0x80000000 +#define OCPR_Read 0x00000000 +#define OCPR_Addr_Reg_shift 16 +#define OCPR_Flag 0x80000000 +#define OCP_STD_PHY_BASE_PAGE 0x0A40 + +/* MCU Command */ +#define RE_NOW_IS_OOB (1 << 7) +#define RE_TXFIFO_EMPTY (1 << 5) +#define RE_RXFIFO_EMPTY (1 << 4) + +/* OOB Command */ +#define OOB_CMD_RESET 0x00 +#define OOB_CMD_DRIVER_START 0x05 +#define OOB_CMD_DRIVER_STOP 0x06 +#define OOB_CMD_SET_IPMAC 0x41 + +/* Ethernet PHY MDI Mode */ +#define RE_ETH_PHY_FORCE_MDI 0 +#define RE_ETH_PHY_FORCE_MDIX 1 +#define RE_ETH_PHY_AUTO_MDI_MDIX 2 + +/* + * The RealTek doesn't use a fragment-based descriptor mechanism. + * Instead, there are only four register sets, each or which represents + * one 'descriptor.' Basically, each TX descriptor is just a contiguous + * packet buffer (32-bit aligned!) and we place the buffer addresses in + * the registers so the chip knows where they are. + * + * We can sort of kludge together the same kind of buffer management + * used in previous drivers, but we have to do buffer copies almost all + * the time, so it doesn't really buy us much. + * + * For reception, there's just one large buffer where the chip stores + * all received packets. + */ +#ifndef __NO_STRICT_ALIGNMENT +#define RE_FIXUP_RX 1 +#endif + + +#define RE_RX_BUF_SZ RE_RXBUF_64 +#define RE_RXBUFLEN (1 << ((RE_RX_BUF_SZ >> 11) + 13)) +#define RE_TX_LIST_CNT 4 /* C mode Tx buffer number */ +#define RE_TX_BUF_NUM 256 /* Tx buffer number */ +#define RE_RX_BUF_NUM 256 /* Rx buffer number */ +#define RE_BUF_SIZE 9216 /* Buffer size of descriptor buffer */ +#define RE_MIN_FRAMELEN 60 +#define RE_TXREV(x) ((x) << 11) +#define RE_RX_RESVERED RE_RXRESVERED +#define RE_RX_MAXDMA RE_RXDMA_UNLIMITED +#define RE_TX_MAXDMA RE_TXDMA_2048BYTES +#define RE_NTXSEGS 32 + +#define RE_TXCFG_CONFIG 0x03000780 //(RE_TXCFG_IFG|RE_TX_MAXDMA) + +#define RE_DESC_ALIGN 256 /* descriptor alignment */ +#define RE_RX_BUFFER_ALIGN 8 /* descriptor alignment */ + +#ifdef RE_FIXUP_RX +#define RE_ETHER_ALIGN RE_RX_BUFFER_ALIGN +#else +#define RE_ETHER_ALIGN 0 +#endif + +#define Jumbo_Frame_2k ((2 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_3k ((3 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_4k ((4 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_5k ((5 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_6k ((6 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_7k ((7 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_8k ((8 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define Jumbo_Frame_9k ((9 * 1024) - ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +struct re_chain_data { + u_int16_t cur_rx; + caddr_t re_rx_buf; + caddr_t re_rx_buf_ptr; + + struct mbuf *re_tx_chain[RE_TX_LIST_CNT]; + u_int8_t last_tx; /* Previous Tx OK */ + u_int8_t cur_tx; /* Next to TX */ +}; + +#define HW_SUPPORT_MAC_MCU(_M) ((_M)->HwSuppMacMcuVer > 0) + +//+++ From FreeBSD 9.0 +++ + +#define RL_MSI_MESSAGES 1 + +#define RL_ADDR_LO(y) ((uint64_t) (y) & 0xFFFFFFFF) +#define RL_ADDR_HI(y) ((uint64_t) (y) >> 32) +/* + * RX/TX descriptor definition. When large send mode is enabled, the + * lower 11 bits of the TX rl_cmd word are used to hold the MSS, and + * the checksum offload bits are disabled. The structure layout is + * the same for RX and TX descriptors + */ + +#define RL_TDESC_CMD_FRAGLEN 0x0000FFFF +#define RL_TDESC_CMD_TCPCSUM 0x00010000 /* TCP checksum enable */ +#define RL_TDESC_CMD_UDPCSUM 0x00020000 /* UDP checksum enable */ +#define RL_TDESC_CMD_IPCSUM 0x00040000 /* IP header checksum enable */ +#define RL_TDESC_CMD_MSSVAL 0x07FF0000 /* Large send MSS value */ +#define RL_TDESC_CMD_MSSVAL_SHIFT 16 /* Large send MSS value shift */ +#define RL_TDESC_CMD_LGSEND 0x08000000 /* TCP large send enb */ +#define RL_TDESC_CMD_EOF 0x10000000 /* end of frame marker */ +#define RL_TDESC_CMD_SOF 0x20000000 /* start of frame marker */ +#define RL_TDESC_CMD_EOR 0x40000000 /* end of ring marker */ +#define RL_TDESC_CMD_OWN 0x80000000 /* chip owns descriptor */ + +#define RL_TDESC_VLANCTL_TAG 0x00020000 /* Insert VLAN tag */ +#define RL_TDESC_VLANCTL_DATA 0x0000FFFF /* TAG data */ +/* RTL8168C/RTL8168CP/RTL8111C/RTL8111CP */ +#define RL_TDESC_CMD_UDPCSUMV2 0x80000000 +#define RL_TDESC_CMD_TCPCSUMV2 0x40000000 +#define RL_TDESC_CMD_IPCSUMV2 0x20000000 +#define RL_TDESC_CMD_MSSVALV2 0x1FFC0000 +#define RL_TDESC_CMD_MSSVALV2_SHIFT 18 + +#define RL_TDESC_CMD_BUFLEN 0x0000FFFF + +/* + * Error bits are valid only on the last descriptor of a frame + * (i.e. RL_TDESC_CMD_EOF == 1) + */ + +#define RL_TDESC_STAT_COLCNT 0x000F0000 /* collision count */ +#define RL_TDESC_STAT_EXCESSCOL 0x00100000 /* excessive collisions */ +#define RL_TDESC_STAT_LINKFAIL 0x00200000 /* link faulure */ +#define RL_TDESC_STAT_OWINCOL 0x00400000 /* out-of-window collision */ +#define RL_TDESC_STAT_TXERRSUM 0x00800000 /* transmit error summary */ +#define RL_TDESC_STAT_UNDERRUN 0x02000000 /* TX underrun occured */ +#define RL_TDESC_STAT_OWN 0x80000000 + +/* + * RX descriptor cmd/vlan definitions + */ + +#define RL_RDESC_CMD_EOR 0x40000000 +#define RL_RDESC_CMD_OWN 0x80000000 +#define RL_RDESC_CMD_BUFLEN 0x00003FFF + +#define RL_RDESC_STAT_OWN 0x80000000 +#define RL_RDESC_STAT_EOR 0x40000000 +#define RL_RDESC_STAT_SOF 0x20000000 +#define RL_RDESC_STAT_EOF 0x10000000 +#define RL_RDESC_STAT_FRALIGN 0x08000000 /* frame alignment error */ +#define RL_RDESC_STAT_MCAST 0x04000000 /* multicast pkt received */ +#define RL_RDESC_STAT_UCAST 0x02000000 /* unicast pkt received */ +#define RL_RDESC_STAT_BCAST 0x01000000 /* broadcast pkt received */ +#define RL_RDESC_STAT_BUFOFLOW 0x00800000 /* out of buffer space */ +#define RL_RDESC_STAT_FIFOOFLOW 0x00400000 /* FIFO overrun */ +#define RL_RDESC_STAT_GIANT 0x00200000 /* pkt > 4096 bytes */ +#define RL_RDESC_STAT_RXERRSUM 0x00100000 /* RX error summary */ +#define RL_RDESC_STAT_RUNT 0x00080000 /* runt packet received */ +#define RL_RDESC_STAT_CRCERR 0x00040000 /* CRC error */ +#define RL_RDESC_STAT_PROTOID 0x00030000 /* Protocol type */ +#define RL_RDESC_STAT_UDP 0x00020000 /* UDP, 8168C/CP, 8111C/CP */ +#define RL_RDESC_STAT_TCP 0x00010000 /* TCP, 8168C/CP, 8111C/CP */ +#define RL_RDESC_STAT_IPSUMBAD 0x00008000 /* IP header checksum bad */ +#define RL_RDESC_STAT_UDPSUMBAD 0x00004000 /* UDP checksum bad */ +#define RL_RDESC_STAT_TCPSUMBAD 0x00002000 /* TCP checksum bad */ +#define RL_RDESC_STAT_GFRAGLEN RL_RDESC_CMD_BUFLEN /* RX'ed frame/frag len */ +#define RL_RDESC_STAT_ERRS (RL_RDESC_STAT_GIANT|RL_RDESC_STAT_RUNT| \ + RL_RDESC_STAT_CRCERR) + +#define RL_RDESC_VLANCTL_TAG 0x00010000 /* VLAN tag available + (rl_vlandata valid)*/ +#define RL_RDESC_VLANCTL_DATA 0x0000FFFF /* TAG data */ +/* RTL8168C/RTL8168CP/RTL8111C/RTL8111CP */ +#define RL_RDESC_IPV6 0x80000000 +#define RL_RDESC_IPV4 0x40000000 + +#define RL_PROTOID_NONIP 0x00000000 +#define RL_PROTOID_TCPIP 0x00010000 +#define RL_PROTOID_UDPIP 0x00020000 +#define RL_PROTOID_IP 0x00030000 +#define RL_TCPPKT(x) (((x) & RL_RDESC_STAT_PROTOID) == \ + RL_PROTOID_TCPIP) +#define RL_UDPPKT(x) (((x) & RL_RDESC_STAT_PROTOID) == \ + RL_PROTOID_UDPIP) + +//--- From FreeBSD 9.0--- + + +union RxDesc { + u_int32_t ul[4]; + struct { +#if defined(_LITTLE_ENDIAN) + u_int32_t Frame_Length:14; + u_int32_t TCPF:1; + u_int32_t UDPF:1; + u_int32_t IPF:1; + u_int32_t TCPT:1; + u_int32_t UDPT:1; + u_int32_t CRC:1; + u_int32_t RUNT:1; + u_int32_t RES:1; + u_int32_t RWT:1; + u_int32_t RESV:2; + u_int32_t BAR:1; + u_int32_t PAM:1; + u_int32_t MAR:1; + u_int32_t LS:1; + u_int32_t FS:1; + u_int32_t EOR:1; + u_int32_t OWN:1; + + u_int32_t VLAN_TAG:16; + u_int32_t TAVA:1; + u_int32_t RESV1:15; +#elif defined(_BIG_ENDIAN) + u_int32_t OWN:1; + u_int32_t EOR:1; + u_int32_t FS:1; + u_int32_t LS:1; + u_int32_t MAR:1; + u_int32_t PAM:1; + u_int32_t BAR:1; + u_int32_t RESV:2; + u_int32_t RWT:1; + u_int32_t RES:1; + u_int32_t RUNT:1; + u_int32_t CRC:1; + u_int32_t UDPT:1; + u_int32_t TCPT:1; + u_int32_t IPF:1; + u_int32_t UDPF:1; + u_int32_t TCPF:1; + u_int32_t Frame_Length:14; + + u_int32_t RESV1:15; + u_int32_t TAVA:1; + u_int32_t VLAN_TAG:16; +#else +#error "what endian is this machine?" +#endif + u_int32_t RxBuffL; + u_int32_t RxBuffH; + } so0; /* symbol owner=0 */ +}; + +union TxDesc { + u_int32_t ul[4]; + struct { +#if defined(_LITTLE_ENDIAN) + u_int32_t Frame_Length:16; + u_int32_t TCPCS:1; + u_int32_t UDPCS:1; + u_int32_t IPCS:1; + u_int32_t SCRC:1; + u_int32_t RESV:6; + u_int32_t TDMA:1; + u_int32_t LGSEN:1; + u_int32_t LS:1; + u_int32_t FS:1; + u_int32_t EOR:1; + u_int32_t OWN:1; + + u_int32_t VLAN_TAG:16; + u_int32_t TAGC0:1; + u_int32_t TAGC1:1; + u_int32_t RESV1:14; +#elif defined(_BIG_ENDIAN) + u_int32_t OWN:1; + u_int32_t EOR:1; + u_int32_t FS:1; + u_int32_t LS:1; + u_int32_t LGSEN:1; + u_int32_t TDMA:1; + u_int32_t RESV:6; + u_int32_t SCRC:1; + u_int32_t IPCS:1; + u_int32_t UDPCS:1; + u_int32_t TCPCS:1; + u_int32_t Frame_Length:16; + + u_int32_t RESV1:14; + u_int32_t TAGC1:1; + u_int32_t TAGC0:1; + u_int32_t VLAN_TAG:16; +#else +#error "what endian is this machine?" +#endif + u_int32_t TxBuffL; + u_int32_t TxBuffH; + } so1; /* symbol owner=1 */ +}; + +struct re_descriptor { + u_int8_t rx_cur_index; + u_int8_t rx_last_index; + union RxDesc *rx_desc; /* 8 bits alignment */ + struct mbuf *rx_buf[RE_RX_BUF_NUM]; + + u_int8_t tx_cur_index; + u_int8_t tx_last_index; + union TxDesc *tx_desc; /* 8 bits alignment */ + struct mbuf *tx_buf[RE_TX_BUF_NUM]; + bus_dma_tag_t rx_desc_tag; + bus_dmamap_t rx_desc_dmamap; + bus_dma_tag_t re_rx_mtag; /* mbuf RX mapping tag */ + bus_dmamap_t re_rx_dmamap[RE_RX_BUF_NUM]; + + bus_dma_tag_t tx_desc_tag; + bus_dmamap_t tx_desc_dmamap; + bus_dma_tag_t re_tx_mtag; /* mbuf TX mapping tag */ + bus_dmamap_t re_tx_dmamap[RE_TX_BUF_NUM]; +}; + +#define RE_INC(x) (x = (x + 1) % RE_TX_LIST_CNT) +#define RE_CUR_TXADDR(x) ((x->re_cdata.cur_tx * 4) + RE_TXADDR0) +#define RE_CUR_TXSTAT(x) ((x->re_cdata.cur_tx * 4) + RE_TXSTAT0) +#define RE_CUR_TXMBUF(x) (x->re_cdata.re_tx_chain[x->re_cdata.cur_tx]) +#define RE_LAST_TXADDR(x) ((x->re_cdata.last_tx * 4) + RE_TXADDR0) +#define RE_LAST_TXSTAT(x) ((x->re_cdata.last_tx * 4) + RE_TXSTAT0) +#define RE_LAST_TXMBUF(x) (x->re_cdata.re_tx_chain[x->re_cdata.last_tx]) + +struct re_type { + u_int16_t re_vid; + u_int16_t re_did; + char *re_name; +}; + +struct re_mii_frame { + u_int8_t mii_stdelim; + u_int8_t mii_opcode; + u_int8_t mii_phyaddr; + u_int8_t mii_regaddr; + u_int8_t mii_turnaround; + u_int16_t mii_data; +}; + +/* + * MII constants + */ +#define RE_MII_STARTDELIM 0x01 +#define RE_MII_READOP 0x02 +#define RE_MII_WRITEOP 0x01 +#define RE_MII_TURNAROUND 0x02 +#define RL_TDESC_VLANCTL_TAG 0x00020000 +#define RL_RDESC_VLANCTL_TAG 0x00010000 +#define RL_RDESC_VLANCTL_DATA 0x0000FFFF +#define RL_CPLUSCMD_VLANSTRIP 0x0040 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_MAGIC_PACKET_V2 0x20000000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_MAGIC_PACKET_V3 0x80000000 + +#define RL_ProtoIP ((1<<17)|(1<<18)) +//#define RL_ProtoIP ((1<<16)|(1<<17)) +#define RL_TCPT (1<<17) +#define RL_UDPT (1<<18) +#define RL_IPF (1<<16) +#define RL_UDPF (1<<15) +#define RL_TCPF (1<<14) +#define RL_V4F (1<<30) + +#define RL_IPV4CS (1<<29) +#define RL_TCPCS (1<<30) +#define RL_UDPCS (1<<31) +#define RL_IPV4CS1 (1<<18) +#define RL_TCPCS1 (1<<16) +#define RL_UDPCS1 (1<<17) + +#define RL_RxChkSum (1<<5) + +enum { + EFUSE_NOT_SUPPORT = 0, + EFUSE_SUPPORT_V1, + EFUSE_SUPPORT_V2, + EFUSE_SUPPORT_V3, + EFUSE_SUPPORT_V4, +}; + +enum { + MACFG_3 = 0x03, + MACFG_4, + MACFG_5, + MACFG_6, + + MACFG_11, + MACFG_12, + MACFG_13, + MACFG_14, + MACFG_15, + MACFG_16, + MACFG_17, + MACFG_18, + MACFG_19, + + MACFG_21, + MACFG_22, + MACFG_23, + MACFG_24, + MACFG_25, + MACFG_26, + MACFG_27, + MACFG_28, + + MACFG_31, + MACFG_32, + MACFG_33, + + MACFG_36, + MACFG_37, + MACFG_38, + MACFG_39, + + MACFG_41, + MACFG_42, + MACFG_43, + + MACFG_50, + MACFG_51, + MACFG_52, + MACFG_53, + MACFG_54, + MACFG_55, + MACFG_56, + MACFG_57, + MACFG_58, + MACFG_59, + MACFG_60, + MACFG_61, + MACFG_62, + MACFG_63, + MACFG_64, + MACFG_65, + MACFG_66, + MACFG_67, + MACFG_68, + MACFG_69, + MACFG_70, + MACFG_71, + MACFG_72, + MACFG_73, + MACFG_74, + + MACFG_80, + MACFG_81, + MACFG_82, + MACFG_83, + + MACFG_FF = 0xFF +}; + +//#define MAC_STYLE_1 1 /* RTL8110S/SB/SC, RTL8111B and RTL8101E */ +//#define MAC_STYLE_2 2 /* RTL8111C/CP/D and RTL8102E */ + +struct re_softc { +#if OS_VER=VERSION(7,0) + struct task re_inttask; +#endif + u_int16_t cur_page; + + u_int16_t phy_reg_anlpar; + + u_int8_t re_hw_enable_msi_msix; + + u_int8_t re_coalesce_tx_pkt; + + u_int8_t link_state; + + u_int8_t prohibit_access_reg; + + u_int8_t re_hw_supp_now_is_oob_ver; + + u_int8_t hw_hw_supp_serdes_phy_ver; + + u_int8_t HwSuppDashVer; + u_int8_t re_dash; + bus_space_handle_t re_mapped_cmac_handle; /* bus space tag */ + bus_space_tag_t re_mapped_cmac_tag; /* bus space tag */ + bus_space_handle_t re_cmac_handle; /* bus space handle */ + bus_space_tag_t re_cmac_tag; /* bus space tag */ + u_int8_t HwPkgDet; + + u_int32_t HwFiberModeVer; + u_int32_t HwFiberStat; + + u_int8_t HwSuppMacMcuVer; + u_int16_t MacMcuPageSize; + + int (*ifmedia_upd)(struct ifnet *); + void (*ifmedia_sts)(struct ifnet *, struct ifmediareq *); +#if OS_VER < VERSION(7,0) + void (*intr)(void *); +#else + int (*intr)(void *); +#endif //OS_VER < VERSION(7,0) + void (*int_task)(void *, int); + void (*hw_start_unlock)(struct re_softc *); +}; + +enum bits { + BIT_0 = (1 << 0), + BIT_1 = (1 << 1), + BIT_2 = (1 << 2), + BIT_3 = (1 << 3), + BIT_4 = (1 << 4), + BIT_5 = (1 << 5), + BIT_6 = (1 << 6), + BIT_7 = (1 << 7), + BIT_8 = (1 << 8), + BIT_9 = (1 << 9), + BIT_10 = (1 << 10), + BIT_11 = (1 << 11), + BIT_12 = (1 << 12), + BIT_13 = (1 << 13), + BIT_14 = (1 << 14), + BIT_15 = (1 << 15), + BIT_16 = (1 << 16), + BIT_17 = (1 << 17), + BIT_18 = (1 << 18), + BIT_19 = (1 << 19), + BIT_20 = (1 << 20), + BIT_21 = (1 << 21), + BIT_22 = (1 << 22), + BIT_23 = (1 << 23), + BIT_24 = (1 << 24), + BIT_25 = (1 << 25), + BIT_26 = (1 << 26), + BIT_27 = (1 << 27), + BIT_28 = (1 << 28), + BIT_29 = (1 << 29), + BIT_30 = (1 << 30), + BIT_31 = (1 << 31) +}; + +#define RE_LOCK(_sc) mtx_lock(&(_sc)->mtx) +#define RE_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) +#define RE_LOCK_INIT(_sc,_name) mtx_init(&(_sc)->mtx,_name,MTX_NETWORK_LOCK,MTX_DEF) +#define RE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->mtx) +#define RE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->mtx,MA_OWNED) + +/* + * register space access macros + */ +#if OS_VER>VERSION(5,9) +#define CSR_WRITE_STREAM_4(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_stream_4(sc->re_btag, sc->re_bhandle, reg, val)) +#define CSR_WRITE_STREAM_2(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_stream_2(sc->re_btag, sc->re_bhandle, reg, val)) +#endif +#define CSR_WRITE_4(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_4(sc->re_btag, sc->re_bhandle, reg, val)) +#define CSR_WRITE_2(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_2(sc->re_btag, sc->re_bhandle, reg, val)) +#define CSR_WRITE_1(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_1(sc->re_btag, sc->re_bhandle, reg, val)) + +#define CSR_READ_4(sc, reg) ((sc->prohibit_access_reg)?0xFFFFFFFF:bus_space_read_4(sc->re_btag, sc->re_bhandle, reg)) +#define CSR_READ_2(sc, reg) ((sc->prohibit_access_reg)?0xFFFF:bus_space_read_2(sc->re_btag, sc->re_bhandle, reg)) +#define CSR_READ_1(sc, reg) ((sc->prohibit_access_reg)?0xFF:bus_space_read_1(sc->re_btag, sc->re_bhandle, reg)) + +/* cmac write/read MMIO register */ +#define RE_CMAC_WRITE_1(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_1(sc->re_cmac_tag, sc->re_cmac_handle, reg, val)) +#define RE_CMAC_WRITE_2(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_2(sc->re_cmac_tag, sc->re_cmac_handle, reg, val)) +#define RE_CMAC_WRITE_4(sc, reg, val) ((sc->prohibit_access_reg)?:bus_space_write_4(sc->re_cmac_tag, sc->re_cmac_handle, reg, val)) +#define RE_CMAC_READ_1(sc, reg) ((sc->prohibit_access_reg)?0xFF:bus_space_read_1(sc->re_cmac_tag, sc->re_cmac_handle, reg)) +#define RE_CMAC_READ_2(sc, reg) ((sc->prohibit_access_reg)?0xFFFF:bus_space_read_2(sc->re_cmac_tag, sc->re_cmac_handle, reg)) +#define RE_CMAC_READ_4(sc, reg) (sc->prohibit_access_reg)?0xFFFFFFFF:bus_space_read_4(sc->re_cmac_tag, sc->re_cmac_handle, reg)) + +#define RE_TIMEOUT 1000 + +/* + * General constants that are fun to know. + * + * RealTek PCI vendor ID + */ +#define RT_VENDORID 0x10EC + +/* + * RealTek chip device IDs. + */ +#define RT_DEVICEID_8129 0x8129 +#define RT_DEVICEID_8139 0x8139 +#define RT_DEVICEID_8169 0x8169 /* For RTL8169 */ +#define RT_DEVICEID_8169SC 0x8167 /* For RTL8169SC */ +#define RT_DEVICEID_8168 0x8168 /* For RTL8168B */ +#define RT_DEVICEID_8161 0x8161 /* For RTL8168 Series add-on card */ +#define RT_DEVICEID_8162 0x8162 /* For RTL8168KB */ +#define RT_DEVICEID_8136 0x8136 /* For RTL8101E */ +#define RT_DEVICEID_8125 0x8125 /* For RTL8125 */ + +/* + * Accton PCI vendor ID + */ +#define ACCTON_VENDORID 0x1113 + +/* + * Accton MPX 5030/5038 device ID. + */ +#define ACCTON_DEVICEID_5030 0x1211 + +/* + * Delta Electronics Vendor ID. + */ +#define DELTA_VENDORID 0x1500 + +/* + * Delta device IDs. + */ +#define DELTA_DEVICEID_8139 0x1360 + +/* + * Addtron vendor ID. + */ +#define ADDTRON_VENDORID 0x4033 + +/* + * Addtron device IDs. + */ +#define ADDTRON_DEVICEID_8139 0x1360 + +/* + * D-Link vendor ID. + */ +#define DLINK_VENDORID 0x1186 + +/* + * D-Link DFE-530TX+ device ID + */ +#define DLINK_DEVICEID_530TXPLUS 0x1300 + +/* + * PCI low memory base and low I/O base register, and + * other PCI registers. + */ + +#define RE_PCI_VENDOR_ID 0x00 +#define RE_PCI_DEVICE_ID 0x02 +#define RE_PCI_COMMAND 0x04 +#define RE_PCI_STATUS 0x06 +#define RE_PCI_REVISION_ID 0x08 /* 8 bits */ +#define RE_PCI_CLASSCODE 0x09 +#define RE_PCI_LATENCY_TIMER 0x0D +#define RE_PCI_HEADER_TYPE 0x0E +#define RE_PCI_BIOSROM 0x30 +#define RE_PCI_INTLINE 0x3C +#define RE_PCI_INTPIN 0x3D +#define RE_PCI_MINGNT 0x3E +#define RE_PCI_MINLAT 0x0F +#define RE_PCI_RESETOPT 0x48 +#define RE_PCI_EEPROM_DATA 0x4C + +#define RE_PCI_CAPID 0x50 /* 8 bits */ +#define RE_PCI_NEXTPTR 0x51 /* 8 bits */ +#define RE_PCI_PWRMGMTCAP 0x52 /* 16 bits */ +#define RE_PCI_PWRMGMTCTRL 0x54 /* 16 bits */ + +#define RE_PSTATE_MASK 0x0003 +#define RE_PSTATE_D0 0x0000 +#define RE_PSTATE_D1 0x0002 +#define RE_PSTATE_D2 0x0002 +#define RE_PSTATE_D3 0x0003 +#define RE_PME_EN 0x0010 +#define RE_PME_STATUS 0x8000 + +#define RE_WOL_LINK_SPEED_10M_FIRST ( 0 ) +#define RE_WOL_LINK_SPEED_100M_FIRST ( 1 ) + +#define RTK_ADVERTISE_2500FULL 0x80 + +#define RTL8125_MAC_MCU_PAGE_SIZE 256 //256 words + +//Ram Code Version +#define NIC_RAMCODE_VERSION_8168E (0x0057) +#define NIC_RAMCODE_VERSION_8168EVL (0x0055) +#define NIC_RAMCODE_VERSION_8168F (0x0052) +#define NIC_RAMCODE_VERSION_8411 (0x0044) +#define NIC_RAMCODE_VERSION_8168G (0x0042) +#define NIC_RAMCODE_VERSION_8168GU (0x0001) +#define NIC_RAMCODE_VERSION_8168EP (0x0019) +#define NIC_RAMCODE_VERSION_8411B (0x0012) +#define NIC_RAMCODE_VERSION_8168H (0x0055) +#define NIC_RAMCODE_VERSION_8168H_6838 (0x0010) +#define NIC_RAMCODE_VERSION_8168FP (0x0003) +#define NIC_RAMCODE_VERSION_8125A_REV_A (0x0B11) +#define NIC_RAMCODE_VERSION_8125A_REV_B (0x0B33) +#define NIC_RAMCODE_VERSION_8125B_REV_A (0x0B17) +#define NIC_RAMCODE_VERSION_8125B_REV_B (0x0B74) + +#ifdef __alpha__ +#undef vtophys +#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va) +#endif + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#define PHYAR_Flag 0x80000000 +#define RE_CPlusMode 0x20 /* In Revision ID */ + +/* interrupt service routine loop time*/ +/* the minimum value is 1 */ +#define INTR_MAX_LOOP 1 + +#define RE_REGS_SIZE (256) + +#define RTL8168FP_OOBMAC_BASE 0xBAF70000 +#define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0 ) +#define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1 ) +#define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2 ) +#define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3 ) + +#define HW_SUPP_SERDES_PHY(_M) ((_M)->hw_hw_supp_serdes_phy_ver > 0) + +/*#define RE_DBG*/ + +#ifdef RE_DBG +#define DBGPRINT(_unit, _msg) printf ("re%d: %s\n", _unit,_msg) +#define DBGPRINT1(_unit, _msg, _para1) \ + { \ + char buf[100]; \ + sprintf(buf,_msg,_para1); \ + printf ("re%d: %s\n", _unit,buf); \ + } +#else +#define DBGPRINT(_unit, _msg) +#define DBGPRINT1(_unit, _msg, _para1) +#endif + +#if OS_VERarpcom.ac_if +#define if_drv_flags if_flags +#define IFF_DRV_RUNNING IFF_RUNNING +#define IFF_DRV_OACTIVE IFF_OACTIVE +#else +#define RE_GET_IFNET(SC) SC->re_ifp +#endif + +#if OS_VER>=VERSION(10,0) +#define IF_ADDR_LOCK IF_ADDR_WLOCK +#define IF_ADDR_UNLOCK IF_ADDR_WUNLOCK +#endif + +#if OS_VER>=VERSION(7,4) +#if OS_VER>=VERSION(9,2) +#define RE_PCIEM_LINK_CAP_ASPM PCIEM_LINK_CAP_ASPM +#define RE_PCIER_LINK_CTL PCIER_LINK_CTL +#define RE_PCIER_LINK_CAP PCIER_LINK_CAP +#else //OS_VER>=VERSION(9,2) +#define RE_PCIEM_LINK_CAP_ASPM PCIM_LINK_CAP_ASPM +#define RE_PCIER_LINK_CTL PCIR_EXPRESS_LINK_CTL +#define RE_PCIER_LINK_CAP PCIR_EXPRESS_LINK_CAP +#endif +#endif //OS_VER>=VERSION(7,4) + +#ifndef IFM_2500_X +#define IFM_2500_X IFM_X(63) +#endif + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(_a) (sizeof((_a)) / sizeof((_a)[0])) +#endif diff --git a/linux/r8169-6.030.01/Makefile b/linux/r8169-6.030.01/Makefile new file mode 100755 index 0000000..98ee7bd --- /dev/null +++ b/linux/r8169-6.030.01/Makefile @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: GPL-2.0-only +################################################################################ +# +# r8169 is the Linux device driver released for RealTek RTL8169S/8110S, +# RTL8169SB/8110SB, and RTL8110SC Gigabit Ethernet controllers with +# PCI interface. +# +# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Author: +# Realtek NIC software team +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ + +################################################################################ +# This product is covered by one or more of the following patents: +# US5,307,459, US5,434,872, US5,732,094, US6,570,884, US6,115,776, and US6,327,625. +################################################################################ + +KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x + +all: clean modules install + +modules: +ifeq ($(KFLAG),24x) + $(MAKE) -C src/ -f Makefile_linux24x modules +else + $(MAKE) -C src/ modules +endif + +clean: +ifeq ($(KFLAG),24x) + $(MAKE) -C src/ -f Makefile_linux24x clean +else + $(MAKE) -C src/ clean +endif + +install: +ifeq ($(KFLAG),24x) + $(MAKE) -C src/ -f Makefile_linux24x install +else + $(MAKE) -C src/ install +endif diff --git a/linux/r8169-6.030.01/readme b/linux/r8169-6.030.01/readme new file mode 100755 index 0000000..6499ee3 --- /dev/null +++ b/linux/r8169-6.030.01/readme @@ -0,0 +1,156 @@ + + + This is the Linux device driver released for RealTek RTL8169S/8110S, RTL8169SB/8110SB, and RTL8110SC. + + + + - kernel source tree (supported Linux kernel 2.6.x/2.4.20 and latter) + - compiler/binutils for kernel compilation + + + Check whether the built-in driver, r8169.ko(or r8169.o for linux kernel 2.4.x), is installed. + # lsmod | grep r8169 + + If it is installed, please remove it. + # rmmod r8169 + note: If the built-in driver cannot removed by rmmod, please edit /etc/modprobe.conf and comment 'alias eth0 r8169'. Then, remove it again or reboot your computer. + + Unpack the tarball : + # tar vjxf r8169-6.aaa.bb.tar.bz2 + + Change to the directory: + # cd r8169-6.aaa.bb + + If you are running the target kernel, then you should be able to do : + + # make clean modules (as root or with sudo) + # make install + # depmod -a + # modprobe r8169 + + You can check whether the driver is loaded by using following commands. + + # lsmod | grep r8169 + # ifconfig -a + + If there is a device name, ethX, shown on the monitor, the linux + driver is loaded. Then, you can use the following command to activate + the ethX. + + # ifconfig ethX up + + , where X=0,1,2,... + + + + 1. Set manually + a. Set the IP address of your machine. + + # ifconfig ethX "the IP address of your machine" + + b. Set the IP address of DNS. + + Insert the following configuration in /etc/resolv.conf. + + nameserver "the IP address of DNS" + + c. Set the IP address of gateway. + + # route add default gw "the IP address of gateway" + + 2. Set by doing configurations in /etc/sysconfig/network-scripts + /ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network + /ifcfg-ethX for SuSE. There are two examples to set network + configurations. + + a. Fix IP address: + DEVICE=eth0 + BOOTPROTO=static + ONBOOT=yes + TYPE=ethernet + NETMASK=255.255.255.0 + IPADDR=192.168.1.1 + GATEWAY=192.168.1.254 + BROADCAST=192.168.1.255 + + b. DHCP: + DEVICE=eth0 + BOOTPROTO=dhcp + ONBOOT=yes + + + There are two ways to modify the MAC address of the NIC. + 1. Use ifconfig: + + # ifconfig ethX hw ether YY:YY:YY:YY:YY:YY + + , where X is the device number assigned by Linux kernel, and + YY:YY:YY:YY:YY:YY is the MAC address assigned by the user. + + 2. Use ip: + + # ip link set ethX address YY:YY:YY:YY:YY:YY + + , where X is the device number assigned by Linux kernel, and + YY:YY:YY:YY:YY:YY is the MAC address assigned by the user. + + + + 1. Force the link status when insert the driver. + + If the user is in the path ~/r8169, the link status can be forced + to one of the 5 modes as following command. + + # insmod ./src/r8169.ko speed=SPEED_MODE duplex=DUPLEX_MODE autoneg=NWAY_OPTION + + , where + SPEED_MODE = 1000 for 1000Mbps + = 100 for 100Mbps + = 10 for 10Mbps + DUPLEX_MODE = 0 for half-duplex + = 1 for full-duplex + NWAY_OPTION = 0 for auto-negotiation off (true force) + = 1 for auto-negotiation on (nway force) + For example: + + # insmod ./src/r8169.ko speed=100 duplex=0 autoneg=0 + + will force PHY to operate in 100Mpbs Half-duplex(nway force). + + 2. Force the link status by using ethtool. + a. Insert the driver first. + b. Make sure that ethtool exists in /sbin. + c. Force the link status as the following command. + + # ethtool -s ethX speed SPEED_MODE duplex DUPLEX_MODE autoneg NWAY_OPTION + + , where + SPEED_MODE = 1000 for 1000Mbps + = 100 for 100Mbps + = 10 for 10Mbps + DUPLEX_MODE = half for half-duplex + = full for full-duplex + NWAY_OPTION = off for auto-negotiation off (true force) + = on for auto-negotiation on (nway force) + + For example: + + # ethtool -s eth0 speed 100 duplex full autoneg on + + will force PHY to operate in 100Mpbs Full-duplex(nway force). + + + Transmitting Jumbo Frames, whose packet size is bigger than 1500 bytes, please change mtu by the following command. + + # ifconfig ethX mtu MTU + + , where X=0,1,2,..., and MTU is configured by user. RTL8110S/SB/SC supports Jumbo Frame size (MTU) up to 7 kBytes. + + For example, to configure jumbo frame as 7 kBytes, use the following command: + + # ethtool eth0 mtu 7168 + + If there is another computer inatalled RTL8169S/SB/SC and its jumbo size is also configured to be 7 kBytes, the Linux can ping it by using following command. + + # ping IP_ADDRESS -s 7126 -M do + diff --git a/linux/r8169-6.030.01/src/Makefile b/linux/r8169-6.030.01/src/Makefile new file mode 100755 index 0000000..76a74a4 --- /dev/null +++ b/linux/r8169-6.030.01/src/Makefile @@ -0,0 +1,119 @@ +# SPDX-License-Identifier: GPL-2.0-only +################################################################################ +# +# r8169 is the Linux device driver released for RealTek RTL8169S/8110S, +# RTL8169SB/8110SB, and RTL8110SC Gigabit Ethernet controllers with +# PCI interface. +# +# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Author: +# Realtek NIC software team +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ + +################################################################################ +# This product is covered by one or more of the following patents: +# US5,307,459, US5,434,872, US5,732,094, US6,570,884, US6,115,776, and US6,327,625. +################################################################################ + +ENABLE_S5_KEEP_CURR_MAC = n + +ifneq ($(KERNELRELEASE),) + obj-m := r8169.o + r8169-objs := r8169_n.o + EXTRA_CFLAGS += -DCONFIG_R8169_NAPI + EXTRA_CFLAGS += -DCONFIG_R8169_VLAN + ifeq ($(ENABLE_S5_KEEP_CURR_MAC), y) + EXTRA_CFLAGS += -DENABLE_S5_KEEP_CURR_MAC + endif +else + BASEDIR := /lib/modules/$(shell uname -r) + KERNELDIR ?= $(BASEDIR)/build + PWD :=$(shell pwd) + DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net/ethernet -name realtek -type d) + ifeq ($(DRIVERDIR),) + DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d) + endif + ifeq ($(DRIVERDIR),) + DRIVERDIR := $(BASEDIR)/kernel/drivers/net + endif + RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR)) + + KERNEL_GCC_VERSION := $(shell cat /proc/version | sed -n 's/.*gcc version \([[:digit:]]\.[[:digit:]]\.[[:digit:]]\).*/\1/p') + CCVERSION = $(shell $(CC) -dumpversion) + + KVER = $(shell uname -r) + KMAJ = $(shell echo $(KVER) | \ + sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/') + KMIN = $(shell echo $(KVER) | \ + sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/') + KREV = $(shell echo $(KVER) | \ + sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/') + + kver_ge = $(shell \ + echo test | awk '{if($(KMAJ) < $(1)) {print 0} else { \ + if($(KMAJ) > $(1)) {print 1} else { \ + if($(KMIN) < $(2)) {print 0} else { \ + if($(KMIN) > $(2)) {print 1} else { \ + if($(KREV) < $(3)) {print 0} else { print 1 } \ + }}}}}' \ + ) + +.PHONY: all +all: print_vars clean modules install + +print_vars: + @echo + @echo "CC: " $(CC) + @echo "CCVERSION: " $(CCVERSION) + @echo "KERNEL_GCC_VERSION: " $(KERNEL_GCC_VERSION) + @echo "KVER: " $(KVER) + @echo "KMAJ: " $(KMAJ) + @echo "KMIN: " $(KMIN) + @echo "KREV: " $(KREV) + @echo "BASEDIR: " $(BASEDIR) + @echo "DRIVERDIR: " $(DRIVERDIR) + @echo "PWD: " $(PWD) + @echo "RTKDIR: " $(RTKDIR) + @echo + +.PHONY:modules +modules: +#ifeq ($(call kver_ge,5,0,0),1) + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +#else +# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules +#endif + +.PHONY:clean +clean: +#ifeq ($(call kver_ge,5,0,0),1) + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean +#else +# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean +#endif + +.PHONY:install +install: +#ifeq ($(call kver_ge,5,0,0),1) + $(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install +#else +# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install +#endif + +endif diff --git a/linux/r8169-6.030.01/src/Makefile_linux24x b/linux/r8169-6.030.01/src/Makefile_linux24x new file mode 100755 index 0000000..0e42c36 --- /dev/null +++ b/linux/r8169-6.030.01/src/Makefile_linux24x @@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only +################################################################################ +# +# r8169 is the Linux device driver released for RealTek RTL8169S/8110S, +# RTL8169SB/8110SB, and RTL8110SC Gigabit Ethernet controllers with +# PCI interface. +# +# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Author: +# Realtek NIC software team +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ + +################################################################################ +# This product is covered by one or more of the following patents: +# US5,307,459, US5,434,872, US5,732,094, US6,570,884, US6,115,776, and US6,327,625. +################################################################################ + +CC := gcc +LD := ld +ARCH := $(shell uname -m | sed 's/i.86/i386/') +KSRC := /lib/modules/$(shell uname -r)/build +CONFIG_FILE := $(KSRC)/include/linux/autoconf.h +KMISC := /lib/modules/$(shell uname -r)/kernel/drivers/net/ + + +ifeq ($(ARCH),x86_64) + MODCFLAGS += -mcmodel=kernel -mno-red-zone +endif + +#standard flags for module builds +MODCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall +MODCFLAGS += -I$(KSRC)/include -I. +MODCFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h +ifeq ($(RTL_IOCTL),y) + SOURCE := r8169_n.c rtl_ioctl.c +else + SOURCE := r8169_n.c +endif +OBJS := $(SOURCE:.c=.o) + + +SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \ + grep CONFIG_SMP | awk '{print $$3}') + +ifneq ($(SMP),1) + SMP := 0 +endif + +ifeq ($(SMP),1) + MODCFLAGS += -D__SMP__ +endif + +modules: $(OBJS) + $(LD) -r $^ -o r8169.o + strip --strip-debug r8169.o + +%.o: %.c + $(CC) $(MODCFLAGS) -c $< -o $@ + +clean: + rm *.o -f + +install: + install -m 744 -c r8169.o $(KMISC) diff --git a/linux/r8169-6.030.01/src/r8169.h b/linux/r8169-6.030.01/src/r8169.h new file mode 100755 index 0000000..61478c5 --- /dev/null +++ b/linux/r8169-6.030.01/src/r8169.h @@ -0,0 +1,1382 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +################################################################################ +# +# r8169 is the Linux device driver released for Realtek Gigabit Ethernet +# Controllers with PCI interface. +# +# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Author: +# Realtek NIC software team +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ +*/ + +/************************************************************************************ + * This product is covered by one or more of the following patents: + * US6,570,884, US6,115,776, and US6,327,625. + ***********************************************************************************/ + +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) +typedef int netdev_tx_t; +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#define skb_transport_offset(skb) (skb->h.raw - skb->data) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) +#define device_set_wakeup_enable(dev, val) do {} while (0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) +static inline void ether_addr_copy(u8 *dst, const u8 *src) +{ + u16 *a = (u16 *)dst; + const u16 *b = (const u16 *)src; + + a[0] = b[0]; + a[1] = b[1]; + a[2] = b[2]; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) +#define IS_ERR_OR_NULL(ptr) (!ptr) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) +#define reinit_completion(x) ((x)->done = 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) +#define pm_runtime_mark_last_busy(x) +#define pm_runtime_put_autosuspend(x) pm_runtime_put(x) +#define pm_runtime_put_sync_autosuspend(x) pm_runtime_put_sync(x) + +static inline bool pm_runtime_suspended(struct device *dev) +{ + return dev->power.runtime_status == RPM_SUSPENDED + && !dev->power.disable_depth; +} + +static inline bool pm_runtime_active(struct device *dev) +{ + return dev->power.runtime_status == RPM_ACTIVE + || dev->power.disable_depth; +} +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) +#define queue_delayed_work(long_wq, work, delay) schedule_delayed_work(work, delay) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +#define netif_printk(priv, type, level, netdev, fmt, args...) \ + do { \ + if (netif_msg_##type(priv)) \ + printk(level "%s: " fmt,(netdev)->name , ##args); \ + } while (0) + +#define netif_emerg(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_EMERG, netdev, fmt, ##args) +#define netif_alert(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_ALERT, netdev, fmt, ##args) +#define netif_crit(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_CRIT, netdev, fmt, ##args) +#define netif_err(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_ERR, netdev, fmt, ##args) +#define netif_warn(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_WARNING, netdev, fmt, ##args) +#define netif_notice(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_NOTICE, netdev, fmt, ##args) +#define netif_info(priv, type, netdev, fmt, args...) \ + netif_printk(priv, type, KERN_INFO, (netdev), fmt, ##args) +#endif +#endif +#endif +#endif +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) +#define setup_timer(_timer, _function, _data) \ +do { \ + (_timer)->function = _function; \ + (_timer)->data = _data; \ + init_timer(_timer); \ +} while (0) +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) +#if defined(skb_vlan_tag_present) && !defined(vlan_tx_tag_present) +#define vlan_tx_tag_present skb_vlan_tag_present +#endif +#if defined(skb_vlan_tag_get) && !defined(vlan_tx_tag_get) +#define vlan_tx_tag_get skb_vlan_tag_get +#endif +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) + +#define RTL_ALLOC_SKB_INTR(tp, length) dev_alloc_skb(length) +#ifdef CONFIG_R8169_NAPI +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) +#undef RTL_ALLOC_SKB_INTR +#define RTL_ALLOC_SKB_INTR(tp, length) napi_alloc_skb(&tp->napi, length) +#endif +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) +#define eth_random_addr(addr) random_ether_addr(addr) +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +#define netdev_features_t u32 +#endif +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +#define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX +#define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) +#define __devinit +#define __devexit +#define __devexit_p(func) func +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +#define CHECKSUM_PARTIAL CHECKSUM_HW +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +#define irqreturn_t void +#define IRQ_HANDLED 1 +#define IRQ_NONE 0 +#define IRQ_RETVAL(x) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +typedef unsigned long uintptr_t; +#endif + +#ifndef NETIF_F_RXALL +#define NETIF_F_RXALL 0 +#endif + +#ifndef NETIF_F_RXFCS +#define NETIF_F_RXFCS 0 +#endif + +#ifndef HAVE_FREE_NETDEV +#define free_netdev(x) kfree(x) +#endif + +#ifndef SET_NETDEV_DEV +#define SET_NETDEV_DEV(net, pdev) +#endif + +#ifndef SET_MODULE_OWNER +#define SET_MODULE_OWNER(dev) +#endif + +#ifndef SA_SHIRQ +#define SA_SHIRQ IRQF_SHARED +#endif + +#ifndef NETIF_F_GSO +#define gso_size tso_size +#define gso_segs tso_segs +#endif + +#ifndef PCI_VENDOR_ID_DLINK +#define PCI_VENDOR_ID_DLINK 0x1186 +#endif + +#ifndef dma_mapping_error +#define dma_mapping_error(a,b) 0 +#endif + +#ifndef netif_err +#define netif_err(a,b,c,d) +#endif + +#ifndef AUTONEG_DISABLE +#define AUTONEG_DISABLE 0x00 +#endif + +#ifndef AUTONEG_ENABLE +#define AUTONEG_ENABLE 0x01 +#endif + +#ifndef BMCR_SPEED1000 +#define BMCR_SPEED1000 0x0040 +#endif + +#ifndef BMCR_SPEED100 +#define BMCR_SPEED100 0x2000 +#endif + +#ifndef BMCR_SPEED10 +#define BMCR_SPEED10 0x0000 +#endif + +#ifndef SPEED_UNKNOWN +#define SPEED_UNKNOWN -1 +#endif + +#ifndef DUPLEX_UNKNOWN +#define DUPLEX_UNKNOWN 0xff +#endif + +#ifndef SUPPORTED_Pause +#define SUPPORTED_Pause (1 << 13) +#endif + +#ifndef SUPPORTED_Asym_Pause +#define SUPPORTED_Asym_Pause (1 << 14) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) +#ifdef CONFIG_NET_POLL_CONTROLLER +#define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8169_netpoll +#else +#define RTL_NET_POLL_CONTROLLER +#endif + +#ifdef CONFIG_R8169_VLAN +#define RTL_SET_VLAN dev->vlan_rx_register=rtl8169_vlan_rx_register +#else +#define RTL_SET_VLAN +#endif + +#define RTL_NET_DEVICE_OPS(ops) dev->open=rtl8169_open; \ + dev->hard_start_xmit=rtl8169_start_xmit; \ + dev->get_stats=rtl8169_get_stats; \ + dev->stop=rtl8169_close; \ + dev->tx_timeout=rtl8169_tx_timeout; \ + dev->set_multicast_list=rtl8169_set_rx_mode; \ + dev->change_mtu=rtl8169_change_mtu; \ + dev->set_mac_address=rtl8169_set_mac_address; \ + dev->do_ioctl=rtl8169_ioctl; \ + RTL_NET_POLL_CONTROLLER; \ + RTL_SET_VLAN; +#else +#define RTL_NET_DEVICE_OPS(ops) dev->netdev_ops=&ops +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef false +#define false 0 +#endif + +#ifndef true +#define true 1 +#endif + +#ifndef NET_IP_ALIGN +#define NET_IP_ALIGN 2 +#endif + +#define NODE_ADDRESS_SIZE 6 + +#define SHORT_PACKET_PADDING_BUF_SIZE 256 + +#define RTK_MAGIC_DEBUG_VALUE 0x0badbeef + +#ifdef CONFIG_R8169_NAPI +#define NAPI_SUFFIX "-NAPI" +#else +#define NAPI_SUFFIX "" +#endif + +#define RTL8169_VERSION "6.030.01" NAPI_SUFFIX +#define MODULENAME "r8169" +#define PFX MODULENAME ": " + +#define GPL_CLAIM "\ +r8169 Copyright (C) 2022 Realtek NIC software team \n \ +This program comes with ABSOLUTELY NO WARRANTY; for details, please see . \n \ +This is free software, and you are welcome to redistribute it under certain conditions; see . \n" + +#ifdef RTL8169_DEBUG +#define assert(expr) \ + if (!(expr)) { \ + printk( "Assertion failed! %s,%s,%s,line=%d\n", \ + #expr,__FILE__,__FUNCTION__,__LINE__); \ + } +#define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0) +#else +#define assert(expr) do {} while (0) +#define dprintk(fmt, args...) do {} while (0) +#endif /* RTL8169_DEBUG */ + +#define R8169_MSG_DEFAULT \ + (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) + +#ifdef CONFIG_R8169_NAPI +#define rtl8169_rx_skb netif_receive_skb +#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb +#define rtl8169_rx_quota(count, quota) min(count, quota) +#else +#define rtl8169_rx_skb netif_rx +#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx +#define rtl8169_rx_quota(count, quota) count +#endif + +/* MAC address length */ +#ifndef MAC_ADDR_LEN +#define MAC_ADDR_LEN 6 +#endif + +#ifndef MAC_PROTOCOL_LEN +#define MAC_PROTOCOL_LEN 2 +#endif + +#ifndef ETH_FCS_LEN +#define ETH_FCS_LEN 4 +#endif + +#ifndef NETIF_F_TSO6 +#define NETIF_F_TSO6 0 +#endif + +#define Reserved2_data 7 +#define RX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */ +#define TX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */ +#define Reserved1_data 0x3F +#define RxPacketMaxSize 0x3FE8 /* 16K - 1 - ETH_HLEN - VLAN - CRC... */ +#define Jumbo_Frame_7k (7*1024 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) + +#define IFG0 (1 << 24) +#define IFG1 (1 << 25) +#define IFG2 (1 << 19) + +#define R8169_REGS_SIZE (256) +#define R8169_MAC_REGS_SIZE (256) +#define R8169_PHY_REGS_SIZE (16*2) +#define R8169_REGS_DUMP_SIZE (0x200) +#define R8169_NAPI_WEIGHT 64 +#define NUM_TX_DESC 256 /* Number of Tx descriptor registers */ +#define NUM_RX_DESC 256 /* Number of Rx descriptor registers */ +#define RX_BUF_SIZE 1536 /* Rx Buffer size */ +#define R8169_TX_RING_BYTES (NUM_TX_DESC * sizeof(struct TxDesc)) +#define R8169_RX_RING_BYTES (NUM_RX_DESC * sizeof(struct RxDesc)) + +#define RTL8169_TX_TIMEOUT (6*HZ) +#define RTL8169_PHY_TIMEOUT (10*HZ) +#define RTL8169_ESD_TIMEOUT (2*HZ) + +/* write/read MMIO register */ +#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) +#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) +#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg)) +#define RTL_R8(reg) readb (ioaddr + (reg)) +#define RTL_R16(reg) readw (ioaddr + (reg)) +#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) + +#ifndef DMA_64BIT_MASK +#define DMA_64BIT_MASK 0xffffffffffffffffULL +#endif + +#ifndef DMA_32BIT_MASK +#define DMA_32BIT_MASK 0x00000000ffffffffULL +#endif + +#ifndef NETDEV_TX_OK +#define NETDEV_TX_OK 0 /* driver took care of packet */ +#endif + +#ifndef NETDEV_TX_BUSY +#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ +#endif + +#ifndef NETDEV_TX_LOCKED +#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ +#endif + +#ifndef ADVERTISED_Pause +#define ADVERTISED_Pause (1 << 13) +#endif + +#ifndef ADVERTISED_Asym_Pause +#define ADVERTISED_Asym_Pause (1 << 14) +#endif + +#ifndef ADVERTISE_PAUSE_CAP +#define ADVERTISE_PAUSE_CAP 0x400 +#endif + +#ifndef ADVERTISE_PAUSE_ASYM +#define ADVERTISE_PAUSE_ASYM 0x800 +#endif + +#ifndef MII_CTRL1000 +#define MII_CTRL1000 0x09 +#endif + +#ifndef ADVERTISE_1000FULL +#define ADVERTISE_1000FULL 0x200 +#endif + +#ifndef ADVERTISE_1000HALF +#define ADVERTISE_1000HALF 0x100 +#endif + +#ifndef ETH_MIN_MTU +#define ETH_MIN_MTU 68 +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) +#ifdef __CHECKER__ +#define __iomem __attribute__((noderef, address_space(2))) +extern void __chk_io_ptr(void __iomem *); +#define __bitwise __attribute__((bitwise)) +#else +#define __iomem +#define __chk_io_ptr(x) (void)0 +#define __bitwise +#endif +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) + +#ifndef module_param +#define module_param(v,t,p) MODULE_PARM(v, "i"); +#endif + +#ifndef PCI_DEVICE +#define PCI_DEVICE(vend,dev) \ + .vendor = (vend), .device = (dev), \ + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID +#endif + +/*****************************************************************************/ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#define RTLDEV tp +#else +#define RTLDEV dev +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +/*****************************************************************************/ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +typedef struct net_device *napi_ptr; +typedef int *napi_budget; + +#define napi dev +#define RTL_NAPI_CONFIG(ndev, priv, function, weig) ndev->poll=function; \ + ndev->weight=weig; +#define RTL_NAPI_QUOTA(budget, ndev) min(*budget, ndev->quota) +#define RTL_GET_PRIV(stuct_ptr, priv_struct) netdev_priv(stuct_ptr) +#define RTL_GET_NETDEV(priv_ptr) +#define RTL_RX_QUOTA(budget) *budget +#define RTL_NAPI_QUOTA_UPDATE(ndev, work_done, budget) *budget -= work_done; \ + ndev->quota -= work_done; +#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) netif_rx_complete(dev) +#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) netif_rx_schedule_prep(dev) +#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __netif_rx_schedule(dev) +#define RTL_NAPI_RETURN_VALUE work_done >= work_to_do +#define RTL_NAPI_ENABLE(dev, napi) netif_poll_enable(dev) +#define RTL_NAPI_DISABLE(dev, napi) netif_poll_disable(dev) +#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) +#else +typedef struct napi_struct *napi_ptr; +typedef int napi_budget; + +#define RTL_NAPI_CONFIG(ndev, priv, function, weight) netif_napi_add(ndev, &priv->napi, function, weight) +#define RTL_NAPI_QUOTA(budget, ndev) min(budget, budget) +#define RTL_GET_PRIV(stuct_ptr, priv_struct) container_of(stuct_ptr, priv_struct, stuct_ptr) +#define RTL_GET_NETDEV(priv_ptr) struct net_device *dev = priv_ptr->dev; +#define RTL_RX_QUOTA(budget) budget +#define RTL_NAPI_QUOTA_UPDATE(ndev, work_done, budget) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) +#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) netif_rx_complete(dev, napi) +#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) netif_rx_schedule_prep(dev, napi) +#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __netif_rx_schedule(dev, napi) +#endif +#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,29) +#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) netif_rx_complete(napi) +#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) netif_rx_schedule_prep(napi) +#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __netif_rx_schedule(napi) +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) +#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) napi_complete_done(napi, work_done) +#else +#define RTL_NETIF_RX_COMPLETE(dev, napi, work_done) napi_complete(napi) +#endif +#define RTL_NETIF_RX_SCHEDULE_PREP(dev, napi) napi_schedule_prep(napi) +#define __RTL_NETIF_RX_SCHEDULE(dev, napi) __napi_schedule(napi) +#endif +#define RTL_NAPI_RETURN_VALUE work_done +#define RTL_NAPI_ENABLE(dev, napi) napi_enable(napi) +#define RTL_NAPI_DISABLE(dev, napi) napi_disable(napi) +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +#define RTL_NAPI_DEL(priv) +#else +#define RTL_NAPI_DEL(priv) netif_napi_del(&priv->napi) +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + +/*****************************************************************************/ + +/* 2.4.22 => 2.4.17 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) ) +#define pci_name(x) ((x)->slot_name) +#endif /* 2.4.22 => 2.4.17 */ + +/*****************************************************************************/ +/* 2.6.5 => 2.6.0 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) ) +#define pci_dma_sync_single_for_cpu pci_dma_sync_single +#define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu +#endif /* 2.6.5 => 2.6.0 */ + +/*****************************************************************************/ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) +#ifdef module_param_array_named +#undef module_param_array_named +#define module_param_array_named(name, array, type, nump, perm) \ + static struct kparam_array __param_arr_##name \ + = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type, \ + sizeof(array[0]), array }; \ + module_param_call(name, param_array_set, param_array_get, \ + &__param_arr_##name, perm) +#endif /* module_param_array_named */ +#endif /* < 2.6.10 */ + +/*****************************************************************************/ +/* 2.6.0 => 2.5.28 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ) +#define MODULE_INFO(version, _version) +#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT +#define CONFIG_E1000_DISABLE_PACKET_SPLIT 1 +#endif + +#define pci_set_consistent_dma_mask(dev,mask) 1 + +#undef dev_put +#define dev_put(dev) __dev_put(dev) + +#ifndef skb_fill_page_desc +#define skb_fill_page_desc _kc_skb_fill_page_desc +extern void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size); +#endif + +#ifndef pci_dma_mapping_error +#define pci_dma_mapping_error _kc_pci_dma_mapping_error +static inline int _kc_pci_dma_mapping_error(dma_addr_t dma_addr) +{ + return dma_addr == 0; +} +#endif + +#undef ALIGN +#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) + +#endif /* 2.6.0 => 2.5.28 */ + +/*****************************************************************************/ + +/* 2.6.4 => 2.6.0 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) +#define MODULE_VERSION(_version) MODULE_INFO(version, _version) +#endif /* 2.6.4 => 2.6.0 */ + +/*****************************************************************************/ +/* 2.5.28 => 2.4.23 */ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) ) + +static inline void _kc_synchronize_irq(void) +{ + synchronize_irq(); +} +#undef synchronize_irq +#define synchronize_irq(X) _kc_synchronize_irq() + +#include +#define work_struct tq_struct +#undef INIT_WORK +#define INIT_WORK(a,b,c) INIT_TQUEUE(a,(void (*)(void *))b,c) +#undef container_of +#define container_of list_entry +#define schedule_work schedule_task +#define flush_scheduled_work flush_scheduled_tasks +#endif /* 2.5.28 => 2.4.17 */ + +/*****************************************************************************/ +/* 2.6.4 => 2.6.0 */ +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25) && \ + LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4))) +#define ETHTOOL_OPS_COMPAT +#endif /* 2.6.4 => 2.6.0 */ + +/*****************************************************************************/ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +/* + * initialize a work-struct's func and data pointers: + */ +#define PREPARE_WORK(_work, _func, _data) \ + do { \ + (_work)->func = _func; \ + (_work)->data = _data; \ + } while (0) + +#endif +/*****************************************************************************/ + +#if 0//LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +#undef ethtool_ops +#define ethtool_ops _kc_ethtool_ops + +struct _kc_ethtool_ops { + int (*get_settings)(struct net_device *, struct ethtool_cmd *); + int (*set_settings)(struct net_device *, struct ethtool_cmd *); + void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); + int (*get_regs_len)(struct net_device *); + void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); + void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); + int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); + u32 (*get_msglevel)(struct net_device *); + void (*set_msglevel)(struct net_device *, u32); + int (*nway_reset)(struct net_device *); + u32 (*get_link)(struct net_device *); + int (*get_eeprom_len)(struct net_device *); + int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); + int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); + void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); + int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); + void (*get_pauseparam)(struct net_device *, + struct ethtool_pauseparam*); + int (*set_pauseparam)(struct net_device *, + struct ethtool_pauseparam*); + u32 (*get_rx_csum)(struct net_device *); + int (*set_rx_csum)(struct net_device *, u32); + u32 (*get_tx_csum)(struct net_device *); + int (*set_tx_csum)(struct net_device *, u32); + u32 (*get_sg)(struct net_device *); + int (*set_sg)(struct net_device *, u32); + u32 (*get_tso)(struct net_device *); + int (*set_tso)(struct net_device *, u32); + int (*self_test_count)(struct net_device *); + void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); + void (*get_strings)(struct net_device *, u32 stringset, u8 *); + int (*phys_id)(struct net_device *, u32); + int (*get_stats_count)(struct net_device *); + void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, + u64 *); +} *ethtool_ops = NULL; + +#undef SET_ETHTOOL_OPS +#define SET_ETHTOOL_OPS(netdev, ops) (ethtool_ops = (ops)) + +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) +#ifndef SET_ETHTOOL_OPS +#define SET_ETHTOOL_OPS(netdev,ops) \ + ( (netdev)->ethtool_ops = (ops) ) +#endif //SET_ETHTOOL_OPS +#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) + +/*****************************************************************************/ +/* Installations with ethtool version without eeprom, adapter id, or statistics + * support */ + +#ifndef ETH_GSTRING_LEN +#define ETH_GSTRING_LEN 32 +#endif + +#ifndef ETHTOOL_GSTATS +#define ETHTOOL_GSTATS 0x1d +#undef ethtool_drvinfo +#define ethtool_drvinfo k_ethtool_drvinfo +struct k_ethtool_drvinfo { + u32 cmd; + char driver[32]; + char version[32]; + char fw_version[32]; + char bus_info[32]; + char reserved1[32]; + char reserved2[16]; + u32 n_stats; + u32 testinfo_len; + u32 eedump_len; + u32 regdump_len; +}; + +struct ethtool_stats { + u32 cmd; + u32 n_stats; + u64 data[0]; +}; +#endif /* ETHTOOL_GSTATS */ + +#ifndef ETHTOOL_PHYS_ID +#define ETHTOOL_PHYS_ID 0x1c +#endif /* ETHTOOL_PHYS_ID */ + +#ifndef ETHTOOL_GSTRINGS +#define ETHTOOL_GSTRINGS 0x1b +enum ethtool_stringset { + ETH_SS_TEST = 0, + ETH_SS_STATS, +}; +struct ethtool_gstrings { + u32 cmd; /* ETHTOOL_GSTRINGS */ + u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ + u32 len; /* number of strings in the string set */ + u8 data[0]; +}; +#endif /* ETHTOOL_GSTRINGS */ + +#ifndef ETHTOOL_TEST +#define ETHTOOL_TEST 0x1a +enum ethtool_test_flags { + ETH_TEST_FL_OFFLINE = (1 << 0), + ETH_TEST_FL_FAILED = (1 << 1), +}; +struct ethtool_test { + u32 cmd; + u32 flags; + u32 reserved; + u32 len; + u64 data[0]; +}; +#endif /* ETHTOOL_TEST */ + +#ifndef ETHTOOL_GEEPROM +#define ETHTOOL_GEEPROM 0xb +#undef ETHTOOL_GREGS +struct ethtool_eeprom { + u32 cmd; + u32 magic; + u32 offset; + u32 len; + u8 data[0]; +}; + +struct ethtool_value { + u32 cmd; + u32 data; +}; +#endif /* ETHTOOL_GEEPROM */ + +#ifndef ETHTOOL_GLINK +#define ETHTOOL_GLINK 0xa +#endif /* ETHTOOL_GLINK */ + +#ifndef ETHTOOL_GREGS +#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers */ +#define ethtool_regs _kc_ethtool_regs +/* for passing big chunks of data */ +struct _kc_ethtool_regs { + u32 cmd; + u32 version; /* driver-specific, indicates different chips/revs */ + u32 len; /* bytes */ + u8 data[0]; +}; +#endif /* ETHTOOL_GREGS */ + +#ifndef ETHTOOL_GMSGLVL +#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ +#endif +#ifndef ETHTOOL_SMSGLVL +#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */ +#endif +#ifndef ETHTOOL_NWAY_RST +#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv */ +#endif +#ifndef ETHTOOL_GLINK +#define ETHTOOL_GLINK 0x0000000a /* Get link status */ +#endif +#ifndef ETHTOOL_GEEPROM +#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ +#endif +#ifndef ETHTOOL_SEEPROM +#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data */ +#endif +#ifndef ETHTOOL_GCOALESCE +#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ +/* for configuring coalescing parameters of chip */ +#define ethtool_coalesce _kc_ethtool_coalesce +struct _kc_ethtool_coalesce { + u32 cmd; /* ETHTOOL_{G,S}COALESCE */ + + /* How many usecs to delay an RX interrupt after + * a packet arrives. If 0, only rx_max_coalesced_frames + * is used. + */ + u32 rx_coalesce_usecs; + + /* How many packets to delay an RX interrupt after + * a packet arrives. If 0, only rx_coalesce_usecs is + * used. It is illegal to set both usecs and max frames + * to zero as this would cause RX interrupts to never be + * generated. + */ + u32 rx_max_coalesced_frames; + + /* Same as above two parameters, except that these values + * apply while an IRQ is being serviced by the host. Not + * all cards support this feature and the values are ignored + * in that case. + */ + u32 rx_coalesce_usecs_irq; + u32 rx_max_coalesced_frames_irq; + + /* How many usecs to delay a TX interrupt after + * a packet is sent. If 0, only tx_max_coalesced_frames + * is used. + */ + u32 tx_coalesce_usecs; + + /* How many packets to delay a TX interrupt after + * a packet is sent. If 0, only tx_coalesce_usecs is + * used. It is illegal to set both usecs and max frames + * to zero as this would cause TX interrupts to never be + * generated. + */ + u32 tx_max_coalesced_frames; + + /* Same as above two parameters, except that these values + * apply while an IRQ is being serviced by the host. Not + * all cards support this feature and the values are ignored + * in that case. + */ + u32 tx_coalesce_usecs_irq; + u32 tx_max_coalesced_frames_irq; + + /* How many usecs to delay in-memory statistics + * block updates. Some drivers do not have an in-memory + * statistic block, and in such cases this value is ignored. + * This value must not be zero. + */ + u32 stats_block_coalesce_usecs; + + /* Adaptive RX/TX coalescing is an algorithm implemented by + * some drivers to improve latency under low packet rates and + * improve throughput under high packet rates. Some drivers + * only implement one of RX or TX adaptive coalescing. Anything + * not implemented by the driver causes these values to be + * silently ignored. + */ + u32 use_adaptive_rx_coalesce; + u32 use_adaptive_tx_coalesce; + + /* When the packet rate (measured in packets per second) + * is below pkt_rate_low, the {rx,tx}_*_low parameters are + * used. + */ + u32 pkt_rate_low; + u32 rx_coalesce_usecs_low; + u32 rx_max_coalesced_frames_low; + u32 tx_coalesce_usecs_low; + u32 tx_max_coalesced_frames_low; + + /* When the packet rate is below pkt_rate_high but above + * pkt_rate_low (both measured in packets per second) the + * normal {rx,tx}_* coalescing parameters are used. + */ + + /* When the packet rate is (measured in packets per second) + * is above pkt_rate_high, the {rx,tx}_*_high parameters are + * used. + */ + u32 pkt_rate_high; + u32 rx_coalesce_usecs_high; + u32 rx_max_coalesced_frames_high; + u32 tx_coalesce_usecs_high; + u32 tx_max_coalesced_frames_high; + + /* How often to do adaptive coalescing packet rate sampling, + * measured in seconds. Must not be zero. + */ + u32 rate_sample_interval; +}; +#endif /* ETHTOOL_GCOALESCE */ + +#ifndef ETHTOOL_SCOALESCE +#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ +#endif +#ifndef ETHTOOL_GRINGPARAM +#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ +/* for configuring RX/TX ring parameters */ +#define ethtool_ringparam _kc_ethtool_ringparam +struct _kc_ethtool_ringparam { + u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ + + /* Read only attributes. These indicate the maximum number + * of pending RX/TX ring entries the driver will allow the + * user to set. + */ + u32 rx_max_pending; + u32 rx_mini_max_pending; + u32 rx_jumbo_max_pending; + u32 tx_max_pending; + + /* Values changeable by the user. The valid values are + * in the range 1 to the "*_max_pending" counterpart above. + */ + u32 rx_pending; + u32 rx_mini_pending; + u32 rx_jumbo_pending; + u32 tx_pending; +}; +#endif /* ETHTOOL_GRINGPARAM */ + +#ifndef ETHTOOL_SRINGPARAM +#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */ +#endif +#ifndef ETHTOOL_GPAUSEPARAM +#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ +/* for configuring link flow control parameters */ +#define ethtool_pauseparam _kc_ethtool_pauseparam +struct _kc_ethtool_pauseparam { + u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ + + /* If the link is being auto-negotiated (via ethtool_cmd.autoneg + * being true) the user may set 'autonet' here non-zero to have the + * pause parameters be auto-negotiated too. In such a case, the + * {rx,tx}_pause values below determine what capabilities are + * advertised. + * + * If 'autoneg' is zero or the link is not being auto-negotiated, + * then {rx,tx}_pause force the driver to use/not-use pause + * flow control. + */ + u32 autoneg; + u32 rx_pause; + u32 tx_pause; +}; +#endif /* ETHTOOL_GPAUSEPARAM */ + +#ifndef ETHTOOL_SPAUSEPARAM +#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ +#endif +#ifndef ETHTOOL_GRXCSUM +#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ +#endif +#ifndef ETHTOOL_SRXCSUM +#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ +#endif +#ifndef ETHTOOL_GTXCSUM +#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ +#endif +#ifndef ETHTOOL_STXCSUM +#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ +#endif +#ifndef ETHTOOL_GSG +#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable +* (ethtool_value) */ +#endif +#ifndef ETHTOOL_SSG +#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable +* (ethtool_value). */ +#endif +#ifndef ETHTOOL_TEST +#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */ +#endif +#ifndef ETHTOOL_GSTRINGS +#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ +#endif +#ifndef ETHTOOL_PHYS_ID +#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ +#endif +#ifndef ETHTOOL_GSTATS +#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ +#endif +#ifndef ETHTOOL_GTSO +#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ +#endif +#ifndef ETHTOOL_STSO +#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ +#endif + +#ifndef ETHTOOL_BUSINFO_LEN +#define ETHTOOL_BUSINFO_LEN 32 +#endif + +/*****************************************************************************/ + +enum mcfg { + CFG_METHOD_1 = 0x00, + CFG_METHOD_2 = 0x01, + CFG_METHOD_3 = 0x02, + CFG_METHOD_4 = 0x04, + CFG_METHOD_5 = 0x05, + CFG_METHOD_6 = 0x06, +}; + +enum pcfg { + PCFG_METHOD_1 = 0x03, /* PHY Reg 0x03 bit0-3 == 0x0000 */ + PCFG_METHOD_2 = 0x04, /* PHY Reg 0x03 bit0-3 == 0x0000 */ + PCFG_METHOD_3 = 0x05, /* PHY Reg 0x03 bit0-3 == 0x0000 */ + PCFG_METHOD_4 = 0x06, /* PHY Reg 0x03 bit0-3 == 0x0001 */ + PCFG_METHOD_5 = 0x07, /* PHY Reg 0x03 bit0-3 == 0x0002 */ + PCFG_METHOD_6 = 0x08, /* PHY Reg 0x03 bit0-3 == 0x0003 */ +}; + +enum RTL8169_registers { + MAC0 = 0x00, /* Ethernet hardware address. */ + MAC4 = 0x04, + MAR0 = 0x08, /* Multicast filter. */ + CounterAddrLow = 0x10, + CounterAddrHigh = 0x14, + TxDescStartAddrLow = 0x20, + TxDescStartAddrHigh = 0x24, + TxHDescStartAddrLow = 0x28, + TxHDescStartAddrHigh = 0x2c, + FLASH = 0x30, + ERSR = 0x36, + ChipCmd = 0x37, + TxPoll = 0x38, + IntrMask = 0x3C, + IntrStatus = 0x3E, + TxConfig = 0x40, + RxConfig = 0x44, + RxMissed = 0x4C, + Cfg9346 = 0x50, + Config0 = 0x51, + Config1 = 0x52, + Config2 = 0x53, + Config3 = 0x54, + Config4 = 0x55, + Config5 = 0x56, + TimeInt0 = 0x58, + MultiIntr = 0x5C, + PHYAR = 0x60, + PHYstatus = 0x6C, + Offset_7Ch = 0x7C, + RxMaxSize = 0xDA, + CPlusCmd = 0xE0, + IntrMitigate = 0xE2, + RxDescAddrLow = 0xE4, + RxDescAddrHigh = 0xE8, + Reserved1 = 0xEC, + FuncEvent = 0xF0, + FuncEventMask = 0xF4, + FuncPresetState = 0xF8, + FuncForceEvent = 0xFC, +}; + +enum RTL8169_register_content { + /* InterruptStatusBits */ + SYSErr = 0x8000, + PCSTimeout = 0x4000, + SWInt = 0x0100, + TxDescUnavail = 0x80, + RxFIFOOver = 0x40, + LinkChg = 0x20, + RxOverflow = 0x10, + TxErr = 0x08, + TxOK = 0x04, + RxErr = 0x02, + RxOK = 0x01, + + /* RxStatusDesc */ + RxRWT = (1 << 22), + RxRES = (1 << 21), + RxRUNT = (1 << 20), + RxCRC = (1 << 19), + + /* ChipCmdBits */ + CmdReset = 0x10, + CmdRxEnb = 0x08, + CmdTxEnb = 0x04, + RxBufEmpty = 0x01, + + /* Cfg9346Bits */ + Cfg9346_Lock = 0x00, + Cfg9346_Unlock = 0xC0, + + /* rx_mode_bits */ + AcceptErr = 0x20, + AcceptRunt = 0x10, + AcceptBroadcast = 0x08, + AcceptMulticast = 0x04, + AcceptMyPhys = 0x02, + AcceptAllPhys = 0x01, + + /* Transmit Priority Polling*/ + HPQ = 0x80, + NPQ = 0x40, + FSWInt = 0x01, + + /* RxConfigBits */ + Reserved2_shift = 13, + RxCfgDMAShift = 8, + + /* TxConfigBits */ + TxInterFrameGapShift = 24, + TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */ + TxMACLoopBack = (1 << 17), /* MAC loopback */ + + /* Config1 register p.24 */ + PMEnable = (1 << 0), /* Power Management Enable */ + VPDEnable = (1 << 1), /* RTL8169 VPD eanble */ + + /* Config2 register p.26 */ + PCI_Clock_66MHz = 0x01, + PCI_Clock_33MHz = 0x00, + + /* Config3 register p.25 */ + MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ + LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ + + /* Config4 register */ + iMode = (1 << 0), /* Improve IP/TCP checksum compatibility with some NIC cards for RTL8169SB */ + + /* Config5 register p.27 */ + BWF = (1 << 6), /* Accept Broadcast wakeup frame */ + MWF = (1 << 5), /* Accept Multicast wakeup frame */ + UWF = (1 << 4), /* Accept Unicast wakeup frame */ + LanWake = (1 << 1), /* LanWake enable/disable */ + PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ + + /* CPlusCmd p.31 */ + EnAnaPLL = (1 << 14), + RxVlan = (1 << 6), + RxChkSum = (1 << 5), + PCIDAC = (1 << 4), + PCIMulRW = (1 << 3), + + /* rtl8169_PHYstatus */ + TxFlowCtrl = 0x40, + RxFlowCtrl = 0x20, + _1000bpsF = 0x10, + _100bps = 0x08, + _10bps = 0x04, + LinkStatus = 0x02, + FullDup = 0x01, + + /* DumpCounterCommand */ + CounterDump = 0x8, + + /* PHY access */ + PHYAR_Flag = 0x80000000, + PHYAR_Write = 0x80000000, + PHYAR_Read = 0x00000000, + PHYAR_Reg_Mask = 0x1f, + PHYAR_Reg_shift = 16, + PHYAR_Data_Mask = 0xffff, +}; + +enum _DescStatusBit { + DescOwn = (1 << 31), /* Descriptor is owned by NIC */ + RingEnd = (1 << 30), /* End of descriptor ring */ + FirstFrag = (1 << 29), /* First segment of a packet */ + LastFrag = (1 << 28), /* Final segment of a packet */ + + /* Tx private */ + LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ + MSSShift = 16, /* MSS value position */ + MSSMask = 0x7FFU, /* MSS value 11 bits */ + IPCS = (1 << 18), /* Calculate IP checksum */ + UDPCS = (1 << 17), /* Calculate UDP/IP checksum */ + TCPCS = (1 << 16), /* Calculate TCP/IP checksum */ + TxVlanTag = (1 << 17), /* Add VLAN tag */ + + /* Rx private */ + PID1 = (1 << 18), /* Protocol ID bit 1/2 */ + PID0 = (1 << 17), /* Protocol ID bit 2/2 */ + +#define RxProtoUDP (PID1) +#define RxProtoTCP (PID0) +#define RxProtoIP (PID1 | PID0) +#define RxProtoMask RxProtoIP + + IPFail = (1 << 16), /* IP checksum failed */ + UDPFail = (1 << 15), /* UDP/IP checksum failed */ + TCPFail = (1 << 14), /* TCP/IP checksum failed */ + RxVlanTag = (1 << 16), /* VLAN tag available */ +}; + +enum bits { + BIT_0 = (1 << 0), + BIT_1 = (1 << 1), + BIT_2 = (1 << 2), + BIT_3 = (1 << 3), + BIT_4 = (1 << 4), + BIT_5 = (1 << 5), + BIT_6 = (1 << 6), + BIT_7 = (1 << 7), + BIT_8 = (1 << 8), + BIT_9 = (1 << 9), + BIT_10 = (1 << 10), + BIT_11 = (1 << 11), + BIT_12 = (1 << 12), + BIT_13 = (1 << 13), + BIT_14 = (1 << 14), + BIT_15 = (1 << 15), + BIT_16 = (1 << 16), + BIT_17 = (1 << 17), + BIT_18 = (1 << 18), + BIT_19 = (1 << 19), + BIT_20 = (1 << 20), + BIT_21 = (1 << 21), + BIT_22 = (1 << 22), + BIT_23 = (1 << 23), + BIT_24 = (1 << 24), + BIT_25 = (1 << 25), + BIT_26 = (1 << 26), + BIT_27 = (1 << 27), + BIT_28 = (1 << 28), + BIT_29 = (1 << 29), + BIT_30 = (1 << 30), + BIT_31 = (1 << 31) +}; + +#define RsvdMask 0x3fffc000 + +struct TxDesc { + u32 opts1; + u32 opts2; + u64 addr; +}; + +struct RxDesc { + u32 opts1; + u32 opts2; + u64 addr; +}; + +struct ring_info { + struct sk_buff *skb; + u32 len; + u8 __pad[sizeof(void *) - sizeof(u32)]; +}; + +enum wol_capability { + WOL_DISABLED = 0, + WOL_ENABLED = 1 +}; + +struct pci_resource { + u8 cmd; + u8 cls; + u16 io_base_h; + u16 io_base_l; + u16 mem_base_h; + u16 mem_base_l; + u8 ilr; + u16 resv_0x20_h; + u16 resv_0x20_l; + u16 resv_0x24_h; + u16 resv_0x24_l; +}; + +/* Flow Control Settings */ +enum rtl8169_fc_mode { + rtl8169_fc_none = 0, + rtl8169_fc_rx_pause, + rtl8169_fc_tx_pause, + rtl8169_fc_full, + rtl8169_fc_default +}; + +struct rtl8169_private { + void __iomem *mmio_addr; /* memory map physical address */ + struct pci_dev *pci_dev; /* Index of PCI device */ + struct net_device *dev; +#ifdef CONFIG_R8169_NAPI +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) + struct napi_struct napi; +#endif +#endif + struct net_device_stats stats; /* statistics of net device */ + spinlock_t lock; /* spin lock flag */ + u32 msg_enable; + int max_jumbo_frame_size; + int chipset; + int mcfg; + int pcfg; + u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ + u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ + u32 dirty_rx; + u32 dirty_tx; + struct TxDesc *TxDescArray; /* 256-aligned Tx descriptor ring */ + struct RxDesc *RxDescArray; /* 256-aligned Rx descriptor ring */ + dma_addr_t TxPhyAddr; + dma_addr_t RxPhyAddr; + struct sk_buff *Rx_skbuff[NUM_RX_DESC]; /* Rx data buffers */ + struct ring_info tx_skb[NUM_TX_DESC]; /* Tx data buffers */ + unsigned align; + unsigned rx_buf_sz; + struct timer_list link_timer; + struct timer_list esd_timer; + struct pci_resource pci_cfg_space; + unsigned int esd_flag; + unsigned int pci_cfg_is_read; + u16 cp_cmd; + u16 intr_mask; + int phy_auto_nego_reg; + int phy_1000_ctrl_reg; + u8 org_mac_addr[NODE_ADDRESS_SIZE]; + +#ifdef CONFIG_R8169_VLAN + struct vlan_group *vlgrp; +#endif + u8 autoneg; + u8 duplex; + u32 speed; + u32 advertising; + enum rtl8169_fc_mode fcpause; + + int (*set_speed)(struct net_device *, u8 autoneg, u32 speed, u8 duplex, u32 adv); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + void (*get_settings)(struct net_device *, struct ethtool_cmd *); +#else + void (*get_settings)(struct net_device *, struct ethtool_link_ksettings *); +#endif + void (*phy_reset_enable)(struct net_device *); + unsigned int (*phy_reset_pending)(struct net_device *); + unsigned int (*link_ok)(struct net_device *); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + struct work_struct task; +#else + struct delayed_work task; +#endif + unsigned wol_enabled; + unsigned features; + + u8 UseSwPaddingShortPkt; + + u8 random_mac; +}; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +#define netdev_mc_count(dev) ((dev)->mc_count) +#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) +#endif + +#define LSO_32K 32000 +#define LSO_64K 64000 + +#define NIC_MIN_PHYS_BUF_COUNT (2) +#define NIC_MAX_PHYS_BUF_COUNT_LSO_64K (24) +#define NIC_MAX_PHYS_BUF_COUNT_LSO2 (16*4) + +#define MSS_MAX 0x07ffu /* MSS value */ diff --git a/linux/r8169-6.030.01/src/r8169_n.c b/linux/r8169-6.030.01/src/r8169_n.c new file mode 100755 index 0000000..6e9f758 --- /dev/null +++ b/linux/r8169-6.030.01/src/r8169_n.c @@ -0,0 +1,4975 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +################################################################################ +# +# r8169 is the Linux device driver released for Realtek Gigabit Ethernet +# Controllers with PCI interface. +# +# Copyright(c) 2022 Realtek Semiconductor Corp. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Author: +# Realtek NIC software team +# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan +# +################################################################################ +*/ + +/************************************************************************************ + * This product is covered by one or more of the following patents: + * US6,570,884, US6,115,776, and US6,327,625. + ***********************************************************************************/ + +/* + * This driver is modified from r8169.c in Linux kernel 2.6.18 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) +#include +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) +#include +#include +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + +#include +#include +#include + +#include "r8169.h" + +/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). + The RTL chips use a 64 element hash table based on the Ethernet CRC. */ +static const int multicast_filter_limit = 32; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) +#ifdef __CHECKER__ +#define __force __attribute__((force)) +#else +#define __force +#endif +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) + +#define _R(NAME,MAC,MASK) \ + { .name = NAME, .mcfg = MAC, .RxConfigMask = MASK } + +static const struct { + const char *name; + u8 mcfg; + u32 RxConfigMask; /* Clears the bits supported by this chip */ +} rtl_chip_info[] = { + _R("RTL8169", CFG_METHOD_1, 0xff7e1880), + _R("RTL8169S/8110S", CFG_METHOD_2, 0xff7e1880), + _R("RTL8169S/8110S", CFG_METHOD_3, 0xff7e1880), + _R("RTL8169SB/8110SB", CFG_METHOD_4, 0xff7e1880), + _R("RTL8169SC/8110SC", CFG_METHOD_5, 0xff7e1880), + _R("RTL8169SC/8110SC", CFG_METHOD_6, 0xff7e1880), +}; +#undef _R + +enum cfg_version { + RTL_CFG_0 = 0x00, + RTL_CFG_1, + RTL_CFG_2 +}; + +static const struct { + unsigned int region; + unsigned int align; +} rtl_cfg_info[] = { + [RTL_CFG_0] = { 1, 8 }, + [RTL_CFG_1] = { 2, 8 }, + [RTL_CFG_2] = { 2, 8 } +}; + +static struct pci_device_id rtl8169_pci_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, + { PCI_VENDOR_ID_DLINK, 0x4300, PCI_VENDOR_ID_DLINK, 0x4300, 0, 0, RTL_CFG_0 }, + { PCI_VENDOR_ID_DLINK, 0x4302, PCI_VENDOR_ID_DLINK, 0x4302, 0, 0, RTL_CFG_0 }, + { PCI_VENDOR_ID_DLINK, 0x4300, PCI_VENDOR_ID_DLINK, 0x4c00, 0, 0, RTL_CFG_0 }, + {0,}, +}; + +MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); + +static int rx_copybreak = 0; +static int use_dac; +#ifdef ENABLE_S5_KEEP_CURR_MAC +static int s5_keep_curr_mac = 1; +#else +static int s5_keep_curr_mac = 0; +#endif +static struct { + u32 msg_enable; +} debug = { -1 }; + +static unsigned int speed_mode = SPEED_1000; +static unsigned int duplex_mode = DUPLEX_FULL; +static unsigned int autoneg_mode = AUTONEG_ENABLE; +static unsigned int advertising_mode = ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | + ADVERTISED_100baseT_Full | + ADVERTISED_1000baseT_Half | + ADVERTISED_1000baseT_Full; + +module_param(speed_mode, uint, 0); +MODULE_PARM_DESC(speed_mode, "force phy operation. Deprecated by ethtool (8)."); + +module_param(duplex_mode, uint, 0); +MODULE_PARM_DESC(duplex_mode, "force phy operation. Deprecated by ethtool (8)."); + +module_param(autoneg_mode, uint, 0); +MODULE_PARM_DESC(autoneg_mode, "force phy operation. Deprecated by ethtool (8)."); + +module_param(advertising_mode, uint, 0); +MODULE_PARM_DESC(advertising_mode, "force phy operation. Deprecated by ethtool (8)."); + +module_param(rx_copybreak, int, 0); +MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); + +module_param(use_dac, int, 0); +MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); + +module_param(s5_keep_curr_mac, int, 0); +MODULE_PARM_DESC(s5_keep_curr_mac, "Enable Shutdown Keep Current MAC Address."); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) +module_param_named(debug, debug.msg_enable, int, 0); +MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); +#endif//LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + +MODULE_LICENSE("GPL"); + +#ifndef MODULE_VERSION +#define MODULE_VERSION(_version) MODULE_INFO(version, _version) +#endif +MODULE_VERSION(RTL8169_VERSION); + +static void rtl8169_set_tx_config(struct net_device *dev); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +static void rtl8169_esd_timer(unsigned long __opaque); +#else +static void rtl8169_esd_timer(struct timer_list *t); +#endif +static void rtl8169_tx_clear(struct rtl8169_private *tp); +static void rtl8169_rx_clear(struct rtl8169_private *tp); +static void rtl8169_init_ring_indexes(struct rtl8169_private *tp); + +static int rtl8169_open(struct net_device *dev); +static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +#else +static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance); +#endif +static int rtl8169_init_ring(struct net_device *dev); +static void rtl8169_hw_start(struct net_device *dev); +static int rtl8169_close(struct net_device *dev); +static void rtl8169_set_rx_mode(struct net_device *dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) +static void rtl8169_tx_timeout(struct net_device *dev, unsigned int txqueue); +#else +static void rtl8169_tx_timeout(struct net_device *dev); +#endif +static struct net_device_stats *rtl8169_get_stats(struct net_device *dev); +static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *, void __iomem *, napi_budget); +static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); +static void rtl8169_down(struct net_device *dev); +static int rtl8169_set_mac_address(struct net_device *dev, void *p); +void rtl8169_rar_set(struct rtl8169_private *tp, const u8 *addr); + +static void rtl8169_phy_power_up(struct net_device *dev); +static void rtl8169_phy_power_down(struct net_device *dev); + +static void rtl8169_hw_reset(struct net_device *dev); + +#ifdef CONFIG_R8169_NAPI +static int rtl8169_poll(napi_ptr napi, napi_budget budget); +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8169_reset_task(void *_data); +#else +static void rtl8169_reset_task(struct work_struct *work); +#endif + +static const u16 rtl8169_intr_mask = + SYSErr | LinkChg | RxOverflow | RxFIFOOver | TxErr | TxOK | RxErr | RxOK; +static const u16 rtl8169_napi_event = + RxOK | RxOverflow | RxFIFOOver | TxOK | TxErr; +static const unsigned int rtl8169_rx_config = + (Reserved2_data << Reserved2_shift) | (RX_DMA_BURST << RxCfgDMAShift); + +#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \ + (( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \ + ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) ))) +/* copied from linux kernel 2.6.20 include/linux/netdev.h */ +#define NETDEV_ALIGN 32 +#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) + +static inline void *netdev_priv(struct net_device *dev) +{ + return (char *)dev + ((sizeof(struct net_device) + + NETDEV_ALIGN_CONST) + & ~NETDEV_ALIGN_CONST); +} +#endif + +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,00))) +void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst, + u32 legacy_u32) +{ + bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS); + dst[0] = legacy_u32; +} + +bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, + const unsigned long *src) +{ + bool retval = true; + + /* TODO: following test will soon always be true */ + if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(ext); + + bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS); + bitmap_fill(ext, 32); + bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS); + if (bitmap_intersects(ext, src, + __ETHTOOL_LINK_MODE_MASK_NBITS)) { + /* src mask goes beyond bit 31 */ + retval = false; + } + } + *legacy_u32 = src[0]; + return retval; +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) + +#ifndef LPA_1000FULL +#define LPA_1000FULL 0x0800 +#endif + +#ifndef LPA_1000HALF +#define LPA_1000HALF 0x0400 +#endif + +static inline u32 mii_adv_to_ethtool_adv_t(u32 adv) +{ + u32 result = 0; + + if (adv & ADVERTISE_10HALF) + result |= ADVERTISED_10baseT_Half; + if (adv & ADVERTISE_10FULL) + result |= ADVERTISED_10baseT_Full; + if (adv & ADVERTISE_100HALF) + result |= ADVERTISED_100baseT_Half; + if (adv & ADVERTISE_100FULL) + result |= ADVERTISED_100baseT_Full; + if (adv & ADVERTISE_PAUSE_CAP) + result |= ADVERTISED_Pause; + if (adv & ADVERTISE_PAUSE_ASYM) + result |= ADVERTISED_Asym_Pause; + + return result; +} + +static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa) +{ + u32 result = 0; + + if (lpa & LPA_LPACK) + result |= ADVERTISED_Autoneg; + + return result | mii_adv_to_ethtool_adv_t(lpa); +} + +static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa) +{ + u32 result = 0; + + if (lpa & LPA_1000HALF) + result |= ADVERTISED_1000baseT_Half; + if (lpa & LPA_1000FULL) + result |= ADVERTISED_1000baseT_Full; + + return result; +} + +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) +static inline void eth_hw_addr_random(struct net_device *dev) +{ + random_ether_addr(dev->dev_addr); +} +#endif + +//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) +#ifndef netif_msg_init +#define netif_msg_init _kc_netif_msg_init +/* copied from linux kernel 2.6.20 include/linux/netdevice.h */ +static inline u32 _kc_netif_msg_init(int debug_value, int default_msg_enable_bits) +{ + /* use default */ + if (debug_value < 0 || debug_value >= (sizeof(u32) * 8)) + return default_msg_enable_bits; + if (debug_value == 0) /* no output */ + return 0; + /* set low N bits */ + return (1 << debug_value) - 1; +} + +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) +/* copied from linux kernel 2.6.20 /include/linux/time.h */ +/* Parameters used to convert the timespec values: */ +#define MSEC_PER_SEC 1000L + +/* copied from linux kernel 2.6.20 /include/linux/jiffies.h */ +/* + * Change timeval to jiffies, trying to avoid the + * most obvious overflows.. + * + * And some not so obvious. + * + * Note that we don't want to return MAX_LONG, because + * for various timeout reasons we often end up having + * to wait "jiffies+1" in order to guarantee that we wait + * at _least_ "jiffies" - so "jiffies+1" had better still + * be positive. + */ +#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1) + +/* + * Convert jiffies to milliseconds and back. + * + * Avoid unnecessary multiplications/divisions in the + * two most common HZ cases: + */ +static inline unsigned int _kc_jiffies_to_msecs(const unsigned long j) +{ +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) + return (MSEC_PER_SEC / HZ) * j; +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) + return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); +#else + return (j * MSEC_PER_SEC) / HZ; +#endif +} + +static inline unsigned long _kc_msecs_to_jiffies(const unsigned int m) +{ + if (m > _kc_jiffies_to_msecs(MAX_JIFFY_OFFSET)) + return MAX_JIFFY_OFFSET; +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) + return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) + return m * (HZ / MSEC_PER_SEC); +#else + return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC; +#endif +} +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) +//for linux kernel 2.6.10 and earlier. + +/* copied from linux kernel 2.6.12.6 /include/linux/pm.h */ +typedef int __bitwise pci_power_t; + +/* copied from linux kernel 2.6.12.6 /include/linux/pci.h */ +typedef u32 __bitwise pm_message_t; + +#define PCI_D0 ((pci_power_t __force) 0) +#define PCI_D1 ((pci_power_t __force) 1) +#define PCI_D2 ((pci_power_t __force) 2) +#define PCI_D3hot ((pci_power_t __force) 3) +#define PCI_D3cold ((pci_power_t __force) 4) +#define PCI_POWER_ERROR ((pci_power_t __force) -1) + +/* copied from linux kernel 2.6.12.6 /drivers/pci/pci.c */ +/** + * pci_choose_state - Choose the power state of a PCI device + * @dev: PCI device to be suspended + * @state: target sleep state for the whole system. This is the value + * that is passed to suspend() function. + * + * Returns PCI power state suitable for given device and given system + * message. + */ + +pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) +{ + if (!pci_find_capability(dev, PCI_CAP_ID_PM)) + return PCI_D0; + + switch (state) { + case 0: + return PCI_D0; + case 3: + return PCI_D3hot; + default: + printk("They asked me for state %d\n", state); +// BUG(); + } + return PCI_D0; +} +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) +//porting on 2.6.8.1 and earlier +/** + * msleep_interruptible - sleep waiting for waitqueue interruptions + * @msecs: Time in milliseconds to sleep for + */ +#define msleep_interruptible _kc_msleep_interruptible +unsigned long _kc_msleep_interruptible(unsigned int msecs) +{ + unsigned long timeout = _kc_msecs_to_jiffies(msecs); + + while (timeout && !signal_pending(current)) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return _kc_jiffies_to_msecs(timeout); +} +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) + +/*****************************************************************************/ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) ) +#define msleep(x) do { set_current_state(TASK_UNINTERRUPTIBLE); \ + schedule_timeout((x * HZ)/1000 + 2); \ + } while (0) +#endif +/*****************************************************************************/ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) +/* copied from linux kernel 2.6.20 include/linux/sched.h */ +#ifndef __sched +#define __sched __attribute__((__section__(".sched.text"))) +#endif + +/* copied from linux kernel 2.6.20 kernel/timer.c */ +signed long __sched schedule_timeout_uninterruptible(signed long timeout) +{ + __set_current_state(TASK_UNINTERRUPTIBLE); + return schedule_timeout(timeout); +} + +/* copied from linux kernel 2.6.20 include/linux/mii.h */ +#undef if_mii +#define if_mii _kc_if_mii +static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) +{ + return (struct mii_ioctl_data *) &rq->ifr_ifru; +} +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) +static inline void eth_copy_and_sum (struct sk_buff *dest, + const unsigned char *src, + int len, int base) +{ + memcpy (dest->data, src, len); +} +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) + +static void mdio_write(struct rtl8169_private *tp, int RegAddr, int value) +{ + void __iomem *ioaddr = tp->mmio_addr; + int i; + + RTL_W32(PHYAR, + PHYAR_Write | + (RegAddr & PHYAR_Reg_Mask) << PHYAR_Reg_shift | + (value & PHYAR_Data_Mask)); + + for (i = 0; i < 20; i++) { + /* Check if the RTL8169 has completed writing to the specified MII register */ + if (!(RTL_R32(PHYAR) & PHYAR_Flag)) + break; + udelay(100); + } + + udelay(20); +} + +static int mdio_read(struct rtl8169_private *tp, int RegAddr) +{ + void __iomem *ioaddr = tp->mmio_addr; + int i, value = -1; + + RTL_W32(PHYAR, PHYAR_Read | (RegAddr & PHYAR_Reg_Mask) << PHYAR_Reg_shift); + + for (i = 0; i < 20; i++) { + /* Check if the RTL8169 has completed retrieving data from the specified MII register */ + if (RTL_R32(PHYAR) & PHYAR_Flag) { + udelay(1); + value = (int) (RTL_R32(PHYAR) & PHYAR_Data_Mask); + break; + } + udelay(100); + + } + + udelay(20); + + return value; +} + +static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) +{ + RTL_W16(IntrMask, 0x0000); + + RTL_W16(IntrStatus, 0xffff); +} + +static unsigned int rtl8169_xmii_reset_pending(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned int retval; + + mdio_write(tp, 0x1f, 0x0000); + retval = mdio_read(tp, MII_BMCR) & BMCR_RESET; + + return retval; +} + +static unsigned int rtl8169_xmii_link_ok(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned int retval; + + mdio_write(tp, 0x1f, 0x0000); + retval = mdio_read(tp, MII_BMSR) & BMSR_LSTATUS; + + return retval; +} + +static void rtl8169_xmii_reset_enable(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + int i, val = 0; + + mdio_write(tp, 0x1f, 0x0000); + mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); + + for (i = 0; i < 2500; i++) { + val = mdio_read(tp, MII_BMCR) & BMCR_RESET; + + if (!val) { + return; + } + + mdelay(1); + } + + if (netif_msg_link(tp)) + printk(KERN_ERR "%s: PHY reset failed.\n", dev->name); +} + +static void rtl8169_check_link_status(struct net_device *dev, struct rtl8169_private *tp, void __iomem *ioaddr) +{ + u8 status; + + if (tp->link_ok(dev)) { + if (tp->mcfg == CFG_METHOD_4) { + status = RTL_R8(PHYstatus); + + if ((status & _10bps) && (RTL_R8(Config2) & PCI_Clock_66MHz)) { + RTL_W32(TxConfig, RTL_R32(TxConfig) & ~(TX_DMA_BURST << TxDMAShift)); + } + } else { + RTL_W32(TxConfig, RTL_R32(TxConfig) | (TX_DMA_BURST << TxDMAShift)); + } + + if (netif_msg_ifup(tp)) + printk(KERN_INFO PFX "%s: link up\n", dev->name); + + rtl8169_set_tx_config(dev); + + netif_carrier_on(dev); + + netif_wake_queue(dev); + } else { + if (netif_msg_ifdown(tp)) + printk(KERN_INFO PFX "%s: link down\n", dev->name); + + netif_stop_queue(dev); + + netif_carrier_off(dev); + } +} + +static void +rtl8169_link_option(u8 *aut, + u32 *spd, + u8 *dup, + u32 *adv) +{ + if ((*spd != SPEED_1000) && (*spd != SPEED_100) && (*spd != SPEED_10)) + *spd = SPEED_1000; + + if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) + *dup = DUPLEX_FULL; + + if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE)) + *aut = AUTONEG_ENABLE; + + *adv &= (ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | + ADVERTISED_100baseT_Full | + ADVERTISED_1000baseT_Half | + ADVERTISED_1000baseT_Full); + if (*adv == 0) + *adv = (ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | + ADVERTISED_100baseT_Full | + ADVERTISED_1000baseT_Half | + ADVERTISED_1000baseT_Full); +} + +static void +rtl8169_phy_setup_force_mode(struct net_device *dev, u32 speed, u8 duplex) +{ + struct rtl8169_private *tp = netdev_priv(dev); + u16 bmcr_true_force = 0; + + if ((speed == SPEED_10) && (duplex == DUPLEX_HALF)) { + bmcr_true_force = BMCR_SPEED10; + } else if ((speed == SPEED_10) && (duplex == DUPLEX_FULL)) { + bmcr_true_force = BMCR_SPEED10 | BMCR_FULLDPLX; + } else if ((speed == SPEED_100) && (duplex == DUPLEX_HALF)) { + bmcr_true_force = BMCR_SPEED100; + } else if ((speed == SPEED_100) && (duplex == DUPLEX_FULL)) { + bmcr_true_force = BMCR_SPEED100 | BMCR_FULLDPLX; + } else { + netif_err(tp, drv, dev, "Failed to set phy force mode!\n"); + return; + } + + mdio_write(tp, 0x1F, 0x0000); + mdio_write(tp, MII_BMCR, bmcr_true_force); +} + +static void +rtl8169_powerdown_pll(struct rtl8169_private *tp) +{ + struct net_device *dev = pci_get_drvdata(tp->pci_dev); + void __iomem *ioaddr = tp->mmio_addr; + + RTL_W16(RxMaxSize, RX_BUF_SIZE); + + if (tp->wol_enabled == WOL_ENABLED) { + int auto_nego; + int giga_ctrl; + u16 val; + + mdio_write(tp, 0x1F, 0x0000); + auto_nego = mdio_read(tp, MII_ADVERTISE); + auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL + | ADVERTISE_100HALF | ADVERTISE_100FULL); + + val = mdio_read(tp, MII_LPA); + + if (val & (LPA_10HALF | LPA_10FULL)) + auto_nego |= (ADVERTISE_10HALF | ADVERTISE_10FULL); + else + auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL); + + giga_ctrl = mdio_read(tp, MII_CTRL1000) & ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); + mdio_write(tp, MII_ADVERTISE, auto_nego); + mdio_write(tp, MII_CTRL1000, giga_ctrl); + mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE | BMCR_ANRESTART); + + return; + } + + rtl8169_phy_power_down(dev); +} + +static void rtl8169_powerup_pll(struct net_device *dev) +{ + rtl8169_phy_power_up(dev); +} + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +static void rtl8169_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + u8 options; + + wol->wolopts = 0; + +#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) + wol->supported = WAKE_ANY; + + spin_lock_irq(&tp->lock); + + options = RTL_R8(Config1); + if (!(options & PMEnable)) + goto out_unlock; + + options = RTL_R8(Config3); + if (options & LinkUp) + wol->wolopts |= WAKE_PHY; + if (options & MagicPacket) + wol->wolopts |= WAKE_MAGIC; + + options = RTL_R8(Config5); + if (options & UWF) + wol->wolopts |= WAKE_UCAST; + if (options & BWF) + wol->wolopts |= WAKE_BCAST; + if (options & MWF) + wol->wolopts |= WAKE_MCAST; + +out_unlock: + spin_unlock_irq(&tp->lock); +} + +static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + int i; + static struct { + u32 opt; + u16 reg; + u8 mask; + } cfg[] = { + { WAKE_ANY, Config1, PMEnable }, + { WAKE_PHY, Config3, LinkUp }, + { WAKE_MAGIC, Config3, MagicPacket }, + { WAKE_UCAST, Config5, UWF }, + { WAKE_BCAST, Config5, BWF }, + { WAKE_MCAST, Config5, MWF }, + { WAKE_ANY, Config5, LanWake } + }; + + spin_lock_irq(&tp->lock); + + RTL_W8(Cfg9346, Cfg9346_Unlock); + + for (i = 0; i < ARRAY_SIZE(cfg); i++) { + u8 options = RTL_R8(cfg[i].reg) & ~cfg[i].mask; + if (wol->wolopts & cfg[i].opt) + options |= cfg[i].mask; + RTL_W8(cfg[i].reg, options); + } + + RTL_W8(Cfg9346, Cfg9346_Lock); + + tp->wol_enabled = (wol->wolopts) ? WOL_ENABLED : WOL_DISABLED; + + spin_unlock_irq(&tp->lock); + + device_set_wakeup_enable(&tp->pci_dev->dev, tp->wol_enabled); + + return 0; +} + +static void rtl8169_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + strcpy(info->driver, MODULENAME); + strcpy(info->version, RTL8169_VERSION); + strcpy(info->bus_info, pci_name(tp->pci_dev)); + info->regdump_len = R8169_REGS_DUMP_SIZE; +} + +static int rtl8169_get_regs_len(struct net_device *dev) +{ + return R8169_REGS_DUMP_SIZE; +} + +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) + +static void rtl8169_set_tx_config(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + u32 tx_config; + u8 duplex; + + duplex = (RTL_R8(PHYstatus) & FullDup) ? DUPLEX_FULL : DUPLEX_HALF; + + tx_config = RTL_R32(TxConfig) | IFG0 | IFG1; + + if (((tp->mcfg == CFG_METHOD_5) | (tp->mcfg == CFG_METHOD_6)) && duplex == DUPLEX_HALF) + tx_config &= ~IFG0; + + RTL_W32(TxConfig, tx_config); +} + +static int rtl8169_set_speed_xmii(struct net_device *dev, + u8 autoneg, + u32 speed, + u8 duplex, + u32 adv) +{ + struct rtl8169_private *tp = netdev_priv(dev); + int auto_nego = 0; + int giga_ctrl = 0; + int rc = -EINVAL; + + if ((speed != SPEED_1000) && + (speed != SPEED_100) && + (speed != SPEED_10)) { + speed = SPEED_1000; + duplex = DUPLEX_FULL; + } + + if (autoneg == AUTONEG_ENABLE) { + /*n-way force*/ + auto_nego = mdio_read(tp, MII_ADVERTISE); + auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL | + ADVERTISE_100HALF | ADVERTISE_100FULL | + ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); + + if (adv & ADVERTISED_10baseT_Half) + auto_nego |= ADVERTISE_10HALF; + if (adv & ADVERTISED_10baseT_Full) + auto_nego |= ADVERTISE_10FULL; + if (adv & ADVERTISED_100baseT_Half) + auto_nego |= ADVERTISE_100HALF; + if (adv & ADVERTISED_100baseT_Full) + auto_nego |= ADVERTISE_100FULL; + if (adv & ADVERTISED_1000baseT_Half) + giga_ctrl |= ADVERTISE_1000HALF; + if (adv & ADVERTISED_1000baseT_Full) + giga_ctrl |= ADVERTISE_1000FULL; + + //flow control + if (tp->fcpause == rtl8169_fc_full) + auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; + + tp->phy_auto_nego_reg = auto_nego; + tp->phy_1000_ctrl_reg = giga_ctrl; + + tp->autoneg = autoneg; + tp->speed = speed; + tp->duplex = duplex; + + mdio_write(tp, 0x1f, 0x0000); + mdio_write(tp, MII_ADVERTISE, auto_nego); + mdio_write(tp, MII_CTRL1000, giga_ctrl); + mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); + } else { + /*true force*/ + if (speed == SPEED_10 || speed == SPEED_100) { + rtl8169_phy_setup_force_mode(dev, speed, duplex); + } else + goto out; + } + + if ((tp->mcfg == CFG_METHOD_2) || (tp->mcfg == CFG_METHOD_3)) { + if ((speed == SPEED_100) && (autoneg != AUTONEG_ENABLE)) { + mdio_write(tp, 0x17, 0x2138); + mdio_write(tp, 0x0e, 0x0260); + } else { + mdio_write(tp, 0x17, 0x2108); + mdio_write(tp, 0x0e, 0x0000); + } + } + + tp->autoneg = autoneg; + tp->speed = speed; + tp->duplex = duplex; + tp->advertising = adv; + + rc = 0; +out: + return rc; +} + +static int rtl8169_set_speed(struct net_device *dev, + u8 autoneg, + u32 speed, + u8 duplex, + u32 adv) +{ + struct rtl8169_private *tp = netdev_priv(dev); + int ret; + + ret = tp->set_speed(dev, autoneg, speed, duplex, adv); + + return ret; +} + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +static int rtl8169_set_settings(struct net_device *dev, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + struct ethtool_cmd *cmd +#else + const struct ethtool_link_ksettings *cmd +#endif + ) +{ + struct rtl8169_private *tp = netdev_priv(dev); + int ret; + unsigned long flags; + u8 autoneg; + u32 speed; + u8 duplex; + u32 supported, advertising; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + autoneg = cmd->autoneg; + speed = cmd->speed; + duplex = cmd->duplex; + supported = cmd->supported; + advertising = cmd->advertising; +#else + const struct ethtool_link_settings *base = &cmd->base; + autoneg = base->autoneg; + speed = base->speed; + duplex = base->duplex; + ethtool_convert_link_mode_to_legacy_u32(&supported, + cmd->link_modes.supported); + ethtool_convert_link_mode_to_legacy_u32(&advertising, + cmd->link_modes.advertising); +#endif + if (advertising & ~supported) + return -EINVAL; + + spin_lock_irqsave(&tp->lock, flags); + ret = rtl8169_set_speed(dev, autoneg, speed, duplex, advertising); + spin_unlock_irqrestore(&tp->lock, flags); + + return ret; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +static u32 +rtl8169_get_tx_csum(struct net_device *dev) +{ + return (dev->features & NETIF_F_IP_CSUM) != 0; +} + +static u32 rtl8169_get_rx_csum(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + return tp->cp_cmd & RxChkSum; +} + +static int +rtl8169_set_tx_csum(struct net_device *dev, + u32 data) +{ + if (data) + dev->features |= NETIF_F_IP_CSUM; + else + dev->features &= ~NETIF_F_IP_CSUM; + + return 0; +} + +static int rtl8169_set_rx_csum(struct net_device *dev, u32 data) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); + + if (data) + tp->cp_cmd |= RxChkSum; + else + tp->cp_cmd &= ~RxChkSum; + + RTL_W16(CPlusCmd, tp->cp_cmd); + RTL_R16(CPlusCmd); + + spin_unlock_irqrestore(&tp->lock, flags); + + return 0; +} +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) + +#ifdef CONFIG_R8169_VLAN + +static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp, + struct sk_buff *skb) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) + return (tp->vlgrp && vlan_tx_tag_present(skb)) ? + TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) + return (vlan_tx_tag_present(skb)) ? + TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; +#else + return (skb_vlan_tag_present(skb)) ? + TxVlanTag | swab16(skb_vlan_tag_get(skb)) : 0x00; +#endif +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) + +static void rtl8169_vlan_rx_register(struct net_device *dev, + struct vlan_group *grp) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); + tp->vlgrp = grp; + if (tp->vlgrp) + tp->cp_cmd |= RxVlan; + else + tp->cp_cmd &= ~RxVlan; + RTL_W16(CPlusCmd, tp->cp_cmd); + RTL_R16(CPlusCmd); + spin_unlock_irqrestore(&tp->lock, flags); +} + +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) + if (tp->vlgrp) + tp->vlgrp->vlan_devices[vid] = NULL; +#else + vlan_group_set_device(tp->vlgrp, vid, NULL); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) + spin_unlock_irqrestore(&tp->lock, flags); +} +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + +static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, + struct RxDesc *desc, + struct sk_buff *skb) +{ + u32 opts2 = le32_to_cpu(desc->opts2); + int ret = -1; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) + if (tp->vlgrp && (opts2 & RxVlanTag)) { + rtl8169_rx_hwaccel_skb(skb, tp->vlgrp, + swab16(opts2 & 0xffff)); + ret = 0; + } +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) + if (opts2 & RxVlanTag) + __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); +#else + if (opts2 & RxVlanTag) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff)); +#endif + + desc->opts2 = 0; + return ret; +} + +#else /* !CONFIG_R8169_VLAN */ + +static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp, + struct sk_buff *skb) +{ + return 0; +} + +static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, + struct RxDesc *desc, + struct sk_buff *skb) +{ + return -1; +} + +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) + +static netdev_features_t rtl8169_fix_features(struct net_device *dev, + netdev_features_t features) +{ + if (dev->mtu > MSSMask) + features &= ~NETIF_F_ALL_TSO; + + return features; +} + +static int rtl8169_hw_set_features(struct net_device *dev, + netdev_features_t features) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + + if (features & NETIF_F_RXCSUM) + tp->cp_cmd |= RxChkSum; + else + tp->cp_cmd &= ~RxChkSum; + + if (dev->features & NETIF_F_HW_VLAN_RX) + tp->cp_cmd |= RxVlan; + else + tp->cp_cmd &= ~RxVlan; + + RTL_W16(CPlusCmd, tp->cp_cmd); + RTL_R16(CPlusCmd); + + return 0; +} + +static int rtl8169_set_features(struct net_device *dev, + netdev_features_t features) +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned long flags; + + features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX; + + spin_lock_irqsave(&tp->lock, flags); + if (features ^ dev->features) + rtl8169_hw_set_features(dev, features); + spin_unlock_irqrestore(&tp->lock, flags); + + return 0; +} + +#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) + +static void rtl8169_gset_xmii(struct net_device *dev, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + struct ethtool_cmd *cmd +#else + struct ethtool_link_ksettings *cmd +#endif + ) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + u8 status; + u8 autoneg, duplex; + u32 speed = 0; + u16 bmcr, bmsr, anlpar, ctrl1000 = 0, stat1000 = 0; + u32 supported, advertising, lp_advertising; + unsigned long flags; + + supported = SUPPORTED_10baseT_Half | + SUPPORTED_10baseT_Full | + SUPPORTED_100baseT_Half | + SUPPORTED_100baseT_Full | + SUPPORTED_1000baseT_Full | + SUPPORTED_Autoneg | + SUPPORTED_TP | + SUPPORTED_Pause | + SUPPORTED_Asym_Pause; + + advertising = ADVERTISED_TP; + + spin_lock_irqsave(&tp->lock, flags); + mdio_write(tp, 0x1F, 0x0000); + bmcr = mdio_read(tp, MII_BMCR); + bmsr = mdio_read(tp, MII_BMSR); + anlpar = mdio_read(tp, MII_LPA); + ctrl1000 = mdio_read(tp, MII_CTRL1000); + stat1000 = mdio_read(tp, MII_STAT1000); + spin_unlock_irqrestore(&tp->lock, flags); + + if (bmcr & BMCR_ANENABLE) { + advertising |= ADVERTISED_Autoneg; + autoneg = AUTONEG_ENABLE; + + if (bmsr & BMSR_ANEGCOMPLETE) { + lp_advertising = mii_lpa_to_ethtool_lpa_t(anlpar); + lp_advertising |= + mii_stat1000_to_ethtool_lpa_t(stat1000); + } else { + lp_advertising = 0; + } + + if (tp->phy_auto_nego_reg & ADVERTISE_10HALF) + advertising |= ADVERTISED_10baseT_Half; + if (tp->phy_auto_nego_reg & ADVERTISE_10FULL) + advertising |= ADVERTISED_10baseT_Full; + if (tp->phy_auto_nego_reg & ADVERTISE_100HALF) + advertising |= ADVERTISED_100baseT_Half; + if (tp->phy_auto_nego_reg & ADVERTISE_100FULL) + advertising |= ADVERTISED_100baseT_Full; + if (tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL) + advertising |= ADVERTISED_1000baseT_Full; + } else { + autoneg = AUTONEG_DISABLE; + lp_advertising = 0; + } + + status = RTL_R8(PHYstatus); + + if (status & LinkStatus) { + /*link on*/ + if (status & _1000bpsF) + speed = SPEED_1000; + else if (status & _100bps) + speed = SPEED_100; + else if (status & _10bps) + speed = SPEED_10; + + if (status & TxFlowCtrl) + advertising |= ADVERTISED_Asym_Pause; + + if (status & RxFlowCtrl) + advertising |= ADVERTISED_Pause; + + duplex = ((status & _1000bpsF) || (status & FullDup)) ? + DUPLEX_FULL : DUPLEX_HALF; + } else { + /*link down*/ + speed = SPEED_UNKNOWN; + duplex = DUPLEX_UNKNOWN; + } + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + cmd->supported = supported; + cmd->advertising = advertising; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30) + cmd->lp_advertising = lp_advertising; +#endif + cmd->autoneg = autoneg; + cmd->speed = speed; + cmd->duplex = duplex; + cmd->port = PORT_TP; +#else + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, + supported); + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, + advertising); + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising, + lp_advertising); + cmd->base.autoneg = autoneg; + cmd->base.speed = speed; + cmd->base.duplex = duplex; + cmd->base.port = PORT_TP; +#endif +} + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +static int rtl8169_get_settings(struct net_device *dev, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + struct ethtool_cmd *cmd +#else + struct ethtool_link_ksettings *cmd +#endif + ) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + tp->get_settings(dev, cmd); + + return 0; +} + +static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, + void *p) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + unsigned int i; + u8 *data = p; + unsigned long flags; + + if (regs->len < R8169_REGS_DUMP_SIZE) + return /* -EINVAL */; + + memset(p, 0, regs->len); + + spin_lock_irqsave(&tp->lock, flags); + for (i = 0; i < R8169_MAC_REGS_SIZE; i++) + *data++ = readb(ioaddr + i); + data = (u8*)p + 256; + + mdio_write(tp, 0x1F, 0x0000); + for (i = 0; i < R8169_PHY_REGS_SIZE/2; i++) { + *(u16*)data = mdio_read(tp, i); + data += 2; + } + spin_unlock_irqrestore(&tp->lock, flags); +} + +static void rtl8169_get_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *pause) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + pause->autoneg = (tp->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); + if (tp->fcpause == rtl8169_fc_rx_pause) + pause->rx_pause = 1; + else if (tp->fcpause == rtl8169_fc_tx_pause) + pause->tx_pause = 1; + else if (tp->fcpause == rtl8169_fc_full) { + pause->rx_pause = 1; + pause->tx_pause = 1; + } +} + +static int rtl8169_set_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *pause) +{ + struct rtl8169_private *tp = netdev_priv(dev); + enum rtl8169_fc_mode newfc; + + if (pause->tx_pause || pause->rx_pause) + newfc = rtl8169_fc_full; + else + newfc = rtl8169_fc_none; + + if (tp->fcpause != newfc) { + tp->fcpause = newfc; + + rtl8169_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + } + + return 0; + +} + +static u32 rtl8169_get_msglevel(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + return tp->msg_enable; +} + +static void rtl8169_set_msglevel(struct net_device *dev, u32 value) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + tp->msg_enable = value; +} + +static const char rtl8169_gstrings[][ETH_GSTRING_LEN] = { + "tx_packets", + "rx_packets", + "tx_errors", + "rx_errors", + "rx_missed", + "align_errors", + "tx_single_collisions", + "tx_multi_collisions", + "unicast", + "broadcast", + "multicast", + "tx_aborted", + "tx_underrun", +}; +#endif //#LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) + +struct rtl8169_counters { + u64 tx_packets; + u64 rx_packets; + u64 tx_errors; + u32 rx_errors; + u16 rx_missed; + u16 align_errors; + u32 tx_one_collision; + u32 tx_multi_collision; + u64 rx_unicast; + u64 rx_broadcast; + u32 rx_multicast; + u16 tx_aborted; + u16 tx_underun; +}; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +static int rtl8169_get_stats_count(struct net_device *dev) +{ + return ARRAY_SIZE(rtl8169_gstrings); +} +#endif //#LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +#else +static int rtl8169_get_sset_count(struct net_device *dev, int sset) +{ + switch (sset) { + case ETH_SS_STATS: + return ARRAY_SIZE(rtl8169_gstrings); + default: + return -EOPNOTSUPP; + } +} +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +static void rtl8169_get_ethtool_stats(struct net_device *dev, + struct ethtool_stats *stats, u64 *data) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + struct rtl8169_counters *counters; + dma_addr_t paddr; + u32 cmd; + + ASSERT_RTNL(); + + counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); + if (!counters) + return; + + RTL_W32(CounterAddrHigh, (u64)paddr >> 32); + cmd = (u64)paddr & DMA_32BIT_MASK; + RTL_W32(CounterAddrLow, cmd); + RTL_W32(CounterAddrLow, cmd | CounterDump); + + while (RTL_R32(CounterAddrLow) & CounterDump) { + if (msleep_interruptible(1)) + break; + } + + RTL_W32(CounterAddrLow, 0); + RTL_W32(CounterAddrHigh, 0); + + data[0] = le64_to_cpu(counters->tx_packets); + data[1] = le64_to_cpu(counters->rx_packets); + data[2] = le64_to_cpu(counters->tx_errors); + data[3] = le32_to_cpu(counters->rx_errors); + data[4] = le16_to_cpu(counters->rx_missed); + data[5] = le16_to_cpu(counters->align_errors); + data[6] = le32_to_cpu(counters->tx_one_collision); + data[7] = le32_to_cpu(counters->tx_multi_collision); + data[8] = le64_to_cpu(counters->rx_unicast); + data[9] = le64_to_cpu(counters->rx_broadcast); + data[10] = le32_to_cpu(counters->rx_multicast); + data[11] = le16_to_cpu(counters->tx_aborted); + data[12] = le16_to_cpu(counters->tx_underun); + + pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); +} + +static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) +{ + switch(stringset) { + case ETH_SS_STATS: + memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings)); + break; + } +} +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) + +#undef ethtool_op_get_link +#define ethtool_op_get_link _kc_ethtool_op_get_link +u32 _kc_ethtool_op_get_link(struct net_device *dev) +{ + return netif_carrier_ok(dev) ? 1 : 0; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +#undef ethtool_op_get_sg +#define ethtool_op_get_sg _kc_ethtool_op_get_sg +u32 _kc_ethtool_op_get_sg(struct net_device *dev) +{ +#ifdef NETIF_F_SG + return (dev->features & NETIF_F_SG) != 0; +#else + return 0; +#endif +} + +#undef ethtool_op_set_sg +#define ethtool_op_set_sg _kc_ethtool_op_set_sg +int _kc_ethtool_op_set_sg(struct net_device *dev, u32 data) +{ +#ifdef NETIF_F_SG + if (data) + dev->features |= NETIF_F_SG; + else + dev->features &= ~NETIF_F_SG; +#endif + + return 0; +} +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) +static const struct ethtool_ops rtl8169_ethtool_ops = { + .get_drvinfo = rtl8169_get_drvinfo, + .get_regs_len = rtl8169_get_regs_len, + .get_link = ethtool_op_get_link, +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) + .get_settings = rtl8169_get_settings, + .set_settings = rtl8169_set_settings, +#else + .get_link_ksettings = rtl8169_get_settings, + .set_link_ksettings = rtl8169_set_settings, +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + .get_pauseparam = rtl8169_get_pauseparam, + .set_pauseparam = rtl8169_set_pauseparam, +#endif + .get_msglevel = rtl8169_get_msglevel, + .set_msglevel = rtl8169_set_msglevel, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) + .get_rx_csum = rtl8169_get_rx_csum, + .set_rx_csum = rtl8169_set_rx_csum, + .get_tx_csum = rtl8169_get_tx_csum, + .set_tx_csum = rtl8169_set_tx_csum, + .get_sg = ethtool_op_get_sg, + .set_sg = ethtool_op_set_sg, +#ifdef NETIF_F_TSO + .get_tso = ethtool_op_get_tso, + .set_tso = ethtool_op_set_tso, +#endif +#endif + .get_regs = rtl8169_get_regs, + .get_wol = rtl8169_get_wol, + .set_wol = rtl8169_set_wol, + .get_strings = rtl8169_get_strings, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) + .get_stats_count = rtl8169_get_stats_count, +#else + .get_sset_count = rtl8169_get_sset_count, +#endif + .get_ethtool_stats = rtl8169_get_ethtool_stats, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) +#ifdef ETHTOOL_GPERMADDR + .get_perm_addr = ethtool_op_get_perm_addr, +#endif +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) +}; +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) + +static void rtl8169_get_mac_version(struct rtl8169_private *tp, void __iomem *ioaddr) +{ + u32 reg,val32; + + val32 = RTL_R32(TxConfig) ; + reg = val32 & 0xFC800000; + + switch(reg) { + case 0x00000000: + tp->mcfg = CFG_METHOD_1; + break; + case 0x00800000: + tp->mcfg = CFG_METHOD_2; + break; + case 0x04000000: + tp->mcfg = CFG_METHOD_3; + break; + case 0x10000000: + tp->mcfg = CFG_METHOD_4; + break; + case 0x18000000: + tp->mcfg = CFG_METHOD_5; + break; + case 0x98000000: + tp->mcfg = CFG_METHOD_6; + break; + default: + tp->mcfg = 0xFFFFFFFF; + printk("unknown chip version (%x)\n",reg); + break; + } +} + +static void rtl8169_print_mac_version(struct rtl8169_private *tp) +{ + dprintk("mac_version = 0x%02x\n", tp->mcfg); +} + +static void rtl8169_get_phy_version(struct rtl8169_private *tp) +{ + const struct { + u16 mask; + u16 set; + int pcfg; + } phy_info[] = { + { 0x000f, 0x0002, PCFG_METHOD_5 }, + { 0x000f, 0x0001, PCFG_METHOD_4 }, + { 0x000f, 0x0000, PCFG_METHOD_3 }, + { 0x0000, 0x0000, PCFG_METHOD_2 } /* Catch-all */ + }, *p = phy_info; + u16 reg; + + mdio_write(tp, 0x1f, 0x0000); + reg = mdio_read(tp, MII_PHYSID2) & 0xffff; + + while ((reg & p->mask) != p->set) + p++; + tp->pcfg = p->pcfg; +} + +static void rtl8169_print_phy_version(struct rtl8169_private *tp) +{ + struct { + int version; + char *msg; + u32 reg; + } phy_print[] = { + { PCFG_METHOD_5, "PCFG_METHOD_5", 0x0002 }, + { PCFG_METHOD_4, "PCFG_METHOD_4", 0x0001 }, + { PCFG_METHOD_3, "PCFG_METHOD_3", 0x0000 }, + { PCFG_METHOD_2, "PCFG_METHOD_2", 0x0000 }, + { 0, NULL, 0x0000 } + }, *p; + + for (p = phy_print; p->msg; p++) { + if (tp->pcfg == p->version) { + dprintk("phy_version == %s (%04x)\n", p->msg, p->reg); + return; + } + } + dprintk("phy_version == Unknown\n"); +} + +static void rtl8169_hw_phy_config(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct pci_dev *pdev = tp->pci_dev; + u16 vendor_id; + u16 device_id; + + tp->phy_reset_enable(dev); + + if (tp->mcfg == CFG_METHOD_6) { + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x04, 0x0000); + mdio_write(tp, 0x03, 0x00a1); + mdio_write(tp, 0x02, 0x0008); + mdio_write(tp, 0x01, 0x0120); + mdio_write(tp, 0x00, 0x1000); + mdio_write(tp, 0x04, 0x0800); + mdio_write(tp, 0x04, 0x9000); + mdio_write(tp, 0x03, 0x802f); + mdio_write(tp, 0x02, 0x4f02); + mdio_write(tp, 0x01, 0x0409); + mdio_write(tp, 0x00, 0xf099); + mdio_write(tp, 0x04, 0x9800); + mdio_write(tp, 0x04, 0xa000); + mdio_write(tp, 0x03, 0xdf01); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0xff95); + mdio_write(tp, 0x00, 0xba00); + mdio_write(tp, 0x04, 0xa800); + mdio_write(tp, 0x04, 0xf000); + mdio_write(tp, 0x03, 0xdf01); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0x101a); + mdio_write(tp, 0x00, 0xa0ff); + mdio_write(tp, 0x04, 0xf800); + mdio_write(tp, 0x04, 0x0000); + mdio_write(tp, 0x1f, 0x0000); + + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x0b, 0x8480); + mdio_write(tp, 0x1f, 0x0000); + + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x18, 0x67c7); + mdio_write(tp, 0x04, 0x2000); + mdio_write(tp, 0x03, 0x002f); + mdio_write(tp, 0x02, 0x4360); + mdio_write(tp, 0x01, 0x0109); + mdio_write(tp, 0x00, 0x3022); + mdio_write(tp, 0x04, 0x2800); + mdio_write(tp, 0x1f, 0x0000); + + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x17, 0x0cc0); + mdio_write(tp, 0x1f, 0x0000); + } else if (tp->mcfg == CFG_METHOD_5) { + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x04, 0x0000); + mdio_write(tp, 0x03, 0x00a1); + mdio_write(tp, 0x02, 0x0008); + mdio_write(tp, 0x01, 0x0120); + mdio_write(tp, 0x00, 0x1000); + mdio_write(tp, 0x04, 0x0800); + mdio_write(tp, 0x04, 0x9000); + mdio_write(tp, 0x03, 0x802f); + mdio_write(tp, 0x02, 0x4f02); + mdio_write(tp, 0x01, 0x0409); + mdio_write(tp, 0x00, 0xf099); + mdio_write(tp, 0x04, 0x9800); + mdio_write(tp, 0x04, 0xa000); + mdio_write(tp, 0x03, 0xdf01); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0xff95); + mdio_write(tp, 0x00, 0xba00); + mdio_write(tp, 0x04, 0xa800); + mdio_write(tp, 0x04, 0xf000); + mdio_write(tp, 0x03, 0xdf01); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0x101a); + mdio_write(tp, 0x00, 0xa0ff); + mdio_write(tp, 0x04, 0xf800); + mdio_write(tp, 0x04, 0x0000); + mdio_write(tp, 0x1f, 0x0000); + + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x10, 0xf41b); + mdio_write(tp, 0x14, 0xfb54); + mdio_write(tp, 0x18, 0xf5c7); + mdio_write(tp, 0x1f, 0x0000); + + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x17, 0x0cc0); + mdio_write(tp, 0x1f, 0x0000); + + pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &vendor_id); + pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &device_id); + if ((vendor_id == 0x1458) && (device_id == 0xe000)) { + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x10, 0xf01b); + mdio_write(tp, 0x1f, 0x0000); + } + } else if (tp->mcfg == CFG_METHOD_4) { + mdio_write(tp, 0x1f, 0x0002); + mdio_write(tp, 0x01, 0x90d0); + mdio_write(tp, 0x1f, 0x0000); + //mdio_write(tp, 0x1e, 0x8c00); /* PHY link down with some Giga switch */ + } else if ((tp->mcfg == CFG_METHOD_2) || (tp->mcfg == CFG_METHOD_3)) { + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x06, 0x006e); + mdio_write(tp, 0x08, 0x0708); + mdio_write(tp, 0x15, 0x4000); + mdio_write(tp, 0x18, 0x65c7); + + mdio_write(tp, 0x1f, 0x0001); + mdio_write(tp, 0x03, 0x00a1); + mdio_write(tp, 0x02, 0x0008); + mdio_write(tp, 0x01, 0x0120); + mdio_write(tp, 0x00, 0x1000); + mdio_write(tp, 0x04, 0x0800); + mdio_write(tp, 0x04, 0x0000); + + mdio_write(tp, 0x03, 0xff41); + mdio_write(tp, 0x02, 0xdf60); + mdio_write(tp, 0x01, 0x0140); + mdio_write(tp, 0x00, 0x0077); + mdio_write(tp, 0x04, 0x7800); + mdio_write(tp, 0x04, 0x7000); + + mdio_write(tp, 0x03, 0x802f); + mdio_write(tp, 0x02, 0x4f02); + mdio_write(tp, 0x01, 0x0409); + mdio_write(tp, 0x00, 0xf0f9); + mdio_write(tp, 0x04, 0x9800); + mdio_write(tp, 0x04, 0x9000); + + mdio_write(tp, 0x03, 0xdf01); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0xff95); + mdio_write(tp, 0x00, 0xba00); + mdio_write(tp, 0x04, 0xa800); + mdio_write(tp, 0x04, 0xa000); + + mdio_write(tp, 0x03, 0xff41); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0x0140); + mdio_write(tp, 0x00, 0x00bb); + mdio_write(tp, 0x04, 0xb800); + mdio_write(tp, 0x04, 0xb000); + + mdio_write(tp, 0x03, 0xdf41); + mdio_write(tp, 0x02, 0xdc60); + mdio_write(tp, 0x01, 0x6340); + mdio_write(tp, 0x00, 0x007d); + mdio_write(tp, 0x04, 0xd800); + mdio_write(tp, 0x04, 0xd000); + + mdio_write(tp, 0x03, 0xdf01); + mdio_write(tp, 0x02, 0xdf20); + mdio_write(tp, 0x01, 0x100a); + mdio_write(tp, 0x00, 0xa0ff); + mdio_write(tp, 0x04, 0xf800); + mdio_write(tp, 0x04, 0xf000); + + mdio_write(tp, 0x1f, 0x0000); + mdio_write(tp, 0x0b, 0x0000); + mdio_write(tp, 0x00, 0x9200); + } + + mdio_write(tp, 0x1F, 0x0000); +} + +static void +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +rtl8169_phy_timer(unsigned long __opaque) +#else +rtl8169_phy_timer(struct timer_list *t) +#endif +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + struct net_device *dev = (struct net_device *)__opaque; + struct rtl8169_private *tp = netdev_priv(dev); + struct timer_list *timer = &tp->link_timer; +#else + struct rtl8169_private *tp = from_timer(tp, t, link_timer); + struct net_device *dev = tp->dev; + struct timer_list *timer = t; +#endif + unsigned long timeout = RTL8169_PHY_TIMEOUT; + + assert(tp->mcfg > CFG_METHOD_1); + assert(tp->pcfg < PCFG_METHOD_6); + + if (!(tp->phy_1000_ctrl_reg & ADVERTISE_1000FULL)) + return; + + spin_lock_irq(&tp->lock); + + if (tp->phy_reset_pending(dev)) { + /* + * A busy loop could burn quite a few cycles on nowadays CPU. + * Let's delay the execution of the timer for a few ticks. + */ + timeout = HZ/10; + goto out_mod_timer; + } + + if (tp->link_ok(dev)) + goto out_unlock; + + if (netif_msg_link(tp)) + printk(KERN_WARNING "%s: PHY reset until link up\n", dev->name); + + tp->phy_reset_enable(dev); + +out_mod_timer: + mod_timer(timer, jiffies + timeout); +out_unlock: + spin_unlock_irq(&tp->lock); +} + +static inline void rtl8169_delete_timer(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct timer_list *timer = &tp->link_timer; + + if ((tp->mcfg <= CFG_METHOD_1) || + (tp->pcfg >= PCFG_METHOD_6)) + return; + + del_timer_sync(timer); +} + +static inline void rtl8169_request_timer(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct timer_list *timer = &tp->link_timer; + + if ((tp->mcfg <= CFG_METHOD_1) || + (tp->pcfg >= PCFG_METHOD_6)) + return; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + setup_timer(timer, rtl8169_phy_timer, (unsigned long)dev); +#else + timer_setup(timer, rtl8169_phy_timer, 0); +#endif + mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT); +} + +static inline void rtl8169_delete_esd_timer(struct net_device *dev, struct timer_list *timer) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + spin_lock_irq(&tp->lock); + del_timer_sync(timer); + spin_unlock_irq(&tp->lock); +} + +static inline void rtl8169_request_esd_timer(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct timer_list *timer = &tp->esd_timer; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + setup_timer(timer, rtl8169_esd_timer, (unsigned long)dev); +#else + timer_setup(timer, rtl8169_esd_timer, 0); +#endif + mod_timer(timer, jiffies + RTL8169_ESD_TIMEOUT); +} + +static void +rtl8169_hw_init(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + + RTL_W32(RxConfig, RTL_R32(RxConfig) & ~(AcceptErr | AcceptRunt | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys)); + + if (RTL_R8(Config2) & PCI_Clock_66MHz) { + if (tp->mcfg == CFG_METHOD_5) + RTL_W32(Offset_7Ch, 0x000FFFFF); + else if (tp->mcfg == CFG_METHOD_6) + RTL_W32(Offset_7Ch, 0x003FFFFF); + } else { + if (tp->mcfg == CFG_METHOD_5) + RTL_W32(Offset_7Ch, 0x000FFF00); + else if (tp->mcfg == CFG_METHOD_6) + RTL_W32(Offset_7Ch, 0x003FFF00); + } + + if (tp->mcfg == CFG_METHOD_4) { + RTL_W8(Cfg9346, Cfg9346_Unlock); + RTL_W8(Config4, RTL_R8(Config4) | iMode); + RTL_W8(Cfg9346, Cfg9346_Lock); + } +} + +#ifdef CONFIG_NET_POLL_CONTROLLER +/* + * Polling 'interrupt' - used by things like netconsole to send skbs + * without having to re-enable interrupts. It's not called while + * the interrupt routine is executing. + */ +static void rtl8169_netpoll(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct pci_dev *pdev = tp->pci_dev; + + disable_irq(pdev->irq); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) + rtl8169_interrupt(pdev->irq, dev, NULL); +#else + rtl8169_interrupt(pdev->irq, dev); +#endif + enable_irq(pdev->irq); +} +#endif + +static void +rtl8169_init_software_variable(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + tp->UseSwPaddingShortPkt = TRUE; +} + +static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev, + void __iomem *ioaddr) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + rtl8169_phy_power_down(dev); + + /* restore the original MAC address */ + rtl8169_rar_set(tp, tp->org_mac_addr); + + iounmap(ioaddr); + pci_release_regions(pdev); + pci_clear_mwi(pdev); + pci_disable_device(pdev); + free_netdev(dev); +} + +static void +rtl8169_hw_address_set(struct net_device *dev, u8 mac_addr[MAC_ADDR_LEN]) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) + eth_hw_addr_set(dev, mac_addr); +#else + memcpy(dev->dev_addr, mac_addr, MAC_ADDR_LEN); +#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) +} + +static int +rtl8169_get_mac_address(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + int i; + u8 mac_addr[MAC_ADDR_LEN]; + + /* Get MAC address. FIXME: read EEPROM */ + for (i = 0; i < MAC_ADDR_LEN; i++) + mac_addr[i] = RTL_R8(MAC0 + i); + + if (!is_valid_ether_addr(mac_addr)) { + netif_err(tp, probe, dev, "Invalid ether addr %pM\n", + mac_addr); + eth_random_addr(mac_addr); + dev->addr_assign_type = NET_ADDR_RANDOM; + netif_info(tp, probe, dev, "Random ether addr %pM\n", + mac_addr); + tp->random_mac = 1; + } + + rtl8169_hw_address_set(dev, mac_addr); + rtl8169_rar_set(tp, mac_addr); + + /* keep the original MAC address */ + memcpy(tp->org_mac_addr, dev->dev_addr, MAC_ADDR_LEN); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); +#endif + return 0; +} + +/** + * rtl8169_set_mac_address - Change the Ethernet Address of the NIC + * @dev: network interface device structure + * @p: pointer to an address structure + * + * Return 0 on success, negative on failure + **/ +static int +rtl8169_set_mac_address(struct net_device *dev, + void *p) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct sockaddr *addr = p; + unsigned long flags; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_hw_address_set(dev, addr->sa_data); + + rtl8169_rar_set(tp, dev->dev_addr); + + spin_unlock_irqrestore(&tp->lock, flags); + + return 0; +} + +/****************************************************************************** + * rtl8169_rar_set - Puts an ethernet address into a receive address register. + * + * tp - The private data structure for driver + * addr - Address to put into receive address register + *****************************************************************************/ +void +rtl8169_rar_set(struct rtl8169_private *tp, + const u8 *addr) +{ + void __iomem *ioaddr = tp->mmio_addr; + uint32_t rar_low = 0; + uint32_t rar_high = 0; + + rar_low = ((uint32_t) addr[0] | + ((uint32_t) addr[1] << 8) | + ((uint32_t) addr[2] << 16) | + ((uint32_t) addr[3] << 24)); + + rar_high = ((uint32_t) addr[4] | + ((uint32_t) addr[5] << 8)); + + RTL_W8(Cfg9346, Cfg9346_Unlock); + RTL_W32(MAC0, rar_low); + RTL_W32(MAC4, rar_high); + RTL_W8(Cfg9346, Cfg9346_Lock); +} + +#ifdef ETHTOOL_OPS_COMPAT +static int ethtool_get_settings(struct net_device *dev, void *useraddr) +{ + struct ethtool_cmd cmd = { ETHTOOL_GSET }; + int err; + + if (!ethtool_ops->get_settings) + return -EOPNOTSUPP; + + err = ethtool_ops->get_settings(dev, &cmd); + if (err < 0) + return err; + + if (copy_to_user(useraddr, &cmd, sizeof(cmd))) + return -EFAULT; + return 0; +} + +static int ethtool_set_settings(struct net_device *dev, void *useraddr) +{ + struct ethtool_cmd cmd; + + if (!ethtool_ops->set_settings) + return -EOPNOTSUPP; + + if (copy_from_user(&cmd, useraddr, sizeof(cmd))) + return -EFAULT; + + return ethtool_ops->set_settings(dev, &cmd); +} + +static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr) +{ + struct ethtool_drvinfo info; + struct ethtool_ops *ops = ethtool_ops; + + if (!ops->get_drvinfo) + return -EOPNOTSUPP; + + memset(&info, 0, sizeof(info)); + info.cmd = ETHTOOL_GDRVINFO; + ops->get_drvinfo(dev, &info); + + if (ops->self_test_count) + info.testinfo_len = ops->self_test_count(dev); + if (ops->get_stats_count) + info.n_stats = ops->get_stats_count(dev); + if (ops->get_regs_len) + info.regdump_len = ops->get_regs_len(dev); + if (ops->get_eeprom_len) + info.eedump_len = ops->get_eeprom_len(dev); + + if (copy_to_user(useraddr, &info, sizeof(info))) + return -EFAULT; + return 0; +} + +static int ethtool_get_regs(struct net_device *dev, char *useraddr) +{ + struct ethtool_regs regs; + struct ethtool_ops *ops = ethtool_ops; + void *regbuf; + int reglen, ret; + + if (!ops->get_regs || !ops->get_regs_len) + return -EOPNOTSUPP; + + if (copy_from_user(®s, useraddr, sizeof(regs))) + return -EFAULT; + + reglen = ops->get_regs_len(dev); + if (regs.len > reglen) + regs.len = reglen; + + regbuf = kmalloc(reglen, GFP_USER); + if (!regbuf) + return -ENOMEM; + + ops->get_regs(dev, ®s, regbuf); + + ret = -EFAULT; + if (copy_to_user(useraddr, ®s, sizeof(regs))) + goto out; + useraddr += offsetof(struct ethtool_regs, data); + if (copy_to_user(useraddr, regbuf, reglen)) + goto out; + ret = 0; + +out: + kfree(regbuf); + return ret; +} + +static int ethtool_get_wol(struct net_device *dev, char *useraddr) +{ + struct ethtool_wolinfo wol = { ETHTOOL_GWOL }; + + if (!ethtool_ops->get_wol) + return -EOPNOTSUPP; + + ethtool_ops->get_wol(dev, &wol); + + if (copy_to_user(useraddr, &wol, sizeof(wol))) + return -EFAULT; + return 0; +} + +static int ethtool_set_wol(struct net_device *dev, char *useraddr) +{ + struct ethtool_wolinfo wol; + + if (!ethtool_ops->set_wol) + return -EOPNOTSUPP; + + if (copy_from_user(&wol, useraddr, sizeof(wol))) + return -EFAULT; + + return ethtool_ops->set_wol(dev, &wol); +} + +static int ethtool_get_msglevel(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GMSGLVL }; + + if (!ethtool_ops->get_msglevel) + return -EOPNOTSUPP; + + edata.data = ethtool_ops->get_msglevel(dev); + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_msglevel(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata; + + if (!ethtool_ops->set_msglevel) + return -EOPNOTSUPP; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + + ethtool_ops->set_msglevel(dev, edata.data); + return 0; +} + +static int ethtool_nway_reset(struct net_device *dev) +{ + if (!ethtool_ops->nway_reset) + return -EOPNOTSUPP; + + return ethtool_ops->nway_reset(dev); +} + +static int ethtool_get_link(struct net_device *dev, void *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GLINK }; + + if (!ethtool_ops->get_link) + return -EOPNOTSUPP; + + edata.data = ethtool_ops->get_link(dev); + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_get_eeprom(struct net_device *dev, void *useraddr) +{ + struct ethtool_eeprom eeprom; + struct ethtool_ops *ops = ethtool_ops; + u8 *data; + int ret; + + if (!ops->get_eeprom || !ops->get_eeprom_len) + return -EOPNOTSUPP; + + if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) + return -EFAULT; + + /* Check for wrap and zero */ + if (eeprom.offset + eeprom.len <= eeprom.offset) + return -EINVAL; + + /* Check for exceeding total eeprom len */ + if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) + return -EINVAL; + + data = kmalloc(eeprom.len, GFP_USER); + if (!data) + return -ENOMEM; + + ret = -EFAULT; + if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len)) + goto out; + + ret = ops->get_eeprom(dev, &eeprom, data); + if (ret) + goto out; + + ret = -EFAULT; + if (copy_to_user(useraddr, &eeprom, sizeof(eeprom))) + goto out; + if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len)) + goto out; + ret = 0; + +out: + kfree(data); + return ret; +} + +static int ethtool_set_eeprom(struct net_device *dev, void *useraddr) +{ + struct ethtool_eeprom eeprom; + struct ethtool_ops *ops = ethtool_ops; + u8 *data; + int ret; + + if (!ops->set_eeprom || !ops->get_eeprom_len) + return -EOPNOTSUPP; + + if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) + return -EFAULT; + + /* Check for wrap and zero */ + if (eeprom.offset + eeprom.len <= eeprom.offset) + return -EINVAL; + + /* Check for exceeding total eeprom len */ + if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev)) + return -EINVAL; + + data = kmalloc(eeprom.len, GFP_USER); + if (!data) + return -ENOMEM; + + ret = -EFAULT; + if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len)) + goto out; + + ret = ops->set_eeprom(dev, &eeprom, data); + if (ret) + goto out; + + if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len)) + ret = -EFAULT; + +out: + kfree(data); + return ret; +} + +static int ethtool_get_coalesce(struct net_device *dev, void *useraddr) +{ + struct ethtool_coalesce coalesce = { ETHTOOL_GCOALESCE }; + + if (!ethtool_ops->get_coalesce) + return -EOPNOTSUPP; + + ethtool_ops->get_coalesce(dev, &coalesce); + + if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) + return -EFAULT; + return 0; +} + +static int ethtool_set_coalesce(struct net_device *dev, void *useraddr) +{ + struct ethtool_coalesce coalesce; + + if (!ethtool_ops->get_coalesce) + return -EOPNOTSUPP; + + if (copy_from_user(&coalesce, useraddr, sizeof(coalesce))) + return -EFAULT; + + return ethtool_ops->set_coalesce(dev, &coalesce); +} + +static int ethtool_get_ringparam(struct net_device *dev, void *useraddr) +{ + struct ethtool_ringparam ringparam = { ETHTOOL_GRINGPARAM }; + + if (!ethtool_ops->get_ringparam) + return -EOPNOTSUPP; + + ethtool_ops->get_ringparam(dev, &ringparam); + + if (copy_to_user(useraddr, &ringparam, sizeof(ringparam))) + return -EFAULT; + return 0; +} + +static int ethtool_set_ringparam(struct net_device *dev, void *useraddr) +{ + struct ethtool_ringparam ringparam; + + if (!ethtool_ops->get_ringparam) + return -EOPNOTSUPP; + + if (copy_from_user(&ringparam, useraddr, sizeof(ringparam))) + return -EFAULT; + + return ethtool_ops->set_ringparam(dev, &ringparam); +} + +static int ethtool_get_pauseparam(struct net_device *dev, void *useraddr) +{ + struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; + + if (!ethtool_ops->get_pauseparam) + return -EOPNOTSUPP; + + ethtool_ops->get_pauseparam(dev, &pauseparam); + + if (copy_to_user(useraddr, &pauseparam, sizeof(pauseparam))) + return -EFAULT; + return 0; +} + +static int ethtool_set_pauseparam(struct net_device *dev, void *useraddr) +{ + struct ethtool_pauseparam pauseparam; + + if (!ethtool_ops->get_pauseparam) + return -EOPNOTSUPP; + + if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) + return -EFAULT; + + return ethtool_ops->set_pauseparam(dev, &pauseparam); +} + +static int ethtool_get_rx_csum(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GRXCSUM }; + + if (!ethtool_ops->get_rx_csum) + return -EOPNOTSUPP; + + edata.data = ethtool_ops->get_rx_csum(dev); + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_rx_csum(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata; + + if (!ethtool_ops->set_rx_csum) + return -EOPNOTSUPP; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + + ethtool_ops->set_rx_csum(dev, edata.data); + return 0; +} + +static int ethtool_get_tx_csum(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GTXCSUM }; + + if (!ethtool_ops->get_tx_csum) + return -EOPNOTSUPP; + + edata.data = ethtool_ops->get_tx_csum(dev); + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_tx_csum(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata; + + if (!ethtool_ops->set_tx_csum) + return -EOPNOTSUPP; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + + return ethtool_ops->set_tx_csum(dev, edata.data); +} + +static int ethtool_get_sg(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GSG }; + + if (!ethtool_ops->get_sg) + return -EOPNOTSUPP; + + edata.data = ethtool_ops->get_sg(dev); + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_sg(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata; + + if (!ethtool_ops->set_sg) + return -EOPNOTSUPP; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + + return ethtool_ops->set_sg(dev, edata.data); +} + +static int ethtool_get_tso(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GTSO }; + + if (!ethtool_ops->get_tso) + return -EOPNOTSUPP; + + edata.data = ethtool_ops->get_tso(dev); + + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_tso(struct net_device *dev, char *useraddr) +{ + struct ethtool_value edata; + + if (!ethtool_ops->set_tso) + return -EOPNOTSUPP; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + + return ethtool_ops->set_tso(dev, edata.data); +} + +static int ethtool_self_test(struct net_device *dev, char *useraddr) +{ + struct ethtool_test test; + struct ethtool_ops *ops = ethtool_ops; + u64 *data; + int ret; + + if (!ops->self_test || !ops->self_test_count) + return -EOPNOTSUPP; + + if (copy_from_user(&test, useraddr, sizeof(test))) + return -EFAULT; + + test.len = ops->self_test_count(dev); + data = kmalloc(test.len * sizeof(u64), GFP_USER); + if (!data) + return -ENOMEM; + + ops->self_test(dev, &test, data); + + ret = -EFAULT; + if (copy_to_user(useraddr, &test, sizeof(test))) + goto out; + useraddr += sizeof(test); + if (copy_to_user(useraddr, data, test.len * sizeof(u64))) + goto out; + ret = 0; + +out: + kfree(data); + return ret; +} + +static int ethtool_get_strings(struct net_device *dev, void *useraddr) +{ + struct ethtool_gstrings gstrings; + struct ethtool_ops *ops = ethtool_ops; + u8 *data; + int ret; + + if (!ops->get_strings) + return -EOPNOTSUPP; + + if (copy_from_user(&gstrings, useraddr, sizeof(gstrings))) + return -EFAULT; + + switch (gstrings.string_set) { + case ETH_SS_TEST: + if (!ops->self_test_count) + return -EOPNOTSUPP; + gstrings.len = ops->self_test_count(dev); + break; + case ETH_SS_STATS: + if (!ops->get_stats_count) + return -EOPNOTSUPP; + gstrings.len = ops->get_stats_count(dev); + break; + default: + return -EINVAL; + } + + data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); + if (!data) + return -ENOMEM; + + ops->get_strings(dev, gstrings.string_set, data); + + ret = -EFAULT; + if (copy_to_user(useraddr, &gstrings, sizeof(gstrings))) + goto out; + useraddr += sizeof(gstrings); + if (copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN)) + goto out; + ret = 0; + +out: + kfree(data); + return ret; +} + +static int ethtool_phys_id(struct net_device *dev, void *useraddr) +{ + struct ethtool_value id; + + if (!ethtool_ops->phys_id) + return -EOPNOTSUPP; + + if (copy_from_user(&id, useraddr, sizeof(id))) + return -EFAULT; + + return ethtool_ops->phys_id(dev, id.data); +} + +static int ethtool_get_stats(struct net_device *dev, void *useraddr) +{ + struct ethtool_stats stats; + struct ethtool_ops *ops = ethtool_ops; + u64 *data; + int ret; + + if (!ops->get_ethtool_stats || !ops->get_stats_count) + return -EOPNOTSUPP; + + if (copy_from_user(&stats, useraddr, sizeof(stats))) + return -EFAULT; + + stats.n_stats = ops->get_stats_count(dev); + data = kmalloc(stats.n_stats * sizeof(u64), GFP_USER); + if (!data) + return -ENOMEM; + + ops->get_ethtool_stats(dev, &stats, data); + + ret = -EFAULT; + if (copy_to_user(useraddr, &stats, sizeof(stats))) + goto out; + useraddr += sizeof(stats); + if (copy_to_user(useraddr, data, stats.n_stats * sizeof(u64))) + goto out; + ret = 0; + +out: + kfree(data); + return ret; +} + +static int ethtool_ioctl(struct ifreq *ifr) +{ + struct net_device *dev = __dev_get_by_name(ifr->ifr_name); + void *useraddr = (void *) ifr->ifr_data; + u32 ethcmd; + + /* + * XXX: This can be pushed down into the ethtool_* handlers that + * need it. Keep existing behaviour for the moment. + */ + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + + if (!dev || !netif_device_present(dev)) + return -ENODEV; + + if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) + return -EFAULT; + + switch (ethcmd) { + case ETHTOOL_GSET: + return ethtool_get_settings(dev, useraddr); + case ETHTOOL_SSET: + return ethtool_set_settings(dev, useraddr); + case ETHTOOL_GDRVINFO: + return ethtool_get_drvinfo(dev, useraddr); + case ETHTOOL_GREGS: + return ethtool_get_regs(dev, useraddr); + case ETHTOOL_GWOL: + return ethtool_get_wol(dev, useraddr); + case ETHTOOL_SWOL: + return ethtool_set_wol(dev, useraddr); + case ETHTOOL_GMSGLVL: + return ethtool_get_msglevel(dev, useraddr); + case ETHTOOL_SMSGLVL: + return ethtool_set_msglevel(dev, useraddr); + case ETHTOOL_NWAY_RST: + return ethtool_nway_reset(dev); + case ETHTOOL_GLINK: + return ethtool_get_link(dev, useraddr); + case ETHTOOL_GEEPROM: + return ethtool_get_eeprom(dev, useraddr); + case ETHTOOL_SEEPROM: + return ethtool_set_eeprom(dev, useraddr); + case ETHTOOL_GCOALESCE: + return ethtool_get_coalesce(dev, useraddr); + case ETHTOOL_SCOALESCE: + return ethtool_set_coalesce(dev, useraddr); + case ETHTOOL_GRINGPARAM: + return ethtool_get_ringparam(dev, useraddr); + case ETHTOOL_SRINGPARAM: + return ethtool_set_ringparam(dev, useraddr); + case ETHTOOL_GPAUSEPARAM: + return ethtool_get_pauseparam(dev, useraddr); + case ETHTOOL_SPAUSEPARAM: + return ethtool_set_pauseparam(dev, useraddr); + case ETHTOOL_GRXCSUM: + return ethtool_get_rx_csum(dev, useraddr); + case ETHTOOL_SRXCSUM: + return ethtool_set_rx_csum(dev, useraddr); + case ETHTOOL_GTXCSUM: + return ethtool_get_tx_csum(dev, useraddr); + case ETHTOOL_STXCSUM: + return ethtool_set_tx_csum(dev, useraddr); + case ETHTOOL_GSG: + return ethtool_get_sg(dev, useraddr); + case ETHTOOL_SSG: + return ethtool_set_sg(dev, useraddr); + case ETHTOOL_GTSO: + return ethtool_get_tso(dev, useraddr); + case ETHTOOL_STSO: + return ethtool_set_tso(dev, useraddr); + case ETHTOOL_TEST: + return ethtool_self_test(dev, useraddr); + case ETHTOOL_GSTRINGS: + return ethtool_get_strings(dev, useraddr); + case ETHTOOL_PHYS_ID: + return ethtool_phys_id(dev, useraddr); + case ETHTOOL_GSTATS: + return ethtool_get_stats(dev, useraddr); + default: + return -EOPNOTSUPP; + } + + return -EOPNOTSUPP; +} +#endif //ETHTOOL_OPS_COMPAT + +static int rtl8169_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct mii_ioctl_data *data = if_mii(ifr); + unsigned long flags; + + if (!netif_running(dev)) + return -ENODEV; + + switch (cmd) { + case SIOCGMIIPHY: + data->phy_id = 32; /* Internal PHY */ + return 0; + + case SIOCGMIIREG: + spin_lock_irqsave(&tp->lock, flags); + mdio_write(tp, 0x1f, 0x0000); + data->val_out = mdio_read(tp, data->reg_num & 0x1f); + spin_unlock_irqrestore(&tp->lock, flags); + return 0; + + case SIOCSMIIREG: + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + spin_lock_irqsave(&tp->lock, flags); + mdio_write(tp, 0x1f, 0x0000); + mdio_write(tp, data->reg_num & 0x1f, data->val_in); + spin_unlock_irqrestore(&tp->lock, flags); + return 0; +#ifdef ETHTOOL_OPS_COMPAT + case SIOCETHTOOL: + return ethtool_ioctl(ifr); +#endif + default: + return -EOPNOTSUPP; + } +} + +static void rtl8169_phy_power_up(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + mdio_write(tp, 0x1F, 0x0000); + mdio_write(tp, 0x0E, 0x0000); + mdio_write(tp, MII_BMCR, BMCR_ANENABLE); +} + +static void rtl8169_phy_power_down(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + mdio_write(tp, 0x1F, 0x0000); + mdio_write(tp, MII_BMCR, BMCR_PDOWN | BMCR_ANENABLE); +} + +static void +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +rtl8169_esd_timer(unsigned long __opaque) +#else +rtl8169_esd_timer(struct timer_list *t) +#endif +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + struct net_device *dev = (struct net_device *)__opaque; + struct rtl8169_private *tp = netdev_priv(dev); + struct timer_list *timer = &tp->esd_timer; +#else + struct rtl8169_private *tp = from_timer(tp, t, esd_timer); + struct net_device *dev = tp->dev; + struct timer_list *timer = t; +#endif + struct pci_dev *pdev = tp->pci_dev; + unsigned long timeout = RTL8169_ESD_TIMEOUT; + u8 cmd; + u8 cls; + u16 io_base_l; + u16 mem_base_l; + u16 mem_base_h; + u8 ilr; + u16 resv_0x20_l; + u16 resv_0x20_h; + u16 resv_0x24_l; + u16 resv_0x24_h; + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); + + tp->esd_flag = 0; + + pci_read_config_byte(pdev, PCI_COMMAND, &cmd); + if (cmd != tp->pci_cfg_space.cmd) { + printk(KERN_ERR "%s: cmd = 0x%02x, should be 0x%02x \n.", dev->name, cmd, tp->pci_cfg_space.cmd); + pci_write_config_byte(pdev, PCI_COMMAND, tp->pci_cfg_space.cmd); + tp->esd_flag |= BIT_0; + + pci_read_config_byte(pdev, PCI_COMMAND, &cmd); + if (cmd == 0xff) { + netif_err(tp, drv, dev, "pci link is down \n"); + goto out_unlock; + } + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &io_base_l); + if (io_base_l != tp->pci_cfg_space.io_base_l) { + printk(KERN_ERR "%s: io_base_l = 0x%04x, should be 0x%04x \n.", dev->name, io_base_l, tp->pci_cfg_space.io_base_l); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_0, tp->pci_cfg_space.io_base_l); + tp->esd_flag |= BIT_1; + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_2, &mem_base_l); + if (mem_base_l != tp->pci_cfg_space.mem_base_l) { + printk(KERN_ERR "%s: mem_base_l = 0x%04x, should be 0x%04x \n.", dev->name, mem_base_l, tp->pci_cfg_space.mem_base_l); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_2, tp->pci_cfg_space.mem_base_l); + tp->esd_flag |= BIT_2; + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, &mem_base_h); + if (mem_base_h!= tp->pci_cfg_space.mem_base_h) { + printk(KERN_ERR "%s: mem_base_h = 0x%04x, should be 0x%04x \n.", dev->name, mem_base_h, tp->pci_cfg_space.mem_base_h); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, tp->pci_cfg_space.mem_base_h); + tp->esd_flag |= BIT_3; + } + + pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cls); + if (cls != tp->pci_cfg_space.cls) { + printk(KERN_ERR "%s: cls = 0x%02x, should be 0x%02x \n.", dev->name, cls, tp->pci_cfg_space.cls); + pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, tp->pci_cfg_space.cls); + tp->esd_flag |= BIT_4; + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_4, &resv_0x20_l); + if (resv_0x20_l != tp->pci_cfg_space.resv_0x20_l) { + printk(KERN_ERR "%s: resv_0x20_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x20_l, tp->pci_cfg_space.resv_0x20_l); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_4, tp->pci_cfg_space.resv_0x20_l); + tp->esd_flag |= BIT_6; + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, &resv_0x20_h); + if (resv_0x20_h != tp->pci_cfg_space.resv_0x20_h) { + printk(KERN_ERR "%s: resv_0x20_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x20_h, tp->pci_cfg_space.resv_0x20_h); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, tp->pci_cfg_space.resv_0x20_h); + tp->esd_flag |= BIT_7; + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_5, &resv_0x24_l); + if (resv_0x24_l != tp->pci_cfg_space.resv_0x24_l) { + printk(KERN_ERR "%s: resv_0x24_l = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x24_l, tp->pci_cfg_space.resv_0x24_l); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_5, tp->pci_cfg_space.resv_0x24_l); + tp->esd_flag |= BIT_8; + } + + pci_read_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, &resv_0x24_h); + if (resv_0x24_h != tp->pci_cfg_space.resv_0x24_h) { + printk(KERN_ERR "%s: resv_0x24_h = 0x%04x, should be 0x%04x \n.", dev->name, resv_0x24_h, tp->pci_cfg_space.resv_0x24_h); + pci_write_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, tp->pci_cfg_space.resv_0x24_h); + tp->esd_flag |= BIT_9; + } + + pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &ilr); + if (ilr != tp->pci_cfg_space.ilr) { + printk(KERN_ERR "%s: ilr = 0x%02x, should be 0x%02x \n.", dev->name, ilr, tp->pci_cfg_space.ilr); + pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, tp->pci_cfg_space.ilr); + tp->esd_flag |= BIT_10; + } + + if (tp->esd_flag != 0) { + printk(KERN_ERR "%s: esd_flag = 0x%04x\n.\n", dev->name, tp->esd_flag); + netif_stop_queue(dev); + netif_carrier_off(dev); + rtl8169_hw_reset(dev); + rtl8169_tx_clear(tp); + rtl8169_rx_clear(tp); + rtl8169_init_ring(dev); + rtl8169_powerup_pll(dev); + rtl8169_hw_phy_config(dev); + rtl8169_hw_start(dev); + rtl8169_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + tp->esd_flag = 0; + } + +out_unlock: + spin_unlock_irqrestore(&tp->lock, flags); + + mod_timer(timer, jiffies + timeout); +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) +static const struct net_device_ops rtl8169_netdev_ops = { + .ndo_open = rtl8169_open, + .ndo_stop = rtl8169_close, + .ndo_get_stats = rtl8169_get_stats, + .ndo_start_xmit = rtl8169_start_xmit, + .ndo_tx_timeout = rtl8169_tx_timeout, + .ndo_change_mtu = rtl8169_change_mtu, + .ndo_set_mac_address = rtl8169_set_mac_address, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) + .ndo_do_ioctl = rtl8169_ioctl, +#else + .ndo_eth_ioctl = rtl8169_ioctl, +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) + .ndo_set_multicast_list = rtl8169_set_rx_mode, +#else + .ndo_set_rx_mode = rtl8169_set_rx_mode, +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) +#ifdef CONFIG_R8169_VLAN + .ndo_vlan_rx_register = rtl8169_vlan_rx_register, +#endif +#else + .ndo_fix_features = rtl8169_fix_features, + .ndo_set_features = rtl8169_set_features, +#endif +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = rtl8169_netpoll, +#endif +}; +#endif //HAVE_NET_DEVICE_OPS + +static int __devinit +rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) +{ + const unsigned int region = rtl_cfg_info[ent->driver_data].region; + struct rtl8169_private *tp; + struct net_device *dev; + void __iomem *ioaddr; + unsigned int pm_cap; + int i, rc; + static int board_idx = -1; + + board_idx++; + + if (netif_msg_drv(&debug)) { + printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", + MODULENAME, RTL8169_VERSION); + } + + dev = alloc_etherdev(sizeof (*tp)); + if (!dev) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_drv(&debug)) + dev_err(&pdev->dev, "unable to alloc new ethernet\n"); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + rc = -ENOMEM; + goto out; + } + + SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); + tp = netdev_priv(dev); + tp->dev = dev; + tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); + + /* enable device (incl. PCI PM wakeup and hotplug setup) */ + rc = pci_enable_device(pdev); + if (rc < 0) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) + dev_err(&pdev->dev, "enable failure\n"); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + goto err_out_free_dev_1; + } + + if (pci_set_mwi(pdev) < 0) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_drv(&debug)) + dev_info(&pdev->dev, "Mem-Wr-Inval unavailable.\n"); +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + } + + /* save power state before pci_enable_device overwrites it */ + pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); + if (pm_cap) { + u16 pwr_command, acpi_idle_state; + + pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command); + acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK; + } else { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) { + dev_err(&pdev->dev, "PowerManagement capability not found.\n"); + } +#else + printk("PowerManagement capability not found.\n"); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + } + + /* make sure PCI base addr 1 is MMIO */ + if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) { + dev_err(&pdev->dev, "region #%d not an MMIO resource, aborting\n", region); + } +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + rc = -ENODEV; + goto err_out_mwi_3; + } + + /* check for weird/broken PCI region reporting */ + if (pci_resource_len(pdev, region) < R8169_REGS_SIZE) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) { + dev_err(&pdev->dev, "Invalid PCI region size(s), aborting\n"); + } +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + rc = -ENODEV; + goto err_out_mwi_3; + } + + rc = pci_request_regions(pdev, MODULENAME); + if (rc < 0) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) + dev_err(&pdev->dev, "could not request regions.\n"); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + goto err_out_mwi_3; + } + + tp->cp_cmd = PCIMulRW | RxChkSum; + + if ((sizeof(dma_addr_t) > 4) && + use_dac && + !pci_set_dma_mask(pdev,DMA_64BIT_MASK) && + !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { + tp->cp_cmd |= PCIDAC; + dev->features |= NETIF_F_HIGHDMA; + } else { + rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + if (rc < 0) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) { + dev_err(&pdev->dev, "DMA configuration failed.\n"); + } +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + goto err_out_free_res_4; + } + } + + /* ioremap MMIO region */ + ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE); + if (!ioaddr) { +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) + dev_err(&pdev->dev, "cannot remap MMIO, aborting\n"); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + rc = -EIO; + goto err_out_free_res_4; + } + + /* Identify chip attached to board */ + rtl8169_get_mac_version(tp, ioaddr); + + rtl8169_print_mac_version(tp); + + for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { + if (tp->mcfg == rtl_chip_info[i].mcfg) + break; + } + if (i < 0) { + /* Unknown chip: assume array element #0, original RTL-8169 */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (netif_msg_probe(tp)) { + dev_printk(KERN_DEBUG, &pdev->dev, "unknown chip version, assuming %s\n", rtl_chip_info[0].name); + } +#else + printk("Realtek unknown chip version, assuming %s\n", rtl_chip_info[0].name); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + i++; + } + tp->chipset = i; + + RTL_W8(Cfg9346, Cfg9346_Unlock); + RTL_W8(Config1, RTL_R8(Config1) | PMEnable); + RTL_W8(Config5, RTL_R8(Config5) & PMEStatus); + RTL_W8(Cfg9346, Cfg9346_Lock); + + tp->set_speed = rtl8169_set_speed_xmii; + tp->get_settings = rtl8169_gset_xmii; + tp->phy_reset_enable = rtl8169_xmii_reset_enable; + tp->phy_reset_pending = rtl8169_xmii_reset_pending; + tp->link_ok = rtl8169_xmii_link_ok; + + RTL_W8(Cfg9346, Cfg9346_Unlock); + RTL_W8(Cfg9346, Cfg9346_Lock); + + RTL_NET_DEVICE_OPS(rtl8169_netdev_ops); + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) + SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops); +#endif + + dev->watchdog_timeo = RTL8169_TX_TIMEOUT; + dev->irq = pdev->irq; + dev->base_addr = (unsigned long) ioaddr; + +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_CONFIG(dev, tp, rtl8169_poll, R8169_NAPI_WEIGHT); +#endif + +#ifdef CONFIG_R8169_VLAN + dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + dev->vlan_rx_kill_vid = rtl8169_vlan_rx_kill_vid; +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#endif //CONFIG_R8169_VLAN + + /* There has been a number of reports that using SG/TSO results in + * tx timeouts. However for a lot of people SG/TSO works fine. + * Therefore disable both features by default, but allow users to + * enable them. Use at own risk! + */ + dev->features |= NETIF_F_IP_CSUM; + tp->cp_cmd |= RTL_R16(CPlusCmd); +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) + tp->cp_cmd |= RxChkSum; +#else + dev->features |= NETIF_F_RXCSUM; + dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; + dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | + NETIF_F_HIGHDMA; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; +#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) + dev->hw_features |= NETIF_F_RXALL; + dev->hw_features |= NETIF_F_RXFCS; + + netif_set_gso_max_size(dev, LSO_32K); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) + dev->gso_max_segs = NIC_MAX_PHYS_BUF_COUNT_LSO_64K; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) + dev->gso_min_segs = NIC_MIN_PHYS_BUF_COUNT; +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) +#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) + + tp->max_jumbo_frame_size = Jumbo_Frame_7k; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) + /* MTU range: 60 - hw-specific max */ + dev->min_mtu = ETH_MIN_MTU; + dev->max_mtu = tp->max_jumbo_frame_size; +#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) + + tp->intr_mask = rtl8169_intr_mask; + tp->pci_dev = pdev; + tp->mmio_addr = ioaddr; + tp->align = rtl_cfg_info[ent->driver_data].align; + + spin_lock_init(&tp->lock); + + rtl8169_init_software_variable(dev); + + rtl8169_hw_init(dev); + + rtl8169_hw_reset(dev); + + rtl8169_get_mac_address(dev); + + rtl8169_get_phy_version(tp); + + rtl8169_print_phy_version(tp); + + pci_set_drvdata(pdev, dev); + + rc = register_netdev(dev); + if (rc < 0) + goto err_out_unmap_5; + + printk(KERN_INFO "%s: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.\n", MODULENAME); + + if (netif_msg_probe(tp)) { + printk(KERN_INFO "%s: %s at 0x%lx, " + "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " + "IRQ %d\n", + dev->name, + rtl_chip_info[tp->chipset].name, + dev->base_addr, + dev->dev_addr[0], dev->dev_addr[1], + dev->dev_addr[2], dev->dev_addr[3], + dev->dev_addr[4], dev->dev_addr[5], dev->irq); + } + + rtl8169_link_option((u8*)&autoneg_mode, (u32*)&speed_mode, (u8*)&duplex_mode, (u32*)&advertising_mode); + + tp->autoneg = autoneg_mode; + tp->speed = speed_mode; + tp->duplex = duplex_mode; + tp->advertising = advertising_mode; + tp->fcpause = rtl8169_fc_full; + + printk("%s", GPL_CLAIM); + +out: + return rc; + +err_out_unmap_5: +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_DEL(tp); +#endif + iounmap(ioaddr); +err_out_free_res_4: + pci_release_regions(pdev); +err_out_mwi_3: + pci_clear_mwi(pdev); + pci_disable_device(pdev); +err_out_free_dev_1: + free_netdev(dev); + goto out; +} + +static void __devexit +rtl8169_remove_one(struct pci_dev *pdev) +{ + struct net_device *dev = pci_get_drvdata(pdev); + struct rtl8169_private *tp = netdev_priv(dev); + + assert(dev != NULL); + assert(tp != NULL); + +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_DEL(tp); +#endif + + unregister_netdev(dev); + rtl8169_release_board(pdev, dev, tp->mmio_addr); + pci_set_drvdata(pdev, NULL); +} + +static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, + struct net_device *dev) +{ + unsigned int mtu = dev->mtu; + + tp->rx_buf_sz = (mtu > ETH_DATA_LEN) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE; +} + +static int rtl8169_open(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct pci_dev *pdev = tp->pci_dev; + unsigned long flags; + int retval; + + rtl8169_set_rxbufsize(tp, dev); + + retval = -ENOMEM; + + /* + * Rx and Tx descriptors needs 256 bytes alignment. + * pci_alloc_consistent provides more. + */ + tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, + &tp->TxPhyAddr); + if (!tp->TxDescArray) + goto err_free_all_allocated_mem; + + tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, + &tp->RxPhyAddr); + if (!tp->RxDescArray) + goto err_free_all_allocated_mem; + + retval = rtl8169_init_ring(dev); + if (retval < 0) + goto err_free_all_allocated_mem; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + INIT_WORK(&tp->task, rtl8169_reset_task, dev); +#else + INIT_DELAYED_WORK(&tp->task, rtl8169_reset_task); +#endif + + pci_set_master(pdev); + +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_ENABLE(dev, &tp->napi); +#endif + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_hw_init(dev); + + rtl8169_hw_reset(dev); + + rtl8169_phy_power_up(dev); + + rtl8169_hw_phy_config(dev); + + rtl8169_hw_start(dev); + + if (tp->esd_flag == 0) { + rtl8169_request_timer(dev); + rtl8169_request_esd_timer(dev); + } + + rtl8169_check_link_status(dev, tp, tp->mmio_addr); + + rtl8169_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + + spin_unlock_irqrestore(&tp->lock, flags); + + retval = request_irq(dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev); + + if (retval < 0) + goto err_free_all_allocated_mem; + +out: + return retval; + +err_free_all_allocated_mem: + if (tp->RxDescArray != NULL) { + pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, + tp->RxPhyAddr); + tp->RxDescArray = NULL; + } + + if (tp->TxDescArray != NULL) { + pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, + tp->TxPhyAddr); + tp->TxDescArray = NULL; + } + + goto out; +} + +static void rtl8169_nic_reset(void __iomem *ioaddr) +{ + int i; + + RTL_W32(RxConfig, (RX_DMA_BURST << RxCfgDMAShift)); + + mdelay(1); + + /* Soft reset the chip. */ + RTL_W8(ChipCmd, CmdReset); + + /* Check that the chip has finished the reset. */ + for (i = 1000; i > 0; i--) { + if ((RTL_R8(ChipCmd) & CmdReset) == 0) + break; + + udelay(100); + } +} + +static void +rtl8169_hw_clear_timer_int(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + + RTL_W32(TimeInt0, 0x0000); +} + +static void rtl8169_hw_reset(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + + /* Disable interrupts */ + rtl8169_irq_mask_and_ack(ioaddr); + + rtl8169_hw_clear_timer_int(dev); + + /* Reset the chipset */ + rtl8169_nic_reset(ioaddr); + + /* Disable interrupts */ + /* RTL8169 may enable interrupt after reset */ + rtl8169_irq_mask_and_ack(ioaddr); +} + +static void +rtl8169_hw_set_rx_packet_filter(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + u32 mc_filter[2]; /* Multicast hash filter */ + int rx_mode; + u32 tmp = 0; + + if (dev->flags & IFF_PROMISC) { + /* Unconditionally log net taps. */ + + if (netif_msg_link(tp)) { + printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", + dev->name); + } + rx_mode = + AcceptBroadcast | AcceptMulticast | AcceptMyPhys | + AcceptAllPhys; + mc_filter[1] = mc_filter[0] = 0xffffffff; + } else if ((netdev_mc_count(dev) > multicast_filter_limit) + || (dev->flags & IFF_ALLMULTI)) { + /* Too many to filter perfectly -- accept all multicasts. */ + + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; + mc_filter[1] = mc_filter[0] = 0xffffffff; + } else { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) + struct dev_mc_list *mclist; + int i; + + rx_mode = AcceptBroadcast | AcceptMyPhys; + mc_filter[1] = mc_filter[0] = 0; + for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; + i++, mclist = mclist->next) { + int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; + mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); + rx_mode |= AcceptMulticast; + } +#else + struct netdev_hw_addr *ha; + + rx_mode = AcceptBroadcast | AcceptMyPhys; + mc_filter[1] = mc_filter[0] = 0; + netdev_for_each_mc_addr(ha, dev) { + int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; + mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); + rx_mode |= AcceptMulticast; + } +#endif + } + + if (dev->features & NETIF_F_RXALL) + rx_mode |= (AcceptErr | AcceptRunt); + + tmp = rtl8169_rx_config | rx_mode | + (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); + + RTL_W32(RxConfig, tmp); + RTL_W32(MAR0 + 0, mc_filter[0]); + RTL_W32(MAR0 + 4, mc_filter[1]); +} + +static void +rtl8169_set_rx_mode(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_hw_set_rx_packet_filter(dev); + + spin_unlock_irqrestore(&tp->lock, flags); +} + +/** + * rtl8169_get_stats - Get rtl8169 read/write statistics + * @dev: The Ethernet Device to get statistics for + * + * Get TX/RX statistics for rtl8169 + */ +static struct net_device_stats *rtl8169_get_stats(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + unsigned long flags; + + if (netif_running(dev)) { + spin_lock_irqsave(&tp->lock, flags); + tp->stats.rx_missed_errors += RTL_R32(RxMissed); + RTL_W32(RxMissed, 0); + spin_unlock_irqrestore(&tp->lock, flags); + } + + return &RTLDEV->stats; +} + +static void rtl8169_hw_start(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + struct pci_dev *pdev = tp->pci_dev; + u8 options1, options2; + + RTL_W32(RxConfig, (RX_DMA_BURST << RxCfgDMAShift)); + + rtl8169_hw_reset(dev); + + dprintk("Set PCI Latency=0x40\n"); + pci_write_config_byte(tp->pci_dev, PCI_LATENCY_TIMER, 0x40); + + RTL_W8(Cfg9346, Cfg9346_Unlock); + + RTL_W8(Reserved1, Reserved1_data); + + tp->cp_cmd |= PCIMulRW; + RTL_W16(CPlusCmd, tp->cp_cmd); + pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08); + + if (tp->mcfg == CFG_METHOD_2) + tp->cp_cmd |= EnAnaPLL; + else + tp->cp_cmd &= ~EnAnaPLL; + + pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); + + /* + * Undocumented corner. Supposedly: + */ + RTL_W16(IntrMitigate, 0x0000); + + /* + * Magic spell: some iop3xx ARM board needs the TxDescAddrHigh + * register to be written before TxDescAddrLow to work. + * Switching from MMIO to I/O access fixes the issue as well. + */ + RTL_W32(TxDescStartAddrLow, ((u64) tp->TxPhyAddr & DMA_32BIT_MASK)); + RTL_W32(RxDescAddrLow, ((u64) tp->RxPhyAddr & DMA_32BIT_MASK)); + RTL_W32(TxDescStartAddrHigh, ((u64) tp->TxPhyAddr >> 32)); + RTL_W32(RxDescAddrHigh, ((u64) tp->RxPhyAddr >> 32)); + + RTL_W32(RxMissed, 0); + + /* no early-rx interrupts */ + RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) + RTL_W16(CPlusCmd, tp->cp_cmd); +#else + rtl8169_hw_set_features(dev, dev->features); +#endif + + RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); + + RTL_W16(RxMaxSize, tp->rx_buf_sz); + + /* Set Rx packet filter */ + rtl8169_hw_set_rx_packet_filter(dev); + + /* Set DMA burst size and Interframe Gap Time */ + rtl8169_set_tx_config(dev); + + RTL_W8(Cfg9346, Cfg9346_Lock); + + rtl8169_hw_clear_timer_int(dev); + + /* Clear the interrupt status. */ + RTL_W16(IntrStatus, 0xFFFF); + + /* Enable all known interrupts by setting the interrupt mask. */ + RTL_W16(IntrMask, rtl8169_intr_mask); + + if (tp->link_ok(dev)) + netif_wake_queue(dev); + else + netif_stop_queue(dev); + + if (!tp->pci_cfg_is_read) { + pci_read_config_byte(pdev, PCI_COMMAND, &tp->pci_cfg_space.cmd); + pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &tp->pci_cfg_space.cls); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_0, &tp->pci_cfg_space.io_base_l); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_0 + 2, &tp->pci_cfg_space.io_base_h); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_2, &tp->pci_cfg_space.mem_base_l); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_2 + 2, &tp->pci_cfg_space.mem_base_h); + pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tp->pci_cfg_space.ilr); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_4, &tp->pci_cfg_space.resv_0x20_l); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_4 + 2, &tp->pci_cfg_space.resv_0x20_h); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_5, &tp->pci_cfg_space.resv_0x24_l); + pci_read_config_word(pdev, PCI_BASE_ADDRESS_5 + 2, &tp->pci_cfg_space.resv_0x24_h); + + tp->pci_cfg_is_read = 1; + } + + options1 = RTL_R8(Config3); + options2 = RTL_R8(Config5); + + if ((options1 & LinkUp) || (options1 & MagicPacket) || (options2 & UWF) || (options2 & BWF) || (options2 & MWF)) + tp->wol_enabled = WOL_ENABLED; + else + tp->wol_enabled = WOL_DISABLED; + + device_set_wakeup_enable(&tp->pci_dev->dev, tp->wol_enabled); + + udelay(10); +} + +static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) +{ + struct rtl8169_private *tp = netdev_priv(dev); + int ret = 0; + unsigned long flags; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) + if (new_mtu < ETH_MIN_MTU) + return -EINVAL; + else if (new_mtu > tp->max_jumbo_frame_size) + new_mtu = tp->max_jumbo_frame_size; +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) + + spin_lock_irqsave(&tp->lock, flags); + dev->mtu = new_mtu; + spin_unlock_irqrestore(&tp->lock, flags); + + if (!netif_running(dev)) + goto out; + + rtl8169_down(dev); + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_set_rxbufsize(tp, dev); + + ret = rtl8169_init_ring(dev); + + if (ret < 0) { + spin_unlock_irqrestore(&tp->lock, flags); + goto err_out; + } + +#ifdef CONFIG_R8169_NAPI +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + RTL_NAPI_ENABLE(dev, &tp->napi); +#endif +#endif//CONFIG_R8169_NAPI + + rtl8169_hw_start(dev); + spin_unlock_irqrestore(&tp->lock, flags); + rtl8169_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + + mod_timer(&tp->link_timer, jiffies + RTL8169_PHY_TIMEOUT); + mod_timer(&tp->esd_timer, jiffies + RTL8169_ESD_TIMEOUT); +out: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) + netdev_update_features(dev); +#endif + +err_out: + return ret; +} + +static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) +{ + desc->addr = 0x0badbadbadbadbadull; + desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); +} + +static void rtl8169_free_rx_skb(struct rtl8169_private *tp, + struct sk_buff **sk_buff, struct RxDesc *desc) +{ + struct pci_dev *pdev = tp->pci_dev; + + dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz, + DMA_FROM_DEVICE); + dev_kfree_skb(*sk_buff); + *sk_buff = NULL; + rtl8169_make_unusable_by_asic(desc); +} + +static inline void rtl8169_mark_to_asic(struct RxDesc *desc, u32 rx_buf_sz) +{ + u32 eor = le32_to_cpu(desc->opts1) & RingEnd; + + desc->opts1 = cpu_to_le32(DescOwn | eor | rx_buf_sz); +} + +static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, + u32 rx_buf_sz) +{ + desc->addr = cpu_to_le64(mapping); + wmb(); + rtl8169_mark_to_asic(desc, rx_buf_sz); +} + +static int rtl8169_alloc_rx_skb(struct rtl8169_private *tp, + struct sk_buff **sk_buff, + struct RxDesc *desc, + int rx_buf_sz, + unsigned int align, + u8 in_intr) +{ + struct sk_buff *skb; + dma_addr_t mapping; + int ret = 0; + + if (in_intr) + skb = RTL_ALLOC_SKB_INTR(tp, rx_buf_sz + align); + else + skb = dev_alloc_skb(rx_buf_sz + align); + + if (unlikely(!skb)) + goto err_out; + + skb_reserve(skb, align - ((align - 1) & (uintptr_t)skb->data)); + + mapping = dma_map_single(&tp->pci_dev->dev, skb->data, rx_buf_sz, + DMA_FROM_DEVICE); + if (unlikely(dma_mapping_error(&tp->pci_dev->dev, mapping))) { + if (unlikely(net_ratelimit())) + netif_err(tp, drv, tp->dev, "Failed to map RX DMA!\n"); + goto err_out; + } + + *sk_buff = skb; + rtl8169_map_to_asic(desc, mapping, rx_buf_sz); + +out: + return ret; + +err_out: + if (skb) + dev_kfree_skb(skb); + ret = -ENOMEM; + rtl8169_make_unusable_by_asic(desc); + goto out; +} + +static void rtl8169_rx_clear(struct rtl8169_private *tp) +{ + int i; + + for (i = 0; i < NUM_RX_DESC; i++) { + if (tp->Rx_skbuff[i]) { + rtl8169_free_rx_skb(tp, tp->Rx_skbuff + i, + tp->RxDescArray + i); + } + } +} + +static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, + u32 start, u32 end, u8 in_intr) +{ + u32 cur; + + for (cur = start; end - cur > 0; cur++) { + int ret, i = cur % NUM_RX_DESC; + + if (tp->Rx_skbuff[i]) + continue; + + ret = rtl8169_alloc_rx_skb(tp, tp->Rx_skbuff + i, + tp->RxDescArray + i, + tp->rx_buf_sz, tp->align, + in_intr); + if (ret < 0) + break; + } + return cur - start; +} + +static inline void rtl8169_mark_as_last_descriptor(struct RxDesc *desc) +{ + desc->opts1 |= cpu_to_le32(RingEnd); +} + +static void rtl8169_init_ring_indexes(struct rtl8169_private *tp) +{ + tp->dirty_tx = tp->dirty_rx = tp->cur_tx = tp->cur_rx = 0; +} + +static void +rtl8169_tx_desc_init(struct rtl8169_private *tp) +{ + int i = 0; + + memset(tp->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc)); + + for (i = 0; i < NUM_TX_DESC; i++) { + if (i == (NUM_TX_DESC - 1)) + tp->TxDescArray[i].opts1 = cpu_to_le32(RingEnd); + } +} + +static void +rtl8169_rx_desc_init(struct rtl8169_private *tp) +{ + memset(tp->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc)); +} + +static int rtl8169_init_ring(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + rtl8169_init_ring_indexes(tp); + + memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); + memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); + + rtl8169_tx_desc_init(tp); + rtl8169_rx_desc_init(tp); + + if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, 0) != NUM_RX_DESC) + goto err_out; + + rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); + + return 0; + +err_out: + rtl8169_rx_clear(tp); + return -ENOMEM; +} + +static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, + struct TxDesc *desc) +{ + unsigned int len = tx_skb->len; + + dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, DMA_TO_DEVICE); + + desc->opts1 = cpu_to_le32(RTK_MAGIC_DEBUG_VALUE); + desc->opts2 = 0x00; + desc->addr = 0x00; + tx_skb->len = 0; +} + +static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start, + unsigned int n) +{ + unsigned int i; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) + struct net_device *dev = tp->dev; +#endif + + for (i = 0; i < n; i++) { + unsigned int entry = (start + i) % NUM_TX_DESC; + struct ring_info *tx_skb = tp->tx_skb + entry; + unsigned int len = tx_skb->len; + + if (len) { + struct sk_buff *skb = tx_skb->skb; + + rtl8169_unmap_tx_skb(tp->pci_dev, tx_skb, + tp->TxDescArray + entry); + if (skb) { + RTLDEV->stats.tx_dropped++; + dev_kfree_skb_any(skb); + tx_skb->skb = NULL; + } + } + } +} + +static void +rtl8169_tx_clear(struct rtl8169_private *tp) +{ + rtl8169_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC); + tp->cur_tx = tp->dirty_tx = 0; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8169_schedule_work(struct net_device *dev, void (*task)(void *)) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + struct rtl8169_private *tp = netdev_priv(dev); + + INIT_WORK(&tp->task, task, dev); + schedule_delayed_work(&tp->task, 4); +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) +} + +#define rtl8169_cancel_schedule_work(a) + +#else +static void rtl8169_schedule_work(struct net_device *dev, work_func_t task) +{ + struct rtl8169_private *tp = netdev_priv(dev); + + INIT_DELAYED_WORK(&tp->task, task); + schedule_delayed_work(&tp->task, 4); +} + +static void rtl8169_cancel_schedule_work(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct work_struct *work = &tp->task.work; + + if (!work->func) return; + + cancel_delayed_work_sync(&tp->task); +} +#endif + +static void rtl8169_wait_for_quiescence(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + + synchronize_irq(dev->irq); + + /* Wait for any pending NAPI task to complete */ +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_DISABLE(dev, &tp->napi); +#endif + + rtl8169_irq_mask_and_ack(ioaddr); + +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_ENABLE(dev, &tp->napi); +#endif +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8169_reinit_task(void *_data) +#else +static void rtl8169_reinit_task(struct work_struct *work) +#endif +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + struct net_device *dev = _data; +#else + struct rtl8169_private *tp = + container_of(work, struct rtl8169_private, task.work); + struct net_device *dev = tp->dev; +#endif + int ret; + + if (netif_running(dev)) { + rtl8169_wait_for_quiescence(dev); + rtl8169_close(dev); + } + + ret = rtl8169_open(dev); + if (unlikely(ret < 0)) { + if (unlikely(net_ratelimit())) { + struct rtl8169_private *tp = netdev_priv(dev); + + if (netif_msg_drv(tp)) { + printk(PFX KERN_ERR + "%s: reinit failure (status = %d)." + " Rescheduling.\n", dev->name, ret); + } + } + rtl8169_schedule_work(dev, rtl8169_reinit_task); + } +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +static void rtl8169_reset_task(void *_data) +{ + struct net_device *dev = _data; + struct rtl8169_private *tp = netdev_priv(dev); +#else +static void rtl8169_reset_task(struct work_struct *work) +{ + struct rtl8169_private *tp = + container_of(work, struct rtl8169_private, task.work); + struct net_device *dev = tp->dev; +#endif + u32 budget = ~(u32)0; + unsigned long flags; + + if (!netif_running(dev)) + return; + + rtl8169_wait_for_quiescence(dev); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + rtl8169_rx_interrupt(dev, tp, tp->mmio_addr, &budget); +#else + rtl8169_rx_interrupt(dev, tp, tp->mmio_addr, budget); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_tx_clear(tp); + + if (tp->dirty_rx == tp->cur_rx) { + rtl8169_rx_clear(tp); + rtl8169_init_ring(dev); + rtl8169_hw_start(dev); + netif_wake_queue(dev); + rtl8169_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + spin_unlock_irqrestore(&tp->lock, flags); + } else { + spin_unlock_irqrestore(&tp->lock, flags); + if (unlikely(net_ratelimit())) { + struct rtl8169_private *tp = netdev_priv(dev); + + if (netif_msg_intr(tp)) { + printk(PFX KERN_EMERG + "%s: Rx buffers shortage\n", dev->name); + } + } + rtl8169_schedule_work(dev, rtl8169_reset_task); + } +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) +static void rtl8169_tx_timeout(struct net_device *dev, unsigned int txqueue) +#else +static void rtl8169_tx_timeout(struct net_device *dev) +#endif +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); + netif_stop_queue(dev); + rtl8169_hw_reset(dev); + spin_unlock_irqrestore(&tp->lock, flags); + + /* Let's wait a bit while any (async) irq lands on */ + rtl8169_schedule_work(dev, rtl8169_reset_task); +} + +static u32 rtl8169_get_txd_opts1(u32 opts1, u32 len, unsigned int entry) +{ + u32 status = opts1 | len; + + if (entry == NUM_TX_DESC - 1) + status |= RingEnd; + + return status; +} + +static int rtl8169_xmit_frags(struct rtl8169_private *tp, + struct sk_buff *skb, + const u32 *opts) +{ + struct skb_shared_info *info = skb_shinfo(skb); + unsigned int cur_frag, entry; + struct TxDesc *txd = NULL; + const unsigned char nr_frags = info->nr_frags; + + entry = tp->cur_tx; + for (cur_frag = 0; cur_frag < nr_frags; cur_frag++) { + skb_frag_t *frag = info->frags + cur_frag; + dma_addr_t mapping; + u32 status, len; + void *addr; + + entry = (entry + 1) % NUM_TX_DESC; + + txd = tp->TxDescArray + entry; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) + len = frag->size; + addr = ((void *) page_address(frag->page)) + frag->page_offset; +#else + len = skb_frag_size(frag); + addr = skb_frag_address(frag); +#endif + mapping = dma_map_single(&tp->pci_dev->dev, addr, len, DMA_TO_DEVICE); + + if (unlikely(dma_mapping_error(&tp->pci_dev->dev, mapping))) { + if (unlikely(net_ratelimit())) + netif_err(tp, drv, tp->dev, + "Failed to map TX fragments DMA!\n"); + goto err_out; + } + + /* anti gcc 2.95.3 bugware (sic) */ + status = rtl8169_get_txd_opts1(opts[1], len, entry);; + if (cur_frag == (nr_frags - 1)) { + tp->tx_skb[entry].skb = skb; + status |= LastFrag; + } + + txd->addr = cpu_to_le64(mapping); + + tp->tx_skb[entry].len = len; + + txd->opts2 = cpu_to_le32(opts[1]); + wmb(); + txd->opts1 = cpu_to_le32(status); + } + + return cur_frag; + +err_out: + rtl8169_tx_clear_range(tp, tp->cur_tx + 1, cur_frag); + return -EIO; +} + +static bool rtl8169_skb_pad(struct sk_buff *skb) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) + if (skb_padto(skb, ETH_ZLEN)) + return false; + skb_put(skb, ETH_ZLEN - skb->len); + return true; +#else + return !eth_skb_pad(skb); +#endif +} + +static inline bool +rtl8169_tx_csum(struct sk_buff *skb, + struct net_device *dev, + u32 *opts) +{ + struct rtl8169_private *tp = netdev_priv(dev); + u32 csum_cmd = 0; + u8 sw_calc_csum = FALSE; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + const struct iphdr *ip = skb->nh.iph; +#else + const struct iphdr *ip = ip_hdr(skb); +#endif + + if (skb->ip_summed == CHECKSUM_PARTIAL) { + if (ip->protocol == IPPROTO_TCP) + csum_cmd = IPCS | TCPCS; + else if (ip->protocol == IPPROTO_UDP) + csum_cmd = IPCS | UDPCS; + + if (csum_cmd == 0) { + sw_calc_csum = TRUE; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + WARN_ON(1); /* we need a WARN() */ +#endif + } + } + + opts[0] |= csum_cmd; + + if (tp->UseSwPaddingShortPkt && skb->len < ETH_ZLEN) + if (!rtl8169_skb_pad(skb)) + return false; + + if (sw_calc_csum) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,7) + skb_checksum_help(&skb, 0); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) + skb_checksum_help(skb, 0); +#else + skb_checksum_help(skb); +#endif + } + + return true; +} + +static bool rtl8169_tx_slots_avail(struct rtl8169_private *tp, + unsigned int nr_frags) +{ + unsigned int slots_avail = tp->dirty_tx + NUM_TX_DESC - tp->cur_tx; + + /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */ + return slots_avail > nr_frags; +} + +static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + unsigned int entry; + struct TxDesc *txd; + void __iomem *ioaddr = tp->mmio_addr; + dma_addr_t mapping; + u32 status, len; + u32 opts[2]; + netdev_tx_t ret = NETDEV_TX_OK; + unsigned long flags, large_send; + int frags; + + spin_lock_irqsave(&tp->lock, flags); + + if (unlikely(!rtl8169_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) { + if (netif_msg_drv(tp)) { + printk(KERN_ERR + "%s: BUG! Tx Ring full when queue awake!\n", + dev->name); + } + goto err_stop; + } + + entry = tp->cur_tx % NUM_TX_DESC; + txd = tp->TxDescArray + entry; + + if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) { + if (netif_msg_drv(tp)) { + printk(KERN_ERR + "%s: BUG! Tx Desc is own by hardware!\n", + dev->name); + } + goto err_stop; + } + + opts[0] = DescOwn; + opts[1] = rtl8169_tx_vlan_tag(tp, skb); + + large_send = 0; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + if (dev->features & NETIF_F_TSO) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) + u32 mss = skb_shinfo(skb)->tso_size; +#else + u32 mss = skb_shinfo(skb)->gso_size; +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) + + if (mss) { + opts[0] |= LargeSend | (min(mss, MSS_MAX) << MSSShift); + large_send = 1; + } + } +#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + + if (large_send == 0) { + if (unlikely(!rtl8169_tx_csum(skb, dev, opts))) + goto err_dma_0; + } + + frags = rtl8169_xmit_frags(tp, skb, opts); + if (unlikely(frags < 0)) + goto err_dma_0; + if (frags) { + len = skb_headlen(skb); + opts[0] |= FirstFrag; + } else { + len = skb->len; + tp->tx_skb[entry].skb = skb; + + opts[0] |= FirstFrag | LastFrag; + } + + mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(&tp->pci_dev->dev, mapping))) { + if (unlikely(net_ratelimit())) + netif_err(tp, drv, dev, "Failed to map TX DMA!\n"); + goto err_dma_1; + } + + /* anti gcc 2.95.3 bugware (sic) */ + status = rtl8169_get_txd_opts1(opts[0], len, entry); + + txd->addr = cpu_to_le64(mapping); + + tp->tx_skb[entry].len = len; + + txd->opts2 = cpu_to_le32(opts[1]); + wmb(); + txd->opts1 = cpu_to_le32(status); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) + dev->trans_start = jiffies; +#else + skb_tx_timestamp(skb); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) + + tp->cur_tx += frags + 1; + + smp_wmb(); + + RTL_W8(TxPoll, NPQ); /* set polling bit */ + + if (!rtl8169_tx_slots_avail(tp, MAX_SKB_FRAGS)) { + netif_stop_queue(dev); + smp_rmb(); + if (rtl8169_tx_slots_avail(tp, MAX_SKB_FRAGS)) + netif_wake_queue(dev); + } + + spin_unlock_irqrestore(&tp->lock, flags); + +out: + return ret; + +err_dma_1: + tp->tx_skb[entry].skb = NULL; + rtl8169_tx_clear_range(tp, tp->cur_tx + 1, frags); +err_dma_0: + RTLDEV->stats.tx_dropped++; + spin_unlock_irqrestore(&tp->lock, flags); + dev_kfree_skb_any(skb); + ret = NETDEV_TX_OK; + goto out; +err_stop: + netif_stop_queue(dev); + ret = NETDEV_TX_BUSY; + RTLDEV->stats.tx_dropped++; + + spin_unlock_irqrestore(&tp->lock, flags); + goto out; +} + +static void rtl8169_pcierr_interrupt(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct pci_dev *pdev = tp->pci_dev; + void __iomem *ioaddr = tp->mmio_addr; + u16 pci_status, pci_cmd; + + pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); + pci_read_config_word(pdev, PCI_STATUS, &pci_status); + + if (netif_msg_intr(tp)) { + printk(KERN_ERR + "%s: PCI error (cmd = 0x%04x, status = 0x%04x).\n", + dev->name, pci_cmd, pci_status); + } + + /* + * The recovery sequence below admits a very elaborated explanation: + * - it seems to work; + * - I did not see what else could be done; + * - it makes iop3xx happy. + * + * Feel free to adjust to your needs. + */ + + pci_write_config_word(pdev, PCI_COMMAND, pci_cmd | PCI_COMMAND_SERR | PCI_COMMAND_PARITY); + + pci_write_config_word(pdev, PCI_STATUS, + pci_status & (PCI_STATUS_DETECTED_PARITY | + PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_REC_MASTER_ABORT | + PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_SIG_TARGET_ABORT)); + + /* The infamous DAC f*ckup only happens at boot time */ + if ((tp->cp_cmd & PCIDAC) && !tp->dirty_rx && !tp->cur_rx) { + if (netif_msg_intr(tp)) + printk(KERN_INFO "%s: disabling PCI DAC.\n", dev->name); + tp->cp_cmd &= ~PCIDAC; + RTL_W16(CPlusCmd, tp->cp_cmd); + dev->features &= ~NETIF_F_HIGHDMA; + } + + rtl8169_hw_reset(dev); + + rtl8169_schedule_work(dev, rtl8169_reinit_task); +} + +static void +rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp, + void __iomem *ioaddr) +{ + unsigned int dirty_tx, tx_left; + + assert(dev != NULL); + assert(tp != NULL); + assert(ioaddr != NULL); + + dirty_tx = tp->dirty_tx; + smp_rmb(); + tx_left = tp->cur_tx - dirty_tx; + + while (tx_left > 0) { + unsigned int entry = dirty_tx % NUM_TX_DESC; + struct ring_info *tx_skb = tp->tx_skb + entry; + u32 len = tx_skb->len; + u32 status; + + rmb(); + status = le32_to_cpu(tp->TxDescArray[entry].opts1); + if (status & DescOwn) + break; + + RTLDEV->stats.tx_bytes += len; + RTLDEV->stats.tx_packets++; + + rtl8169_unmap_tx_skb(tp->pci_dev, tx_skb, tp->TxDescArray + entry); + + if (tx_skb->skb!=NULL) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) + dev_consume_skb_any(tx_skb->skb); +#else + dev_kfree_skb_any(tx_skb->skb); +#endif + tx_skb->skb = NULL; + } + dirty_tx++; + tx_left--; + } + + if (tp->dirty_tx != dirty_tx) { + tp->dirty_tx = dirty_tx; + smp_wmb(); + if (netif_queue_stopped(dev) && + (rtl8169_tx_slots_avail(tp, MAX_SKB_FRAGS))) { + netif_wake_queue(dev); + } + smp_rmb(); + } +} + +static inline int rtl8169_fragmented_frame(u32 status) +{ + return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); +} + +static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc) +{ + u32 opts1 = le32_to_cpu(desc->opts1); + u32 status = opts1 & RxProtoMask; + + if (((status == RxProtoTCP) && !(opts1 & (TCPFail | IPFail))) || + ((status == RxProtoUDP) && !(opts1 & (UDPFail | IPFail)))) + skb->ip_summed = CHECKSUM_UNNECESSARY; + else + skb->ip_summed = CHECKSUM_NONE; +} + +static inline int rtl8169_try_rx_copy(struct rtl8169_private *tp, + struct sk_buff **sk_buff, + int pkt_size, + struct RxDesc *desc, int rx_buf_sz, + unsigned int align) +{ + int ret = -1; + + if (pkt_size < rx_copybreak) { + struct sk_buff *skb; + + skb = RTL_ALLOC_SKB_INTR(tp, pkt_size + NET_IP_ALIGN); + if (skb) { + u8 *data; + + data = sk_buff[0]->data; + skb_reserve(skb, NET_IP_ALIGN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) + prefetch(data - NET_IP_ALIGN); +#endif + eth_copy_and_sum(skb, data, pkt_size, 0); + *sk_buff = skb; + rtl8169_mark_to_asic(desc, rx_buf_sz); + ret = 0; + } + } + return ret; +} + +static int +rtl8169_rx_interrupt(struct net_device *dev, + struct rtl8169_private *tp, + void __iomem *ioaddr, napi_budget budget) +{ + unsigned int cur_rx, rx_left; + unsigned int delta, count = 0; + unsigned int entry; + struct RxDesc *desc; + u32 status; + u32 rx_quota; + + assert(dev != NULL); + assert(tp != NULL); + assert(ioaddr != NULL); + + if (tp->RxDescArray == NULL) + goto rx_out; + + rx_quota = RTL_RX_QUOTA(budget); + cur_rx = tp->cur_rx; + entry = cur_rx % NUM_RX_DESC; + desc = tp->RxDescArray + entry; + rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; + rx_left = rtl8169_rx_quota(rx_left, (u32) rx_quota); + + for (; rx_left > 0; rx_left--) { + rmb(); + status = le32_to_cpu(desc->opts1); + if (status & DescOwn) + break; + + if (unlikely(status & RxRES)) { + if (netif_msg_rx_err(tp)) { + printk(KERN_INFO + "%s: Rx ERROR. status = %08x\n", + dev->name, status); + } + RTLDEV->stats.rx_errors++; + + if (status & (RxRWT | RxRUNT)) + RTLDEV->stats.rx_length_errors++; + if (status & RxCRC) + RTLDEV->stats.rx_crc_errors++; + if (dev->features & NETIF_F_RXALL) + goto process_pkt; + rtl8169_mark_to_asic(desc, tp->rx_buf_sz); + } else { + struct sk_buff *skb; + int pkt_size ; + +process_pkt: + if (likely(!(dev->features & NETIF_F_RXFCS))) + pkt_size = (status & 0x00003fff) - 4; + else + pkt_size = status & 0x00003fff; + + /* + * The driver does not support incoming fragmented + * frames. They are seen as a symptom of over-mtu + * sized frames. + */ + if (unlikely(rtl8169_fragmented_frame(status))) { + RTLDEV->stats.rx_dropped++; + RTLDEV->stats.rx_length_errors++; + rtl8169_mark_to_asic(desc, tp->rx_buf_sz); + continue; + } + + skb = tp->Rx_skbuff[entry]; + + dma_sync_single_for_cpu(&tp->pci_dev->dev, + le64_to_cpu(desc->addr), tp->rx_buf_sz, + DMA_FROM_DEVICE); + + if (rtl8169_try_rx_copy(tp, &skb, pkt_size, + desc, tp->rx_buf_sz, tp->align)) { + tp->Rx_skbuff[entry] = NULL; + dma_unmap_single(&tp->pci_dev->dev, le64_to_cpu(desc->addr), + tp->rx_buf_sz, DMA_FROM_DEVICE); + } else { + dma_sync_single_for_device(&tp->pci_dev->dev, le64_to_cpu(desc->addr), + tp->rx_buf_sz, DMA_FROM_DEVICE); + } + + if (tp->cp_cmd & RxChkSum) + rtl8169_rx_csum(skb, desc); + + skb->dev = dev; + skb_put(skb, pkt_size); + skb->protocol = eth_type_trans(skb, dev); + + if (skb->pkt_type == PACKET_MULTICAST) + RTLDEV->stats.multicast++; + + if (rtl8169_rx_vlan_skb(tp, desc, skb) < 0) + rtl8169_rx_skb(skb); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) + dev->last_rx = jiffies; +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) + RTLDEV->stats.rx_bytes += pkt_size; + RTLDEV->stats.rx_packets++; + } + + cur_rx++; + entry = cur_rx % NUM_RX_DESC; + desc = tp->RxDescArray + entry; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) + prefetch(desc); +#endif + } + + count = cur_rx - tp->cur_rx; + tp->cur_rx = cur_rx; + + delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, 1); + if (!delta && count && netif_msg_intr(tp)) + printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); + tp->dirty_rx += delta; + + /* + * FIXME: until there is periodic timer to try and refill the ring, + * a temporary shortage may definitely kill the Rx process. + * - disable the asic to try and avoid an overflow and kick it again + * after refill ? + * - how do others driver handle this condition (Uh oh...). + */ + if ((tp->dirty_rx + NUM_RX_DESC == tp->cur_rx) && netif_msg_intr(tp)) + printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name); + +rx_out: + return count; +} + +/* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +#else +static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) +#endif +{ + struct net_device *dev = (struct net_device *) dev_instance; + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + int status; + int handled = IRQ_NONE; + + do { + status = RTL_R16(IntrStatus); + + /* hotplug/major error/no more work/shared irq */ + if ((status == 0xFFFF) || !status) + break; + + status &= tp->intr_mask; + + if (!(status & rtl8169_intr_mask)) + break; + + handled = 1; + + RTL_W16(IntrStatus, + (status & RxFIFOOver) ? (status | RxOverflow) : status); + + if (unlikely(status & SYSErr)) { + rtl8169_pcierr_interrupt(dev); + break; + } + + if (status & LinkChg) + rtl8169_check_link_status(dev, tp, ioaddr); + +#ifdef CONFIG_R8169_NAPI + if (status & rtl8169_napi_event) { + RTL_W16(IntrMask, rtl8169_intr_mask & ~rtl8169_napi_event); + tp->intr_mask = rtl8169_intr_mask & ~rtl8169_napi_event; + + if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &tp->napi))) { + __RTL_NETIF_RX_SCHEDULE(dev, &tp->napi); + } else if (netif_msg_intr(tp)) { + printk(KERN_INFO "%s: interrupt %04x in poll\n", + dev->name, status); + } + } + break; +#else + u32 budget = ~(u32)0; + + /* Tx interrupt */ + rtl8169_tx_interrupt(dev, tp, ioaddr); + + /* Rx interrupt */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + rtl8169_rx_interrupt(dev, tp, tp->mmio_addr, &budget); +#else + rtl8169_rx_interrupt(dev, tp, tp->mmio_addr, budget); +#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + + RTL_W16(IntrMask, rtl8169_intr_mask); +#endif + } while (false); + + return IRQ_RETVAL(handled); +} + +#ifdef CONFIG_R8169_NAPI +static int rtl8169_poll(napi_ptr napi, napi_budget budget) +{ + struct rtl8169_private *tp = RTL_GET_PRIV(napi, struct rtl8169_private); + void __iomem *ioaddr = tp->mmio_addr; + RTL_GET_NETDEV(tp) + unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); + unsigned int work_done; + unsigned long flags; + + spin_lock_irqsave(&tp->lock, flags); + rtl8169_tx_interrupt(dev, tp, ioaddr); + spin_unlock_irqrestore(&tp->lock, flags); + + work_done = rtl8169_rx_interrupt(dev, tp, ioaddr, budget); + + RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); + + if (work_done < work_to_do) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) + if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; +#else + RTL_NETIF_RX_COMPLETE(dev, napi, work_done); +#endif + tp->intr_mask = rtl8169_intr_mask; + /* + * 20040426: the barrier is not strictly required but the + * behavior of the irq handler could be less predictable + * without it. Btw, the lack of flush for the posted pci + * write is safe - FR + */ + smp_wmb(); + RTL_W16(IntrMask, rtl8169_intr_mask); + } + + return RTL_NAPI_RETURN_VALUE; +} +#endif//CONFIG_R8169_NAPI + +static void rtl8169_down(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; + unsigned long flags; +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) + unsigned int poll_locked = 0; +#endif + + + rtl8169_delete_timer(dev); + rtl8169_delete_esd_timer(dev, &tp->esd_timer); + + netif_stop_queue(dev); + +#ifdef CONFIG_R8169_NAPI + RTL_NAPI_DISABLE(dev, &tp->napi); +#endif + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_hw_reset(dev); + + /* Update the error counts. */ + tp->stats.rx_missed_errors += RTL_R32(RxMissed); + RTL_W32(RxMissed, 0); + + spin_unlock_irqrestore(&tp->lock, flags); + + synchronize_irq(dev->irq); + +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) + if (!poll_locked) { +#ifdef CONFIG_R8169_NAPI + netif_poll_disable(dev); +#endif + poll_locked++; + } +#endif + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) + /* Give a racing hard_start_xmit a few cycles to complete. */ + synchronize_rcu(); /* FIXME: should this be synchronize_irq()? */ +#endif + + /* + * And now for the 50k$ question: are IRQ disabled or not ? + * + * Two paths lead here: + * 1) dev->close + * -> netif_running() is available to sync the current code and the + * IRQ handler. See rtl8169_interrupt for details. + * 2) dev->change_mtu + * -> rtl8169_poll can not be issued again and re-enable the + * interruptions. Let's simply issue the IRQ down sequence again. + * + * No loop if hotpluged or major error (0xffff). + */ + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_tx_clear(tp); + + rtl8169_rx_clear(tp); + + rtl8169_powerdown_pll(tp); + + spin_unlock_irqrestore(&tp->lock, flags); +} + +static int rtl8169_close(struct net_device *dev) +{ + struct rtl8169_private *tp = netdev_priv(dev); + struct pci_dev *pdev = tp->pci_dev; + + if(tp->TxDescArray!=NULL && tp->RxDescArray!=NULL) { + rtl8169_cancel_schedule_work(dev); + + rtl8169_down(dev); + + pci_clear_master(tp->pci_dev); + + free_irq(dev->irq, dev); + + pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, + tp->RxPhyAddr); + pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, + tp->TxPhyAddr); + tp->TxDescArray = NULL; + tp->RxDescArray = NULL; + } + + return 0; +} + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) +static void rtl8169_shutdown(struct pci_dev *pdev) +{ + struct net_device *dev = pci_get_drvdata(pdev); + struct rtl8169_private *tp = netdev_priv(dev); + + /* restore the original MAC address */ + if (s5_keep_curr_mac == 0 && tp->random_mac == 0) + rtl8169_rar_set(tp, tp->org_mac_addr); + + rtl8169_close(dev); + + if (system_state == SYSTEM_POWER_OFF) { + pci_clear_master(tp->pci_dev); + pci_wake_from_d3(pdev, tp->wol_enabled); + pci_set_power_state(pdev, PCI_D3hot); + } +} +#endif + +#ifdef CONFIG_PM + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) +static int +rtl8169_suspend(struct pci_dev *pdev, + u32 state) +#else +static int +rtl8169_suspend(struct pci_dev *pdev, + pm_message_t state) +#endif +{ + struct net_device *dev = pci_get_drvdata(pdev); + struct rtl8169_private *tp = netdev_priv(dev); + void __iomem *ioaddr = tp->mmio_addr; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + u32 pci_pm_state = pci_choose_state(pdev, state); +#endif + unsigned long flags; + + if (!netif_running(dev)) + goto out; + + rtl8169_cancel_schedule_work(dev); + + netif_device_detach(dev); + netif_stop_queue(dev); + + rtl8169_delete_timer(dev); + rtl8169_delete_esd_timer(dev, &tp->esd_timer); + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_hw_reset(dev); + + pci_clear_master(pdev); + + tp->stats.rx_missed_errors += RTL_R32(RxMissed); + RTL_W32(RxMissed, 0); + + rtl8169_powerdown_pll(tp); + + spin_unlock_irqrestore(&tp->lock, flags); + +out: +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + pci_save_state(pdev, &pci_pm_state); +#else + pci_save_state(pdev); +#endif + pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); +// pci_set_power_state(pdev, pci_choose_state(pdev, state)); + + return 0; +} + +static int rtl8169_resume(struct pci_dev *pdev) +{ + struct net_device *dev = pci_get_drvdata(pdev); + struct rtl8169_private *tp = netdev_priv(dev); + unsigned long flags; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + u32 pci_pm_state = PCI_D0; +#endif + + pci_set_power_state(pdev, PCI_D0); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) + pci_restore_state(pdev, &pci_pm_state); +#else + pci_restore_state(pdev); +#endif + pci_enable_wake(pdev, PCI_D0, 0); + + spin_lock_irqsave(&tp->lock, flags); + + /* restore last modified mac address */ + rtl8169_rar_set(tp, dev->dev_addr); + + spin_unlock_irqrestore(&tp->lock, flags); + + if (!netif_running(dev)) + goto out; + + pci_set_master(pdev); + + spin_lock_irqsave(&tp->lock, flags); + + rtl8169_hw_init(dev); + + rtl8169_phy_power_up(dev); + + rtl8169_hw_phy_config(dev); + + spin_unlock_irqrestore(&tp->lock, flags); + + rtl8169_schedule_work(dev, rtl8169_reset_task); + + netif_device_attach(dev); + + mod_timer(&tp->link_timer, jiffies + RTL8169_PHY_TIMEOUT); + mod_timer(&tp->esd_timer, jiffies + RTL8169_ESD_TIMEOUT); +out: + return 0; +} + +#endif /* CONFIG_PM */ + +static struct pci_driver rtl8169_pci_driver = { + .name = MODULENAME, + .id_table = rtl8169_pci_tbl, + .probe = rtl8169_init_one, + .remove = __devexit_p(rtl8169_remove_one), +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) + .shutdown = rtl8169_shutdown, +#endif +#ifdef CONFIG_PM + .suspend = rtl8169_suspend, + .resume = rtl8169_resume, +#endif +}; + +static int __init +rtl8169_init_module(void) +{ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) + return pci_register_driver(&rtl8169_pci_driver); +#else + return pci_module_init(&rtl8169_pci_driver); +#endif +} + +static void __exit +rtl8169_cleanup_module(void) +{ + pci_unregister_driver(&rtl8169_pci_driver); +} + +module_init(rtl8169_init_module); +module_exit(rtl8169_cleanup_module); -- cgit v1.2.3