drivers/net/ethernet/ti/icssg/icss_iep.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/icssg/icss_iep.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ti/icssg/icss_iep.c- Extension
.c- Size
- 29579 bytes
- Lines
- 1108
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitops.hlinux/clk.hlinux/err.hlinux/io.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/timekeeping.hlinux/interrupt.hlinux/of_irq.hlinux/workqueue.hicss_iep.h
Detected Declarations
function Copyrightfunction icss_iep_get_count_lowfunction icss_iep_get_ptp_clock_idxfunction icss_iep_set_counterfunction icss_iep_settimefunction icss_iep_gettimefunction icss_iep_enablefunction icss_iep_disablefunction icss_iep_enable_shadow_modefunction icss_iep_set_default_incfunction icss_iep_set_compensation_incfunction icss_iep_set_compensation_countfunction icss_iep_set_slow_compensation_countfunction icss_iep_ptp_adjfinefunction icss_iep_ptp_adjtimefunction icss_iep_ptp_gettimeexfunction icss_iep_ptp_settimefunction icss_iep_update_to_next_boundaryfunction icss_iep_perout_enable_hwfunction icss_iep_perout_enablefunction icss_iep_cap_cmp_workfunction icss_iep_cap_cmp_irqfunction icss_iep_pps_enablefunction icss_iep_extts_enablefunction icss_iep_ptp_enablefunction icss_iep_putfunction icss_iep_init_fwfunction icss_iep_exit_fwfunction icss_iep_initfunction icss_iep_exitfunction icss_iep_probefunction am654_icss_iep_valid_regfunction icss_iep_regmap_writefunction icss_iep_regmap_readfunction am335x_icss_iep_valid_regexport icss_iep_get_count_hiexport icss_iep_get_count_lowexport icss_iep_get_ptp_clock_idxexport icss_iep_get_idxexport icss_iep_getexport icss_iep_putexport icss_iep_init_fwexport icss_iep_exit_fwexport icss_iep_initexport icss_iep_exit
Annotated Snippet
if (ret) {
dev_info(iep->dev, "cap_cmp irq request failed: %x\n",
ret);
} else {
iep->cap_cmp_irq = irq;
INIT_WORK(&iep->work, icss_iep_cap_cmp_work);
}
}
iep_clk = devm_clk_get(dev, NULL);
if (IS_ERR(iep_clk))
return PTR_ERR(iep_clk);
iep->refclk_freq = clk_get_rate(iep_clk);
iep->def_inc = NSEC_PER_SEC / iep->refclk_freq; /* ns per clock tick */
if (iep->def_inc > IEP_MAX_DEF_INC) {
dev_err(dev, "Failed to set def_inc %d. IEP_clock is too slow to be supported\n",
iep->def_inc);
return -EINVAL;
}
iep->plat_data = device_get_match_data(dev);
if (!iep->plat_data)
return -EINVAL;
iep->map = devm_regmap_init(dev, NULL, iep, iep->plat_data->config);
if (IS_ERR(iep->map)) {
dev_err(dev, "Failed to create regmap for IEP %ld\n",
PTR_ERR(iep->map));
return PTR_ERR(iep->map);
}
iep->ptp_info = icss_iep_ptp_info;
mutex_init(&iep->ptp_clk_mutex);
dev_set_drvdata(dev, iep);
icss_iep_disable(iep);
return 0;
}
static bool am654_icss_iep_valid_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case ICSS_IEP_GLOBAL_CFG_REG ... ICSS_IEP_SYNC_START_REG:
return true;
default:
return false;
}
return false;
}
static int icss_iep_regmap_write(void *context, unsigned int reg,
unsigned int val)
{
struct icss_iep *iep = context;
writel(val, iep->base + iep->plat_data->reg_offs[reg]);
return 0;
}
static int icss_iep_regmap_read(void *context, unsigned int reg,
unsigned int *val)
{
struct icss_iep *iep = context;
*val = readl(iep->base + iep->plat_data->reg_offs[reg]);
return 0;
}
static const struct regmap_config am654_icss_iep_regmap_config = {
.name = "icss iep",
.reg_stride = 1,
.reg_write = icss_iep_regmap_write,
.reg_read = icss_iep_regmap_read,
.writeable_reg = am654_icss_iep_valid_reg,
.readable_reg = am654_icss_iep_valid_reg,
.fast_io = 1,
};
static const struct icss_iep_plat_data am654_icss_iep_plat_data = {
.flags = ICSS_IEP_64BIT_COUNTER_SUPPORT |
ICSS_IEP_SLOW_COMPEN_REG_SUPPORT |
ICSS_IEP_SHADOW_MODE_SUPPORT,
.reg_offs = {
[ICSS_IEP_GLOBAL_CFG_REG] = 0x00,
[ICSS_IEP_COMPEN_REG] = 0x08,
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/err.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function icss_iep_get_count_low`, `function icss_iep_get_ptp_clock_idx`, `function icss_iep_set_counter`, `function icss_iep_settime`, `function icss_iep_gettime`, `function icss_iep_enable`, `function icss_iep_disable`, `function icss_iep_enable_shadow_mode`, `function icss_iep_set_default_inc`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.