{
s32 err;
- DEBUGFUNC("ngbe_start_hw");
-
/* Clear the VLAN filter table */
hw->mac.clear_vfta(hw);
/* Setup flow control */
err = hw->mac.setup_fc(hw);
if (err != 0 && err != NGBE_NOT_IMPLEMENTED) {
- DEBUGOUT("Flow control setup failed, returning %d\n", err);
+ DEBUGOUT("Flow control setup failed, returning %d", err);
return err;
}
{
s32 status;
- DEBUGFUNC("ngbe_init_hw");
-
ngbe_save_eeprom_version(hw);
/* Reset the hardware */
}
if (status != 0)
- DEBUGOUT("Failed to initialize HW, STATUS = %d\n", status);
+ DEBUGOUT("Failed to initialize HW, STATUS = %d", status);
return status;
}
wr32m(hw, NGBE_GPIE, NGBE_GPIE_MSIX, NGBE_GPIE_MSIX);
- if ((hw->sub_system_id & NGBE_OEM_MASK) == NGBE_LY_M88E1512_SFP ||
- (hw->sub_system_id & NGBE_OEM_MASK) == NGBE_LY_YT8521S_SFP) {
+ if (hw->gpio_ctl) {
/* gpio0 is used to power on/off control*/
wr32(hw, NGBE_GPIODIR, NGBE_GPIODIR_DDR(1));
wr32(hw, NGBE_GPIODATA, NGBE_GPIOBIT_0);
{
s32 status;
- DEBUGFUNC("ngbe_reset_hw_em");
-
/* Call adapter stop to disable tx/rx and clear interrupts */
status = hw->mac.stop_hw(hw);
if (status != 0)
{
u16 i = 0;
- DEBUGFUNC("ngbe_clear_hw_cntrs");
-
/* QP Stats */
/* don't write clear queue stats */
for (i = 0; i < NGBE_MAX_QP; i++) {
u32 rar_low;
u16 i;
- DEBUGFUNC("ngbe_get_mac_addr");
-
wr32(hw, NGBE_ETHADDRIDX, 0);
rar_high = rd32(hw, NGBE_ETHADDRH);
rar_low = rd32(hw, NGBE_ETHADDRL);
struct ngbe_bus_info *bus = &hw->bus;
u32 reg = 0;
- DEBUGFUNC("ngbe_set_lan_id_multi_port");
-
reg = rd32(hw, NGBE_PORTSTAT);
bus->lan_id = NGBE_PORTSTAT_ID(reg);
bus->func = bus->lan_id;
u16 i;
s32 status = 0;
- DEBUGFUNC("ngbe_stop_hw");
-
/*
* Set the adapter_stopped flag so other driver functions stop touching
* the hardware
{
u32 led_reg = rd32(hw, NGBE_LEDCTL);
- DEBUGFUNC("ngbe_led_on");
-
if (index > 3)
return NGBE_ERR_PARAM;
{
u32 led_reg = rd32(hw, NGBE_LEDCTL);
- DEBUGFUNC("ngbe_led_off");
-
if (index > 3)
return NGBE_ERR_PARAM;
{
s32 status = 0;
- DEBUGFUNC("ngbe_validate_mac_addr");
-
/* Make sure it is not a multicast address */
if (NGBE_IS_MULTICAST((struct rte_ether_addr *)mac_addr)) {
status = NGBE_ERR_INVALID_MAC_ADDR;
u32 rar_low, rar_high;
u32 rar_entries = hw->mac.num_rar_entries;
- DEBUGFUNC("ngbe_set_rar");
-
/* Make sure we are using a valid rar index range */
if (index >= rar_entries) {
- DEBUGOUT("RAR index %d is out of range.\n", index);
+ DEBUGOUT("RAR index %d is out of range.", index);
return NGBE_ERR_INVALID_ARGUMENT;
}
u32 rar_high;
u32 rar_entries = hw->mac.num_rar_entries;
- DEBUGFUNC("ngbe_clear_rar");
-
/* Make sure we are using a valid rar index range */
if (index >= rar_entries) {
- DEBUGOUT("RAR index %d is out of range.\n", index);
+ DEBUGOUT("RAR index %d is out of range.", index);
return NGBE_ERR_INVALID_ARGUMENT;
}
u32 psrctl;
u32 rar_entries = hw->mac.num_rar_entries;
- DEBUGFUNC("ngbe_init_rx_addrs");
-
/*
* If the current mac address is valid, assume it is a software override
* to the permanent address.
/* Get the MAC address from the RAR0 for later reference */
hw->mac.get_mac_addr(hw, hw->mac.addr);
- DEBUGOUT(" Keeping Current RAR0 Addr =%.2X %.2X %.2X ",
+ DEBUGOUT(" Keeping Current RAR0 Addr = "
+ RTE_ETHER_ADDR_PRT_FMT,
hw->mac.addr[0], hw->mac.addr[1],
- hw->mac.addr[2]);
- DEBUGOUT("%.2X %.2X %.2X\n", hw->mac.addr[3],
+ hw->mac.addr[2], hw->mac.addr[3],
hw->mac.addr[4], hw->mac.addr[5]);
} else {
/* Setup the receive address. */
- DEBUGOUT("Overriding MAC Address in RAR[0]\n");
- DEBUGOUT(" New MAC Addr =%.2X %.2X %.2X ",
+ DEBUGOUT("Overriding MAC Address in RAR[0]");
+ DEBUGOUT(" New MAC Addr = "
+ RTE_ETHER_ADDR_PRT_FMT,
hw->mac.addr[0], hw->mac.addr[1],
- hw->mac.addr[2]);
- DEBUGOUT("%.2X %.2X %.2X\n", hw->mac.addr[3],
+ hw->mac.addr[2], hw->mac.addr[3],
hw->mac.addr[4], hw->mac.addr[5]);
hw->mac.set_rar(hw, 0, hw->mac.addr, 0, true);
hw->mac.clear_vmdq(hw, 0, BIT_MASK32);
/* Zero out the other receive addresses. */
- DEBUGOUT("Clearing RAR[1-%d]\n", rar_entries - 1);
+ DEBUGOUT("Clearing RAR[1-%d]", rar_entries - 1);
for (i = 1; i < rar_entries; i++) {
wr32(hw, NGBE_ETHADDRIDX, i);
wr32(hw, NGBE_ETHADDRL, 0);
psrctl |= NGBE_PSRCTL_ADHF12(hw->mac.mc_filter_type);
wr32(hw, NGBE_PSRCTL, psrctl);
- DEBUGOUT(" Clearing MTA\n");
+ DEBUGOUT(" Clearing MTA");
for (i = 0; i < hw->mac.mcft_size; i++)
wr32(hw, NGBE_MCADDRTBL(i), 0);
{
u32 vector = 0;
- DEBUGFUNC("ngbe_mta_vector");
-
switch (hw->mac.mc_filter_type) {
case 0: /* use bits [47:36] of the address */
vector = ((mc_addr[4] >> 4) | (((u16)mc_addr[5]) << 4));
vector = ((mc_addr[4]) | (((u16)mc_addr[5]) << 8));
break;
default: /* Invalid mc_filter_type */
- DEBUGOUT("MC filter type param set incorrectly\n");
+ DEBUGOUT("MC filter type param set incorrectly");
ASSERT(0);
break;
}
u32 vector_bit;
u32 vector_reg;
- DEBUGFUNC("ngbe_set_mta");
-
hw->addr_ctrl.mta_in_use++;
vector = ngbe_mta_vector(hw, mc_addr);
- DEBUGOUT(" bit-vector = 0x%03X\n", vector);
+ DEBUGOUT(" bit-vector = 0x%03X", vector);
/*
* The MTA is a register array of 128 32-bit registers. It is treated
u32 i;
u32 vmdq;
- DEBUGFUNC("ngbe_update_mc_addr_list");
-
/*
* Set the new number of MC addresses that we are being requested to
* use.
/* Clear mta_shadow */
if (clear) {
- DEBUGOUT(" Clearing MTA\n");
+ DEBUGOUT(" Clearing MTA");
memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow));
}
/* Update mta_shadow */
for (i = 0; i < mc_addr_count; i++) {
- DEBUGOUT(" Adding the multicast addresses:\n");
+ DEBUGOUT(" Adding the multicast addresses:");
ngbe_set_mta(hw, next(hw, &mc_addr_list, &vmdq));
}
wr32(hw, NGBE_PSRCTL, psrctl);
}
- DEBUGOUT("ngbe update mc addr list complete\n");
+ DEBUGOUT("ngbe update mc addr list complete");
return 0;
}
s32 err = 0;
u16 reg_cu = 0;
- DEBUGFUNC("ngbe_setup_fc");
-
/* Validate the requested mode */
if (hw->fc.strict_ieee && hw->fc.requested_mode == ngbe_fc_rx_pause) {
- DEBUGOUT("ngbe_fc_rx_pause not valid in strict IEEE mode\n");
+ DEBUGOUT("ngbe_fc_rx_pause not valid in strict IEEE mode");
err = NGBE_ERR_INVALID_LINK_SETTINGS;
goto out;
}
reg_cu |= 0xC00; /*need to merge rtl and mvl on page 0*/
break;
default:
- DEBUGOUT("Flow control param set incorrectly\n");
+ DEBUGOUT("Flow control param set incorrectly");
err = NGBE_ERR_CONFIG;
goto out;
}
u32 pause_time;
u32 fcrtl, fcrth;
- DEBUGFUNC("ngbe_fc_enable");
-
/* Validate the water mark configuration */
if (!hw->fc.pause_time) {
err = NGBE_ERR_INVALID_LINK_SETTINGS;
if ((hw->fc.current_mode & ngbe_fc_tx_pause) && hw->fc.high_water) {
if (!hw->fc.low_water ||
hw->fc.low_water >= hw->fc.high_water) {
- DEBUGOUT("Invalid water mark configuration\n");
+ DEBUGOUT("Invalid water mark configuration");
err = NGBE_ERR_INVALID_LINK_SETTINGS;
goto out;
}
fccfg_reg |= NGBE_TXFCCFG_FC;
break;
default:
- DEBUGOUT("Flow control param set incorrectly\n");
+ DEBUGOUT("Flow control param set incorrectly");
err = NGBE_ERR_CONFIG;
goto out;
}
u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
{
if ((!(adv_reg)) || (!(lp_reg))) {
- DEBUGOUT("Local or link partner's advertised flow control "
- "settings are NULL. Local: %x, link partner: %x\n",
+ DEBUGOUT("Local or link partner's advertised flow control settings are NULL. Local: %x, link partner: %x",
adv_reg, lp_reg);
return NGBE_ERR_FC_NOT_NEGOTIATED;
}
*/
if (hw->fc.requested_mode == ngbe_fc_full) {
hw->fc.current_mode = ngbe_fc_full;
- DEBUGOUT("Flow Control = FULL.\n");
+ DEBUGOUT("Flow Control = FULL.");
} else {
hw->fc.current_mode = ngbe_fc_rx_pause;
- DEBUGOUT("Flow Control=RX PAUSE frames only\n");
+ DEBUGOUT("Flow Control=RX PAUSE frames only");
}
} else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) &&
(lp_reg & lp_sym) && (lp_reg & lp_asm)) {
hw->fc.current_mode = ngbe_fc_tx_pause;
- DEBUGOUT("Flow Control = TX PAUSE frames only.\n");
+ DEBUGOUT("Flow Control = TX PAUSE frames only.");
} else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) &&
!(lp_reg & lp_sym) && (lp_reg & lp_asm)) {
hw->fc.current_mode = ngbe_fc_rx_pause;
- DEBUGOUT("Flow Control = RX PAUSE frames only.\n");
+ DEBUGOUT("Flow Control = RX PAUSE frames only.");
} else {
hw->fc.current_mode = ngbe_fc_none;
- DEBUGOUT("Flow Control = NONE.\n");
+ DEBUGOUT("Flow Control = NONE.");
}
return 0;
}
u32 speed;
bool link_up;
- DEBUGFUNC("ngbe_fc_autoneg");
-
/*
* AN should have completed when the cable was plugged in.
* Look for reasons to bail out. Bail out if:
u16 addr = 0x04;
u32 data, i;
- DEBUGFUNC("ngbe_set_pcie_master");
-
ngbe_hic_pcie_read(hw, addr, &data, 4);
if (enable)
data |= 0x04;
goto out;
}
- DEBUGOUT("PCIe transaction pending bit also did not clear.\n");
+ DEBUGOUT("PCIe transaction pending bit also did not clear.");
status = NGBE_ERR_MASTER_REQUESTS_PENDING;
out:
u32 timeout = 200;
u32 i;
- DEBUGFUNC("ngbe_acquire_swfw_sync");
-
for (i = 0; i < timeout; i++) {
/*
* SW NVM semaphore bit is used for access to all
}
fwsm = rd32(hw, NGBE_MNGFWSYNC);
- DEBUGOUT("SWFW semaphore not granted: MNG_SWFW_SYNC = 0x%x, MNG_FW_SM = 0x%x\n",
+ DEBUGOUT("SWFW semaphore not granted: MNG_SWFW_SYNC = 0x%x, MNG_FW_SM = 0x%x",
mngsem, fwsm);
msec_delay(5);
u32 mngsem;
u32 swmask = mask;
- DEBUGFUNC("ngbe_release_swfw_sync");
-
ngbe_get_eeprom_semaphore(hw);
mngsem = rd32(hw, NGBE_MNGSEM);
int i;
u32 secrxreg;
- DEBUGFUNC("ngbe_disable_sec_rx_path");
-
-
secrxreg = rd32(hw, NGBE_SECRXCTL);
secrxreg |= NGBE_SECRXCTL_XDSA;
wr32(hw, NGBE_SECRXCTL, secrxreg);
/* For informational purposes only */
if (i >= NGBE_MAX_SECRX_POLL)
- DEBUGOUT("Rx unit being enabled before security "
- "path fully disabled. Continuing with init.\n");
+ DEBUGOUT("Rx unit being enabled before security path fully disabled. Continuing with init.");
return 0;
}
{
u32 secrxreg;
- DEBUGFUNC("ngbe_enable_sec_rx_path");
-
secrxreg = rd32(hw, NGBE_SECRXCTL);
secrxreg &= ~NGBE_SECRXCTL_XDSA;
wr32(hw, NGBE_SECRXCTL, secrxreg);
u32 mpsar;
u32 rar_entries = hw->mac.num_rar_entries;
- DEBUGFUNC("ngbe_clear_vmdq");
-
/* Make sure we are using a valid rar index range */
if (rar >= rar_entries) {
- DEBUGOUT("RAR index %d is out of range.\n", rar);
+ DEBUGOUT("RAR index %d is out of range.", rar);
return NGBE_ERR_INVALID_ARGUMENT;
}
u32 mpsar;
u32 rar_entries = hw->mac.num_rar_entries;
- DEBUGFUNC("ngbe_set_vmdq");
-
/* Make sure we are using a valid rar index range */
if (rar >= rar_entries) {
- DEBUGOUT("RAR index %d is out of range.\n", rar);
+ DEBUGOUT("RAR index %d is out of range.", rar);
return NGBE_ERR_INVALID_ARGUMENT;
}
{
int i;
- DEBUGFUNC("ngbe_init_uta_tables");
- DEBUGOUT(" Clearing UTA\n");
+ DEBUGOUT(" Clearing UTA");
for (i = 0; i < 128; i++)
wr32(hw, NGBE_UCADDRTBL(i), 0);
* slot we found during our search, else error.
*/
if (!first_empty_slot)
- DEBUGOUT("No space in VLVF.\n");
+ DEBUGOUT("No space in VLVF.");
return first_empty_slot ? first_empty_slot : NGBE_ERR_NO_SPACE;
}
u32 regidx, vfta_delta, vfta;
s32 err;
- DEBUGFUNC("ngbe_set_vfta");
-
if (vlan > 4095 || vind > 63)
return NGBE_ERR_PARAM;
u32 portctl;
s32 vlvf_index;
- DEBUGFUNC("ngbe_set_vlvf");
-
if (vlan > 4095 || vind > 63)
return NGBE_ERR_PARAM;
{
u32 offset;
- DEBUGFUNC("ngbe_clear_vfta");
-
for (offset = 0; offset < hw->mac.vft_size; offset++)
wr32(hw, NGBE_VLANTBL(offset), 0);
u32 i, reg;
s32 status = 0;
- DEBUGFUNC("ngbe_check_mac_link_em");
-
reg = rd32(hw, NGBE_GPIOINTSTAT);
wr32(hw, NGBE_GPIOEOI, reg);
bool *autoneg)
{
s32 status = 0;
-
- DEBUGFUNC("\n");
+ u16 value = 0;
hw->mac.autoneg = *autoneg;
- switch (hw->sub_device_id) {
- case NGBE_SUB_DEV_ID_EM_RTL_SGMII:
+ if (hw->phy.type == ngbe_phy_rtl) {
*speed = NGBE_LINK_SPEED_1GB_FULL |
NGBE_LINK_SPEED_100M_FULL |
NGBE_LINK_SPEED_10M_FULL;
- break;
- default:
- break;
+ }
+
+ if (hw->phy.type == ngbe_phy_yt8521s_sfi) {
+ ngbe_read_phy_reg_ext_yt(hw, YT_CHIP, 0, &value);
+ if ((value & YT_CHIP_MODE_MASK) == YT_CHIP_MODE_SEL(1))
+ *speed = NGBE_LINK_SPEED_1GB_FULL;
}
return status;
{
s32 status;
- DEBUGFUNC("\n");
-
/* Setup the PHY according to input speed */
status = hw->phy.setup_link(hw, speed, autoneg_wait_to_complete);
{
struct ngbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data;
- DEBUGFUNC("ngbe_init_thermal_sensor_thresh");
-
memset(data, 0, sizeof(struct ngbe_thermal_sensor_data));
if (hw->bus.lan_id != 0)
s32 status = 0;
u32 ts_state;
- DEBUGFUNC("ngbe_mac_check_overtemp");
-
/* Check that the LASI temp alarm status was triggered */
ts_state = rd32(hw, NGBE_TSALM);
{
s32 err = 0;
- DEBUGFUNC("ngbe_set_mac_type");
-
if (hw->vendor_id != PCI_VENDOR_ID_WANGXUN) {
DEBUGOUT("Unsupported vendor id: %x", hw->vendor_id);
return NGBE_ERR_DEVICE_NOT_SUPPORTED;
case NGBE_SUB_DEV_ID_EM_MVL_RGMII:
hw->phy.media_type = ngbe_media_type_copper;
hw->mac.type = ngbe_mac_em;
+ hw->mac.link_type = ngbe_link_copper;
+ break;
+ case NGBE_SUB_DEV_ID_EM_RTL_YT8521S_SFP:
+ hw->phy.media_type = ngbe_media_type_copper;
+ hw->mac.type = ngbe_mac_em;
+ hw->mac.link_type = ngbe_link_fiber;
break;
case NGBE_SUB_DEV_ID_EM_MVL_SFP:
case NGBE_SUB_DEV_ID_EM_YT8521S_SFP:
hw->phy.media_type = ngbe_media_type_fiber;
hw->mac.type = ngbe_mac_em;
+ hw->mac.link_type = ngbe_link_fiber;
+ break;
+ case NGBE_SUB_DEV_ID_EM_MVL_MIX:
+ hw->phy.media_type = ngbe_media_type_unknown;
+ hw->mac.type = ngbe_mac_em;
+ hw->mac.link_type = ngbe_link_type_unknown;
break;
case NGBE_SUB_DEV_ID_EM_VF:
hw->phy.media_type = ngbe_media_type_virtual;
break;
}
- DEBUGOUT("found mac: %d media: %d, returns: %d\n",
+ DEBUGOUT("found mac: %d media: %d, returns: %d",
hw->mac.type, hw->phy.media_type, err);
return err;
}
**/
s32 ngbe_enable_rx_dma(struct ngbe_hw *hw, u32 regval)
{
- DEBUGFUNC("ngbe_enable_rx_dma");
-
/*
* Workaround silicon errata when enabling the Rx datapath.
* If traffic is incoming before we enable the Rx unit, it could hang
* the Rx DMA unit. Therefore, make sure the security engine is
* completely disabled prior to enabling the Rx unit.
*/
-
hw->mac.disable_sec_rx_path(hw);
if (regval & NGBE_PBRXCTL_ENA)
void ngbe_map_device_id(struct ngbe_hw *hw)
{
u16 oem = hw->sub_system_id & NGBE_OEM_MASK;
- u16 internal = hw->sub_system_id & NGBE_INTERNAL_MASK;
+
hw->is_pf = true;
/* move subsystem_device_id to device_id */
case NGBE_DEV_ID_EM_WX1860A1:
case NGBE_DEV_ID_EM_WX1860A1L:
hw->device_id = NGBE_DEV_ID_EM;
- if (oem == NGBE_LY_M88E1512_SFP ||
- internal == NGBE_INTERNAL_SFP)
+ if (oem == NGBE_M88E1512_SFP || oem == NGBE_LY_M88E1512_SFP)
hw->sub_device_id = NGBE_SUB_DEV_ID_EM_MVL_SFP;
- else if (hw->sub_system_id == NGBE_SUB_DEV_ID_EM_M88E1512_RJ45)
+ else if (oem == NGBE_M88E1512_RJ45 ||
+ (hw->sub_system_id == NGBE_SUB_DEV_ID_EM_M88E1512_RJ45))
hw->sub_device_id = NGBE_SUB_DEV_ID_EM_MVL_RGMII;
+ else if (oem == NGBE_M88E1512_MIX)
+ hw->sub_device_id = NGBE_SUB_DEV_ID_EM_MVL_MIX;
else if (oem == NGBE_YT8521S_SFP ||
- oem == NGBE_LY_YT8521S_SFP)
+ oem == NGBE_YT8521S_SFP_GPIO ||
+ oem == NGBE_LY_YT8521S_SFP)
hw->sub_device_id = NGBE_SUB_DEV_ID_EM_YT8521S_SFP;
+ else if (oem == NGBE_INTERNAL_YT8521S_SFP ||
+ oem == NGBE_INTERNAL_YT8521S_SFP_GPIO)
+ hw->sub_device_id = NGBE_SUB_DEV_ID_EM_RTL_YT8521S_SFP;
else
hw->sub_device_id = NGBE_SUB_DEV_ID_EM_RTL_SGMII;
break;
default:
break;
}
+
+ if (oem == NGBE_LY_M88E1512_SFP || oem == NGBE_YT8521S_SFP_GPIO ||
+ oem == NGBE_INTERNAL_YT8521S_SFP_GPIO ||
+ oem == NGBE_LY_YT8521S_SFP)
+ hw->gpio_ctl = true;
}
/**
struct ngbe_rom_info *rom = &hw->rom;
struct ngbe_mbx_info *mbx = &hw->mbx;
- DEBUGFUNC("ngbe_init_ops_pf");
-
/* BUS */
bus->set_lan_id = ngbe_set_lan_id_multi_port;
phy->read_reg_unlocked = ngbe_read_phy_reg_mdi;
phy->write_reg_unlocked = ngbe_write_phy_reg_mdi;
phy->reset_hw = ngbe_reset_phy;
+ phy->led_oem_chk = ngbe_phy_led_oem_chk;
/* MAC */
mac->init_hw = ngbe_init_hw;
{
s32 status = 0;
- DEBUGFUNC("ngbe_init_shared_code");
-
/*
* Set the mac type
*/