Re: [PATCH v4 1/3] spi: airoha-snfi: en7523: workaround flash damaging if UART_TXD was short to GND

Mikhail Kshevetskiy
2025-11-25T14:20:52Z

On 11/25/25 13:14, Andy Shevchenko wrote:
> On Tue, Nov 25, 2025 at 01:04:12PM +0300, Mikhail Kshevetskiy wrote:
>> On 11/25/25 10:18, Andy Shevchenko wrote:
>>> On Tue, Nov 25, 2025 at 05:10:49AM +0300, Mikhail Kshevetskiy wrote:
>>>> Airoha EN7523 specific bug
>>>> --------------------------
>>>> We found that some serial console may pull TX line to GROUND during board
>>>> boot time. Airoha uses TX line as one of it's BOOT pins.
>>> I know the term bootstrap, what does BOOT mean?
>> yes, it's bootstrap pin
> Then use that term.
>
>>>> On the EN7523 SoC this may lead to booting in RESERVED boot mode.
>>>>
>>>> It was found that some flashes operates incorrectly in RESERVED mode.
>>>> Micron and Skyhigh flashes are definitely affected by the issue,
>>>> Winbond flashes are NOT affected.
>>> NOT --> not
>> will fix
>>>> Details:
>>>> --------
>>>> DMA reading of odd pages on affected flashes operates incorrectly. Page
>>>> reading offset (start of the page) on hardware level is replaced by 0x10.
>>>> Thus results in incorrect data reading. As result OS loading becomes
>>>> impossible.
>>>>
>>>> Usage of UBI make things even worse. On attaching, UBI will detects
>>>> corruptions (because of wrong reading of odd pages) and will try to
>>>> recover. For recovering UBI will erase and write 'damaged' blocks with
>>>> a valid information. This will destroy all UBI data.
>>>>
>>>> Non-DMA reading is OK.
>>>>
>>>> This patch detects booting in reserved mode, turn off DMA and print big
>>>> fat warning.
> ...

could you clarify what's wrong here?

>
>>>> - err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32));
>>>> - if (err)
>>>> - return err;
>>>> + if (dma_enable) {
>>>> + err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32));
>>>> + if (err)
>>>> + return err;
>>>> + }
>>> Why do you need this to be conditional? The settings of DMA mask should not
>>> affect the (in)ability of the device to perform DMA. I.o.w. it should not
>>> influence PIO mode. Can you confirm this?
>>>
>> no any particular reason, just see no sense to set mask if dma will not
>> be used
> So, this is an unneeded churn in the patch. Device is [still] capable of DMA?
> Yes. Set the mask. The DMA/PIO choice is done on the upper layer (as you do it
> via ops).
>