@@ -347,17 +347,17 @@ static int anfc_select_target(struct nand_chip *chip, int target)
347347
348348 /* Update clock frequency */
349349 if (nfc -> cur_clk != anand -> clk ) {
350- clk_disable_unprepare (nfc -> controller_clk );
351- ret = clk_set_rate (nfc -> controller_clk , anand -> clk );
350+ clk_disable_unprepare (nfc -> bus_clk );
351+ ret = clk_set_rate (nfc -> bus_clk , anand -> clk );
352352 if (ret ) {
353353 dev_err (nfc -> dev , "Failed to change clock rate\n" );
354354 return ret ;
355355 }
356356
357- ret = clk_prepare_enable (nfc -> controller_clk );
357+ ret = clk_prepare_enable (nfc -> bus_clk );
358358 if (ret ) {
359359 dev_err (nfc -> dev ,
360- "Failed to re-enable the controller clock\n" );
360+ "Failed to re-enable the bus clock\n" );
361361 return ret ;
362362 }
363363
@@ -1043,7 +1043,13 @@ static int anfc_setup_interface(struct nand_chip *chip, int target,
10431043 DQS_BUFF_SEL_OUT (dqs_mode );
10441044 }
10451045
1046- anand -> clk = ANFC_XLNX_SDR_DFLT_CORE_CLK ;
1046+ if (nand_interface_is_sdr (conf )) {
1047+ anand -> clk = ANFC_XLNX_SDR_DFLT_CORE_CLK ;
1048+ } else {
1049+ /* ONFI timings are defined in picoseconds */
1050+ anand -> clk = div_u64 ((u64 )NSEC_PER_SEC * 1000 ,
1051+ conf -> timings .nvddr .tCK_min );
1052+ }
10471053
10481054 /*
10491055 * Due to a hardware bug in the ZynqMP SoC, SDR timing modes 0-1 work
0 commit comments