]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/clk/ti/clk-7xx.c
6f989f8b6881c400bd736d8b1316af677a048673
[linux.git] / drivers / clk / ti / clk-7xx.c
1 /*
2  * DRA7 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/clk/ti.h>
18 #include <dt-bindings/clock/dra7.h>
19
20 #include "clock.h"
21
22 #define DRA7_DPLL_GMAC_DEFFREQ                          1000000000
23 #define DRA7_DPLL_USB_DEFFREQ                           960000000
24
25 int __init dra7xx_dt_clk_init(void)
26 {
27         int rc;
28         struct clk *dpll_ck, *hdcp_ck;
29
30         ti_dt_clocks_register(dra7xx_compat_clks);
31
32         omap2_clk_disable_autoidle_all();
33
34         ti_clk_add_aliases();
35
36         dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck");
37         rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ);
38         if (rc)
39                 pr_err("%s: failed to configure GMAC DPLL!\n", __func__);
40
41         dpll_ck = clk_get_sys(NULL, "dpll_usb_ck");
42         rc = clk_set_rate(dpll_ck, DRA7_DPLL_USB_DEFFREQ);
43         if (rc)
44                 pr_err("%s: failed to configure USB DPLL!\n", __func__);
45
46         dpll_ck = clk_get_sys(NULL, "dpll_usb_m2_ck");
47         rc = clk_set_rate(dpll_ck, DRA7_DPLL_USB_DEFFREQ/2);
48         if (rc)
49                 pr_err("%s: failed to set USB_DPLL M2 OUT\n", __func__);
50
51         hdcp_ck = clk_get_sys(NULL, "dss_deshdcp_clk");
52         rc = clk_prepare_enable(hdcp_ck);
53         if (rc)
54                 pr_err("%s: failed to set dss_deshdcp_clk\n", __func__);
55
56         return rc;
57 }