drivers/misc/xilinx_tmr_manager.c
Source file repositories/reference/linux-study-clean/drivers/misc/xilinx_tmr_manager.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/xilinx_tmr_manager.c- Extension
.c- Size
- 6380 bytes
- Lines
- 221
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- 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
asm/xilinx_mb_manager.hlinux/module.hlinux/of.hlinux/platform_device.h
Detected Declarations
struct xtmr_manager_devfunction xtmr_manager_writefunction xtmr_manager_readfunction xmb_manager_reset_handlerfunction xmb_manager_update_errcntfunction errcnt_showfunction dis_block_break_storefunction xtmr_manager_initfunction xtmr_manager_probe
Annotated Snippet
struct xtmr_manager_dev {
void __iomem *regs;
u32 cr_val;
u32 magic1;
u32 err_cnt;
resource_size_t phys_baseaddr;
};
/* IO accessors */
static inline void xtmr_manager_write(struct xtmr_manager_dev *xtmr_manager,
u32 addr, u32 value)
{
iowrite32(value, xtmr_manager->regs + addr);
}
static inline u32 xtmr_manager_read(struct xtmr_manager_dev *xtmr_manager,
u32 addr)
{
return ioread32(xtmr_manager->regs + addr);
}
static void xmb_manager_reset_handler(struct xtmr_manager_dev *xtmr_manager)
{
/* Clear the FFR Register contents as a part of recovery process. */
xtmr_manager_write(xtmr_manager, XTMR_MANAGER_FFR_OFFSET, 0);
}
static void xmb_manager_update_errcnt(struct xtmr_manager_dev *xtmr_manager)
{
xtmr_manager->err_cnt++;
}
static ssize_t errcnt_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct xtmr_manager_dev *xtmr_manager = dev_get_drvdata(dev);
return sysfs_emit(buf, "%x\n", xtmr_manager->err_cnt);
}
static DEVICE_ATTR_RO(errcnt);
static ssize_t dis_block_break_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
struct xtmr_manager_dev *xtmr_manager = dev_get_drvdata(dev);
int ret;
long value;
ret = kstrtoul(buf, 16, &value);
if (ret)
return ret;
/* unblock the break signal*/
xtmr_manager->cr_val &= ~(1 << XTMR_MANAGER_CR_BB_SHIFT);
xtmr_manager_write(xtmr_manager, XTMR_MANAGER_CR_OFFSET,
xtmr_manager->cr_val);
return size;
}
static DEVICE_ATTR_WO(dis_block_break);
static struct attribute *xtmr_manager_dev_attrs[] = {
&dev_attr_dis_block_break.attr,
&dev_attr_errcnt.attr,
NULL,
};
ATTRIBUTE_GROUPS(xtmr_manager_dev);
static void xtmr_manager_init(struct xtmr_manager_dev *xtmr_manager)
{
/* Clear the SEM interrupt mask register to disable the interrupt */
xtmr_manager_write(xtmr_manager, XTMR_MANAGER_SEMIMR_OFFSET, 0);
/* Allow recovery reset by default */
xtmr_manager->cr_val = (1 << XTMR_MANAGER_CR_RIR_SHIFT) |
xtmr_manager->magic1;
xtmr_manager_write(xtmr_manager, XTMR_MANAGER_CR_OFFSET,
xtmr_manager->cr_val);
/*
* Configure Break Delay Initialization Register to zero so that
* break occurs immediately
*/
xtmr_manager_write(xtmr_manager, XTMR_MANAGER_BDIR_OFFSET, 0);
/*
* To come out of break handler need to block the break signal
* in the tmr manager, update the xtmr_manager cr_val for the same
*/
xtmr_manager->cr_val |= (1 << XTMR_MANAGER_CR_BB_SHIFT);
Annotation
- Immediate include surface: `asm/xilinx_mb_manager.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct xtmr_manager_dev`, `function xtmr_manager_write`, `function xtmr_manager_read`, `function xmb_manager_reset_handler`, `function xmb_manager_update_errcnt`, `function errcnt_show`, `function dis_block_break_store`, `function xtmr_manager_init`, `function xtmr_manager_probe`.
- Atlas domain: Driver Families / drivers/misc.
- 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.