diff mbox series

[net-next,09/11] net: hibmcge: Add a Makefile and update Kconfig for hibmcge

Message ID 20240819071229.2489506-10-shaojijie@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Add support of HIBMCGE Ethernet Driver | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 17 this patch: 17
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 22 this patch: 22
netdev/checkpatch warning WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jijie Shao Aug. 19, 2024, 7:12 a.m. UTC
Add a Makefile and update Kconfig to build hibmcge driver.

Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
 drivers/net/ethernet/hisilicon/Kconfig          | 16 +++++++++++++++-
 drivers/net/ethernet/hisilicon/Makefile         |  1 +
 drivers/net/ethernet/hisilicon/hibmcge/Makefile | 10 ++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/Makefile

Comments

kernel test robot Aug. 19, 2024, 3:07 p.m. UTC | #1
Hi Jijie,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jijie-Shao/net-hibmcge-Add-pci-table-supported-in-this-module/20240819-152333
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240819071229.2489506-10-shaojijie%40huawei.com
patch subject: [PATCH net-next 09/11] net: hibmcge: Add a Makefile and update Kconfig for hibmcge
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20240819/202408192219.zrGff7n1-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240819/202408192219.zrGff7n1-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408192219.zrGff7n1-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c:9:
   drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c: In function 'hbg_hw_set_txrx_intr_enable':
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h:27:59: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
      27 |         regmap_write_bits((priv)->regmap, reg_addr, mask, FIELD_PREP(mask, val))
         |                                                           ^~~~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c:101:9: note: in expansion of macro 'hbg_reg_write_field'
     101 |         hbg_reg_write_field(priv, addr, HBG_REG_CF_IND_INT_STAT_CLR_MSK_B, enabld);
         |         ^~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c: In function 'hbg_hw_txrx_intr_is_enabled':
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h:24:9: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
      24 |         FIELD_GET(mask, hbg_reg_read(priv, reg_addr))
         |         ^~~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c:109:16: note: in expansion of macro 'hbg_reg_read_field'
     109 |         return hbg_reg_read_field(priv, addr, HBG_REG_CF_IND_INT_STAT_CLR_MSK_B);
         |                ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c: In function 'hbg_init_tx_desc':
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c:52:18: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
      52 |         word0 |= FIELD_PREP(HBG_TX_DESC_W0_WB_B, HBG_STATUS_ENABLE);
         |                  ^~~~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c: In function 'hbg_sync_data_from_hw':
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c:233:16: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
     233 |         return FIELD_GET(HBG_RX_DESC_W2_PKT_LEN_M, rx_desc->word2) != 0;
         |                ^~~~~~~~~
   cc1: some warnings being treated as errors


vim +/FIELD_PREP +27 drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h

97e170277067a0 Jijie Shao 2024-08-19  19  
97e170277067a0 Jijie Shao 2024-08-19  20  #define hbg_reg_write64(priv, reg_addr, value) \
97e170277067a0 Jijie Shao 2024-08-19  21  	lo_hi_writeq(value, (priv)->io_base + (reg_addr))
97e170277067a0 Jijie Shao 2024-08-19  22  
44d1e0ec4b312d Jijie Shao 2024-08-19  23  #define hbg_reg_read_field(priv, reg_addr, mask) \
44d1e0ec4b312d Jijie Shao 2024-08-19 @24  	FIELD_GET(mask, hbg_reg_read(priv, reg_addr))
44d1e0ec4b312d Jijie Shao 2024-08-19  25  
44d1e0ec4b312d Jijie Shao 2024-08-19  26  #define hbg_reg_write_field(priv, reg_addr, mask, val) \
44d1e0ec4b312d Jijie Shao 2024-08-19 @27  	regmap_write_bits((priv)->regmap, reg_addr, mask, FIELD_PREP(mask, val))
44d1e0ec4b312d Jijie Shao 2024-08-19  28
kernel test robot Aug. 19, 2024, 4:19 p.m. UTC | #2
Hi Jijie,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jijie-Shao/net-hibmcge-Add-pci-table-supported-in-this-module/20240819-152333
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240819071229.2489506-10-shaojijie%40huawei.com
patch subject: [PATCH net-next 09/11] net: hibmcge: Add a Makefile and update Kconfig for hibmcge
config: sparc64-defconfig (https://download.01.org/0day-ci/archive/20240820/202408200026.q20EuSHC-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408200026.q20EuSHC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408200026.q20EuSHC-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:15:21: error: variable 'hbg_regmap_config' has initializer but incomplete type
      15 | static const struct regmap_config hbg_regmap_config = {
         |                     ^~~~~~~~~~~~~
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:16:10: error: 'const struct regmap_config' has no member named 'reg_bits'
      16 |         .reg_bits       = 32,
         |          ^~~~~~~~
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:16:27: warning: excess elements in struct initializer
      16 |         .reg_bits       = 32,
         |                           ^~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:16:27: note: (near initialization for 'hbg_regmap_config')
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:17:10: error: 'const struct regmap_config' has no member named 'reg_stride'
      17 |         .reg_stride     = 4,
         |          ^~~~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:17:27: warning: excess elements in struct initializer
      17 |         .reg_stride     = 4,
         |                           ^
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:17:27: note: (near initialization for 'hbg_regmap_config')
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:18:10: error: 'const struct regmap_config' has no member named 'val_bits'
      18 |         .val_bits       = 32,
         |          ^~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:18:27: warning: excess elements in struct initializer
      18 |         .val_bits       = 32,
         |                           ^~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:18:27: note: (near initialization for 'hbg_regmap_config')
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:19:10: error: 'const struct regmap_config' has no member named 'max_register'
      19 |         .max_register   = 0x20000,
         |          ^~~~~~~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:19:27: warning: excess elements in struct initializer
      19 |         .max_register   = 0x20000,
         |                           ^~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:19:27: note: (near initialization for 'hbg_regmap_config')
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:20:10: error: 'const struct regmap_config' has no member named 'fast_io'
      20 |         .fast_io        = true,
         |          ^~~~~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:20:27: warning: excess elements in struct initializer
      20 |         .fast_io        = true,
         |                           ^~~~
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:20:27: note: (near initialization for 'hbg_regmap_config')
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c: In function 'hbg_init':
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:136:18: error: implicit declaration of function 'devm_regmap_init_mmio' [-Wimplicit-function-declaration]
     136 |         regmap = devm_regmap_init_mmio(dev, priv->io_base, &hbg_regmap_config);
         |                  ^~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:136:16: error: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     136 |         regmap = devm_regmap_init_mmio(dev, priv->io_base, &hbg_regmap_config);
         |                ^
   drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c: At top level:
>> drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c:15:35: error: storage size of 'hbg_regmap_config' isn't known
      15 | static const struct regmap_config hbg_regmap_config = {
         |                                   ^~~~~~~~~~~~~~~~~


vim +/hbg_regmap_config +15 drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c

97e170277067a0 Jijie Shao 2024-08-19   14  
97e170277067a0 Jijie Shao 2024-08-19  @15  static const struct regmap_config hbg_regmap_config = {
97e170277067a0 Jijie Shao 2024-08-19  @16  	.reg_bits	= 32,
97e170277067a0 Jijie Shao 2024-08-19  @17  	.reg_stride	= 4,
97e170277067a0 Jijie Shao 2024-08-19  @18  	.val_bits	= 32,
97e170277067a0 Jijie Shao 2024-08-19  @19  	.max_register	= 0x20000,
97e170277067a0 Jijie Shao 2024-08-19  @20  	.fast_io	= true,
97e170277067a0 Jijie Shao 2024-08-19   21  };
97e170277067a0 Jijie Shao 2024-08-19   22  
687339112834f6 Jijie Shao 2024-08-19   23  static void hbg_all_irq_enable(struct hbg_priv *priv, bool enabled)
687339112834f6 Jijie Shao 2024-08-19   24  {
687339112834f6 Jijie Shao 2024-08-19   25  	u32 i;
687339112834f6 Jijie Shao 2024-08-19   26  
687339112834f6 Jijie Shao 2024-08-19   27  	for (i = 0; i < priv->vectors.info_array_len; i++)
687339112834f6 Jijie Shao 2024-08-19   28  		hbg_irq_enable(priv, priv->vectors.info_array[i].mask,
687339112834f6 Jijie Shao 2024-08-19   29  			       enabled);
687339112834f6 Jijie Shao 2024-08-19   30  }
687339112834f6 Jijie Shao 2024-08-19   31  
687339112834f6 Jijie Shao 2024-08-19   32  static int hbg_net_open(struct net_device *dev)
687339112834f6 Jijie Shao 2024-08-19   33  {
687339112834f6 Jijie Shao 2024-08-19   34  	struct hbg_priv *priv = netdev_priv(dev);
687339112834f6 Jijie Shao 2024-08-19   35  
687339112834f6 Jijie Shao 2024-08-19   36  	if (test_and_set_bit(HBG_NIC_STATE_OPEN, &priv->state))
687339112834f6 Jijie Shao 2024-08-19   37  		return 0;
687339112834f6 Jijie Shao 2024-08-19   38  
687339112834f6 Jijie Shao 2024-08-19   39  	netif_carrier_off(dev);
ae4a07330253ca Jijie Shao 2024-08-19   40  	napi_enable(&priv->rx_ring.napi);
ddb659b09e0fd3 Jijie Shao 2024-08-19   41  	napi_enable(&priv->tx_ring.napi);
687339112834f6 Jijie Shao 2024-08-19   42  	hbg_all_irq_enable(priv, true);
687339112834f6 Jijie Shao 2024-08-19   43  	hbg_hw_mac_enable(priv, HBG_STATUS_ENABLE);
687339112834f6 Jijie Shao 2024-08-19   44  	netif_start_queue(dev);
687339112834f6 Jijie Shao 2024-08-19   45  	hbg_phy_start(priv);
687339112834f6 Jijie Shao 2024-08-19   46  
687339112834f6 Jijie Shao 2024-08-19   47  	return 0;
687339112834f6 Jijie Shao 2024-08-19   48  }
687339112834f6 Jijie Shao 2024-08-19   49  
687339112834f6 Jijie Shao 2024-08-19   50  static int hbg_net_stop(struct net_device *dev)
687339112834f6 Jijie Shao 2024-08-19   51  {
687339112834f6 Jijie Shao 2024-08-19   52  	struct hbg_priv *priv = netdev_priv(dev);
687339112834f6 Jijie Shao 2024-08-19   53  
687339112834f6 Jijie Shao 2024-08-19   54  	if (!hbg_nic_is_open(priv))
687339112834f6 Jijie Shao 2024-08-19   55  		return 0;
687339112834f6 Jijie Shao 2024-08-19   56  
687339112834f6 Jijie Shao 2024-08-19   57  	clear_bit(HBG_NIC_STATE_OPEN, &priv->state);
687339112834f6 Jijie Shao 2024-08-19   58  	netif_carrier_off(dev);
687339112834f6 Jijie Shao 2024-08-19   59  	hbg_phy_stop(priv);
687339112834f6 Jijie Shao 2024-08-19   60  	netif_stop_queue(dev);
687339112834f6 Jijie Shao 2024-08-19   61  	hbg_hw_mac_enable(priv, HBG_STATUS_DISABLE);
687339112834f6 Jijie Shao 2024-08-19   62  	hbg_all_irq_enable(priv, false);
ddb659b09e0fd3 Jijie Shao 2024-08-19   63  	napi_disable(&priv->tx_ring.napi);
ae4a07330253ca Jijie Shao 2024-08-19   64  	napi_disable(&priv->rx_ring.napi);
687339112834f6 Jijie Shao 2024-08-19   65  
687339112834f6 Jijie Shao 2024-08-19   66  	return 0;
687339112834f6 Jijie Shao 2024-08-19   67  }
687339112834f6 Jijie Shao 2024-08-19   68  
687339112834f6 Jijie Shao 2024-08-19   69  static int hbg_net_set_mac_address(struct net_device *dev, void *addr)
687339112834f6 Jijie Shao 2024-08-19   70  {
687339112834f6 Jijie Shao 2024-08-19   71  	struct hbg_priv *priv = netdev_priv(dev);
687339112834f6 Jijie Shao 2024-08-19   72  	u8 *mac_addr;
687339112834f6 Jijie Shao 2024-08-19   73  
687339112834f6 Jijie Shao 2024-08-19   74  	mac_addr = ((struct sockaddr *)addr)->sa_data;
687339112834f6 Jijie Shao 2024-08-19   75  	hbg_hw_set_uc_addr(priv, ether_addr_to_u64(mac_addr));
687339112834f6 Jijie Shao 2024-08-19   76  	dev_addr_set(dev, mac_addr);
687339112834f6 Jijie Shao 2024-08-19   77  
687339112834f6 Jijie Shao 2024-08-19   78  	return 0;
687339112834f6 Jijie Shao 2024-08-19   79  }
687339112834f6 Jijie Shao 2024-08-19   80  
687339112834f6 Jijie Shao 2024-08-19   81  static int hbg_net_change_mtu(struct net_device *dev, int new_mtu)
687339112834f6 Jijie Shao 2024-08-19   82  {
687339112834f6 Jijie Shao 2024-08-19   83  	struct hbg_priv *priv = netdev_priv(dev);
687339112834f6 Jijie Shao 2024-08-19   84  	bool is_opened = hbg_nic_is_open(priv);
687339112834f6 Jijie Shao 2024-08-19   85  	u32 frame_len;
687339112834f6 Jijie Shao 2024-08-19   86  
687339112834f6 Jijie Shao 2024-08-19   87  	hbg_net_stop(dev);
687339112834f6 Jijie Shao 2024-08-19   88  
687339112834f6 Jijie Shao 2024-08-19   89  	frame_len = new_mtu + VLAN_HLEN * priv->dev_specs.vlan_layers +
687339112834f6 Jijie Shao 2024-08-19   90  		    ETH_HLEN + ETH_FCS_LEN;
687339112834f6 Jijie Shao 2024-08-19   91  	hbg_hw_set_mtu(priv, frame_len);
687339112834f6 Jijie Shao 2024-08-19   92  	WRITE_ONCE(dev->mtu, new_mtu);
687339112834f6 Jijie Shao 2024-08-19   93  
687339112834f6 Jijie Shao 2024-08-19   94  	dev_dbg(&priv->pdev->dev,
687339112834f6 Jijie Shao 2024-08-19   95  		"change mtu from %u to %u\n", dev->mtu, new_mtu);
687339112834f6 Jijie Shao 2024-08-19   96  	if (is_opened)
687339112834f6 Jijie Shao 2024-08-19   97  		hbg_net_open(dev);
687339112834f6 Jijie Shao 2024-08-19   98  	return 0;
687339112834f6 Jijie Shao 2024-08-19   99  }
687339112834f6 Jijie Shao 2024-08-19  100  
ddb659b09e0fd3 Jijie Shao 2024-08-19  101  static void hbg_net_tx_timeout(struct net_device *dev, unsigned int txqueue)
ddb659b09e0fd3 Jijie Shao 2024-08-19  102  {
ddb659b09e0fd3 Jijie Shao 2024-08-19  103  	struct hbg_priv *priv = netdev_priv(dev);
ddb659b09e0fd3 Jijie Shao 2024-08-19  104  	struct hbg_ring *ring = &priv->tx_ring;
ddb659b09e0fd3 Jijie Shao 2024-08-19  105  	char *buf = ring->tout_log_buf;
ddb659b09e0fd3 Jijie Shao 2024-08-19  106  	u32 pos = 0;
ddb659b09e0fd3 Jijie Shao 2024-08-19  107  
ddb659b09e0fd3 Jijie Shao 2024-08-19  108  	pos += scnprintf(buf + pos, HBG_TX_TIMEOUT_BUF_LEN - pos,
ddb659b09e0fd3 Jijie Shao 2024-08-19  109  			 "ring used num: %u, fifo used num: %u\n",
ddb659b09e0fd3 Jijie Shao 2024-08-19  110  			 hbg_get_queue_used_num(ring),
ddb659b09e0fd3 Jijie Shao 2024-08-19  111  			 hbg_hw_get_fifo_used_num(priv, HBG_DIR_TX));
ddb659b09e0fd3 Jijie Shao 2024-08-19  112  	pos += scnprintf(buf + pos, HBG_TX_TIMEOUT_BUF_LEN - pos,
ddb659b09e0fd3 Jijie Shao 2024-08-19  113  			 "ntc: %u, ntu: %u, irq enabled: %u\n",
ddb659b09e0fd3 Jijie Shao 2024-08-19  114  			 ring->ntc, ring->ntu,
ddb659b09e0fd3 Jijie Shao 2024-08-19  115  			 hbg_irq_is_enabled(priv, HBG_INT_MSK_TX_B));
ddb659b09e0fd3 Jijie Shao 2024-08-19  116  
ddb659b09e0fd3 Jijie Shao 2024-08-19  117  	netdev_info(dev, "%s", buf);
ddb659b09e0fd3 Jijie Shao 2024-08-19  118  }
ddb659b09e0fd3 Jijie Shao 2024-08-19  119  
687339112834f6 Jijie Shao 2024-08-19  120  static const struct net_device_ops hbg_netdev_ops = {
687339112834f6 Jijie Shao 2024-08-19  121  	.ndo_open		= hbg_net_open,
687339112834f6 Jijie Shao 2024-08-19  122  	.ndo_stop		= hbg_net_stop,
ddb659b09e0fd3 Jijie Shao 2024-08-19  123  	.ndo_start_xmit		= hbg_net_start_xmit,
687339112834f6 Jijie Shao 2024-08-19  124  	.ndo_validate_addr	= eth_validate_addr,
687339112834f6 Jijie Shao 2024-08-19  125  	.ndo_set_mac_address	= hbg_net_set_mac_address,
687339112834f6 Jijie Shao 2024-08-19  126  	.ndo_change_mtu		= hbg_net_change_mtu,
ddb659b09e0fd3 Jijie Shao 2024-08-19  127  	.ndo_tx_timeout		= hbg_net_tx_timeout,
687339112834f6 Jijie Shao 2024-08-19  128  };
687339112834f6 Jijie Shao 2024-08-19  129  
97e170277067a0 Jijie Shao 2024-08-19  130  static int hbg_init(struct hbg_priv *priv)
97e170277067a0 Jijie Shao 2024-08-19  131  {
97e170277067a0 Jijie Shao 2024-08-19  132  	struct device *dev = &priv->pdev->dev;
97e170277067a0 Jijie Shao 2024-08-19  133  	struct regmap *regmap;
44d1e0ec4b312d Jijie Shao 2024-08-19  134  	int ret;
97e170277067a0 Jijie Shao 2024-08-19  135  
97e170277067a0 Jijie Shao 2024-08-19 @136  	regmap = devm_regmap_init_mmio(dev, priv->io_base, &hbg_regmap_config);
97e170277067a0 Jijie Shao 2024-08-19  137  	if (IS_ERR(regmap))
97e170277067a0 Jijie Shao 2024-08-19  138  		return dev_err_probe(dev, PTR_ERR(regmap), "failed to init regmap\n");
97e170277067a0 Jijie Shao 2024-08-19  139  
97e170277067a0 Jijie Shao 2024-08-19  140  	priv->regmap = regmap;
44d1e0ec4b312d Jijie Shao 2024-08-19  141  	ret = hbg_hw_init(priv);
44d1e0ec4b312d Jijie Shao 2024-08-19  142  	if (ret)
44d1e0ec4b312d Jijie Shao 2024-08-19  143  		return ret;
44d1e0ec4b312d Jijie Shao 2024-08-19  144  
ddb659b09e0fd3 Jijie Shao 2024-08-19  145  	ret = hbg_txrx_init(priv);
ddb659b09e0fd3 Jijie Shao 2024-08-19  146  	if (ret)
ddb659b09e0fd3 Jijie Shao 2024-08-19  147  		return ret;
ddb659b09e0fd3 Jijie Shao 2024-08-19  148  
ddb659b09e0fd3 Jijie Shao 2024-08-19  149  	ret = devm_add_action_or_reset(&priv->pdev->dev, hbg_txrx_uninit, priv);
ddb659b09e0fd3 Jijie Shao 2024-08-19  150  	if (ret)
ddb659b09e0fd3 Jijie Shao 2024-08-19  151  		return ret;
ddb659b09e0fd3 Jijie Shao 2024-08-19  152  
20db2e78ac2dab Jijie Shao 2024-08-19  153  	ret = hbg_irq_init(priv);
20db2e78ac2dab Jijie Shao 2024-08-19  154  	if (ret)
20db2e78ac2dab Jijie Shao 2024-08-19  155  		return ret;
20db2e78ac2dab Jijie Shao 2024-08-19  156  
44d1e0ec4b312d Jijie Shao 2024-08-19  157  	return hbg_mdio_init(priv);
97e170277067a0 Jijie Shao 2024-08-19  158  }
7212bbc0ea2ed3 Jijie Shao 2024-08-19  159
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/Kconfig b/drivers/net/ethernet/hisilicon/Kconfig
index 3312e1d93c3b..0ed9b22b65df 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -7,7 +7,6 @@  config NET_VENDOR_HISILICON
 	bool "Hisilicon devices"
 	default y
 	depends on OF || ACPI
-	depends on ARM || ARM64 || COMPILE_TEST
 	help
 	  If you have a network (Ethernet) card belonging to this class, say Y.
 
@@ -18,6 +17,8 @@  config NET_VENDOR_HISILICON
 
 if NET_VENDOR_HISILICON
 
+if ARM || ARM64 || COMPILE_TEST
+
 config HIX5HD2_GMAC
 	tristate "Hisilicon HIX5HD2 Family Network Device Support"
 	select PHYLIB
@@ -141,4 +142,17 @@  config HNS3_ENET
 
 endif #HNS3
 
+endif # ARM || ARM64 || COMPILE_TEST
+
+config HIBMCGE
+	tristate "Hisilicon BMC Gigabit Ethernet Device Support"
+	default m
+	depends on PCI && PCI_MSI
+	help
+	  If you wish to compile a kernel for a BMC with HIBMC-xx_gmac
+	  then you should answer Y to this. This makes this driver suitable for use
+	  on certain boards such as the HIBMC-210.
+
+	  If you are unsure, say N.
+
 endif # NET_VENDOR_HISILICON
diff --git a/drivers/net/ethernet/hisilicon/Makefile b/drivers/net/ethernet/hisilicon/Makefile
index 7f76d412047a..0e2cadfea8ff 100644
--- a/drivers/net/ethernet/hisilicon/Makefile
+++ b/drivers/net/ethernet/hisilicon/Makefile
@@ -9,3 +9,4 @@  obj-$(CONFIG_HNS_MDIO) += hns_mdio.o
 obj-$(CONFIG_HNS) += hns/
 obj-$(CONFIG_HNS3) += hns3/
 obj-$(CONFIG_HISI_FEMAC) += hisi_femac.o
+obj-$(CONFIG_HIBMCGE) += hibmcge/
diff --git a/drivers/net/ethernet/hisilicon/hibmcge/Makefile b/drivers/net/ethernet/hisilicon/hibmcge/Makefile
new file mode 100644
index 000000000000..ea223b7207af
--- /dev/null
+++ b/drivers/net/ethernet/hisilicon/hibmcge/Makefile
@@ -0,0 +1,10 @@ 
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Makefile for the HISILICON BMC GE network device drivers.
+#
+
+ccflags-y += -I$(src)
+
+obj-$(CONFIG_HIBMCGE) += hibmcge.o
+
+hibmcge-objs = hbg_main.o hbg_hw.o hbg_mdio.o hbg_irq.o hbg_txrx.o hbg_ethtool.o