drivers/mtd/nand/raw/rockchip-nand-controller.c
Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/rockchip-nand-controller.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/nand/raw/rockchip-nand-controller.c- Extension
.c- Size
- 38359 bytes
- Lines
- 1508
- Domain
- Driver Families
- Bucket
- drivers/mtd
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/delay.hlinux/dma-mapping.hlinux/dmaengine.hlinux/interrupt.hlinux/iopoll.hlinux/module.hlinux/mtd/mtd.hlinux/mtd/rawnand.hlinux/of.hlinux/platform_device.hlinux/slab.h
Detected Declarations
struct rk_ecc_cnt_statusstruct nfc_cfgstruct rk_nfc_nand_chipstruct rk_nfcenum nfc_typefunction rk_nfc_data_lenfunction rk_nfc_hw_ecc_setupfunction rk_nfc_select_chipfunction rk_nfc_wait_ioreadyfunction rk_nfc_read_buffunction rk_nfc_write_buffunction rk_nfc_cmdfunction rk_nfc_exec_opfunction rk_nfc_setup_interfacefunction rk_nfc_xfer_startfunction rk_nfc_wait_for_xfer_donefunction rk_nfc_write_page_rawfunction rk_nfc_write_page_hweccfunction blocksfunction rk_nfc_write_oobfunction rk_nfc_read_page_rawfunction rk_nfc_read_page_hweccfunction blocksfunction rk_nfc_read_oobfunction rk_nfc_hw_initfunction rk_nfc_irqfunction rk_nfc_enable_clksfunction rk_nfc_disable_clksfunction rk_nfc_ooblayout_freefunction rk_nfc_ooblayout_eccfunction rk_nfc_ecc_initfunction rk_nfc_attach_chipfunction rk_nfc_nand_chip_initfunction rk_nfc_chips_cleanupfunction list_for_each_entry_safefunction rk_nfc_nand_chips_initfunction for_each_child_of_node_scopedfunction rk_nfc_probefunction rk_nfc_removefunction rk_nfc_suspendfunction rk_nfc_resume
Annotated Snippet
struct rk_ecc_cnt_status {
u8 err_flag_bit;
u8 low;
u8 low_mask;
u8 low_bn;
u8 high;
u8 high_mask;
};
/**
* struct nfc_cfg: Rockchip NAND controller configuration
* @type: NFC version
* @ecc_strengths: ECC strengths
* @ecc_cfgs: ECC config values
* @flctl_off: FLCTL register offset
* @bchctl_off: BCHCTL register offset
* @dma_data_buf_off: DMA_DATA_BUF register offset
* @dma_oob_buf_off: DMA_OOB_BUF register offset
* @dma_cfg_off: DMA_CFG register offset
* @dma_st_off: DMA_ST register offset
* @bch_st_off: BCG_ST register offset
* @randmz_off: RANDMZ register offset
* @int_en_off: interrupt enable register offset
* @int_clr_off: interrupt clean register offset
* @int_st_off: interrupt status register offset
* @oob0_off: oob0 register offset
* @oob1_off: oob1 register offset
* @ecc0: represent ECC0 status data
* @ecc1: represent ECC1 status data
*/
struct nfc_cfg {
enum nfc_type type;
u8 ecc_strengths[NFC_ECC_MAX_MODES];
u32 ecc_cfgs[NFC_ECC_MAX_MODES];
u32 flctl_off;
u32 bchctl_off;
u32 dma_cfg_off;
u32 dma_data_buf_off;
u32 dma_oob_buf_off;
u32 dma_st_off;
u32 bch_st_off;
u32 randmz_off;
u32 int_en_off;
u32 int_clr_off;
u32 int_st_off;
u32 oob0_off;
u32 oob1_off;
struct rk_ecc_cnt_status ecc0;
struct rk_ecc_cnt_status ecc1;
};
struct rk_nfc_nand_chip {
struct list_head node;
struct nand_chip chip;
u16 boot_blks;
u16 metadata_size;
u32 boot_ecc;
u32 timing;
u8 nsels;
u8 sels[] __counted_by(nsels);
};
struct rk_nfc {
struct nand_controller controller;
const struct nfc_cfg *cfg;
struct device *dev;
struct clk *nfc_clk;
struct clk *ahb_clk;
void __iomem *regs;
u32 selected_bank;
u32 band_offset;
u32 cur_ecc;
u32 cur_timing;
struct completion done;
struct list_head chips;
u8 *page_buf;
u32 *oob_buf;
u32 page_buf_size;
u32 oob_buf_size;
unsigned long assigned_cs;
};
static inline struct rk_nfc_nand_chip *rk_nfc_to_rknand(struct nand_chip *chip)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/interrupt.h`, `linux/iopoll.h`, `linux/module.h`, `linux/mtd/mtd.h`.
- Detected declarations: `struct rk_ecc_cnt_status`, `struct nfc_cfg`, `struct rk_nfc_nand_chip`, `struct rk_nfc`, `enum nfc_type`, `function rk_nfc_data_len`, `function rk_nfc_hw_ecc_setup`, `function rk_nfc_select_chip`, `function rk_nfc_wait_ioready`, `function rk_nfc_read_buf`.
- Atlas domain: Driver Families / drivers/mtd.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.