提交 482f13aa 编写于 作者: D 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: NDavid S. Miller <davem@davemloft.net>
......@@ -13,10 +13,10 @@ Required properties:
- interrupts: should contain the DSA Fabric and rcb interrupt.
- reg: specifies base physical address(es) and size of the device registers.
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.
The second region is SerDes base register and size(optional, only be used when
serdes-syscon in port node is not exists. It is recommended using
The second region is SerDes base register and size(optional, only used when
serdes-syscon in port node does not exist). It is recommended using
serdes-syscon rather than this address.
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
......@@ -24,8 +24,8 @@ Required properties:
- reg-names: may be ppe-base and(or) dsaf-base. It is used to find the
corresponding reg's index.
- phy-handle: phy handle of physicl 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.
- phy-handle: phy handle of physical port, 0 if not any phy device. It is optional
attribute. If port node exists, phy-handle in each port node will be used.
see ethernet.txt [1].
- subctrl-syscon: is syscon handle for external interface control register.
- reset-field-offset: is offset of reset field. Its value depends on the hardware
......@@ -35,14 +35,12 @@ Required properties:
- port: subnodes of dsaf. A dsaf node may contain several port nodes(Depending
on mode of dsaf). Port node contain some attributes listed below:
- port-id: is physical port index in one dsaf.
- phy-handle: phy handle of physicl port. It is not required if there isn't
- reg: is physical port index in one dsaf.
- phy-handle: phy handle of physical port. It is not required if there isn't
phy device. see ethernet.txt [1].
- serdes-syscon: is syscon handle for SerDes register.
- cpld-syscon: is syscon handle for cpld register. It is 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.
- cpld-syscon: is syscon handle + register offset pair for cpld register. It is
not required if there isn't cpld device.
- port-rst-offset: is offset of reset field for each port in dsaf. Its value
depends on the hardware user manual.
- port-mode-offset: is offset of port mode field for each port in dsaf. Its
......@@ -72,14 +70,14 @@ dsaf0: dsa@c7000000 {
desc-num = <1024>;
dma-coherent;
prot@0 {
port-id = 0;
port@0 {
reg = 0;
phy-handle = <&phy0>;
serdes-syscon = <&serdes>;
};
prot@1 {
port-id = 1;
port@1 {
reg = 1;
serdes-syscon = <&serdes>;
};
};
......@@ -24,6 +24,8 @@ soc0: soc@000000000 {
};
dsaf0: dsa@c7000000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "hisilicon,hns-dsaf-v1";
mode = "6port-16rss";
interrupt-parent = <&mbigen_dsa>;
......@@ -124,20 +126,20 @@ soc0: soc@000000000 {
dma-coherent;
port@0 {
port-id = <0>;
reg = <0>;
serdes-syscon = <&serdes_ctrl0>;
};
port@1 {
port-id = <1>;
reg = <1>;
serdes-syscon = <&serdes_ctrl0>;
};
port@4 {
port-id = <4>;
reg = <4>;
phy-handle = <&soc0_phy0>;
serdes-syscon = <&serdes_ctrl1>;
};
port@5 {
port-id = <5>;
reg = <5>;
phy-handle = <&soc0_phy1>;
serdes-syscon = <&serdes_ctrl1>;
};
......
......@@ -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 regmap *syscon;
struct of_phandle_args cpld_args;
u32 ret;
mac_cb->link = false;
......@@ -713,22 +714,23 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->mac_id);
}
syscon = syscon_node_to_regmap(
of_parse_phandle(to_of_node(mac_cb->fw_port),
"cpld-syscon", 0));
if (IS_ERR_OR_NULL(syscon)) {
dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
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;
ret = fwnode_property_read_u32(mac_cb->fw_port,
"cpld-ctrl-reg",
&mac_cb->cpld_ctrl_reg);
if (ret) {
dev_err(mac_cb->dev, "get cpld-ctrl-reg fail!\n");
return ret;
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];
}
}
return 0;
}
......@@ -832,15 +834,15 @@ int hns_mac_init(struct dsaf_device *dsaf_dev)
struct fwnode_handle *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) {
dev_err(dsaf_dev->dev,
"get port-id fail, ret=%d!\n", ret);
"get reg fail, ret=%d!\n", ret);
return ret;
}
if (port_id >= max_port_num) {
dev_err(dsaf_dev->dev,
"port-id(%u) out of range!\n", port_id);
"reg(%u) out of range!\n", port_id);
return -EINVAL;
}
mac_cb = devm_kzalloc(dsaf_dev->dev, sizeof(*mac_cb),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册