Commit Graph

839635 Commits

Author SHA1 Message Date
Elaine Zhang
8a6ccdfd71 clk: rockchip: rk3288: mark the aclk_dmac1 as critical clk
crypto and dmac share the same noc clk,
so mark the aclk_dmac1 as critical clk.

Change-Id: I34a4a7cc532a385086679fafb961a47b0a6abc3b
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:04:08 +08:00
Elaine Zhang
73dbc88847 clk: rockchip: rk3368: mark the aclk_dmac_bus as critical clk
crypto and dmac share the same noc clk,
so mark the aclk_dmac_bus as critical clk.

Change-Id: Ib0b70bbed3fdefeab7b6f2b5f88350a416e66787
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:04:07 +08:00
Elaine Zhang
9e1508fdb4 clk: rockchip: rk3288: export PCLK_PD_PMU and PCLK_PD_ALIVE clock id
Change-Id: Ie0550d9528367fa070328562fad2e597a5d6d7f7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:04:07 +08:00
Elaine Zhang
cc7b88d4a0 clk: rockchip: rk3399: export CIF_OUT_SRC clock id for cif
Change-Id: I77423891821dae0412dda4414222ba64bd0a4a4a
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:04:07 +08:00
Randy Li
600925e8ef clk: rockchip: rk3036: export the sfc clocks
The serial Flash controller on the rk3036 would request
two clock nodes.

Change-Id: Iaa50c4a25602a68241b0b9b2f186e4c7e55bc3da
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:04:07 +08:00
Elaine Zhang
6555246930 soc: rockchip: power-domain: support qos node status get
check if qos node is available for use.

Change-Id: Ife40ee58664cd53a9705cda934b92d886ca35522
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:03:46 +08:00
Elaine Zhang
2fa792c706 soc: rockchip: power-domain: Add regulator support
The power domains are supplied by regulators. Add support for them so
that the regulators are properly turned on before a domain is powered up
and turned off when a domain is powered down.

Change-Id: I43ad569e1b82a8e818cbbf2ffcfa6a965d993bbf
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:03:46 +08:00
Elaine Zhang
6eb27c4e56 soc: rockchip: power-domain: remove the rockchip_pd_power(pd, true)
It's not need to power on all pd when add pm domain.
Use pd's real status for pm_genpd_init().

Change-Id: I9a976f01c1b0ff192e09494dcfa236d786495e96
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:03:46 +08:00
Elaine Zhang
756f0ec25c soc: rockchip: power-domain: add power domain support for rk1808
This driver is modified to support RK1808 SoC.

Change-Id: Id622e126936a242f3dfbab94b0e7c7818b41f9ae
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:03:46 +08:00
Elaine Zhang
4d34bb8bf5 soc: rockchip: power-domain: add panic when wait status timeout
Change-Id: Ic0ce83068091313942f9277ba56abffa525da1d2
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 17:03:46 +08:00
Elaine Zhang
b601439ff9 dt-bindings: rockchip: add the power domains for rk1808 SoCs
Change-Id: I6da9acfddfae1ecfa66adb1deba46b6de448ef35
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 16:55:37 +08:00
Elaine Zhang
c4b99e9c6b dt-bindings: thermal: rockchip-thermal: Support the RK1808 SoCs compatible
This patch set attempts to new compatible for thermal founding
on RK1808 SoCs.

Change-Id: I133218cd958e0aabf711a5d22fe5e5da2fbd59ce
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 16:54:45 +08:00
Elaine Zhang
8290dc8dd7 thermal: rockchip: add pinctrl control
Based on the TSADC Tshut mode to select pinctrl,
instead of setting pinctrl based on architecture
(Not depends on pinctrl setting by "init" or "default").
And it requires setting the tshut polarity before select pinctrl.

Change-Id: Ieb181ec19dedbbfb7aef474b3558aac867e668eb
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 16:39:34 +08:00
Elaine Zhang
d3cb398d79 thermal: rockchip: add tsadc support for rk1808
Change-Id: Icc0bb8a076a3fbd5f8ab70db8d7e032165528ae8
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 16:39:34 +08:00
Rocky Hao
d35fb3fe4d thermal: rockchip: tune tsadc parameter of temperature prediction
init temp_last with a more suitable value. also we eliminate
the steady state error by ajusting the temp calc fomular.
extra useful log is added to mark tsadc is probed successfully.

Change-Id: If88031c10646437fa7b5152c70aeaebf93e4df05
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 16:39:34 +08:00
Xinhuang Li
73834d3fc6 clk: rockchip: rk3228: Add clock id for pclk_acodecphy
Change-Id: I289f2c2681e187eaed0cda1561544581409ffd07
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 14:16:59 +08:00
Finley Xiao
3c734e64aa clk: rockchip: rk3368: Add clock id for tsp
Change-Id: I79a423f93f991aab43922e58ce34eac1754304e2
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-13 14:16:47 +08:00
Xinhuang Li
92d76d67b6 clk: rockchip: rk3368: set true clk for spdif
the mux_spdif_8ch_p is composed of spdif_8ch_src not spdif_8ch_pre

Change-Id: I7dd40e35078b2d012af2c777de763d14e93c3d4e
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:21:21 +08:00
Liang Chen
86ad3d0bc0 clk: rockchip: mark rkvdec clk as critical clk on rk3228
Change-Id: I08d8eaa8002a955cf38a90b0a750731e7afae63e
Signed-off-by: Liang Chen <cl@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:21:17 +08:00
Finley Xiao
0ee785bb30 clk: rockchip: Add supprot to limit input rate for fractional divider
From Rockchips fractional divider usage, some clocks can be generated
by fractional divider, but the input clock frequency of fractional
divider should be less than a specified value.

Change-Id: Ifd6c5f6a24a64021f990506e8657cd925f9b96f9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:21:12 +08:00
Tao Huang
5b68eec983 clk: rockchip: drop severity of 'invalid clk rate' message
These are noisy during boot:
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] rockchip_mmc_get_phase: invalid clk rate
[    0.000000] rockchip_mmc_get_phase: invalid clk rate
[    0.000000] rockchip_mmc_get_phase: invalid clk rate
[    0.000000] rockchip_mmc_get_phase: invalid clk rate
[    0.000000] rockchip_mmc_get_phase: invalid clk rate
[    0.000000] rockchip_mmc_get_phase: invalid clk rate
[    0.000000] Architected cp15 timer(s) running at 24.00MHz (phys).

Change-Id: I0a5ca5a1e0b6c6ba9038fa64635dc448bb5c612b
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:20:56 +08:00
Finley Xiao
4a67123cc7 clk: rockchip: rk3228: Fix sclk_wifi div_width
Change-Id: I8e216249fbd588ce55660eba9911fc59aedc920d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:20:36 +08:00
Liang Chen
0a3b4eb464 clk: rockchip: Add adaptive frequency scaling for pll_rk3036
Change-Id: Ifd035967afc1852df81daa2b15afea764c5b851d
Signed-off-by: Liang Chen <cl@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:20:11 +08:00
Finley Xiao
b8daed0133 clk: rockchip: Fix cpu frequency overflowing
If change parent to alternate parent and the old parent clock speed is less
than the clock speed of the alternate parent, add dividers first and then
select alternate parent.

If change parent to primary parent, select primary parent first and then
remove dividers.

Change-Id: Ib82de9a936effe5c885639799f3bb5629dc89f8d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:15:36 +08:00
Finley Xiao
aa8173513c clk: rockchip: rk3328: Fix clk_cif_src parent
Change-Id: I0ea209224880b8c51a385ed46827bb0d8f7dd219
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:15:12 +08:00
Finley Xiao
488ffe507e clk: rockchip: px30: fix gpu clk
Remove clk_gpu_divnp5.
Fix gpu frequency overflowing.

Change-Id: I67f47f5fdd7873c22b1349e3aeb80b7157c7844c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:15:03 +08:00
Finley Xiao
1497e5c949 clk: rockchip: rk3288: Add TSP clock
Change-Id: I02185c5ab7a1072d271cd51161f6d4b05d327673
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:14:08 +08:00
Finley Xiao
eff5ccdefb clk: rockchip: rk3128: Add sclk_hsadc_tsp
Change-Id: I842869a7ea79730daa6616f1cf2a8f5db7165ceb
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:14:00 +08:00
Finley Xiao
7293bb6e68 clk: rockchip: rk3328: Fix aclk_gmac select register
Change-Id: Ie800d876644f1a7abac3f7d7f8352ba405a9537a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:13:52 +08:00
Xinhuang Li
0f3337613e clk: rockchip: rk3328: the group of softrst is 12
Change-Id: Idec7baa6bb0bb5824270e9cd8f3c6ed38d47ecc1
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:12:54 +08:00
Rocky Hao
25ddf5bcd3 thermal: rockchip: add tsadc support for rk3308
Change-Id: Ibf1782ca471c8ad4b14d6fd64eeb123181903adc
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:07:11 +08:00
Rocky Hao
b7372154d4 thermal: rockchip: add shutdown callback function
Tsadc has a tshut pin which is designed to reset the pmic or soc,
when the temperature inside soc is too high. we should switch off
the tshut function and change the pin to gpio function in reboot
process, eg, software reset. If not, the tsadc module will WRONGLY
pull high the tshut pin during its reset process and then WRONGLY
reset the pmic or soc, which incurred a hardware reset. The hardware
reset will reset everything inside soc, even includes the power on
reason flag, which is set by software before reboot process.

we also change over-temperature protection mode to cru mode,
since the tshut pin have be changed to gpio function.

Change-Id: Iac3dacf55a4b5536fccd2eb05a6a9e6923a082c0
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:07:10 +08:00
Rocky Hao
265e89a8bf thermal: rockchip: add tsadc support for px30
Change-Id: I46ac8ebd4a92367acb610fb96c18a487c67602d4
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:07:10 +08:00
Finley Xiao
148e9ae288 soc: rockchip: power-domain: Fix restore error qos value
Change-Id: I74692018652ed2aa45b666f1598662146beec92e
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:02:37 +08:00
Finley Xiao
743525f3c9 soc: rockchip: power-domain: Add support to ignore on/off
Change-Id: I96c3ae8ae53b9ae95f6f896363b761798a534821
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:01:06 +08:00
Finley Xiao
ce842d4e62 soc: rockchip: power-domain: export qos save and restore
Change-Id: I89af4462f561fa06ace7761e20cf522b5954aaed
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-03-12 20:00:49 +08:00
Frank Wang
9f2fb93354 phy: rockchip-inno-usb2: add wake_lock function
Prevent the system from entering suspend when usb cable is connecetd.

Change-Id: I50c4a09d9142ebeb2d4e2a0ab2df59f98ef99737
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
153538b270 phy: rockchip-inno-usb2: add bypass uart cfgs for rk1808
This patch adds bypass uart cfgs for rk1808 USB 3.0 OTG
port. In addition, please note that it needs to set the
uart2 rx/tx io selection in the reg "BUS_GRF_IOFUNC_CON0"
bit 15:14.

Change-Id: I77ea461be299c0454f5caee1349110b6f2714c30
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
3e79e9c0c4 phy: rockchip-inno-usb2: add phy configurations for rk1808
RK1808 SoC has an usb 2.0 comb phy with one otg-port and one
host-port. This patch adds port configurations for them.

Change-Id: Id4d117929ec0e327c8f2cc1a06d4caaa2d584f06
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
2d19e6806b phy: rockchip-inno-usb2: register 480MHz clk at the end of probe
We find an usb phy 480MHz clk prepare fail issue on PX30/RK3326
platforms with RK819 PMIC. On PX30/RK3326 platforms, we set the
usb480m clk to critical because GPU 480M is from usb480m and the
source clocks should be always on. And the usb phy 480MHz clk is
parent of usb480m clk, so the clk framework will prepare the usb
phy 480MHz clk when register it.

This logic works well if the usb phy probe only once. But if the
usb phy needs to probe twice or more because of some reasons (e.g.
fail to get vbus regulator from RK819), the usb phy 480MHz clk will
be unregistered and registered again, however, the clk framework
doesn't prepare the usb phy 480MHz clk except the first time register
operation. So we move the 480MHz clk register to the end of probe,
and make sure only register it once.

Change-Id: If69378b49035746a7c0107c6a363c4d91dfc15e5
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
42ee2ffcde phy: rockchip: rockchip-inno-usb2: and otg cfg for rk3368
This patch adds rk3368 otg-port phy configurations.
But actually, we don't use the otg phy configurations
for the time being, because we use dwc_otg_310 driver
for rk3368 otg controller, and this driver doesn't use
generic phy. This patch is useful if we switch to dwc2
driver for rk3368 otg in the feature.

Change-Id: Ibed3fde4ef64ad25e933ac4560f956b7c9f5c476
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
f7a26c41a7 phy: rockchip: rockchip-inno-usb2: check iddig upon resume
Because USB OTG id irq is disabled during system suspend
and enabled after resume, so the usb2 phy doesn't notice
any id status change upon resume. It may cause two issues:

1. Plug in OTG cable and USB device when system enter
   suspend, it will fail to detect the OTG cable and
   USB device after resume.

2. Plug out OTG cable and USB device when system enter
   suspend, and then connect USB to PC or USB charger
   after resume, it will fail to detect USB charge type.

This patch restores the OTG id status before enter suspend,
and check the id status upon resume, and set the extcon
state and vbus if id status has changed.

Change-Id: Iaca14841cc287e7d82e1cffd64ff18bba86d3ba4
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
Meng Dongyang
9eb67154eb phy: rockchip: rockchip-inno-usb2: flush otg work when exit
The controller will be reinit when suspend and resume in device
mode if not connect to PC. And the U2PHY must be keep in power
on state during the init process. But The 'otg_sm_work' may be
schedule immediately and power off the U2PHY if system suspend
and resume between the delay time of schedule 'otg_sm_work', so
it will result in the error when init controller as below:

dwc2_core_reset() HANG! Soft Reset GRSTCTL=80000001

So flush the otg work in exit function to finish power control
of U2PHY.

Change-Id: I79c4b6a877196abd2f2201b2f984c9ea22e48fec
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
009901098a phy: rockchip-inno-usb2: fix comparison warnings
This patches fixes comparison between signed and unsigned values.

Change-Id: Ie417fdb8092463890a67bce7efa11f3ef20d5871
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
5319b2a3bb phy: rockchip-inno-usb2: fix a clang warning
This patch fix the following clang warning:
[clang]drivers/phy/rockchip/phy-rockchip-inno-usb2.c:1255:3:
warning: Value stored to 'delay' is never read

Change-Id: I8c70975e1bc2b24a78d0934ccefc9d67fe3a5da9
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
86e7f9572c phy: rockchip-inno-usb2: reduce the otg schedule delay time
Reduce the otg schedule delay time from 6s to 1s to do
the first time usb charger detection earlier when power
on system with usb cable connect to PC USB. Because the
usb connection willed be disconnectted during usb charger
detection.

And the patch also makes the phy detect the usb disconnetion
more quickly after usb cable plug out.

Change-Id: I9b55317ab3592f517fdf590fea85c4ed403bbd8d
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
a96c31bfe6 phy: rockchip-inno-usb2: open pre-emphasize for rk3228
Open pre-emphasize in non-chirp state for rk3228 USB
PHY0 otg port to increase HS slew rate.

Change-Id: Ia565746286a750a251619a83cbbead99c0ddecbd
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
Meng Dongyang
6bf52fb9a6 phy: rockchip-inno-usb2: make u2phy enter low power mode
Make u2phy enter low power mode when suspend. If config the DT of
u2phy port with "rockchip,low-power-mode" property, the port will
be config to lower power state when suspend.

Bvalid irq and linestate irq will be disabled in this mode.

Change-Id: Ie7d40a9a181b0622b1f8d062a741661548cabd59
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
Meng Dongyang
2f6076d7bf Documentation: bindings: add rockchip,low-power-mode property for u2phy
Change-Id: Id99aeb68aa5b6174a3a97f413f09270d893cef4e
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00
William Wu
e4fe585d6b phy: rockchip-inno-usb2: open pre-emphasize for rk3308/rk3328
Open pre-emphasize in non-chirp state for rk3308 and
rk3328 usb otg and host ports to increase HS slew rate.

Change-Id: I16435d67b9994cef0fd5e6edbae00c41cc02c48b
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2019-03-12 17:12:55 +08:00