drivers/reset/reset-k230.c
Source file repositories/reference/linux-study-clean/drivers/reset/reset-k230.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/reset-k230.c- Extension
.c- Size
- 12966 bytes
- Lines
- 372
- 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.
- 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/cleanup.hlinux/delay.hlinux/io.hlinux/iopoll.hlinux/of.hlinux/platform_device.hlinux/reset-controller.hlinux/spinlock.hdt-bindings/reset/canaan,k230-rst.h
Detected Declarations
struct k230_rst_mapstruct k230_rstenum k230_rst_typefunction k230_rst_clear_donefunction k230_rst_wait_and_clear_donefunction k230_rst_updatefunction k230_rst_assertfunction k230_rst_deassertfunction k230_rst_resetfunction k230_rst_probe
Annotated Snippet
struct k230_rst_map {
u32 offset;
enum k230_rst_type type;
u32 done;
u32 reset;
};
struct k230_rst {
struct reset_controller_dev rcdev;
void __iomem *base;
/* protect register read-modify-write */
spinlock_t lock;
};
static const struct k230_rst_map k230_resets[] = {
[RST_CPU0] = { 0x4, RST_TYPE_CPU0, BIT(12), BIT(0) },
[RST_CPU1] = { 0xc, RST_TYPE_CPU1, BIT(12), BIT(0) },
[RST_CPU0_FLUSH] = { 0x4, RST_TYPE_FLUSH, 0, BIT(4) },
[RST_CPU1_FLUSH] = { 0xc, RST_TYPE_FLUSH, 0, BIT(4) },
[RST_AI] = { 0x14, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_VPU] = { 0x1c, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_HISYS] = { 0x2c, RST_TYPE_HW_DONE, BIT(4), BIT(0) },
[RST_HISYS_AHB] = { 0x2c, RST_TYPE_HW_DONE, BIT(5), BIT(1) },
[RST_SDIO0] = { 0x34, RST_TYPE_HW_DONE, BIT(28), BIT(0) },
[RST_SDIO1] = { 0x34, RST_TYPE_HW_DONE, BIT(29), BIT(1) },
[RST_SDIO_AXI] = { 0x34, RST_TYPE_HW_DONE, BIT(30), BIT(2) },
[RST_USB0] = { 0x3c, RST_TYPE_HW_DONE, BIT(28), BIT(0) },
[RST_USB1] = { 0x3c, RST_TYPE_HW_DONE, BIT(29), BIT(1) },
[RST_USB0_AHB] = { 0x3c, RST_TYPE_HW_DONE, BIT(30), BIT(0) },
[RST_USB1_AHB] = { 0x3c, RST_TYPE_HW_DONE, BIT(31), BIT(1) },
[RST_SPI0] = { 0x44, RST_TYPE_HW_DONE, BIT(28), BIT(0) },
[RST_SPI1] = { 0x44, RST_TYPE_HW_DONE, BIT(29), BIT(1) },
[RST_SPI2] = { 0x44, RST_TYPE_HW_DONE, BIT(30), BIT(2) },
[RST_SEC] = { 0x4c, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_PDMA] = { 0x54, RST_TYPE_HW_DONE, BIT(28), BIT(0) },
[RST_SDMA] = { 0x54, RST_TYPE_HW_DONE, BIT(29), BIT(1) },
[RST_DECOMPRESS] = { 0x5c, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_SRAM] = { 0x64, RST_TYPE_HW_DONE, BIT(28), BIT(0) },
[RST_SHRM_AXIM] = { 0x64, RST_TYPE_HW_DONE, BIT(30), BIT(2) },
[RST_SHRM_AXIS] = { 0x64, RST_TYPE_HW_DONE, BIT(31), BIT(3) },
[RST_NONAI2D] = { 0x6c, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_MCTL] = { 0x74, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_ISP] = { 0x80, RST_TYPE_HW_DONE, BIT(29), BIT(6) },
[RST_ISP_DW] = { 0x80, RST_TYPE_HW_DONE, BIT(28), BIT(5) },
[RST_DPU] = { 0x88, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_DISP] = { 0x90, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_GPU] = { 0x98, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_AUDIO] = { 0xa4, RST_TYPE_HW_DONE, BIT(31), BIT(0) },
[RST_TIMER0] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(0) },
[RST_TIMER1] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(1) },
[RST_TIMER2] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(2) },
[RST_TIMER3] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(3) },
[RST_TIMER4] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(4) },
[RST_TIMER5] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(5) },
[RST_TIMER_APB] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(6) },
[RST_HDI] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(7) },
[RST_WDT0] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(12) },
[RST_WDT1] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(13) },
[RST_WDT0_APB] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(14) },
[RST_WDT1_APB] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(15) },
[RST_TS_APB] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(16) },
[RST_MAILBOX] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(17) },
[RST_STC] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(18) },
[RST_PMU] = { 0x20, RST_TYPE_SW_DONE, 0, BIT(19) },
[RST_LOSYS_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(0) },
[RST_UART0] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(1) },
[RST_UART1] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(2) },
[RST_UART2] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(3) },
[RST_UART3] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(4) },
[RST_UART4] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(5) },
[RST_I2C0] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(6) },
[RST_I2C1] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(7) },
[RST_I2C2] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(8) },
[RST_I2C3] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(9) },
[RST_I2C4] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(10) },
[RST_JAMLINK0_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(11) },
[RST_JAMLINK1_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(12) },
[RST_JAMLINK2_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(13) },
[RST_JAMLINK3_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(14) },
[RST_CODEC_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(17) },
[RST_GPIO_DB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(18) },
[RST_GPIO_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(19) },
[RST_ADC] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(20) },
[RST_ADC_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(21) },
[RST_PWM_APB] = { 0x24, RST_TYPE_SW_DONE, 0, BIT(22) },
[RST_SHRM_APB] = { 0x64, RST_TYPE_SW_DONE, 0, BIT(1) },
[RST_CSI0] = { 0x80, RST_TYPE_SW_DONE, 0, BIT(0) },
[RST_CSI1] = { 0x80, RST_TYPE_SW_DONE, 0, BIT(1) },
[RST_CSI2] = { 0x80, RST_TYPE_SW_DONE, 0, BIT(2) },
[RST_CSI_DPHY] = { 0x80, RST_TYPE_SW_DONE, 0, BIT(3) },
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/delay.h`, `linux/io.h`, `linux/iopoll.h`, `linux/of.h`, `linux/platform_device.h`, `linux/reset-controller.h`, `linux/spinlock.h`.
- Detected declarations: `struct k230_rst_map`, `struct k230_rst`, `enum k230_rst_type`, `function k230_rst_clear_done`, `function k230_rst_wait_and_clear_done`, `function k230_rst_update`, `function k230_rst_assert`, `function k230_rst_deassert`, `function k230_rst_reset`, `function k230_rst_probe`.
- Atlas domain: Driver Families / drivers/reset.
- 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.