Lines Matching +full:hw +full:- +full:device +full:- +full:address
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* atlx.c -- common functions for Attansic network drivers
4 * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
5 * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com>
6 * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com>
10 * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
13 /* Including this file like a header is a temporary hack, I promise. -- CHS */
17 #include <linux/device.h>
31 static s32 atlx_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 *phy_data);
32 static u32 atlx_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr);
33 static void atlx_set_mac_addr(struct atl1_hw *hw);
50 return -EOPNOTSUPP; in atlx_ioctl()
55 * atlx_set_mac - Change the Ethernet Address of the NIC
56 * @netdev: network interface device structure
57 * @p: pointer to an address structure
67 return -EBUSY; in atlx_set_mac()
69 if (!is_valid_ether_addr(addr->sa_data)) in atlx_set_mac()
70 return -EADDRNOTAVAIL; in atlx_set_mac()
72 eth_hw_addr_set(netdev, addr->sa_data); in atlx_set_mac()
73 memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len); in atlx_set_mac()
75 atlx_set_mac_addr(&adapter->hw); in atlx_set_mac()
81 struct net_device *netdev = adapter->netdev; in atlx_check_for_link()
84 spin_lock(&adapter->lock); in atlx_check_for_link()
85 adapter->phy_timer_pending = false; in atlx_check_for_link()
86 atlx_read_phy_reg(&adapter->hw, MII_BMSR, &phy_data); in atlx_check_for_link()
87 atlx_read_phy_reg(&adapter->hw, MII_BMSR, &phy_data); in atlx_check_for_link()
88 spin_unlock(&adapter->lock); in atlx_check_for_link()
95 dev_info(&adapter->pdev->dev, "%s link is down\n", in atlx_check_for_link()
96 netdev->name); in atlx_check_for_link()
97 adapter->link_speed = SPEED_0; in atlx_check_for_link()
101 schedule_work(&adapter->link_chg_task); in atlx_check_for_link()
105 * atlx_set_multi - Multicast and Promiscuous mode set
106 * @netdev: network interface device structure
108 * The set_multi entry point is called whenever the multicast address
111 * promiscuous mode, and all-multi behavior.
116 struct atlx_hw *hw = &adapter->hw; in atlx_set_multi() local
122 rctl = ioread32(hw->hw_addr + REG_MAC_CTRL); in atlx_set_multi()
123 if (netdev->flags & IFF_PROMISC) in atlx_set_multi()
125 else if (netdev->flags & IFF_ALLMULTI) { in atlx_set_multi()
131 iowrite32(rctl, hw->hw_addr + REG_MAC_CTRL); in atlx_set_multi()
134 iowrite32(0, hw->hw_addr + REG_RX_HASH_TABLE); in atlx_set_multi()
135 iowrite32(0, (hw->hw_addr + REG_RX_HASH_TABLE) + (1 << 2)); in atlx_set_multi()
139 hash_value = atlx_hash_mc_addr(hw, ha->addr); in atlx_set_multi()
140 atlx_hash_set(hw, hash_value); in atlx_set_multi()
147 iowrite32(imr, adapter->hw.hw_addr + REG_IMR); in atlx_imr_set()
148 ioread32(adapter->hw.hw_addr + REG_IMR); in atlx_imr_set()
152 * atlx_irq_enable - Enable default interrupt generation settings
158 adapter->int_enabled = true; in atlx_irq_enable()
162 * atlx_irq_disable - Mask off interrupt generation on the NIC
167 adapter->int_enabled = false; in atlx_irq_disable()
169 synchronize_irq(adapter->pdev->irq); in atlx_irq_disable()
177 spin_lock_irqsave(&adapter->lock, flags); in atlx_clear_phy_int()
178 atlx_read_phy_reg(&adapter->hw, 19, &phy_data); in atlx_clear_phy_int()
179 spin_unlock_irqrestore(&adapter->lock, flags); in atlx_clear_phy_int()
183 * atlx_tx_timeout - Respond to a Tx Hang
184 * @netdev: network interface device structure
190 schedule_work(&adapter->reset_dev_task); in atlx_tx_timeout()
194 * atlx_link_chg_task - deal with link change event Out of interrupt context
203 spin_lock_irqsave(&adapter->lock, flags); in atlx_link_chg_task()
205 spin_unlock_irqrestore(&adapter->lock, flags); in atlx_link_chg_task()
226 spin_lock_irqsave(&adapter->lock, flags); in atlx_vlan_mode()
228 ctrl = ioread32(adapter->hw.hw_addr + REG_MAC_CTRL); in atlx_vlan_mode()
230 iowrite32(ctrl, adapter->hw.hw_addr + REG_MAC_CTRL); in atlx_vlan_mode()
232 spin_unlock_irqrestore(&adapter->lock, flags); in atlx_vlan_mode()
237 atlx_vlan_mode(adapter->netdev, adapter->netdev->features); in atlx_restore_vlan()
258 netdev_features_t changed = netdev->features ^ features; in atlx_set_features()