Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: rnpgbe: Add build support for rnpgbe

Add build options and doc for mucse.
Initialize pci device access for MUCSE devices.

Signed-off-by: Dong Yibo <dong100@mucse.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: MD Danish Anwar <danishanwar@ti.com>
Link: https://patch.msgid.link/20251101013849.120565-2-dong100@mucse.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dong Yibo and committed by
Jakub Kicinski
ee61c10c 3f02b827

+214
+1
Documentation/networking/device_drivers/ethernet/index.rst
··· 47 47 mellanox/mlx5/index 48 48 meta/fbnic 49 49 microsoft/netvsc 50 + mucse/rnpgbe 50 51 neterion/s2io 51 52 netronome/nfp 52 53 pensando/ionic
+17
Documentation/networking/device_drivers/ethernet/mucse/rnpgbe.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + =========================================================== 4 + Linux Base Driver for MUCSE(R) Gigabit PCI Express Adapters 5 + =========================================================== 6 + 7 + Contents 8 + ======== 9 + 10 + - Identifying Your Adapter 11 + 12 + Identifying Your Adapter 13 + ======================== 14 + The driver is compatible with devices based on the following: 15 + 16 + * MUCSE(R) Ethernet Controller N210 series 17 + * MUCSE(R) Ethernet Controller N500 series
+8
MAINTAINERS
··· 17610 17610 F: Documentation/devicetree/bindings/media/i2c/aptina,mt9v111.yaml 17611 17611 F: drivers/media/i2c/mt9v111.c 17612 17612 17613 + MUCSE ETHERNET DRIVER 17614 + M: Yibo Dong <dong100@mucse.com> 17615 + L: netdev@vger.kernel.org 17616 + S: Maintained 17617 + W: https://www.mucse.com/en/ 17618 + F: Documentation/networking/device_drivers/ethernet/mucse/ 17619 + F: drivers/net/ethernet/mucse/ 17620 + 17613 17621 MULTIFUNCTION DEVICES (MFD) 17614 17622 M: Lee Jones <lee@kernel.org> 17615 17623 S: Maintained
+1
drivers/net/ethernet/Kconfig
··· 129 129 source "drivers/net/ethernet/mscc/Kconfig" 130 130 source "drivers/net/ethernet/microsoft/Kconfig" 131 131 source "drivers/net/ethernet/moxa/Kconfig" 132 + source "drivers/net/ethernet/mucse/Kconfig" 132 133 source "drivers/net/ethernet/myricom/Kconfig" 133 134 134 135 config FEALNX
+1
drivers/net/ethernet/Makefile
··· 65 65 obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/ 66 66 obj-$(CONFIG_NET_VENDOR_MICROSEMI) += mscc/ 67 67 obj-$(CONFIG_NET_VENDOR_MOXART) += moxa/ 68 + obj-$(CONFIG_NET_VENDOR_MUCSE) += mucse/ 68 69 obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/ 69 70 obj-$(CONFIG_FEALNX) += fealnx.o 70 71 obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/
+33
drivers/net/ethernet/mucse/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + # 3 + # Mucse network device configuration 4 + # 5 + 6 + config NET_VENDOR_MUCSE 7 + bool "Mucse devices" 8 + default y 9 + help 10 + If you have a network (Ethernet) card from Mucse(R), say Y. 11 + 12 + Note that the answer to this question doesn't directly affect the 13 + kernel: saying N will just cause the configurator to skip all 14 + the questions about Mucse(R) cards. If you say Y, you will 15 + be asked for your specific card in the following questions. 16 + 17 + if NET_VENDOR_MUCSE 18 + 19 + config MGBE 20 + tristate "Mucse(R) 1GbE PCI Express adapters support" 21 + depends on PCI 22 + help 23 + This driver supports Mucse(R) 1GbE PCI Express family of 24 + adapters. 25 + 26 + More specific information on configuring the driver is in 27 + <file:Documentation/networking/device_drivers/ethernet/mucse/rnpgbe.rst>. 28 + 29 + To compile this driver as a module, choose M here. The module 30 + will be called rnpgbe. 31 + 32 + endif # NET_VENDOR_MUCSE 33 +
+7
drivers/net/ethernet/mucse/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Copyright(c) 2020 - 2025 MUCSE Corporation. 3 + # 4 + # Makefile for the MUCSE(R) network device drivers 5 + # 6 + 7 + obj-$(CONFIG_MGBE) += rnpgbe/
+8
drivers/net/ethernet/mucse/rnpgbe/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Copyright(c) 2020 - 2025 MUCSE Corporation. 3 + # 4 + # Makefile for the MUCSE(R) 1GbE PCI Express ethernet driver 5 + # 6 + 7 + obj-$(CONFIG_MGBE) += rnpgbe.o 8 + rnpgbe-objs := rnpgbe_main.o
+18
drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* Copyright(c) 2020 - 2025 Mucse Corporation. */ 3 + 4 + #ifndef _RNPGBE_H 5 + #define _RNPGBE_H 6 + 7 + enum rnpgbe_boards { 8 + board_n500, 9 + board_n210 10 + }; 11 + 12 + /* Device IDs */ 13 + #define PCI_VENDOR_ID_MUCSE 0x8848 14 + #define RNPGBE_DEVICE_ID_N500_QUAD_PORT 0x8308 15 + #define RNPGBE_DEVICE_ID_N500_DUAL_PORT 0x8318 16 + #define RNPGBE_DEVICE_ID_N210 0x8208 17 + #define RNPGBE_DEVICE_ID_N210L 0x820a 18 + #endif /* _RNPGBE_H */
+120
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* Copyright(c) 2020 - 2025 Mucse Corporation. */ 3 + 4 + #include <linux/pci.h> 5 + 6 + #include "rnpgbe.h" 7 + 8 + static const char rnpgbe_driver_name[] = "rnpgbe"; 9 + 10 + /* rnpgbe_pci_tbl - PCI Device ID Table 11 + * 12 + * { PCI_VDEVICE(Vendor ID, Device ID), 13 + * private_data (used for different hw chip) } 14 + */ 15 + static struct pci_device_id rnpgbe_pci_tbl[] = { 16 + { PCI_VDEVICE(MUCSE, RNPGBE_DEVICE_ID_N210), board_n210 }, 17 + { PCI_VDEVICE(MUCSE, RNPGBE_DEVICE_ID_N210L), board_n210 }, 18 + { PCI_VDEVICE(MUCSE, RNPGBE_DEVICE_ID_N500_DUAL_PORT), board_n500 }, 19 + { PCI_VDEVICE(MUCSE, RNPGBE_DEVICE_ID_N500_QUAD_PORT), board_n500 }, 20 + /* required last entry */ 21 + {0, }, 22 + }; 23 + 24 + /** 25 + * rnpgbe_probe - Device initialization routine 26 + * @pdev: PCI device information struct 27 + * @id: entry in rnpgbe_pci_tbl 28 + * 29 + * rnpgbe_probe initializes a PF adapter identified by a pci_dev 30 + * structure. 31 + * 32 + * Return: 0 on success, negative errno on failure 33 + **/ 34 + static int rnpgbe_probe(struct pci_dev *pdev, const struct pci_device_id *id) 35 + { 36 + int err; 37 + 38 + err = pci_enable_device_mem(pdev); 39 + if (err) 40 + return err; 41 + 42 + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(56)); 43 + if (err) { 44 + dev_err(&pdev->dev, 45 + "No usable DMA configuration, aborting %d\n", err); 46 + goto err_disable_dev; 47 + } 48 + 49 + err = pci_request_mem_regions(pdev, rnpgbe_driver_name); 50 + if (err) { 51 + dev_err(&pdev->dev, 52 + "pci_request_selected_regions failed %d\n", err); 53 + goto err_disable_dev; 54 + } 55 + 56 + pci_set_master(pdev); 57 + err = pci_save_state(pdev); 58 + if (err) { 59 + dev_err(&pdev->dev, "pci_save_state failed %d\n", err); 60 + goto err_free_regions; 61 + } 62 + 63 + return 0; 64 + err_free_regions: 65 + pci_release_mem_regions(pdev); 66 + err_disable_dev: 67 + pci_disable_device(pdev); 68 + return err; 69 + } 70 + 71 + /** 72 + * rnpgbe_remove - Device removal routine 73 + * @pdev: PCI device information struct 74 + * 75 + * rnpgbe_remove is called by the PCI subsystem to alert the driver 76 + * that it should release a PCI device. This could be caused by a 77 + * Hot-Plug event, or because the driver is going to be removed from 78 + * memory. 79 + **/ 80 + static void rnpgbe_remove(struct pci_dev *pdev) 81 + { 82 + pci_release_mem_regions(pdev); 83 + pci_disable_device(pdev); 84 + } 85 + 86 + /** 87 + * rnpgbe_dev_shutdown - Device shutdown routine 88 + * @pdev: PCI device information struct 89 + **/ 90 + static void rnpgbe_dev_shutdown(struct pci_dev *pdev) 91 + { 92 + pci_disable_device(pdev); 93 + } 94 + 95 + /** 96 + * rnpgbe_shutdown - Device shutdown routine 97 + * @pdev: PCI device information struct 98 + * 99 + * rnpgbe_shutdown is called by the PCI subsystem to alert the driver 100 + * that os shutdown. Device should setup wakeup state here. 101 + **/ 102 + static void rnpgbe_shutdown(struct pci_dev *pdev) 103 + { 104 + rnpgbe_dev_shutdown(pdev); 105 + } 106 + 107 + static struct pci_driver rnpgbe_driver = { 108 + .name = rnpgbe_driver_name, 109 + .id_table = rnpgbe_pci_tbl, 110 + .probe = rnpgbe_probe, 111 + .remove = rnpgbe_remove, 112 + .shutdown = rnpgbe_shutdown, 113 + }; 114 + 115 + module_pci_driver(rnpgbe_driver); 116 + 117 + MODULE_DEVICE_TABLE(pci, rnpgbe_pci_tbl); 118 + MODULE_AUTHOR("Yibo Dong, <dong100@mucse.com>"); 119 + MODULE_DESCRIPTION("Mucse(R) 1 Gigabit PCI Express Network Driver"); 120 + MODULE_LICENSE("GPL");