comparison loadtools/flash.h @ 506:0dd2c87c1b63

fc-loadtool flash support overhaul
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 May 2019 05:12:47 +0000
parents e7502631a0f9
children 9c5b0629e346
comparison
equal deleted inserted replaced
505:7bf0d909c87e 506:0dd2c87c1b63
1 /* this header file contains definitions for fc-loadtool flash support */ 1 /* this header file contains definitions for fc-loadtool flash support */
2
3 /* global configuration */
4 #define FLASH_GLOBAL_CFG_NONE 0
5 #define FLASH_GLOBAL_CFG_SINGLE_4M 1
6 #define FLASH_GLOBAL_CFG_SINGLE_8M 2
7 #define FLASH_GLOBAL_CFG_DUAL_8M 3
2 8
3 /* 9 /*
4 * The following structures represent an "abstract" 10 * The following structures represent an "abstract"
5 * description of flash devices. 11 * description of flash devices.
6 * 12 *
23 unsigned nregions; 29 unsigned nregions;
24 struct flash_region_desc regions[CFI_MAX_REGIONS]; 30 struct flash_region_desc regions[CFI_MAX_REGIONS];
25 unsigned total_sectors; 31 unsigned total_sectors;
26 }; 32 };
27 33
28 struct flash_idcheck { 34 struct cfi_check {
29 uint16_t offset; 35 int offset;
30 uint16_t expect_val; 36 uint8_t expect_val;
31 }; 37 };
32 38
33 struct flash_bank_desc { 39 struct flash_device {
34 uint32_t align_size;
35 struct flash_geom *geom;
36 struct flash_idcheck *idcheck_table;
37 unsigned idcheck_num;
38 };
39
40 struct flash_device_desc {
41 char *name; 40 char *name;
42 struct flash_bank_desc *bank_desc; 41 struct cfi_check *cfi_table;
43 unsigned nbanks; 42 int required_global_config;
43 struct flash_geom *bank_geom[2];
44 struct flash_cmdset *cmdset; 44 struct flash_cmdset *cmdset;
45 }; 45 };
46 46
47 /* the following structures describe flash banks as accessible to us */ 47 /* the following structures describe flash banks as accessible to us */
48 48
63 int needs_unlock; 63 int needs_unlock;
64 }; 64 };
65 65
66 struct flash_bank_info { 66 struct flash_bank_info {
67 uint32_t base_addr; 67 uint32_t base_addr;
68 struct flash_bank_desc *bank_desc; 68 struct flash_device *device;
69 struct flash_geom *geom; 69 struct flash_geom *geom;
70 struct flash_cmdset *ops; 70 struct flash_cmdset *ops;
71 struct sector_info *sectors; 71 struct sector_info *sectors;
72 int idcheck_done; 72 int detect_done;
73 }; 73 };