drivers/clk/visconti/reset.c
Source file repositories/reference/linux-study-clean/drivers/clk/visconti/reset.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/visconti/reset.c- Extension
.c- Size
- 2938 bytes
- Lines
- 108
- Domain
- Driver Families
- Bucket
- drivers/clk
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/delay.hlinux/device.hlinux/mfd/syscon.hlinux/regmap.hlinux/slab.hreset.h
Detected Declarations
function Copyrightfunction visconti_reset_assertfunction visconti_reset_deassertfunction visconti_reset_resetfunction visconti_reset_statusfunction visconti_register_reset_controller
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Toshiba Visconti ARM SoC reset controller
*
* Copyright (c) 2021 TOSHIBA CORPORATION
* Copyright (c) 2021 Toshiba Electronic Devices & Storage Corporation
*
* Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
*/
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include "reset.h"
static inline struct visconti_reset *to_visconti_reset(struct reset_controller_dev *rcdev)
{
return container_of(rcdev, struct visconti_reset, rcdev);
}
static int visconti_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
{
struct visconti_reset *reset = to_visconti_reset(rcdev);
const struct visconti_reset_data *data = &reset->resets[id];
u32 rst = BIT(data->rs_idx);
unsigned long flags;
int ret;
spin_lock_irqsave(reset->lock, flags);
ret = regmap_update_bits(reset->regmap, data->rson_offset, rst, rst);
spin_unlock_irqrestore(reset->lock, flags);
return ret;
}
static int visconti_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
{
struct visconti_reset *reset = to_visconti_reset(rcdev);
const struct visconti_reset_data *data = &reset->resets[id];
u32 rst = BIT(data->rs_idx);
unsigned long flags;
int ret;
spin_lock_irqsave(reset->lock, flags);
ret = regmap_update_bits(reset->regmap, data->rsoff_offset, rst, rst);
spin_unlock_irqrestore(reset->lock, flags);
return ret;
}
static int visconti_reset_reset(struct reset_controller_dev *rcdev, unsigned long id)
{
visconti_reset_assert(rcdev, id);
udelay(1);
visconti_reset_deassert(rcdev, id);
return 0;
}
static int visconti_reset_status(struct reset_controller_dev *rcdev, unsigned long id)
{
struct visconti_reset *reset = to_visconti_reset(rcdev);
const struct visconti_reset_data *data = &reset->resets[id];
unsigned long flags;
u32 reg;
int ret;
spin_lock_irqsave(reset->lock, flags);
ret = regmap_read(reset->regmap, data->rson_offset, ®);
spin_unlock_irqrestore(reset->lock, flags);
if (ret)
return ret;
return !(reg & data->rs_idx);
}
const struct reset_control_ops visconti_reset_ops = {
.assert = visconti_reset_assert,
.deassert = visconti_reset_deassert,
.reset = visconti_reset_reset,
.status = visconti_reset_status,
};
int visconti_register_reset_controller(struct device *dev,
struct regmap *regmap,
const struct visconti_reset_data *resets,
unsigned int num_resets,
const struct reset_control_ops *reset_ops,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/mfd/syscon.h`, `linux/regmap.h`, `linux/slab.h`, `reset.h`.
- Detected declarations: `function Copyright`, `function visconti_reset_assert`, `function visconti_reset_deassert`, `function visconti_reset_reset`, `function visconti_reset_status`, `function visconti_register_reset_controller`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.