Commit Graph

356 Commits

Author SHA1 Message Date
Elaine Zhang ed2a409163 clk: rockchip: rk3288: fix up the dclk_vop setting freq error
fix the commit b328c914c:
(clk: rockchip: rk3288: fix up the dclk_vop freq setting)

Change-Id: Ic4df8bcd4410dbc0484c1ea50d73e70aa64556bb
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-10-22 18:03:06 +08:00
Elaine Zhang fab096102c clk: rockchip: rk1808: Support dclk_voplite to set any of the frequencies
Change-Id: I7ac53f75244388e7fb448a721e55b6b1e789d4d7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-10-22 09:26:11 +08:00
Elaine Zhang b328c914c0 clk: rockchip: rk3288: fix up the dclk_vop freq setting
Change-Id: I960a02cba63076afbc845e5ccdfb9f85a553d38b
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-10-19 15:30:55 +08:00
Elaine Zhang ba5feded0a clk: rockchip: rk312x: add cpll freq init
Add cpll freq setting in rkclk_init.
If have vop display, the cpll is just for dclk vop.
The cpll freq will be setting by dclk freq set.
But if no vop display, the cpll need to set init freq for other
children clk.

Change-Id: Ia45892dd3c8efb77cf32b631329d927aceb8dd86
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-10-19 15:29:24 +08:00
Elaine Zhang 1ae6d6e5c8 clk: rockchip: rk1808: fix up the dclk_raw/lite set rate error
Change-Id: I0b8c7d0e15501c7ecc3c5acb0e0844e722ad18ab
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-10-10 11:27:30 +08:00
Elaine Zhang dad1489559 clk: rockchip: rk1808: support pclk_pmu freq setting
set pclk_pmu freq before ppll freq setting.

Change-Id: Ieab142dd9e41d98d9798be08a0f01f941d3ad9a4
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-10-07 09:08:17 +08:00
Elaine Zhang aa8c298733 clk: rockchip: mmc: add mmc set and get phase
add mmc set and get phase for rk3128\rk3328\rk3368

Change-Id: Ic8d7764391165f28c54721c4af218f8623b2f3a7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-09-29 10:20:11 +08:00
Elaine Zhang cb3c37fcc0 clk: rockchip: support clk_tsadc setting freq
Change-Id: Ie5e91c95d6ff3caf618ff1a5e5e3b7dcf6723325
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-09-27 18:24:57 +08:00
Sugar Zhang 95f2641240 clk: rockchip: px30: add support clock for SCLK_I2S1
Change-Id: Iaaacd6fdabe2c702202ffe09dc95cd6d648597d6
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2018-09-25 19:32:33 +08:00
Joseph Chen f680c019e6 clk: rockchip: add debug info for waiting pll
On FPGA, PLL is fake and can't give a lock state which causes
dead waiting, so that adding a debug message to easily notice
this situation.

Change-Id: Ic7dccedb3d7e5c7588da85bb4c4552b924f60e43
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-09-12 15:51:10 +08:00
Elaine Zhang 45a3782ab4 rockchip: clk: rk1808: add clk driver for rk1808
Add basic clock for rk1808 which including pll, cpu, bus,
emmc, i2c, spi, pwm, saradc clock init.

Change-Id: I302c91e64d0c44ea991d734371811ab4be77c9ab
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-29 15:25:55 +08:00
Elaine Zhang 41c0dd9b25 clk: rockchip: rk3399: Improve the aclk_perilp0 frequency
Set aclk_perilp0 to 300M,
To improve the performance of dual USB transmission.

Change-Id: I3842742e87ed1d483215ec7bccb75b1c0ed503bf
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-28 19:16:42 +08:00
Kever Yang 47b085748c rockchip: clk: rk3399: fix assert error
We can not meet the assert condition after we update the code,
fix it so that we can enable the DEBUG option.

Change-Id: I4b3e6b30aae4480ed208f30610493a7d297e90ee
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-08-23 11:57:57 +08:00
Finley Xiao a737bf22c0 rockchip: clk: pll: Fix pll rate overflow calculation on 32-bit
Change-Id: Ide0a10a19218443fa016ee91b5a18cfbf3e0948d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-17 10:52:21 +08:00
Finley Xiao 45484bdc51 rockchip: clk: px30: Add support to initialize npll rate
Change-Id: If98ed54ad785a40efae7da78c5f0122158a3de61
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-16 10:19:09 +08:00
Elaine Zhang 02104b86c5 clk: rockchip: rk3368: fixup the bus and peri parent
make the bus and peri parent to GPLL.

Change-Id: I3956752c1191a6417d16fa9a9765574f38c7ab7b
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-09 16:38:20 +08:00
Finley Xiao 94058cdffd rockchip: clk: rk3308: Add clk_set_defaults()
As clk_set_defaults() is removed in device core, so add it in clock
driver.

Change-Id: If09a9ddca27a3d1fc0747d8cafbeaacd8ef97d36
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-09 10:08:07 +08:00
Finley Xiao 03a6c02989 rockchip: clk: rk3308: Add support to set and get armclk rate
Change-Id: I2f4bbed7d6c43f340892968ce8e2ed417f975e97
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-09 10:08:07 +08:00
Finley Xiao 27ee7641c9 rockchip: clk: rk3308: Use common apis for setting and getting pll rate
Change-Id: Id60ebe239148c7fa7bb8ca1abb411570596c6e28
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-09 10:08:07 +08:00
Finley Xiao c996ae8a43 rockchip: clk: px30: Add support to get vopl aclk and dclk
Change-Id: Id40cbddf780889e308839b7beb2cfb894d407914
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-09 10:08:07 +08:00
Finley Xiao fe784db32b rockchip: clk: px30: Add px30_clk_init()
Add support to initialize gpll, bus and peri clock rate.

Change-Id: I84f496094606ac2231ea27ad9072b079c45f9f94
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-09 10:08:07 +08:00
Elaine Zhang 8e2239d5eb clk: rockchip: rk3328: replenish some CLK settings
Change-Id: I33e6ff57c2d616c933a458dade9a751460d0bc9a
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-06 11:21:15 +08:00
Elaine Zhang 7150785e44 rockchip: clk: rk3368: support more clks to set and get rate
Make clock ids consistent with kernel.
Support more clks to set and get rate.
Add clk dump.

Change-Id: I348c98ce81ce76af9c492a30480fcb495da7ed79
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-06 11:20:24 +08:00
Finley Xiao d101530a8a rockchip: clk: px30: Add support to set vopl aclk and dclk rate
Change-Id: I31376ebb8d1d40d46ad4e2b6421b65ac7fae096d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Finley Xiao f909d4a8c9 rockchip: clk: px30: Add support to limit minimum rate for vop dclk
Change-Id: Ieff359603b1b6dede4377b1a17daf3eb803e2552
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Finley Xiao bf97d0d67a rockchip: clk: px30: Avoid setting gpll rate repeatedly
Change-Id: I24a062bf17f2552b94c9421b52ee930890fefcb6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Finley Xiao eb46e71787 rockchip: clk: px30: restore bus and peri rate when change gpll rate
Change-Id: I208196e11e7c4fa5db26a02abdd41ecfa610d5bd
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Finley Xiao a221d6e67e rockchip: clk: px30: Add support to set npll rate
Change-Id: Ida62e70610bd28d4c7d327e0431f09b0e4de6b2e
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Finley Xiao c4d4e4dc26 rockchip: clk: px30: Add clk_set_defaults()
As clk_set_defaults() is removed in device core, so add it in clock
driver.

Change-Id: Ib5b9a7f81c738c65f2cb3e0ca74a410cda2ca1e2
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Finley Xiao 56dd66cf79 rockchip: clk: px30: Modify the print format of clk
The new print format can reduce startup time.

Change-Id: I7ea53e07b8245fe4b5ef1fa15dd1f6efb176db47
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-06 11:12:03 +08:00
Elaine Zhang 09e1ca4340 clk: rockchip: rk3399: fix up the pll setting
If the gpll and npll freq is no change,don't set pll once again.

Change-Id: Ib16a0a1ff56560997b6ed4b487fc2d56928c14ec
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-02 17:04:36 +08:00
Elaine Zhang efb944b698 rockchip: clk: rk3128: support more clks to set and get rate
Make clock ids consistent with kernel.
support more clks to set and get rate.
add clk init.

Change-Id: I1e6b5734887e0bd5d845f1286f10eb0e3e42bc08
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-02 17:03:55 +08:00
Elaine Zhang 809e91fd38 rockchip: clk: rk322x: support more clks to set and get rate
Change-Id: Ibed40f1826469263a8015d8af2dea4d3567a08e6
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-02 17:03:55 +08:00
Elaine Zhang 0b7db90f19 rockchip: clk: rk3328: support more clks to set and get rate
Change-Id: Ic231b7701c6eb23b0e9db21c1d28fb4d08c4debf
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-02 17:03:55 +08:00
Elaine Zhang 2f0a72b1f2 rockchip: clk: pll: add common pll setting funcs
Change-Id: I99887338a4f84aead905938eee066b460c4c1b9f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-08-02 17:03:55 +08:00
chenfen b2a78faeb5 rockchip: clock: rk3399: support 400KHZ output for emmc initialization.
support 400KHz output for emmc initialization

Change-Id: I4f2182981f587688c777f64c30d0eeb59f69b0ea
Signed-off-by: chenfen <chenfen@rock-chips.com>
2018-08-01 17:21:49 +08:00
Elaine Zhang 4897499e15 clk: rockchip: rk3399: add gpll and npll init
remove clk_set_defaults(), need init pll freq as kernel.

Change-Id: I245d01bf65b3092c21a0c2aa06a0a6eaca8528ef
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-07-27 15:44:58 +08:00
Elaine Zhang c6c6283c78 rockchip: clk: rk3399: fix up the hdmi clk error
make the dclk_vop div=1.

Change-Id: I0faedbd557cddd55f93529d66f2f7815ce4c5f9e
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-07-20 17:38:15 +08:00
Elaine Zhang 3afe53975c clk: rockchip: rk3288: add PLL_LIMIT_FREQ
npll is for dclk, add PLL_LIMIT_FREQ for better jitter.

Change-Id: I6ac09e9bdbd1bef0eddb37835100be782b772d54
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-07-10 14:43:00 +08:00
Finley Xiao 4ffb5e6c04 clk: rockchip: rk3308: Modify the print format of clk
Change-Id: Idb56e8c662fafe443e8f271046d8b6298b1ca5ec
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-07-09 19:53:33 +08:00
Finley Xiao e27c054acc rockchip: clk: rk3308: Correct clock divisor range assertions
Change-Id: I97e8b1b5c454d9cea4126a302491a63f1d57b430
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-07-09 19:51:24 +08:00
Finley Xiao cb981eea7f rockchip: clk: px30: Correct clock divisor range assertions
Change-Id: Ie187ca603b47bfedaa33041ce85e78be7d4b5b23
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-07-09 19:51:24 +08:00
Elaine Zhang 6944022d14 clk: rockchip: rk3399: remove pll init
use the dts node to set rate by:
assigned-clocks = <&cru PLL_GPLL>;
assigned-clock-rates = <800000000>;

Change-Id: I2a674213509308fcd5ad27239bdf261c428d8027
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-07-09 19:48:56 +08:00
William Wu 0a3a50d644 rockchip: clk: rk3399: add phy 480MHz clks for usb Host0/1
In kernel dtb, the rk3399 usb Host0/1 use SCLK_USBPHY0/1_480M_SRC
in addition to HCLK_HOST0/1 and HCLK_HOST0/1_ARB. This patch adds
the phy 480MHz clks for usb Host0/1 to ensure the generic ehci-driver
(ehci-generic.c) to enable the clocks successfully.

Change-Id: I0790e949bca0d7bdc4179f3232b29aa58436593f
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-06-28 16:52:44 +08:00
Elaine Zhang 6bfdfc4f06 clk: rockchip: rk3399: support dual pll for vop
set the vop's parent just vpll and cpll,
set vop parent in dts node,the same as kernel setting.
i.e:
&vopb {
	status = "okay";
	assigned-clocks = <&cru DCLK_VOP0_DIV>;
	assigned-clock-parents = <&cru PLL_VPLL>;
};
&vopl {
	status = "okay";
	assigned-clocks = <&cru DCLK_VOP1_DIV>;
	assigned-clock-parents = <&cru PLL_CPLL>;
};

Change-Id: I07ab4e2837cf7fc0860e8b4d14adb8936f5cb27a
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-06-28 16:35:33 +08:00
Finley Xiao 37428b9209 rockchip: clk: px30: Add support to set and get armclk rate
Change-Id: I40948e5cedb781cad7129b02dfbf34fecb8689ca
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-24 17:19:14 +08:00
Finley Xiao 4a9de4c99b rockchip: clk: px30: Avoid emmc, sdmmc, nandc, rate overflowing
Change-Id: I75b5bed7962fcd7ffad84dc1c4d2ffbbf1404ad3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-24 17:18:32 +08:00
Yifeng Zhao 60a1199e41 rockchip: clk: px30: fix nandc clock freq caculate
The nandc clk no need div 2.

Change-Id: I9e33ef3a4b5c5dcd024f3aed26ddee9fb8e6af6c
Signed-off-by: Yifeng Zhao <zyf@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-24 17:18:05 +08:00
Finley Xiao dd472d4ff5 rockchip: clk: px30: Change apll rate to 600MHz
The initial voltage may be too low for 816MHz and it is enough for
600MHz.

Change-Id: Ifa1438d8d3056c9fb8fb3e578a28c26682a27e46
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-24 17:17:26 +08:00
Finley Xiao 7a1915c07b clk: rockchip: px30: implement soc_clk_dump
Change-Id: I8c5c4468ed6c6d1f4767a0a6ddaa2b47037fe8bc
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Finley Xiao 8b1aed51a6 clk: rockchip: px30: Add support to get pll rate
Change-Id: I41834e2d5e2537a71d68228d995cbfcc04744959
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Finley Xiao cefa5186b0 clk: rockchip: px30: Add support for pmucru
Change-Id: I445ae2b2491d1709d2790412fcc07dccf56189d9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Finley Xiao 7b1c1c4be3 clk: rockchip: rk3308: check pll rate before set and get rate
As clk_set_defaults() is called before rk3308_clk_probe() and pll rate are
assigned when clk probe at present, so if enable kernel dtb and it contains
"assigned-clocks" property, the pll rate will be zero when set and get clk rate.
In order to fix this, check and assign pll rate before set and get rate.

Change-Id: Ic8e9fcf487e7531a8ef23f54d0786e0cbc9a9f4a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Finley Xiao 6399bf1d8a clk: rockchip: rk3308: update dpll_hz if dpll rate is changed
Change-Id: I133c4c19968de249902db005fea31648bb69a7fc
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Finley Xiao 4e6d575238 clk: rockchip: rk3308: Fix divisor for i2c, saradc, pwm and spi
Some divisor calculations were misrounded, causing higher than
requested rates on some clocks. Fix them up using DIV_ROUND_UP.

Change-Id: Ie90598d94e9a8dcde9c68ec9986ea200293c2d5b
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Finley Xiao e8ca712810 clk: rockchip: Fix clk name of PLL_DPLL
Change-Id: Id2d9e91917a8011d150f499bfc91eae02e5a0642
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-13 11:07:38 +08:00
Elaine Zhang 680c48344f clk: rockchip: rv1108: support i2c clk get and set rate
Change-Id: Iff7e9191e66e0eff828b9ea51cb952ee7139457f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-06-06 17:56:31 +08:00
Finley Xiao efdbac3478 clk: rockchip: rk3308: implement soc_clk_dump
Change-Id: I6f0c3f56a878f491c4bb1deafd8e020e052e2287
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-05 08:56:08 +08:00
Finley Xiao 6c96c4c345 clk: rockchip: px30: Add support to set rate for bus and peri clks
Change-Id: Ic122eaea3c1c63e6108eabf41ca1b46a30cc66ef
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-05 08:56:08 +08:00
Finley Xiao 1e180a5641 clk: rockchip: rk3308: Add support to set and get pll rate
Change-Id: Idfbe59c3f1d12d0e9adcb253e3d6db9e994bc44c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-05 08:56:08 +08:00
Kever Yang 05b226ad5b rockchip: clk: rk3328: convert to live dt
Use dev_read_addr_ptr to get cru base

Change-Id: I6bae4b3e540f2d70f50615bf7cff0af99908f859
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-06-01 17:39:59 +08:00
Kever Yang 7d9cf22de9 rockchip: clk: rk3288: convert to live dt
Use dev_read_addr_ptr to get cru base

Change-Id: Ia0c7e42beff1442055156d2125d35a58b5be8b13
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-06-01 17:39:46 +08:00
Kever Yang b1cc17a3f7 rockchip: clk: rk3188: convert to live dt
Use dev_read_addr_ptr to get cru base

Change-Id: Ib0903a0ec7b0602fb2f78bab65c44db071f13bd0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-06-01 17:39:46 +08:00
Kever Yang 11143e9c45 rockchip: clk: rk3066: convert to live dt
Use dev_read_addr_ptr to get cru base

Change-Id: I22d0a98ff29d894ec777574f93f145c55383ffa0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-06-01 17:39:46 +08:00
Kever Yang 52ae0af19e rockchip: clk: rv1108: use ofdata_to_platdata for cru base
We use ofdata_to_platdata() to get cru base from dtb,
update the api with support for live dt.

Change-Id: I652c82a427693093d4ceca5d747543af945b0986
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-06-01 17:39:46 +08:00
Elaine Zhang 5cb579f13b rockchip: clk: rv1108: Add some frequency setting interfaces
support PLL freq setting,
support bus and peri clk freq setting,
support aclk vio and dclk vop freq setting.

Change-Id: I894552c1e1bb1bd13a143e200edf289234a53c1d
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2018-06-01 11:55:11 +08:00
Finley Xiao fc4a6bd40d clk: rockchip: rk3308: Move pll rate into clk private data
Change-Id: I424259266a4c76031192bf07d52c29cd3e48ec0a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-05-25 11:51:32 +08:00
Finley Xiao df8f8a42aa clk: rockchip: px30: Add support to set rate for bus and peri clks
Change-Id: Iaef91432628395e9f955d2d08455a53e6034c669
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-05-25 11:46:18 +08:00
Finley Xiao 9f8e13d3a0 rockchip: board: probe clks after load kernel dtb
pmucru isn't referenced on some platforms, so pmucru driver can't
probe that the "assigned-clocks" is unused.

Change-Id: I390b302c9101f87dcd9264fda39e1f2e0e66d2b3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-05-25 11:46:18 +08:00
Caesar Wang 1d2570d36f clk: rockchip/rk3399: fixes the correct clock init
We will use the rkclk_init() for rk3399 without SPL/TPL way.

Change-Id: I73a4d694ff2cb0e18f390c293971985f41d2b03d
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2018-04-19 10:00:11 +08:00
Kever Yang 41dd6e98d0 rockchip: clk: rk3128: add ofdata_to_platdata callback
We need to init platdata from of data with ofdata_to_platdata callback.

Change-Id: I9e8e9427767f9de84c9871d9a639e7fdb5319ba4
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-04-12 15:56:49 +08:00
Kever Yang 87e0d84ff7 rockchip: clk: rk3288: do rkclk_init() when CPLL is in slow mode
The pre-loader(eg. miniloader) may not init the CPLL, we need to
do the rkclk_init() to init the clocks in U-Boot, or else we may
get wrong serial baurd rate in kernel.

Change-Id: I4a226e110638aa18d10df35e8d9507f6679a5678
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-04-03 11:55:57 +08:00
Finley Xiao ec20593d9e clk: rockchip: rk3308: Add support to set dclk_vop rate
Change-Id: Ib7b5d35d4a65167d660f254600e0673bebd70432
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-02 17:50:55 +08:00
Finley Xiao 72510c146a clk: rockchip: rk3308: Change peri bus parent to dpll
Change-Id: I375500bdfaf884daf646b7c29e260fe997645f37
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-02 16:13:03 +08:00
David Wu 00fbb281ed rockchip: clk: rk3036: Add power down and power up for pll set
If power down and power up were not done, there was an error during
pll setting again.

Change-Id: Iaa5ef558c2bff270614f08d96a70e5c847ce927c
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-03-29 16:27:44 +08:00
David Wu bb8e4ec3d9 clk: rockchip: Get cru's reg address before probe for rk3036
The assigned clock-rate and clock-parent is done before probe,
so it is better to get cru's reg address at ofdata_to_platdata
before probe, otherwise there is a error to use cru's red address.

Change-Id: I7af5faa931352a4ee4a495efa9b80c95066eb5c5
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-03-29 16:27:44 +08:00
Finley Xiao 9064e0be0b clk: rockchip: rk3308: Delete DEBUG
Change-Id: Ie4a3c3d37e464ac89a2b0e7990ec2760996e813f
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-23 21:44:40 +08:00
Finley Xiao ceb961ad05 clk: rockchip: rk3308: Fix cpu clock error
Change-Id: I89f6f14fef0bb5222ec098f4afa71fed66ee1b83
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-23 21:44:35 +08:00
Andy Yan 54d254fe97 clk: rockchip: add clk driver for rk3308
Add basic clock for px30 which including cpu, bus, emmc, i2c,
spi, pwm, saradc clock init.

Change-Id: Idd8542d7833e4997378bce99e0a464d5d16890fd
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-21 16:49:40 +08:00
Finley Xiao 693b63de6e clk: Don't break when set default rate unsuccessfully
Change-Id: I8073d6a68602aa5a8bc79accb13e95fcb2142cfa
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-21 16:43:15 +08:00
Finley Xiao f91572913e clk: rockchip: px30: Fix saradc div mask
Change-Id: I79ecf32b78b9c4b71fa7f03ef3fa4ca80a80e70d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-21 16:42:31 +08:00
Finley Xiao 6fb52ead7d clk: rockchip: px30: Fix pll lock status
Change-Id: I0ccae06f42b37a21af7fc877bb00ca498dd8b95f
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-15 15:47:57 +08:00
Finley Xiao fce7cb7b10 clk: rockchip: px30: Fix return value for some clocks
Change-Id: Iac7a67337f05c42e99ad5e2eebbeb82b6375f676
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-15 15:47:26 +08:00
Kever Yang 96f1b3d949 rockchip: clk: px30: support emmc ciu-sample clock
ciu-sample is a dummy clock, which should be the same with sclk_emmc.

Change-Id: I5350774a390555153ddaee49fb9613f25f4f249b
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-03-13 11:36:03 +08:00
Kever Yang 0dc8896c7e rockchip: clk: px30: only do one time clk init
We may get into clk_probe more than one time from TPL/SPL/U-Boot,
and we only need to init bus clock one time.

Change-Id: Iab0434c66d344ff57c1edd30679c3ab3bb8f2b17
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-03-09 18:21:07 +08:00
Lin Huang ccced9e100 clk: rockchip: rk3399: refactor configure cpu clock function
some board request enable cpu big core clock in uboot,
refactor rk3399_configure_cpu() function, so that the little
core and big core can reuse this function to set clock.

Change-Id: I0390d22179faf91307b22348f6f9329a58f00143
Signed-off-by: Lin Huang <hl@rock-chips.com>
2018-03-06 15:29:08 +08:00
Lin Huang 5f42424bae clk: rockchip: Correct and standardize clock divisor range assertions
Some of the asserts for valid clock divisor ranges were off by one. This
patch corrects them and writes them all in a consistent way.

Change-Id: Ia87974c8e27b7414cfe9210a916d114aa81f5ccb
Signed-off-by: Lin Huang <hl@rock-chips.com>
2018-03-06 15:29:08 +08:00
Lin Huang 1702a77f8e clk: rockchip: rk3399: Fix rkclk_init() to actually use PERILP1_PCLK_HZ
This patch fixes a typo in the clock initialization code that caused the
PERILP1_PCLK_HZ constant to be ignored and the clock to always run at
the same speed as its parent (PERILP1_HCLK_HZ). Since we've done all our
previous tests and validation with this bug, we should probably increase
the value of the constant (that had not actually been used) to the value
that we had been incorrectly using instead.

Change-Id: I8e1725f71ea0dbacd01929b8e8a80b91dc4f17cc
Signed-off-by: Lin Huang <hl@rock-chips.com>
2018-03-06 15:29:08 +08:00
Lin Huang e959b7070e clk: rockchip: rk3399: support uart0~uart4 clock get rate
some board will use other uart as console output,
so add uart0~uart4 clock get rate.

Change-Id: Iafde4819cdcf3e650fe14c7c3dd9784d953ba8a0
Signed-off-by: Lin Huang <hl@rock-chips.com>
2018-03-05 10:37:06 +08:00
Finley Xiao bcefd07799 clk: rockchip: px30: Remove duplicate definition of mode shift and mask
Change-Id: I94c3b5a6dfd23c96b681e05e28865bc541421391
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-02-27 12:23:18 +08:00
Finley Xiao 30f1f38dda clk: rockchip: px30: Add support to set and get rate for vopb
Change-Id: I5105c4823ffd6632c29a8faa80b995f7ef0decaa
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-02-27 11:43:51 +08:00
Finley Xiao 77ecce6897 clk: rockchip: px30: Modify gpll to 1200MHz
Change-Id: Ia853acdc1d6c7085712379680b6fb1ed6a5802d6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-02-27 11:43:46 +08:00
Finley Xiao db235eb51f clk: rockchip: px30: Move pll mode operation into rkclk_set_pll
Change-Id: I55bc3f9eedd41c40b8e424b482ad620b248262b1
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-02-26 10:33:13 +08:00
Philipp Tomsich d2866b3201 rockchip: clk: guard set_parent implementations against OF_PLATDATA
The set_parent implementations do not make sense when OF_PLATDATA is
enabled.  We guard these against OF_PLATDATA and don't populate the
set_parent-op when this is the case.

Change-Id: I37c384bf6851666550b8b3902d79b9278cff5074
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-02-24 19:02:43 +08:00
David Wu b2477abafd clk: rockchip: clk_rk3368: Implement "assign-clock-parent"
Implement the setting parent for gmac clock, and add internal
pll div set for mac clk.

Change-Id: I4f75d0c1e35bbe7ff0af07d05dbb42f4732d5eb7
Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-02-24 19:02:43 +08:00
David Wu b0b6870835 clk: rockchip: clk_rk3288: Implement "assign-clock-parent" and "assign-clock-rate"
The RK3288 CRU-node assigns rates to a number of clocks that are not
implemented in the RK3288 clock-driver (but which have been
sufficiently initialised from rkclk_init()): for these clocks, we
implement the gmac clock set parent, but simply ignore the
others' set_rate() operation and return 0 to signal success.

Change-Id: Ic1a41634aba674001beb0e7e5ca3f7f2fa008e51
Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-02-24 19:02:43 +08:00
David Wu 58996dfcd4 clk: rockchip: Add rk322x gamc clock support
Assuming mac_clk is fed by an external clock, set clk_rmii_src
clock select control register from IO for rgmii interface.

Change-Id: I6405c3b2ead429084118c544bcc461e0b301d77a
Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-02-24 19:02:43 +08:00
David Wu 07a48b3e0c clk: rockchip: Add rk3328 gamc clock support
The rk3328 soc has two gmac controllers, one is gmac2io,
the other is gmac2phy. We use the gmac2io rgmii interface
for 1000M phy here.

Change-Id: I4963f03f6aea2c7196f33dae0bca38a432c80690
Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-02-24 19:02:43 +08:00
Philipp Tomsich a6de9238bf rockchip: clk: rk3399: accept all assigned-clocks from the 'cru'-node
The RK3399 CRU-node assigns rates to a number of clocks that are not
implemented in the RK3399 clock-driver (but which have been
sufficiently initialised from rkclk_init()): for these clocks, we
simply ignore the set_rate() operation and return 0 to signal success.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: David Wu <david.wu@rock-chips.com>

Series-changes: 2
- Fixed David's email address.

(cherry picked from commit d2f1f1abafbedd3580334f2564bfea918e49522d)

Change-Id: Ic19614e75b76d8159cf03ac4adb180ca5a8688fd
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-02-24 19:02:43 +08:00
Philipp Tomsich 0b2881acbd clk: implement clk_set_defaults()
Linux uses the properties 'assigned-clocks', 'assigned-clock-parents'
and 'assigned-clock-rates' to configure the clock subsystem for use
with various peripheral nodes.

This implements clk_set_defaults() and hooks it up with the general
device probibin in drivers/core/device.c: when a new device is probed,
clk_set_defaults() will be called for it and will process the
properties mentioned above.

Note that this functionality is designed to fail gracefully (i.e. if a
clock-driver does not implement set_parent(), we simply accept this
and ignore the error) as not to break existing board-support.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: David Wu <david.wu@rock-chips.com>

Series-changes: 2
- Fixed David's email address.

Series-version: 2

Cover-letter:
clk: support assigned-clock, assigned-clock-parents, assigned-clock-rates

For various peripherals on Rockchip SoCs (e.g. for the Ethernet GMAC),
the parent-clock needs to be set via the DTS.  This adds the required
plumbing and implements the GMAC case for the RK3399.
END

(cherry picked from commit f4fcba5c5baaaa9d477d753f97124efdb8e45893)

Change-Id: I549891987c5a3e8546b96f1f54ad575950f92b12
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-02-24 19:02:43 +08:00