121876ea5STero Kristo /* 221876ea5STero Kristo * OMAP4 Clock init 321876ea5STero Kristo * 421876ea5STero Kristo * Copyright (C) 2013 Texas Instruments, Inc. 521876ea5STero Kristo * 621876ea5STero Kristo * Tero Kristo (t-kristo@ti.com) 721876ea5STero Kristo * 821876ea5STero Kristo * This program is free software; you can redistribute it and/or modify 921876ea5STero Kristo * it under the terms of the GNU General Public License version 2 as 1021876ea5STero Kristo * published by the Free Software Foundation. 1121876ea5STero Kristo */ 1221876ea5STero Kristo 1321876ea5STero Kristo #include <linux/kernel.h> 1421876ea5STero Kristo #include <linux/list.h> 15e387088aSStephen Boyd #include <linux/clk.h> 1621876ea5STero Kristo #include <linux/clkdev.h> 1721876ea5STero Kristo #include <linux/clk/ti.h> 1821876ea5STero Kristo 19a3314e9cSTero Kristo #include "clock.h" 20a3314e9cSTero Kristo 2121876ea5STero Kristo /* 2221876ea5STero Kristo * OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section 2321876ea5STero Kristo * "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK 2421876ea5STero Kristo * must be set to 196.608 MHz" and hence, the DPLL locked frequency is 2521876ea5STero Kristo * half of this value. 2621876ea5STero Kristo */ 2721876ea5STero Kristo #define OMAP4_DPLL_ABE_DEFFREQ 98304000 2821876ea5STero Kristo 2921876ea5STero Kristo /* 3021876ea5STero Kristo * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section 3121876ea5STero Kristo * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred 3221876ea5STero Kristo * locked frequency for the USB DPLL is 960MHz. 3321876ea5STero Kristo */ 3421876ea5STero Kristo #define OMAP4_DPLL_USB_DEFFREQ 960000000 3521876ea5STero Kristo 3621876ea5STero Kristo static struct ti_dt_clk omap44xx_clks[] = { 3721876ea5STero Kristo DT_CLK("smp_twd", NULL, "mpu_periphclk"), 3821876ea5STero Kristo DT_CLK("omapdss_dss", "ick", "dss_fck"), 3921876ea5STero Kristo DT_CLK("usbhs_omap", "fs_fck", "usb_host_fs_fck"), 4021876ea5STero Kristo DT_CLK("usbhs_omap", "hs_fck", "usb_host_hs_fck"), 4121876ea5STero Kristo DT_CLK("musb-omap2430", "ick", "usb_otg_hs_ick"), 4221876ea5STero Kristo DT_CLK("usbhs_omap", "usbtll_ick", "usb_tll_hs_ick"), 4321876ea5STero Kristo DT_CLK("usbhs_tll", "usbtll_ick", "usb_tll_hs_ick"), 4421876ea5STero Kristo DT_CLK("omap_i2c.1", "ick", "dummy_ck"), 4521876ea5STero Kristo DT_CLK("omap_i2c.2", "ick", "dummy_ck"), 4621876ea5STero Kristo DT_CLK("omap_i2c.3", "ick", "dummy_ck"), 4721876ea5STero Kristo DT_CLK("omap_i2c.4", "ick", "dummy_ck"), 4821876ea5STero Kristo DT_CLK(NULL, "mailboxes_ick", "dummy_ck"), 4921876ea5STero Kristo DT_CLK("omap_hsmmc.0", "ick", "dummy_ck"), 5021876ea5STero Kristo DT_CLK("omap_hsmmc.1", "ick", "dummy_ck"), 5121876ea5STero Kristo DT_CLK("omap_hsmmc.2", "ick", "dummy_ck"), 5221876ea5STero Kristo DT_CLK("omap_hsmmc.3", "ick", "dummy_ck"), 5321876ea5STero Kristo DT_CLK("omap_hsmmc.4", "ick", "dummy_ck"), 5421876ea5STero Kristo DT_CLK("omap-mcbsp.1", "ick", "dummy_ck"), 5521876ea5STero Kristo DT_CLK("omap-mcbsp.2", "ick", "dummy_ck"), 5621876ea5STero Kristo DT_CLK("omap-mcbsp.3", "ick", "dummy_ck"), 5721876ea5STero Kristo DT_CLK("omap-mcbsp.4", "ick", "dummy_ck"), 5821876ea5STero Kristo DT_CLK("omap2_mcspi.1", "ick", "dummy_ck"), 5921876ea5STero Kristo DT_CLK("omap2_mcspi.2", "ick", "dummy_ck"), 6021876ea5STero Kristo DT_CLK("omap2_mcspi.3", "ick", "dummy_ck"), 6121876ea5STero Kristo DT_CLK("omap2_mcspi.4", "ick", "dummy_ck"), 6221876ea5STero Kristo DT_CLK(NULL, "uart1_ick", "dummy_ck"), 6321876ea5STero Kristo DT_CLK(NULL, "uart2_ick", "dummy_ck"), 6421876ea5STero Kristo DT_CLK(NULL, "uart3_ick", "dummy_ck"), 6521876ea5STero Kristo DT_CLK(NULL, "uart4_ick", "dummy_ck"), 6621876ea5STero Kristo DT_CLK("usbhs_omap", "usbhost_ick", "dummy_ck"), 6721876ea5STero Kristo DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"), 6821876ea5STero Kristo DT_CLK("usbhs_tll", "usbtll_fck", "dummy_ck"), 6921876ea5STero Kristo DT_CLK("omap_wdt", "ick", "dummy_ck"), 7021876ea5STero Kristo DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"), 7121876ea5STero Kristo DT_CLK("4a318000.timer", "timer_sys_ck", "sys_clkin_ck"), 7221876ea5STero Kristo DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin_ck"), 7321876ea5STero Kristo DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin_ck"), 7421876ea5STero Kristo DT_CLK("48036000.timer", "timer_sys_ck", "sys_clkin_ck"), 7521876ea5STero Kristo DT_CLK("4803e000.timer", "timer_sys_ck", "sys_clkin_ck"), 7621876ea5STero Kristo DT_CLK("48086000.timer", "timer_sys_ck", "sys_clkin_ck"), 7721876ea5STero Kristo DT_CLK("48088000.timer", "timer_sys_ck", "sys_clkin_ck"), 7821876ea5STero Kristo DT_CLK("40138000.timer", "timer_sys_ck", "syc_clk_div_ck"), 7921876ea5STero Kristo DT_CLK("4013a000.timer", "timer_sys_ck", "syc_clk_div_ck"), 8021876ea5STero Kristo DT_CLK("4013c000.timer", "timer_sys_ck", "syc_clk_div_ck"), 8121876ea5STero Kristo DT_CLK("4013e000.timer", "timer_sys_ck", "syc_clk_div_ck"), 8221876ea5STero Kristo DT_CLK(NULL, "cpufreq_ck", "dpll_mpu_ck"), 8321876ea5STero Kristo { .node_name = NULL }, 8421876ea5STero Kristo }; 8521876ea5STero Kristo 8621876ea5STero Kristo int __init omap4xxx_dt_clk_init(void) 8721876ea5STero Kristo { 8821876ea5STero Kristo int rc; 8921876ea5STero Kristo struct clk *abe_dpll_ref, *abe_dpll, *sys_32k_ck, *usb_dpll; 9021876ea5STero Kristo 9121876ea5STero Kristo ti_dt_clocks_register(omap44xx_clks); 9221876ea5STero Kristo 9321876ea5STero Kristo omap2_clk_disable_autoidle_all(); 9421876ea5STero Kristo 95*b6312da5STero Kristo ti_clk_add_aliases(); 96*b6312da5STero Kristo 9721876ea5STero Kristo /* 9821876ea5STero Kristo * Lock USB DPLL on OMAP4 devices so that the L3INIT power 9921876ea5STero Kristo * domain can transition to retention state when not in use. 10021876ea5STero Kristo */ 10121876ea5STero Kristo usb_dpll = clk_get_sys(NULL, "dpll_usb_ck"); 10221876ea5STero Kristo rc = clk_set_rate(usb_dpll, OMAP4_DPLL_USB_DEFFREQ); 10321876ea5STero Kristo if (rc) 10421876ea5STero Kristo pr_err("%s: failed to configure USB DPLL!\n", __func__); 10521876ea5STero Kristo 10621876ea5STero Kristo /* 10721876ea5STero Kristo * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power 10821876ea5STero Kristo * state when turning the ABE clock domain. Workaround this by 10921876ea5STero Kristo * locking the ABE DPLL on boot. 11021876ea5STero Kristo * Lock the ABE DPLL in any case to avoid issues with audio. 11121876ea5STero Kristo */ 11221876ea5STero Kristo abe_dpll_ref = clk_get_sys(NULL, "abe_dpll_refclk_mux_ck"); 11321876ea5STero Kristo sys_32k_ck = clk_get_sys(NULL, "sys_32k_ck"); 11421876ea5STero Kristo rc = clk_set_parent(abe_dpll_ref, sys_32k_ck); 11521876ea5STero Kristo abe_dpll = clk_get_sys(NULL, "dpll_abe_ck"); 11621876ea5STero Kristo if (!rc) 11721876ea5STero Kristo rc = clk_set_rate(abe_dpll, OMAP4_DPLL_ABE_DEFFREQ); 11821876ea5STero Kristo if (rc) 11921876ea5STero Kristo pr_err("%s: failed to configure ABE DPLL!\n", __func__); 12021876ea5STero Kristo 12121876ea5STero Kristo return 0; 12221876ea5STero Kristo } 123