Re: [PATCH] spi: stm32: enable controller before asserting CS

From: Mark Brown
Date: Fri Dec 01 2023 - 16:50:42 EST


On Fri, Dec 01, 2023 at 04:40:14PM -0500, Ben Wolsieffer wrote:

> This patch fixes the bug by enabling the controller in prepare_message()
> and disabling it in unprepare_message(), which are called while CS is
> not asserted.

This feels like it'd be a good fit for moving to runtime PM - that way
we avoid bouncing the controller on and off between messages which is
probably better anyway. The driver already does pinctrl management for
the device there.

> Note that bug is likely not present on the STM32H7, because it supports
> the AFCNTR bit (and this driver sets it), which keeps the SPI pins
> driven even while the controller is disabled.

It also occurs to me that this isn't going to work for devices which
chip select inverted - for them we can't stop driving chip select at all
since they need it held high when idle. There aren't that many such
devices and it'd loose us the PM which is rather awkward... I guess
that's an incremental issue with a more invasive fix though.

Attachment: signature.asc
Description: PGP signature