U-CLASS SPI Bus and Devices

Simon Glass sjg at chromium.org
Wed May 20 05:07:00 CEST 2020


Hi Rudolf,

On Tue, 12 May 2020 at 18:02, Rudolf J Streif <rudolf.streif at ibeeto.com> wrote:
>
> Hi Simon,
>
> Thanks for your response.
>
> On 5/7/20 6:36 PM, Simon Glass wrote:
> > Hi Rudolf,
> >
> > On Wed, 18 Mar 2020 at 05:25, Rudolf J Streif <rudolf.streif at ibeeto.com> wrote:
> >> 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
> > You can put the SPI flash in the device tree with an alias pointing to
> > it.. That is the intended way with driver model.
>
> The board I am using the the FSL/NXP LX2160A-RDB. The dts
> arch/arm/dts/fsl-lx2160a-rdb.dts defines:
>
>  / {
>         model = "NXP Layerscape LX2160ARDB Board";
>         compatible = "fsl,lx2160ardb", "fsl,lx2160a";
>
>         aliases {
>                 spi0 = &fspi;
>         };
> };
>
> I am I missing something?

That's SPI. I mean actually SPI flash, which would be a subnode of that,

Regards,
SImon


More information about the U-Boot mailing list