Minor updates to the Broadcom XLP NAE driver

Remove unnecessary SGMII initialization code from nae.c. While there
clean up some prints and whitespace.
This commit is contained in:
Jayachandran C. 2013-01-24 14:42:58 +00:00
parent 301b961c3e
commit a10ce85526
2 changed files with 11 additions and 23 deletions

View File

@ -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);

View File

@ -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,