// SPDX-License-Identifier: GPL-2.0-or-later /* * Support for Digigram AlpX PCI-e boards * * Copyright (c) 2024 Digigram Digital (info@digigram.com) */ #ifndef _ALPX_MTD_H #define _ALPX_MTD_H #include "alpx.h" #include "alpx_proc.h" #include int alpx_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int alpx_mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); int alpx_mtd_probe(struct alpx_device *alpx_dev, const struct mtd_partition* partitions, u32 partitions_size); int alpx_mtd_remove(struct alpx_device *alpx_dev); /* Check validity of PRODUCTION area in Golden Region : Serial Number set */ int alpx_mtd_is_golden_prod_area_valid(struct alpx_device* alpx_dev); /*replicate the USER's Production area into the GOLDEN's Production area */ int alpx_mtd_replicate_prod_area(struct alpx_device* alpx_dev); /* Read lenght Bytes out of the flash FROM to the TO buffer using the SHARED area => length limited*/ int alpx_mtd_read_from(struct alpx_device* alpx_dev, uint32_t from, unsigned char* to, unsigned int length); /* Load the SHARED Area with Flash data "from" , NOT MT safe */ int alpx_mtd_load_shared_from(struct alpx_device* alpx_dev, uint32_t from); /* Read Shared Area "at" to for "length" bytes NOT MT safe */ int alpx_mtd_read_shared(struct alpx_device* alpx_dev, uint32_t at, unsigned char* to, unsigned int length); /* Clean the Shared Area NOT MT safe */ int alpx_mtd_clean_shared(struct alpx_device* alpx_dev); /* return true if the MTD is availble for the given device */ int alpx_mtd_is_available(struct alpx_device* alpx_dev); #endif