Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7371544ybi; Mon, 8 Jul 2019 20:32:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9686VXzsUW26LIzukDfBRKYdCM+GHw0I+YYAfBXxT46CB4zMIKWtD9CCxcEEYLxjTjAE3 X-Received: by 2002:a17:90a:c481:: with SMTP id j1mr29788505pjt.96.1562643136585; Mon, 08 Jul 2019 20:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562643136; cv=none; d=google.com; s=arc-20160816; b=vuz3+aDnt/z+BeEhtqujc3xYsvo6KVRn5QUrQHdQm3VLSHhwVeYqsWS8sVd4Tz8UL0 2ojv0hL2x4rbyzJcb3dZc+AoJ7MsveKysnkIa80aJYt2x8eHW7MxxD/Zz2OCjEgXW75j 778arCmVJmbTU4p87fkkBmOu86OASeLf73x6mjtfQnr4UmoyFt1FypiDy17MZGwby33c 6eau8Y/DFG0vqbpUmRRCMFXadTkK5TDyBjqslsvS4szvNvBeAS3ICasxl1T/PdZbhSKO ojNG33lS3Pukt91pOMpPNn3zTZNhj7BHmPtNsG3f81Siv06IGVEWTNmgXL7wcezTzka9 tKkA== 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=8+Uu3f5Lpx5EJp+wAYj5B9CwRcyisElyySjo/b1X+UQ=; b=lSVVVXyxc2focwu/rZQWGDQ8JaCw8ugm2ZcKY9rSZtFGMVFgGCRKLEVMmzvCGws5k9 jmWuQNu1I36vmsE33dL2ijbwMtK7j9pNro6zTsGj3RJmHwjdUuA0m8CQq2+Hz7o3WxYh h/kPiPCz5ZnYASpaugdrhtFsy+Zas31fzQG7mTYWhDSjsSTrdtSu1rajK3Le3EU97qes u/N9/8ZvtLJ4TqvYU9NMsjS1E/VI4rAfNxvyLMp3yN8r8k4FGbkypMB0zc6XiRAfespK Y6jDcEutbRV+lw7zf3Im8pMB1x/2II1685hzoRRZrIKDBH0r8iytnSLkUQZ9tFMyfysp /cvw== 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 u191si20469016pgd.281.2019.07.08.20.32.01; Mon, 08 Jul 2019 20:32:16 -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 S1727316AbfGIDbe (ORCPT + 99 others); Mon, 8 Jul 2019 23:31:34 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51552 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726046AbfGIDbb (ORCPT ); Mon, 8 Jul 2019 23:31:31 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 812921B7C99B1553E632; 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:20 +0800 From: Jiangfeng Xiao To: , , , , , , CC: , , , , , , Subject: [PATCH v2 01/10] net: hisilicon: Add support for HI13X1 to hip04_eth Date: Tue, 9 Jul 2019 11:31:02 +0800 Message-ID: <1562643071-46811-2-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 Extend the hip04_eth driver to support HI13X1_GMAC. Enable it with CONFIG_HI13X1_GMAC option. Signed-off-by: Jiangfeng Xiao --- drivers/net/ethernet/hisilicon/Kconfig | 10 ++++++++ drivers/net/ethernet/hisilicon/hip04_eth.c | 37 ++++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/Kconfig b/drivers/net/ethernet/hisilicon/Kconfig index a0d780c..3892a20 100644 --- a/drivers/net/ethernet/hisilicon/Kconfig +++ b/drivers/net/ethernet/hisilicon/Kconfig @@ -46,6 +46,16 @@ config HIP04_ETH If you wish to compile a kernel for a hardware with hisilicon p04 SoC and want to use the internal ethernet then you should answer Y to this. +config HI13X1_GMAC + bool "Hisilicon HI13X1 Network Device Support" + depends on HIP04_ETH + help + If you wish to compile a kernel for a hardware with hisilicon hi13x1_gamc + then you should answer Y to this. This makes this driver suitable for use + on certain boards such as the HI13X1. + + If you are unsure, say N. + config HNS_MDIO tristate select PHYLIB diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c index e1f2978..2b5112b 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -33,10 +33,23 @@ #define GE_MODE_CHANGE_REG 0x1b4 #define GE_RECV_CONTROL_REG 0x1e0 #define GE_STATION_MAC_ADDRESS 0x210 -#define PPE_CFG_CPU_ADD_ADDR 0x580 -#define PPE_CFG_MAX_FRAME_LEN_REG 0x408 + #define PPE_CFG_BUS_CTRL_REG 0x424 #define PPE_CFG_RX_CTRL_REG 0x428 + +#if defined(CONFIG_HI13X1_GMAC) +#define PPE_CFG_CPU_ADD_ADDR 0x6D0 +#define PPE_CFG_MAX_FRAME_LEN_REG 0x500 +#define PPE_CFG_RX_PKT_MODE_REG 0x504 +#define PPE_CFG_QOS_VMID_GEN 0x520 +#define PPE_CFG_RX_PKT_INT 0x740 +#define PPE_INTEN 0x700 +#define PPE_INTSTS 0x708 +#define PPE_RINT 0x704 +#define PPE_CFG_STS_MODE 0x880 +#else +#define PPE_CFG_CPU_ADD_ADDR 0x580 +#define PPE_CFG_MAX_FRAME_LEN_REG 0x408 #define PPE_CFG_RX_PKT_MODE_REG 0x438 #define PPE_CFG_QOS_VMID_GEN 0x500 #define PPE_CFG_RX_PKT_INT 0x538 @@ -44,6 +57,8 @@ #define PPE_INTSTS 0x608 #define PPE_RINT 0x604 #define PPE_CFG_STS_MODE 0x700 +#endif /* CONFIG_HI13X1_GMAC */ + #define PPE_HIS_RX_PKT_CNT 0x804 /* REG_INTERRUPT */ @@ -93,18 +108,26 @@ #define GE_RX_PORT_EN BIT(1) #define GE_TX_PORT_EN BIT(2) -#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(12) - #define PPE_CFG_RX_PKT_ALIGN BIT(18) -#define PPE_CFG_QOS_VMID_MODE BIT(14) + +#if defined(CONFIG_HI13X1_GMAC) +#define PPE_CFG_QOS_VMID_GRP_SHIFT 4 +#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 7 +#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(0) +#define PPE_CFG_QOS_VMID_MODE BIT(15) +#define PPE_CFG_BUS_LOCAL_REL (BIT(9) | BIT(15) | BIT(19) | BIT(23)) +#else #define PPE_CFG_QOS_VMID_GRP_SHIFT 8 +#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 +#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(12) +#define PPE_CFG_QOS_VMID_MODE BIT(14) +#define PPE_CFG_BUS_LOCAL_REL BIT(14) +#endif /* CONFIG_HI13X1_GMAC */ #define PPE_CFG_RX_FIFO_FSFU BIT(11) #define PPE_CFG_RX_DEPTH_SHIFT 16 #define PPE_CFG_RX_START_SHIFT 0 -#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 -#define PPE_CFG_BUS_LOCAL_REL BIT(14) #define PPE_CFG_BUS_BIG_ENDIEN BIT(0) #define RX_DESC_NUM 128 -- 1.8.5.6