From a10ce85526896e04ff1b9a43a625ee7f18ef42c7 Mon Sep 17 00:00:00 2001 From: "Jayachandran C." Date: Thu, 24 Jan 2013 14:42:58 +0000 Subject: [PATCH] Minor updates to the Broadcom XLP NAE driver Remove unnecessary SGMII initialization code from nae.c. While there clean up some prints and whitespace. --- sys/mips/nlm/dev/net/nae.c | 26 +++++++------------------- sys/mips/nlm/dev/net/xlpge.c | 8 ++++---- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/sys/mips/nlm/dev/net/nae.c b/sys/mips/nlm/dev/net/nae.c index dce4836811e7..d97b29038625 100644 --- a/sys/mips/nlm/dev/net/nae.c +++ b/sys/mips/nlm/dev/net/nae.c @@ -1427,9 +1427,8 @@ nlm_nae_open_if(uint64_t nae_base, int nblock, int port_type, int port, uint32_t desc_size) { uint32_t netwk_inf; - uint32_t mac_cfg1, mac_cfg2, netior_ctrl3; - int iface, speed, duplex, ifmode; - int iface_ctrl_reg, iface_ctrl3_reg, conf1_reg, conf2_reg; + uint32_t mac_cfg1, netior_ctrl3; + int iface, iface_ctrl_reg, iface_ctrl3_reg, conf1_reg, conf2_reg; switch (port_type) { case XAUIC: @@ -1487,6 +1486,7 @@ nlm_nae_open_if(uint64_t nae_base, int nblock, int port_type, /* clear gmac reset */ mac_cfg1 = nlm_read_nae_reg(nae_base, conf1_reg); nlm_write_nae_reg(nae_base, conf1_reg, mac_cfg1 & ~(1 << 31)); + /* clear speed debug bit */ iface_ctrl3_reg = SGMII_NET_IFACE_CTRL3(nblock, iface); netior_ctrl3 = nlm_read_nae_reg(nae_base, iface_ctrl3_reg); @@ -1500,33 +1500,21 @@ nlm_nae_open_if(uint64_t nae_base, int nblock, int port_type, nlm_write_nae_reg(nae_base, iface_ctrl_reg, netwk_inf & ~(0x1 << 2)); - /* setup defaults */ /* XXXJC: take defaults from sc? */ - speed = 2; - duplex = 1; - ifmode = 0x2; - netwk_inf = nlm_read_nae_reg(nae_base, iface_ctrl_reg); - netwk_inf &= ~(0x3); - nlm_write_nae_reg(nae_base, iface_ctrl_reg, - netwk_inf | (speed & 0x3)); - mac_cfg2 = nlm_read_nae_reg(nae_base, conf2_reg); - mac_cfg2 &= ~(0x3 << 8); - nlm_write_nae_reg(nae_base, conf2_reg, - mac_cfg2 | - ((ifmode & 0x3) << 8) | /* interface mode */ - (duplex & 0x1)); - /* clear stats counters */ netwk_inf = nlm_read_nae_reg(nae_base, iface_ctrl_reg); nlm_write_nae_reg(nae_base, iface_ctrl_reg, netwk_inf | (1 << 15)); + /* enable stats counters */ netwk_inf = nlm_read_nae_reg(nae_base, iface_ctrl_reg); nlm_write_nae_reg(nae_base, iface_ctrl_reg, (netwk_inf & ~(1 << 15)) | (1 << 16)); + + /* flow control? */ mac_cfg1 = nlm_read_nae_reg(nae_base, conf1_reg); nlm_write_nae_reg(nae_base, conf1_reg, mac_cfg1 | (0x3 << 4)); - break; + break; } nlm_nae_init_ingress(nae_base, desc_size); diff --git a/sys/mips/nlm/dev/net/xlpge.c b/sys/mips/nlm/dev/net/xlpge.c index 0e41559cbb06..f94dcd5077e1 100644 --- a/sys/mips/nlm/dev/net/xlpge.c +++ b/sys/mips/nlm/dev/net/xlpge.c @@ -1364,13 +1364,13 @@ nlm_xlpge_mii_statchg(device_t dev) if (mii->mii_media_status & IFM_ACTIVE) { if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) { sc->speed = NLM_SGMII_SPEED_10; - speed = "10-Mbps"; + speed = "10Mbps"; } else if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) { sc->speed = NLM_SGMII_SPEED_100; - speed = "100-Mbps"; + speed = "100Mbps"; } else { /* default to 1G */ sc->speed = NLM_SGMII_SPEED_1000; - speed = "1-Gbps"; + speed = "1Gbps"; } if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) { @@ -1381,7 +1381,7 @@ nlm_xlpge_mii_statchg(device_t dev) duplexity = "half"; } - printf("Setup [complex=%d, port=%d] with speed=%s duplex=%s\n", + printf("Port [%d, %d] setup with speed=%s duplex=%s\n", sc->block, sc->port, speed, duplexity); nlm_nae_setup_mac(sc->base_addr, sc->block, sc->port, 0, 1, 1,