On Tue, Feb 23, 2021 at 07:07:37PM +0100, Geert Uytterhoeven wrote: > On Tue, Feb 23, 2021 at 4:25 PM Pratyush Yadav wrote: > > To select the optimal number of dummy cycles we need to know what speed > > the controller is running at, not the other way around. The flash would > > always set the top speed to its maximum (say 200 MHz). But if the > > controller is only capable of running at 50 MHz, you will end up wasting > > dummy cycles. I don't see any API to communicate speed from controller > > to flash. > spi_transfer.effective_speed_hz? > If the driver has filled this in (after the first transfer), you can optimize > dummy cycles before doing the next transfer. Note that effective_speed_hz > might not always be the same, if e.g. the SPI controller shares its parent > clock with another component. Yes, that's what that's for, or just go with the speed set by the client on the basis that it should be safe even if potentially wasteful. You'd need to fall back to that anyway in the cases where the controller doesn't or can't report the effective speed.