Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2977653ybi; Thu, 4 Jul 2019 23:33:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWZNrtojJizo1WxLe5548byLsHuH5AXyytAglQc0rla+5zpMMFUqtZIV7ylTexJC8kI92l X-Received: by 2002:a17:902:d897:: with SMTP id b23mr2999155plz.321.1562308409435; Thu, 04 Jul 2019 23:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562308409; cv=none; d=google.com; s=arc-20160816; b=wQu6Gy8j8NCEb8VHjNnjfmOwmrTjduMY68Yu8rjgxrEqcJwnmBXJBvw6ne4T03PMVO LcO/u7NYP+3f6Vly3SbP+rEOhCmkaXLiPhJPFNAJh9vKHNGkSRVCgCvU9FRF8ZnuCxgP MaBLOkeM/Ez0Fzmt3m+uHR69q+Pv+aTO1rzuTfnk6Fzpm9FoxmcZZVQdgu3qdiuneXFc s3TQs/0WWtKOKBAaEf4d0ucLFOhdecRJpO6533MioBJGcqtD+XV2BLUGcBEeUtTE42sO DIg1R5UeEveL7TW2nWrI5KsXZaNYmOkZrbsmEjxRW5BE+tMIggJAGkYUmTw6nXrsMiz1 RVSw== 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=X50L569TpESzFCBfiUf93q072RzKcMQ9xVJ7DRoqy5E=; b=AtGIXsrp1dW8Vq72XpwzZARgdfE2dkglnKliXbKf7TtM5PvSSI1L6QFPqsul5IuR1e 1o4oh7aE2jCnSYMBtP+FZJEu2tI7W0AL0RnpyfGdNKYbKn/RHGLutfjv/hUH5gYM5PwN YcJYXFzhl5kEqc/ogCtykCz2Y2IMr8KY+DoE2nDhTmqLL1s38Ek8joyuj1ZzPJG0eGZ+ 79N1JMeeaDqVMDmdBoTmKiQ54vC53w5WZaZhr0UXFVUMQDAmAMnp3Kv8aOtghGrrDu33 bZcEFbpc852XnuQz+qCityMKPqAA0zzFRR2ODrqxR+Wzcs2mBruk1o1c6pJu+l/mrqPp whTg== 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 f34si7621162ple.327.2019.07.04.23.33.02; Thu, 04 Jul 2019 23:33:29 -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 S1727581AbfGEGKr (ORCPT + 99 others); Fri, 5 Jul 2019 02:10:47 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:44430 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727169AbfGEGKq (ORCPT ); Fri, 5 Jul 2019 02:10:46 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5675A73B08C9FD20883E; Fri, 5 Jul 2019 14:10:43 +0800 (CST) Received: from huawei.com (10.67.189.167) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Fri, 5 Jul 2019 14:10:36 +0800 From: Jiangfeng Xiao To: , , , CC: , , , , , , , , , Subject: [PATCH 01/10] net: hisilicon: Add support for HI13X1 to hip04_eth Date: Fri, 5 Jul 2019 14:10:28 +0800 Message-ID: <1562307028-103555-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 Extend the hip04_eth driver to support HI13X1_GMAC. Enable it with CONFIG_HI13X1_GMAC option. HI13X1 changed the offsets and bitmaps for registers in the same peripheral device on different models of the hip04_eth. 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