Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7372558ybi; Mon, 8 Jul 2019 20:33:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4Xvzi3sacn0YcEU8rA8BwUil0Yh+XgkiKoKQZAtrDq7y0EDMrXgL2LS3R6E4DIj2hasa0 X-Received: by 2002:a63:c03:: with SMTP id b3mr28288983pgl.68.1562643212735; Mon, 08 Jul 2019 20:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562643212; cv=none; d=google.com; s=arc-20160816; b=u6x7PHtlJRvjEqSrqAnxSw+7IXKHMIcofPYNJgclXz0e0fkb2hPfX9WDJFuxmnhj1S rTnzgzFmS5t1UxeIB88qlV7opMlg7Io7fdv89H8TehlhX2yvYRfvJnGkeW3edOqMAqc6 loNhGBm0Y8wNk8YT/8Q+8mjhQ5XkkWfmujYfsKZiUeLDIFwaodnGelrjvSMvQ+kkzpcn aUgUUMcKh9rxbwzPbfABH+zwnOb+Sd6nWzkgjxYR5NgniwNEUmBV2bGGki+draQ4luAe lTMBQg0Bue7nUykBjQZCYhvTvh0BLkAK5OJsfbFQk2tb6bl/4QNFgUVLJQ2dBzIm3dOR g4og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=eGXh9jqxywsIsl6qvxldGZOla8Ym2mpAqRTnLbhqY9s=; b=Fvh5XkhAl9DagsDeg544DShF9G/bHdvdaIfi9Qvl5s0fzNCvzmTezOIjDQofWgNJ0F f7VQne2wx/NYUW5/UlkhsBGAdN42WIMZFkVCdbDddZ3ncn78dPFEVCqq2WToTDTpbbcu KNIutAcjg0jSbx/czVH86jh0jDvT+jbDPPcXSx0lhtWArMmBBvvsxgZvvIg4NS48Xc9/ AWgMY48lT3Rgz2B5z2lhYiYnh/ypQFsiO5HnoM3ak4Nf4zLD5kRnAd4fp0gkb25+ieJE BIGm9G6Gi1tiePiDs651TDcHaJrvMlI8XTSsD5Vi+1L/7FgcLgr09rGAmTJRvQH2SKKk aG2w== 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 80si22814748pgf.5.2019.07.08.20.33.17; Mon, 08 Jul 2019 20:33:32 -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 S1727646AbfGIDcQ (ORCPT + 99 others); Mon, 8 Jul 2019 23:32:16 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51548 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726089AbfGIDbc (ORCPT ); Mon, 8 Jul 2019 23:31:32 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 86B112CF840E11197A97; Tue, 9 Jul 2019 11:31:29 +0800 (CST) Received: from huawei.com (10.67.189.167) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Tue, 9 Jul 2019 11:31:22 +0800 From: Jiangfeng Xiao To: , , , , , , CC: , , , , , , Subject: [PATCH v2 05/10] net: hisilicon: HI13X1_GMAX need dreq reset at first Date: Tue, 9 Jul 2019 11:31:06 +0800 Message-ID: <1562643071-46811-6-git-send-email-xiaojiangfeng@huawei.com> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1562643071-46811-1-git-send-email-xiaojiangfeng@huawei.com> References: <1562643071-46811-1-git-send-email-xiaojiangfeng@huawei.com> 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