Commit 482f13aa authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 494e8489 ea991027
...@@ -13,10 +13,10 @@ Required properties: ...@@ -13,10 +13,10 @@ Required properties:
- interrupts: should contain the DSA Fabric and rcb interrupt. - interrupts: should contain the DSA Fabric and rcb interrupt.
- reg: specifies base physical address(es) and size of the device registers. - reg: specifies base physical address(es) and size of the device registers.
The first region is external interface control register base and size(optional, The first region is external interface control register base and size(optional,
only be used when subctrl-syscon is not exists). It is recommended using only used when subctrl-syscon does not exist). It is recommended using
subctrl-syscon rather than this address. subctrl-syscon rather than this address.
The second region is SerDes base register and size(optional, only be used when The second region is SerDes base register and size(optional, only used when
serdes-syscon in port node is not exists. It is recommended using serdes-syscon in port node does not exist). It is recommended using
serdes-syscon rather than this address. serdes-syscon rather than this address.
The third region is the PPE register base and size. The third region is the PPE register base and size.
The fourth region is dsa fabric base register and size. It is not required for The fourth region is dsa fabric base register and size. It is not required for
...@@ -24,8 +24,8 @@ Required properties: ...@@ -24,8 +24,8 @@ Required properties:
- reg-names: may be ppe-base and(or) dsaf-base. It is used to find the - reg-names: may be ppe-base and(or) dsaf-base. It is used to find the
corresponding reg's index. corresponding reg's index.
- phy-handle: phy handle of physicl port, 0 if not any phy device. It is optional - phy-handle: phy handle of physical port, 0 if not any phy device. It is optional
attribute. If port node is exists, phy-handle in each port node will be used. attribute. If port node exists, phy-handle in each port node will be used.
see ethernet.txt [1]. see ethernet.txt [1].
- subctrl-syscon: is syscon handle for external interface control register. - subctrl-syscon: is syscon handle for external interface control register.
- reset-field-offset: is offset of reset field. Its value depends on the hardware - reset-field-offset: is offset of reset field. Its value depends on the hardware
...@@ -35,14 +35,12 @@ Required properties: ...@@ -35,14 +35,12 @@ Required properties:
- port: subnodes of dsaf. A dsaf node may contain several port nodes(Depending - port: subnodes of dsaf. A dsaf node may contain several port nodes(Depending
on mode of dsaf). Port node contain some attributes listed below: on mode of dsaf). Port node contain some attributes listed below:
- port-id: is physical port index in one dsaf. - reg: is physical port index in one dsaf.
- phy-handle: phy handle of physicl port. It is not required if there isn't - phy-handle: phy handle of physical port. It is not required if there isn't
phy device. see ethernet.txt [1]. phy device. see ethernet.txt [1].
- serdes-syscon: is syscon handle for SerDes register. - serdes-syscon: is syscon handle for SerDes register.
- cpld-syscon: is syscon handle for cpld register. It is not required if there - cpld-syscon: is syscon handle + register offset pair for cpld register. It is
isn't cpld device. not required if there isn't cpld device.
- cpld-ctrl-reg: is cpld register offset. It is not required if there isn't
cpld-syscon.
- port-rst-offset: is offset of reset field for each port in dsaf. Its value - port-rst-offset: is offset of reset field for each port in dsaf. Its value
depends on the hardware user manual. depends on the hardware user manual.
- port-mode-offset: is offset of port mode field for each port in dsaf. Its - port-mode-offset: is offset of port mode field for each port in dsaf. Its
...@@ -72,14 +70,14 @@ dsaf0: dsa@c7000000 { ...@@ -72,14 +70,14 @@ dsaf0: dsa@c7000000 {
desc-num = <1024>; desc-num = <1024>;
dma-coherent; dma-coherent;
prot@0 { port@0 {
port-id = 0; reg = 0;
phy-handle = <&phy0>; phy-handle = <&phy0>;
serdes-syscon = <&serdes>; serdes-syscon = <&serdes>;
}; };
prot@1 { port@1 {
port-id = 1; reg = 1;
serdes-syscon = <&serdes>; serdes-syscon = <&serdes>;
}; };
}; };
...@@ -24,6 +24,8 @@ soc0_phy1: ethernet-phy@1 { ...@@ -24,6 +24,8 @@ soc0_phy1: ethernet-phy@1 {
}; };
dsaf0: dsa@c7000000 { dsaf0: dsa@c7000000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "hisilicon,hns-dsaf-v1"; compatible = "hisilicon,hns-dsaf-v1";
mode = "6port-16rss"; mode = "6port-16rss";
interrupt-parent = <&mbigen_dsa>; interrupt-parent = <&mbigen_dsa>;
...@@ -124,20 +126,20 @@ dsaf0: dsa@c7000000 { ...@@ -124,20 +126,20 @@ dsaf0: dsa@c7000000 {
dma-coherent; dma-coherent;
port@0 { port@0 {
port-id = <0>; reg = <0>;
serdes-syscon = <&serdes_ctrl0>; serdes-syscon = <&serdes_ctrl0>;
}; };
port@1 { port@1 {
port-id = <1>; reg = <1>;
serdes-syscon = <&serdes_ctrl0>; serdes-syscon = <&serdes_ctrl0>;
}; };
port@4 { port@4 {
port-id = <4>; reg = <4>;
phy-handle = <&soc0_phy0>; phy-handle = <&soc0_phy0>;
serdes-syscon = <&serdes_ctrl1>; serdes-syscon = <&serdes_ctrl1>;
}; };
port@5 { port@5 {
port-id = <5>; reg = <5>;
phy-handle = <&soc0_phy1>; phy-handle = <&soc0_phy1>;
serdes-syscon = <&serdes_ctrl1>; serdes-syscon = <&serdes_ctrl1>;
}; };
......
...@@ -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;
} }
...@@ -832,15 +834,15 @@ int hns_mac_init(struct dsaf_device *dsaf_dev) ...@@ -832,15 +834,15 @@ int hns_mac_init(struct dsaf_device *dsaf_dev)
struct fwnode_handle *child; struct fwnode_handle *child;
device_for_each_child_node(dsaf_dev->dev, child) { device_for_each_child_node(dsaf_dev->dev, child) {
ret = fwnode_property_read_u32(child, "port-id", &port_id); ret = fwnode_property_read_u32(child, "reg", &port_id);
if (ret) { if (ret) {
dev_err(dsaf_dev->dev, dev_err(dsaf_dev->dev,
"get port-id fail, ret=%d!\n", ret); "get reg fail, ret=%d!\n", ret);
return ret; return ret;
} }
if (port_id >= max_port_num) { if (port_id >= max_port_num) {
dev_err(dsaf_dev->dev, dev_err(dsaf_dev->dev,
"port-id(%u) out of range!\n", port_id); "reg(%u) out of range!\n", port_id);
return -EINVAL; return -EINVAL;
} }
mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb), mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb),
......
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