summaryrefslogtreecommitdiff
path: root/drivers/regulator/tps6524x-regulator.c
diff options
context:
space:
mode:
authorBen Wolsieffer <ben.wolsieffer@hefring.com>2024-04-24 16:52:38 +0300
committerMark Brown <broonie@kernel.org>2024-05-03 05:07:41 +0300
commit52b62e7a5d4fb53ae3db3c83aee73683e5f3d2d2 (patch)
treea5782d743a2a842b30f741de44593247683bfb9d /drivers/regulator/tps6524x-regulator.c
parent4756fa529b2f12b7cb8f21fe229b0f6f47190829 (diff)
downloadlinux-52b62e7a5d4fb53ae3db3c83aee73683e5f3d2d2.tar.xz
spi: stm32: enable controller before asserting CS
On the STM32F4/7, the MOSI and CLK pins float while the controller is disabled. CS is a regular GPIO, and therefore always driven. Currently, the controller is enabled in the transfer_one() callback, which runs after CS is asserted. Therefore, there is a period where the SPI pins are floating while CS is asserted, making it possible for stray signals to disrupt communications. An analogous problem occurs at the end of the transfer when the controller is disabled before CS is released. This problem can be reliably observed by enabling the pull-up (if CPOL=0) or pull-down (if CPOL=1) on the clock pin. This will cause two extra unintended clock edges per transfer, when the controller is enabled and disabled. Note that this bug is likely not present on the STM32H7, because this driver sets the AFCNTR bit (not supported on F4/F7), which keeps the SPI pins driven even while the controller is disabled. Enabling/disabling the controller as part of runtime PM was suggested as an alternative approach, but this breaks the driver on the STM32MP1 (see [1]). The following quote from the manual may explain this: > To restart the internal state machine properly, SPI is strongly > suggested to be disabled and re-enabled before next transaction starts > despite its setting is not changed. This patch has been tested on an STM32F746 with a MAX14830 UART expander. [1] https://lore.kernel.org/lkml/ZXzRi_h2AMqEhMVw@dell-precision-5540/T/ Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com> Link: https://lore.kernel.org/r/20240424135237.1329001-2-ben.wolsieffer@hefring.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/tps6524x-regulator.c')
0 files changed, 0 insertions, 0 deletions