-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Igor Russkikh says: ==================== net: atlantic: Aquantia driver updates 2019-04 This patchset contains various improvements: - Work targeting link up speedups: link interrupt introduced, some other logic changes to imrove this. - FW operations securing with mutex - Counters and statistics logic improved by Dmitry - read out of chip temperature via hwmon interface implemented by Yana and Nikita. v4 changes: - remove drvinfo_exit noop - 64bit stats should be readed out sequentially (lsw, then msw) declare 64bit read ops for that v3 changes: - temp ops renamed to phy_temp ops - mutex commits squashed for better structure v2 changes: - use threaded irq for link state handling - rework hwmon via devm_hwmon_device_register_with_info Extra comments on review from Andrew: - direct device name pointer is used in hwmon registration. This causes hwmon device to derive possible interface name changes - Will consider sanity checks for firmware mutex lock separately. Right now there is no single point exsists where such check could be easily added. - There is no way now to fetch and configure min/max/crit temperatures via FW. Will investigate this separately. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
22 changed files
with
427 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
/* Copyright (C) 2014-2019 aQuantia Corporation. */ | ||
|
||
/* File aq_drvinfo.c: Definition of common code for firmware info in sys.*/ | ||
|
||
#include <linux/init.h> | ||
#include <linux/kobject.h> | ||
#include <linux/module.h> | ||
#include <linux/stat.h> | ||
#include <linux/string.h> | ||
#include <linux/hwmon.h> | ||
#include <linux/uaccess.h> | ||
|
||
#include "aq_drvinfo.h" | ||
|
||
static int aq_hwmon_read(struct device *dev, enum hwmon_sensor_types type, | ||
u32 attr, int channel, long *value) | ||
{ | ||
struct aq_nic_s *aq_nic = dev_get_drvdata(dev); | ||
int temp; | ||
int err; | ||
|
||
if (!aq_nic) | ||
return -EIO; | ||
|
||
if (type != hwmon_temp) | ||
return -EOPNOTSUPP; | ||
|
||
if (!aq_nic->aq_fw_ops->get_phy_temp) | ||
return -EOPNOTSUPP; | ||
|
||
switch (attr) { | ||
case hwmon_temp_input: | ||
err = aq_nic->aq_fw_ops->get_phy_temp(aq_nic->aq_hw, &temp); | ||
*value = temp; | ||
return err; | ||
default: | ||
return -EOPNOTSUPP; | ||
} | ||
} | ||
|
||
static int aq_hwmon_read_string(struct device *dev, | ||
enum hwmon_sensor_types type, | ||
u32 attr, int channel, const char **str) | ||
{ | ||
struct aq_nic_s *aq_nic = dev_get_drvdata(dev); | ||
|
||
if (!aq_nic) | ||
return -EIO; | ||
|
||
if (type != hwmon_temp) | ||
return -EOPNOTSUPP; | ||
|
||
if (!aq_nic->aq_fw_ops->get_phy_temp) | ||
return -EOPNOTSUPP; | ||
|
||
switch (attr) { | ||
case hwmon_temp_label: | ||
*str = "PHY Temperature"; | ||
return 0; | ||
default: | ||
return -EOPNOTSUPP; | ||
} | ||
} | ||
|
||
static umode_t aq_hwmon_is_visible(const void *data, | ||
enum hwmon_sensor_types type, | ||
u32 attr, int channel) | ||
{ | ||
if (type != hwmon_temp) | ||
return 0; | ||
|
||
switch (attr) { | ||
case hwmon_temp_input: | ||
case hwmon_temp_label: | ||
return 0444; | ||
default: | ||
return 0; | ||
} | ||
} | ||
|
||
static const struct hwmon_ops aq_hwmon_ops = { | ||
.is_visible = aq_hwmon_is_visible, | ||
.read = aq_hwmon_read, | ||
.read_string = aq_hwmon_read_string, | ||
}; | ||
|
||
static u32 aq_hwmon_temp_config[] = { | ||
HWMON_T_INPUT | HWMON_T_LABEL, | ||
0, | ||
}; | ||
|
||
static const struct hwmon_channel_info aq_hwmon_temp = { | ||
.type = hwmon_temp, | ||
.config = aq_hwmon_temp_config, | ||
}; | ||
|
||
static const struct hwmon_channel_info *aq_hwmon_info[] = { | ||
&aq_hwmon_temp, | ||
NULL, | ||
}; | ||
|
||
static const struct hwmon_chip_info aq_hwmon_chip_info = { | ||
.ops = &aq_hwmon_ops, | ||
.info = aq_hwmon_info, | ||
}; | ||
|
||
int aq_drvinfo_init(struct net_device *ndev) | ||
{ | ||
struct aq_nic_s *aq_nic = netdev_priv(ndev); | ||
struct device *dev = &aq_nic->pdev->dev; | ||
struct device *hwmon_dev; | ||
int err = 0; | ||
|
||
hwmon_dev = devm_hwmon_device_register_with_info(dev, | ||
ndev->name, | ||
aq_nic, | ||
&aq_hwmon_chip_info, | ||
NULL); | ||
|
||
if (IS_ERR(hwmon_dev)) | ||
err = PTR_ERR(hwmon_dev); | ||
|
||
return err; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
/* Copyright (C) 2014-2017 aQuantia Corporation. */ | ||
|
||
/* File aq_drvinfo.h: Declaration of common code for firmware info in sys.*/ | ||
|
||
#ifndef AQ_DRVINFO_H | ||
#define AQ_DRVINFO_H | ||
|
||
#include "aq_nic.h" | ||
#include "aq_hw.h" | ||
#include "hw_atl/hw_atl_utils.h" | ||
|
||
int aq_drvinfo_init(struct net_device *ndev); | ||
|
||
#endif /* AQ_DRVINFO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.