drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c- Extension
.c- Size
- 3105 bytes
- Lines
- 144
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/errno.hlinux/etherdevice.hrnpgbe.hrnpgbe_hw.hrnpgbe_mbx.hrnpgbe_mbx_fw.h
Detected Declarations
function rnpgbe_get_permanent_macfunction rnpgbe_reset_hwfunction rnpgbe_send_notifyfunction rnpgbe_init_n500function rnpgbe_init_n210function rnpgbe_init_hw
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2020 - 2025 Mucse Corporation. */
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
#include "rnpgbe.h"
#include "rnpgbe_hw.h"
#include "rnpgbe_mbx.h"
#include "rnpgbe_mbx_fw.h"
/**
* rnpgbe_get_permanent_mac - Get permanent mac
* @hw: hw information structure
* @perm_addr: pointer to store perm_addr
*
* rnpgbe_get_permanent_mac tries to get mac from hw
*
* Return: 0 on success, negative errno on failure
**/
int rnpgbe_get_permanent_mac(struct mucse_hw *hw, u8 *perm_addr)
{
struct device *dev = &hw->pdev->dev;
int err;
err = mucse_mbx_get_macaddr(hw, hw->pfvfnum, perm_addr, hw->port);
if (err) {
dev_err(dev, "Failed to get MAC from FW %d\n", err);
return err;
}
if (!is_valid_ether_addr(perm_addr)) {
dev_err(dev, "Failed to get valid MAC from FW\n");
return -EINVAL;
}
return 0;
}
/**
* rnpgbe_reset_hw - Do a hardware reset
* @hw: hw information structure
*
* rnpgbe_reset_hw calls fw to do a hardware
* reset, and cleans some regs to default.
*
* Return: 0 on success, negative errno on failure
**/
int rnpgbe_reset_hw(struct mucse_hw *hw)
{
mucse_hw_wr32(hw, RNPGBE_DMA_AXI_EN, 0);
return mucse_mbx_reset_hw(hw);
}
/**
* rnpgbe_send_notify - Echo fw status
* @hw: hw information structure
* @enable: true or false status
* @mode: status mode
*
* Return: 0 on success, negative errno on failure
**/
int rnpgbe_send_notify(struct mucse_hw *hw,
bool enable,
int mode)
{
int err;
/* Keep switch struct to support more modes in the future */
switch (mode) {
case mucse_fw_powerup:
err = mucse_mbx_powerup(hw, enable);
break;
default:
err = -EINVAL;
}
return err;
}
/**
* rnpgbe_init_n500 - Setup n500 hw info
* @hw: hw information structure
*
* rnpgbe_init_n500 initializes all private
* structure for n500
**/
static void rnpgbe_init_n500(struct mucse_hw *hw)
{
struct mucse_mbx_info *mbx = &hw->mbx;
Annotation
- Immediate include surface: `linux/pci.h`, `linux/errno.h`, `linux/etherdevice.h`, `rnpgbe.h`, `rnpgbe_hw.h`, `rnpgbe_mbx.h`, `rnpgbe_mbx_fw.h`.
- Detected declarations: `function rnpgbe_get_permanent_mac`, `function rnpgbe_reset_hw`, `function rnpgbe_send_notify`, `function rnpgbe_init_n500`, `function rnpgbe_init_n210`, `function rnpgbe_init_hw`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.