Go to file
Douglas Anderson 864c2fee4e ARM: dts: rockchip: Add vdd_logic to rk3288-veyron
The vdd_logic rail controls the voltage supplied to misc logic on
rk3288, including the voltage supplied to the memory controller.  The
vcc logic is implemented by a PWM regulator.

Right now there are no consumers of vdd_logic on veyron but if anyone
ever wants to try to add DDR Freq they'd need it.

Note that in the downstream Chrome OS kernel the PWM regulator has
a voltage table with these points:
  1350000 0%
  1300000 10%
  1250000 20%
  1200000 31%
  1150000 41%
  1125000 46%
  1100000 52%
  1050000 62%
  1000000 72%
   950000 83%

The DDR Freq driver in the downstream kernel only uses some of those
points, namely:
  DDR3:  1200000, 1150000, 1100000, 1050000
  LPDDR:          1150000, 1100000, 1050000

When adapting the downstream kernel to upstream I have opted to switch
to using the "continuous" mode of the PWM regulator driver.  This was
the only way I could get the upstream driver to achieve _exactly_ the
same voltages as the downstream driver could.  Specifically note that
the old driver in downstream Chrome OS 3.14 _didn't_ have the
DIV_ROUND_CLOSEST_ULL() in the Rockchip PLL driver.  That means if I
use the same (downstream) table I might end up with a duty cycle
that's 1 larger than was used downstream, leading to a slightly
different voltage.  Due to the way the rounding worked I couldn't even
just adjust the "percent" by 1 for a given voltage level--certain duty
cycles just aren't achievable with the upstream math for voltage
tables.

Using continuous mode you can achieve the exact same duty cycle by
simply adjusting the voltage you use by a tad bit.  The voltages that
are equivalent to the ones used in the downstream kernel's table are:
  1350000, 1304472, 1255691, 1200407, 1154878,
  1128862, 1099593, 1050813, 1005285, 950000

Note that the top/bottom voltage is exactly the same just due to the
way that continuous mode is calculated and the fact that I used those
as anchors.  I didn't make any attempt to do the resistor math (as was
done on rk3399-gru).

If anyone ever gets DDRFreq working on veyron upstream they should
thus adjust the voltage specified in the DDRFreq operating points
slightly (as per the above) to obtain the existing/tested values.  AKA
you'd use:
  DDR3:  1200407, 1154878, 1099593, 1050813
  LPDDR:          1154878, 1099593, 1050813

A few other notes:
- The "period" here (1994) is different than the "period" downstream
  (2000) for similar reasons: there's a DIV_ROUND_CLOSEST_ULL() that
  wasn't downstream.  With 1994 upstream comes up with the same value
  (0x94) to program into the hardware that downstream put there.  As
  far as I can tell 0x94 actually means 1993.27.
- The duty cycle unit of 0x94 was picked by just matching the period
  which nicely allows us to insert 0x7b as that value to program into
  the hardware for 950mV.  The 0x7b was found by observing what the
  downstream kernel calculated (not that the system can actually run
  with vdd_log at 950 mV).
- The downstream kernel can also be seen to program a different value
  into the CTRL field.  Upstream achieves 0x0b and downstream 0x1b.
  This is because the upstream commit bc834d7b07 ("pwm: rockchip:
  Move the configuration of polarity") fixed a bug by adding "ctrl &=
  ~PWM_POLARITY_MASK".  Downstream accidentally left bit 4 set.
  Luckily this bit doesn't matter--it's only used when the PWM goes
  inactive (AKA if it's in oneshot mode or is disabled) and we don't
  do that for the PWM regulator.

I measured the voltage of vdd_log while adjusting it and found that
with the upstream kernel voltage difference between requested and
actual was 9.2 mV at 950 mV and 13.4 mV at 1350 mV with in-between
voltages consistently showing ~1% error.  This error is likely
expected as voltage can be seen to sag a bit when more load is put on
the rail.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
2019-03-25 13:28:47 +01:00
arch ARM: dts: rockchip: Add vdd_logic to rk3288-veyron 2019-03-25 13:28:47 +01:00
block for-5.1/block-post-20190315 2019-03-16 12:36:39 -07:00
certs kexec, KEYS: Make use of platform keyring for signature verify 2019-02-04 17:34:07 -05:00
crypto lib/lzo: separate lzo-rle from lzo 2019-03-07 18:32:03 -08:00
Documentation dt-bindings: ARM: dts: rockchip: Add rk3288-veyron-jerry rev 10-15 2019-03-25 13:24:18 +01:00
drivers xen: one further fix for v5.1-rc1 2019-03-17 09:16:22 -07:00
fs Pull request for inlusion in 5.1 2019-03-17 09:10:56 -07:00
include Kbuild updates for v5.1 (2nd) 2019-03-17 13:25:26 -07:00
init init/main: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
ipc Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-03-12 14:08:19 -07:00
kernel pidfd patches for v5.1-rc1 2019-03-16 13:47:14 -07:00
lib Kbuild updates for v5.1 (2nd) 2019-03-17 13:25:26 -07:00
LICENSES LICENSES: Add GCC runtime library exception text 2019-01-16 14:54:15 -07:00
mm device-dax for 5.1 2019-03-16 13:05:32 -07:00
net Pull request for inlusion in 5.1 2019-03-17 09:10:56 -07:00
samples Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-03-11 08:54:01 -07:00
scripts kconfig: remove stale lxdialog/.gitignore 2019-03-17 15:47:02 +09:00
security selinux/stable-5.1 PR 20190312 2019-03-13 11:10:42 -07:00
sound sound fixes for 5.1-rc1 2019-03-15 14:05:00 -07:00
tools pidfd patches for v5.1-rc1 2019-03-16 13:47:14 -07:00
usr user/Makefile: Fix typo and capitalization in comment section 2018-12-11 00:18:03 +09:00
virt ARM: some cleanups, direct physical timer assignment, cache sanitization 2019-03-15 15:00:28 -07:00
.clang-format Merge branch 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-03-12 13:43:42 -07:00
.cocciconfig scripts: add Linux .cocciconfig for coccinelle 2016-07-22 12:13:39 +02:00
.get_maintainer.ignore Add hch to .get_maintainer.ignore 2015-08-21 14:30:10 -07:00
.gitattributes .gitattributes: set git diff driver for C source code files 2016-10-07 18:46:30 -07:00
.gitignore kbuild: Add support for DT binding schema checks 2018-12-13 09:41:32 -06:00
.mailmap .mailmap: Add Mathieu Othacehe 2019-02-21 11:41:19 +00:00
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS Char/Misc driver patches for 5.1-rc1 2019-03-06 14:18:59 -08:00
Kbuild Kbuild updates for v5.1 2019-03-10 17:48:21 -07:00
Kconfig kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt 2018-08-02 08:06:55 +09:00
MAINTAINERS ARM: some cleanups, direct physical timer assignment, cache sanitization 2019-03-15 15:00:28 -07:00
Makefile Linux 5.1-rc1 2019-03-17 14:22:26 -07:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.