drivers/pci/controller/pcie-mt7621.c
Source file repositories/reference/linux-study-clean/drivers/pci/controller/pcie-mt7621.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pci/controller/pcie-mt7621.c- Extension
.c- Size
- 13160 bytes
- Lines
- 549
- 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.
- 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/bitops.hlinux/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_pci.hlinux/of_platform.hlinux/pci.hlinux/phy/phy.hlinux/platform_device.hlinux/reset.hlinux/sys_soc.h../pci.h
Detected Declarations
struct mt7621_pcie_portstruct mt7621_pciefunction pcie_readfunction pcie_writefunction pcie_port_readfunction pcie_port_writefunction read_configfunction write_configfunction mt7621_rst_gpio_pcie_assertfunction mt7621_rst_gpio_pcie_deassertfunction mt7621_pcie_port_is_linkupfunction mt7621_control_assertfunction mt7621_control_deassertfunction mt7621_pcie_parse_portfunction mt7621_pcie_parse_dtfunction for_each_available_child_of_node_scopedfunction mt7621_pcie_init_portfunction mt7621_pcie_reset_assertfunction list_for_each_entryfunction mt7621_pcie_reset_rc_deassertfunction mt7621_pcie_reset_ep_deassertfunction mt7621_pcie_init_portsfunction list_for_each_entry_safefunction mt7621_pcie_enable_portfunction mt7621_pcie_enable_portsfunction list_for_each_entryfunction mt7621_pcie_register_hostfunction mt7621_pcie_probefunction mt7621_pcie_remove
Annotated Snippet
struct mt7621_pcie_port {
void __iomem *base;
struct list_head list;
struct mt7621_pcie *pcie;
struct clk *clk;
struct phy *phy;
struct reset_control *pcie_rst;
struct gpio_desc *gpio_rst;
u32 slot;
bool enabled;
};
/**
* struct mt7621_pcie - PCIe host information
* @base: IO Mapped Register Base
* @dev: Pointer to PCIe device
* @ports: pointer to PCIe port information
* @resets_inverted: depends on chip revision
* reset lines are inverted.
*/
struct mt7621_pcie {
struct device *dev;
void __iomem *base;
struct list_head ports;
bool resets_inverted;
};
static inline u32 pcie_read(struct mt7621_pcie *pcie, u32 reg)
{
return readl_relaxed(pcie->base + reg);
}
static inline void pcie_write(struct mt7621_pcie *pcie, u32 val, u32 reg)
{
writel_relaxed(val, pcie->base + reg);
}
static inline u32 pcie_port_read(struct mt7621_pcie_port *port, u32 reg)
{
return readl_relaxed(port->base + reg);
}
static inline void pcie_port_write(struct mt7621_pcie_port *port,
u32 val, u32 reg)
{
writel_relaxed(val, port->base + reg);
}
static void __iomem *mt7621_pcie_map_bus(struct pci_bus *bus,
unsigned int devfn, int where)
{
struct mt7621_pcie *pcie = bus->sysdata;
u32 address = PCI_CONF1_EXT_ADDRESS(bus->number, PCI_SLOT(devfn),
PCI_FUNC(devfn), where);
writel_relaxed(address, pcie->base + RALINK_PCI_CONFIG_ADDR);
return pcie->base + RALINK_PCI_CONFIG_DATA + (where & 3);
}
static struct pci_ops mt7621_pcie_ops = {
.map_bus = mt7621_pcie_map_bus,
.read = pci_generic_config_read,
.write = pci_generic_config_write,
};
static u32 read_config(struct mt7621_pcie *pcie, unsigned int dev, u32 reg)
{
u32 address = PCI_CONF1_EXT_ADDRESS(0, dev, 0, reg);
pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
return pcie_read(pcie, RALINK_PCI_CONFIG_DATA);
}
static void write_config(struct mt7621_pcie *pcie, unsigned int dev,
u32 reg, u32 val)
{
u32 address = PCI_CONF1_EXT_ADDRESS(0, dev, 0, reg);
pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA);
}
static inline void mt7621_rst_gpio_pcie_assert(struct mt7621_pcie_port *port)
{
if (port->gpio_rst)
gpiod_set_value(port->gpio_rst, 1);
}
static inline void mt7621_rst_gpio_pcie_deassert(struct mt7621_pcie_port *port)
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_pci.h`.
- Detected declarations: `struct mt7621_pcie_port`, `struct mt7621_pcie`, `function pcie_read`, `function pcie_write`, `function pcie_port_read`, `function pcie_port_write`, `function read_config`, `function write_config`, `function mt7621_rst_gpio_pcie_assert`, `function mt7621_rst_gpio_pcie_deassert`.
- Atlas domain: Representative Device Path / PCIe NVMe Storage Path.
- 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.