Skip to content

Commit 1ffdfac

Browse files
Yisen.Zhuang\(Zhuangyuzeng\)davem330
authored andcommitted
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: Yisen Zhuang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 494e848 commit 1ffdfac

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
647647
{
648648
struct device_node *np = mac_cb->dev->of_node;
649649
struct regmap *syscon;
650+
struct of_phandle_args cpld_args;
650651
u32 ret;
651652

652653
mac_cb->link = false;
@@ -713,22 +714,23 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
713714
mac_cb->mac_id);
714715
}
715716

716-
syscon = syscon_node_to_regmap(
717-
of_parse_phandle(to_of_node(mac_cb->fw_port),
718-
"cpld-syscon", 0));
719-
if (IS_ERR_OR_NULL(syscon)) {
720-
dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
717+
ret = of_parse_phandle_with_fixed_args(to_of_node(mac_cb->fw_port),
718+
"cpld-syscon", 1, 0, &cpld_args);
719+
if (ret) {
720+
dev_dbg(mac_cb->dev, "mac%d no cpld-syscon found.\n",
721+
mac_cb->mac_id);
721722
mac_cb->cpld_ctrl = NULL;
722723
} else {
723-
mac_cb->cpld_ctrl = syscon;
724-
ret = fwnode_property_read_u32(mac_cb->fw_port,
725-
"cpld-ctrl-reg",
726-
&mac_cb->cpld_ctrl_reg);
727-
if (ret) {
728-
dev_err(mac_cb->dev, "get cpld-ctrl-reg fail!\n");
729-
return ret;
724+
syscon = syscon_node_to_regmap(cpld_args.np);
725+
if (IS_ERR_OR_NULL(syscon)) {
726+
dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
727+
mac_cb->cpld_ctrl = NULL;
728+
} else {
729+
mac_cb->cpld_ctrl = syscon;
730+
mac_cb->cpld_ctrl_reg = cpld_args.args[0];
730731
}
731732
}
733+
732734
return 0;
733735
}
734736

0 commit comments

Comments
 (0)