1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// 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 <linux/mtd/partitions.h>
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
|