drivers/mtd/nand/raw/ingenic/ingenic_ecc.h

Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/ingenic/ingenic_ecc.h

File Facts

System
Linux kernel
Corpus path
drivers/mtd/nand/raw/ingenic/ingenic_ecc.h
Extension
.h
Size
2124 bytes
Lines
84
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ingenic_ecc_params {
	int size;
	int bytes;
	int strength;
};

#if IS_ENABLED(CONFIG_MTD_NAND_INGENIC_ECC)
int ingenic_ecc_calculate(struct ingenic_ecc *ecc,
			  struct ingenic_ecc_params *params,
			  const u8 *buf, u8 *ecc_code);
int ingenic_ecc_correct(struct ingenic_ecc *ecc,
			struct ingenic_ecc_params *params, u8 *buf,
			u8 *ecc_code);

void ingenic_ecc_release(struct ingenic_ecc *ecc);
struct ingenic_ecc *of_ingenic_ecc_get(struct device_node *np);
#else /* CONFIG_MTD_NAND_INGENIC_ECC */
static inline int ingenic_ecc_calculate(struct ingenic_ecc *ecc,
			  struct ingenic_ecc_params *params,
			  const u8 *buf, u8 *ecc_code)
{
	return -ENODEV;
}

static inline int ingenic_ecc_correct(struct ingenic_ecc *ecc,
			struct ingenic_ecc_params *params, u8 *buf,
			u8 *ecc_code)
{
	return -ENODEV;
}

static inline void ingenic_ecc_release(struct ingenic_ecc *ecc)
{
}

static inline struct ingenic_ecc *of_ingenic_ecc_get(struct device_node *np)
{
	return ERR_PTR(-ENODEV);
}
#endif /* CONFIG_MTD_NAND_INGENIC_ECC */

struct ingenic_ecc_ops {
	void (*disable)(struct ingenic_ecc *ecc);
	int (*calculate)(struct ingenic_ecc *ecc,
			 struct ingenic_ecc_params *params,
			 const u8 *buf, u8 *ecc_code);
	int (*correct)(struct ingenic_ecc *ecc,
			struct ingenic_ecc_params *params,
			u8 *buf, u8 *ecc_code);
};

struct ingenic_ecc {
	struct device *dev;
	const struct ingenic_ecc_ops *ops;
	void __iomem *base;
	struct clk *clk;
	struct mutex lock;
};

int ingenic_ecc_probe(struct platform_device *pdev);

#endif /* __DRIVERS_MTD_NAND_INGENIC_ECC_INTERNAL_H__ */

Annotation

Implementation Notes