u-boot/drivers
Xavier Drudis Ferran 2cb23b80e4 arm: rockchip: rk3399: Program PLL clock for DDR at 50 MHz in documented range
The original code set up the DDR clock to 48 MHz, not 50MHz as
requested, and did it in a way that didn't satisfy the Application
Notes in RK3399 TRM [1]. 2.9.2.B says:

   PLL frequency range requirement
   [...]
   FOUTVCO: 800MHz to 3.2GHz

2.9.2.A :
   PLL output frequency configuration
   [...]
   FOUTVCO = FREF / REFDIV * FBDIV
   FOUTPOSTDIV = FOUTVCO / POSTDIV1 / POSTDIV2

FREF = 24 MHz

The original code gives FOUTVCO: 24MHz/1 * 12 = 288MHz < 800MHz
And the resulting FOUTPOSTDIV is 288MHz / 3 / 2 = 48MHz
but the requested frequency was 50MHz

Note:
2.7.2 Detail Register Description
PMUCRU_PPLL_CON0 says

   fbdiv
   Feedback Divide Value
   Valid divider settings are:
   [16, 3200] in integer mode

So .fbdiv = 12 wouldn't be right. But 2.9.2.C says:

   PLL setting consideration
   [...]
   The following settings are valid for FBDIV:
   DSMPD=1 (Integer Mode):
   12,13,14,16-4095 (practical value is limited to 3200, 2400, or 1600
   (FVCOMAX / FREFMIN))
   [...]

So .fbdiv = 12 would be right.

In any case FOUTVCO is still wrong. I thank YouMin Chen for
confirmation and explanation.

Despite documentation, I don't seem to be able to reproduce a
practical problem with the wrong FOUTVCO. When I initially found it I
thought some problems with detecting the RAM capacity in my Rock Pi 4B
could be related to it and my patch seemed to help. But since I'm no
longer able to reproduce the issue, it works with or without this
patch. And meanwhile a patch[2] by Lee Jones and YouMin Chen addresses
this issue. Btw, shouldn't that be commited?

So this patches solves no visible problem.  Yet, to prevent future
problems, I think it'd be best to stick to spec.

An alternative to this patch could be

    {.refdiv = 1, .fbdiv = 75, .postdiv1 = 6, .postdiv2 = 6};

This would theoretically consume more power and yield less jitter,
according to 2.9.2.C :

   PLL setting consideration
   [...]
   For lowest power operation, the minimum VCO and FREF frequencies
   should be used. For minimum jitter operation, the highest VCO and
   FREF frequencies should be used.
   [...]

But I haven't tried it because I don't think it matters much. 50MHz
for DDR is only shortly used by TPL at RAM init. Normal operation is
at 800MHz.  Maybe it's better to use less power until later when more
complex software can control batteries or charging or whatever ?

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>

Link: [1] https://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf
Link: [2] https://patchwork.ozlabs.org/project/uboot/list/?series=305766

Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2022-10-19 19:30:48 +08:00
..
adc adc: meson-saradc: add AXG variant 2022-04-25 09:25:00 +02:00
ata blk: Rename if_type to uclass_id 2022-09-25 08:30:05 -06:00
axi WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
bios_emulator video: Rename structs and functions to avoid VBE 2022-08-12 08:14:23 -04:00
block blk: Rename if_type to uclass_id 2022-09-25 08:30:05 -06:00
bootcount bootcount: pmic: Correct misleading comment 2022-10-11 15:40:48 -04:00
bus bus: ti-sysc: change in a normal driver 2021-03-22 19:23:27 +13:00
button button: gpio: add DM_GPIO dependency 2022-08-23 12:39:06 +02:00
cache drivers: cache: ncore: Disable snoop filter 2022-06-17 16:27:05 +08:00
clk arm: rockchip: rk3399: Program PLL clock for DDR at 50 MHz in documented range 2022-10-19 19:30:48 +08:00
core regmap: fix range checks 2022-10-06 22:54:56 +02:00
cpu dm: core: Drop ofnode_is_available() 2022-09-29 16:11:31 -04:00
crypto dm: core: Drop ofnode_is_available() 2022-09-29 16:11:31 -04:00
ddr ddr: fsl: Fix re-align of verbose DRAM information for non-SPL builds 2022-09-23 15:13:18 -04:00
demo demo: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
dfu blk: Switch over to using uclass IDs 2022-09-16 11:05:16 -04:00
dma dma: ti: k3-udma: Fix 'SZ_64K’ undeclared error 2022-10-06 21:05:17 -04:00
fastboot Audit <flash.h> inclusion 2022-08-04 16:18:47 -04:00
firmware firmware: scmi: fix the multi channel support with CCF 2022-10-12 08:55:31 -04:00
fpga fpga: virtex2: Use logging feature instead of FPGA_DEBUG 2022-10-10 12:28:08 +02:00
fuzz sandbox: Implement fuzzing engine driver 2022-06-23 12:58:19 -04:00
gpio gpio: ftgpio010: Add support for Faraday Technology FTGPIO010 2022-10-06 21:05:17 -04:00
hwspinlock treewide: invaild -> invalid 2022-01-13 07:57:49 -05:00
i2c i2c: add support for MediaTek I2C interface 2022-09-23 15:09:15 -04:00
input input: apple: Add support for Apple SPI keyboard 2022-02-10 16:44:23 -05:00
iommu iommu: Add M2 support to Apple DART driver 2022-07-25 09:38:47 -04:00
led led: pwm: Use NOP uclass driver for top-level node 2022-07-08 10:56:45 -04:00
mailbox mailbox: zynqmp: Enable ipi mailbox driver for Versal NET 2022-09-26 14:23:29 +02:00
memory keystone2: Move CONFIG_AEMIF_CNTRL_BASE out of CONFIG namespace 2021-09-27 21:38:34 -04:00
misc misc: usb251xb: Support 8/16 bit device tree values 2022-09-14 15:23:03 -04:00
mmc mmc: zynq_sdhci: Read power-domains id from DT and use 2022-10-05 11:36:54 +02:00
mtd mtd: mxs_nand: Support EDO mode for imx8mn architecture 2022-10-09 10:42:26 +02:00
mux treewide: invaild -> invalid 2022-01-13 07:57:49 -05:00
net Xilinx changes for v2023.01-rc1 (round 3) 2022-10-11 09:57:08 -04:00
nvme Merge branch 'master' into next 2022-09-19 16:07:12 -04:00
pch treewide: Simply conditions with the new OF_REAL 2021-09-25 09:46:15 -06:00
pci dm: core: Drop ofnode_is_available() 2022-09-29 16:11:31 -04:00
pci_endpoint dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
phy phy: Add generic_{setup,shutdown}_phy() helpers 2022-10-10 18:08:18 +02:00
pinctrl pinctrl: fix buffer size for pinctrl_generic_set_state_prefix() 2022-10-11 15:40:48 -04:00
power sandbox: power: Update PMIC driver to use log 2022-09-29 16:07:57 -04:00
pwm pwm: mtk: add support for MediaTek MT7981 SoC 2022-09-23 15:09:15 -04:00
qe powerpc: remove support for kmtergr1 and MPC8309 2022-08-20 22:45:00 -04:00
ram Merge branch 'master' into next 2022-09-19 16:07:12 -04:00
reboot-mode reboot-mode: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
remoteproc remoteproc: ipu: Add driver to bring up ipu 2022-02-08 11:00:03 -05:00
reset reset: zynqmp: Enable reset driver for Versal NET 2022-09-26 14:23:29 +02:00
rng drivers: rng: optee_rng: register to CONFIG_OPTEE_SERVICE_DISCOVERY 2022-09-14 15:23:03 -04:00
rtc treewide: Fix Marek's name and change my e-mail address 2022-07-21 10:14:04 +02:00
scsi sandbox: Convert to use driver model for SCSI 2022-09-25 13:59:50 -06:00
serial Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-riscv into next 2022-09-26 11:27:30 -04:00
smem smem: msm: add missing <linux/sizes.h> 2022-10-12 08:56:24 -04:00
soc soc: xilinx: zynqmp: Mark soc_xilinx_zynqmp_get_machine() as static 2022-10-10 12:28:08 +02:00
sound sound: enable building DA7219 driver with ACPIGEN=n 2022-07-08 09:05:47 -04:00
spi spi: Implement spi_set_speed 2022-10-16 12:23:22 +02:00
spmi spmi: msm: add arbiter version 5 support 2021-10-31 08:46:44 -04:00
sysinfo sysinfo: rcar3: Add Renesas R-Car Gen3 sysinfo driver 2021-07-20 23:33:54 +02:00
sysreset RISC-V: enable CONFIG_SYSRESET_SBI by default 2022-09-06 13:00:58 +08:00
tee blk: Switch over to using uclass IDs 2022-09-16 11:05:16 -04:00
thermal thermal: add sandbox driver 2022-10-11 16:03:03 -04:00
timer timer: orion-timer: Only init timer once 2022-10-06 10:15:35 +02:00
tpm tpm: Implement state command for Cr50 2022-09-03 16:59:05 +03:00
ufs lib: fix selection of CONFIG_CHARSET 2022-05-03 21:39:22 +02:00
usb Fix typo in CONFIG_USBNET_DEVADDR 2022-10-12 11:11:19 -04:00
video cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
virtio blk: Rename if_type to uclass_id 2022-09-25 08:30:05 -06:00
w1 arm: Remove zmx25 board and ARCH_MX25 2021-10-01 21:08:18 -04:00
w1-eeprom dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
watchdog Merge branch 'next' 2022-10-03 15:39:46 -04:00
xen blk: Rename if_type to uclass_id 2022-09-25 08:30:05 -06:00
Kconfig fuzzing_engine: Add fuzzing engine uclass 2022-06-23 12:58:18 -04:00
Makefile blk: Rename HAVE_BLOCK_DEVICE 2022-09-16 11:05:16 -04:00