u-boot/drivers/spi
Philipp Tomsich 9fc354e246 rockchip: spi: rewrite rkspi_set_clk for a more conservative baudrate setting
The baudrate in rkspi was calculated by using an integer division
(which implicitly discarded any fractional result), then rounding to
an even number and finally clamping to 0xfffe using a bitwise AND
operator.  This introduced two issues:
1) for very small baudrates (overflowing the 0xfffe range), the
   bitwise-AND generates rather random-looking (wildly varying)
   actual output bitrates
2) for higher baudrates, the calculation tends to 'err towards a
   higher baudrate' with the actual error increasing as the dividers
   become very small. E.g., with a 99MHz input clock, a request
   for a 20MBit baudrate (99/20 = 4.95), a 24.75 MBit would be use
   (which amounts to a 23.75% error)... for a 34 MBit request this
   would be an actual outbout of 49.5 Mbit (i.e. a 45% error).

This change rewrites the divider selection (i.e. baudrate calculation)
by making sure that
a) for the normal case: the largest representable baudrate below the
   requested rate will be chosen;
b) for the denormal case (i.e. when the divider can no longer be
   represented), the lowest representable baudrate is chosen.

Even though the denormal case (b) may be of little concern in real
world applications (even with a 198MHz input clock, this will only
happen at below approx. 3kHz/3kBit), our board-verification team kept
complaining.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2017-05-10 13:37:21 -06:00
..
altera_spi.c altera_spi: change ioremap to map_physmem 2015-11-18 21:18:30 +08:00
ath79_spi.c ath79: spi: Remove the explicit pinctrl setting 2016-05-21 01:36:37 +02:00
atmel_dataflash_spi.c spi: atmel_dataflash: Simplify AT91F_SpiEnable implementation 2014-03-17 21:54:57 +05:30
atmel_spi.c spi: atmel: check GPIO validity before using cs_gpios 2017-05-03 10:58:54 +05:30
atmel_spi.h spi: atmel_spi: Use GENMASK 2015-10-27 23:21:42 +05:30
cadence_qspi_apb.c spi: cadence_qspi_apb: Use 32 bit indirect read transaction when possible 2017-01-04 16:38:35 +01:00
cadence_qspi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
cadence_qspi.h spi: cadence_qspi: Use spi mode at the point it is needed 2016-12-15 16:57:27 +01:00
cf_spi.c spi: Zap cf_qspi driver and related code 2017-01-15 18:29:04 +01:00
davinci_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
designware_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
exynos_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
fsl_dspi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
fsl_espi.c spi: fsl: Use BIT macro 2015-10-27 23:19:29 +05:30
fsl_qspi.c spi: fsl_qspi: Add support for single chip select 2017-03-28 09:10:12 -07:00
fsl_qspi.h qspi:fsl implement AHB read 2015-01-09 00:03:28 +05:30
ich.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
ich.h spi: ich: Change PCHV_ to ICHV_ 2016-02-05 12:47:20 +08:00
Kconfig ARM: SPI: stm32: add stm32f746 qspi driver 2017-01-28 14:04:50 -05:00
kirkwood_spi.c spi: kirkwood_spi: implement mvebu_spi_set_mode() 2016-11-18 13:04:52 +05:30
lpc32xx_ssp.c lpc32xx: add LPC32xx SSP support (SPI mode) 2015-04-10 14:23:20 +02:00
Makefile Blackfin: Remove 2017-04-05 13:52:01 -04:00
mpc8xxx_spi.c spi: mpc8xxx_spi: Use BIT macro 2015-10-27 23:21:28 +05:30
mvebu_a3700_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
mxc_spi.c treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
mxs_spi.c treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
omap3_spi.c drivers: spi: Remove duplicate .probe method 2017-05-03 11:52:16 +05:30
pic32_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
rk_spi.c rockchip: spi: rewrite rkspi_set_clk for a more conservative baudrate setting 2017-05-10 13:37:21 -06:00
rk_spi.h rockchip: spi: rk_spi: dynamically select an module input rate 2017-05-10 13:37:21 -06:00
sandbox_spi.c treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
sh_qspi.c Move console definitions into a new console.h file 2015-11-19 20:27:50 -07:00
sh_spi.c Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
sh_spi.h Add more SPDX-License-Identifier tags 2016-01-19 08:31:21 -05:00
soft_spi_legacy.c dm: spi: Remove SPI_INIT feature 2014-10-22 10:36:48 -06:00
soft_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
spi-emul-uclass.c dm: sandbox: Add a SPI emulation uclass 2014-10-22 10:36:46 -06:00
spi-uclass.c dm: core: Add flags parameter to device_remove() 2017-04-04 20:15:10 -06:00
spi.c spi: Support half-duplex mode in FDT decode 2014-08-06 00:18:01 +05:30
stm32_qspi.c stm32f7: use clock driver to enable qspi controller clock 2017-05-08 11:38:41 -04:00
tegra20_sflash.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
tegra20_slink.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
tegra114_spi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
tegra210_qspi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
tegra_spi.h dm: tegra: spi: Convert to driver model 2014-10-22 10:36:52 -06:00
ti_qspi.c drivers: ti_qspi: use syscon to get the address ctrl_mod_mmap register 2017-03-22 07:27:19 -06:00
xilinx_spi.c spi: xilinx: Add new compatible strings 2015-12-11 22:12:24 +05:30
zynq_qspi.c dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
zynq_spi.c zynq: spi: Honour the activation / deactivation delay 2017-05-03 11:03:04 +05:30