drivers/mtd/spi-nor/sst.c
Source file repositories/reference/linux-study-clean/drivers/mtd/spi-nor/sst.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/spi-nor/sst.c- Extension
.c- Size
- 6645 bytes
- Lines
- 286
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mtd/spi-nor.hcore.h
Detected Declarations
function Copyrightfunction sst26vf_nor_unlockfunction sst26vf_nor_is_lockedfunction sst26vf_nor_late_initfunction sst_nor_write_datafunction sst_nor_writefunction sst_nor_late_init
Annotated Snippet
if (needs_write_enable) {
ret = spi_nor_write_enable(nor);
if (ret)
goto out;
}
}
/* Write out most of the data here. */
for (; actual < len - 1; actual += 2) {
/* write two bytes. */
ret = sst_nor_write_data(nor, to, 2, buf + actual);
if (ret < 0)
goto out;
to += 2;
nor->sst_write_second = true;
}
nor->sst_write_second = false;
ret = spi_nor_write_disable(nor);
if (ret)
goto out;
ret = spi_nor_wait_till_ready(nor);
if (ret)
goto out;
/* Write out trailing byte if it exists. */
if (actual != len) {
ret = spi_nor_write_enable(nor);
if (ret)
goto out;
ret = sst_nor_write_data(nor, to, 1, buf + actual);
if (ret < 0)
goto out;
actual += 1;
ret = spi_nor_write_disable(nor);
}
out:
*retlen += actual;
spi_nor_unlock_and_unprep(nor);
return ret;
}
static int sst_nor_late_init(struct spi_nor *nor)
{
if (nor->info->mfr_flags & SST_WRITE)
nor->mtd._write = sst_nor_write;
return 0;
}
static const struct spi_nor_fixups sst_nor_fixups = {
.late_init = sst_nor_late_init,
};
const struct spi_nor_manufacturer spi_nor_sst = {
.name = "sst",
.parts = sst_nor_parts,
.nparts = ARRAY_SIZE(sst_nor_parts),
.fixups = &sst_nor_fixups,
};
Annotation
- Immediate include surface: `linux/mtd/spi-nor.h`, `core.h`.
- Detected declarations: `function Copyright`, `function sst26vf_nor_unlock`, `function sst26vf_nor_is_locked`, `function sst26vf_nor_late_init`, `function sst_nor_write_data`, `function sst_nor_write`, `function sst_nor_late_init`.
- 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.