[PATCH V2] spi: Update speed/mode on change

Da Xue da at libre.computer
Fri Jul 2 22:10:36 CEST 2021


On Fri, Jul 2, 2021 at 3:40 PM Marek Vasut <marex at denx.de> wrote:

> On 7/2/21 9:35 PM, Da Xue wrote:
>
> [...]
>
> >>>>>> Seems like you're hitting this code in drivers/spi/meson_spifc.c
> >>>>>>
> >>>>>> 250 static int meson_spifc_set_mode(struct udevice *dev, uint mode)
> >>>>>> 251 {
> >>>>>> 252         struct meson_spifc_priv *spifc = dev_get_priv(dev);
> >>>>>> 253
> >>>>>> 254         if (mode & (SPI_CPHA | SPI_RX_QUAD | SPI_RX_DUAL |
> >>>>>> 255                     SPI_TX_QUAD | SPI_TX_DUAL))
> >>>>>> 256                 return -ENODEV;
> >>>>>>
> >>>>>> (the -ENODEV code doesn't look right, it should be some -EOPNOTSUP
> or
> >>>> so)
> >>>>>>
> >>>>>> Can you check which of the mode bits is set and triggers the
> >> condition ?
> >>>>>>
> >>>>>> I think you might be missing something like
> >>>>>> spi-rx-bus-width = <1>;
> >>>>>> spi-tx-bus-width = <1>;
> >>>>>> in your DT, but that's a guess.
> >>>>
> >>>> Can you check which of the mode bits is set and triggers the
> condition ?
> >>>>
> >>>> Also, where in the DT did you add spi-rx-bus-width = <1> and
> >>>> spi-tx-bus-width = <1> ?
> >>>>
> >>>> Finally, please do not top-post and keep the list on CC.
> >>>>
> >>>
> >>> My apologies about the top-posting.
> >>>
> >>> --- a/arch/arm/dts/meson-gxl-s805x-libretech-ac.dts
> >>> +++ b/arch/arm/dts/meson-gxl-s805x-libretech-ac.dts
> >>> @@ -304,6 +304,8 @@
> >>>                   compatible = "jedec,spi-nor";
> >>>                   reg = <0>;
> >>>                   spi-max-frequency = <80000000>;
> >>> +               spi-rx-bus-width = <1>;
> >>> +               spi-tx-bus-width = <1>;
> >>>           };
> >>>    };
> >>
> >> That should do the trick. Can you check which of the mode bits is set in
> >> meson_spifc_set_mode() and triggers the ENODEV condition ?
> >>
> >
> > SPI_CPHA seems to be  the culprit. I tried adding spi-cpha = <0> to no
> > avail.
>
> Can you find out what is setting the SPI_CPHA in the first place on your
> machine ?
>

The Kconfig was setting it to 3. I manually added the default mode (0) to
my board's config and it worked. Thanks Marek.


More information about the U-Boot mailing list