drivers/mtd/nand/raw/ingenic/jz4725b_bch.c
Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/ingenic/jz4725b_bch.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/nand/raw/ingenic/jz4725b_bch.c- Extension
.c- Size
- 7319 bytes
- Lines
- 296
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/device.hlinux/io.hlinux/iopoll.hlinux/module.hlinux/mutex.hlinux/of_platform.hlinux/platform_device.hingenic_ecc.h
Detected Declarations
function Copyrightfunction jz4725b_bch_config_clearfunction jz4725b_bch_resetfunction jz4725b_bch_disablefunction jz4725b_bch_write_datafunction jz4725b_bch_read_parityfunction jz4725b_bch_wait_completefunction jz4725b_calculatefunction jz4725b_correct
Annotated Snippet
if (i & 1) {
bit = (reg & BCH_BHERR_INDEX1_MASK) >> BCH_BHERR_INDEX1_SHIFT;
} else {
reg = readl(bch->base + BCH_BHERR0 + (i * 4));
bit = (reg & BCH_BHERR_INDEX0_MASK) >> BCH_BHERR_INDEX0_SHIFT;
}
buf[(bit >> 3)] ^= BIT(bit & 0x7);
}
out:
jz4725b_bch_disable(bch);
mutex_unlock(&bch->lock);
return ret;
}
static const struct ingenic_ecc_ops jz4725b_bch_ops = {
.disable = jz4725b_bch_disable,
.calculate = jz4725b_calculate,
.correct = jz4725b_correct,
};
static const struct of_device_id jz4725b_bch_dt_match[] = {
{ .compatible = "ingenic,jz4725b-bch", .data = &jz4725b_bch_ops },
{},
};
MODULE_DEVICE_TABLE(of, jz4725b_bch_dt_match);
static struct platform_driver jz4725b_bch_driver = {
.probe = ingenic_ecc_probe,
.driver = {
.name = "jz4725b-bch",
.of_match_table = jz4725b_bch_dt_match,
},
};
module_platform_driver(jz4725b_bch_driver);
MODULE_AUTHOR("Paul Cercueil <paul@crapouillou.net>");
MODULE_DESCRIPTION("Ingenic JZ4725B BCH controller driver");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/device.h`, `linux/io.h`, `linux/iopoll.h`, `linux/module.h`, `linux/mutex.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function jz4725b_bch_config_clear`, `function jz4725b_bch_reset`, `function jz4725b_bch_disable`, `function jz4725b_bch_write_data`, `function jz4725b_bch_read_parity`, `function jz4725b_bch_wait_complete`, `function jz4725b_calculate`, `function jz4725b_correct`.
- Atlas domain: Driver Families / drivers/mtd.
- 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.