1251a449dSTero Kristo /* 2251a449dSTero Kristo * DRA7 Clock init 3251a449dSTero Kristo * 4251a449dSTero Kristo * Copyright (C) 2013 Texas Instruments, Inc. 5251a449dSTero Kristo * 6251a449dSTero Kristo * Tero Kristo (t-kristo@ti.com) 7251a449dSTero Kristo * 8251a449dSTero Kristo * This program is free software; you can redistribute it and/or modify 9251a449dSTero Kristo * it under the terms of the GNU General Public License version 2 as 10251a449dSTero Kristo * published by the Free Software Foundation. 11251a449dSTero Kristo */ 12251a449dSTero Kristo 13251a449dSTero Kristo #include <linux/kernel.h> 14251a449dSTero Kristo #include <linux/list.h> 15e387088aSStephen Boyd #include <linux/clk.h> 16251a449dSTero Kristo #include <linux/clkdev.h> 17251a449dSTero Kristo #include <linux/clk/ti.h> 18251a449dSTero Kristo 19a3314e9cSTero Kristo #include "clock.h" 20a3314e9cSTero Kristo 21251a449dSTero Kristo #define DRA7_DPLL_GMAC_DEFFREQ 1000000000 2294e72ae5SRoger Quadros #define DRA7_DPLL_USB_DEFFREQ 960000000 23251a449dSTero Kristo 24251a449dSTero Kristo static struct ti_dt_clk dra7xx_clks[] = { 25251a449dSTero Kristo DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), 26d5630b7aSGrygorii Strashko DT_CLK(NULL, "sys_clkin_ck", "timer_sys_clk_div"), 27251a449dSTero Kristo DT_CLK(NULL, "sys_clkin", "sys_clkin1"), 28251a449dSTero Kristo { .node_name = NULL }, 29251a449dSTero Kristo }; 30251a449dSTero Kristo 31251a449dSTero Kristo int __init dra7xx_dt_clk_init(void) 32251a449dSTero Kristo { 33251a449dSTero Kristo int rc; 344b3061b3SPeter Ujfalusi struct clk *dpll_ck, *hdcp_ck; 35251a449dSTero Kristo 36251a449dSTero Kristo ti_dt_clocks_register(dra7xx_clks); 37251a449dSTero Kristo 38251a449dSTero Kristo omap2_clk_disable_autoidle_all(); 39251a449dSTero Kristo 40*a8202cd5STero Kristo ti_clk_add_aliases(); 41*a8202cd5STero Kristo 42251a449dSTero Kristo dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck"); 43251a449dSTero Kristo rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ); 44251a449dSTero Kristo if (rc) 45251a449dSTero Kristo pr_err("%s: failed to configure GMAC DPLL!\n", __func__); 46251a449dSTero Kristo 4794e72ae5SRoger Quadros dpll_ck = clk_get_sys(NULL, "dpll_usb_ck"); 4894e72ae5SRoger Quadros rc = clk_set_rate(dpll_ck, DRA7_DPLL_USB_DEFFREQ); 4994e72ae5SRoger Quadros if (rc) 5094e72ae5SRoger Quadros pr_err("%s: failed to configure USB DPLL!\n", __func__); 5194e72ae5SRoger Quadros 5294e72ae5SRoger Quadros dpll_ck = clk_get_sys(NULL, "dpll_usb_m2_ck"); 5394e72ae5SRoger Quadros rc = clk_set_rate(dpll_ck, DRA7_DPLL_USB_DEFFREQ/2); 5494e72ae5SRoger Quadros if (rc) 5594e72ae5SRoger Quadros pr_err("%s: failed to set USB_DPLL M2 OUT\n", __func__); 5694e72ae5SRoger Quadros 57f892b203STomi Valkeinen hdcp_ck = clk_get_sys(NULL, "dss_deshdcp_clk"); 58f892b203STomi Valkeinen rc = clk_prepare_enable(hdcp_ck); 59f892b203STomi Valkeinen if (rc) 60f892b203STomi Valkeinen pr_err("%s: failed to set dss_deshdcp_clk\n", __func__); 61f892b203STomi Valkeinen 62251a449dSTero Kristo return rc; 63251a449dSTero Kristo } 64