FreeCalypso > hg > freecalypso-sw
annotate loadtools/flash.h @ 401:7ceeec049be4
fc-loadtool flash: bank configurations for CFI
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 15 Jun 2014 20:24:51 +0000 |
parents | f027c6fbe37e |
children | a212b4968b29 |
rev | line source |
---|---|
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* this header file contains definitions for fc-loadtool flash support */ |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 /* |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * The following structures represent an "abstract" |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * description of flash devices. |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * A "region" is a consecutive group of erase units of the same size. |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 */ |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 struct flash_region_desc { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 uint32_t sector_size; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 unsigned nsectors; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
15 #define CFI_MAX_REGIONS 4 |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
16 |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
17 /* The info in struct cfi_info can be either gathered from CFI or hard-coded. */ |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
18 struct cfi_info { |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
19 uint16_t cmdset_style; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
20 uint32_t total_size; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
21 unsigned nregions; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
22 struct flash_region_desc regions[CFI_MAX_REGIONS]; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
23 unsigned total_sectors; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
24 }; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
25 |
203
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
26 struct flash_idcheck { |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
27 uint16_t offset; |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
28 uint16_t expect_val; |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
29 }; |
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
30 |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 struct flash_bank_desc { |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
32 uint32_t align_size; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
33 struct cfi_info *hard_cfi; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
34 struct flash_idcheck *idcheck_table; |
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
35 unsigned idcheck_num; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 struct flash_device_desc { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 char *name; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 struct flash_bank_desc *bank_desc; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 unsigned nbanks; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 /* the following structures describe flash banks as accessible to us */ |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 struct sector_info { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 uint32_t start; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 uint32_t size; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 }; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 struct flash_bank_info { |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 uint32_t base_addr; |
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 struct flash_bank_desc *bank_desc; |
400
f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
203
diff
changeset
|
54 struct cfi_info *cfi; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 struct sector_info *sectors; |
203
99c234bf6a9b
fc-loadtool flash ID check: definitions created
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
55
diff
changeset
|
56 int idcheck_done; |
55
278052b6afda
loadtools: started laying the foundation for flash support
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 }; |