Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2961210ybi; Thu, 4 Jul 2019 23:13:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPE5e48E/MYoScCLNNWojx44ZWNE2GWLomkm8yMkTKFIY2R8HEIvrCAkVKIKxu64w8xNSZ X-Received: by 2002:a63:4f5b:: with SMTP id p27mr2917677pgl.273.1562307234179; Thu, 04 Jul 2019 23:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562307234; cv=none; d=google.com; s=arc-20160816; b=tCIhk2njIAl2fTTWsHXY1OUzYOu6po4RjFXp1Mjr2sB6EhBYPKjMeL7ijAkxHfDimS zrK1cA9svt+aaJc7MHRsnwMufjA3CgTXKJOXqvraQchrV0jOzAaf+w7NjSP94OQukbcc WzwnjbbW0ifme6YvRVntw/DIDBZau3qelugfDqXRWJiLdWeID9HweB5R+MBEgdWrEw8H mDsiq8EbnYYeSeXQd2Od1AdK0A1zr2lJJ7bqvX9waqWJV9Ze4PTeDpwC7FySFXQEderG vbfA9WRcIYycWN+R9dOYHjQvnWPnXYia8Zzclkp3tRjpRvxMX25fRYcYBfj3iSbtToI/ gk9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=eGXh9jqxywsIsl6qvxldGZOla8Ym2mpAqRTnLbhqY9s=; b=AbAO/+uknteJGmc3cOpOtZwHwNr1nIRazBcrZgdyVCrdwQyAsv6V5d+pt170c9ArYT iNB9KkTRRSzqwe32/jTiuNKmVG9w/CCKZP1QNj+l920xEFZDhddeWWn/xOdMUVia/rx7 zpTzFKgxV32nQJTTIloDBqTYlQFRD0ZPtSzDwSrXz1CHcYzzlge46YA8wYy8yQH0+nRh OCbCjCUBchptF0O3WrcTTHwVdLl0fpijSX66B3quoktrmc2d6pmyfOOUrbVOIFfMnnfO hodr9yYSoQHhiA4xvEJCqP/Q6qMvwbLC5XXuYseJC4JyhC/Mz9QeA+dPuIdrAhP3ofLa B3GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si8646362pfi.240.2019.07.04.23.13.39; Thu, 04 Jul 2019 23:13:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbfGEGLu (ORCPT + 99 others); Fri, 5 Jul 2019 02:11:50 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45124 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725827AbfGEGLu (ORCPT ); Fri, 5 Jul 2019 02:11:50 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1D78CA60EB7F3C994434; Fri, 5 Jul 2019 14:11:48 +0800 (CST) Received: from huawei.com (10.67.189.167) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Fri, 5 Jul 2019 14:11:40 +0800 From: Jiangfeng Xiao To: , , , CC: , , , , , , , , , Subject: [PATCH 05/10] net: hisilicon: HI13X1_GMAX need dreq reset at first Date: Fri, 5 Jul 2019 14:11:34 +0800 Message-ID: <1562307094-103720-1-git-send-email-xiaojiangfeng@huawei.com> X-Mailer: git-send-email 1.8.5.6 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.167] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HI13X1_GMAC delete request for soft reset at first, otherwise, the subsequent initialization will not take effect. Signed-off-by: Jiangfeng Xiao --- drivers/net/ethernet/hisilicon/hip04_eth.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c index fe61b01..19d8cfd 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -16,6 +16,8 @@ #include #include +#define SC_PPE_RESET_DREQ 0x026C + #define PPE_CFG_RX_ADDR 0x100 #define PPE_CFG_POOL_GRP 0x300 #define PPE_CFG_RX_BUF_SIZE 0x400 @@ -61,6 +63,8 @@ #define PPE_HIS_RX_PKT_CNT 0x804 +#define RESET_DREQ_ALL 0xffffffff + /* REG_INTERRUPT */ #define RCV_INT BIT(10) #define RCV_NOBUF BIT(8) @@ -168,6 +172,9 @@ struct rx_desc { struct hip04_priv { void __iomem *base; +#if defined(CONFIG_HI13X1_GMAC) + void __iomem *sysctrl_base; +#endif int phy_mode; int chan; unsigned int port; @@ -244,6 +251,13 @@ static void hip04_config_port(struct net_device *ndev, u32 speed, u32 duplex) writel_relaxed(val, priv->base + GE_MODE_CHANGE_REG); } +static void hip04_reset_dreq(struct hip04_priv *priv) +{ +#if defined(CONFIG_HI13X1_GMAC) + writel_relaxed(RESET_DREQ_ALL, priv->sysctrl_base + SC_PPE_RESET_DREQ); +#endif +} + static void hip04_reset_ppe(struct hip04_priv *priv) { u32 val, tmp, timeout = 0; @@ -853,6 +867,15 @@ static int hip04_mac_probe(struct platform_device *pdev) goto init_fail; } +#if defined(CONFIG_HI13X1_GMAC) + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + priv->sysctrl_base = devm_ioremap_resource(d, res); + if (IS_ERR(priv->sysctrl_base)) { + ret = PTR_ERR(priv->sysctrl_base); + goto init_fail; + } +#endif + ret = of_parse_phandle_with_fixed_args(node, "port-handle", 2, 0, &arg); if (ret < 0) { dev_warn(d, "no port-handle\n"); @@ -921,6 +944,7 @@ static int hip04_mac_probe(struct platform_device *pdev) ndev->irq = irq; netif_napi_add(ndev, &priv->napi, hip04_rx_poll, NAPI_POLL_WEIGHT); + hip04_reset_dreq(priv); hip04_reset_ppe(priv); if (priv->phy_mode == PHY_INTERFACE_MODE_MII) hip04_config_port(ndev, SPEED_100, DUPLEX_FULL); -- 1.8.5.6