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 #ifndef ATMEL_PMECC_H
35 #define ATMEL_PMECC_H
36
37 #define ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH 0
38 #define ATMEL_PMECC_SECTOR_SIZE_AUTO 0
39 #define ATMEL_PMECC_OOBOFFSET_AUTO -1
40
41 struct atmel_pmecc_user_req {
42 int pagesize;
43 int oobsize;
44 struct {
45 int strength;
46 int bytes;
47 int sectorsize;
48 int nsectors;
49 int ooboffset;
50 } ecc;
51 };
52
53 struct atmel_pmecc *devm_atmel_pmecc_get(struct device *dev);
54
55 struct atmel_pmecc_user *
56 atmel_pmecc_create_user(struct atmel_pmecc *pmecc,
57 struct atmel_pmecc_user_req *req);
58 void atmel_pmecc_destroy_user(struct atmel_pmecc_user *user);
59
60 void atmel_pmecc_reset(struct atmel_pmecc *pmecc);
61 int atmel_pmecc_enable(struct atmel_pmecc_user *user, int op);
62 void atmel_pmecc_disable(struct atmel_pmecc_user *user);
63 int atmel_pmecc_wait_rdy(struct atmel_pmecc_user *user);
64 int atmel_pmecc_correct_sector(struct atmel_pmecc_user *user, int sector,
65 void *data, void *ecc);
66 bool atmel_pmecc_correct_erased_chunks(struct atmel_pmecc_user *user);
67 void atmel_pmecc_get_generated_eccbytes(struct atmel_pmecc_user *user,
68 int sector, void *ecc);
69
70 #endif