Hi Yaniv, On Mon, 2 Nov 2020 at 11:14, Moshe, Yaniv <yani...@amazon.com> wrote: > > Hi Simon, > > Hope you’re doing good. > > > > My name is Yaniv, and I have a question regarding an old commit in U-boot: > > commit 60e2809a848bccd3a8090d3f2237964670f2780c > > Author: Simon Glass <s...@chromium.org> > > Date: Tue Feb 17 15:29:35 2015 -0700 > > > > dm: spi: Avoid setting the speed with every transfer > > > > Only set the speed if it has changed from last time. Since the speed will > > be 0 when the device is probed it will always be changed on the first > > transfer after the device is probed. > > > > Signed-off-by: Simon Glass s...@chromium.org > > > > > > As far as I understand it, each SPI slave has its own struct. So, when we > will use the device for the first time, we will set the speed. > > But, if we’re jumping between different slaves, the slaves structs were > already configured at the first time, and since then there won’t be any > future speed setting. > > > > e.g: > > access flash with max-freq = X - > speed set > > access TPM with max-freq =Y -> speed set > > access flash again, slave struct already configured, no change between speed > and slave->speed, -> speed stay the same as for TPM. > > > > Did I got it wrong? I’m trying to understand what am I missing…
Yes I think you are right. I think we need to have a single speed for the SPI bus and check against that instead. It could be stored in dm_spi_bus perhaps? Regards, Simon