]> git.dujemihanovic.xyz Git - u-boot.git/commit
spi: sunxi: fix clock divider calculation for max frequency setting
authorMichael Walle <mwalle@kernel.org>
Thu, 18 Jul 2024 20:42:53 +0000 (22:42 +0200)
committerAndre Przywara <andre.przywara@arm.com>
Tue, 6 Aug 2024 10:20:10 +0000 (11:20 +0100)
commit541a1649e74787682902d820d0b79e16bad69a4f
tree0348d9eb365add5def50c29884e962f775298f5c
parent6aadcb814d1e2203b0b953dda8d5fbdc7b3a9bf0
spi: sunxi: fix clock divider calculation for max frequency setting

If the maximum frequency is requested, we still fall into the CDR2
handling. But there the minimal divider is 2. For the sun6i and sun8i we
can do better with the CDR1 setting where the minimal divider is 1:
  SPI_CLK = MOD_CLK / 2 ^ cdr with cdr = 0

Thus, handle the div = 1 case specially.

While at it, correct the comment above the calculation.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
drivers/spi/spi-sunxi.c