summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
diff options
context:
space:
mode:
authoroulijun <oulijun@huawei.com>2016-08-18 15:32:52 +0300
committerDavid S. Miller <davem@davemloft.net>2016-08-20 02:58:33 +0300
commite018068812e54c407da599513bf8ad2d99fd0eaf (patch)
treebb018db88fca35dff805193c83dac495f3276fd8 /drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
parenta68d53988bc7f54aa383ecb308e7684c787af67c (diff)
downloadlinux-e018068812e54c407da599513bf8ad2d99fd0eaf.tar.xz
net: hns: Add reset function support for RoCE driver
It added reset function for RoCE driver. RoCE is a feature of hns. In hip06 SoC, in RoCE reset process, it's needed to configure dsaf channel reset, port and sl map info. Reset function of RoCE is located in dsaf module, we only call it in RoCE driver when needed. This patch is used to fix the conflict, please refer to this link: https://www.spinics.net/lists/linux-rdma/msg39114.html Signed-off-by: Wei Hu <xavier.huwei@huawei.com> Signed-off-by: Nenglong Zhao <zhaonenglong@hisilicon.com> Signed-off-by: Lijun Ou <oulijun@huawei.com> Signed-off-by: Sheng Li <lisheng011@huawei.com> Reviewed-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_misc.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index 611b67b6f450..36b9f791cf2f 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -231,6 +231,42 @@ static void hns_dsaf_xge_core_srst_by_port(struct dsaf_device *dsaf_dev,
dsaf_write_sub(dsaf_dev, reg_addr, reg_val);
}
+/**
+ * hns_dsaf_srst_chns - reset dsaf channels
+ * @dsaf_dev: dsaf device struct pointer
+ * @msk: xbar channels mask value:
+ * bit0-5 for xge0-5
+ * bit6-11 for ppe0-5
+ * bit12-17 for roce0-5
+ * bit18-19 for com/dfx
+ * @enable: false - request reset , true - drop reset
+ */
+void hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool enable)
+{
+ u32 reg_addr;
+
+ if (!enable)
+ reg_addr = DSAF_SUB_SC_DSAF_RESET_REQ_REG;
+ else
+ reg_addr = DSAF_SUB_SC_DSAF_RESET_DREQ_REG;
+
+ dsaf_write_sub(dsaf_dev, reg_addr, msk);
+}
+
+void hns_dsaf_roce_srst(struct dsaf_device *dsaf_dev, bool enable)
+{
+ if (!enable) {
+ dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_ROCEE_RESET_REQ_REG, 1);
+ } else {
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_ROCEE_CLK_DIS_REG, 1);
+ dsaf_write_sub(dsaf_dev,
+ DSAF_SUB_SC_ROCEE_RESET_DREQ_REG, 1);
+ msleep(20);
+ dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_ROCEE_CLK_EN_REG, 1);
+ }
+}
+
static void
hns_dsaf_xge_core_srst_by_port_acpi(struct dsaf_device *dsaf_dev,
u32 port, bool dereset)