@@ -266,8 +266,8 @@ int QSPIFBlockDevice::init()
266
266
if ((_sfdp_info.smtbl .addr != 0 ) && (0 != _sfdp_info.smtbl .size )) {
267
267
tr_debug (" Init - Parsing Sector Map Table - addr: 0x%lxh, Size: %d" , _sfdp_info.smtbl .addr ,
268
268
_sfdp_info.smtbl .size );
269
- if (_sfdp_parse_sector_map_table (callback (this , &QSPIFBlockDevice::_qspi_send_read_sfdp_command),
270
- _sfdp_info.smtbl ) < 0 ) {
269
+ if (sfdp_parse_sector_map_table (callback (this , &QSPIFBlockDevice::_qspi_send_read_sfdp_command),
270
+ _sfdp_info.smtbl ) < 0 ) {
271
271
tr_error (" Init - Parse Sector Map Table Failed" );
272
272
status = QSPIF_BD_ERROR_PARSING_FAILED;
273
273
goto exit_point;
@@ -1107,65 +1107,6 @@ int QSPIFBlockDevice::_sfdp_detect_reset_protocol_and_reset(uint8_t *basic_param
1107
1107
return status;
1108
1108
}
1109
1109
1110
- int QSPIFBlockDevice::_sfdp_parse_sector_map_table (Callback<int (bd_addr_t , void *, bd_size_t )> sfdp_reader,
1111
- sfdp_smtbl_info &smtbl)
1112
- {
1113
- uint8_t sector_map_table[SFDP_BASIC_PARAMS_TBL_SIZE]; /* Up To 20 DWORDS = 80 Bytes */
1114
- uint32_t tmp_region_size = 0 ;
1115
- int i_ind = 0 ;
1116
- int prev_boundary = 0 ;
1117
- // Default set to all type bits 1-4 are common
1118
- int min_common_erase_type_bits = SFDP_ERASE_BITMASK_ALL;
1119
-
1120
- int status = sfdp_reader (smtbl.addr , sector_map_table, smtbl.size );
1121
- if (status < 0 ) {
1122
- tr_error (" table retrieval failed" );
1123
- return -1 ;
1124
- }
1125
-
1126
- // Currently we support only Single Map Descriptor
1127
- if (!((sector_map_table[0 ] & 0x3 ) == 0x03 ) && (sector_map_table[1 ] == 0x0 )) {
1128
- tr_error (" Sector Map - Supporting Only Single! Map Descriptor (not map commands)" );
1129
- return -1 ;
1130
- }
1131
-
1132
- smtbl.region_cnt = sector_map_table[2 ] + 1 ;
1133
- if (smtbl.region_cnt > SFDP_SECTOR_MAP_MAX_REGIONS) {
1134
- tr_error (" Supporting up to %d regions, current setup to %d regions - fail" ,
1135
- SFDP_SECTOR_MAP_MAX_REGIONS,
1136
- smtbl.regions_count );
1137
- return -1 ;
1138
- }
1139
-
1140
- // Loop through Regions and set for each one: size, supported erase types, high boundary offset
1141
- // Calculate minimum Common Erase Type for all Regions
1142
- for (i_ind = 0 ; i_ind < smtbl.region_cnt ; i_ind++) {
1143
- tmp_region_size = ((*((uint32_t *)§or_map_table[(i_ind + 1 ) * 4 ])) >> 8 ) & 0x00FFFFFF ; // bits 9-32
1144
- smtbl.region_size [i_ind] = (tmp_region_size + 1 ) * 256 ; // Region size is 0 based multiple of 256 bytes;
1145
- smtbl.region_erase_types_bitfld [i_ind] = sector_map_table[(i_ind + 1 ) * 4 ] & 0x0F ; // bits 1-4
1146
- min_common_erase_type_bits &= smtbl.region_erase_types_bitfld [i_ind];
1147
- smtbl.region_high_boundary [i_ind] = (smtbl.region_size [i_ind] - 1 ) + prev_boundary;
1148
- prev_boundary = smtbl.region_high_boundary [i_ind] + 1 ;
1149
- }
1150
-
1151
- // Calc minimum Common Erase Size from min_common_erase_type_bits
1152
- uint8_t type_mask = SFDP_ERASE_BITMASK_TYPE1;
1153
- for (i_ind = 0 ; i_ind < 4 ; i_ind++) {
1154
- if (min_common_erase_type_bits & type_mask) {
1155
- smtbl.regions_min_common_erase_size = smtbl.erase_type_size_arr [i_ind];
1156
- break ;
1157
- }
1158
- type_mask = type_mask << 1 ;
1159
- }
1160
-
1161
- if (i_ind == 4 ) {
1162
- // No common erase type was found between regions
1163
- smtbl.regions_min_common_erase_size = 0 ;
1164
- }
1165
-
1166
- return 0 ;
1167
- }
1168
-
1169
1110
int QSPIFBlockDevice::_handle_vendor_quirks ()
1170
1111
{
1171
1112
uint8_t vendor_device_ids[QSPI_RDID_DATA_LENGTH] = {0 };
0 commit comments