spi: sunxi: fix CDR2 calculation
The CDR2 divider calculation always yield a frequency greater than the requested one. Use DIV_ROUND_UP() to keep the frequency equal or below the requested one. This way, we can also drop the "if div > 0" check because we know for a fact that div cannot be zero. FWIW, this aligns the CDR2 calculation with the linux driver. Suggested-by:Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Michael Walle <mwalle@kernel.org> Reviewed-by:
Andre Przywara <andre.przywara@arm.com>
Loading
Please register or sign in to comment