drivers/reset/reset-eyeq.c
Source file repositories/reference/linux-study-clean/drivers/reset/reset-eyeq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/reset-eyeq.c- Extension
.c- Size
- 16411 bytes
- Lines
- 593
- Domain
- Driver Families
- Bucket
- drivers/reset
- 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
linux/array_size.hlinux/auxiliary_bus.hlinux/bitfield.hlinux/bits.hlinux/bug.hlinux/cleanup.hlinux/container_of.hlinux/device.hlinux/err.hlinux/errno.hlinux/init.hlinux/io.hlinux/iopoll.hlinux/lockdep.hlinux/mod_devicetable.hlinux/mutex.hlinux/of.hlinux/reset-controller.hlinux/slab.hlinux/types.h
Detected Declarations
struct eqr_busy_wait_timingsstruct eqr_domain_descriptorstruct eqr_match_datastruct eqr_privateenum eqr_domain_typefunction eqr_double_readlfunction eqr_busy_wait_lockedfunction eqr_assert_lockedfunction eqr_assertfunction eqr_deassert_lockedfunction eqr_deassertfunction eqr_statusfunction eqr_of_xlate_internalfunction eqr_of_xlate_onecellfunction eqr_of_xlate_twocellsfunction eqr_probe
Annotated Snippet
struct eqr_busy_wait_timings {
unsigned long sleep_us;
unsigned long timeout_us;
};
static const struct eqr_busy_wait_timings eqr_timings[] = {
[EQR_EYEQ5_SARCR] = {1, 10},
[EQR_EYEQ5_ACRP] = {1, 40 * USEC_PER_MSEC}, /* LBIST implies long timeout. */
/* EQR_EYEQ5_PCIE does no busy waiting. */
[EQR_EYEQ6H_SARCR] = {1, 400},
};
#define EQR_MAX_DOMAIN_COUNT 3
struct eqr_domain_descriptor {
enum eqr_domain_type type;
u32 valid_mask;
unsigned int offset;
};
struct eqr_match_data {
unsigned int domain_count;
const struct eqr_domain_descriptor *domains;
};
struct eqr_private {
/*
* One mutex per domain for read-modify-write operations on registers.
* Some domains can be involved in LBIST which implies long critical
* sections; we wouldn't want other domains to be impacted by that.
*/
struct mutex mutexes[EQR_MAX_DOMAIN_COUNT];
void __iomem *base;
const struct eqr_match_data *data;
struct reset_controller_dev rcdev;
};
static inline struct eqr_private *eqr_rcdev_to_priv(struct reset_controller_dev *x)
{
return container_of(x, struct eqr_private, rcdev);
}
static u32 eqr_double_readl(void __iomem *addr_a, void __iomem *addr_b,
u32 *dest_a, u32 *dest_b)
{
*dest_a = readl(addr_a);
*dest_b = readl(addr_b);
return 0; /* read_poll_timeout() op argument must return something. */
}
static int eqr_busy_wait_locked(struct eqr_private *priv, struct device *dev,
u32 domain, u32 offset, bool assert)
{
void __iomem *base = priv->base + priv->data->domains[domain].offset;
enum eqr_domain_type domain_type = priv->data->domains[domain].type;
unsigned long timeout_us = eqr_timings[domain_type].timeout_us;
unsigned long sleep_us = eqr_timings[domain_type].sleep_us;
u32 val, mask, rst_status, clk_status;
void __iomem *reg;
int ret;
lockdep_assert_held(&priv->mutexes[domain]);
switch (domain_type) {
case EQR_EYEQ5_SARCR:
reg = base + EQR_EYEQ5_SARCR_STATUS;
mask = BIT(offset);
ret = readl_poll_timeout(reg, val, !(val & mask) == assert,
sleep_us, timeout_us);
break;
case EQR_EYEQ5_ACRP:
reg = base + 4 * offset;
if (assert)
mask = EQR_EYEQ5_ACRP_ST_POWER_DOWN;
else
mask = EQR_EYEQ5_ACRP_ST_ACTIVE;
ret = readl_poll_timeout(reg, val, !!(val & mask),
sleep_us, timeout_us);
break;
case EQR_EYEQ5_PCIE:
ret = 0; /* No busy waiting. */
break;
case EQR_EYEQ6H_SARCR:
/*
* Wait until both bits change:
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/auxiliary_bus.h`, `linux/bitfield.h`, `linux/bits.h`, `linux/bug.h`, `linux/cleanup.h`, `linux/container_of.h`, `linux/device.h`.
- Detected declarations: `struct eqr_busy_wait_timings`, `struct eqr_domain_descriptor`, `struct eqr_match_data`, `struct eqr_private`, `enum eqr_domain_type`, `function eqr_double_readl`, `function eqr_busy_wait_locked`, `function eqr_assert_locked`, `function eqr_assert`, `function eqr_deassert_locked`.
- Atlas domain: Driver Families / drivers/reset.
- 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.