diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-03-25 15:06:16 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-25 08:30:17 -0700 |
commit | 9df461eca18f5395ee84670cdba6755dddec1898 (patch) | |
tree | ca866b01fbfb63bdd31ccf53f50c0d05ae8765de /drivers/spi/spi-sun6i.c | |
parent | 025ffe88ee605acb03dba0d920908dff5ec15dd0 (diff) |
spi: pxa2xx: replace ugly table by approximation
The Quark SoC data sheet describes the baud rate setting using fractional
divider. The subset of possible values represented by a table suggests that the
divisor has one block that could divide by 5. This explains the number of the
beast in some cases in the table. Thus, in this particular case the divisor can
be evaluated as
5^i * 2^j * 2 * k,
where
i = [0, 1]
j = [0, 23]
k = [1, 256]
There are few cases as mentioned in the data sheet, i.e. better form of the
clock signal will be in case if DDS_CLK_RATE either 2^n or 2/5. It's also
possible to use any value that is less or equal to 0x33333 (1/5/16 = 1/80).
All three cases are compared to each other and the one that suits better is
chosen by the approximation algorithm. Anyone can play with the script [1] that
represents the algorithm.
[1] https://gist.github.com/06b084488b3629898121
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-sun6i.c')
0 files changed, 0 insertions, 0 deletions