xref: /openbmc/linux/drivers/clk/ti/clk-43xx.c (revision 131ee08f)
1ffab2399STero Kristo /*
2ffab2399STero Kristo  * AM43XX Clock init
3ffab2399STero Kristo  *
4ffab2399STero Kristo  * Copyright (C) 2013 Texas Instruments, Inc
5ffab2399STero Kristo  *     Tero Kristo (t-kristo@ti.com)
6ffab2399STero Kristo  *
7ffab2399STero Kristo  * This program is free software; you can redistribute it and/or
8ffab2399STero Kristo  * modify it under the terms of the GNU General Public License as
9ffab2399STero Kristo  * published by the Free Software Foundation version 2.
10ffab2399STero Kristo  *
11ffab2399STero Kristo  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12ffab2399STero Kristo  * kind, whether express or implied; without even the implied warranty
13ffab2399STero Kristo  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14ffab2399STero Kristo  * GNU General Public License for more details.
15ffab2399STero Kristo  */
16ffab2399STero Kristo 
17ffab2399STero Kristo #include <linux/kernel.h>
18ffab2399STero Kristo #include <linux/list.h>
191b29e601SStephen Boyd #include <linux/clk.h>
20ffab2399STero Kristo #include <linux/clk-provider.h>
21ffab2399STero Kristo #include <linux/clk/ti.h>
22a3da10b7STero Kristo #include <dt-bindings/clock/am4.h>
23ffab2399STero Kristo 
24a3314e9cSTero Kristo #include "clock.h"
25a3314e9cSTero Kristo 
26ffab2399STero Kristo int __init am43xx_dt_clk_init(void)
27ffab2399STero Kristo {
28f9786f41SGeorge Cherian 	struct clk *clk1, *clk2;
29f9786f41SGeorge Cherian 
30131ee08fSTero Kristo 	ti_dt_clocks_register(am43xx_compat_clks);
31ffab2399STero Kristo 
32ffab2399STero Kristo 	omap2_clk_disable_autoidle_all();
33ffab2399STero Kristo 
3478aac800STero Kristo 	ti_clk_add_aliases();
3578aac800STero Kristo 
36f9786f41SGeorge Cherian 	/*
37f9786f41SGeorge Cherian 	 * cpsw_cpts_rft_clk  has got the choice of 3 clocksources
38f9786f41SGeorge Cherian 	 * dpll_core_m4_ck, dpll_core_m5_ck and dpll_disp_m2_ck.
39f9786f41SGeorge Cherian 	 * By default dpll_core_m4_ck is selected, witn this as clock
40f9786f41SGeorge Cherian 	 * source the CPTS doesnot work properly. It gives clockcheck errors
41f9786f41SGeorge Cherian 	 * while running PTP.
42f9786f41SGeorge Cherian 	 * clockcheck: clock jumped backward or running slower than expected!
43f9786f41SGeorge Cherian 	 * By selecting dpll_core_m5_ck as the clocksource fixes this issue.
44f9786f41SGeorge Cherian 	 * In AM335x dpll_core_m5_ck is the default clocksource.
45f9786f41SGeorge Cherian 	 */
46f9786f41SGeorge Cherian 	clk1 = clk_get_sys(NULL, "cpsw_cpts_rft_clk");
47f9786f41SGeorge Cherian 	clk2 = clk_get_sys(NULL, "dpll_core_m5_ck");
48f9786f41SGeorge Cherian 	clk_set_parent(clk1, clk2);
49f9786f41SGeorge Cherian 
50ffab2399STero Kristo 	return 0;
51ffab2399STero Kristo }
52