mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
Merge d0f1c248b4 ("Merge tag 'for-net-next-2021-10-01' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next") into android-mainline
Steps on the way to 5.16-rc1 Resolves merge conflicts with: tools/testing/selftests/net/ioam6.sh Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I2c7f5ee7cb7c5df2b757d7284e23eb5bd9851851
This commit is contained in:
@@ -100,15 +100,18 @@ additionalProperties: false
|
||||
examples:
|
||||
# Lager board
|
||||
- |
|
||||
#include <dt-bindings/clock/r8a7790-clock.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/clock/r8a7790-cpg-mssr.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/power/r8a7790-sysc.h>
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
ethernet@ee700000 {
|
||||
compatible = "renesas,ether-r8a7790", "renesas,rcar-gen2-ether";
|
||||
reg = <0xee700000 0x400>;
|
||||
interrupt-parent = <&gic>;
|
||||
interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&mstp8_clks R8A7790_CLK_ETHER>;
|
||||
interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&cpg CPG_MOD 813>;
|
||||
power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
|
||||
resets = <&cpg 813>;
|
||||
phy-mode = "rmii";
|
||||
phy-handle = <&phy1>;
|
||||
renesas,ether-link-active-low;
|
||||
@@ -116,8 +119,12 @@ examples:
|
||||
#size-cells = <0>;
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-id0022.1537",
|
||||
"ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
interrupt-parent = <&irqc0>;
|
||||
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
|
||||
micrel,led-mode = <1>;
|
||||
reset-gpios = <&gpio5 31 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -287,6 +287,7 @@ examples:
|
||||
"ch13", "ch14", "ch15", "ch16", "ch17", "ch18",
|
||||
"ch19", "ch20", "ch21", "ch22", "ch23", "ch24";
|
||||
clocks = <&cpg CPG_MOD 812>;
|
||||
clock-names = "fck";
|
||||
iommus = <&ipmmu_ds0 16>;
|
||||
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
|
||||
resets = <&cpg 812>;
|
||||
@@ -298,6 +299,8 @@ examples:
|
||||
#size-cells = <0>;
|
||||
|
||||
phy0: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-id0022.1622",
|
||||
"ethernet-phy-ieee802.3-c22";
|
||||
rxc-skew-ps = <1500>;
|
||||
reg = <0>;
|
||||
interrupt-parent = <&gpio2>;
|
||||
|
||||
@@ -26,23 +26,6 @@ The ``iosm`` driver implements the following driver-specific parameters.
|
||||
the device during firmware flashing.
|
||||
If set, Full nand erase command will be sent to the device. By default,
|
||||
only conditional erase support is enabled.
|
||||
* - ``download_region``
|
||||
- u8
|
||||
- runtime
|
||||
- download_region parameter is used to identify if we are flashing the
|
||||
loadmap/region file during the firmware flashing.
|
||||
* - ``address``
|
||||
- u32
|
||||
- runtime
|
||||
- address parameter is used to send the address information of the
|
||||
loadmap/region file which is required during the firmware flashing
|
||||
process. Each region file has be flashed to its respective flash address.
|
||||
* - ``region_count``
|
||||
- u8
|
||||
- runtime
|
||||
- region_count parameter is used to inform the driver on how many total
|
||||
loadmap/region files are present in modem firmware image that has to be
|
||||
flashed.
|
||||
|
||||
|
||||
Flash Update
|
||||
@@ -87,7 +70,7 @@ Flash Commands:
|
||||
1) When modem is in Boot ROM stage, user can use below command to inject PSI RAM
|
||||
image using devlink flash command.
|
||||
|
||||
$ devlink dev flash pci/0000:02:00.0 file <PSI_RAM_File_name> component PSI
|
||||
$ devlink dev flash pci/0000:02:00.0 file <PSI_RAM_File_name>
|
||||
|
||||
2) If user want to do a full erase, below command need to be issued to set the
|
||||
erase full flash param (To be set only if full erase required).
|
||||
@@ -95,22 +78,19 @@ erase full flash param (To be set only if full erase required).
|
||||
$ devlink dev param set pci/0000:02:00.0 name erase_full_flash value true cmode runtime
|
||||
|
||||
3) Inject EBL after the modem is in PSI stage.
|
||||
$ devlink dev flash pci/0000:02:00.0 file <EBL_File_name> component EBL
|
||||
|
||||
$ devlink dev flash pci/0000:02:00.0 file <EBL_File_name>
|
||||
|
||||
4) Once EBL is injected successfully, then the actual firmware flashing takes
|
||||
place. Below is the sequence of commands used for each of the firmware images.
|
||||
|
||||
a) Flash secure bin file.
|
||||
$ devlink dev flash pci/0000:02:00.0 file <Secure_bin_file_name> component FLS
|
||||
|
||||
$ devlink dev flash pci/0000:02:00.0 file <Secure_bin_file_name>
|
||||
|
||||
b) Flashing the Loadmap/Region file
|
||||
$ devlink dev param set pci/0000:02:00.0 name region_count value 1 cmode runtime
|
||||
|
||||
$ devlink dev param set pci/0000:02:00.0 name download_region value true cmode runtime
|
||||
|
||||
$ devlink dev param set pci/0000:02:00.0 name address value <Nand_address> cmode runtime
|
||||
|
||||
$ devlink dev flash pci/0000:02:00.0 file <Load_map_file_name> component FLS
|
||||
$ devlink dev flash pci/0000:02:00.0 file <Load_map_file_name>
|
||||
|
||||
Regions
|
||||
=======
|
||||
|
||||
@@ -200,7 +200,7 @@ static struct net_device * __init nfeth_probe(int unit)
|
||||
dev->irq = nfEtherIRQ;
|
||||
dev->netdev_ops = &nfeth_netdev_ops;
|
||||
|
||||
memcpy(dev->dev_addr, mac, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, mac);
|
||||
|
||||
priv = netdev_priv(dev);
|
||||
priv->ethX = unit;
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
#define SO_BUF_LOCK 0x0051
|
||||
|
||||
#define SO_RESEVE_MEM 0x0052
|
||||
#define SO_RESERVE_MEM 0x0052
|
||||
|
||||
|
||||
#if !defined(__KERNEL__)
|
||||
|
||||
@@ -467,7 +467,7 @@ static int iss_net_set_mac(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(hwaddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
spin_lock_bh(&lp->lock);
|
||||
memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, hwaddr->sa_data);
|
||||
spin_unlock_bh(&lp->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1037,8 +1037,9 @@ static bool btintel_firmware_version(struct hci_dev *hdev,
|
||||
|
||||
params = (void *)(fw_ptr + sizeof(*cmd));
|
||||
|
||||
bt_dev_info(hdev, "Boot Address: 0x%x",
|
||||
le32_to_cpu(params->boot_addr));
|
||||
*boot_addr = le32_to_cpu(params->boot_addr);
|
||||
|
||||
bt_dev_info(hdev, "Boot Address: 0x%x", *boot_addr);
|
||||
|
||||
bt_dev_info(hdev, "Firmware Version: %u-%u.%u",
|
||||
params->fw_build_num, params->fw_build_ww,
|
||||
@@ -1071,9 +1072,6 @@ int btintel_download_firmware(struct hci_dev *hdev,
|
||||
/* Skip version checking */
|
||||
break;
|
||||
default:
|
||||
/* Skip reading firmware file version in bootloader mode */
|
||||
if (ver->fw_variant == 0x06)
|
||||
break;
|
||||
|
||||
/* Skip download if firmware has the same version */
|
||||
if (btintel_firmware_version(hdev, ver->fw_build_num,
|
||||
@@ -1114,19 +1112,16 @@ static int btintel_download_fw_tlv(struct hci_dev *hdev,
|
||||
int err;
|
||||
u32 css_header_ver;
|
||||
|
||||
/* Skip reading firmware file version in bootloader mode */
|
||||
if (ver->img_type != 0x01) {
|
||||
/* Skip download if firmware has the same version */
|
||||
if (btintel_firmware_version(hdev, ver->min_fw_build_nn,
|
||||
ver->min_fw_build_cw,
|
||||
ver->min_fw_build_yy,
|
||||
fw, boot_param)) {
|
||||
bt_dev_info(hdev, "Firmware already loaded");
|
||||
/* Return -EALREADY to indicate that firmware has
|
||||
* already been loaded.
|
||||
*/
|
||||
return -EALREADY;
|
||||
}
|
||||
/* Skip download if firmware has the same version */
|
||||
if (btintel_firmware_version(hdev, ver->min_fw_build_nn,
|
||||
ver->min_fw_build_cw,
|
||||
ver->min_fw_build_yy,
|
||||
fw, boot_param)) {
|
||||
bt_dev_info(hdev, "Firmware already loaded");
|
||||
/* Return -EALREADY to indicate that firmware has
|
||||
* already been loaded.
|
||||
*/
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
/* The firmware variant determines if the device is in bootloader
|
||||
@@ -1285,12 +1280,16 @@ static int btintel_read_debug_features(struct hci_dev *hdev,
|
||||
static int btintel_set_debug_features(struct hci_dev *hdev,
|
||||
const struct intel_debug_features *features)
|
||||
{
|
||||
u8 mask[11] = { 0x0a, 0x92, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||
u8 mask[11] = { 0x0a, 0x92, 0x02, 0x7f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00 };
|
||||
u8 period[5] = { 0x04, 0x91, 0x02, 0x05, 0x00 };
|
||||
u8 trace_enable = 0x02;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (!features)
|
||||
if (!features) {
|
||||
bt_dev_warn(hdev, "Debug features not read");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(features->page1[0] & 0x3f)) {
|
||||
bt_dev_info(hdev, "Telemetry exception format not supported");
|
||||
@@ -1303,11 +1302,95 @@ static int btintel_set_debug_features(struct hci_dev *hdev,
|
||||
PTR_ERR(skb));
|
||||
return PTR_ERR(skb);
|
||||
}
|
||||
|
||||
kfree_skb(skb);
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc8b, 5, period, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
bt_dev_err(hdev, "Setting periodicity for link statistics traces failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return PTR_ERR(skb);
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfca1, 1, &trace_enable, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
bt_dev_err(hdev, "Enable tracing of link statistics events failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return PTR_ERR(skb);
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
bt_dev_info(hdev, "set debug features: trace_enable 0x%02x mask 0x%02x",
|
||||
trace_enable, mask[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btintel_reset_debug_features(struct hci_dev *hdev,
|
||||
const struct intel_debug_features *features)
|
||||
{
|
||||
u8 mask[11] = { 0x0a, 0x92, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00 };
|
||||
u8 trace_enable = 0x00;
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (!features) {
|
||||
bt_dev_warn(hdev, "Debug features not read");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(features->page1[0] & 0x3f)) {
|
||||
bt_dev_info(hdev, "Telemetry exception format not supported");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Should stop the trace before writing ddc event mask. */
|
||||
skb = __hci_cmd_sync(hdev, 0xfca1, 1, &trace_enable, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
bt_dev_err(hdev, "Stop tracing of link statistics events failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return PTR_ERR(skb);
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc8b, 11, mask, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
bt_dev_err(hdev, "Setting Intel telemetry ddc write event mask failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return PTR_ERR(skb);
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
bt_dev_info(hdev, "reset debug features: trace_enable 0x%02x mask 0x%02x",
|
||||
trace_enable, mask[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int btintel_set_quality_report(struct hci_dev *hdev, bool enable)
|
||||
{
|
||||
struct intel_debug_features features;
|
||||
int err;
|
||||
|
||||
bt_dev_dbg(hdev, "enable %d", enable);
|
||||
|
||||
/* Read the Intel supported features and if new exception formats
|
||||
* supported, need to load the additional DDC config to enable.
|
||||
*/
|
||||
err = btintel_read_debug_features(hdev, &features);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* Set or reset the debug features. */
|
||||
if (enable)
|
||||
err = btintel_set_debug_features(hdev, &features);
|
||||
else
|
||||
err = btintel_reset_debug_features(hdev, &features);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(btintel_set_quality_report);
|
||||
|
||||
static const struct firmware *btintel_legacy_rom_get_fw(struct hci_dev *hdev,
|
||||
struct intel_version *ver)
|
||||
{
|
||||
@@ -1893,7 +1976,6 @@ static int btintel_bootloader_setup(struct hci_dev *hdev,
|
||||
u32 boot_param;
|
||||
char ddcname[64];
|
||||
int err;
|
||||
struct intel_debug_features features;
|
||||
|
||||
BT_DBG("%s", hdev->name);
|
||||
|
||||
@@ -1934,14 +2016,7 @@ static int btintel_bootloader_setup(struct hci_dev *hdev,
|
||||
btintel_load_ddc_config(hdev, ddcname);
|
||||
}
|
||||
|
||||
/* Read the Intel supported features and if new exception formats
|
||||
* supported, need to load the additional DDC config to enable.
|
||||
*/
|
||||
err = btintel_read_debug_features(hdev, &features);
|
||||
if (!err) {
|
||||
/* Set DDC mask for available debug features */
|
||||
btintel_set_debug_features(hdev, &features);
|
||||
}
|
||||
hci_dev_clear_flag(hdev, HCI_QUALITY_REPORT);
|
||||
|
||||
/* Read the Intel version information after loading the FW */
|
||||
err = btintel_read_version(hdev, &new_ver);
|
||||
@@ -2083,13 +2158,102 @@ done:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int btintel_get_codec_config_data(struct hci_dev *hdev,
|
||||
__u8 link, struct bt_codec *codec,
|
||||
__u8 *ven_len, __u8 **ven_data)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (!ven_data || !ven_len)
|
||||
return -EINVAL;
|
||||
|
||||
*ven_len = 0;
|
||||
*ven_data = NULL;
|
||||
|
||||
if (link != ESCO_LINK) {
|
||||
bt_dev_err(hdev, "Invalid link type(%u)", link);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*ven_data = kmalloc(sizeof(__u8), GFP_KERNEL);
|
||||
if (!*ven_data) {
|
||||
err = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* supports only CVSD and mSBC offload codecs */
|
||||
switch (codec->id) {
|
||||
case 0x02:
|
||||
**ven_data = 0x00;
|
||||
break;
|
||||
case 0x05:
|
||||
**ven_data = 0x01;
|
||||
break;
|
||||
default:
|
||||
err = -EINVAL;
|
||||
bt_dev_err(hdev, "Invalid codec id(%u)", codec->id);
|
||||
goto error;
|
||||
}
|
||||
/* codec and its capabilities are pre-defined to ids
|
||||
* preset id = 0x00 represents CVSD codec with sampling rate 8K
|
||||
* preset id = 0x01 represents mSBC codec with sampling rate 16K
|
||||
*/
|
||||
*ven_len = sizeof(__u8);
|
||||
return err;
|
||||
|
||||
error:
|
||||
kfree(*ven_data);
|
||||
*ven_data = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int btintel_get_data_path_id(struct hci_dev *hdev, __u8 *data_path_id)
|
||||
{
|
||||
/* Intel uses 1 as data path id for all the usecases */
|
||||
*data_path_id = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btintel_configure_offload(struct hci_dev *hdev)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int err = 0;
|
||||
struct intel_offload_use_cases *use_cases;
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc86, 0, NULL, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
bt_dev_err(hdev, "Reading offload use cases failed (%ld)",
|
||||
PTR_ERR(skb));
|
||||
return PTR_ERR(skb);
|
||||
}
|
||||
|
||||
if (skb->len < sizeof(*use_cases)) {
|
||||
err = -EIO;
|
||||
goto error;
|
||||
}
|
||||
|
||||
use_cases = (void *)skb->data;
|
||||
|
||||
if (use_cases->status) {
|
||||
err = -bt_to_errno(skb->data[0]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (use_cases->preset[0] & 0x03) {
|
||||
hdev->get_data_path_id = btintel_get_data_path_id;
|
||||
hdev->get_codec_config_data = btintel_get_codec_config_data;
|
||||
}
|
||||
error:
|
||||
kfree_skb(skb);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
|
||||
struct intel_version_tlv *ver)
|
||||
{
|
||||
u32 boot_param;
|
||||
char ddcname[64];
|
||||
int err;
|
||||
struct intel_debug_features features;
|
||||
struct intel_version_tlv new_ver;
|
||||
|
||||
bt_dev_dbg(hdev, "");
|
||||
@@ -2125,14 +2289,10 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
|
||||
*/
|
||||
btintel_load_ddc_config(hdev, ddcname);
|
||||
|
||||
/* Read the Intel supported features and if new exception formats
|
||||
* supported, need to load the additional DDC config to enable.
|
||||
*/
|
||||
err = btintel_read_debug_features(hdev, &features);
|
||||
if (!err) {
|
||||
/* Set DDC mask for available debug features */
|
||||
btintel_set_debug_features(hdev, &features);
|
||||
}
|
||||
/* Read supported use cases and set callbacks to fetch datapath id */
|
||||
btintel_configure_offload(hdev);
|
||||
|
||||
hci_dev_clear_flag(hdev, HCI_QUALITY_REPORT);
|
||||
|
||||
/* Read the Intel version information after loading the FW */
|
||||
err = btintel_read_version_tlv(hdev, &new_ver);
|
||||
@@ -2232,6 +2392,9 @@ static int btintel_setup_combined(struct hci_dev *hdev)
|
||||
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
|
||||
set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks);
|
||||
|
||||
/* Set up the quality report callback for Intel devices */
|
||||
hdev->set_quality_report = btintel_set_quality_report;
|
||||
|
||||
/* For Legacy device, check the HW platform value and size */
|
||||
if (skb->len == sizeof(ver) && skb->data[1] == 0x37) {
|
||||
bt_dev_dbg(hdev, "Read the legacy Intel version information");
|
||||
|
||||
@@ -132,6 +132,11 @@ struct intel_debug_features {
|
||||
__u8 page1[16];
|
||||
} __packed;
|
||||
|
||||
struct intel_offload_use_cases {
|
||||
__u8 status;
|
||||
__u8 preset[8];
|
||||
} __packed;
|
||||
|
||||
#define INTEL_HW_PLATFORM(cnvx_bt) ((u8)(((cnvx_bt) & 0x0000ff00) >> 8))
|
||||
#define INTEL_HW_VARIANT(cnvx_bt) ((u8)(((cnvx_bt) & 0x003f0000) >> 16))
|
||||
#define INTEL_CNVX_TOP_TYPE(cnvx_top) ((cnvx_top) & 0x00000fff)
|
||||
@@ -204,6 +209,7 @@ int btintel_configure_setup(struct hci_dev *hdev);
|
||||
void btintel_bootup(struct hci_dev *hdev, const void *ptr, unsigned int len);
|
||||
void btintel_secure_send_result(struct hci_dev *hdev,
|
||||
const void *ptr, unsigned int len);
|
||||
int btintel_set_quality_report(struct hci_dev *hdev, bool enable);
|
||||
#else
|
||||
|
||||
static inline int btintel_check_bdaddr(struct hci_dev *hdev)
|
||||
@@ -294,4 +300,9 @@ static inline void btintel_secure_send_result(struct hci_dev *hdev,
|
||||
const void *ptr, unsigned int len)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int btintel_set_quality_report(struct hci_dev *hdev, bool enable)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -587,12 +587,12 @@ static int btmrvl_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool btmrvl_prevent_wake(struct hci_dev *hdev)
|
||||
static bool btmrvl_wakeup(struct hci_dev *hdev)
|
||||
{
|
||||
struct btmrvl_private *priv = hci_get_drvdata(hdev);
|
||||
struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
|
||||
|
||||
return !device_may_wakeup(&card->func->dev);
|
||||
return device_may_wakeup(&card->func->dev);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -696,7 +696,7 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
|
||||
hdev->send = btmrvl_send_frame;
|
||||
hdev->setup = btmrvl_setup;
|
||||
hdev->set_bdaddr = btmrvl_set_bdaddr;
|
||||
hdev->prevent_wake = btmrvl_prevent_wake;
|
||||
hdev->wakeup = btmrvl_wakeup;
|
||||
SET_HCIDEV_DEV(hdev, &card->func->dev);
|
||||
|
||||
hdev->dev_type = priv->btmrvl_dev.dev_type;
|
||||
|
||||
@@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
|
||||
int err;
|
||||
|
||||
hlen = sizeof(*hdr) + wmt_params->dlen;
|
||||
if (hlen > 255)
|
||||
return -EINVAL;
|
||||
if (hlen > 255) {
|
||||
err = -EINVAL;
|
||||
goto err_free_skb;
|
||||
}
|
||||
|
||||
hdr = (struct mtk_wmt_hdr *)&wc;
|
||||
hdr->dir = 1;
|
||||
@@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
|
||||
err = __hci_cmd_send(hdev, 0xfc6f, hlen, &wc);
|
||||
if (err < 0) {
|
||||
clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
|
||||
return err;
|
||||
goto err_free_skb;
|
||||
}
|
||||
|
||||
/* The vendor specific WMT commands are all answered by a vendor
|
||||
@@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,
|
||||
if (err == -EINTR) {
|
||||
bt_dev_err(hdev, "Execution of wmt command interrupted");
|
||||
clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
|
||||
return err;
|
||||
goto err_free_skb;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
bt_dev_err(hdev, "Execution of wmt command timed out");
|
||||
clear_bit(BTMTKUART_TX_WAIT_VND_EVT, &bdev->tx_state);
|
||||
return -ETIMEDOUT;
|
||||
err = -ETIMEDOUT;
|
||||
goto err_free_skb;
|
||||
}
|
||||
|
||||
/* Parse and handle the return WMT event */
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <net/rsi_91x.h>
|
||||
#include <net/genetlink.h>
|
||||
|
||||
#define RSI_DMA_ALIGN 8
|
||||
#define RSI_FRAME_DESC_SIZE 16
|
||||
|
||||
@@ -59,6 +59,7 @@ struct id_table {
|
||||
__u8 hci_bus;
|
||||
bool config_needed;
|
||||
bool has_rom_version;
|
||||
bool has_msft_ext;
|
||||
char *fw_name;
|
||||
char *cfg_name;
|
||||
};
|
||||
@@ -121,6 +122,7 @@ static const struct id_table ic_id_table[] = {
|
||||
{ IC_INFO(RTL_ROM_LMP_8821A, 0xc, 0x8, HCI_USB),
|
||||
.config_needed = false,
|
||||
.has_rom_version = true,
|
||||
.has_msft_ext = true,
|
||||
.fw_name = "rtl_bt/rtl8821c_fw.bin",
|
||||
.cfg_name = "rtl_bt/rtl8821c_config" },
|
||||
|
||||
@@ -135,6 +137,7 @@ static const struct id_table ic_id_table[] = {
|
||||
{ IC_INFO(RTL_ROM_LMP_8761A, 0xb, 0xa, HCI_UART),
|
||||
.config_needed = false,
|
||||
.has_rom_version = true,
|
||||
.has_msft_ext = true,
|
||||
.fw_name = "rtl_bt/rtl8761b_fw.bin",
|
||||
.cfg_name = "rtl_bt/rtl8761b_config" },
|
||||
|
||||
@@ -149,6 +152,7 @@ static const struct id_table ic_id_table[] = {
|
||||
{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART),
|
||||
.config_needed = true,
|
||||
.has_rom_version = true,
|
||||
.has_msft_ext = true,
|
||||
.fw_name = "rtl_bt/rtl8822cs_fw.bin",
|
||||
.cfg_name = "rtl_bt/rtl8822cs_config" },
|
||||
|
||||
@@ -156,6 +160,7 @@ static const struct id_table ic_id_table[] = {
|
||||
{ IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_USB),
|
||||
.config_needed = false,
|
||||
.has_rom_version = true,
|
||||
.has_msft_ext = true,
|
||||
.fw_name = "rtl_bt/rtl8822cu_fw.bin",
|
||||
.cfg_name = "rtl_bt/rtl8822cu_config" },
|
||||
|
||||
@@ -163,6 +168,7 @@ static const struct id_table ic_id_table[] = {
|
||||
{ IC_INFO(RTL_ROM_LMP_8822B, 0xb, 0x7, HCI_USB),
|
||||
.config_needed = true,
|
||||
.has_rom_version = true,
|
||||
.has_msft_ext = true,
|
||||
.fw_name = "rtl_bt/rtl8822b_fw.bin",
|
||||
.cfg_name = "rtl_bt/rtl8822b_config" },
|
||||
|
||||
@@ -170,6 +176,7 @@ static const struct id_table ic_id_table[] = {
|
||||
{ IC_INFO(RTL_ROM_LMP_8852A, 0xa, 0xb, HCI_USB),
|
||||
.config_needed = false,
|
||||
.has_rom_version = true,
|
||||
.has_msft_ext = true,
|
||||
.fw_name = "rtl_bt/rtl8852au_fw.bin",
|
||||
.cfg_name = "rtl_bt/rtl8852au_config" },
|
||||
};
|
||||
@@ -594,8 +601,10 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||
hci_rev = le16_to_cpu(resp->hci_rev);
|
||||
lmp_subver = le16_to_cpu(resp->lmp_subver);
|
||||
|
||||
if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c &&
|
||||
resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e)
|
||||
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
|
||||
hdev->bus);
|
||||
|
||||
if (!btrtl_dev->ic_info)
|
||||
btrtl_dev->drop_fw = true;
|
||||
|
||||
if (btrtl_dev->drop_fw) {
|
||||
@@ -634,13 +643,13 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||
hci_ver = resp->hci_ver;
|
||||
hci_rev = le16_to_cpu(resp->hci_rev);
|
||||
lmp_subver = le16_to_cpu(resp->lmp_subver);
|
||||
|
||||
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
|
||||
hdev->bus);
|
||||
}
|
||||
out_free:
|
||||
kfree_skb(skb);
|
||||
|
||||
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
|
||||
hdev->bus);
|
||||
|
||||
if (!btrtl_dev->ic_info) {
|
||||
rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
|
||||
lmp_subver, hci_rev, hci_ver);
|
||||
@@ -684,12 +693,8 @@ out_free:
|
||||
/* The following chips supports the Microsoft vendor extension,
|
||||
* therefore set the corresponding VsMsftOpCode.
|
||||
*/
|
||||
switch (lmp_subver) {
|
||||
case RTL_ROM_LMP_8822B:
|
||||
case RTL_ROM_LMP_8852A:
|
||||
if (btrtl_dev->ic_info->has_msft_ext)
|
||||
hci_set_msft_opcode(hdev, 0xFCF0);
|
||||
break;
|
||||
}
|
||||
|
||||
return btrtl_dev;
|
||||
|
||||
@@ -746,6 +751,7 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
|
||||
case CHIP_ID_8852A:
|
||||
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
|
||||
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
|
||||
hci_set_aosp_capable(hdev);
|
||||
break;
|
||||
default:
|
||||
rtl_dev_dbg(hdev, "Central-peripheral role not enabled.");
|
||||
|
||||
@@ -384,6 +384,12 @@ static const struct usb_device_id blacklist_table[] = {
|
||||
/* Realtek 8852AE Bluetooth devices */
|
||||
{ USB_DEVICE(0x0bda, 0xc852), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
{ USB_DEVICE(0x0bda, 0x4852), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
{ USB_DEVICE(0x04c5, 0x165c), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
{ USB_DEVICE(0x04ca, 0x4006), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
|
||||
/* Realtek Bluetooth devices */
|
||||
{ USB_VENDOR_AND_INTERFACE_INFO(0x0bda, 0xe0, 0x01, 0x01),
|
||||
@@ -410,6 +416,9 @@ static const struct usb_device_id blacklist_table[] = {
|
||||
{ USB_DEVICE(0x13d3, 0x3563), .driver_info = BTUSB_MEDIATEK |
|
||||
BTUSB_WIDEBAND_SPEECH |
|
||||
BTUSB_VALID_LE_STATES },
|
||||
{ USB_DEVICE(0x13d3, 0x3564), .driver_info = BTUSB_MEDIATEK |
|
||||
BTUSB_WIDEBAND_SPEECH |
|
||||
BTUSB_VALID_LE_STATES },
|
||||
{ USB_DEVICE(0x0489, 0xe0cd), .driver_info = BTUSB_MEDIATEK |
|
||||
BTUSB_WIDEBAND_SPEECH |
|
||||
BTUSB_VALID_LE_STATES },
|
||||
@@ -433,6 +442,10 @@ static const struct usb_device_id blacklist_table[] = {
|
||||
{ USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK },
|
||||
{ USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK },
|
||||
|
||||
/* Additional Realtek 8761B Bluetooth devices */
|
||||
{ USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
|
||||
/* Additional Realtek 8761BU Bluetooth devices */
|
||||
{ USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
@@ -451,10 +464,6 @@ static const struct usb_device_id blacklist_table[] = {
|
||||
/* Additional Realtek 8822CE Bluetooth devices */
|
||||
{ USB_DEVICE(0x04ca, 0x4005), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
/* Bluetooth component of Realtek 8852AE device */
|
||||
{ USB_DEVICE(0x04ca, 0x4006), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
|
||||
{ USB_DEVICE(0x04c5, 0x161f), .driver_info = BTUSB_REALTEK |
|
||||
BTUSB_WIDEBAND_SPEECH },
|
||||
{ USB_DEVICE(0x0b05, 0x18ef), .driver_info = BTUSB_REALTEK |
|
||||
@@ -652,11 +661,33 @@ static void btusb_rtl_cmd_timeout(struct hci_dev *hdev)
|
||||
static void btusb_qca_cmd_timeout(struct hci_dev *hdev)
|
||||
{
|
||||
struct btusb_data *data = hci_get_drvdata(hdev);
|
||||
struct gpio_desc *reset_gpio = data->reset_gpio;
|
||||
int err;
|
||||
|
||||
if (++data->cmd_timeout_cnt < 5)
|
||||
return;
|
||||
|
||||
if (reset_gpio) {
|
||||
bt_dev_err(hdev, "Reset qca device via bt_en gpio");
|
||||
|
||||
/* Toggle the hard reset line. The qca bt device is going to
|
||||
* yank itself off the USB and then replug. The cleanup is handled
|
||||
* correctly on the way out (standard USB disconnect), and the new
|
||||
* device is detected cleanly and bound to the driver again like
|
||||
* it should be.
|
||||
*/
|
||||
if (test_and_set_bit(BTUSB_HW_RESET_ACTIVE, &data->flags)) {
|
||||
bt_dev_err(hdev, "last reset failed? Not resetting again");
|
||||
return;
|
||||
}
|
||||
|
||||
gpiod_set_value_cansleep(reset_gpio, 0);
|
||||
msleep(200);
|
||||
gpiod_set_value_cansleep(reset_gpio, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bt_dev_err(hdev, "Multiple cmd timeouts seen. Resetting usb device.");
|
||||
/* This is not an unbalanced PM reference since the device will reset */
|
||||
err = usb_autopm_get_interface(data->intf);
|
||||
@@ -2200,6 +2231,23 @@ struct btmtk_section_map {
|
||||
};
|
||||
} __packed;
|
||||
|
||||
static int btusb_set_bdaddr_mtk(struct hci_dev *hdev, const bdaddr_t *bdaddr)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
long ret;
|
||||
|
||||
skb = __hci_cmd_sync(hdev, 0xfc1a, sizeof(bdaddr), bdaddr, HCI_INIT_TIMEOUT);
|
||||
if (IS_ERR(skb)) {
|
||||
ret = PTR_ERR(skb);
|
||||
bt_dev_err(hdev, "changing Mediatek device address failed (%ld)",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
kfree_skb(skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void btusb_mtk_wmt_recv(struct urb *urb)
|
||||
{
|
||||
struct hci_dev *hdev = urb->context;
|
||||
@@ -2804,6 +2852,7 @@ static int btusb_mtk_setup(struct hci_dev *hdev)
|
||||
case 0x7668:
|
||||
fwname = FIRMWARE_MT7668;
|
||||
break;
|
||||
case 0x7922:
|
||||
case 0x7961:
|
||||
snprintf(fw_bin_name, sizeof(fw_bin_name),
|
||||
"mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
|
||||
@@ -3591,11 +3640,11 @@ static void btusb_check_needs_reset_resume(struct usb_interface *intf)
|
||||
interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
|
||||
}
|
||||
|
||||
static bool btusb_prevent_wake(struct hci_dev *hdev)
|
||||
static bool btusb_wakeup(struct hci_dev *hdev)
|
||||
{
|
||||
struct btusb_data *data = hci_get_drvdata(hdev);
|
||||
|
||||
return !device_may_wakeup(&data->udev->dev);
|
||||
return device_may_wakeup(&data->udev->dev);
|
||||
}
|
||||
|
||||
static int btusb_shutdown_qca(struct hci_dev *hdev)
|
||||
@@ -3752,7 +3801,7 @@ static int btusb_probe(struct usb_interface *intf,
|
||||
hdev->flush = btusb_flush;
|
||||
hdev->send = btusb_send_frame;
|
||||
hdev->notify = btusb_notify;
|
||||
hdev->prevent_wake = btusb_prevent_wake;
|
||||
hdev->wakeup = btusb_wakeup;
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
err = btusb_config_oob_wake(hdev);
|
||||
@@ -3819,6 +3868,7 @@ static int btusb_probe(struct usb_interface *intf,
|
||||
hdev->shutdown = btusb_mtk_shutdown;
|
||||
hdev->manufacturer = 70;
|
||||
hdev->cmd_timeout = btusb_mtk_cmd_timeout;
|
||||
hdev->set_bdaddr = btusb_set_bdaddr_mtk;
|
||||
set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks);
|
||||
data->recv_acl = btusb_recv_acl_mtk;
|
||||
}
|
||||
|
||||
@@ -587,9 +587,11 @@ static int h5_recv(struct hci_uart *hu, const void *data, int count)
|
||||
count -= processed;
|
||||
}
|
||||
|
||||
pm_runtime_get(&hu->serdev->dev);
|
||||
pm_runtime_mark_last_busy(&hu->serdev->dev);
|
||||
pm_runtime_put_autosuspend(&hu->serdev->dev);
|
||||
if (hu->serdev) {
|
||||
pm_runtime_get(&hu->serdev->dev);
|
||||
pm_runtime_mark_last_busy(&hu->serdev->dev);
|
||||
pm_runtime_put_autosuspend(&hu->serdev->dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -814,7 +816,6 @@ static int h5_serdev_probe(struct serdev_device *serdev)
|
||||
struct device *dev = &serdev->dev;
|
||||
struct h5 *h5;
|
||||
const struct h5_device_data *data;
|
||||
int err;
|
||||
|
||||
h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL);
|
||||
if (!h5)
|
||||
@@ -846,6 +847,8 @@ static int h5_serdev_probe(struct serdev_device *serdev)
|
||||
h5->vnd = data->vnd;
|
||||
}
|
||||
|
||||
if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
|
||||
set_bit(H5_WAKEUP_DISABLE, &h5->flags);
|
||||
|
||||
h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(h5->enable_gpio))
|
||||
@@ -856,14 +859,7 @@ static int h5_serdev_probe(struct serdev_device *serdev)
|
||||
if (IS_ERR(h5->device_wake_gpio))
|
||||
return PTR_ERR(h5->device_wake_gpio);
|
||||
|
||||
err = hci_uart_register_device(&h5->serdev_hu, &h5p);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (data->driver_info & H5_INFO_WAKEUP_DISABLE)
|
||||
set_bit(H5_WAKEUP_DISABLE, &h5->flags);
|
||||
|
||||
return 0;
|
||||
return hci_uart_register_device(&h5->serdev_hu, &h5p);
|
||||
}
|
||||
|
||||
static void h5_serdev_remove(struct serdev_device *serdev)
|
||||
@@ -962,11 +958,13 @@ static void h5_btrtl_open(struct h5 *h5)
|
||||
serdev_device_set_parity(h5->hu->serdev, SERDEV_PARITY_EVEN);
|
||||
serdev_device_set_baudrate(h5->hu->serdev, 115200);
|
||||
|
||||
pm_runtime_set_active(&h5->hu->serdev->dev);
|
||||
pm_runtime_use_autosuspend(&h5->hu->serdev->dev);
|
||||
pm_runtime_set_autosuspend_delay(&h5->hu->serdev->dev,
|
||||
SUSPEND_TIMEOUT_MS);
|
||||
pm_runtime_enable(&h5->hu->serdev->dev);
|
||||
if (!test_bit(H5_WAKEUP_DISABLE, &h5->flags)) {
|
||||
pm_runtime_set_active(&h5->hu->serdev->dev);
|
||||
pm_runtime_use_autosuspend(&h5->hu->serdev->dev);
|
||||
pm_runtime_set_autosuspend_delay(&h5->hu->serdev->dev,
|
||||
SUSPEND_TIMEOUT_MS);
|
||||
pm_runtime_enable(&h5->hu->serdev->dev);
|
||||
}
|
||||
|
||||
/* The controller needs up to 500ms to wakeup */
|
||||
gpiod_set_value_cansleep(h5->enable_gpio, 1);
|
||||
@@ -976,7 +974,8 @@ static void h5_btrtl_open(struct h5 *h5)
|
||||
|
||||
static void h5_btrtl_close(struct h5 *h5)
|
||||
{
|
||||
pm_runtime_disable(&h5->hu->serdev->dev);
|
||||
if (!test_bit(H5_WAKEUP_DISABLE, &h5->flags))
|
||||
pm_runtime_disable(&h5->hu->serdev->dev);
|
||||
|
||||
gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
|
||||
gpiod_set_value_cansleep(h5->enable_gpio, 0);
|
||||
|
||||
@@ -479,6 +479,9 @@ static int hci_uart_tty_open(struct tty_struct *tty)
|
||||
|
||||
BT_DBG("tty %p", tty);
|
||||
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
/* Error if the tty has no write op instead of leaving an exploitable
|
||||
* hole
|
||||
*/
|
||||
|
||||
@@ -1577,7 +1577,7 @@ static void qca_cmd_timeout(struct hci_dev *hdev)
|
||||
mutex_unlock(&qca->hci_memdump_lock);
|
||||
}
|
||||
|
||||
static bool qca_prevent_wake(struct hci_dev *hdev)
|
||||
static bool qca_wakeup(struct hci_dev *hdev)
|
||||
{
|
||||
struct hci_uart *hu = hci_get_drvdata(hdev);
|
||||
bool wakeup;
|
||||
@@ -1730,6 +1730,7 @@ retry:
|
||||
if (qca_is_wcn399x(soc_type) ||
|
||||
qca_is_wcn6750(soc_type)) {
|
||||
set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
|
||||
hci_set_aosp_capable(hdev);
|
||||
|
||||
ret = qca_read_soc_version(hdev, &ver, soc_type);
|
||||
if (ret)
|
||||
@@ -1764,7 +1765,7 @@ retry:
|
||||
qca_debugfs_init(hdev);
|
||||
hu->hdev->hw_error = qca_hw_error;
|
||||
hu->hdev->cmd_timeout = qca_cmd_timeout;
|
||||
hu->hdev->prevent_wake = qca_prevent_wake;
|
||||
hu->hdev->wakeup = qca_wakeup;
|
||||
} else if (ret == -ENOENT) {
|
||||
/* No patch/nvm-config found, run with original fw/config */
|
||||
set_bit(QCA_ROM_FW, &qca->flags);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#include <net/bluetooth/bluetooth.h>
|
||||
#include <net/bluetooth/hci_core.h>
|
||||
@@ -37,6 +38,9 @@ struct vhci_data {
|
||||
|
||||
struct mutex open_mutex;
|
||||
struct delayed_work open_timeout;
|
||||
|
||||
bool suspended;
|
||||
bool wakeup;
|
||||
};
|
||||
|
||||
static int vhci_open_dev(struct hci_dev *hdev)
|
||||
@@ -73,6 +77,115 @@ static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vhci_get_data_path_id(struct hci_dev *hdev, u8 *data_path_id)
|
||||
{
|
||||
*data_path_id = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vhci_get_codec_config_data(struct hci_dev *hdev, __u8 type,
|
||||
struct bt_codec *codec, __u8 *vnd_len,
|
||||
__u8 **vnd_data)
|
||||
{
|
||||
if (type != ESCO_LINK)
|
||||
return -EINVAL;
|
||||
|
||||
*vnd_len = 0;
|
||||
*vnd_data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool vhci_wakeup(struct hci_dev *hdev)
|
||||
{
|
||||
struct vhci_data *data = hci_get_drvdata(hdev);
|
||||
|
||||
return data->wakeup;
|
||||
}
|
||||
|
||||
static ssize_t force_suspend_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct vhci_data *data = file->private_data;
|
||||
char buf[3];
|
||||
|
||||
buf[0] = data->suspended ? 'Y' : 'N';
|
||||
buf[1] = '\n';
|
||||
buf[2] = '\0';
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
|
||||
}
|
||||
|
||||
static ssize_t force_suspend_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct vhci_data *data = file->private_data;
|
||||
bool enable;
|
||||
int err;
|
||||
|
||||
err = kstrtobool_from_user(user_buf, count, &enable);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (data->suspended == enable)
|
||||
return -EALREADY;
|
||||
|
||||
if (enable)
|
||||
err = hci_suspend_dev(data->hdev);
|
||||
else
|
||||
err = hci_resume_dev(data->hdev);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
data->suspended = enable;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations force_suspend_fops = {
|
||||
.open = simple_open,
|
||||
.read = force_suspend_read,
|
||||
.write = force_suspend_write,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t force_wakeup_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct vhci_data *data = file->private_data;
|
||||
char buf[3];
|
||||
|
||||
buf[0] = data->wakeup ? 'Y' : 'N';
|
||||
buf[1] = '\n';
|
||||
buf[2] = '\0';
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
|
||||
}
|
||||
|
||||
static ssize_t force_wakeup_write(struct file *file,
|
||||
const char __user *user_buf, size_t count,
|
||||
loff_t *ppos)
|
||||
{
|
||||
struct vhci_data *data = file->private_data;
|
||||
bool enable;
|
||||
int err;
|
||||
|
||||
err = kstrtobool_from_user(user_buf, count, &enable);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (data->wakeup == enable)
|
||||
return -EALREADY;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations force_wakeup_fops = {
|
||||
.open = simple_open,
|
||||
.read = force_wakeup_read,
|
||||
.write = force_wakeup_write,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
|
||||
{
|
||||
struct hci_dev *hdev;
|
||||
@@ -112,6 +225,9 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
|
||||
hdev->close = vhci_close_dev;
|
||||
hdev->flush = vhci_flush;
|
||||
hdev->send = vhci_send_frame;
|
||||
hdev->get_data_path_id = vhci_get_data_path_id;
|
||||
hdev->get_codec_config_data = vhci_get_codec_config_data;
|
||||
hdev->wakeup = vhci_wakeup;
|
||||
|
||||
/* bit 6 is for external configuration */
|
||||
if (opcode & 0x40)
|
||||
@@ -129,6 +245,12 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
debugfs_create_file("force_suspend", 0644, hdev->debugfs, data,
|
||||
&force_suspend_fops);
|
||||
|
||||
debugfs_create_file("force_wakeup", 0644, hdev->debugfs, data,
|
||||
&force_wakeup_fops);
|
||||
|
||||
hci_skb_pkt_type(skb) = HCI_VENDOR_PKT;
|
||||
|
||||
skb_put_u8(skb, 0xff);
|
||||
|
||||
@@ -2275,7 +2275,7 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev,
|
||||
u64 release_mac = MLX4_IB_INVALID_MAC;
|
||||
struct mlx4_ib_qp *qp;
|
||||
|
||||
new_smac = mlx4_mac_to_u64(dev->dev_addr);
|
||||
new_smac = ether_addr_to_u64(dev->dev_addr);
|
||||
atomic64_set(&ibdev->iboe.mac[port - 1], new_smac);
|
||||
|
||||
/* no need for update QP1 and mac registration in non-SRIOV */
|
||||
|
||||
@@ -1853,7 +1853,7 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_qp_attr *qp,
|
||||
u16 vlan_id, u8 *smac)
|
||||
{
|
||||
return _mlx4_set_path(dev, &qp->ah_attr,
|
||||
mlx4_mac_to_u64(smac),
|
||||
ether_addr_to_u64(smac),
|
||||
vlan_id,
|
||||
path, &mqp->pri, port);
|
||||
}
|
||||
|
||||
@@ -1559,6 +1559,7 @@ int mlx5r_odp_create_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)
|
||||
|
||||
eq->irq_nb.notifier_call = mlx5_ib_eq_pf_int;
|
||||
param = (struct mlx5_eq_param) {
|
||||
.irq_index = MLX5_IRQ_EQ_CTRL,
|
||||
.nent = MLX5_IB_NUM_PF_EQE,
|
||||
};
|
||||
param.mask[0] = 1ull << MLX5_EVENT_TYPE_PAGE_FAULT;
|
||||
|
||||
@@ -272,7 +272,7 @@ static int qedr_register_device(struct qedr_dev *dev)
|
||||
static int qedr_alloc_mem_sb(struct qedr_dev *dev,
|
||||
struct qed_sb_info *sb_info, u16 sb_id)
|
||||
{
|
||||
struct status_block_e4 *sb_virt;
|
||||
struct status_block *sb_virt;
|
||||
dma_addr_t sb_phys;
|
||||
int rc;
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ static void el3_dev_fill(struct net_device *dev, __be16 *phys_addr, int ioaddr,
|
||||
{
|
||||
struct el3_private *lp = netdev_priv(dev);
|
||||
|
||||
memcpy(dev->dev_addr, phys_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, (u8 *)phys_addr);
|
||||
dev->base_addr = ioaddr;
|
||||
dev->irq = irq;
|
||||
dev->if_port = if_port;
|
||||
|
||||
@@ -716,7 +716,7 @@ static int ax_init_dev(struct net_device *dev)
|
||||
for (i = 0; i < 16; i++)
|
||||
SA_prom[i] = SA_prom[i+i];
|
||||
|
||||
memcpy(dev->dev_addr, SA_prom, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, SA_prom);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AX88796_93CX6
|
||||
@@ -733,7 +733,7 @@ static int ax_init_dev(struct net_device *dev)
|
||||
(__le16 __force *)mac_addr,
|
||||
sizeof(mac_addr) >> 1);
|
||||
|
||||
memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, mac_addr);
|
||||
}
|
||||
#endif
|
||||
if (ax->plat->wordlength == 2) {
|
||||
@@ -757,7 +757,7 @@ static int ax_init_dev(struct net_device *dev)
|
||||
|
||||
if ((ax->plat->flags & AXFLG_MAC_FROMPLATFORM) &&
|
||||
ax->plat->mac_addr)
|
||||
memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, ax->plat->mac_addr);
|
||||
|
||||
if (!is_valid_ether_addr(dev->dev_addr)) {
|
||||
eth_hw_addr_random(dev);
|
||||
|
||||
@@ -390,7 +390,7 @@ static int ne2k_pci_init_one(struct pci_dev *pdev,
|
||||
dev->ethtool_ops = &ne2k_pci_ethtool_ops;
|
||||
NS8390_init(dev, 0);
|
||||
|
||||
memcpy(dev->dev_addr, SA_prom, dev->addr_len);
|
||||
eth_hw_addr_set(dev, SA_prom);
|
||||
|
||||
i = register_netdev(dev);
|
||||
if (i)
|
||||
|
||||
@@ -1173,7 +1173,7 @@ static int owl_emac_ndo_set_mac_addr(struct net_device *netdev, void *addr)
|
||||
if (netif_running(netdev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(netdev->dev_addr, skaddr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, skaddr->sa_data);
|
||||
owl_emac_set_hw_mac_addr(netdev);
|
||||
|
||||
return owl_emac_setup_frame_xmit(netdev_priv(netdev));
|
||||
|
||||
@@ -1025,7 +1025,7 @@ static int greth_set_mac_add(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
GRETH_REGSAVE(regs->esa_msb, dev->dev_addr[0] << 8 | dev->dev_addr[1]);
|
||||
GRETH_REGSAVE(regs->esa_lsb, dev->dev_addr[2] << 24 | dev->dev_addr[3] << 16 |
|
||||
dev->dev_addr[4] << 8 | dev->dev_addr[5]);
|
||||
|
||||
@@ -3863,7 +3863,7 @@ static int et131x_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
|
||||
et131x_init_send(adapter);
|
||||
et131x_hwaddr_init(adapter);
|
||||
ether_addr_copy(netdev->dev_addr, adapter->addr);
|
||||
eth_hw_addr_set(netdev, adapter->addr);
|
||||
|
||||
/* Init the device with the new settings */
|
||||
et131x_adapter_setup(adapter);
|
||||
@@ -3966,7 +3966,7 @@ static int et131x_pci_setup(struct pci_dev *pdev,
|
||||
|
||||
netif_napi_add(netdev, &adapter->napi, et131x_poll, 64);
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, adapter->addr);
|
||||
eth_hw_addr_set(netdev, adapter->addr);
|
||||
|
||||
rc = -ENOMEM;
|
||||
|
||||
|
||||
@@ -1660,7 +1660,7 @@ static int slic_read_eeprom(struct slic_device *sdev)
|
||||
goto free_eeprom;
|
||||
}
|
||||
/* set mac address */
|
||||
ether_addr_copy(sdev->netdev->dev_addr, mac[devfn]);
|
||||
eth_hw_addr_set(sdev->netdev, mac[devfn]);
|
||||
free_eeprom:
|
||||
dma_free_coherent(&sdev->pdev->dev, SLIC_EEPROM_SIZE, eeprom, paddr);
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ static int emac_set_mac_address(struct net_device *dev, void *p)
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
writel(dev->dev_addr[0] << 16 | dev->dev_addr[1] << 8 | dev->
|
||||
dev_addr[2], db->membase + EMAC_MAC_A1_REG);
|
||||
|
||||
@@ -2718,7 +2718,7 @@ static int ace_set_mac_addr(struct net_device *dev, void *p)
|
||||
if(netif_running(dev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
da = (u8 *)dev->dev_addr;
|
||||
|
||||
|
||||
@@ -4073,7 +4073,7 @@ static void ena_set_conf_feat_params(struct ena_adapter *adapter,
|
||||
ether_addr_copy(adapter->mac_addr, netdev->dev_addr);
|
||||
} else {
|
||||
ether_addr_copy(adapter->mac_addr, feat->dev_attr.mac_addr);
|
||||
ether_addr_copy(netdev->dev_addr, adapter->mac_addr);
|
||||
eth_hw_addr_set(netdev, adapter->mac_addr);
|
||||
}
|
||||
|
||||
/* Set offload features */
|
||||
|
||||
@@ -1500,7 +1500,7 @@ static int amd8111e_set_mac_address(struct net_device *dev, void *p)
|
||||
int i;
|
||||
struct sockaddr *addr = p;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
spin_lock_irq(&lp->lock);
|
||||
/* Setting the MAC address to the device */
|
||||
for (i = 0; i < ETH_ALEN; i++)
|
||||
|
||||
@@ -582,7 +582,7 @@ static unsigned long __init lance_probe1( struct net_device *dev,
|
||||
switch( lp->cardtype ) {
|
||||
case OLD_RIEBL:
|
||||
/* No ethernet address! (Set some default address) */
|
||||
memcpy(dev->dev_addr, OldRieblDefHwaddr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, OldRieblDefHwaddr);
|
||||
break;
|
||||
case NEW_RIEBL:
|
||||
lp->memcpy_f(dev->dev_addr, RIEBL_HWADDR_ADDR, ETH_ALEN);
|
||||
@@ -1123,7 +1123,7 @@ static int lance_set_mac_address( struct net_device *dev, void *addr )
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
memcpy( dev->dev_addr, saddr->sa_data, dev->addr_len );
|
||||
eth_hw_addr_set(dev, saddr->sa_data);
|
||||
for( i = 0; i < 6; i++ )
|
||||
MEM->init.hwaddr[i] = dev->dev_addr[i^1]; /* <- 16 bit swap! */
|
||||
lp->memcpy_f( RIEBL_HWADDR_ADDR, dev->dev_addr, 6 );
|
||||
|
||||
@@ -1178,7 +1178,7 @@ static int au1000_probe(struct platform_device *pdev)
|
||||
aup->phy1_search_mac0 = 1;
|
||||
} else {
|
||||
if (is_valid_ether_addr(pd->mac)) {
|
||||
memcpy(dev->dev_addr, pd->mac, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac);
|
||||
} else {
|
||||
/* Set a random MAC since no valid provided by platform_data. */
|
||||
eth_hw_addr_random(dev);
|
||||
|
||||
@@ -635,7 +635,7 @@ static int nmclan_config(struct pcmcia_device *link)
|
||||
kfree(buf);
|
||||
goto failed;
|
||||
}
|
||||
memcpy(dev->dev_addr, buf, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, buf);
|
||||
kfree(buf);
|
||||
|
||||
/* Verify configuration by reading the MACE ID. */
|
||||
|
||||
@@ -1775,7 +1775,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
|
||||
pr_cont(" warning: CSR address invalid,\n");
|
||||
pr_info(" using instead PROM address of");
|
||||
}
|
||||
memcpy(dev->dev_addr, promaddr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, promaddr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2016,7 +2016,7 @@ static int xgbe_set_mac_address(struct net_device *netdev, void *addr)
|
||||
if (!is_valid_ether_addr(saddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(netdev->dev_addr, saddr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, saddr->sa_data);
|
||||
|
||||
hw_if->set_mac_address(pdata, netdev->dev_addr);
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)
|
||||
|
||||
netdev->irq = pdata->dev_irq;
|
||||
netdev->base_addr = (unsigned long)pdata->xgmac_regs;
|
||||
memcpy(netdev->dev_addr, pdata->mac_addr, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, pdata->mac_addr);
|
||||
|
||||
/* Initialize ECC timestamps */
|
||||
pdata->tx_sec_period = jiffies;
|
||||
|
||||
@@ -332,7 +332,7 @@ int aq_nic_ndev_register(struct aq_nic_s *self)
|
||||
{
|
||||
static u8 mac_addr_permanent[] = AQ_CFG_MAC_ADDR_PERMANENT;
|
||||
|
||||
ether_addr_copy(self->ndev->dev_addr, mac_addr_permanent);
|
||||
eth_hw_addr_set(self->ndev, mac_addr_permanent);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -773,7 +773,7 @@ static int arc_emac_set_address(struct net_device *ndev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
|
||||
eth_hw_addr_set(ndev, addr->sa_data);
|
||||
|
||||
arc_emac_set_address_internal(ndev);
|
||||
|
||||
|
||||
@@ -607,7 +607,7 @@ static int alx_set_mac_address(struct net_device *netdev, void *data)
|
||||
if (netdev->addr_assign_type & NET_ADDR_RANDOM)
|
||||
netdev->addr_assign_type ^= NET_ADDR_RANDOM;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
memcpy(hw->mac_addr, addr->sa_data, netdev->addr_len);
|
||||
alx_set_macaddr(hw, hw->mac_addr);
|
||||
|
||||
@@ -1832,7 +1832,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
}
|
||||
|
||||
memcpy(hw->mac_addr, hw->perm_addr, ETH_ALEN);
|
||||
memcpy(netdev->dev_addr, hw->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, hw->mac_addr);
|
||||
memcpy(netdev->perm_addr, hw->perm_addr, ETH_ALEN);
|
||||
|
||||
hw->mdio.prtad = 0;
|
||||
|
||||
@@ -482,7 +482,7 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p)
|
||||
if (netif_running(netdev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
|
||||
|
||||
atl1c_hw_set_mac_addr(&adapter->hw, adapter->hw.mac_addr);
|
||||
@@ -2767,7 +2767,7 @@ static int atl1c_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/* got a random MAC address, set NET_ADDR_RANDOM to netdev */
|
||||
netdev->addr_assign_type = NET_ADDR_RANDOM;
|
||||
}
|
||||
memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac_addr);
|
||||
if (netif_msg_probe(adapter))
|
||||
dev_dbg(&pdev->dev, "mac address : %pM\n",
|
||||
adapter->hw.mac_addr);
|
||||
|
||||
@@ -374,7 +374,7 @@ static int atl1e_set_mac_addr(struct net_device *netdev, void *p)
|
||||
if (netif_running(netdev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
|
||||
|
||||
atl1e_hw_set_mac_addr(&adapter->hw);
|
||||
@@ -2390,7 +2390,7 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
goto err_eeprom;
|
||||
}
|
||||
|
||||
memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac_addr);
|
||||
netdev_dbg(netdev, "mac address : %pM\n", adapter->hw.mac_addr);
|
||||
|
||||
INIT_WORK(&adapter->reset_task, atl1e_reset_task);
|
||||
|
||||
@@ -3027,7 +3027,7 @@ static int atl1_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
/* mark random mac */
|
||||
netdev->addr_assign_type = NET_ADDR_RANDOM;
|
||||
}
|
||||
memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac_addr);
|
||||
|
||||
if (!is_valid_ether_addr(netdev->dev_addr)) {
|
||||
err = -EIO;
|
||||
|
||||
@@ -931,7 +931,7 @@ static int atl2_set_mac(struct net_device *netdev, void *p)
|
||||
if (netif_running(netdev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
|
||||
|
||||
atl2_set_mac_addr(&adapter->hw);
|
||||
@@ -1405,7 +1405,7 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
|
||||
/* copy the MAC address out of the EEPROM */
|
||||
atl2_read_mac_addr(&adapter->hw);
|
||||
memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, adapter->hw.mac_addr);
|
||||
if (!is_valid_ether_addr(netdev->dev_addr)) {
|
||||
err = -EIO;
|
||||
goto err_eeprom;
|
||||
|
||||
@@ -69,7 +69,7 @@ static int atlx_set_mac(struct net_device *netdev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
|
||||
|
||||
atlx_set_mac_addr(&adapter->hw);
|
||||
|
||||
@@ -1383,7 +1383,7 @@ static int b44_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
spin_lock_irq(&bp->lock);
|
||||
|
||||
@@ -2171,7 +2171,7 @@ static int b44_get_invariants(struct b44 *bp)
|
||||
* valid PHY address. */
|
||||
bp->phy_addr &= 0x1F;
|
||||
|
||||
memcpy(bp->dev->dev_addr, addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, addr);
|
||||
|
||||
if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
|
||||
pr_err("Invalid MAC address found in EEPROM\n");
|
||||
|
||||
@@ -670,7 +670,7 @@ static int bcm_enet_set_mac_address(struct net_device *dev, void *p)
|
||||
u32 val;
|
||||
|
||||
priv = netdev_priv(dev);
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
/* use perfect match register 0 to store my mac address */
|
||||
val = (dev->dev_addr[2] << 24) | (dev->dev_addr[3] << 16) |
|
||||
@@ -1762,7 +1762,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
|
||||
|
||||
pd = dev_get_platdata(&pdev->dev);
|
||||
if (pd) {
|
||||
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac_addr);
|
||||
priv->has_phy = pd->has_phy;
|
||||
priv->phy_id = pd->phy_id;
|
||||
priv->has_phy_interrupt = pd->has_phy_interrupt;
|
||||
@@ -2665,7 +2665,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
|
||||
|
||||
pd = dev_get_platdata(&pdev->dev);
|
||||
if (pd) {
|
||||
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, pd->mac_addr);
|
||||
memcpy(priv->used_ports, pd->used_ports,
|
||||
sizeof(pd->used_ports));
|
||||
priv->num_ports = pd->num_ports;
|
||||
|
||||
@@ -1850,7 +1850,7 @@ static int bcm_sysport_change_mac(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
/* interface is disabled, changes to MAC will be reflected on next
|
||||
* open call
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/brcmphy.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include "bgmac.h"
|
||||
|
||||
static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
|
||||
@@ -211,6 +212,7 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)
|
||||
{
|
||||
struct bcma_device *core = bgmac->bcma.core;
|
||||
struct mii_bus *mii_bus;
|
||||
struct device_node *np;
|
||||
int err;
|
||||
|
||||
mii_bus = mdiobus_alloc();
|
||||
@@ -229,7 +231,9 @@ struct mii_bus *bcma_mdio_mii_register(struct bgmac *bgmac)
|
||||
mii_bus->parent = &core->dev;
|
||||
mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
|
||||
|
||||
err = mdiobus_register(mii_bus);
|
||||
np = of_get_child_by_name(core->dev.of_node, "mdio");
|
||||
|
||||
err = of_mdiobus_register(mii_bus, np);
|
||||
if (err) {
|
||||
dev_err(&core->dev, "Registration of mii bus failed\n");
|
||||
goto err_free_bus;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/brcmphy.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include <linux/of_net.h>
|
||||
#include "bgmac.h"
|
||||
|
||||
@@ -86,17 +87,28 @@ static int bcma_phy_connect(struct bgmac *bgmac)
|
||||
struct phy_device *phy_dev;
|
||||
char bus_id[MII_BUS_ID_SIZE + 3];
|
||||
|
||||
/* DT info should be the most accurate */
|
||||
phy_dev = of_phy_get_and_connect(bgmac->net_dev, bgmac->dev->of_node,
|
||||
bgmac_adjust_link);
|
||||
if (phy_dev)
|
||||
return 0;
|
||||
|
||||
/* Connect to the PHY */
|
||||
snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
|
||||
bgmac->phyaddr);
|
||||
phy_dev = phy_connect(bgmac->net_dev, bus_id, bgmac_adjust_link,
|
||||
PHY_INTERFACE_MODE_MII);
|
||||
if (IS_ERR(phy_dev)) {
|
||||
dev_err(bgmac->dev, "PHY connection failed\n");
|
||||
return PTR_ERR(phy_dev);
|
||||
if (bgmac->mii_bus && bgmac->phyaddr != BGMAC_PHY_NOREGS) {
|
||||
snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
|
||||
bgmac->phyaddr);
|
||||
phy_dev = phy_connect(bgmac->net_dev, bus_id, bgmac_adjust_link,
|
||||
PHY_INTERFACE_MODE_MII);
|
||||
if (IS_ERR(phy_dev)) {
|
||||
dev_err(bgmac->dev, "PHY connection failed\n");
|
||||
return PTR_ERR(phy_dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Assume a fixed link to the switch port */
|
||||
return bgmac_phy_connect_direct(bgmac);
|
||||
}
|
||||
|
||||
static const struct bcma_device_id bgmac_bcma_tbl[] = {
|
||||
@@ -150,7 +162,7 @@ static int bgmac_probe(struct bcma_device *core)
|
||||
err = -ENOTSUPP;
|
||||
goto err;
|
||||
}
|
||||
ether_addr_copy(bgmac->net_dev->dev_addr, mac);
|
||||
eth_hw_addr_set(bgmac->net_dev, mac);
|
||||
}
|
||||
|
||||
/* On BCM4706 we need common core to access PHY */
|
||||
@@ -297,10 +309,7 @@ static int bgmac_probe(struct bcma_device *core)
|
||||
bgmac->cco_ctl_maskset = bcma_bgmac_cco_ctl_maskset;
|
||||
bgmac->get_bus_clock = bcma_bgmac_get_bus_clock;
|
||||
bgmac->cmn_maskset32 = bcma_bgmac_cmn_maskset32;
|
||||
if (bgmac->mii_bus)
|
||||
bgmac->phy_connect = bcma_phy_connect;
|
||||
else
|
||||
bgmac->phy_connect = bgmac_phy_connect_direct;
|
||||
bgmac->phy_connect = bcma_phy_connect;
|
||||
|
||||
err = bgmac_enet_probe(bgmac);
|
||||
if (err)
|
||||
|
||||
@@ -1241,7 +1241,7 @@ static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ether_addr_copy(net_dev->dev_addr, sa->sa_data);
|
||||
eth_hw_addr_set(net_dev, sa->sa_data);
|
||||
bgmac_write_mac_address(bgmac, net_dev->dev_addr);
|
||||
|
||||
eth_commit_mac_addr_change(net_dev, addr);
|
||||
|
||||
@@ -7910,7 +7910,7 @@ bnx2_change_mac_addr(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
if (netif_running(dev))
|
||||
bnx2_set_mac_addr(bp, bp->dev->dev_addr, 0);
|
||||
|
||||
@@ -8574,7 +8574,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if (is_kdump_kernel())
|
||||
bnx2_wait_dma_complete(bp);
|
||||
|
||||
memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, bp->mac_addr);
|
||||
|
||||
dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
|
||||
NETIF_F_TSO | NETIF_F_TSO_ECN |
|
||||
|
||||
@@ -4336,7 +4336,7 @@ int bnx2x_change_mac_addr(struct net_device *dev, void *p)
|
||||
return rc;
|
||||
}
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
if (netif_running(dev))
|
||||
rc = bnx2x_set_eth_mac(bp, true);
|
||||
|
||||
@@ -11790,7 +11790,7 @@ static void bnx2x_get_cnic_mac_hwinfo(struct bnx2x *bp)
|
||||
* as the SAN mac was copied from the primary MAC.
|
||||
*/
|
||||
if (IS_MF_FCOE_AFEX(bp))
|
||||
memcpy(bp->dev->dev_addr, fip_mac, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, fip_mac);
|
||||
} else {
|
||||
val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].
|
||||
iscsi_mac_upper);
|
||||
|
||||
@@ -3058,7 +3058,7 @@ enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
|
||||
if (bulletin->valid_bitmap & 1 << MAC_ADDR_VALID &&
|
||||
!ether_addr_equal(bulletin->mac, bp->old_bulletin.mac)) {
|
||||
/* update new mac to net device */
|
||||
memcpy(bp->dev->dev_addr, bulletin->mac, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bulletin->mac);
|
||||
}
|
||||
|
||||
if (bulletin->valid_bitmap & (1 << LINK_VALID)) {
|
||||
|
||||
@@ -384,9 +384,8 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
|
||||
sizeof(bp->fw_ver));
|
||||
|
||||
if (is_valid_ether_addr(bp->acquire_resp.resc.current_mac_addr))
|
||||
memcpy(bp->dev->dev_addr,
|
||||
bp->acquire_resp.resc.current_mac_addr,
|
||||
ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev,
|
||||
bp->acquire_resp.resc.current_mac_addr);
|
||||
|
||||
out:
|
||||
bnx2x_vfpf_finalize(bp, &req->first_tlv);
|
||||
@@ -767,7 +766,7 @@ int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set)
|
||||
"vfpf SET MAC failed. Check bulletin board for new posts\n");
|
||||
|
||||
/* copy mac from bulletin to device */
|
||||
memcpy(bp->dev->dev_addr, bulletin.mac, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bulletin.mac);
|
||||
|
||||
/* check if bulletin board was updated */
|
||||
if (bnx2x_sample_bulletin(bp) == PFVF_BULLETIN_UPDATED) {
|
||||
|
||||
@@ -12369,7 +12369,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
if (netif_running(dev)) {
|
||||
bnxt_close_nic(bp, false, false);
|
||||
rc = bnxt_open_nic(bp, false, false);
|
||||
@@ -13103,7 +13103,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
|
||||
int rc = 0;
|
||||
|
||||
if (BNXT_PF(bp)) {
|
||||
memcpy(bp->dev->dev_addr, bp->pf.mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bp->pf.mac_addr);
|
||||
} else {
|
||||
#ifdef CONFIG_BNXT_SRIOV
|
||||
struct bnxt_vf_info *vf = &bp->vf;
|
||||
@@ -13111,7 +13111,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
|
||||
|
||||
if (is_valid_ether_addr(vf->mac_addr)) {
|
||||
/* overwrite netdev dev_addr with admin VF MAC */
|
||||
memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, vf->mac_addr);
|
||||
/* Older PF driver or firmware may not approve this
|
||||
* correctly.
|
||||
*/
|
||||
|
||||
@@ -1217,7 +1217,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
|
||||
|
||||
/* overwrite netdev dev_addr with admin VF MAC */
|
||||
if (is_valid_ether_addr(bp->vf.mac_addr))
|
||||
memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(bp->dev, bp->vf.mac_addr);
|
||||
update_vf_mac_exit:
|
||||
hwrm_req_drop(bp, req);
|
||||
if (inform_pf)
|
||||
|
||||
@@ -475,7 +475,7 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
|
||||
dev->features |= pf_dev->features;
|
||||
bnxt_vf_rep_eth_addr_gen(bp->pf.mac_addr, vf_rep->vf_idx,
|
||||
dev->perm_addr);
|
||||
ether_addr_copy(dev->dev_addr, dev->perm_addr);
|
||||
eth_hw_addr_set(dev, dev->perm_addr);
|
||||
/* Set VF-Rep's max-mtu to the corresponding VF's max-mtu */
|
||||
if (!bnxt_hwrm_vfr_qcfg(bp, vf_rep, &max_mtu))
|
||||
dev->max_mtu = max_mtu;
|
||||
|
||||
@@ -3633,7 +3633,7 @@ static int bcmgenet_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
|
||||
ether_addr_copy(dev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4082,7 +4082,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
|
||||
bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
|
||||
|
||||
if (pd && !IS_ERR_OR_NULL(pd->mac_address))
|
||||
ether_addr_copy(dev->dev_addr, pd->mac_address);
|
||||
eth_hw_addr_set(dev, pd->mac_address);
|
||||
else
|
||||
if (!device_get_mac_address(&pdev->dev, dev->dev_addr, ETH_ALEN))
|
||||
if (has_acpi_companion(&pdev->dev))
|
||||
|
||||
@@ -9366,7 +9366,7 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
if (!netif_running(dev))
|
||||
return 0;
|
||||
|
||||
@@ -875,7 +875,7 @@ bnad_set_netdev_perm_addr(struct bnad *bnad)
|
||||
|
||||
ether_addr_copy(netdev->perm_addr, bnad->perm_addr);
|
||||
if (is_zero_ether_addr(netdev->dev_addr))
|
||||
ether_addr_copy(netdev->dev_addr, bnad->perm_addr);
|
||||
eth_hw_addr_set(netdev, bnad->perm_addr);
|
||||
}
|
||||
|
||||
/* Control Path Handlers */
|
||||
@@ -3249,7 +3249,7 @@ bnad_set_mac_address(struct net_device *netdev, void *addr)
|
||||
|
||||
err = bnad_mac_addr_set_locked(bnad, sa->sa_data);
|
||||
if (!err)
|
||||
ether_addr_copy(netdev->dev_addr, sa->sa_data);
|
||||
eth_hw_addr_set(netdev, sa->sa_data);
|
||||
|
||||
spin_unlock_irqrestore(&bnad->bna_lock, flags);
|
||||
|
||||
|
||||
@@ -547,13 +547,8 @@ static void macb_validate(struct phylink_config *config,
|
||||
if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE &&
|
||||
(state->interface == PHY_INTERFACE_MODE_NA ||
|
||||
state->interface == PHY_INTERFACE_MODE_10GBASER)) {
|
||||
phylink_set(mask, 10000baseCR_Full);
|
||||
phylink_set(mask, 10000baseER_Full);
|
||||
phylink_set_10g_modes(mask);
|
||||
phylink_set(mask, 10000baseKR_Full);
|
||||
phylink_set(mask, 10000baseLR_Full);
|
||||
phylink_set(mask, 10000baseLRM_Full);
|
||||
phylink_set(mask, 10000baseSR_Full);
|
||||
phylink_set(mask, 10000baseT_Full);
|
||||
if (state->interface != PHY_INTERFACE_MODE_NA)
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1479,7 +1479,7 @@ static int xgmac_set_mac_address(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
xgmac_set_mac_addr(ioaddr, dev->dev_addr, 0);
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ void octeon_pf_changed_vf_macaddr(struct octeon_device *oct, u8 *mac)
|
||||
|
||||
if (!ether_addr_equal(netdev->dev_addr, mac)) {
|
||||
macaddr_changed = true;
|
||||
ether_addr_copy(netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(netdev, mac);
|
||||
ether_addr_copy(((u8 *)&lio->linfo.hw_addr) + 2, mac);
|
||||
call_netdevice_notifiers(NETDEV_CHANGEADDR, netdev);
|
||||
}
|
||||
|
||||
@@ -2024,7 +2024,7 @@ static int liquidio_set_mac(struct net_device *netdev, void *p)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
memcpy(((u8 *)&lio->linfo.hw_addr) + 2, addr->sa_data, ETH_ALEN);
|
||||
|
||||
return 0;
|
||||
@@ -3634,7 +3634,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
|
||||
|
||||
/* Copy MAC Address to OS network device structure */
|
||||
|
||||
ether_addr_copy(netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(netdev, mac);
|
||||
|
||||
/* By default all interfaces on a single Octeon uses the same
|
||||
* tx and rx queues
|
||||
|
||||
@@ -1168,7 +1168,7 @@ static int liquidio_set_mac(struct net_device *netdev, void *p)
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
ether_addr_copy(((u8 *)&lio->linfo.hw_addr) + 2, addr->sa_data);
|
||||
|
||||
return 0;
|
||||
@@ -2148,7 +2148,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
|
||||
mac[j] = *((u8 *)(((u8 *)&lio->linfo.hw_addr) + 2 + j));
|
||||
|
||||
/* Copy MAC Address to OS network device structure */
|
||||
ether_addr_copy(netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(netdev, mac);
|
||||
|
||||
if (liquidio_setup_io_queues(octeon_dev, i,
|
||||
lio->linfo.num_txpciq,
|
||||
|
||||
@@ -221,8 +221,7 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
|
||||
nic->tns_mode = mbx.nic_cfg.tns_mode & 0x7F;
|
||||
nic->node = mbx.nic_cfg.node_id;
|
||||
if (!nic->set_mac_pending)
|
||||
ether_addr_copy(nic->netdev->dev_addr,
|
||||
mbx.nic_cfg.mac_addr);
|
||||
eth_hw_addr_set(nic->netdev, mbx.nic_cfg.mac_addr);
|
||||
nic->sqs_mode = mbx.nic_cfg.sqs_mode;
|
||||
nic->loopback_supported = mbx.nic_cfg.loopback_supported;
|
||||
nic->link_up = false;
|
||||
@@ -1612,7 +1611,7 @@ static int nicvf_set_mac_address(struct net_device *netdev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
|
||||
if (nic->pdev->msix_enabled) {
|
||||
if (nicvf_hw_set_mac_addr(nic, netdev))
|
||||
|
||||
@@ -853,7 +853,7 @@ static int t1_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (!mac->ops->macaddress_set)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
mac->ops->macaddress_set(mac, dev->dev_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1140,7 +1140,7 @@ int t1_init_sw_modules(adapter_t *adapter, const struct board_info *bi)
|
||||
adapter->port[i].dev->name);
|
||||
goto error;
|
||||
}
|
||||
memcpy(adapter->port[i].dev->dev_addr, hw_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->port[i].dev, hw_addr);
|
||||
init_link_config(&adapter->port[i].link_config, bi);
|
||||
}
|
||||
|
||||
|
||||
@@ -2586,7 +2586,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
t3_mac_set_address(&pi->mac, LAN_MAC_IDX, dev->dev_addr);
|
||||
if (offload_running(adapter))
|
||||
write_smt_entry(adapter, pi->port_id);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <linux/etherdevice.h>
|
||||
#include "common.h"
|
||||
#include "regs.h"
|
||||
#include "sge_defs.h"
|
||||
@@ -3758,8 +3759,7 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
|
||||
memcpy(hw_addr, adapter->params.vpd.eth_base, 5);
|
||||
hw_addr[5] = adapter->params.vpd.eth_base[5] + i;
|
||||
|
||||
memcpy(adapter->port[i]->dev_addr, hw_addr,
|
||||
ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->port[i], hw_addr);
|
||||
init_link_config(&p->link_config, p->phy.caps);
|
||||
p->phy.ops->power_down(&p->phy, 1);
|
||||
|
||||
|
||||
@@ -1545,7 +1545,7 @@ static inline void t4_write_reg64(struct adapter *adap, u32 reg_addr, u64 val)
|
||||
static inline void t4_set_hw_addr(struct adapter *adapter, int port_idx,
|
||||
u8 hw_addr[])
|
||||
{
|
||||
ether_addr_copy(adapter->port[port_idx]->dev_addr, hw_addr);
|
||||
eth_hw_addr_set(adapter->port[port_idx], hw_addr);
|
||||
ether_addr_copy(adapter->port[port_idx]->perm_addr, hw_addr);
|
||||
}
|
||||
|
||||
|
||||
@@ -3468,7 +3468,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -9706,7 +9706,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
|
||||
eth_hw_addr_set(adap->port[i], addr);
|
||||
j++;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#ifndef __CXGB4VF_ADAPTER_H__
|
||||
#define __CXGB4VF_ADAPTER_H__
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/spinlock.h>
|
||||
@@ -507,7 +508,7 @@ static inline const char *port_name(struct adapter *adapter, int pidx)
|
||||
static inline void t4_os_set_hw_addr(struct adapter *adapter, int pidx,
|
||||
u8 hw_addr[])
|
||||
{
|
||||
memcpy(adapter->port[pidx]->dev_addr, hw_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->port[pidx], hw_addr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1218,7 +1218,7 @@ static int cxgb4vf_set_mac_addr(struct net_device *dev, void *_addr)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1227,7 +1227,7 @@ static int set_mac_address(struct net_device *dev, void *p)
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
cs89_dbg(0, debug, "%s: Setting MAC address to %pM\n",
|
||||
dev->name, dev->dev_addr);
|
||||
|
||||
@@ -746,7 +746,7 @@ static struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data)
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy(dev->dev_addr, data->dev_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, data->dev_addr);
|
||||
|
||||
dev->ethtool_ops = &ep93xx_ethtool_ops;
|
||||
dev->netdev_ops = &ep93xx_netdev_ops;
|
||||
|
||||
@@ -541,7 +541,7 @@ static int set_mac_address(struct net_device *dev, void *addr)
|
||||
if (!is_valid_ether_addr(saddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, saddr->sa_data);
|
||||
netdev_info(dev, "Setting MAC address to %pM\n", dev->dev_addr);
|
||||
|
||||
/* set the Ethernet address */
|
||||
|
||||
@@ -985,7 +985,7 @@ static int enic_set_mac_addr(struct net_device *netdev, char *addr)
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
|
||||
memcpy(netdev->dev_addr, addr, netdev->addr_len);
|
||||
eth_hw_addr_set(netdev, addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1889,7 +1889,7 @@ static int gmac_set_mac_address(struct net_device *netdev, void *addr)
|
||||
{
|
||||
struct sockaddr *sa = addr;
|
||||
|
||||
memcpy(netdev->dev_addr, sa->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, sa->sa_data);
|
||||
gmac_write_mac_address(netdev);
|
||||
|
||||
return 0;
|
||||
@@ -2467,7 +2467,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
|
||||
DEFAULT_NAPI_WEIGHT);
|
||||
|
||||
if (is_valid_ether_addr((void *)port->mac_addr)) {
|
||||
memcpy(netdev->dev_addr, port->mac_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(netdev, (u8 *)port->mac_addr);
|
||||
} else {
|
||||
dev_dbg(dev, "ethernet address 0x%08x%08x%08x invalid\n",
|
||||
port->mac_addr[0], port->mac_addr[1],
|
||||
|
||||
@@ -1670,7 +1670,7 @@ dm9000_probe(struct platform_device *pdev)
|
||||
|
||||
if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
|
||||
mac_src = "platform data";
|
||||
memcpy(ndev->dev_addr, pdata->dev_addr, ETH_ALEN);
|
||||
eth_hw_addr_set(ndev, pdata->dev_addr);
|
||||
}
|
||||
|
||||
if (!is_valid_ether_addr(ndev->dev_addr)) {
|
||||
|
||||
@@ -1609,7 +1609,7 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
#if defined(CONFIG_SPARC)
|
||||
addr = of_get_property(dp, "local-mac-address", &len);
|
||||
if (addr && len == ETH_ALEN)
|
||||
memcpy(dev->dev_addr, addr, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr);
|
||||
#endif
|
||||
#if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */
|
||||
if (last_irq)
|
||||
|
||||
@@ -1611,7 +1611,7 @@ static int sundance_set_mac_addr(struct net_device *dev, void *data)
|
||||
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
__set_mac_addr(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -369,7 +369,7 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
|
||||
/* Remember currently programmed MAC */
|
||||
ether_addr_copy(adapter->dev_mac, addr->sa_data);
|
||||
done:
|
||||
ether_addr_copy(netdev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(netdev, addr->sa_data);
|
||||
dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);
|
||||
return 0;
|
||||
err:
|
||||
@@ -4599,7 +4599,7 @@ static int be_mac_setup(struct be_adapter *adapter)
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
|
||||
eth_hw_addr_set(adapter->netdev, mac);
|
||||
memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
|
||||
|
||||
/* Initial MAC for BE3 VFs is already programmed by PF */
|
||||
|
||||
@@ -816,7 +816,7 @@ static int ethoc_set_mac_address(struct net_device *dev, void *p)
|
||||
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
ethoc_do_set_mac_address(dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -1144,7 +1144,7 @@ static int ethoc_probe(struct platform_device *pdev)
|
||||
|
||||
/* Allow the platform setup code to pass in a MAC address. */
|
||||
if (pdata) {
|
||||
ether_addr_copy(netdev->dev_addr, pdata->hwaddr);
|
||||
eth_hw_addr_set(netdev, pdata->hwaddr);
|
||||
priv->phy_id = pdata->phy_id;
|
||||
} else {
|
||||
of_get_mac_address(pdev->dev.of_node, netdev->dev_addr);
|
||||
|
||||
@@ -421,7 +421,7 @@ static s32 nps_enet_set_mac_address(struct net_device *ndev, void *p)
|
||||
|
||||
res = eth_mac_addr(ndev, p);
|
||||
if (!res) {
|
||||
ether_addr_copy(ndev->dev_addr, addr->sa_data);
|
||||
eth_hw_addr_set(ndev, addr->sa_data);
|
||||
nps_enet_set_hw_mac_address(ndev);
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ static void ftgmac100_initial_mac(struct ftgmac100 *priv)
|
||||
|
||||
addr = device_get_mac_address(priv->dev, mac, ETH_ALEN);
|
||||
if (addr) {
|
||||
ether_addr_copy(priv->netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(priv->netdev, mac);
|
||||
dev_info(priv->dev, "Read MAC address %pM from device tree\n",
|
||||
mac);
|
||||
return;
|
||||
@@ -203,7 +203,7 @@ static void ftgmac100_initial_mac(struct ftgmac100 *priv)
|
||||
mac[5] = l & 0xff;
|
||||
|
||||
if (is_valid_ether_addr(mac)) {
|
||||
ether_addr_copy(priv->netdev->dev_addr, mac);
|
||||
eth_hw_addr_set(priv->netdev, mac);
|
||||
dev_info(priv->dev, "Read MAC address %pM from chip\n", mac);
|
||||
} else {
|
||||
eth_hw_addr_random(priv->netdev);
|
||||
|
||||
@@ -268,7 +268,7 @@ static int dpaa_netdev_init(struct net_device *net_dev,
|
||||
|
||||
if (is_valid_ether_addr(mac_addr)) {
|
||||
memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len);
|
||||
memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
|
||||
eth_hw_addr_set(net_dev, mac_addr);
|
||||
} else {
|
||||
eth_hw_addr_random(net_dev);
|
||||
err = priv->mac_dev->change_addr(priv->mac_dev->fman_mac,
|
||||
|
||||
@@ -4013,7 +4013,7 @@ static int dpaa2_eth_set_mac_addr(struct dpaa2_eth_priv *priv)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
|
||||
eth_hw_addr_set(net_dev, mac_addr);
|
||||
} else if (is_zero_ether_addr(dpni_mac_addr)) {
|
||||
/* No MAC address configured, fill in net_dev->dev_addr
|
||||
* with a random one
|
||||
@@ -4038,7 +4038,7 @@ static int dpaa2_eth_set_mac_addr(struct dpaa2_eth_priv *priv)
|
||||
/* NET_ADDR_PERM is default, all we have to do is
|
||||
* fill in the device addr.
|
||||
*/
|
||||
memcpy(net_dev->dev_addr, dpni_mac_addr, net_dev->addr_len);
|
||||
eth_hw_addr_set(net_dev, dpni_mac_addr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -139,12 +139,7 @@ static void dpaa2_mac_validate(struct phylink_config *config,
|
||||
case PHY_INTERFACE_MODE_NA:
|
||||
case PHY_INTERFACE_MODE_10GBASER:
|
||||
case PHY_INTERFACE_MODE_USXGMII:
|
||||
phylink_set(mask, 10000baseT_Full);
|
||||
phylink_set(mask, 10000baseCR_Full);
|
||||
phylink_set(mask, 10000baseSR_Full);
|
||||
phylink_set(mask, 10000baseLR_Full);
|
||||
phylink_set(mask, 10000baseLRM_Full);
|
||||
phylink_set(mask, 10000baseER_Full);
|
||||
phylink_set_10g_modes(mask);
|
||||
if (state->interface == PHY_INTERFACE_MODE_10GBASER)
|
||||
break;
|
||||
phylink_set(mask, 5000baseT_Full);
|
||||
|
||||
@@ -980,7 +980,7 @@ static int dpaa2_switch_port_set_mac_addr(struct ethsw_port_priv *port_priv)
|
||||
|
||||
/* First check if firmware has any address configured by bootloader */
|
||||
if (!is_zero_ether_addr(mac_addr)) {
|
||||
memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
|
||||
eth_hw_addr_set(net_dev, mac_addr);
|
||||
} else {
|
||||
/* No MAC address configured, fill in net_dev->dev_addr
|
||||
* with a random one
|
||||
|
||||
@@ -40,7 +40,7 @@ static int enetc_pf_set_mac_addr(struct net_device *ndev, void *addr)
|
||||
if (!is_valid_ether_addr(saddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(ndev->dev_addr, saddr->sa_data, ndev->addr_len);
|
||||
eth_hw_addr_set(ndev, saddr->sa_data);
|
||||
enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1768,7 +1768,7 @@ static int fec_get_mac(struct net_device *ndev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(ndev->dev_addr, iap, ETH_ALEN);
|
||||
eth_hw_addr_set(ndev, iap);
|
||||
|
||||
/* Adjust MAC if using macaddr */
|
||||
if (iap == macaddr)
|
||||
@@ -3326,7 +3326,7 @@ fec_set_mac_address(struct net_device *ndev, void *p)
|
||||
if (addr) {
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
|
||||
eth_hw_addr_set(ndev, addr->sa_data);
|
||||
}
|
||||
|
||||
/* Add netif status check here to avoid system hang in below case:
|
||||
|
||||
@@ -112,7 +112,7 @@ static int mpc52xx_fec_set_mac_address(struct net_device *dev, void *addr)
|
||||
{
|
||||
struct sockaddr *sock = addr;
|
||||
|
||||
memcpy(dev->dev_addr, sock->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, sock->sa_data);
|
||||
|
||||
mpc52xx_fec_set_paddr(dev, sock->sa_data);
|
||||
return 0;
|
||||
|
||||
@@ -3205,7 +3205,7 @@ static int ucc_geth_set_mac_addr(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, addr->sa_data);
|
||||
|
||||
/*
|
||||
* If device is not running, we will set mac addr register
|
||||
|
||||
@@ -733,7 +733,7 @@ int gve_adminq_describe_device(struct gve_priv *priv)
|
||||
}
|
||||
priv->dev->max_mtu = mtu;
|
||||
priv->num_event_counters = be16_to_cpu(descriptor->counters);
|
||||
ether_addr_copy(priv->dev->dev_addr, descriptor->mac);
|
||||
eth_hw_addr_set(priv->dev, descriptor->mac);
|
||||
mac = descriptor->mac;
|
||||
dev_info(&priv->pdev->dev, "MAC addr: %pM\n", mac);
|
||||
priv->tx_pages_per_qpl = be16_to_cpu(descriptor->tx_pages_per_qpl);
|
||||
|
||||
@@ -555,7 +555,7 @@ static int hisi_femac_set_mac_address(struct net_device *dev, void *p)
|
||||
if (!is_valid_ether_addr(skaddr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, skaddr->sa_data, dev->addr_len);
|
||||
eth_hw_addr_set(dev, skaddr->sa_data);
|
||||
dev->addr_assign_type &= ~NET_ADDR_RANDOM;
|
||||
|
||||
hisi_femac_set_hw_mac_addr(priv, dev->dev_addr);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user