drivers/pci/controller/dwc/pcie-fu740.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/dwc/pcie-fu740.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/dwc/pcie-fu740.c- Extension
.c- Size
- 10828 bytes
- Lines
- 358
- Domain
- Representative Device Path
- Bucket
- PCIe NVMe Storage Path
- Inferred role
- Representative Device Path: implementation source
- Status
- source implementation candidate
Why This File Exists
Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Part of the selected hardware vertical slice: PCI discovery, driver binding, NVMe queues, block requests, DMA, interrupts, and completion.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/delay.hlinux/gpio.hlinux/gpio/consumer.hlinux/kernel.hlinux/module.hlinux/pci.hlinux/platform_device.hlinux/resource.hlinux/types.hlinux/interrupt.hlinux/iopoll.hlinux/reset.hpcie-designware.h
Detected Declarations
struct fu740_pciefunction fu740_pcie_assert_resetfunction fu740_pcie_deassert_resetfunction fu740_pcie_power_onfunction fu740_pcie_drive_resetfunction fu740_phyregwritefunction fu740_pcie_init_phyfunction fu740_pcie_start_linkfunction fu740_pcie_host_initfunction fu740_pcie_probefunction fu740_pcie_shutdown
Annotated Snippet
struct fu740_pcie {
struct dw_pcie pci;
void __iomem *mgmt_base;
struct gpio_desc *reset;
struct gpio_desc *pwren;
struct clk *pcie_aux;
struct reset_control *rst;
};
#define SIFIVE_DEVICESRESETREG 0x28
#define PCIEX8MGMT_PERST_N 0x0
#define PCIEX8MGMT_APP_LTSSM_ENABLE 0x10
#define PCIEX8MGMT_APP_HOLD_PHY_RST 0x18
#define PCIEX8MGMT_DEVICE_TYPE 0x708
#define PCIEX8MGMT_PHY0_CR_PARA_ADDR 0x860
#define PCIEX8MGMT_PHY0_CR_PARA_RD_EN 0x870
#define PCIEX8MGMT_PHY0_CR_PARA_RD_DATA 0x878
#define PCIEX8MGMT_PHY0_CR_PARA_SEL 0x880
#define PCIEX8MGMT_PHY0_CR_PARA_WR_DATA 0x888
#define PCIEX8MGMT_PHY0_CR_PARA_WR_EN 0x890
#define PCIEX8MGMT_PHY0_CR_PARA_ACK 0x898
#define PCIEX8MGMT_PHY1_CR_PARA_ADDR 0x8a0
#define PCIEX8MGMT_PHY1_CR_PARA_RD_EN 0x8b0
#define PCIEX8MGMT_PHY1_CR_PARA_RD_DATA 0x8b8
#define PCIEX8MGMT_PHY1_CR_PARA_SEL 0x8c0
#define PCIEX8MGMT_PHY1_CR_PARA_WR_DATA 0x8c8
#define PCIEX8MGMT_PHY1_CR_PARA_WR_EN 0x8d0
#define PCIEX8MGMT_PHY1_CR_PARA_ACK 0x8d8
#define PCIEX8MGMT_PHY_CDR_TRACK_EN BIT(0)
#define PCIEX8MGMT_PHY_LOS_THRSHLD BIT(5)
#define PCIEX8MGMT_PHY_TERM_EN BIT(9)
#define PCIEX8MGMT_PHY_TERM_ACDC BIT(10)
#define PCIEX8MGMT_PHY_EN BIT(11)
#define PCIEX8MGMT_PHY_INIT_VAL (PCIEX8MGMT_PHY_CDR_TRACK_EN|\
PCIEX8MGMT_PHY_LOS_THRSHLD|\
PCIEX8MGMT_PHY_TERM_EN|\
PCIEX8MGMT_PHY_TERM_ACDC|\
PCIEX8MGMT_PHY_EN)
#define PCIEX8MGMT_PHY_LANEN_DIG_ASIC_RX_OVRD_IN_3 0x1008
#define PCIEX8MGMT_PHY_LANE_OFF 0x100
#define PCIEX8MGMT_PHY_LANE0_BASE (PCIEX8MGMT_PHY_LANEN_DIG_ASIC_RX_OVRD_IN_3 + 0x100 * 0)
#define PCIEX8MGMT_PHY_LANE1_BASE (PCIEX8MGMT_PHY_LANEN_DIG_ASIC_RX_OVRD_IN_3 + 0x100 * 1)
#define PCIEX8MGMT_PHY_LANE2_BASE (PCIEX8MGMT_PHY_LANEN_DIG_ASIC_RX_OVRD_IN_3 + 0x100 * 2)
#define PCIEX8MGMT_PHY_LANE3_BASE (PCIEX8MGMT_PHY_LANEN_DIG_ASIC_RX_OVRD_IN_3 + 0x100 * 3)
static void fu740_pcie_assert_reset(struct fu740_pcie *afp)
{
/* Assert PERST_N GPIO */
gpiod_set_value_cansleep(afp->reset, 0);
/* Assert controller PERST_N */
writel_relaxed(0x0, afp->mgmt_base + PCIEX8MGMT_PERST_N);
}
static void fu740_pcie_deassert_reset(struct fu740_pcie *afp)
{
/* Deassert controller PERST_N */
writel_relaxed(0x1, afp->mgmt_base + PCIEX8MGMT_PERST_N);
/* Deassert PERST_N GPIO */
gpiod_set_value_cansleep(afp->reset, 1);
}
static void fu740_pcie_power_on(struct fu740_pcie *afp)
{
gpiod_set_value_cansleep(afp->pwren, 1);
/*
* Ensure that PERST has been asserted for at least 100 ms.
* Section 2.2 of PCI Express Card Electromechanical Specification
* Revision 3.0
*/
msleep(100);
}
static void fu740_pcie_drive_reset(struct fu740_pcie *afp)
{
fu740_pcie_assert_reset(afp);
fu740_pcie_power_on(afp);
fu740_pcie_deassert_reset(afp);
}
static void fu740_phyregwrite(const uint8_t phy, const uint16_t addr,
const uint16_t wrdata, struct fu740_pcie *afp)
{
struct device *dev = afp->pci.dev;
void __iomem *phy_cr_para_addr;
void __iomem *phy_cr_para_wr_data;
void __iomem *phy_cr_para_wr_en;
void __iomem *phy_cr_para_ack;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio.h`, `linux/gpio/consumer.h`, `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/platform_device.h`.
- Detected declarations: `struct fu740_pcie`, `function fu740_pcie_assert_reset`, `function fu740_pcie_deassert_reset`, `function fu740_pcie_power_on`, `function fu740_pcie_drive_reset`, `function fu740_phyregwrite`, `function fu740_pcie_init_phy`, `function fu740_pcie_start_link`, `function fu740_pcie_host_init`, `function fu740_pcie_probe`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.