]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sdhci_fsl_fdt: Provide more accurate clk calculation
authorArtur Rojek <ar@semihalf.com>
Fri, 5 Nov 2021 09:17:49 +0000 (10:17 +0100)
committerWojciech Macek <wma@FreeBSD.org>
Fri, 5 Nov 2021 09:18:57 +0000 (10:18 +0100)
commit8b57ee7e0107695403702cca2b5ac0dfa452b5ee
tree00ee985995e478dcfa33804192caa2191b2a788a
parent36b80dba1742acfeecfe8c26516c5cf16fd1346d
sdhci_fsl_fdt: Provide more accurate clk calculation

SDHCI controllers found in the QorIQ SoCs offer improved accuracy of
the clock frequency selection, compared to the SDHCI standard. Frequency
selection is performed using two divider registers, named prescaler and
divisor, according to the following formula:
frequency = base clock / (prescaler * divisor), where prescaler can be
bypassed (set to 1) and divisor permitted to take odd values.

Rather than depend on clock division precalculated by sdhci core, make
use of this property of the divider registers and achieve frequencies
closer to the ones requested.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32706
sys/dev/sdhci/sdhci_fsl_fdt.c