Hi Rickard, Rickard X Andersson <Rickard.Andersson@xxxxxxxx> wrote on Wed, 20 May 2020 14:16:57 +0000: > > > I have created a new patchset that I will send shortly. This patchset does however not use onfi_find_equivalent_sdr_mode(..), that could be a future improvment. My patchset falls back to mode 0 if the specialized timings does not work for the controller. > > > > Thanks for updating! > > > > Actually I wrote it because of a previous discussion with Boris who > > told me that this mode field would be badly understood and he actually > > got it right as in your previous submission this field was set to 0 > > while, IIRC, you told me it was close to mode 3. This is important to > > controllers that cannot tweak the parameters but just pick an ONFI > > mode. So the timings they choose must fit the slowest mins and fastest > > maxs of your new set of timings. Hence the use of the helper which > > seems needed. It is actually pretty straightforward so I don't > > understand your choice of not making use of it? > > > > As this is the primary contribution of this type, I would like to get > > it right so that other contributors can refer to it :) > > 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. 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). Thanks, Miquèl ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/