[PATCH] spi: Replace `dummy.nbytes` with `dummy.ncycles`
michael at walle.cc
Thu Mar 9 00:38:05 PST 2023
> In an ideal world, where both the controller and the device talk about
> dummy number of cycles, I would agree with you, buswidth and dtr should
> not be relevant for the number of dummy cycles. But it seems that there
> are old controllers (e.g. spi-hisi-sfc-v3xx.c, spi-mt65xx.c,
> that support buswidths > 1 and work only with dummy nbytes, they are
> capable of specifying a smaller granularity (ncycles). Thus the older
> controllers would have to convert the dummy ncycles to dummy nbytes.
> Since mixed transfer modes are a thing (see jesd251, it talks about
> 4S-4D-4D), where single transfer mode (S) can be mixed with double
> transfer mode (D) for a command, the controller would have to guess the
> buswidth and dtr of the dummy. Shall they replicate the buswidth and
> of the address or of the data? There's no rule for that.
But in the end that doesn't matter because they are just dummy clock
cycles and the mode will only affect the data/address/command.
the controller is free to choose the mode that suits it best.
But that begs the question, is ncycles in regard to DTR or SDR? That is,
are you counting just one type of edges or both the falling and rising
edges. The smallest granularity would be ncycles in regard of DTR. To
it's not obvious what the SEMPER Nano Flash  uses. I'd say we choose
the smallest granularty in spi-mem to be future proof and maybe provide
some spi-mem helper to help setting the cycles for SDR/DTR. As an
if you want to wait 4 cycles in SDR you'd have ncycles=8 in spi-mem.
So you won't need the mode nor the dtr property.
More information about the Linux-rockchip