Commit Graph

1053481 Commits

Author SHA1 Message Date
Shawn Lin
af02b05e59 mmc: add thunder boot support
Remove unnecessary initialization process from core as possible, such
as remove some idle process, shorten delay, remove parsing ext_csd,
remove post-delay for power and so on. All these stuffs are enabled
by CONFIG_ROCKCHIP_THUNDER_BOOT.

Change-Id: I0e2326dd79d938eb82c8cfac9db09e34d6c08987
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:16 +08:00
Shawn Lin
70f84526ba FROMLIST: mmc: core: fall back host->f_init if failing to init mmc card after resume
We observed the failure of initializing card after resume
accidentally. It's hard to reproduce but we did get report from
the suspend/resume test of our RK3399 mp test farm .Unfortunately,
we still fail to figure out what was going wrong at that time.
Also we can't achieve it by retrying the host->f_init without falling
back it. But this patch will solve the problem as we could add some log
there and see that we resume the mmc card successfully after falling
back the host->f_init. There is no obviousside effect found, so it seems
this patch will improve the stability.

[   93.405085] mmc1: unexpected status 0x800900 after switch
[   93.408474] mmc1: switch to bus width 1 failed
[   93.408482] mmc1: mmc_select_hs200 failed, error -110
[   93.408492] mmc1: error -110 during resume (card was removed?)
[   93.408705] PM: resume of devices complete after 213.453 msecs

Change-Id: I5b24cb84a223394392450a1f10d8bbacb9e1006e
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:16 +08:00
Shawn Lin
795e052cc8 mmc: dw_mmc-rockchip: add v2 tuning support
v2 tuning will inherit pre-stage loader's phase
settings for the first time, and do re-tune if
necessary. Re-tune will still try the rough degrees,
for instance, 90, 180, 270, 360 but continue to do the
fine tuning if sample window isn't good enough.

Change-Id: I593384ee381d09df5b9adfc29a18eb22517b2764
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:16 +08:00
Shawn Lin
a95ce73bf7 mmc: core: Add mmc_sd_shutdown support for SD
The ROM code for Rockchip platform never support detecting
SD 3.0 mode, so if the SD card contains system image running
into SD 3.0 mode in kernel, it will fails to reboot.

The problem is SD 3.0 mode is using 1.8V signal and could only
be switched back into 2.0 mode by power cycle. If the customed
board could not switch off its power rail, the ROM code can't
soft reset the SD.

Add mmc_sd_shutdown to workaround this special case and don't
bother normal SD cards used as external disk by checking the
RESTRICT_CARD_TYPE_MMC flag.

Conflicts:
	drivers/mmc/core/sd.c

Change-Id: I4c3d3111c0bce0ad3cd4f0c6592ff595d7015afe
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
94728f4382 mmc: sdhci-of-arasan: Parse disable-cqe
Add support to disable cqe function if disable-cqe
is assigned by firmware.

Change-Id: Iac2826c4b986c122510af1594c971c4135bafc34
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
9d76cd58bf mmc: core: Set clock after changing timing immediately for mmc_select_hs400es()
This's what mmc_select_hs400() or mmc_select_hs() did,
since mmc_set_clock() will let sdhci_arasan_set_clock()
update the PHY clock to match the timing, otherwise
the following mmc_switch_status() will be failed.

Change-Id: Ic1a0178ec209ec71d904f7212a84da6665904007
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
4734c45258 mmc: core: don't check card status when flushing cache
It's meaningless to check the card's status which execute
the on-going flush. As the status been responded make no
any sense here.

Change-Id: I34197d1c93c01337dd2e68ec22e3ce8dd195c424
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
a03fec2ff6 mmc: dw_mmc: bypass RPM for native CD
Otherwise now the RPM core will gate the clk and power domain,
so that the hotplug will be broken.

Change-Id: I9104ff1beb2db5ef2752179eb91730f48f3089d7
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
976ea163ad mmc: dw_mmc: add xfer timer for avoid DTO without actual data payload
It has proved the controller has a potention broken state with a DTO
interrupt comes while the data payload is missing, which was not
covered by current software state machine. Add a xfer timer to work
around this buggy behaviour introduced by broken design.

Change-Id: I5019c5ba0cdeb59adcdd3a5231a2000b448762bc
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
8c7548af80 mmc: dw_mmc: initialize zero for dma_slave_config
This fixes uninitialized variable introduced by commit ddd2e87ad4
("dmaengine: pl330: add support for interlace size config")

Change-Id: Ib1bbec21053fbcccf85a339d8ed7eec0bbe77727
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
4f0afb8a55 mmc: sdhci-of-arasan: wakeup genpd in probe
Let's keep genpd for sdhci alive while entering deep
sleep which gte me out of yapping around.

Change-Id: I0da20b417621d277745bafd53d1ee461aae72e11
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Shawn Lin
22ddcf4e49 mmc: porting legacy tactices into 5.10
Change-Id: Ieb0e609f5cad4e889be6194f8fd8a54057a1174b
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2021-04-12 20:15:15 +08:00
Tao Huang
f3155b19d7 rk: get rid of legacy 'get_ds()' function
According to commit 736706bee3 ("get rid of legacy 'get_ds()' function")

Every in-kernel use of this function defined it to KERNEL_DS (either as
an actual define, or as an inline function).  It's an entirely
historical artifact, and long long long ago used to actually read the
segment selector valueof '%ds' on x86.

Which in the kernel is always KERNEL_DS.

Inspired by a patch from Jann Horn that just did this for a very small
subset of users (the ones in fs/), along with Al who suggested a script.
I then just took it to the logical extreme and removed all the remaining
gunk.

Roughly scripted with

   git grep -l '(get_ds())' -- :^tools/ | xargs sed -i 's/(get_ds())/(KERNEL_DS)/'
   git grep -lw 'get_ds' -- :^tools/ | xargs sed -i '/^#define get_ds()/d'

plus manual fixups to remove a few unusual usage patterns, the couple of
inline function cases and to fix up a comment that had become stale.

The 'get_ds()' function remains in an x86 kvm selftest, since in user
space it actually does something relevant.

Change-Id: I4b8e3436c958b7745059ea7ef4367f3fd4a0ebbe
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-12 19:56:40 +08:00
Tao Huang
d4de7bcdff rk: Replace deprecated PTR_RET
According to commit fad7c90209 ("err.h: remove deprecated PTR_RET for good").

Initially, commit fa9ee9c4b9 ("include/linux/err.h: add a function to
cast error-pointers to a return value") from Uwe Kleine-König introduced
PTR_RET in 03/2011. Then, in 07/2013, commit 6e8b8726ad ("PTR_RET is
now PTR_ERR_OR_ZERO") from Rusty Russell renamed PTR_RET to
PTR_ERR_OR_ZERO, and left PTR_RET as deprecated-marked alias.

After six years since the renaming and various repeated cleanups in the
meantime, it is time to finally remove the deprecated PTR_RET for good.

Change-Id: I2b5d464dc1c6bc0409e41dd9da503f14bef17dc7
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-12 19:40:45 +08:00
Tao Huang
fd2bfab3ee rk: remove ioremap_nocache and devm_ioremap_nocache
According to commit 4bdc0d676a ("remove ioremap_nocache and devm_ioremap_nocache").

ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Change-Id: Id62917547d7d0d838ac3785f8c2bfd2d645af034
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-12 19:24:04 +08:00
Tao Huang
30dac6b636 arm64: rockchip_defconfig: Enable CONFIG_ARM_PSCI_CPUIDLE
Enable support for PSCI firmware based cpuidle.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I746d25e8e38cac39e895d00c33e7e3ae27bf61a7
2021-04-12 18:38:21 +08:00
Tao Huang
68d7a58af3 ARM: rockchip_defconfig: Enable CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
GPU drivers should select this config.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Id44c1aff8216550e50341667d0f63fdbf2cf9137
2021-04-12 18:34:44 +08:00
Tao Huang
42ed6f90e0 arm64: rockchip_defconfig: Enable CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
GPU drivers should select this config.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I2942405980648abc8cee8de3a0f1e0ec5379724c
2021-04-12 18:28:21 +08:00
Tao Huang
808bc30143 rk: Replace <asm/uaccess.h> with <linux/uaccess.h> globally
According to commit 7c0f6ba682 ("Replace <asm/uaccess.h> with
<linux/uaccess.h> globally").

sed -i "s!#include <asm/uaccess.h>  !#include <linux/uaccess.h>!" \
$(git grep -l "#include <asm/uaccess.h>  " | grep -v ^include/linux/uaccess.h)

PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
      $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I2110dffd32d855ecc9c403fc75cee950f7abb024
2021-04-09 17:08:07 +08:00
Tao Huang
ebef293011 Revert "staging: iio: new invensence mpu6050/6500 driver"
This reverts commit a3c1d3323d.

Change-Id: I79bbd4a094c4cc636f58cf75fa886b582b065136
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-09 15:11:43 +08:00
Tao Huang
5ca870aaf2 staging: remove unused rk29 ipp driver
Change-Id: If2199ef59419e5e963f89b6461b706c9d0d8abd8
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-09 15:09:27 +08:00
Tao Huang
eb7864e36f drivers: remove unused rk29 smc driver
Change-Id: I925aaa94936e09e8eea09f1ae05f1565c4eaab4f
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-09 14:42:43 +08:00
shengfei Xu
7d0153aa70 regulator: fan53555: support reboot
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I216f931fd6a3bc0ccfbad876239d2b0eb25420ea
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2021-04-09 10:45:45 +08:00
Elaine Zhang
dbeca9d00a regulator: fan53555: add support for Rockchip RK860X regulators
Rockchip RK860X regulators share the exact same functionality and
register layout as the Fairchild FAN53555 regulators.
Therefore extend the driver to add support for them.

Both types use the same vendor id in their ID1 register, so it's not
possible to distinguish them automatically.

Similarly, the types also do not match. Type 8 used by the RK8603
and RK8604 start at 500mV and increment in 6.25mv steps,
while the FAN53555 type 8 starts at 600mV and increments in 10mV steps.
And the en register is also differences.

Change-Id: Id93f85de91b79a1922b1efc27771f30dd7bc8bcb
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2021-04-09 10:45:45 +08:00
Joseph Chen
1ca735225a regulator: fan53555: add TCS4525 DCDC support
TCS4525 main features:

- 2.7V to 5.5V Input Voltage Range;
- 3MHz Constant Switching Frequency;
- 5A Available Load Current;
- Programmable Output Voltage: 0.6V to 1.4V in 6.25mV Steps;
- PFM/PWM Operation for Optimum Increased Efficiency;

Change-Id: I7d4b8bbf38a5c74174b16ae4cb64d04f903a2902
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2021-04-09 10:45:29 +08:00
Tao Huang
4b92d5bca3 treewide: replace '---help---' in Kconfig files with 'help' (rk)
Since commit 84af7a6194 ("checkpatch: kconfig: prefer 'help' over
'---help---'"), the number of '---help---' has been gradually
decreasing, but there are still more than 2400 instances.

This commit finishes the conversion. While I touched the lines,
I also fixed the indentation.

There are a variety of indentation styles found.

  a) 4 spaces + '---help---'
  b) 7 spaces + '---help---'
  c) 8 spaces + '---help---'
  d) 1 space + 1 tab + '---help---'
  e) 1 tab + '---help---'    (correct indentation)
  f) 1 tab + 1 space + '---help---'
  g) 1 tab + 2 spaces + '---help---'

In order to convert all of them to 1 tab + 'help', I ran the
following commend:

  $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I6c1a95c0cb15b1a5a4215acba748e7023dfd4338
2021-04-08 18:57:03 +08:00
Guohai Wang
c9e1ebc790 input: Add IR decode driver
Change-Id: I7e6f36b70fd1f5356ad64cad9a0b9f2aab18c2b1
Signed-off-by: Guohai Wang <alex.wang@rock-chips.com>
Reviewed-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
2021-04-08 18:14:45 +08:00
Tao Huang
df2a7ca256 ASoC: rockchip: vad: Fix clang assembly error
sound/soc/rockchip/vad_preprocess_arm64.S:53:18: error: expected 'sxtx' 'uxtx' or 'lsl' with optional integer in range [0, 4]
 add x2, x2, x5, sxtw
                 ^

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I5e9a2442d3d9bb0223290e0dac3f54a580b3f949
2021-04-08 16:15:14 +08:00
Yifeng Zhao
969b0ab881 drivers: rk_nand: fix the problem of clang compilate error
compilate error info:
drivers/rk_nand/rk_zftl_arm64.S:29609:19: error: expected 'sxtx' 'uxtx' or 'lsl' with optional integer in range [0, 4]
 add x0, x5, x21, uxth
                  ^
drivers/rk_nand/rk_zftl_arm64.S:29635:19: error: expected 'sxtx' 'uxtx' or 'lsl' with optional integer in range [0, 4]
 add x3, x19, x3, uxth 3
                  ^
make[1]: *** [scripts/Makefile.build:433:drivers/rk_nand/rk_zftl_arm64.o] error 1

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I59578a4ff3434911c135778f83afc6ec0af5bffc
2021-04-08 09:35:17 +08:00
Tao Huang
d46a5554b4 arm64: rockchip_defconfig: Disable CONFIG_HW_RANDOM_CAVIUM
Which is default y.

Change-Id: Ia8c443016bc42394d98c1561ff4efdddf7161124
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-04-07 20:28:34 +08:00
Bian Jin chen
f67b818670 ARM: rockchip_defconfig: Enable metadata FBE.
Android 11 requires metadata File Base Encryption to protect userdata.

+CONFIG_BLK_INLINE_ENCRYPTION=y
+CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y
+CONFIG_DM_DEFAULT_KEY=y
+CONFIG_MMC_CRYPTO=y
+CONFIG_FS_ENCRYPTION=y
+CONFIG_FS_ENCRYPTION_INLINE_CRYPT=y

Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I479f43d9188f2619e0ac03e2e10006015a50599c
2021-04-07 16:19:33 +08:00
Bian Jin chen
ab9ac154d8 arm64: rockchip_defconfig: Enable metadata FBE.
Android 11 requires metadata File Base Encryption to protect userdata.

+CONFIG_BLK_INLINE_ENCRYPTION=y
+CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y
+CONFIG_DM_DEFAULT_KEY=y
+CONFIG_MMC_CRYPTO=y
+CONFIG_FS_ENCRYPTION=y
+CONFIG_FS_ENCRYPTION_INLINE_CRYPT=y

Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I2a741aa3d46f64375400c6fe8d7fac66b48eecad
2021-04-07 15:53:14 +08:00
Simon Xue
fae620b2b6 iommu/rockchip: add irq mask cb
Change-Id: I5d2d565340395fb3573c7f25d764ed9f66333aeb
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:52:11 +08:00
Simon Xue
f5db486322 iommu: rockchip: rewrite command if failed for RV1109/RV1126
On RV1109/RV1126, there is a rare risk that command would not take effect
for rkvenc_mmu. Rewrite command no more than 10 times. Only consider
enable/disable paging, enable/disable stall these 4 commands
which result can be checked through register RK_MMU_STATUS.

Change-Id: I508783821f05513b28392d5a3d3a55953917f910
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:52:11 +08:00
Simon Xue
7f8158fb41 iommu: rockchip: disable fetch dte time limit
Master fetch data and cpu update page table may work in parallel, may
have the following procedure:

	master                  cpu
	fetch dte               update page tabl
	        |                       |
	(make dte invalid)  <-  zap iotlb entry
	        |                       |
	fetch dte again
	(make dte invalid)  <-  zap iotlb entry
	        |                       |
	fetch dte again
	(make dte invalid)  <-  zap iotlb entry
	        |                       |
	fetch dte again
	(make iommu block)  <-  zap iotlb entry

New iommu version has the above bug, if fetch dte consecutively four
times, then it will be blocked. Fortunately, we can set bit 31 of
register MMU_AUTO_GATING to 1 to make it work as old version which does
not have this issue.

This issue only appears on RV1126 so far, so make a workaround dedicated
to "rockchip,rv1126" machine type.

Change-Id: I808bf87898e2dfdd8ada5666234e4c2c3237ffde
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:52:11 +08:00
Simon Xue
bdbe1596d1 iommu: rockchip: Add support iommu v2
Change-Id: I82dcbf5b9d24bd82d6127558c264226b32e7a7bd
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:52:11 +08:00
Simon Xue
5dcdfc634c iommu: rockchip: Introduce flush_iotlb_all to shoot entire tlb once
Change-Id: I1ef476fcde1b6d323dd2653dc01e27f9990cc6f5
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
3fc0486fdf iommu/rockchip: add max segment size for device
The default max segment size is 64Kb, if memory that device
want to map larger than default then it will break to several times
mapping which may result in non-contiguous IOVA. So set to 4Gb

Change-Id: I22eb7f30a3f741689c8c32734509c34f99fd8100
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
85959f645b iommu/rockchip: ignore device_link for vop
iommu may enabled by pm_runtime_get_sync from vop, this
path is not accept by vop, so ignore device_link for vop

Change-Id: I532a2a964b423e78fadec02c3b4c2952301ebf4b
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
d9cf598162 iommu/rockchip: make compatible to extra sclk
Change-Id: Ia9821eb74effd0b61a42c5cb19ca12f9cf036b78
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
7fafd907ae iommu/rockchip: make compatible to iommu who use "hclk" in dts
Change-Id: If7c5c48e78cdbf189dd445980a61f4ffeb7082ce
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
8b158ee7e1 iommu/rockchip: disable iommu by attaching NULL
Iommu framework introduce default_domain for automatic
attach which we were not interesting before, now rockchip
iommu driver following this way that make things different:

iommu_detach_device function is not able to disable iommu anymore.
It just do following things either:

1. Just return
   Like Vcodec/ISP who does not allocate new domain
2. Attach default_domain
   Like vop who allocate new domain by vop driver

We have no way to temporary disable iommu,to fix this issue, master
driver need to attach a NULL domain,also master driver need more step:

1. iommu_attach_device(NULL, dev) -> disable iommu
2. iommu_detach_device(NULL, dev) -> attach default_domain

Above two steps must comes in pairs.

Following order called by driver is not permitted:

1. iommu_attach_device(domain, dev)
2. iommu_attach_device(NULL, dev)
3. iommu_detach_device(NULL, dev)
4. iommu_detach_device(domain, dev)

Correct is:

1. iommu_attach_device(domain, dev)
2. iommu_detach_device(domain, dev)
3. iommu_attach_device(NULL, dev)
4. iommu_detach_device(NULL, dev)

Change-Id: I12b1e27e5119fb1abd05ccce57c9e941f03e9498
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
e8409200d6 iommu/rockchip: add deferred attach for vop
When jumping from uboot to kernel, vop may page fault, this due
to vop working parallel to kernel probe dts node by cpu.
Defer vop iommu attach function when iommu_ops->add_device called,
and hand the attach function to vop driver is a solution.

Change-Id: I84822ac7a3d0884f96df774a2363c22cbf0f074a
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
31331cb84b iommu/rockchip: use status register instead of flags as parameter
When iommu fall into interrupt, status register indicate more information
than read or write flag, so use status register as parameter when callback
report_iommu_fault

Change-Id: I07c6b9996f305eb970bd1d1d2b0f2a7db53cc6ba
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Simon Xue
a1efc0f6e7 iommu/rockchip: skip read vop iommu registers on rk3128 and rk3126
RK3128 and RK3126 failed to read vop iommu register, it is SoC bug.
Add this patch as a workaround for this bug, make SoC work as normal

Change-Id: I44d4ef7f6e15f85a466563b0b3e8e091db23fba0
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2021-04-07 14:38:11 +08:00
Elaine Zhang
14d85ea556 regulator: fan53555: fix up the dcdc is disabled when reboot
Before reboot if the DCDC is disabled,
the DCDC is still disabled after restart.
We have an method to workaround:
Use vsel pin to switch the voltage between value in FAN53555_VSEL0
and FAN53555_VSEL1. If VSEL pin is inactive, the voltage of DCDC
are controlled by FAN53555_VSEL0, when we pull vsel pin to active,
they would be controlled by FAN53555_VSEL1.
In this case, we can set FAN53555_VSEL1 to disable dcdc,
So we can make vsel pin to active to disable dcdc,
VSEL pin is inactive to enable DCDC.

Change-Id: I14c823ed11dc3369044ad2ed0b53a6027acbccd0
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2021-04-06 16:30:19 +08:00
Elaine Zhang
30c764755f regulator: fan53555: add regulator-initial-mode to set default mode
regulator-initial-mode: default mode to set on startup
regulator-initial-mode is set as:
        REGULATOR_MODE_FAST                     0x1
        REGULATOR_MODE_NORMAL                   0x2
Example:
 vdd_cpu_b: syr827@40 {
                compatible = "silergy,syr827";
                reg = <0x40>;
                vin-supply = <&vcc5v0_sys>;
                regulator-compatible = "fan53555-reg";
                regulator-name = "vdd_cpu_b";
                regulator-min-microvolt = <712500>;
                regulator-max-microvolt = <1500000>;
                regulator-ramp-delay = <1000>;
                fcs,suspend-voltage-selector = <1>;
                regulator-always-on;
                regulator-boot-on;
                regulator-initial-state = <3>;
                regulator-initial-mode = <1>;/*1:pwm 2: auto mode*/
                        regulator-state-mem {
                        regulator-off-in-suspend;
                };
        };

Change-Id: I4d3bbd50fd40531113f2cc6fe63905e24888a752
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2021-04-06 15:21:48 +08:00
Jianqun Xu
1f0218269b pinctrl: rockchip: Add iomux recalculated for rk3328 GPIO2B0~GPIO2B6
The pins from GPIO2B0 to GPIO2B6 are located at GRF_GPIO2BL_IOMUX,
they are recalculated to get correct iomux.

Change-Id: I1e46697c4508c396b5e8140c32c4185925a040ea
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2021-04-02 16:31:07 +08:00
Jianqun Xu
5f5cb213bc pinctrl: rockchip: Add pinctrl support for rk3308b
The main description for rk3308b is as follows:
 - Old iomux multiplexing extension;
 - GRF_SOC_CON5 register add some bits;
 - Newly added GRF_SOC_CON13/15 register.

Change-Id: I94bfcae5387aceae14895f1cafa0bfea51bf8b63
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2021-04-02 16:31:07 +08:00
Jianqun Xu
8e4bbb805b pinctrl: rockchip: Add IOMUX_WRITABLE_32BIT flag for rk3288 gpio0 iomux
There are writable 32 bits for PMU_GPIO0's iomux, so add the
IOMUX_WRITABLE_32BIT to read iomux register at first, it would
not change others' bits.

Change-Id: I1fb27c60d5d26e5719b6911a78e7cdf144feba26
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2021-04-02 16:31:07 +08:00