On Wed, 20 May 2020 14:42:31 +0000 Rickard X Andersson <Rickard.Andersson@xxxxxxxx> wrote: > > > If I understand you correctly you want me to use onfi_find_equivalent_sdr_mode in order to find the corresponding onfi mode. Then you want me to use onfi_fill_data_interface and loop towards mode 0 checking which mode the controller accepts? I just thought it was a "messy" to duplicate this code in all vendor drivers. > > > Or do you mean that I should just use onfi_find_equivalent_sdr_mode to set ."timings.mode" and let nand_base to do the looping in case error is returned from th58nvg2s3hbai4_choose_data_interface (i.e specialized timings not accepted by the controller). > > > > Sorry for the misunderstanding. What I think you should try is: > > 1/ call onfi_find_equivalent_sdr_mode() to set the timings.mode field. > > 2/ call nand_controller_supports_data_interface() > > 3/ if the controller supports the timings, set > > chip->default_timing_mode accordingly and return 0. Why do we have to set the default_timing_mode field? Can't we just set timings.mode directly? > > 4/ if the controller does not support the timings, you may want to > > propose other standard timings to test by setting > > chip->default_timing_mode anyway but returning an error which means > > "best interface has not been found yet" so the rest of the > > choose_data_interface() helper will try the remaining ONFI modes > > automatically (fallbacks to 0 anyway). Again, I don't see why setting chip->default_timing_mode is needed here, and I'm not sure trying remaining ONFI modes is useful, I guess we can just fall back on mode 0 in that case. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/