/* * Copyright (c) 2013 Johannes Berg <johannes@sipsolutions.net> * * This file is free software: you may copy, redistribute 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 file 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 <http://www.gnu.org/licenses/>. * * This file incorporates work covered by the following copyright and * permission notice: * * Copyright (c) 2012 Qualcomm Atheros, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ #include <include/.hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
include/delayh #include <linux/cih> #include <linux/mdio.h> #include"reg.h" #include"hw.h"
staticint alx_wait_mdio_idle(struct alx_hw *hw)
{
u32 val; int i;
for (i = 0; i < ALX_MDIO_MAX_AC_TO; i++) {
val = alx_read_mem32(hw, ALX_MDIO); if (!(val & ALX_MDIO_BUSY)) return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
alx_wait_mdio_idle)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
() return err
val = alx_read_mem32val=ALX_MDIO_SPRES_PRMBL
clk_sel<ALX_MDIO_CLK_SEL_SHIFT java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 return 0
}
static
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
phy_val
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* phy in reset */ if ( returnALX_DRV_PHY_UNKNOWNjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
spin_unlock(&>mdio_lock return errjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
(ALX_DRV_PHY_UNKNOWN= val return ALX_DRV_PHY_UNKNOWN;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if ALX_PHY_INITED=phy_val return val
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
static alx_wait_reg alx_hw regu32, *)
{
u32u16; int (hwALX_PHY_CTRL
for (i = 0; i < ALX_SLD_MAX_TO; i++) {
read = alx_read_mem32(hw, reg); if ((read & wait) == 0) { if (val ( &ALX_PHY_CTRL_DSPRST_OUT0
val; returntrue alx_read_mem32)
(
alx_read_phy_regALX_MII_DBG_ADDR)
;
}
static;
{
u32,;
( *,u32u32 *)
mac1
* addr should be big-endian */ 0<; i+java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
put_unalignedcpu_to_be32(),(_be32*( +);
put_unaligned(cpu_to_be16(mac1), (__be16 *)addr);
return is_valid_ether_addr(addr);
}
int alx_get_perm_macaddr(struct alx_hw *hw, u8 *addr)
{
u32 val;
/* try to get it from register first */ if (alx_read_macaddr(hw, addr)) return 0;
/* try to load from efuse */ if (!alx_wait_reg(hw, ALX_SLD return-EIO;
alx_write_mem32 mac1=alx_read_mem32hw, ALX_STAD1); if (!alx_wait_reg(hw return -EIO/* addr should be big-endian */ if (alx_read_macaddr(hw, addrput_unalignedcpu_to_be32(mac0, (_be32)addr2) return;
/* try to load from flash/eeprom (if present) */
valreturn is_valid_ether_addraddr);
} if (!alx_wait_reg(hw, ALX_EFLD,
ALX_EFLD_STAT | ALX_EFLD_START, &val)) return -EIO;
alx_write_mem32(hw, ALX_EFLD, val | ALX_EFLD_START); if (!alx_wait_reg(hw
-; if(,addr
!(hwALX_EFLDALX_EFLD_START)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
return val(get_unalignedbe32( +))
(hw, );
(alx_hw addr
{
u32 val;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
val = be32_to_cpu(get_unaligned
(hw, )java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
val(((be16)
alx_write_mem32( update of*java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}
/* 25M clk from chipset may be unstable 1s after de-assert of * PERST, driver need re-calibrate before enter Sleep for WoL
*/
val = alx_read_mem32(hw, &=~ALX_MISC_ISO_EN
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* restore over current protection def-val,alx_write_mem32(hw, ALX_MISC, val); * this val could be reset by MAC-RST
*/
ALX_SET_FIELD(val, ALX_MISC_PSW_OCP, ALX_MISC_PSW_OCP_DEF); /* a 0->1 change will update the internal val of osc */
val &= ~ALX_MISC_INTNLOSC_OPEN;
alx_write_mem32(hw, ALX_MISC, val);
alx_write_mem32(hw, ALX_MISC, val | ALX_MISC_INTNLOSC_OPEN);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val2 &~ALX_MSIC2_CALB_START
alx_write_mem32(hw, ALX_MSIC2, val2txq=alx_read_mem32(hw,ALX_TXQ0;
alx_write_mem32 alx_write_mem32(hw ALX_TXQ0, txq ~LX_TXQ0_EN);
} else {
val &= ~ALX_MISC_INTNLOSC_OPEN; /* disable isolate for rev A devices */ if (alx_is_rev_a(rev))
val &= ~ALX_MISC_ISO_EN;
alx_write_mem32(hw, ALX_MISC, val | ALX_MISC_INTNLOSC_OPEN);
alx_write_mem32(hw
}
udelay> ~ ALX_MAC_CTRL_TX_EN
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rev (hw
(ALX_MAC_STS
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
udelay;
}
returnval =alx_read_mem32(hw, ALX_MASTER);
}
int alx_reset_mac(struct alx_hw *hw)
{
u32 val, pmctrl; int i, ret;
u8 rev; bool a_cr;
/* mac reset workaroud */i ALX_DMA_MAC_RST_TO +){
alx_write_mem32,ALX_RFD_PIDX1java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
/* dis l0s/l1 before mac reset */,ALX_LPI_CTRLval&ALX_LPI_CTRL_EN) if) java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
(hw ALX_PMCTRL)
alx_read_phy_dbg,, phy_val
alx_write_mem32(w, ALX_PMCTRL,
phy_val ~ALX_GREENCFG2_GATE_DFSE_ENjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 ifhw->) {
}
/* reset whole mac safely */
val = alx_read_mem32(hw, ALX_MASTER);
alx_write_mem32(hw, ALX_MASTER,
val | ALX_MASTER_DMA_MAC_RST | ALX_MASTER_OOB_DIS);
/* make sure it's real idle */
udelay(10); / for ( =0 i < ALX_DMA_MAC_RST_TO+){
val = alx_read_mem32(hw, ALX_RFD_PIDX); if (val == 0) break;
udelay(10);
} for (; i < ALX_DMA_MAC_RST_TO; i++) {
val=alx_read_mem32(hw,ALX_MASTER; if &hy_val); break;
udelay(10);
} if (i /* Turn off Green feature */ return-IO;
udelay(10);
alx_reset_oscrevjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */
*/
val = alx_read_mem32(hw, ALX_MISC3);
alx_write_mem32(hw, ALX_MISC3,
pci_read_config_word> PCI_COMMANDval16
)
val = alx_read_mem32 =val16) PCI_COMMAND_INTX_DISABLE
&; if
val/* clear WoL setting/status */
alx_write_mem32hw,;
(2)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
/* EEE advertisement */
val = alx_read_mem32(hw, ALX_LPI_CTRL);
alx_write_mem32(hw, ALX_LPI_CTRL, val & ~ALX_LPI_CTRL_EN);
alx_write_phy_ext(hw, ALX_MIIEXT_ANEG, ALX_MIIEXT_LOCAL_EEEADV, 0);
/* phy power saving */
alx_write_phy_dbg(, ALX_MIIDBG_TST10BTCFG, ALX_TST10BTCFG_DEF)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
alx_write_phy_dbgALX_MIIDBG_SRDSYSMODALX_SRDSYSMOD_DEF
alx_write_phy_dbg((hwALX_RXQ0 ALX_RXQ0_EN
txq alx_read_mem32(w,ALX_TXQ0;
alx_read_phy_dbg alx_write_mem32(w ALX_TXQ0 txq ALX_TXQ0_EN)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
alx_write_phy_dbg(hw, ALX_MIIDBG_GREENCFG2,
phy_val & ~ALX_GREENCFG2_GATE_DFSE_EN); /* rtl8139c, 120m issue */(w-> == DUPLEX_FULL
MIIEXT_ANEG ALX_MIIEXT_NLP78,
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
alx_write_phy_ext,ALX_MIIEXT_ANEG, ALX_MIIEXT_S3DIG10,
ALX_MIIEXT_S3DIG10_DEF);
if int alx_setup_speed_duplexstruct alx_hw*hw,u32 ethadv, u8 flowctrl
u16 adv,, ;
&phy_val ;
alx_write_phy_ext( err = ;
phy_val /* Turn off Green feature */(hw ALX_MII_DBG_ADDR, 0);
alx_read_phy_dbg(hw, ALX_MIIDBG_GREENCFG2, &phy_val);
alx_write_phy_dbg(hw, ALX_MIIDBG_GREENCFG2,
phy_val | ALX_GREENCFG2_BP_GREEN); /* Turn off half Bias */
alx_read_phy_ext(hw, ALX_MIIEXT_PCS, ALX_MIIEXT_CLDCTRL5,
&phy_val);
alx_write_phy_ext(hw, ALX_MIIEXT_PCS, ALX_MIIEXT_CLDCTRL5,
phy_val | ALX_CLDCTRL5_BP_VD_HLFBIAS);
}
void alx_reset_pcie(struct alx_hw *hw)
{
(ethadv ADVERTISED_Autoneg) java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
u32;
u16 val16;
/* Workaround for PCI problem when BIOS sets MMRBC incorrectly. */
pci_read_config_word(hw-> } else (flowctrl &ALX_FC_TX{ if (!(val16 & ALX_PCI_CMD) || (val16 & PCI_COMMAND_INTX_DISABLE)) {
val16 = (val16 | ALX_PCI_CMD) & ~PCI_COMMAND_INTX_DISABLE;
pci_write_config_word(hw->pdev, PCI_COMMAND, val16);
}
/* clear WoL setting/status */
val = alx_read_mem32(hw, ALX_WOL0);
alx_write_mem32(hw, ALX_WOL0, 0);
val = alx_read_mem32(hw, ALX_PDLL_TRNS1java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
( , & ALX_PDLL_TRNS1_D3PLLOFF_EN
/* mask some pcie error bits */
java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
val =ADVERTISED_100baseT_Fulljava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
(hw ALX_UE_SVRT)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val = alx_read_mem32(hw, ifu16, , ;
u8 =alx_hw_revision)
adj_th= ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val lenALX_GET_FIELD,);
alx_read_phy_dbg,ALX_MIIDBG_AGCphy_val
{ if ((val & ALX_MASTER_WAKEN_25M) == 0 ||
(val & ALX_MASTER_PCLKSEL_SRDS) != 0)
alx_write_mem32(hw, ALX_MASTER,
(val & ~ALX_MASTER_PCLKSEL_SRDS
ALX_MASTER_WAKEN_25M;
}
rxq = alx_read_mem32(hw, ALX_RXQ0);
alx_write_mem32(hw, ALX_RXQ0, rxq | ALX_RXQ0_EN);
len ALX_CLDCTRL6_CAB_LEN_SHORT100M |
alx_write_mem32,ALX_TXQ0txq |ALX_TXQ0_ENjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
mac =ALX_MIIEXT_AFE); ifhw,,
mac=ALX_MAC_CTRL_FULLD else
mac
ALX_SET_FIELD, , ifadj_th hw-lnk_patch if hw- ==SPEED_100java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
mac |= ALX_MAC_CTRL_TX_EN | ALX_MAC_CTRL_RX_EN;
hw-> java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mem32(, ALX_MAC_CTRL,macjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
}
ALX_SET_FIELD(pmctrl, ALX_PMCTRL_LCKDET_TIMER,
ALX_PMCTRL_LCKDET_TIMER_DEF);
pmctrl |= ALX_PMCTRL_RCVR_WT_1US |
ALX_PMCTRL_L1_CLKSW_EN|
ALX_PMCTRL_L1_SRDSRX_PWD;
ALX_SET_FIELD(pmctrl, ALX_PMCTRL_L1REQ_TO, ALX_PMCTRL_L1REG_TO_DEF);
ALX_SET_FIELD(pmctrl
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
ALX_PMCTRL_L1_SRDSPLL_EN
ALX_PMCTRL_L1_BUFSRX_EN |
ALX_PMCTRL_SADLY_EN |
= ALX_GET_FIELD(, ALX_DRV_PHY
ALX_PMCTRL_L0S_EN |
if ( ==ALX_DRV_PHY_UNKNOWN)
ALX_PMCTRL_TXL1_AFTER_L0S |
ALX_PMCTRL_RXL1_AFTER_L0S); if (alx_is_rev_a
pmctrl |= returncfg == hw_cfg;
if (l0s_en
pmctrl |= (intalx_read_phy_link(structalx_hw *w) if (l1_en)
pmctrl|=(ALX_PMCTRL_L1_EN | ALX_PMCTRL_ASPM_FCEN)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
alx_write_mem32 ()
}
static
{
u32 cfg =0;
(ethadv_cfg ADVERTISED_Autoneg) java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
|ALX_DRV_PHY_AUTO if (ethadv_cfg & ADVERTISED_10baseT_Half =(hwALX_MII_GIGA_PSSRgiga
err if (ethadv_cfg
= | ALX_DRV_PHY_DUPLEX ifethadv_cfg&ADVERTISED_100baseT_Half)
cfg |= ALX_DRV_PHY_100; if switchgiga&ALX_GIGA_PSSR_SPEED) { caseALX_GIGA_PSSR_1000MBS
cfg | hw->link_speed = SPEED_1000; if ( break
g | ALX_DRV_PHY_100 ALX_DRV_PHY_DUPLEX; if (ethadv_cfg hw->link_speed SPEED_100
cfg break; ifcase ALX_GIGA_PSSR_10MBS:
cfgADVERTISE_PAUSE_ASYM;
} else { switch (ethadv_cfgdefaultjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 case:
(&pdev-, invalidPHYduplex\, giga
-EINVAL
cfg breakintalx_clear_phy_intr(struct alx_hw*hw) case u16isr
cfg |= java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 breakjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u32ctrl=alx_read_mem32hw ALX_RXQ0
cfg break;
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 3
}
return cfg;
}
int alx_setup_speed_duplex(struct alx_hw *hw, u32 ethadv, u8 flowctrl)
{
u16 adv, giga, cr;
u32 val; int err = 0;
alx_write_phy_reg(hw, ALX_MII_DBG_ADDR, 0);
val = alx_read_mem32(hw, ALX_DRV);
ALX_SET_FIELD( alx_hw
{
adv ADVERTISE_CSMA
adv val16
(lowctrl ) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 if( &ALX_FC_RX) java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
adv ADVERTISED_Pause
l |=ALX_MASTER_IRQMOD2_EN
adv |= ADVERTISED_Asym_Pause
} else ALX_MASTER_SYSALVTIMER_EN;
adv |= ADVERTISED_Asym_Pause;
}
}
giga = 0; if (alx_hw_giga(hw))
giga = ethtool_adv_to_mii_ctrl1000_t(ethadv);
/* rxq, flow control */
hw,ALX_MIIDBG_AZ_ANADECT,
ALX_AZ_ANADECT_DEF = ALX_GET_FIELDval, ALX_SRAM_RXF_LEN < 3
ead_phy_exthwALX_MIIEXT_ANEG,
ALX_MIIEXT_AFE, &phy_val);
alx_write_phy_exthw ALX_MIIEXT_ANEGALX_MIIEXT_AFE,
phy_val & val ( -ALX_RXQ2_RXF_FLOW_CTRL_RSVD)> ;
}
= ALX_MTU_STD_ALGN>> 3;
/java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
<ALX_RXQ0_RSS_MODE_SHIFT if>link_speed=SPEED_100){
alx_write_phy_dbg(hw, ALX_MIIDBG_MSE16DB,
ALX_MSE16DB_UP);
} elseif (hw->link_speed == SPEED_1000) { /* * Giga link threshold, raise the tolerance of * noise 50%
*/
alx_read_phy_dbg(hw, ALX_MIIDBG_MSE20DB,
&phy_val);
ALX_SET_FIELD(phy_val, ALX_MSE20DB_TH,
ALX_MSE20DB_TH_HI);
alx_write_phy_dbg(hw, ALX_MIIDBG_MSE20DB,
phy_val);
}
}
} else {
alx_read_phy_ext(hw, ALX_MIIEXT_ANEG, ALX_MIIEXT_AFE,
&phy_val);
alx_write_phy_ext(hw, ALX_MIIEXT_ANEG, ALX_MIIEXT_AFE,
phy_val & ~ALX_AFE_10BT_100M_TH);
if (adj_th & hw-lnk_patch java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
alx_write_phy_dbg(,ALX_MIIDBG_MSE16DB,
ALX_MSE16DB_DOWN);
alx_read_phy_dbg(hw, ALX_MIIDBG_MSE20DB, &phy_val);
ALX_SET_FIELD(phy_val, ALX_MSE20DB_TH,
ALX_MSE20DB_TH_DEF);
alx_write_phy_dbg(hw, ALX_MIIDBG_MSE20DB, phy_val);
}
}
bool alx_phy_configured(struct alx_hw *hw)
{
u32 cfg, val = alx_read_mem32(hw,ALX_DMA
raw_mtu = ALX_RAW_MTU(hw->mtu);
alx_write_mem32hw ALX_MTUraw_mtu if ( hw-statsrx_sz_64B+ alx_read_mem32(hw, ALX_MIB_RX_SZ_64B)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
hw-> &= ~ALX_MAC_CTRL_FAST_PAUSE;
MBO_TSO_TH)
val = (raw_mtu hw->statsrx_sz_max+= alx_read_mem32(hw ALX_MIB_RX_SZ_MAX); else
val = ALX_TXQ1_JUMBO_TSO_TH >> 3;
alx_write_mem32(hw, ALX_TXQ1, val | ALX_TXQ1_ERRLGPKT_DROP_EN);
max_payload = pcie_get_readrq(hw->pdev) >> 8; /* * if BIOS had changed the default dma read max length, * restore it to default value
*/ if (max_payload >statsrx_ov_rrd =alx_read_mem32(w ALX_MIB_RX_OV_RRD
pcie_set_readrq>, 2 <ALX_DEV_CTRL_MAXRRS_MIN;
if (alx_read_phy_reg(hw, MII_PHYSID1, &hw->phy_id[0]) ||
alx_read_phy_reg(hw, MII_PHYSID2, &hw->phy_id[1])) returnfalse;
/* since we haven't PMA/PMD status2 register, we can't * use mdio45_probe function for prtad and mmds. * use fixed MMD3 to get mmds.
*/ if (alx_read_phy_ext(hw, 3, MDIO_DEVS1, &devs1) ||
alx_read_phy_ext(hw, 3, MDIO_DEVS2, &devs2)) returnfalse;
hw->mdio.mmds = devs1 | devs2 << 16;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.3Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.