Skip to content

Commit 482f13a

Browse files
committed
Merge branch 'hns-props'
Yisen Zhuang says: ==================== net: hns: update DT properties according to Rob's comments There are some inappropriate properties definition in hns DT. We update the definition according to Rob's review comments and fix some typos in binding. For more details, please see individual patches. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 494e848 + ea99102 commit 482f13a

File tree

3 files changed

+36
-34
lines changed

3 files changed

+36
-34
lines changed

Documentation/devicetree/bindings/net/hisilicon-hns-dsaf.txt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ Required properties:
1313
- interrupts: should contain the DSA Fabric and rcb interrupt.
1414
- reg: specifies base physical address(es) and size of the device registers.
1515
The first region is external interface control register base and size(optional,
16-
only be used when subctrl-syscon is not exists). It is recommended using
16+
only used when subctrl-syscon does not exist). It is recommended using
1717
subctrl-syscon rather than this address.
18-
The second region is SerDes base register and size(optional, only be used when
19-
serdes-syscon in port node is not exists. It is recommended using
18+
The second region is SerDes base register and size(optional, only used when
19+
serdes-syscon in port node does not exist). It is recommended using
2020
serdes-syscon rather than this address.
2121
The third region is the PPE register base and size.
2222
The fourth region is dsa fabric base register and size. It is not required for
2323
single-port mode.
2424
- reg-names: may be ppe-base and(or) dsaf-base. It is used to find the
2525
corresponding reg's index.
2626

27-
- phy-handle: phy handle of physicl port, 0 if not any phy device. It is optional
28-
attribute. If port node is exists, phy-handle in each port node will be used.
27+
- phy-handle: phy handle of physical port, 0 if not any phy device. It is optional
28+
attribute. If port node exists, phy-handle in each port node will be used.
2929
see ethernet.txt [1].
3030
- subctrl-syscon: is syscon handle for external interface control register.
3131
- reset-field-offset: is offset of reset field. Its value depends on the hardware
@@ -35,14 +35,12 @@ Required properties:
3535

3636
- port: subnodes of dsaf. A dsaf node may contain several port nodes(Depending
3737
on mode of dsaf). Port node contain some attributes listed below:
38-
- port-id: is physical port index in one dsaf.
39-
- phy-handle: phy handle of physicl port. It is not required if there isn't
38+
- reg: is physical port index in one dsaf.
39+
- phy-handle: phy handle of physical port. It is not required if there isn't
4040
phy device. see ethernet.txt [1].
4141
- serdes-syscon: is syscon handle for SerDes register.
42-
- cpld-syscon: is syscon handle for cpld register. It is not required if there
43-
isn't cpld device.
44-
- cpld-ctrl-reg: is cpld register offset. It is not required if there isn't
45-
cpld-syscon.
42+
- cpld-syscon: is syscon handle + register offset pair for cpld register. It is
43+
not required if there isn't cpld device.
4644
- port-rst-offset: is offset of reset field for each port in dsaf. Its value
4745
depends on the hardware user manual.
4846
- port-mode-offset: is offset of port mode field for each port in dsaf. Its
@@ -72,14 +70,14 @@ dsaf0: dsa@c7000000 {
7270
desc-num = <1024>;
7371
dma-coherent;
7472

75-
prot@0 {
76-
port-id = 0;
73+
port@0 {
74+
reg = 0;
7775
phy-handle = <&phy0>;
7876
serdes-syscon = <&serdes>;
7977
};
8078

81-
prot@1 {
82-
port-id = 1;
79+
port@1 {
80+
reg = 1;
8381
serdes-syscon = <&serdes>;
8482
};
8583
};

arch/arm64/boot/dts/hisilicon/hip05_hns.dtsi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ soc0: soc@000000000 {
2424
};
2525

2626
dsaf0: dsa@c7000000 {
27+
#address-cells = <1>;
28+
#size-cells = <0>;
2729
compatible = "hisilicon,hns-dsaf-v1";
2830
mode = "6port-16rss";
2931
interrupt-parent = <&mbigen_dsa>;
@@ -124,20 +126,20 @@ soc0: soc@000000000 {
124126
dma-coherent;
125127

126128
port@0 {
127-
port-id = <0>;
129+
reg = <0>;
128130
serdes-syscon = <&serdes_ctrl0>;
129131
};
130132
port@1 {
131-
port-id = <1>;
133+
reg = <1>;
132134
serdes-syscon = <&serdes_ctrl0>;
133135
};
134136
port@4 {
135-
port-id = <4>;
137+
reg = <4>;
136138
phy-handle = <&soc0_phy0>;
137139
serdes-syscon = <&serdes_ctrl1>;
138140
};
139141
port@5 {
140-
port-id = <5>;
142+
reg = <5>;
141143
phy-handle = <&soc0_phy1>;
142144
serdes-syscon = <&serdes_ctrl1>;
143145
};

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

Lines changed: 17 additions & 15 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

@@ -832,15 +834,15 @@ int hns_mac_init(struct dsaf_device *dsaf_dev)
832834
struct fwnode_handle *child;
833835

834836
device_for_each_child_node(dsaf_dev->dev, child) {
835-
ret = fwnode_property_read_u32(child, "port-id", &port_id);
837+
ret = fwnode_property_read_u32(child, "reg", &port_id);
836838
if (ret) {
837839
dev_err(dsaf_dev->dev,
838-
"get port-id fail, ret=%d!\n", ret);
840+
"get reg fail, ret=%d!\n", ret);
839841
return ret;
840842
}
841843
if (port_id >= max_port_num) {
842844
dev_err(dsaf_dev->dev,
843-
"port-id(%u) out of range!\n", port_id);
845+
"reg(%u) out of range!\n", port_id);
844846
return -EINVAL;
845847
}
846848
mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb),

0 commit comments

Comments
 (0)