1 /* 2 * OMAP5 Clock init 3 * 4 * Copyright (C) 2013 Texas Instruments, Inc. 5 * 6 * Tero Kristo (t-kristo@ti.com) 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License version 2 as 10 * published by the Free Software Foundation. 11 */ 12 13 #include <linux/kernel.h> 14 #include <linux/list.h> 15 #include <linux/clk.h> 16 #include <linux/clkdev.h> 17 #include <linux/io.h> 18 #include <linux/clk/ti.h> 19 20 #include "clock.h" 21 22 #define OMAP5_DPLL_ABE_DEFFREQ 98304000 23 24 /* 25 * OMAP543x TRM, section "3.6.3.9.5 DPLL_USB Preferred Settings" 26 * states it must be at 960MHz 27 */ 28 #define OMAP5_DPLL_USB_DEFFREQ 960000000 29 30 static struct ti_dt_clk omap54xx_clks[] = { 31 DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), 32 DT_CLK(NULL, "sys_clkin_ck", "sys_clkin"), 33 { .node_name = NULL }, 34 }; 35 36 int __init omap5xxx_dt_clk_init(void) 37 { 38 int rc; 39 struct clk *abe_dpll_ref, *abe_dpll, *sys_32k_ck, *usb_dpll; 40 41 ti_dt_clocks_register(omap54xx_clks); 42 43 omap2_clk_disable_autoidle_all(); 44 45 ti_clk_add_aliases(); 46 47 abe_dpll_ref = clk_get_sys(NULL, "abe_dpll_clk_mux"); 48 sys_32k_ck = clk_get_sys(NULL, "sys_32k_ck"); 49 rc = clk_set_parent(abe_dpll_ref, sys_32k_ck); 50 abe_dpll = clk_get_sys(NULL, "dpll_abe_ck"); 51 if (!rc) 52 rc = clk_set_rate(abe_dpll, OMAP5_DPLL_ABE_DEFFREQ); 53 if (rc) 54 pr_err("%s: failed to configure ABE DPLL!\n", __func__); 55 56 abe_dpll = clk_get_sys(NULL, "dpll_abe_m2x2_ck"); 57 if (!rc) 58 rc = clk_set_rate(abe_dpll, OMAP5_DPLL_ABE_DEFFREQ * 2); 59 if (rc) 60 pr_err("%s: failed to configure ABE m2x2 DPLL!\n", __func__); 61 62 usb_dpll = clk_get_sys(NULL, "dpll_usb_ck"); 63 rc = clk_set_rate(usb_dpll, OMAP5_DPLL_USB_DEFFREQ); 64 if (rc) 65 pr_err("%s: failed to configure USB DPLL!\n", __func__); 66 67 usb_dpll = clk_get_sys(NULL, "dpll_usb_m2_ck"); 68 rc = clk_set_rate(usb_dpll, OMAP5_DPLL_USB_DEFFREQ/2); 69 if (rc) 70 pr_err("%s: failed to set USB_DPLL M2 OUT\n", __func__); 71 72 return 0; 73 } 74