| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2014-2015 Hisilicon Limited. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 6 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | | - * (at your option) any later version. |
|---|
| 8 | 4 | */ |
|---|
| 9 | 5 | |
|---|
| 10 | 6 | #include <linux/acpi.h> |
|---|
| .. | .. |
|---|
| 370 | 366 | static void hns_mac_param_get(struct mac_params *param, |
|---|
| 371 | 367 | struct hns_mac_cb *mac_cb) |
|---|
| 372 | 368 | { |
|---|
| 373 | | - param->vaddr = (void *)mac_cb->vaddr; |
|---|
| 369 | + param->vaddr = mac_cb->vaddr; |
|---|
| 374 | 370 | param->mac_mode = hns_get_enet_interface(mac_cb); |
|---|
| 375 | 371 | ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr); |
|---|
| 376 | 372 | param->mac_id = mac_cb->mac_id; |
|---|
| .. | .. |
|---|
| 378 | 374 | } |
|---|
| 379 | 375 | |
|---|
| 380 | 376 | /** |
|---|
| 381 | | - *hns_mac_queue_config_bc_en - set broadcast rx&tx enable |
|---|
| 382 | | - *@mac_cb: mac device |
|---|
| 383 | | - *@queue: queue number |
|---|
| 384 | | - *@en:enable |
|---|
| 385 | | - *retuen 0 - success , negative --fail |
|---|
| 377 | + * hns_mac_queue_config_bc_en - set broadcast rx&tx enable |
|---|
| 378 | + * @mac_cb: mac device |
|---|
| 379 | + * @port_num: queue number |
|---|
| 380 | + * @vlan_id: vlan id` |
|---|
| 381 | + * @enable: enable |
|---|
| 382 | + * return 0 - success , negative --fail |
|---|
| 386 | 383 | */ |
|---|
| 387 | 384 | static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb, |
|---|
| 388 | 385 | u32 port_num, u16 vlan_id, bool enable) |
|---|
| .. | .. |
|---|
| 412 | 409 | } |
|---|
| 413 | 410 | |
|---|
| 414 | 411 | /** |
|---|
| 415 | | - *hns_mac_vm_config_bc_en - set broadcast rx&tx enable |
|---|
| 416 | | - *@mac_cb: mac device |
|---|
| 417 | | - *@vmid: vm id |
|---|
| 418 | | - *@en:enable |
|---|
| 419 | | - *retuen 0 - success , negative --fail |
|---|
| 412 | + * hns_mac_vm_config_bc_en - set broadcast rx&tx enable |
|---|
| 413 | + * @mac_cb: mac device |
|---|
| 414 | + * @vmid: vm id |
|---|
| 415 | + * @enable: enable |
|---|
| 416 | + * return 0 - success , negative --fail |
|---|
| 420 | 417 | */ |
|---|
| 421 | 418 | int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, bool enable) |
|---|
| 422 | 419 | { |
|---|
| .. | .. |
|---|
| 546 | 543 | /** |
|---|
| 547 | 544 | * hns_mac_get_autoneg - get auto autonegotiation |
|---|
| 548 | 545 | * @mac_cb: mac control block |
|---|
| 549 | | - * @enable: enable or not |
|---|
| 550 | | - * retuen 0 - success , negative --fail |
|---|
| 546 | + * @auto_neg: output pointer to autoneg result |
|---|
| 547 | + * return 0 - success , negative --fail |
|---|
| 551 | 548 | */ |
|---|
| 552 | 549 | void hns_mac_get_autoneg(struct hns_mac_cb *mac_cb, u32 *auto_neg) |
|---|
| 553 | 550 | { |
|---|
| .. | .. |
|---|
| 564 | 561 | * @mac_cb: mac control block |
|---|
| 565 | 562 | * @rx_en: rx enable status |
|---|
| 566 | 563 | * @tx_en: tx enable status |
|---|
| 567 | | - * retuen 0 - success , negative --fail |
|---|
| 564 | + * return 0 - success , negative --fail |
|---|
| 568 | 565 | */ |
|---|
| 569 | 566 | void hns_mac_get_pauseparam(struct hns_mac_cb *mac_cb, u32 *rx_en, u32 *tx_en) |
|---|
| 570 | 567 | { |
|---|
| .. | .. |
|---|
| 582 | 579 | * hns_mac_set_autoneg - set auto autonegotiation |
|---|
| 583 | 580 | * @mac_cb: mac control block |
|---|
| 584 | 581 | * @enable: enable or not |
|---|
| 585 | | - * retuen 0 - success , negative --fail |
|---|
| 582 | + * return 0 - success , negative --fail |
|---|
| 586 | 583 | */ |
|---|
| 587 | 584 | int hns_mac_set_autoneg(struct hns_mac_cb *mac_cb, u8 enable) |
|---|
| 588 | 585 | { |
|---|
| .. | .. |
|---|
| 627 | 624 | /** |
|---|
| 628 | 625 | * hns_mac_init_ex - mac init |
|---|
| 629 | 626 | * @mac_cb: mac control block |
|---|
| 630 | | - * retuen 0 - success , negative --fail |
|---|
| 627 | + * return 0 - success , negative --fail |
|---|
| 631 | 628 | */ |
|---|
| 632 | 629 | static int hns_mac_init_ex(struct hns_mac_cb *mac_cb) |
|---|
| 633 | 630 | { |
|---|
| .. | .. |
|---|
| 701 | 698 | return rc; |
|---|
| 702 | 699 | |
|---|
| 703 | 700 | if (!strcmp(phy_type, phy_modes(PHY_INTERFACE_MODE_XGMII))) |
|---|
| 704 | | - is_c45 = 1; |
|---|
| 701 | + is_c45 = true; |
|---|
| 705 | 702 | else if (!strcmp(phy_type, phy_modes(PHY_INTERFACE_MODE_SGMII))) |
|---|
| 706 | | - is_c45 = 0; |
|---|
| 703 | + is_c45 = false; |
|---|
| 707 | 704 | else |
|---|
| 708 | 705 | return -ENODATA; |
|---|
| 709 | 706 | |
|---|
| .. | .. |
|---|
| 804 | 801 | /** |
|---|
| 805 | 802 | *hns_mac_get_info - get mac information from device node |
|---|
| 806 | 803 | *@mac_cb: mac device |
|---|
| 807 | | - *@np:device node |
|---|
| 808 | 804 | * return: 0 --success, negative --fail |
|---|
| 809 | 805 | */ |
|---|
| 810 | 806 | static int hns_mac_get_info(struct hns_mac_cb *mac_cb) |
|---|
| .. | .. |
|---|
| 848 | 844 | */ |
|---|
| 849 | 845 | put_device(&mac_cb->phy_dev->mdio.dev); |
|---|
| 850 | 846 | |
|---|
| 851 | | - dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n", |
|---|
| 852 | | - mac_cb->mac_id, np->name); |
|---|
| 847 | + dev_dbg(mac_cb->dev, "mac%d phy_node: %pOFn\n", |
|---|
| 848 | + mac_cb->mac_id, np); |
|---|
| 853 | 849 | } |
|---|
| 854 | 850 | of_node_put(np); |
|---|
| 855 | 851 | |
|---|
| .. | .. |
|---|
| 866 | 862 | * if the phy_dev is found |
|---|
| 867 | 863 | */ |
|---|
| 868 | 864 | put_device(&mac_cb->phy_dev->mdio.dev); |
|---|
| 869 | | - dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n", |
|---|
| 870 | | - mac_cb->mac_id, np->name); |
|---|
| 865 | + dev_dbg(mac_cb->dev, "mac%d phy_node: %pOFn\n", |
|---|
| 866 | + mac_cb->mac_id, np); |
|---|
| 871 | 867 | } |
|---|
| 872 | 868 | of_node_put(np); |
|---|
| 873 | 869 | |
|---|
| .. | .. |
|---|
| 955 | 951 | /** |
|---|
| 956 | 952 | * hns_mac_get_mode - get mac mode |
|---|
| 957 | 953 | * @phy_if: phy interface |
|---|
| 958 | | - * retuen 0 - gmac, 1 - xgmac , negative --fail |
|---|
| 954 | + * return 0 - gmac, 1 - xgmac , negative --fail |
|---|
| 959 | 955 | */ |
|---|
| 960 | 956 | static int hns_mac_get_mode(phy_interface_t phy_if) |
|---|
| 961 | 957 | { |
|---|