// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright(c) 2007 Atheros Corporation. All rights reserved. * * Derived from Intel e1000 driver * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. */ #include <linux/pci.h> #include <linux/delay.h> #include <linux/mii.h> #include <linux/crc32.h> #include "atl1c.h" /* * check_eeprom_exist * return 1 if eeprom exist */ int atl1c_check_eeprom_exist(struct atl1c_hw *hw) { … } void atl1c_hw_set_mac_addr(struct atl1c_hw *hw, u8 *mac_addr) { … } /* read mac address from hardware register */ static bool atl1c_read_current_addr(struct atl1c_hw *hw, u8 *eth_addr) { … } /* * atl1c_get_permanent_address * return 0 if get valid mac address, */ static int atl1c_get_permanent_address(struct atl1c_hw *hw) { … } bool atl1c_read_eeprom(struct atl1c_hw *hw, u32 offset, u32 *p_value) { … } /* * Reads the adapter's MAC address from the EEPROM * * hw - Struct containing variables accessed by shared code */ int atl1c_read_mac_addr(struct atl1c_hw *hw) { … } /* * atl1c_hash_mc_addr * purpose * set hash value for a multicast address * hash calcu processing : * 1. calcu 32bit CRC for multicast address * 2. reverse crc with MSB to LSB */ u32 atl1c_hash_mc_addr(struct atl1c_hw *hw, u8 *mc_addr) { … } /* * Sets the bit in the multicast table corresponding to the hash value. * hw - Struct containing variables accessed by shared code * hash_value - Multicast address hash value */ void atl1c_hash_set(struct atl1c_hw *hw, u32 hash_value) { … } /* * wait mdio module be idle * return true: idle * false: still busy */ bool atl1c_wait_mdio_idle(struct atl1c_hw *hw) { … } void atl1c_stop_phy_polling(struct atl1c_hw *hw) { … } void atl1c_start_phy_polling(struct atl1c_hw *hw, u16 clk_sel) { … } /* * atl1c_read_phy_core * core function to read register in PHY via MDIO control register. * ext: extension register (see IEEE 802.3) * dev: device address (see IEEE 802.3 DEVAD, PRTAD is fixed to 0) * reg: reg to read */ int atl1c_read_phy_core(struct atl1c_hw *hw, bool ext, u8 dev, u16 reg, u16 *phy_data) { … } /* * atl1c_write_phy_core * core function to write to register in PHY via MDIO control register. * ext: extension register (see IEEE 802.3) * dev: device address (see IEEE 802.3 DEVAD, PRTAD is fixed to 0) * reg: reg to write */ int atl1c_write_phy_core(struct atl1c_hw *hw, bool ext, u8 dev, u16 reg, u16 phy_data) { … } /* * Reads the value from a PHY register * hw - Struct containing variables accessed by shared code * reg_addr - address of the PHY register to read */ int atl1c_read_phy_reg(struct atl1c_hw *hw, u16 reg_addr, u16 *phy_data) { … } /* * Writes a value to a PHY register * hw - Struct containing variables accessed by shared code * reg_addr - address of the PHY register to write * data - data to write to the PHY */ int atl1c_write_phy_reg(struct atl1c_hw *hw, u32 reg_addr, u16 phy_data) { … } /* read from PHY extension register */ int atl1c_read_phy_ext(struct atl1c_hw *hw, u8 dev_addr, u16 reg_addr, u16 *phy_data) { … } /* write to PHY extension register */ int atl1c_write_phy_ext(struct atl1c_hw *hw, u8 dev_addr, u16 reg_addr, u16 phy_data) { … } int atl1c_read_phy_dbg(struct atl1c_hw *hw, u16 reg_addr, u16 *phy_data) { … } int atl1c_write_phy_dbg(struct atl1c_hw *hw, u16 reg_addr, u16 phy_data) { … } /* * Configures PHY autoneg and flow control advertisement settings * * hw - Struct containing variables accessed by shared code */ static int atl1c_phy_setup_adv(struct atl1c_hw *hw) { … } void atl1c_phy_disable(struct atl1c_hw *hw) { … } int atl1c_phy_reset(struct atl1c_hw *hw) { … } int atl1c_phy_init(struct atl1c_hw *hw) { … } bool atl1c_get_link_status(struct atl1c_hw *hw) { … } /* * Detects the current speed and duplex settings of the hardware. * * hw - Struct containing variables accessed by shared code * speed - Speed of the connection * duplex - Duplex setting of the connection */ int atl1c_get_speed_and_duplex(struct atl1c_hw *hw, u16 *speed, u16 *duplex) { … } /* select one link mode to get lower power consumption */ int atl1c_phy_to_ps_link(struct atl1c_hw *hw) { … } int atl1c_restart_autoneg(struct atl1c_hw *hw) { … } int atl1c_power_saving(struct atl1c_hw *hw, u32 wufc) { … } /* configure phy after Link change Event */ void atl1c_post_phy_linkchg(struct atl1c_hw *hw, u16 link_speed) { … }