drivers/mtd/nand/raw/au1550nd.c
Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/au1550nd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/nand/raw/au1550nd.c- Extension
.c- Size
- 8304 bytes
- Lines
- 368
- 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.
- 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/slab.hlinux/module.hlinux/interrupt.hlinux/mtd/mtd.hlinux/mtd/rawnand.hlinux/mtd/partitions.hlinux/platform_device.hasm/io.hasm/mach-au1x00/au1000.hasm/mach-au1x00/au1550nd.h
Detected Declarations
struct au1550nd_ctxfunction au_write_buffunction au_read_buffunction au_write_buf16function au_read_buf16function find_nand_csfunction au1550nd_waitrdyfunction au1550nd_exec_instrfunction au1550nd_exec_opfunction au1550nd_attach_chipfunction au1550nd_probefunction au1550nd_remove
Annotated Snippet
struct au1550nd_ctx {
struct nand_controller controller;
struct nand_chip chip;
int cs;
void __iomem *base;
};
static struct au1550nd_ctx *chip_to_au_ctx(struct nand_chip *this)
{
return container_of(this, struct au1550nd_ctx, chip);
}
/**
* au_write_buf - write buffer to chip
* @this: NAND chip object
* @buf: data buffer
* @len: number of bytes to write
*
* write function for 8bit buswidth
*/
static void au_write_buf(struct nand_chip *this, const void *buf,
unsigned int len)
{
struct au1550nd_ctx *ctx = chip_to_au_ctx(this);
const u8 *p = buf;
int i;
for (i = 0; i < len; i++) {
writeb(p[i], ctx->base + MEM_STNAND_DATA);
wmb(); /* drain writebuffer */
}
}
/**
* au_read_buf - read chip data into buffer
* @this: NAND chip object
* @buf: buffer to store date
* @len: number of bytes to read
*
* read function for 8bit buswidth
*/
static void au_read_buf(struct nand_chip *this, void *buf,
unsigned int len)
{
struct au1550nd_ctx *ctx = chip_to_au_ctx(this);
u8 *p = buf;
int i;
for (i = 0; i < len; i++) {
p[i] = readb(ctx->base + MEM_STNAND_DATA);
wmb(); /* drain writebuffer */
}
}
/**
* au_write_buf16 - write buffer to chip
* @this: NAND chip object
* @buf: data buffer
* @len: number of bytes to write
*
* write function for 16bit buswidth
*/
static void au_write_buf16(struct nand_chip *this, const void *buf,
unsigned int len)
{
struct au1550nd_ctx *ctx = chip_to_au_ctx(this);
const u16 *p = buf;
unsigned int i;
len >>= 1;
for (i = 0; i < len; i++) {
writew(p[i], ctx->base + MEM_STNAND_DATA);
wmb(); /* drain writebuffer */
}
}
/**
* au_read_buf16 - read chip data into buffer
* @this: NAND chip object
* @buf: buffer to store date
* @len: number of bytes to read
*
* read function for 16bit buswidth
*/
static void au_read_buf16(struct nand_chip *this, void *buf, unsigned int len)
{
struct au1550nd_ctx *ctx = chip_to_au_ctx(this);
unsigned int i;
u16 *p = buf;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/slab.h`, `linux/module.h`, `linux/interrupt.h`, `linux/mtd/mtd.h`, `linux/mtd/rawnand.h`, `linux/mtd/partitions.h`, `linux/platform_device.h`.
- Detected declarations: `struct au1550nd_ctx`, `function au_write_buf`, `function au_read_buf`, `function au_write_buf16`, `function au_read_buf16`, `function find_nand_cs`, `function au1550nd_waitrdy`, `function au1550nd_exec_instr`, `function au1550nd_exec_op`, `function au1550nd_attach_chip`.
- Atlas domain: Driver Families / drivers/mtd.
- Implementation status: source implementation candidate.
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.