drivers/reset/reset-lantiq.c
Source file repositories/reference/linux-study-clean/drivers/reset/reset-lantiq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/reset-lantiq.c- Extension
.c- Size
- 5238 bytes
- Lines
- 209
- 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/mfd/syscon.hlinux/module.hlinux/regmap.hlinux/reset-controller.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/property.h
Detected Declarations
struct lantiq_rcu_reset_privfunction lantiq_rcu_reset_statusfunction lantiq_rcu_reset_status_timeoutfunction lantiq_rcu_reset_updatefunction lantiq_rcu_reset_assertfunction lantiq_rcu_reset_deassertfunction lantiq_rcu_reset_resetfunction lantiq_rcu_reset_of_parsefunction lantiq_rcu_reset_xlatefunction lantiq_rcu_reset_probe
Annotated Snippet
struct lantiq_rcu_reset_priv {
struct reset_controller_dev rcdev;
struct device *dev;
struct regmap *regmap;
u32 reset_offset;
u32 status_offset;
};
static struct lantiq_rcu_reset_priv *to_lantiq_rcu_reset_priv(
struct reset_controller_dev *rcdev)
{
return container_of(rcdev, struct lantiq_rcu_reset_priv, rcdev);
}
static int lantiq_rcu_reset_status(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct lantiq_rcu_reset_priv *priv = to_lantiq_rcu_reset_priv(rcdev);
unsigned int status = (id >> 8) & 0x1f;
u32 val;
int ret;
ret = regmap_read(priv->regmap, priv->status_offset, &val);
if (ret)
return ret;
return !!(val & BIT(status));
}
static int lantiq_rcu_reset_status_timeout(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
int ret;
int retry = LANTIQ_RCU_RESET_TIMEOUT;
do {
ret = lantiq_rcu_reset_status(rcdev, id);
if (ret < 0)
return ret;
if (ret == assert)
return 0;
usleep_range(20, 40);
} while (--retry);
return -ETIMEDOUT;
}
static int lantiq_rcu_reset_update(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
struct lantiq_rcu_reset_priv *priv = to_lantiq_rcu_reset_priv(rcdev);
unsigned int set = id & 0x1f;
u32 val = assert ? BIT(set) : 0;
int ret;
ret = regmap_update_bits(priv->regmap, priv->reset_offset, BIT(set),
val);
if (ret) {
dev_err(priv->dev, "Failed to set reset bit %u\n", set);
return ret;
}
ret = lantiq_rcu_reset_status_timeout(rcdev, id, assert);
if (ret)
dev_err(priv->dev, "Failed to %s bit %u\n",
assert ? "assert" : "deassert", set);
return ret;
}
static int lantiq_rcu_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
return lantiq_rcu_reset_update(rcdev, id, true);
}
static int lantiq_rcu_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
{
return lantiq_rcu_reset_update(rcdev, id, false);
}
static int lantiq_rcu_reset_reset(struct reset_controller_dev *rcdev,
unsigned long id)
{
int ret;
ret = lantiq_rcu_reset_assert(rcdev, id);
if (ret)
Annotation
- Immediate include surface: `linux/mfd/syscon.h`, `linux/module.h`, `linux/regmap.h`, `linux/reset-controller.h`, `linux/of_address.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/property.h`.
- Detected declarations: `struct lantiq_rcu_reset_priv`, `function lantiq_rcu_reset_status`, `function lantiq_rcu_reset_status_timeout`, `function lantiq_rcu_reset_update`, `function lantiq_rcu_reset_assert`, `function lantiq_rcu_reset_deassert`, `function lantiq_rcu_reset_reset`, `function lantiq_rcu_reset_of_parse`, `function lantiq_rcu_reset_xlate`, `function lantiq_rcu_reset_probe`.
- 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.