u-boot/drivers
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
..
adc dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
bios_emulator bios_emulator: Fix cast for 64-bit compilation 2016-10-11 11:55:33 +08:00
block drivers: block: dwc_ahci: Implement a driver for Synopsys DWC sata device 2017-05-09 12:14:16 -06:00
bootcount Blackfin: Remove 2017-04-05 13:52:01 -04:00
clk rockchip: clk: rk3399: fix off-by one during rate calculation in i2c/spi_set_rate 2017-05-10 13:37:21 -06:00
core dm: core: Ensure DMA regions start up with the cache clean 2017-04-13 14:44:49 -06:00
cpu cpu: Add get_vendor callback 2016-10-19 09:01:51 +02:00
crypto Merge git://git.denx.de/u-boot-fsl-qoriq 2017-04-18 11:36:06 -04:00
ddr Merge git://git.denx.de/u-boot-fsl-qoriq 2017-04-18 11:36:06 -04:00
demo dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
dfu dfu: align array in dfu_get_dev_type with enum dfu_device_type 2016-11-03 11:55:25 +01:00
dma treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
firmware sysreset: psci: support system reset in a generic way with PSCI 2017-04-18 10:29:19 -04:00
fpga FPGA: drivers/fpga/ivm_core.c: incorrect printf 2017-04-18 10:29:23 -04:00
gpio dm: gpio: Add driver for stm32f7 gpio controller 2017-05-08 11:57:02 -04:00
hwmon mailaddr: Update mail address 2016-01-27 15:32:05 +01:00
i2c ARM: OMAP: I2C: Support New read, write and probe functions for OMAP3 2017-05-09 20:35:36 -04:00
input dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
led dm: led: Add support for blinking LEDs 2017-04-14 19:38:57 -06:00
mailbox dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
memory memory: Move TI_AEMIF config to KCONFIG 2016-04-18 17:11:43 -04:00
misc Drop the pdsp188x driver 2017-04-30 13:41:02 -04:00
mmc mmc: dw_mmc: rockchip: select proper card clock 2017-05-10 13:37:21 -06:00
mtd fix: nand: pxa3xx: Remove hardcode values from the driver 2017-05-09 13:38:18 +02:00
net Merge git://git.denx.de/u-boot-dm 2017-05-09 16:11:36 -04:00
pch dm: Use dm_scan_fdt_dev() directly where possible 2016-07-27 14:15:54 -06:00
pci fix: mvebu: pcie_dw: Allow probing empty PCIe slots 2017-05-09 13:38:17 +02:00
pcmcia powerpc: mpc824x: remove MPC824X cpu support 2015-01-05 12:08:55 -05:00
phy Merge git://git.denx.de/u-boot-dm 2017-05-09 16:11:36 -04:00
pinctrl aspeed: AST2500 Pinctrl Driver 2017-05-08 11:57:33 -04:00
power power: twl4030: Move CONFIG_TWL4030_POWER to Kconfig 2017-05-09 20:35:38 -04:00
pwm dm: sandbox: pwm: Add a basic pwm test 2017-04-27 16:49:02 -04:00
qe armv7: ls1021a: Drop macro CONFIG_LS102XA 2017-04-17 09:03:30 -07:00
ram stm32f7: sdram: correct sdram configuration as per micron sdram 2017-05-08 11:57:22 -04:00
remoteproc dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
reset aspeed: Reset Driver 2017-05-08 11:57:32 -04:00
rtc rtc: Add DM support to ds1307 2017-05-08 11:57:28 -04:00
serial serial: atmel_usart: Add clk support 2017-05-09 12:14:15 -06:00
soc Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
sound of: clean up OF_CONTROL ifdef conditionals 2015-08-18 13:46:05 -04:00
spi rockchip: spi: rewrite rkspi_set_clk for a more conservative baudrate setting 2017-05-10 13:37:21 -06:00
spmi dm: core: Replace of_offset with accessor 2017-02-08 06:12:14 -07:00
sysreset aspeed: Refactor AST2500 RAM Driver and Sysreset Driver 2017-05-08 11:57:32 -04:00
thermal imx: thermal: Kconfig: add MX7 2017-01-02 17:08:25 +01:00
timer drivers: timer: Introduce ARC timer driver 2017-03-29 07:38:11 +02:00
tpm lib: tpm: Add command to list resources 2017-03-26 13:22:58 -06:00
twserial drivers: convert makefiles to Kbuild style 2013-10-31 13:26:01 -04:00
usb net: smsc95xx: Correct free_pkt() implementation 2017-05-09 20:17:24 -04:00
video rockchip: video: Makefile: Modify Makefile for rockchip video driver 2017-05-10 13:37:21 -06:00
watchdog bcm2835_wdt: support for the BCM2835/2836 watchdog 2017-05-09 20:30:08 -04:00
Kconfig drivers: phy: add generic PHY framework 2017-05-09 12:14:16 -06:00
Makefile drivers: phy: add generic PHY framework 2017-05-09 12:14:16 -06:00