Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1408717 > unrolled thread
| Started by | Kejian Yan <yankejian@huawei.com> |
|---|---|
| First post | 2016-05-30 04:10 +0200 |
| Last post | 2016-05-30 10:30 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[patch v2 net-next 00/13] net: hns: add support of ACPI Kejian Yan <yankejian@huawei.com> - 2016-05-30 04:10 +0200
[patch v2 net-next 02/13] ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h Kejian Yan <yankejian@huawei.com> - 2016-05-30 04:10 +0200
[patch v2 net-next 04/13] net: hisilicon: add support of acpi for hns-mdio Kejian Yan <yankejian@huawei.com> - 2016-05-30 04:10 +0200
[patch v2 net-next 10/13] net: hns: dsaf adds support of acpi Kejian Yan <yankejian@huawei.com> - 2016-05-30 04:10 +0200
Re: [patch v2 net-next 00/13] net: hns: add support of ACPI Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-05-30 10:30 +0200
| From | Kejian Yan <yankejian@huawei.com> |
|---|---|
| Date | 2016-05-30 04:10 +0200 |
| Subject | [patch v2 net-next 00/13] net: hns: add support of ACPI |
| Message-ID | <rEkEN-5XN-3@gated-at.bofh.it> |
This series adds HNS support of acpi. The routine will call some ACPI
helper functions, like acpi_dev_found() 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. And we use device property functions instead
of serial helper functions to suport both DT and ACPI cases. And then
add the supports of ACPI for HNS.
change log:
v1 -> v2:
1. use acpi_dev_found() instead of acpi_match_device_ids() to check if
it is a acpi node.
2. use is_of_node() instead of IS_ENABLED() to check if it is a DT node.
3. split the patch("add support of acpi for hns-mdio") into two patches:
3.1 Move to use fwnode_handle
3.2 Add ACPI
4. add the patch which subject is dsaf misc operation method
5. fix the comments by Andy Shevchenko
Kejian Yan (13):
ACPI: bus: add stub acpi_dev_found() to linux/acpi.h
ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h
net: hisilicon: cleanup to prepare for other cases
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: add dsaf misc operation method
net: hns: dsaf adds support of acpi
net: hns: register phy device in each mac initial sequence
net: hns: implement the miscellaneous operation by asl
net: hns: 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 | 6 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 6 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 247 +++++++++++++++-----
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | 4 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 105 ++++++---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | 33 ++-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 250 ++++++++++++++++++---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.h | 7 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | 15 +-
drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | 5 +-
.../net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | 10 +-
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 90 +++++---
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 | 147 +++++++-----
include/linux/acpi.h | 13 ++
18 files changed, 710 insertions(+), 255 deletions(-)
--
1.9.1
[toc] | [next] | [standalone]
| From | Kejian Yan <yankejian@huawei.com> |
|---|---|
| Date | 2016-05-30 04:10 +0200 |
| Subject | [patch v2 net-next 02/13] ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h |
| Message-ID | <rEkOu-6ij-13@gated-at.bofh.it> |
| In reply to | #1408717 |
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 3025d19..4d4bb49 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -659,6 +659,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 | Kejian Yan <yankejian@huawei.com> |
|---|---|
| Date | 2016-05-30 04:10 +0200 |
| Subject | [patch v2 net-next 04/13] net: hisilicon: add support of acpi for hns-mdio |
| Message-ID | <rEkOu-6ij-15@gated-at.bofh.it> |
| In reply to | #1408717 |
hns-mdio needs to register itself to mii-bus. The info of the device can
be read by both DT and ACPI.
HNS tries to call Linux PHY driver to help access PHY-devices, the HNS
hardware topology is as below. The MDIO controller may control several
PHY-devices, and each PHY-device connects to a MAC device. The MDIO will
be registered to mdiobus, then PHY-devices will register when each mac
find PHY device.
cpu
|
|
-------------------------------------------
| | |
| | |
| dsaf |
MDIO | MDIO
| --------------------------- |
| | | | | |
| | | | | |
| MAC MAC MAC MAC |
| | | | | |
---- |-------- |-------- | | --------
|| || || ||
PHY PHY PHY PHY
And the driver can handle reset sequence by _RST method in DSDT in ACPI
case.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
change log:
v2:
1. use dev_of_node instead of IS_ENABLED macro
2. Add ACPI bits
v1: first submit
Link: https://lkml.org/lkml/2016/5/13/93
---
drivers/net/ethernet/hisilicon/hns_mdio.c | 107 +++++++++++++++++++-----------
1 file changed, 69 insertions(+), 38 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
index 381cf0a..f78286c 100644
--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
@@ -7,6 +7,7 @@
* (at your option) any later version.
*/
+#include <linux/acpi.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
#include <linux/init.h>
@@ -354,48 +355,60 @@ static int hns_mdio_reset(struct mii_bus *bus)
struct hns_mdio_device *mdio_dev = (struct hns_mdio_device *)bus->priv;
int ret;
- if (!dev_of_node(bus->parent))
- return -ENOTSUPP;
+ if (dev_of_node(bus->parent)) {
+ if (!mdio_dev->subctrl_vbase) {
+ dev_err(&bus->dev, "mdio sys ctl reg has not maped\n");
+ return -ENODEV;
+ }
- if (!mdio_dev->subctrl_vbase) {
- dev_err(&bus->dev, "mdio sys ctl reg has not maped\n");
- return -ENODEV;
- }
+ /* 1. reset req, and read reset st check */
+ ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_RESET_REQ, 0x1,
+ MDIO_SC_RESET_ST, 0x1,
+ MDIO_CHECK_SET_ST);
+ if (ret) {
+ dev_err(&bus->dev, "MDIO reset fail\n");
+ return ret;
+ }
- /*1. reset req, and read reset st check*/
- ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_RESET_REQ, 0x1,
- MDIO_SC_RESET_ST, 0x1,
- MDIO_CHECK_SET_ST);
- if (ret) {
- dev_err(&bus->dev, "MDIO reset fail\n");
- return ret;
- }
+ /* 2. dis clk, and read clk st check */
+ ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_CLK_DIS,
+ 0x1, MDIO_SC_CLK_ST, 0x1,
+ MDIO_CHECK_CLR_ST);
+ if (ret) {
+ dev_err(&bus->dev, "MDIO dis clk fail\n");
+ return ret;
+ }
- /*2. dis clk, and read clk st check*/
- ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_CLK_DIS,
- 0x1, MDIO_SC_CLK_ST, 0x1,
- MDIO_CHECK_CLR_ST);
- if (ret) {
- dev_err(&bus->dev, "MDIO dis clk fail\n");
- return ret;
- }
+ /* 3. reset dreq, and read reset st check */
+ ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_RESET_DREQ, 0x1,
+ MDIO_SC_RESET_ST, 0x1,
+ MDIO_CHECK_CLR_ST);
+ if (ret) {
+ dev_err(&bus->dev, "MDIO dis clk fail\n");
+ return ret;
+ }
- /*3. reset dreq, and read reset st check*/
- ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_RESET_DREQ, 0x1,
- MDIO_SC_RESET_ST, 0x1,
- MDIO_CHECK_CLR_ST);
- if (ret) {
- dev_err(&bus->dev, "MDIO dis clk fail\n");
- return ret;
+ /* 4. en clk, and read clk st check */
+ ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_CLK_EN,
+ 0x1, MDIO_SC_CLK_ST, 0x1,
+ MDIO_CHECK_SET_ST);
+ if (ret)
+ dev_err(&bus->dev, "MDIO en clk fail\n");
+ } else if (is_acpi_node(bus->parent->fwnode)) {
+ acpi_status s;
+
+ s = acpi_evaluate_object(ACPI_HANDLE(bus->parent),
+ "_RST", NULL, NULL);
+ if (ACPI_FAILURE(s)) {
+ dev_err(&bus->dev, "Reset failed, return:%#x\n", s);
+ ret = -EBUSY;
+ } else {
+ ret = 0;
+ }
+ } else {
+ dev_err(&bus->dev, "Can not get cfg data from DT or ACPI\n");
+ ret = -ENXIO;
}
-
- /*4. en clk, and read clk st check*/
- ret = mdio_sc_cfg_reg_write(mdio_dev, MDIO_SC_CLK_EN,
- 0x1, MDIO_SC_CLK_ST, 0x1,
- MDIO_CHECK_SET_ST);
- if (ret)
- dev_err(&bus->dev, "MDIO en clk fail\n");
-
return ret;
}
@@ -453,7 +466,6 @@ static int hns_mdio_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, new_bus);
-
hns_mdio_bus_name(new_bus->id, res->start);
if (dev_of_node(&pdev->dev)) {
mdio_dev->subctrl_vbase = syscon_node_to_regmap(
@@ -464,6 +476,18 @@ static int hns_mdio_probe(struct platform_device *pdev)
mdio_dev->subctrl_vbase = NULL;
}
ret = of_mdiobus_register(new_bus, pdev->dev.of_node);
+ } else if (is_acpi_node(pdev->dev.fwnode)) {
+ /* Clear all the IRQ properties */
+ memset(new_bus->irq, PHY_POLL, 4 * PHY_MAX_ADDR);
+
+ /* Mask out all PHYs from auto probing. */
+ new_bus->phy_mask = ~0;
+
+ /* Register the MDIO bus */
+ ret = mdiobus_register(new_bus);
+ } else {
+ dev_err(&pdev->dev, "Can not get cfg data from DT or ACPI\n");
+ ret = -ENXIO;
}
if (ret) {
@@ -499,12 +523,19 @@ static const struct of_device_id hns_mdio_match[] = {
{}
};
+static const struct acpi_device_id hns_mdio_acpi_match[] = {
+ { "HISI0141", 0 },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, hns_mdio_acpi_match);
+
static struct platform_driver hns_mdio_driver = {
.probe = hns_mdio_probe,
.remove = hns_mdio_remove,
.driver = {
.name = MDIO_DRV_NAME,
.of_match_table = hns_mdio_match,
+ .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match),
},
};
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Kejian Yan <yankejian@huawei.com> |
|---|---|
| Date | 2016-05-30 04:10 +0200 |
| Subject | [patch v2 net-next 10/13] net: hns: dsaf adds support of acpi |
| Message-ID | <rEkOu-6ij-17@gated-at.bofh.it> |
| In reply to | #1408717 |
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>
---
change log:
v2:
1. use dev_of_node() instead of IS_ENABLED() to check if it is in
DT case,
2. split a new patch to implement misc operation method,
3. use acpi_dev_found() instead of acpi_match_device_ids() to
check which hw version it is,
4. use is_acpi_node instead of ACPI_COMPANION to check if it is
work in ACPI case.
v1: first submit
link: https://lkml.org/lkml/2016/5/13/108
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 80 ++++++++++----------
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 85 +++++++++++++++-------
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 32 ++++----
3 files changed, 114 insertions(+), 83 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 2ebf14a..3ef0c9b 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 28bde08..ac03c4a 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>
@@ -33,6 +34,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;
@@ -46,10 +54,22 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
struct device_node *np = dsaf_dev->dev->of_node;
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 (dev_of_node(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;
+ } else if (is_acpi_node(dsaf_dev->dev->fwnode)) {
+ if (acpi_dev_found(hns_dsaf_acpi_match[0].id))
+ dsaf_dev->dsaf_ver = AE_VERSION_1;
+ else if (acpi_dev_found(hns_dsaf_acpi_match[1].id))
+ dsaf_dev->dsaf_ver = AE_VERSION_2;
+ else
+ return -ENXIO;
+ } else {
+ dev_err(dsaf_dev->dev, "cannot get cfg data from of or acpi\n");
+ return -ENXIO;
+ }
ret = device_property_read_string(dsaf_dev->dev, "mode", &mode_str);
if (ret) {
@@ -81,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 (dev_of_node(dsaf_dev->dev)) {
+ 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");
@@ -2686,6 +2714,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 e1c3e0d..f21177b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -362,21 +362,23 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev)
if (!misc_op)
return NULL;
- misc_op->cpld_set_led = hns_cpld_set_led;
- misc_op->cpld_reset_led = cpld_led_reset;
- misc_op->cpld_set_led_id = cpld_set_led_id;
-
- misc_op->dsaf_reset = hns_dsaf_rst;
- misc_op->xge_srst = hns_dsaf_xge_srst_by_port;
- misc_op->xge_core_srst = hns_dsaf_xge_core_srst_by_port;
- misc_op->ge_srst = hns_dsaf_ge_srst_by_port;
- misc_op->ppe_srst = hns_ppe_srst_by_port;
- misc_op->ppe_comm_srst = hns_ppe_com_srst;
-
- misc_op->get_phy_if = hns_mac_get_phy_if;
- misc_op->get_sfp_prsnt = hns_mac_get_sfp_prsnt;
-
- misc_op->cfg_serdes_loopback = hns_mac_config_sds_loopback;
+ if (dev_of_node(dsaf_dev->dev)) {
+ misc_op->cpld_set_led = hns_cpld_set_led;
+ misc_op->cpld_reset_led = cpld_led_reset;
+ misc_op->cpld_set_led_id = cpld_set_led_id;
+
+ misc_op->dsaf_reset = hns_dsaf_rst;
+ misc_op->xge_srst = hns_dsaf_xge_srst_by_port;
+ misc_op->xge_core_srst = hns_dsaf_xge_core_srst_by_port;
+ misc_op->ge_srst = hns_dsaf_ge_srst_by_port;
+ misc_op->ppe_srst = hns_ppe_srst_by_port;
+ misc_op->ppe_comm_srst = hns_ppe_com_srst;
+
+ misc_op->get_phy_if = hns_mac_get_phy_if;
+ misc_op->get_sfp_prsnt = hns_mac_get_sfp_prsnt;
+
+ misc_op->cfg_serdes_loopback = hns_mac_config_sds_loopback;
+ }
return (void *)misc_op;
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
|---|---|
| Date | 2016-05-30 10:30 +0200 |
| Message-ID | <rEqKd-1Gi-9@gated-at.bofh.it> |
| In reply to | #1408717 |
On Mon, 2016-05-30 at 10:10 +0800, Kejian Yan wrote:
> This series adds HNS support of acpi. The routine will call some ACPI
> helper functions, like acpi_dev_found() 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. And we use device property functions
> instead
> of serial helper functions to suport both DT and ACPI cases. And then
> add the supports of ACPI for HNS.
Looks better. I have only kinda bikeshedding comments in mind, which I
didn't put here, though there is one you perhaps need to address.
Otherwise FWIW:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> change log:
> v1 -> v2:
> 1. use acpi_dev_found() instead of acpi_match_device_ids() to check
> if
> it is a acpi node.
> 2. use is_of_node() instead of IS_ENABLED() to check if it is a DT
> node.
> 3. split the patch("add support of acpi for hns-mdio") into two
> patches:
> 3.1 Move to use fwnode_handle
> 3.2 Add ACPI
> 4. add the patch which subject is dsaf misc operation method
> 5. fix the comments by Andy Shevchenko
>
> Kejian Yan (13):
> ACPI: bus: add stub acpi_dev_found() to linux/acpi.h
> ACPI: bus: add stub acpi_evaluate_dsm() to linux/acpi.h
> net: hisilicon: cleanup to prepare for other cases
> 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: add dsaf misc operation method
> net: hns: dsaf adds support of acpi
> net: hns: register phy device in each mac initial sequence
> net: hns: implement the miscellaneous operation by asl
> net: hns: 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 | 6 +-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c | 6 +-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 247
> +++++++++++++++-----
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | 4 +-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 105 ++++++---
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | 33 ++-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 250
> ++++++++++++++++++---
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.h | 7 +-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | 15 +-
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | 5 +-
> .../net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | 10 +-
> drivers/net/ethernet/hisilicon/hns/hns_enet.c | 90 +++++---
> 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 | 147 +++++++-----
> include/linux/acpi.h | 13 ++
> 18 files changed, 710 insertions(+), 255 deletions(-)
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web