From: Rudolf J Streif Date: Tue, 17 Mar 2020 19:25:04 -0700 Subject: U-CLASS SPI Bus and Devices Message-ID: <1850f84a-4242-05fc-bc3f-7746f4cabddd@ibeeto.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de I ran into an issue today with a U-CLASS SPI NOR flash device on a NXP FlexSPI controller. U-Boot started correctly from the flash device but using 'sf probe 0:0' would always return 'Invalid bus 0 (err=-19)'. This error message is emitted by spi_get_bus_and_cs() in drivers/spi/spi-uclass.c. I traced the issue to uclass_get_device_by_seq() in drivers/core/uclass.c. The function first searches the device list for a device that already claimed the sequence number (dev->seq). If not found it would look if a device requested that sequence number (dev->seq_req). That would always fail for my device. The bus had not been probed yet and hence dev->seq was -1 and the device also had dev->req_seq set to -1. The board is using a device tree hence it would only make sense to set the requested sequence number via the device tree. However, there is no such thing and even if there was it might not be specified. Consequently, the device was never probed although the driver was correctly set up via device tree. I worked around it by simply setting dev->req_seq of the first device that had it set to -1 to the sequence number the search function was looking for (see patch below). It solved my problem but I don't know if that is the right way of addressing it. I could not find any other solution for this particular problem anywhere. Rudi