Commit 1ffdfac9 authored by Yisen.Zhuang\(Zhuangyuzeng\)'s avatar Yisen.Zhuang\(Zhuangyuzeng\) Committed by David S. Miller

net: hns: remove cpld-ctrl-reg and add cell in the cpld-syscon property

Because cpld-ctrl-reg property is offset base on cpld-syscon property,
we make it as a cell in the cpld-syscon property.
Signed-off-by: default avatarYisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 494e8489
...@@ -647,6 +647,7 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb) ...@@ -647,6 +647,7 @@ 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 = mac_cb->dev->of_node;
struct regmap *syscon; struct regmap *syscon;
struct of_phandle_args cpld_args;
u32 ret; u32 ret;
mac_cb->link = false; mac_cb->link = false;
...@@ -713,22 +714,23 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb) ...@@ -713,22 +714,23 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->mac_id); mac_cb->mac_id);
} }
syscon = syscon_node_to_regmap( ret = of_parse_phandle_with_fixed_args(to_of_node(mac_cb->fw_port),
of_parse_phandle(to_of_node(mac_cb->fw_port), "cpld-syscon", 1, 0, &cpld_args);
"cpld-syscon", 0)); 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)) { if (IS_ERR_OR_NULL(syscon)) {
dev_dbg(mac_cb->dev, "no cpld-syscon found!\n"); dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
mac_cb->cpld_ctrl = NULL; mac_cb->cpld_ctrl = NULL;
} else { } else {
mac_cb->cpld_ctrl = syscon; mac_cb->cpld_ctrl = syscon;
ret = fwnode_property_read_u32(mac_cb->fw_port, mac_cb->cpld_ctrl_reg = cpld_args.args[0];
"cpld-ctrl-reg",
&mac_cb->cpld_ctrl_reg);
if (ret) {
dev_err(mac_cb->dev, "get cpld-ctrl-reg fail!\n");
return ret;
} }
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment