summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
diff options
context:
space:
mode:
authorYisen.Zhuang\(Zhuangyuzeng\) <Yisen.Zhuang@huawei.com>2016-04-23 17:05:14 +0800
committerDavid S. Miller <davem@davemloft.net>2016-04-26 01:09:18 -0400
commit0d768fc62def08628affa4a2abe4f319926027a9 (patch)
tree04b9e8c24ce0a2869238c9aaa31a09fe805505bd /drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
parent850bfa3b78ea8849fef78ed74f5f2ccf947db0ca (diff)
net: hns: add attribute port-mode-offset for dsaf port node
Port mode offset for each dsaf port is different. The current code is not so readability. This patch adds configuration named port-mode-offset to make the code simple and more readability. If port-mode-offset isn't exists, default value 0 will be used. Signed-off-by: Daode Huang <huangdaode@hisilicon.com> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 52d757df623e..1c8fdd316ca0 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -665,6 +665,7 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->max_frm = MAC_DEFAULT_MTU;
mac_cb->tx_pause_frm_time = MAC_DEFAULT_PAUSE_TIME;
mac_cb->port_rst_off = mac_cb->mac_id;
+ mac_cb->port_mode_off = 0;
/* if the dsaf node doesn't contain a port subnode, get phy-handle
* from dsaf node
@@ -703,6 +704,15 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
mac_cb->mac_id);
}
+ ret = fwnode_property_read_u32(mac_cb->fw_port,
+ "port-mode-offset",
+ &mac_cb->port_mode_off);
+ if (ret) {
+ dev_dbg(mac_cb->dev,
+ "mac%d port-mode-offset not found, use default value.\n",
+ mac_cb->mac_id);
+ }
+
syscon = syscon_node_to_regmap(
of_parse_phandle(to_of_node(mac_cb->fw_port),
"cpld-syscon", 0));