@@ -1160,9 +1160,16 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
1160
1160
return status ;
1161
1161
}
1162
1162
1163
- static bool nand_supports_set_get_features (struct nand_chip * chip )
1163
+ static bool nand_supports_get_features (struct nand_chip * chip , int addr )
1164
1164
{
1165
- return chip -> parameters .supports_set_get_features ;
1165
+ return (chip -> parameters .supports_set_get_features &&
1166
+ test_bit (addr , chip -> parameters .get_feature_list ));
1167
+ }
1168
+
1169
+ static bool nand_supports_set_features (struct nand_chip * chip , int addr )
1170
+ {
1171
+ return (chip -> parameters .supports_set_get_features &&
1172
+ test_bit (addr , chip -> parameters .set_feature_list ));
1166
1173
}
1167
1174
1168
1175
/**
@@ -1179,7 +1186,7 @@ int nand_get_features(struct nand_chip *chip, int addr,
1179
1186
{
1180
1187
struct mtd_info * mtd = nand_to_mtd (chip );
1181
1188
1182
- if (!nand_supports_set_get_features (chip ))
1189
+ if (!nand_supports_get_features (chip , addr ))
1183
1190
return - ENOTSUPP ;
1184
1191
1185
1192
return chip -> get_features (mtd , chip , addr , subfeature_param );
@@ -1200,7 +1207,7 @@ int nand_set_features(struct nand_chip *chip, int addr,
1200
1207
{
1201
1208
struct mtd_info * mtd = nand_to_mtd (chip );
1202
1209
1203
- if (!nand_supports_set_get_features (chip ))
1210
+ if (!nand_supports_set_features (chip , addr ))
1204
1211
return - ENOTSUPP ;
1205
1212
1206
1213
return chip -> set_features (mtd , chip , addr , subfeature_param );
@@ -1271,7 +1278,7 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
1271
1278
return 0 ;
1272
1279
1273
1280
/* Change the mode on the chip side (if supported by the NAND chip) */
1274
- if (nand_supports_set_get_features (chip )) {
1281
+ if (nand_supports_set_features (chip , ONFI_FEATURE_ADDR_TIMING_MODE )) {
1275
1282
chip -> select_chip (mtd , chipnr );
1276
1283
ret = nand_set_features (chip , ONFI_FEATURE_ADDR_TIMING_MODE ,
1277
1284
tmode_param );
@@ -1286,7 +1293,7 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
1286
1293
return ret ;
1287
1294
1288
1295
/* Check the mode has been accepted by the chip, if supported */
1289
- if (!nand_supports_set_get_features (chip ))
1296
+ if (!nand_supports_get_features (chip , ONFI_FEATURE_ADDR_TIMING_MODE ))
1290
1297
return 0 ;
1291
1298
1292
1299
memset (tmode_param , 0 , ONFI_SUBFEATURE_PARAM_LEN );
@@ -5192,8 +5199,13 @@ static int nand_flash_detect_onfi(struct nand_chip *chip)
5192
5199
}
5193
5200
5194
5201
/* Save some parameters from the parameter page for future use */
5195
- if (le16_to_cpu (p -> opt_cmd ) & ONFI_OPT_CMD_SET_GET_FEATURES )
5202
+ if (le16_to_cpu (p -> opt_cmd ) & ONFI_OPT_CMD_SET_GET_FEATURES ) {
5196
5203
chip -> parameters .supports_set_get_features = true;
5204
+ bitmap_set (chip -> parameters .get_feature_list ,
5205
+ ONFI_FEATURE_ADDR_TIMING_MODE , 1 );
5206
+ bitmap_set (chip -> parameters .set_feature_list ,
5207
+ ONFI_FEATURE_ADDR_TIMING_MODE , 1 );
5208
+ }
5197
5209
chip -> parameters .onfi .tPROG = le16_to_cpu (p -> t_prog );
5198
5210
chip -> parameters .onfi .tBERS = le16_to_cpu (p -> t_bers );
5199
5211
chip -> parameters .onfi .tR = le16_to_cpu (p -> t_r );
0 commit comments