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

Marek Vasut marex at denx.de
Fri Jul 2 21:40:47 CEST 2021


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 ?


More information about the U-Boot mailing list