Lines Matching full:mac
27 struct spl2sw_mac *mac = netdev_priv(ndev); in spl2sw_ethernet_open() local
28 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_open()
31 netdev_dbg(ndev, "Open port = %x\n", mac->lan_port); in spl2sw_ethernet_open()
33 comm->enable |= mac->lan_port; in spl2sw_ethernet_open()
51 struct spl2sw_mac *mac = netdev_priv(ndev); in spl2sw_ethernet_stop() local
52 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_stop()
56 comm->enable &= ~mac->lan_port; in spl2sw_ethernet_stop()
68 struct spl2sw_mac *mac = netdev_priv(ndev); in spl2sw_ethernet_start_xmit() local
69 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_start_xmit()
110 cmd1 = TXD_OWN | TXD_SOP | TXD_EOP | (mac->to_vlan << 12) | in spl2sw_ethernet_start_xmit()
132 /* Trigger mac to transmit */ in spl2sw_ethernet_start_xmit()
141 struct spl2sw_mac *mac = netdev_priv(ndev); in spl2sw_ethernet_set_rx_mode() local
143 spl2sw_mac_rx_mode_set(mac); in spl2sw_ethernet_set_rx_mode()
148 struct spl2sw_mac *mac = netdev_priv(ndev); in spl2sw_ethernet_set_mac_address() local
155 /* Delete the old MAC address */ in spl2sw_ethernet_set_mac_address()
156 netdev_dbg(ndev, "Old Ethernet (MAC) address = %pM\n", mac->mac_addr); in spl2sw_ethernet_set_mac_address()
157 if (is_valid_ether_addr(mac->mac_addr)) { in spl2sw_ethernet_set_mac_address()
158 err = spl2sw_mac_addr_del(mac); in spl2sw_ethernet_set_mac_address()
163 /* Set the MAC address */ in spl2sw_ethernet_set_mac_address()
164 ether_addr_copy(mac->mac_addr, ndev->dev_addr); in spl2sw_ethernet_set_mac_address()
165 return spl2sw_mac_addr_add(mac); in spl2sw_ethernet_set_mac_address()
170 struct spl2sw_mac *mac = netdev_priv(ndev); in spl2sw_ethernet_tx_timeout() local
171 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_tx_timeout()
208 /* Byte order of MAC address of some samples are reversed. in spl2sw_check_mac_vendor_id_and_convert()
226 u8 *mac; in spl2sw_nvmem_get_mac_address() local
228 /* Get nvmem cell of mac-address from dts. */ in spl2sw_nvmem_get_mac_address()
229 cell = of_nvmem_cell_get(np, "mac-address"); in spl2sw_nvmem_get_mac_address()
233 /* Read mac address from nvmem cell. */ in spl2sw_nvmem_get_mac_address()
234 mac = nvmem_cell_read(cell, &len); in spl2sw_nvmem_get_mac_address()
236 if (IS_ERR(mac)) in spl2sw_nvmem_get_mac_address()
237 return PTR_ERR(mac); in spl2sw_nvmem_get_mac_address()
240 kfree(mac); in spl2sw_nvmem_get_mac_address()
241 dev_info(dev, "Invalid length of mac address in nvmem!\n"); in spl2sw_nvmem_get_mac_address()
248 spl2sw_check_mac_vendor_id_and_convert(mac); in spl2sw_nvmem_get_mac_address()
250 /* Check if mac address is valid */ in spl2sw_nvmem_get_mac_address()
251 if (!is_valid_ether_addr(mac)) { in spl2sw_nvmem_get_mac_address()
252 dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac); in spl2sw_nvmem_get_mac_address()
253 kfree(mac); in spl2sw_nvmem_get_mac_address()
257 ether_addr_copy(addrbuf, mac); in spl2sw_nvmem_get_mac_address()
258 kfree(mac); in spl2sw_nvmem_get_mac_address()
266 struct spl2sw_mac *mac; in spl2sw_init_netdev() local
272 ndev = devm_alloc_etherdev(&pdev->dev, sizeof(*mac)); in spl2sw_init_netdev()
279 mac = netdev_priv(ndev); in spl2sw_init_netdev()
280 mac->ndev = ndev; in spl2sw_init_netdev()
281 ether_addr_copy(mac->mac_addr, mac_addr); in spl2sw_init_netdev()
284 dev_info(&pdev->dev, "Ethernet (MAC) address = %pM\n", mac_addr); in spl2sw_init_netdev()
328 struct spl2sw_mac *mac; in spl2sw_probe() local
380 /* Reset MAC */ in spl2sw_probe()
397 dev_err(&pdev->dev, "Fail to initialize mac descriptors!\n"); in spl2sw_probe()
402 /* Initialize MAC. */ in spl2sw_probe()
441 /* Get mac-address from nvmem. */ in spl2sw_probe()
446 dev_info(&pdev->dev, "Generate a random mac address!\n"); in spl2sw_probe()
457 mac = netdev_priv(ndev); in spl2sw_probe()
458 mac->phy_node = phy_np; in spl2sw_probe()
459 mac->phy_mode = phy_mode; in spl2sw_probe()
460 mac->comm = comm; in spl2sw_probe()
462 mac->lan_port = 0x1 << i; /* forward to port i */ in spl2sw_probe()
463 mac->to_vlan = 0x1 << i; /* vlan group: i */ in spl2sw_probe()
464 mac->vlan_id = i; /* vlan group: i */ in spl2sw_probe()
466 /* Set MAC address */ in spl2sw_probe()
467 ret = spl2sw_mac_addr_add(mac); in spl2sw_probe()
471 spl2sw_mac_rx_mode_set(mac); in spl2sw_probe()