drivers/mtd/nand/raw/arasan-nand-controller.c
Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/arasan-nand-controller.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/nand/raw/arasan-nand-controller.c- Extension
.c- Size
- 40133 bytes
- Lines
- 1519
- 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/bch.hlinux/bitfield.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/gpio/consumer.hlinux/interrupt.hlinux/iopoll.hlinux/module.hlinux/mtd/mtd.hlinux/mtd/partitions.hlinux/mtd/rawnand.hlinux/of.hlinux/platform_device.hlinux/slab.h
Detected Declarations
struct anfc_opstruct anandstruct arasan_nfcfunction anfc_wait_for_eventfunction anfc_wait_for_rbfunction anfc_trigger_opfunction anfc_pkt_len_configfunction anfc_is_gpio_csfunction anfc_relative_to_absolute_csfunction anfc_assert_csfunction anfc_select_targetfunction anfc_read_page_hw_eccfunction anfc_sel_read_page_hw_eccfunction anfc_write_page_hw_eccfunction anfc_sel_write_page_hw_eccfunction anfc_parse_instructionsfunction anfc_rw_pio_opfunction anfc_misc_data_type_execfunction anfc_param_read_type_execfunction anfc_data_read_type_execfunction anfc_param_write_type_execfunction anfc_data_write_type_execfunction anfc_misc_zerolen_type_execfunction anfc_status_type_execfunction anfc_reset_type_execfunction anfc_erase_type_execfunction anfc_wait_type_execfunction anfc_check_opfunction anfc_exec_opfunction anfc_setup_interfacefunction anfc_calc_hw_ecc_bytesfunction anfc_init_hw_ecc_controllerfunction anfc_attach_chipfunction anfc_detach_chipfunction anfc_chip_initfunction anfc_chips_cleanupfunction list_for_each_entry_safefunction anfc_chips_initfunction for_each_child_of_node_scopedfunction anfc_resetfunction anfc_parse_csfunction anfc_probefunction anfc_remove
Annotated Snippet
struct anfc_op {
u32 pkt_reg;
u32 addr1_reg;
u32 addr2_reg;
u32 cmd_reg;
u32 prog_reg;
int steps;
unsigned int rdy_timeout_ms;
unsigned int len;
bool read;
u8 *buf;
};
/**
* struct anand - Defines the NAND chip related information
* @node: Used to store NAND chips into a list
* @chip: NAND chip information structure
* @rb: Ready-busy line
* @page_sz: Register value of the page_sz field to use
* @clk: Expected clock frequency to use
* @data_iface: Data interface timing mode to use
* @timings: NV-DDR specific timings to use
* @ecc_conf: Hardware ECC configuration value
* @strength: Register value of the ECC strength
* @raddr_cycles: Row address cycle information
* @caddr_cycles: Column address cycle information
* @ecc_bits: Exact number of ECC bits per syndrome
* @ecc_total: Total number of ECC bytes
* @errloc: Array of errors located with soft BCH
* @hw_ecc: Buffer to store syndromes computed by hardware
* @bch: BCH structure
* @cs_idx: Array of chip-select for this device, values are indexes
* of the controller structure @gpio_cs array
* @ncs_idx: Size of the @cs_idx array
*/
struct anand {
struct list_head node;
struct nand_chip chip;
unsigned int rb;
unsigned int page_sz;
unsigned long clk;
u32 data_iface;
u32 timings;
u32 ecc_conf;
u32 strength;
u16 raddr_cycles;
u16 caddr_cycles;
unsigned int ecc_bits;
unsigned int ecc_total;
unsigned int *errloc;
u8 *hw_ecc;
struct bch_control *bch;
int *cs_idx;
int ncs_idx;
};
/**
* struct arasan_nfc - Defines the Arasan NAND flash controller driver instance
* @dev: Pointer to the device structure
* @base: Remapped register area
* @controller_clk: Pointer to the system clock
* @bus_clk: Pointer to the flash clock
* @controller: Base controller structure
* @chips: List of all NAND chips attached to the controller
* @cur_clk: Current clock rate
* @cs_array: CS array. Native CS are left empty, the other cells are
* populated with their corresponding GPIO descriptor.
* @ncs: Size of @cs_array
* @cur_cs: Index in @cs_array of the currently in use CS
* @native_cs: Currently selected native CS
* @spare_cs: Native CS that is not wired (may be selected when a GPIO
* CS is in use)
*/
struct arasan_nfc {
struct device *dev;
void __iomem *base;
struct clk *controller_clk;
struct clk *bus_clk;
struct nand_controller controller;
struct list_head chips;
unsigned int cur_clk;
struct gpio_desc **cs_array;
unsigned int ncs;
int cur_cs;
unsigned int native_cs;
unsigned int spare_cs;
};
static struct anand *to_anand(struct nand_chip *nand)
{
Annotation
- Immediate include surface: `linux/bch.h`, `linux/bitfield.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/iopoll.h`.
- Detected declarations: `struct anfc_op`, `struct anand`, `struct arasan_nfc`, `function anfc_wait_for_event`, `function anfc_wait_for_rb`, `function anfc_trigger_op`, `function anfc_pkt_len_config`, `function anfc_is_gpio_cs`, `function anfc_relative_to_absolute_cs`, `function anfc_assert_cs`.
- 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.