drivers/reset/sti/reset-syscfg.c
Source file repositories/reference/linux-study-clean/drivers/reset/sti/reset-syscfg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/sti/reset-syscfg.c- Extension
.c- Size
- 4639 bytes
- Lines
- 193
- 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/kernel.hlinux/platform_device.hlinux/property.hlinux/module.hlinux/err.hlinux/types.hlinux/of.hlinux/regmap.hlinux/mfd/syscon.hreset-syscfg.h
Detected Declarations
struct syscfg_reset_channelstruct syscfg_reset_controllerfunction syscfg_reset_program_hwfunction syscfg_reset_assertfunction syscfg_reset_deassertfunction syscfg_reset_devfunction syscfg_reset_statusfunction syscfg_reset_controller_registerfunction syscfg_reset_probe
Annotated Snippet
struct syscfg_reset_channel {
struct regmap_field *reset;
struct regmap_field *ack;
};
/**
* struct syscfg_reset_controller - A reset controller which groups together
* a set of related reset bits, which may be located in different system
* configuration registers.
*
* @rst: base reset controller structure.
* @active_low: are the resets in this controller active low, i.e. clearing
* the reset bit puts the hardware into reset.
* @channels: An array of reset channels for this controller.
*/
struct syscfg_reset_controller {
struct reset_controller_dev rst;
bool active_low;
struct syscfg_reset_channel channels[];
};
#define to_syscfg_reset_controller(_rst) \
container_of(_rst, struct syscfg_reset_controller, rst)
static int syscfg_reset_program_hw(struct reset_controller_dev *rcdev,
unsigned long idx, int assert)
{
struct syscfg_reset_controller *rst = to_syscfg_reset_controller(rcdev);
const struct syscfg_reset_channel *ch;
u32 ctrl_val = rst->active_low ? !assert : !!assert;
int err;
if (idx >= rcdev->nr_resets)
return -EINVAL;
ch = &rst->channels[idx];
err = regmap_field_write(ch->reset, ctrl_val);
if (err)
return err;
if (ch->ack) {
u32 ack_val;
err = regmap_field_read_poll_timeout(ch->ack, ack_val, (ack_val == ctrl_val),
100, USEC_PER_SEC);
if (err)
return err;
}
return 0;
}
static int syscfg_reset_assert(struct reset_controller_dev *rcdev,
unsigned long idx)
{
return syscfg_reset_program_hw(rcdev, idx, true);
}
static int syscfg_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long idx)
{
return syscfg_reset_program_hw(rcdev, idx, false);
}
static int syscfg_reset_dev(struct reset_controller_dev *rcdev,
unsigned long idx)
{
int err;
err = syscfg_reset_assert(rcdev, idx);
if (err)
return err;
return syscfg_reset_deassert(rcdev, idx);
}
static int syscfg_reset_status(struct reset_controller_dev *rcdev,
unsigned long idx)
{
struct syscfg_reset_controller *rst = to_syscfg_reset_controller(rcdev);
const struct syscfg_reset_channel *ch;
u32 ret_val = 0;
int err;
if (idx >= rcdev->nr_resets)
return -EINVAL;
ch = &rst->channels[idx];
if (ch->ack)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/platform_device.h`, `linux/property.h`, `linux/module.h`, `linux/err.h`, `linux/types.h`, `linux/of.h`, `linux/regmap.h`.
- Detected declarations: `struct syscfg_reset_channel`, `struct syscfg_reset_controller`, `function syscfg_reset_program_hw`, `function syscfg_reset_assert`, `function syscfg_reset_deassert`, `function syscfg_reset_dev`, `function syscfg_reset_status`, `function syscfg_reset_controller_register`, `function syscfg_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.