@@ -1042,12 +1042,13 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
10421042/**
10431043 * nand_reset_data_interface - Reset data interface and timings
10441044 * @chip: The NAND chip
1045+ * @chipnr: Internal die id
10451046 *
10461047 * Reset the Data interface and timings to ONFI mode 0.
10471048 *
10481049 * Returns 0 for success or negative error code otherwise.
10491050 */
1050- static int nand_reset_data_interface (struct nand_chip * chip )
1051+ static int nand_reset_data_interface (struct nand_chip * chip , int chipnr )
10511052{
10521053 struct mtd_info * mtd = nand_to_mtd (chip );
10531054 const struct nand_data_interface * conf ;
@@ -1071,7 +1072,7 @@ static int nand_reset_data_interface(struct nand_chip *chip)
10711072 */
10721073
10731074 conf = nand_get_default_data_interface ();
1074- ret = chip -> setup_data_interface (mtd , conf , false );
1075+ ret = chip -> setup_data_interface (mtd , chipnr , conf );
10751076 if (ret )
10761077 pr_err ("Failed to configure data interface to SDR timing mode 0\n" );
10771078
@@ -1081,6 +1082,7 @@ static int nand_reset_data_interface(struct nand_chip *chip)
10811082/**
10821083 * nand_setup_data_interface - Setup the best data interface and timings
10831084 * @chip: The NAND chip
1085+ * @chipnr: Internal die id
10841086 *
10851087 * Find and configure the best data interface and NAND timings supported by
10861088 * the chip and the driver.
@@ -1090,7 +1092,7 @@ static int nand_reset_data_interface(struct nand_chip *chip)
10901092 *
10911093 * Returns 0 for success or negative error code otherwise.
10921094 */
1093- static int nand_setup_data_interface (struct nand_chip * chip )
1095+ static int nand_setup_data_interface (struct nand_chip * chip , int chipnr )
10941096{
10951097 struct mtd_info * mtd = nand_to_mtd (chip );
10961098 int ret ;
@@ -1114,7 +1116,7 @@ static int nand_setup_data_interface(struct nand_chip *chip)
11141116 goto err ;
11151117 }
11161118
1117- ret = chip -> setup_data_interface (mtd , chip -> data_interface , false );
1119+ ret = chip -> setup_data_interface (mtd , chipnr , chip -> data_interface );
11181120err :
11191121 return ret ;
11201122}
@@ -1165,8 +1167,10 @@ static int nand_init_data_interface(struct nand_chip *chip)
11651167 if (ret )
11661168 continue ;
11671169
1168- ret = chip -> setup_data_interface (mtd , chip -> data_interface ,
1169- true);
1170+ /* Pass -1 to only */
1171+ ret = chip -> setup_data_interface (mtd ,
1172+ NAND_DATA_IFACE_CHECK_ONLY ,
1173+ chip -> data_interface );
11701174 if (!ret ) {
11711175 chip -> onfi_timing_mode_default = mode ;
11721176 break ;
@@ -1193,7 +1197,7 @@ int nand_reset(struct nand_chip *chip, int chipnr)
11931197 struct mtd_info * mtd = nand_to_mtd (chip );
11941198 int ret ;
11951199
1196- ret = nand_reset_data_interface (chip );
1200+ ret = nand_reset_data_interface (chip , chipnr );
11971201 if (ret )
11981202 return ret ;
11991203
@@ -1206,7 +1210,7 @@ int nand_reset(struct nand_chip *chip, int chipnr)
12061210 chip -> select_chip (mtd , -1 );
12071211
12081212 chip -> select_chip (mtd , chipnr );
1209- ret = nand_setup_data_interface (chip );
1213+ ret = nand_setup_data_interface (chip , chipnr );
12101214 chip -> select_chip (mtd , -1 );
12111215 if (ret )
12121216 return ret ;
@@ -4396,7 +4400,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
43964400 * For the other dies, nand_reset() will automatically switch to the
43974401 * best mode for us.
43984402 */
4399- ret = nand_setup_data_interface (chip );
4403+ ret = nand_setup_data_interface (chip , 0 );
44004404 if (ret )
44014405 return ret ;
44024406
0 commit comments