Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1400585 > unrolled thread
| Started by | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| First post | 2016-05-13 10:10 +0200 |
| Last post | 2016-05-16 04:10 +0200 |
| Articles | 11 — 3 participants |
Back to article view | Back to linux.kernel
[patch net-next 00/11] net: hns: add support of ACPI Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
[patch net-next 09/11] ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
[patch net-next 08/11] net: hns: register phy device in each mac initial sequence Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
[patch net-next 10/11] net: hns: implement the reset sequence by asl Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
[patch net-next 07/11] net: hns: dsaf adds support of acpi Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
Re: [patch net-next 07/11] net: hns: dsaf adds support of acpi Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-05-13 15:20 +0200
Re: [patch net-next 07/11] net: hns: dsaf adds support of acpi "Yankejian (Hackim Yim)" <yankejian@huawei.com> - 2016-05-16 04:10 +0200
[patch net-next 02/11] net: hns: use device_* APIs instead of of_* APIs Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
[patch net-next 05/11] net: hns: add uniform interface for phy connection Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-05-13 10:10 +0200
Re: [patch net-next 05/11] net: hns: add uniform interface for phy connection Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-05-13 15:10 +0200
Re: [patch net-next 05/11] net: hns: add uniform interface for phy connection "Yankejian (Hackim Yim)" <yankejian@huawei.com> - 2016-05-16 04:10 +0200
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 00/11] net: hns: add support of ACPI |
| Message-ID | <rygkx-7Xv-3@gated-at.bofh.it> |
HNS driver needs to run only in ACPI case, so this series adds HNS support of acpi. The routine will call some ACPI helper functions, like acpi_match_device_ids() and acpi_evaluate_dsm(), which are not included in other cases. In order to make system compile successfully in other cases except ACPI, it needs to add relative stub functions to linux/acpi.h. Hanjun Guo (1): ACPI: bus: move acpi_match_device_ids() to linux/acpi.h Kejian Yan (10): net: hisilicon: add support of acpi for hns-mdio net: hns: use device_* APIs instead of of_* APIs net: hns: use platform_get_irq instead of irq_of_parse_and_map net: hns: enet specify a reference to dsaf by fwnode_handle net: hns: add uniform interface for phy connection net: hns: dsaf adds support of acpi net: hns: register phy device in each mac initial sequence ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h net: hns: implement the reset sequence by asl net: hns: enet adds support of acpi drivers/net/ethernet/hisilicon/hns/hnae.c | 18 +- drivers/net/ethernet/hisilicon/hns/hnae.h | 5 +- drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 2 +- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 221 +++++++++--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | 2 +- drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 95 ++++-- drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 372 ++++++++++++++------- drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | 5 +- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 112 +++++-- drivers/net/ethernet/hisilicon/hns/hns_enet.h | 2 +- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 +- drivers/net/ethernet/hisilicon/hns_mdio.c | 145 +++++--- include/acpi/acpi_bus.h | 2 - include/linux/acpi.h | 19 ++ 14 files changed, 712 insertions(+), 290 deletions(-) -- 1.9.1
[toc] | [next] | [standalone]
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 09/11] ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h |
| Message-ID | <rygky-7Xv-19@gated-at.bofh.it> |
| In reply to | #1400585 |
From: Kejian Yan <yankejian@huawei.com>
acpi_evaluate_dsm() will be used to handle the _DSM method in ACPI case.
It will be compiled in non-ACPI case, but the function is in acpi_bus.h
and acpi_bus.h can only be used in ACPI case, so this patch add the stub
function to linux/acpi.h to make compiled successfully in non-ACPI cases.
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
include/linux/acpi.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index e578bce..5c5566e 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -661,6 +661,14 @@ static inline bool acpi_driver_match_device(struct device *dev,
return false;
}
+static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
+ const u8 *uuid,
+ int rev, int func,
+ union acpi_object *argv4)
+{
+ return NULL;
+}
+
static inline int acpi_device_uevent_modalias(struct device *dev,
struct kobj_uevent_env *env)
{
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 08/11] net: hns: register phy device in each mac initial sequence |
| Message-ID | <rygky-7Xv-23@gated-at.bofh.it> |
| In reply to | #1400585 |
From: Kejian Yan <yankejian@huawei.com>
In ACPI case, there is no interface to register phy device to mdio-bus.
Phy device has to be registered itself to mdio-bus, and then enet can
get the phy device's info so that it can config the phy-device to help
to trasmit and receive data.
HNS hardware topology is as below. The MDIO controller may control several
PHY-devices, and each PHY-device connects to a MAC device. PHY-devices
will register when each mac find PHY device in initial sequence.
cpu
|
|
-------------------------------------------
| | |
| | |
| dsaf |
MDIO | MDIO
| --------------------------- |
| | | | | |
| | | | | |
| MAC MAC MAC MAC |
| | | | | |
---- |-------- |-------- | | --------
|| || || ||
PHY PHY PHY PHY
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 119 +++++++++++++++++++++-
1 file changed, 115 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 6e8f2b3..79d820b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -7,6 +7,7 @@
* (at your option) any later version.
*/
+#include <linux/acpi.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
@@ -638,6 +639,115 @@ free_mac_drv:
return ret;
}
+static int
+hns_mac_phy_parse_addr(struct device *dev, struct fwnode_handle *fwnode)
+{
+ u32 addr;
+ int ret;
+
+ ret = fwnode_property_read_u32(fwnode, "phy-addr", &addr);
+ if (ret) {
+ dev_err(dev, "has invalid PHY address ret:%d\n", ret);
+ return ret;
+ }
+
+ if (addr >= PHY_MAX_ADDR) {
+ dev_err(dev, "PHY address %i is too large\n", addr);
+ return -EINVAL;
+ }
+
+ return addr;
+}
+
+static int hns_mac_phydev_match(struct device *dev, void *fwnode)
+{
+ return dev->fwnode == fwnode;
+}
+
+static struct
+platform_device *hns_mac_find_platform_device(struct fwnode_handle *fwnode)
+{
+ struct device *dev;
+
+ dev = bus_find_device(&platform_bus_type, NULL,
+ fwnode, hns_mac_phydev_match);
+ return dev ? to_platform_device(dev) : NULL;
+}
+
+static int
+hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb,
+ u32 addr)
+{
+ struct phy_device *phy;
+ const char *phy_type;
+ bool is_c45;
+ int rc;
+
+ rc = fwnode_property_read_string(mac_cb->fw_port,
+ "phy-mode", &phy_type);
+ if (rc < 0)
+ return rc;
+
+ if (!strcmp(phy_type, phy_modes(PHY_INTERFACE_MODE_XGMII)))
+ is_c45 = 1;
+ else if (!strcmp(phy_type, phy_modes(PHY_INTERFACE_MODE_SGMII)))
+ is_c45 = 0;
+ else
+ return -ENODATA;
+
+ phy = get_phy_device(mdio, addr, is_c45);
+ if (!phy || IS_ERR(phy))
+ return -EIO;
+
+ if (mdio->irq)
+ phy->irq = mdio->irq[addr];
+
+ /* All data is now stored in the phy struct;
+ * register it
+ */
+ rc = phy_device_register(phy);
+ if (rc) {
+ phy_device_free(phy);
+ return -ENODEV;
+ }
+
+ mac_cb->phy_dev = phy;
+
+ dev_dbg(&mdio->dev, "registered phy at address %i\n", addr);
+
+ return 0;
+}
+
+static void hns_mac_register_phy(struct hns_mac_cb *mac_cb)
+{
+ struct acpi_reference_args args;
+ struct platform_device *pdev;
+ struct mii_bus *mii_bus;
+ int rc;
+ int addr;
+
+ /* Loop over the child nodes and register a phy_device for each one */
+ if (!to_acpi_device_node(mac_cb->fw_port))
+ return;
+
+ rc = acpi_node_get_property_reference(
+ mac_cb->fw_port, "mdio-node", 0, &args);
+ if (rc)
+ return;
+
+ addr = hns_mac_phy_parse_addr(mac_cb->dev, mac_cb->fw_port);
+ if (addr < 0)
+ return;
+
+ /* dev address in adev */
+ pdev = hns_mac_find_platform_device(acpi_fwnode_handle(args.adev));
+ mii_bus = platform_get_drvdata(pdev);
+ rc = hns_mac_register_phydev(mii_bus, mac_cb, addr);
+ if (!rc)
+ dev_dbg(mac_cb->dev, "mac%d register phy addr:%d\n",
+ mac_cb->mac_id, addr);
+}
+
/**
*hns_mac_get_info - get mac information from device node
*@mac_cb: mac device
@@ -677,11 +787,7 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->mac_id);
mac_cb->phy_dev = of_phy_find_device(np);
if (mac_cb->phy_dev) {
- /* refcount is held by of_phy_find_device()
- * if the phy_dev is found
- */
put_device(&mac_cb->phy_dev->mdio.dev);
-
dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
mac_cb->mac_id, np->name);
}
@@ -743,6 +849,11 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->cpld_ctrl_reg = cpld_args.args[0];
}
}
+ } else if (ACPI_COMPANION(dev)) {
+ hns_mac_register_phy(mac_cb);
+ } else {
+ dev_err(mac_cb->dev, "mac%d cannot find phy node\n",
+ mac_cb->mac_id);
}
return 0;
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 10/11] net: hns: implement the reset sequence by asl |
| Message-ID | <rygky-7Xv-27@gated-at.bofh.it> |
| In reply to | #1400585 |
From: Kejian Yan <yankejian@huawei.com>
The reset sequence is implemented in BIOS, the kernel can call _DSM
method help to call the implementation in ACPI case. Here is a patch
to do that.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 113 +++++++++++++++++++++
1 file changed, 113 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index ed96d7b..9edf4f7 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -12,6 +12,27 @@
#include "hns_dsaf_ppe.h"
#include "hns_dsaf_reg.h"
+enum _dsm_op_index {
+ HNS_OP_RESET_FUNC = 0x1,
+ HNS_OP_SERDES_LP_FUNC = 0x2,
+ HNS_OP_LED_SET_FUNC = 0x3,
+ HNS_OP_GET_PORT_TYPE_FUNC = 0x4,
+ HNS_OP_GET_SFP_STAT_FUNC = 0x5,
+};
+
+enum _dsm_rst_type {
+ HNS_DSAF_RESET_FUNC = 0x1,
+ HNS_PPE_RESET_FUNC = 0x2,
+ HNS_XGE_CORE_RESET_FUNC = 0x3,
+ HNS_XGE_RESET_FUNC = 0x4,
+ HNS_GE_RESET_FUNC = 0x5,
+};
+
+const u8 hns_dsaf_acpi_dsm_uuid[] = {
+ 0x1A, 0xAA, 0x85, 0x1A, 0x93, 0xE2, 0x5E, 0x41,
+ 0x8E, 0x28, 0x8D, 0x69, 0x0A, 0x0F, 0x82, 0x0A
+};
+
static void dsaf_write_sub(struct dsaf_device *dsaf_dev, u32 reg, u32 val)
{
if (dsaf_dev->sub_ctrl)
@@ -109,6 +130,34 @@ int cpld_set_led_id(struct hns_mac_cb *mac_cb,
#define RESET_REQ_OR_DREQ 1
+static void hns_dsaf_acpi_srst_by_port(struct dsaf_device *dsaf_dev, u8 op_type,
+ u32 port_type, u32 port, u32 val)
+{
+ union acpi_object *obj;
+ union acpi_object obj_args[3], argv4;
+
+ obj_args[0].integer.type = ACPI_TYPE_INTEGER;
+ obj_args[0].integer.value = port_type;
+ obj_args[1].integer.type = ACPI_TYPE_INTEGER;
+ obj_args[1].integer.value = port;
+ obj_args[2].integer.type = ACPI_TYPE_INTEGER;
+ obj_args[2].integer.value = val;
+
+ argv4.type = ACPI_TYPE_PACKAGE;
+ argv4.package.count = 3;
+ argv4.package.elements = obj_args;
+
+ obj = acpi_evaluate_dsm(ACPI_HANDLE(dsaf_dev->dev),
+ hns_dsaf_acpi_dsm_uuid, 0, op_type, &argv4);
+ if (!obj) {
+ dev_warn(dsaf_dev->dev, "reset port_type%d port%d fail!",
+ port_type, port);
+ return;
+ }
+
+ ACPI_FREE(obj);
+}
+
void hns_dsaf_rst(struct dsaf_device *dsaf_dev, u32 val)
{
u32 xbar_reg_addr;
@@ -125,6 +174,10 @@ void hns_dsaf_rst(struct dsaf_device *dsaf_dev, u32 val)
dsaf_write_sub(dsaf_dev, xbar_reg_addr, RESET_REQ_OR_DREQ);
dsaf_write_sub(dsaf_dev, nt_reg_addr, RESET_REQ_OR_DREQ);
+ } else if (is_acpi_device_node(dsaf_dev->dev->fwnode)) {
+ hns_dsaf_acpi_srst_by_port(dsaf_dev, HNS_OP_RESET_FUNC,
+ HNS_DSAF_RESET_FUNC,
+ 0, val);
}
}
@@ -147,6 +200,9 @@ void hns_dsaf_xge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
reg_addr = DSAF_SUB_SC_XGE_RESET_DREQ_REG;
dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ } else if (is_acpi_device_node(dsaf_dev->dev->fwnode)) {
+ hns_dsaf_acpi_srst_by_port(dsaf_dev, HNS_OP_RESET_FUNC,
+ HNS_XGE_RESET_FUNC, port, val);
}
}
@@ -168,6 +224,9 @@ void hns_dsaf_xge_core_srst_by_port(struct dsaf_device *dsaf_dev,
reg_addr = DSAF_SUB_SC_XGE_RESET_DREQ_REG;
dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ } else if (is_acpi_device_node(dsaf_dev->dev->fwnode)) {
+ hns_dsaf_acpi_srst_by_port(dsaf_dev, HNS_OP_RESET_FUNC,
+ HNS_XGE_CORE_RESET_FUNC, port, val);
}
}
@@ -229,6 +288,9 @@ void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
reg_val_2);
}
}
+ } else if (is_acpi_device_node(dsaf_dev->dev->fwnode)) {
+ hns_dsaf_acpi_srst_by_port(dsaf_dev, HNS_OP_RESET_FUNC,
+ HNS_GE_RESET_FUNC, port, val);
}
}
@@ -248,6 +310,9 @@ void hns_ppe_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
reg_addr = DSAF_SUB_SC_PPE_RESET_DREQ_REG;
dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ } else if (is_acpi_device_node(dsaf_dev->dev->fwnode)) {
+ hns_dsaf_acpi_srst_by_port(dsaf_dev, HNS_OP_RESET_FUNC,
+ HNS_PPE_RESET_FUNC, port, val);
}
}
@@ -313,6 +378,30 @@ phy_interface_t hns_mac_get_phy_if(struct hns_mac_cb *mac_cb)
phy_if = PHY_INTERFACE_MODE_XGMII;
else
phy_if = PHY_INTERFACE_MODE_SGMII;
+ } else if (is_acpi_device_node(mac_cb->dev->fwnode)) {
+ union acpi_object *obj;
+ union acpi_object obj_args, argv4;
+
+ obj_args.integer.type = ACPI_TYPE_INTEGER;
+ obj_args.integer.value = mac_cb->mac_id;
+
+ argv4.type = ACPI_TYPE_PACKAGE,
+ argv4.package.count = 1,
+ argv4.package.elements = &obj_args,
+
+ obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
+ hns_dsaf_acpi_dsm_uuid, 0,
+ HNS_OP_GET_PORT_TYPE_FUNC, &argv4);
+
+ if (!obj || obj->type != ACPI_TYPE_INTEGER)
+ return phy_if;
+
+ phy_if = obj->integer.value ?
+ PHY_INTERFACE_MODE_XGMII : PHY_INTERFACE_MODE_SGMII;
+
+ dev_dbg(mac_cb->dev, "mac_id=%d, phy_if=%d\n", mac_id, phy_if);
+
+ ACPI_FREE(obj);
}
return phy_if;
@@ -380,6 +469,30 @@ int hns_mac_config_sds_loopback(struct hns_mac_cb *mac_cb, u8 en)
dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10,
10, !!en);
}
+ } else if (is_acpi_device_node(dsaf_dev->dev->fwnode)) {
+ union acpi_object *obj;
+ union acpi_object obj_args[3], argv4;
+
+ obj_args[0].integer.type = ACPI_TYPE_INTEGER;
+ obj_args[0].integer.value = mac_cb->mac_id;
+ obj_args[1].integer.type = ACPI_TYPE_INTEGER;
+ obj_args[1].integer.value = !!en;
+
+ argv4.type = ACPI_TYPE_PACKAGE;
+ argv4.package.count = 2;
+ argv4.package.elements = obj_args;
+
+ obj = acpi_evaluate_dsm(ACPI_HANDLE(dsaf_dev->dev),
+ hns_dsaf_acpi_dsm_uuid, 0,
+ HNS_OP_SERDES_LP_FUNC, &argv4);
+ if (!obj) {
+ dev_warn(dsaf_dev->dev, "set port%d serdes lp fail!",
+ mac_cb->mac_id);
+
+ return -ENOTSUPP;
+ }
+
+ ACPI_FREE(obj);
}
return 0;
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 07/11] net: hns: dsaf adds support of acpi |
| Message-ID | <rygkz-7Xv-29@gated-at.bofh.it> |
| In reply to | #1400585 |
From: Kejian Yan <yankejian@huawei.com>
Dsaf needs to get configuration parameter by ACPI, so this patch add
support of ACPI.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 80 +++----
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 86 ++++---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 259 ++++++++++++---------
3 files changed, 244 insertions(+), 181 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 527b49d..6e8f2b3 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -689,9 +689,7 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
return 0;
}
- if (!is_of_node(mac_cb->fw_port))
- return -EINVAL;
-
+ if (is_of_node(mac_cb->fw_port)) {
/* parse property from port subnode in dsaf */
np = of_parse_phandle(to_of_node(mac_cb->fw_port), "phy-handle", 0);
mac_cb->phy_dev = of_phy_find_device(np);
@@ -701,47 +699,49 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->mac_id, np->name);
}
- syscon = syscon_node_to_regmap(
- of_parse_phandle(to_of_node(mac_cb->fw_port),
- "serdes-syscon", 0));
- if (IS_ERR_OR_NULL(syscon)) {
- dev_err(mac_cb->dev, "serdes-syscon is needed!\n");
- return -EINVAL;
- }
- mac_cb->serdes_ctrl = syscon;
-
- ret = fwnode_property_read_u32(mac_cb->fw_port,
- "port-rst-offset",
- &mac_cb->port_rst_off);
- if (ret) {
- dev_dbg(mac_cb->dev,
- "mac%d port-rst-offset not found, use default value.\n",
- mac_cb->mac_id);
- }
+ syscon = syscon_node_to_regmap(
+ of_parse_phandle(to_of_node(mac_cb->fw_port),
+ "serdes-syscon", 0));
+ if (IS_ERR_OR_NULL(syscon)) {
+ dev_err(mac_cb->dev, "serdes-syscon is needed!\n");
+ return -EINVAL;
+ }
+ mac_cb->serdes_ctrl = syscon;
- ret = fwnode_property_read_u32(mac_cb->fw_port,
- "port-mode-offset",
- &mac_cb->port_mode_off);
- if (ret) {
- dev_dbg(mac_cb->dev,
- "mac%d port-mode-offset not found, use default value.\n",
- mac_cb->mac_id);
- }
+ ret = fwnode_property_read_u32(mac_cb->fw_port,
+ "port-rst-offset",
+ &mac_cb->port_rst_off);
+ if (ret) {
+ dev_dbg(mac_cb->dev,
+ "mac%d port-rst-offset not found, use default value.\n",
+ mac_cb->mac_id);
+ }
- ret = of_parse_phandle_with_fixed_args(to_of_node(mac_cb->fw_port),
- "cpld-syscon", 1, 0, &cpld_args);
- if (ret) {
- dev_dbg(mac_cb->dev, "mac%d no cpld-syscon found.\n",
- mac_cb->mac_id);
- mac_cb->cpld_ctrl = NULL;
- } else {
- syscon = syscon_node_to_regmap(cpld_args.np);
- if (IS_ERR_OR_NULL(syscon)) {
- dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
+ ret = fwnode_property_read_u32(mac_cb->fw_port,
+ "port-mode-offset",
+ &mac_cb->port_mode_off);
+ if (ret) {
+ dev_dbg(mac_cb->dev,
+ "mac%d port-mode-offset not found, use default value.\n",
+ mac_cb->mac_id);
+ }
+
+ ret = of_parse_phandle_with_fixed_args(
+ to_of_node(mac_cb->fw_port), "cpld-syscon", 1, 0,
+ &cpld_args);
+ if (ret) {
+ dev_dbg(mac_cb->dev, "mac%d no cpld-syscon found.\n",
+ mac_cb->mac_id);
mac_cb->cpld_ctrl = NULL;
} else {
- mac_cb->cpld_ctrl = syscon;
- mac_cb->cpld_ctrl_reg = cpld_args.args[0];
+ syscon = syscon_node_to_regmap(cpld_args.np);
+ if (IS_ERR_OR_NULL(syscon)) {
+ dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
+ mac_cb->cpld_ctrl = NULL;
+ } else {
+ mac_cb->cpld_ctrl = syscon;
+ mac_cb->cpld_ctrl_reg = cpld_args.args[0];
+ }
}
}
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index 9afc5e6..da878b1 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -7,6 +7,7 @@
* (at your option) any later version.
*/
+#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/interrupt.h>
@@ -32,6 +33,13 @@ const char *g_dsaf_mode_match[DSAF_MODE_MAX] = {
[DSAF_MODE_DISABLE_SP] = "single-port",
};
+static const struct acpi_device_id hns_dsaf_acpi_match[] = {
+ { "HISI00B1", 0 },
+ { "HISI00B2", 0 },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, hns_dsaf_acpi_match);
+
int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
{
int ret, i;
@@ -43,12 +51,25 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
struct regmap *syscon;
struct resource *res;
struct device_node *np = dsaf_dev->dev->of_node;
+ struct fwnode_handle *fwnode = dsaf_dev->dev->fwnode;
+ struct acpi_device *adev;
struct platform_device *pdev = to_platform_device(dsaf_dev->dev);
- if (of_device_is_compatible(np, "hisilicon,hns-dsaf-v1"))
- dsaf_dev->dsaf_ver = AE_VERSION_1;
- else
- dsaf_dev->dsaf_ver = AE_VERSION_2;
+ if (IS_ENABLED(CONFIG_OF) && np) {
+ if (of_device_is_compatible(np, "hisilicon,hns-dsaf-v1"))
+ dsaf_dev->dsaf_ver = AE_VERSION_1;
+ else
+ dsaf_dev->dsaf_ver = AE_VERSION_2;
+ } else if (ACPI_COMPANION(dsaf_dev->dev)) {
+ adev = to_acpi_device_node(fwnode);
+ if (!acpi_match_device_ids(adev, &hns_dsaf_acpi_match[1]))
+ dsaf_dev->dsaf_ver = AE_VERSION_2;
+ else
+ dsaf_dev->dsaf_ver = AE_VERSION_1;
+ } else {
+ dev_err(dsaf_dev->dev, "cannot get cfd data from of or acpi\n");
+ return -ENXIO;
+ }
ret = device_property_read_string(dsaf_dev->dev, "mode", &mode_str);
if (ret) {
@@ -80,32 +101,40 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
else
dsaf_dev->dsaf_tc_mode = HRD_DSAF_4TC_MODE;
- syscon = syscon_node_to_regmap(
- of_parse_phandle(np, "subctrl-syscon", 0));
- if (IS_ERR_OR_NULL(syscon)) {
- res = platform_get_resource(pdev, IORESOURCE_MEM, res_idx++);
- if (!res) {
- dev_err(dsaf_dev->dev, "subctrl info is needed!\n");
- return -ENOMEM;
- }
- dsaf_dev->sc_base = devm_ioremap_resource(&pdev->dev, res);
- if (!dsaf_dev->sc_base) {
- dev_err(dsaf_dev->dev, "subctrl can not map!\n");
- return -ENOMEM;
- }
+ if (IS_ENABLED(CONFIG_OF) && np) {
+ syscon = syscon_node_to_regmap(
+ of_parse_phandle(np, "subctrl-syscon", 0));
+ if (IS_ERR_OR_NULL(syscon)) {
+ res = platform_get_resource(pdev, IORESOURCE_MEM,
+ res_idx++);
+ if (!res) {
+ dev_err(dsaf_dev->dev, "subctrl info is needed!\n");
+ return -ENOMEM;
+ }
- res = platform_get_resource(pdev, IORESOURCE_MEM, res_idx++);
- if (!res) {
- dev_err(dsaf_dev->dev, "serdes-ctrl info is needed!\n");
- return -ENOMEM;
- }
- dsaf_dev->sds_base = devm_ioremap_resource(&pdev->dev, res);
- if (!dsaf_dev->sds_base) {
- dev_err(dsaf_dev->dev, "serdes-ctrl can not map!\n");
- return -ENOMEM;
+ dsaf_dev->sc_base = devm_ioremap_resource(&pdev->dev,
+ res);
+ if (!dsaf_dev->sc_base) {
+ dev_err(dsaf_dev->dev, "subctrl can not map!\n");
+ return -ENOMEM;
+ }
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM,
+ res_idx++);
+ if (!res) {
+ dev_err(dsaf_dev->dev, "serdes-ctrl info is needed!\n");
+ return -ENOMEM;
+ }
+
+ dsaf_dev->sds_base = devm_ioremap_resource(&pdev->dev,
+ res);
+ if (!dsaf_dev->sds_base) {
+ dev_err(dsaf_dev->dev, "serdes-ctrl can not map!\n");
+ return -ENOMEM;
+ }
+ } else {
+ dsaf_dev->sub_ctrl = syscon;
}
- } else {
- dsaf_dev->sub_ctrl = syscon;
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ppe-base");
@@ -2681,6 +2710,7 @@ static struct platform_driver g_dsaf_driver = {
.driver = {
.name = DSAF_DRV_NAME,
.of_match_table = g_dsaf_match,
+ .acpi_match_table = hns_dsaf_acpi_match,
},
};
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index a843a86..ed96d7b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -114,16 +114,18 @@ void hns_dsaf_rst(struct dsaf_device *dsaf_dev, u32 val)
u32 xbar_reg_addr;
u32 nt_reg_addr;
- if (!val) {
- xbar_reg_addr = DSAF_SUB_SC_XBAR_RESET_REQ_REG;
- nt_reg_addr = DSAF_SUB_SC_NT_RESET_REQ_REG;
- } else {
- xbar_reg_addr = DSAF_SUB_SC_XBAR_RESET_DREQ_REG;
- nt_reg_addr = DSAF_SUB_SC_NT_RESET_DREQ_REG;
- }
+ if (IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node) {
+ if (!val) {
+ xbar_reg_addr = DSAF_SUB_SC_XBAR_RESET_REQ_REG;
+ nt_reg_addr = DSAF_SUB_SC_NT_RESET_REQ_REG;
+ } else {
+ xbar_reg_addr = DSAF_SUB_SC_XBAR_RESET_DREQ_REG;
+ nt_reg_addr = DSAF_SUB_SC_NT_RESET_DREQ_REG;
+ }
- dsaf_write_sub(dsaf_dev, xbar_reg_addr, RESET_REQ_OR_DREQ);
- dsaf_write_sub(dsaf_dev, nt_reg_addr, RESET_REQ_OR_DREQ);
+ dsaf_write_sub(dsaf_dev, xbar_reg_addr, RESET_REQ_OR_DREQ);
+ dsaf_write_sub(dsaf_dev, nt_reg_addr, RESET_REQ_OR_DREQ);
+ }
}
void hns_dsaf_xge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
@@ -134,15 +136,18 @@ void hns_dsaf_xge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
if (port >= DSAF_XGE_NUM)
return;
- reg_val |= RESET_REQ_OR_DREQ;
- reg_val |= 0x2082082 << dsaf_dev->mac_cb[port]->port_rst_off;
+ if (IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node) {
+ reg_val |= RESET_REQ_OR_DREQ;
- if (val == 0)
- reg_addr = DSAF_SUB_SC_XGE_RESET_REQ_REG;
- else
- reg_addr = DSAF_SUB_SC_XGE_RESET_DREQ_REG;
+ reg_val |= 0x2082082 << dsaf_dev->mac_cb[port]->port_rst_off;
- dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ if (val == 0)
+ reg_addr = DSAF_SUB_SC_XGE_RESET_REQ_REG;
+ else
+ reg_addr = DSAF_SUB_SC_XGE_RESET_DREQ_REG;
+
+ dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ }
}
void hns_dsaf_xge_core_srst_by_port(struct dsaf_device *dsaf_dev,
@@ -153,16 +158,17 @@ void hns_dsaf_xge_core_srst_by_port(struct dsaf_device *dsaf_dev,
if (port >= DSAF_XGE_NUM)
return;
+ if (IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node) {
+ reg_val |= XGMAC_TRX_CORE_SRST_M
+ << dsaf_dev->mac_cb[port]->port_rst_off;
- reg_val |= XGMAC_TRX_CORE_SRST_M
- << dsaf_dev->mac_cb[port]->port_rst_off;
-
- if (val == 0)
- reg_addr = DSAF_SUB_SC_XGE_RESET_REQ_REG;
- else
- reg_addr = DSAF_SUB_SC_XGE_RESET_DREQ_REG;
+ if (val == 0)
+ reg_addr = DSAF_SUB_SC_XGE_RESET_REQ_REG;
+ else
+ reg_addr = DSAF_SUB_SC_XGE_RESET_DREQ_REG;
- dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ }
}
void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
@@ -174,44 +180,54 @@ void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
if (port >= DSAF_GE_NUM)
return;
- if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
- reg_val_1 = 0x1 << port;
- port_rst_off = dsaf_dev->mac_cb[port]->port_rst_off;
- /* there is difference between V1 and V2 in register.*/
- if (AE_IS_VER1(dsaf_dev->dsaf_ver))
- reg_val_2 = 0x1041041 << port_rst_off;
- else
- reg_val_2 = 0x2082082 << port_rst_off;
-
- if (val == 0) {
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_REQ1_REG,
- reg_val_1);
-
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_REQ0_REG,
- reg_val_2);
- } else {
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_DREQ0_REG,
- reg_val_2);
-
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_DREQ1_REG,
- reg_val_1);
- }
- } else {
- reg_val_1 = 0x15540 << dsaf_dev->reset_offset;
- reg_val_2 = 0x100 << dsaf_dev->reset_offset;
-
- if (val == 0) {
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_REQ1_REG,
- reg_val_1);
-
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_PPE_RESET_REQ_REG,
- reg_val_2);
+ if (IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node) {
+ if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
+ reg_val_1 = 0x1 << port;
+ port_rst_off = dsaf_dev->mac_cb[port]->port_rst_off;
+ /* there is difference between V1 and V2 in register.*/
+ if (AE_IS_VER1(dsaf_dev->dsaf_ver))
+ reg_val_2 = 0x1041041 << port_rst_off;
+ else
+ reg_val_2 = 0x2082082 << port_rst_off;
+
+ if (val == 0) {
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_GE_RESET_REQ1_REG,
+ reg_val_1);
+
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_GE_RESET_REQ0_REG,
+ reg_val_2);
+ } else {
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_GE_RESET_DREQ0_REG,
+ reg_val_2);
+
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_GE_RESET_DREQ1_REG,
+ reg_val_1);
+ }
} else {
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_DREQ1_REG,
- reg_val_1);
-
- dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_PPE_RESET_DREQ_REG,
- reg_val_2);
+ reg_val_1 = 0x15540 << dsaf_dev->reset_offset;
+ reg_val_2 = 0x100 << dsaf_dev->reset_offset;
+
+ if (val == 0) {
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_GE_RESET_REQ1_REG,
+ reg_val_1);
+
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_PPE_RESET_REQ_REG,
+ reg_val_2);
+ } else {
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_GE_RESET_DREQ1_REG,
+ reg_val_1);
+
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_PPE_RESET_DREQ_REG,
+ reg_val_2);
+ }
}
}
}
@@ -221,14 +237,18 @@ void hns_ppe_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
u32 reg_val = 0;
u32 reg_addr;
- reg_val |= RESET_REQ_OR_DREQ << dsaf_dev->mac_cb[port]->port_rst_off;
+ if (IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node) {
+ struct hns_mac_cb *mac_cb = dsaf_dev->mac_cb[port];
- if (val == 0)
- reg_addr = DSAF_SUB_SC_PPE_RESET_REQ_REG;
- else
- reg_addr = DSAF_SUB_SC_PPE_RESET_DREQ_REG;
+ reg_val |= RESET_REQ_OR_DREQ << mac_cb->port_rst_off;
- dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ if (val == 0)
+ reg_addr = DSAF_SUB_SC_PPE_RESET_REQ_REG;
+ else
+ reg_addr = DSAF_SUB_SC_PPE_RESET_DREQ_REG;
+
+ dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
+ }
}
void hns_ppe_com_srst(struct ppe_common_cb *ppe_common, u32 val)
@@ -237,6 +257,9 @@ void hns_ppe_com_srst(struct ppe_common_cb *ppe_common, u32 val)
u32 reg_val;
u32 reg_addr;
+ if (!(IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node))
+ return;
+
if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
reg_val = RESET_REQ_OR_DREQ;
if (val == 0)
@@ -267,29 +290,31 @@ phy_interface_t hns_mac_get_phy_if(struct hns_mac_cb *mac_cb)
u32 reg;
bool is_ver1 = AE_IS_VER1(mac_cb->dsaf_dev->dsaf_ver);
int mac_id = mac_cb->mac_id;
- phy_interface_t phy_if;
+ phy_interface_t phy_if = PHY_INTERFACE_MODE_NA;
- if (is_ver1) {
- if (HNS_DSAF_IS_DEBUG(mac_cb->dsaf_dev))
- return PHY_INTERFACE_MODE_SGMII;
+ if (IS_ENABLED(CONFIG_OF) && mac_cb->dev->of_node) {
+ if (is_ver1) {
+ if (HNS_DSAF_IS_DEBUG(mac_cb->dsaf_dev))
+ return PHY_INTERFACE_MODE_SGMII;
- if (mac_id >= 0 && mac_id <= 3)
- reg = HNS_MAC_HILINK4_REG;
- else
- reg = HNS_MAC_HILINK3_REG;
- } else{
- if (!HNS_DSAF_IS_DEBUG(mac_cb->dsaf_dev) && mac_id <= 3)
- reg = HNS_MAC_HILINK4V2_REG;
+ if (mac_id >= 0 && mac_id <= 3)
+ reg = HNS_MAC_HILINK4_REG;
+ else
+ reg = HNS_MAC_HILINK3_REG;
+ } else {
+ if (!HNS_DSAF_IS_DEBUG(mac_cb->dsaf_dev) && mac_id <= 3)
+ reg = HNS_MAC_HILINK4V2_REG;
+ else
+ reg = HNS_MAC_HILINK3V2_REG;
+ }
+
+ mode = dsaf_read_sub(mac_cb->dsaf_dev, reg);
+ if (dsaf_get_bit(mode, mac_cb->port_mode_off))
+ phy_if = PHY_INTERFACE_MODE_XGMII;
else
- reg = HNS_MAC_HILINK3V2_REG;
+ phy_if = PHY_INTERFACE_MODE_SGMII;
}
- mode = dsaf_read_sub(mac_cb->dsaf_dev, reg);
- if (dsaf_get_bit(mode, mac_cb->port_mode_off))
- phy_if = PHY_INTERFACE_MODE_XGMII;
- else
- phy_if = PHY_INTERFACE_MODE_SGMII;
-
return phy_if;
}
@@ -311,42 +336,50 @@ int hns_mac_get_sfp_prsnt(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
*/
int hns_mac_config_sds_loopback(struct hns_mac_cb *mac_cb, u8 en)
{
+ struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
+
/* port 0-3 hilink4 base is serdes_vaddr + 0x00280000
* port 4-7 hilink3 base is serdes_vaddr + 0x00200000
*/
- u8 *base_addr = (u8 *)mac_cb->serdes_vaddr +
- (mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000);
- const u8 lane_id[] = {
- 0, /* mac 0 -> lane 0 */
- 1, /* mac 1 -> lane 1 */
- 2, /* mac 2 -> lane 2 */
- 3, /* mac 3 -> lane 3 */
- 2, /* mac 4 -> lane 2 */
- 3, /* mac 5 -> lane 3 */
- 0, /* mac 6 -> lane 0 */
- 1 /* mac 7 -> lane 1 */
- };
+
+ if (IS_ENABLED(CONFIG_OF) && dsaf_dev->dev->of_node) {
+ u8 *base_addr = (u8 *)mac_cb->serdes_vaddr +
+ (mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000);
+ const u8 lane_id[] = {
+ 0, /* mac 0 -> lane 0 */
+ 1, /* mac 1 -> lane 1 */
+ 2, /* mac 2 -> lane 2 */
+ 3, /* mac 3 -> lane 3 */
+ 2, /* mac 4 -> lane 2 */
+ 3, /* mac 5 -> lane 3 */
+ 0, /* mac 6 -> lane 0 */
+ 1 /* mac 7 -> lane 1 */
+ };
#define RX_CSR(lane, reg) ((0x4080 + (reg) * 0x0002 + (lane) * 0x0200) * 2)
- u64 reg_offset = RX_CSR(lane_id[mac_cb->mac_id], 0);
+ u64 reg_offset = RX_CSR(lane_id[mac_cb->mac_id], 0);
- int sfp_prsnt;
- int ret = hns_mac_get_sfp_prsnt(mac_cb, &sfp_prsnt);
+ int sfp_prsnt;
+ int ret = hns_mac_get_sfp_prsnt(mac_cb, &sfp_prsnt);
- if (!mac_cb->phy_dev) {
- if (ret)
- pr_info("please confirm sfp is present or not\n");
- else
- if (!sfp_prsnt)
- pr_info("no sfp in this eth\n");
- }
+ if (!mac_cb->phy_dev) {
+ if (ret)
+ pr_info("please confirm sfp is present or not\n");
+ else
+ if (!sfp_prsnt)
+ pr_info("no sfp in this eth\n");
+ }
- if (mac_cb->serdes_ctrl) {
- u32 origin = dsaf_read_syscon(mac_cb->serdes_ctrl, reg_offset);
+ if (mac_cb->serdes_ctrl) {
+ u32 origin = dsaf_read_syscon(mac_cb->serdes_ctrl,
+ reg_offset);
- dsaf_set_field(origin, 1ull << 10, 10, !!en);
- dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset, origin);
- } else {
- dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10, 10, !!en);
+ dsaf_set_field(origin, 1ull << 10, 10, !!en);
+ dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset,
+ origin);
+ } else {
+ dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10,
+ 10, !!en);
+ }
}
return 0;
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2016-05-13 15:20 +0200 |
| Subject | Re: [patch net-next 07/11] net: hns: dsaf adds support of acpi |
| Message-ID | <rylay-3Vi-25@gated-at.bofh.it> |
| In reply to | #1400592 |
On Fri, 2016-05-13 at 16:19 +0800, Yisen Zhuang wrote: > From: Kejian Yan <yankejian@huawei.com> > > Dsaf needs to get configuration parameter by ACPI, so this patch add > support of ACPI. > Looks like at some point better to split driver to core part, and PCI and ACPI/DT/platform code. Too many changes where IS_ENABLED() involved shows as I can imagine bad architecture / split of the driver. -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy
[toc] | [prev] | [next] | [standalone]
| From | "Yankejian (Hackim Yim)" <yankejian@huawei.com> |
|---|---|
| Date | 2016-05-16 04:10 +0200 |
| Subject | Re: [patch net-next 07/11] net: hns: dsaf adds support of acpi |
| Message-ID | <rzg8O-u7-19@gated-at.bofh.it> |
| In reply to | #1400792 |
On 2016/5/13 21:12, Andy Shevchenko wrote: > On Fri, 2016-05-13 at 16:19 +0800, Yisen Zhuang wrote: >> From: Kejian Yan <yankejian@huawei.com> >> >> Dsaf needs to get configuration parameter by ACPI, so this patch add >> support of ACPI. >> > Looks like at some point better to split driver to core part, and PCI > and ACPI/DT/platform code. > > Too many changes where IS_ENABLED() involved shows as I can imagine bad > architecture / split of the driver. Hi Andy, Actully, we use the unified function asap. The routine in DT/ACPI maybe difference. Some routine will be treated in BIOS in ACPI case, but it will be treated in OS in DT case, so we need to distinguish it. And we will try to reduce the use of IS_ENABLED(). Thanks very much for your suggestions, Andy Kejian
[toc] | [prev] | [next] | [standalone]
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 02/11] net: hns: use device_* APIs instead of of_* APIs |
| Message-ID | <rygkz-7Xv-31@gated-at.bofh.it> |
| In reply to | #1400585 |
From: Kejian Yan <yankejian@huawei.com>
OF series functions can be used only for OF case. It needs to be similar
series function for the others cases. There are uniform interface which
has device_ prefix to get properties from the platform firmware. So this
patch will use the device_* series functions instead of of_* functions.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 9 +++++----
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 11 +++--------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index 1c2ddb2..9afc5e6 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -50,7 +50,7 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
else
dsaf_dev->dsaf_ver = AE_VERSION_2;
- ret = of_property_read_string(np, "mode", &mode_str);
+ ret = device_property_read_string(dsaf_dev->dev, "mode", &mode_str);
if (ret) {
dev_err(dsaf_dev->dev, "get dsaf mode fail, ret=%d!\n", ret);
return ret;
@@ -142,7 +142,7 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
}
}
- ret = of_property_read_u32(np, "desc-num", &desc_num);
+ ret = device_property_read_u32(dsaf_dev->dev, "desc-num", &desc_num);
if (ret < 0 || desc_num < HNS_DSAF_MIN_DESC_CNT ||
desc_num > HNS_DSAF_MAX_DESC_CNT) {
dev_err(dsaf_dev->dev, "get desc-num(%d) fail, ret=%d!\n",
@@ -151,14 +151,15 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
}
dsaf_dev->desc_num = desc_num;
- ret = of_property_read_u32(np, "reset-field-offset", &reset_offset);
+ ret = device_property_read_u32(dsaf_dev->dev, "reset-field-offset",
+ &reset_offset);
if (ret < 0) {
dev_dbg(dsaf_dev->dev,
"get reset-field-offset fail, ret=%d!\r\n", ret);
}
dsaf_dev->reset_offset = reset_offset;
- ret = of_property_read_u32(np, "buf-size", &buf_size);
+ ret = device_property_read_u32(dsaf_dev->dev, "buf-size", &buf_size);
if (ret < 0) {
dev_err(dsaf_dev->dev,
"get buf-size fail, ret=%d!\r\n", ret);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index e621636..8851420 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -1067,13 +1067,8 @@ void hns_nic_update_stats(struct net_device *netdev)
static void hns_init_mac_addr(struct net_device *ndev)
{
struct hns_nic_priv *priv = netdev_priv(ndev);
- struct device_node *node = priv->dev->of_node;
- const void *mac_addr_temp;
- mac_addr_temp = of_get_mac_address(node);
- if (mac_addr_temp && is_valid_ether_addr(mac_addr_temp)) {
- memcpy(ndev->dev_addr, mac_addr_temp, ndev->addr_len);
- } else {
+ if (!device_get_mac_address(priv->dev, ndev->dev_addr, ETH_ALEN)) {
eth_hw_addr_random(ndev);
dev_warn(priv->dev, "No valid mac, use random mac %pM",
ndev->dev_addr);
@@ -1898,10 +1893,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
goto out_read_prop_fail;
}
/* try to find port-idx-in-ae first */
- ret = of_property_read_u32(node, "port-idx-in-ae", &port_id);
+ ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id);
if (ret) {
/* only for old code compatible */
- ret = of_property_read_u32(node, "port-id", &port_id);
+ ret = device_property_read_u32(dev, "port-id", &port_id);
if (ret)
goto out_read_prop_fail;
/* for old dts, we need to caculate the port offset */
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Yisen Zhuang <Yisen.Zhuang@huawei.com> |
|---|---|
| Date | 2016-05-13 10:10 +0200 |
| Subject | [patch net-next 05/11] net: hns: add uniform interface for phy connection |
| Message-ID | <rygkz-7Xv-35@gated-at.bofh.it> |
| In reply to | #1400585 |
From: Kejian Yan <yankejian@huawei.com>
As device_node is only used by OF case, HNS needs to treat the others
cases including ACPI. It needs to use uniform ways to handle both of
OF and ACPI. This patch chooses phy_device, and of_phy_connect and
of_phy_attach are only used by OF case. It needs to add uniform interface
to handle that sequence by both OF and ACPI.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns/hnae.h | 2 +-
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 2 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 34 +++++++++++-----
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | 2 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 2 +-
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 46 +++++++++++++++++++---
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 +-
7 files changed, 70 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 3ad3e55..529cb13 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -513,7 +513,7 @@ struct hnae_ae_dev {
struct hnae_handle {
struct device *owner_dev; /* the device which make use of this handle */
struct hnae_ae_dev *dev; /* the device who provides this handle */
- struct device_node *phy_node;
+ struct phy_device *phy_dev;
phy_interface_t phy_if;
u32 if_support;
int q_num;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index 7a757e8..8e009f4 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -131,7 +131,7 @@ struct hnae_handle *hns_ae_get_handle(struct hnae_ae_dev *dev,
vf_cb->mac_cb = dsaf_dev->mac_cb[port_id];
ae_handle->phy_if = vf_cb->mac_cb->phy_if;
- ae_handle->phy_node = vf_cb->mac_cb->phy_node;
+ ae_handle->phy_dev = vf_cb->mac_cb->phy_dev;
ae_handle->if_support = vf_cb->mac_cb->if_support;
ae_handle->port_type = vf_cb->mac_cb->mac_type;
ae_handle->dport_id = port_id;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 611581f..527b49d 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -15,7 +15,8 @@
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_address.h>
-#include <linux/phy_fixed.h>
+#include <linux/of_mdio.h>
+#include <linux/phy.h>
#include <linux/platform_device.h>
#include "hns_dsaf_main.h"
@@ -645,7 +646,7 @@ free_mac_drv:
*/
static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
{
- struct device_node *np = mac_cb->dev->of_node;
+ struct device_node *np;
struct regmap *syscon;
struct of_phandle_args cpld_args;
u32 ret;
@@ -672,21 +673,34 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
* from dsaf node
*/
if (!mac_cb->fw_port) {
- mac_cb->phy_node = of_parse_phandle(np, "phy-handle",
- mac_cb->mac_id);
- if (mac_cb->phy_node)
+ np = of_parse_phandle(mac_cb->dev->of_node, "phy-handle",
+ mac_cb->mac_id);
+ mac_cb->phy_dev = of_phy_find_device(np);
+ if (mac_cb->phy_dev) {
+ /* refcount is held by of_phy_find_device()
+ * if the phy_dev is found
+ */
+ put_device(&mac_cb->phy_dev->mdio.dev);
+
dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
- mac_cb->mac_id, mac_cb->phy_node->name);
+ mac_cb->mac_id, np->name);
+ }
+
return 0;
}
+
if (!is_of_node(mac_cb->fw_port))
return -EINVAL;
+
/* parse property from port subnode in dsaf */
- mac_cb->phy_node = of_parse_phandle(to_of_node(mac_cb->fw_port),
- "phy-handle", 0);
- if (mac_cb->phy_node)
+ np = of_parse_phandle(to_of_node(mac_cb->fw_port), "phy-handle", 0);
+ mac_cb->phy_dev = of_phy_find_device(np);
+ if (mac_cb->phy_dev) {
+ put_device(&mac_cb->phy_dev->mdio.dev);
dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
- mac_cb->mac_id, mac_cb->phy_node->name);
+ mac_cb->mac_id, np->name);
+ }
+
syscon = syscon_node_to_regmap(
of_parse_phandle(to_of_node(mac_cb->fw_port),
"serdes-syscon", 0));
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
index 97ce9a7..89b49d7 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
@@ -338,7 +338,7 @@ struct hns_mac_cb {
phy_interface_t phy_if;
enum hnae_loop loop_mode;
- struct device_node *phy_node;
+ struct phy_device *phy_dev;
struct mac_hw_stats hw_stats;
};
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index a837bb9..a843a86 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -332,7 +332,7 @@ int hns_mac_config_sds_loopback(struct hns_mac_cb *mac_cb, u8 en)
int sfp_prsnt;
int ret = hns_mac_get_sfp_prsnt(mac_cb, &sfp_prsnt);
- if (!mac_cb->phy_node) {
+ if (!mac_cb->phy_dev) {
if (ret)
pr_info("please confirm sfp is present or not\n");
else
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 4fa9c21..34ebe7d 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -987,6 +987,41 @@ static void hns_nic_adjust_link(struct net_device *ndev)
h->dev->ops->adjust_link(h, ndev->phydev->speed, ndev->phydev->duplex);
}
+static
+struct phy_device *hns_nic_phy_attach(struct net_device *dev,
+ struct phy_device *phy,
+ u32 flags,
+ phy_interface_t iface)
+{
+ int ret;
+
+ if (!phy)
+ return NULL;
+
+ ret = phy_attach_direct(dev, phy, flags, iface);
+
+ return ret ? NULL : phy;
+}
+
+static
+struct phy_device *hns_nic_phy_connect(struct net_device *dev,
+ struct phy_device *phy,
+ void (*hndlr)(struct net_device *),
+ u32 flags,
+ phy_interface_t iface)
+{
+ int ret;
+
+ if (!phy)
+ return NULL;
+
+ phy->dev_flags = flags;
+
+ ret = phy_connect_direct(dev, phy, hndlr, iface);
+
+ return ret ? NULL : phy;
+}
+
/**
*hns_nic_init_phy - init phy
*@ndev: net device
@@ -996,16 +1031,17 @@ static void hns_nic_adjust_link(struct net_device *ndev)
int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)
{
struct hns_nic_priv *priv = netdev_priv(ndev);
- struct phy_device *phy_dev = NULL;
+ struct phy_device *phy_dev = h->phy_dev;
- if (!h->phy_node)
+ if (!h->phy_dev)
return 0;
if (h->phy_if != PHY_INTERFACE_MODE_XGMII)
- phy_dev = of_phy_connect(ndev, h->phy_node,
- hns_nic_adjust_link, 0, h->phy_if);
+ phy_dev = hns_nic_phy_connect(ndev, phy_dev,
+ hns_nic_adjust_link,
+ 0, h->phy_if);
else
- phy_dev = of_phy_attach(ndev, h->phy_node, 0, h->phy_if);
+ phy_dev = hns_nic_phy_attach(ndev, phy_dev, 0, h->phy_if);
if (unlikely(!phy_dev) || IS_ERR(phy_dev))
return !phy_dev ? -ENODEV : PTR_ERR(phy_dev);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 3d746c8..03007d2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -597,7 +597,7 @@ static void hns_nic_self_test(struct net_device *ndev,
st_param[1][0] = MAC_INTERNALLOOP_SERDES;
st_param[1][1] = 1; /*serdes must exist*/
st_param[2][0] = MAC_INTERNALLOOP_PHY; /* only supporte phy node*/
- st_param[2][1] = ((!!(priv->ae_handle->phy_node)) &&
+ st_param[2][1] = ((!!(priv->ae_handle->phy_dev)) &&
(priv->ae_handle->phy_if != PHY_INTERFACE_MODE_XGMII));
if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2016-05-13 15:10 +0200 |
| Subject | Re: [patch net-next 05/11] net: hns: add uniform interface for phy connection |
| Message-ID | <ryl0S-3QE-11@gated-at.bofh.it> |
| In reply to | #1400595 |
On Fri, 2016-05-13 at 16:19 +0800, Yisen Zhuang wrote:
> From: Kejian Yan <yankejian@huawei.com>
>
> As device_node is only used by OF case, HNS needs to treat the others
> cases including ACPI. It needs to use uniform ways to handle both of
> OF and ACPI. This patch chooses phy_device, and of_phy_connect and
> of_phy_attach are only used by OF case. It needs to add uniform
> interface
> to handle that sequence by both OF and ACPI.
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
> @@ -987,6 +987,41 @@ static void hns_nic_adjust_link(struct net_device
> *ndev)
> h->dev->ops->adjust_link(h, ndev->phydev->speed, ndev-
> >phydev->duplex);
> }
>
> +static
> +struct phy_device *hns_nic_phy_attach(struct net_device *dev,
> + struct phy_device *phy,
> + u32 flags,
> + phy_interface_t iface)
> +{
> + int ret;
> +
> + if (!phy)
> + return NULL;
No need to use defensive programming here.
> +
> + ret = phy_attach_direct(dev, phy, flags, iface);
> +
> + return ret ? NULL : phy;
Shouldn't it return an error?
> +}
> +
> +static
> +struct phy_device *hns_nic_phy_connect(struct net_device *dev,
> + struct phy_device *phy,
> + void (*hndlr)(struct
> net_device *),
> + u32 flags,
> + phy_interface_t iface)
> +{
> + int ret;
> +
> + if (!phy)
> + return NULL;
> +
> + phy->dev_flags = flags;
> +
> + ret = phy_connect_direct(dev, phy, hndlr, iface);
> +
> + return ret ? NULL : phy;
> +}
> +
For now looks that above functions are redundant and you may call them
directly in below code.
> /**
> *hns_nic_init_phy - init phy
> *@ndev: net device
> @@ -996,16 +1031,17 @@ static void hns_nic_adjust_link(struct
> net_device *ndev)
> int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)
> {
> struct hns_nic_priv *priv = netdev_priv(ndev);
> - struct phy_device *phy_dev = NULL;
> + struct phy_device *phy_dev = h->phy_dev;
>
> - if (!h->phy_node)
> + if (!h->phy_dev)
> return 0;
>
> if (h->phy_if != PHY_INTERFACE_MODE_XGMII)
> - phy_dev = of_phy_connect(ndev, h->phy_node,
> - hns_nic_adjust_link, 0, h-
> >phy_if);
> + phy_dev = hns_nic_phy_connect(ndev, phy_dev,
> + hns_nic_adjust_link,
> + 0, h->phy_if);
> else
> - phy_dev = of_phy_attach(ndev, h->phy_node, 0, h-
> >phy_if);
> + phy_dev = hns_nic_phy_attach(ndev, phy_dev, 0, h-
> >phy_if);
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
[toc] | [prev] | [next] | [standalone]
| From | "Yankejian (Hackim Yim)" <yankejian@huawei.com> |
|---|---|
| Date | 2016-05-16 04:10 +0200 |
| Subject | Re: [patch net-next 05/11] net: hns: add uniform interface for phy connection |
| Message-ID | <rzg8O-u7-5@gated-at.bofh.it> |
| In reply to | #1400782 |
On 2016/5/13 21:07, Andy Shevchenko wrote:
> On Fri, 2016-05-13 at 16:19 +0800, Yisen Zhuang wrote:
>> From: Kejian Yan <yankejian@huawei.com>
>>
>> As device_node is only used by OF case, HNS needs to treat the others
>> cases including ACPI. It needs to use uniform ways to handle both of
>> OF and ACPI. This patch chooses phy_device, and of_phy_connect and
>> of_phy_attach are only used by OF case. It needs to add uniform
>> interface
>> to handle that sequence by both OF and ACPI.
> --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
>> @@ -987,6 +987,41 @@ static void hns_nic_adjust_link(struct net_device
>> *ndev)
>> h->dev->ops->adjust_link(h, ndev->phydev->speed, ndev-
>>> phydev->duplex);
>> }
>>
>> +static
>> +struct phy_device *hns_nic_phy_attach(struct net_device *dev,
>> + struct phy_device *phy,
>> + u32 flags,
>> + phy_interface_t iface)
>> +{
>> + int ret;
>> +
>> + if (!phy)
>> + return NULL;
> No need to use defensive programming here.
>
>> +
>> + ret = phy_attach_direct(dev, phy, flags, iface);
>> +
>> + return ret ? NULL : phy;
> Shouldn't it return an error?
>
>
>> +}
>> +
>> +static
>> +struct phy_device *hns_nic_phy_connect(struct net_device *dev,
>> + struct phy_device *phy,
>> + void (*hndlr)(struct
>> net_device *),
>> + u32 flags,
>> + phy_interface_t iface)
>> +{
>> + int ret;
>> +
>> + if (!phy)
>> + return NULL;
>> +
>> + phy->dev_flags = flags;
>> +
>> + ret = phy_connect_direct(dev, phy, hndlr, iface);
>> +
>> + return ret ? NULL : phy;
>> +}
>> +
> For now looks that above functions are redundant and you may call them
> directly in below code.
Hi Andy,
Thanks for you suggestions, it will be fixed in next submit
MBR,
Kejian
>> /**
>> *hns_nic_init_phy - init phy
>> *@ndev: net device
>> @@ -996,16 +1031,17 @@ static void hns_nic_adjust_link(struct
>> net_device *ndev)
>> int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h)
>> {
>> struct hns_nic_priv *priv = netdev_priv(ndev);
>> - struct phy_device *phy_dev = NULL;
>> + struct phy_device *phy_dev = h->phy_dev;
>>
>> - if (!h->phy_node)
>> + if (!h->phy_dev)
>> return 0;
>>
>> if (h->phy_if != PHY_INTERFACE_MODE_XGMII)
>> - phy_dev = of_phy_connect(ndev, h->phy_node,
>> - hns_nic_adjust_link, 0, h-
>>> phy_if);
>> + phy_dev = hns_nic_phy_connect(ndev, phy_dev,
>> + hns_nic_adjust_link,
>> + 0, h->phy_if);
>> else
>> - phy_dev = of_phy_attach(ndev, h->phy_node, 0, h-
>>> phy_if);
>> + phy_dev = hns_nic_phy_attach(ndev, phy_dev, 0, h-
>>> phy_if);
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web