aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 21:44:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 21:44:53 -0500
commitd30492adea3a82e7120bcf60893aaaab711f90a6 (patch)
tree082d1dff4d71ccbd722b5edd47411acad110b636 /drivers/clk
parentf1499382f114231cbd1e3dee7e656b50ce9d8236 (diff)
parentfd3fdaf09f26cd4f53fd4d7cdfe8e3dbb55a4dda (diff)
Merge tag 'clk-for-linus-3.14-part2' of git://git.linaro.org/people/mike.turquette/linux
Pull more clock framework changes from Mike Turquette: "The second half of the clock framework pull requeust for 3.14 is dominated by platform support for Qualcomm's MSM SoCs, DT binding updates for TI's OMAP-ish processors and additional support for Samsung chips. Additionally there are other smaller clock driver changes and several last minute fixes. This pull request also includes the HiSilicon support that depends on the already-merged arm-soc pull request" [ Fix up stupid compile error in the source tree with evil merge - Grumpy Linus ] * tag 'clk-for-linus-3.14-part2' of git://git.linaro.org/people/mike.turquette/linux: (49 commits) clk: sort Makefile clk: sunxi: fix overflow when setting up divided factors clk: Export more clk-provider functions dt-bindings: qcom: Fix warning with duplicate dt define clk: si5351: remove variant from platform_data clk: samsung: Remove unneeded semicolon clk: qcom: Fix modular build ARM: OMAP3: use DT clock init if DT data is available ARM: AM33xx: remove old clock data and link in new clock init code ARM: AM43xx: Enable clock init ARM: OMAP: DRA7: Enable clock init ARM: OMAP4: remove old clock data and link in new clock init code ARM: OMAP2+: io: use new clock init API ARM: OMAP2+: PRM: add support for initializing PRCM clock modules from DT ARM: OMAP3: hwmod: initialize clkdm from clkdm_name ARM: OMAP: hwmod: fix an incorrect clk type cast with _get_clkdm ARM: OMAP2+: clock: use driver API instead of direct memory read/write ARM: OMAP2+: clock: add support for indexed memmaps ARM: dts: am43xx clock data ARM: dts: AM35xx: use DT clock data ...
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/Makefile77
-rw-r--r--drivers/clk/clk-si5351.c30
-rw-r--r--drivers/clk/clk-si5351.h14
-rw-r--r--drivers/clk/clk.c11
-rw-r--r--drivers/clk/qcom/Makefile12
-rw-r--r--drivers/clk/samsung/clk-pll.c2
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c2
-rw-r--r--drivers/clk/ti/Makefile11
-rw-r--r--drivers/clk/ti/apll.c223
-rw-r--r--drivers/clk/ti/autoidle.c133
-rw-r--r--drivers/clk/ti/clk-33xx.c161
-rw-r--r--drivers/clk/ti/clk-3xxx.c401
-rw-r--r--drivers/clk/ti/clk-43xx.c118
-rw-r--r--drivers/clk/ti/clk-44xx.c316
-rw-r--r--drivers/clk/ti/clk-54xx.c255
-rw-r--r--drivers/clk/ti/clk-7xx.c332
-rw-r--r--drivers/clk/ti/clk.c167
-rw-r--r--drivers/clk/ti/clockdomain.c70
-rw-r--r--drivers/clk/ti/composite.c269
-rw-r--r--drivers/clk/ti/divider.c487
-rw-r--r--drivers/clk/ti/dpll.c558
-rw-r--r--drivers/clk/ti/fixed-factor.c66
-rw-r--r--drivers/clk/ti/gate.c249
-rw-r--r--drivers/clk/ti/interface.c125
-rw-r--r--drivers/clk/ti/mux.c246
25 files changed, 4268 insertions, 67 deletions
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 0c16e9cdfb87..a367a9831717 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -9,45 +9,44 @@ obj-$(CONFIG_COMMON_CLK) += clk-gate.o
9obj-$(CONFIG_COMMON_CLK) += clk-mux.o 9obj-$(CONFIG_COMMON_CLK) += clk-mux.o
10obj-$(CONFIG_COMMON_CLK) += clk-composite.o 10obj-$(CONFIG_COMMON_CLK) += clk-composite.o
11 11
12# SoCs specific 12# hardware specific clock types
13obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o 13# please keep this section sorted lexicographically by file/directory path name
14obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o 14obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
15obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o 15obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o
16obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o 16obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o
17obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/ 17obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o
18obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o 18obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o
19obj-$(CONFIG_ARCH_MXS) += mxs/ 19obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o
20obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/ 20obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o
21obj-$(CONFIG_PLAT_SPEAR) += spear/ 21obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o
22obj-$(CONFIG_ARCH_U300) += clk-u300.o 22obj-$(CONFIG_CLK_PPC_CORENET) += clk-ppc-corenet.o
23obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/ 23obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o
24obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/ 24obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
25obj-$(CONFIG_PLAT_ORION) += mvebu/ 25obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
26obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o
27obj-$(CONFIG_ARCH_U300) += clk-u300.o
28obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
29obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
30obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o
31obj-$(CONFIG_COMMON_CLK_AT91) += at91/
32obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/
33obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/
26ifeq ($(CONFIG_COMMON_CLK), y) 34ifeq ($(CONFIG_COMMON_CLK), y)
27obj-$(CONFIG_ARCH_MMP) += mmp/ 35obj-$(CONFIG_ARCH_MMP) += mmp/
28endif 36endif
29obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o 37obj-$(CONFIG_PLAT_ORION) += mvebu/
30obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ 38obj-$(CONFIG_ARCH_MXS) += mxs/
31obj-$(CONFIG_ARCH_SUNXI) += sunxi/ 39obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/
32obj-$(CONFIG_ARCH_U8500) += ux500/ 40obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
33obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o 41obj-$(CONFIG_PLAT_SAMSUNG) += samsung/
34obj-$(CONFIG_ARCH_SIRF) += sirf/
35obj-$(CONFIG_ARCH_ZYNQ) += zynq/
36obj-$(CONFIG_ARCH_TEGRA) += tegra/
37obj-$(CONFIG_PLAT_SAMSUNG) += samsung/
38obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o
39obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/
40obj-$(CONFIG_COMMON_CLK_AT91) += at91/
41obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile/ 42obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile/
42 43obj-$(CONFIG_ARCH_SIRF) += sirf/
43obj-$(CONFIG_X86) += x86/ 44obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/
44 45obj-$(CONFIG_PLAT_SPEAR) += spear/
45# Chip specific 46obj-$(CONFIG_ARCH_SUNXI) += sunxi/
46obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o 47obj-$(CONFIG_ARCH_TEGRA) += tegra/
47obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o 48obj-$(CONFIG_ARCH_OMAP2PLUS) += ti/
48obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o 49obj-$(CONFIG_ARCH_U8500) += ux500/
49obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o 50obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/
50obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o 51obj-$(CONFIG_X86) += x86/
51obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o 52obj-$(CONFIG_ARCH_ZYNQ) += zynq/
52obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o
53obj-$(CONFIG_CLK_PPC_CORENET) += clk-ppc-corenet.o
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index c50e83744b0a..3b2a66f78755 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1111,11 +1111,11 @@ static const struct of_device_id si5351_dt_ids[] = {
1111}; 1111};
1112MODULE_DEVICE_TABLE(of, si5351_dt_ids); 1112MODULE_DEVICE_TABLE(of, si5351_dt_ids);
1113 1113
1114static int si5351_dt_parse(struct i2c_client *client) 1114static int si5351_dt_parse(struct i2c_client *client,
1115 enum si5351_variant variant)
1115{ 1116{
1116 struct device_node *child, *np = client->dev.of_node; 1117 struct device_node *child, *np = client->dev.of_node;
1117 struct si5351_platform_data *pdata; 1118 struct si5351_platform_data *pdata;
1118 const struct of_device_id *match;
1119 struct property *prop; 1119 struct property *prop;
1120 const __be32 *p; 1120 const __be32 *p;
1121 int num = 0; 1121 int num = 0;
@@ -1124,15 +1124,10 @@ static int si5351_dt_parse(struct i2c_client *client)
1124 if (np == NULL) 1124 if (np == NULL)
1125 return 0; 1125 return 0;
1126 1126
1127 match = of_match_node(si5351_dt_ids, np);
1128 if (match == NULL)
1129 return -EINVAL;
1130
1131 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); 1127 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
1132 if (!pdata) 1128 if (!pdata)
1133 return -ENOMEM; 1129 return -ENOMEM;
1134 1130
1135 pdata->variant = (enum si5351_variant)match->data;
1136 pdata->clk_xtal = of_clk_get(np, 0); 1131 pdata->clk_xtal = of_clk_get(np, 0);
1137 if (!IS_ERR(pdata->clk_xtal)) 1132 if (!IS_ERR(pdata->clk_xtal))
1138 clk_put(pdata->clk_xtal); 1133 clk_put(pdata->clk_xtal);
@@ -1163,7 +1158,7 @@ static int si5351_dt_parse(struct i2c_client *client)
1163 pdata->pll_src[num] = SI5351_PLL_SRC_XTAL; 1158 pdata->pll_src[num] = SI5351_PLL_SRC_XTAL;
1164 break; 1159 break;
1165 case 1: 1160 case 1:
1166 if (pdata->variant != SI5351_VARIANT_C) { 1161 if (variant != SI5351_VARIANT_C) {
1167 dev_err(&client->dev, 1162 dev_err(&client->dev,
1168 "invalid parent %d for pll %d\n", 1163 "invalid parent %d for pll %d\n",
1169 val, num); 1164 val, num);
@@ -1187,7 +1182,7 @@ static int si5351_dt_parse(struct i2c_client *client)
1187 } 1182 }
1188 1183
1189 if (num >= 8 || 1184 if (num >= 8 ||
1190 (pdata->variant == SI5351_VARIANT_A3 && num >= 3)) { 1185 (variant == SI5351_VARIANT_A3 && num >= 3)) {
1191 dev_err(&client->dev, "invalid clkout %d\n", num); 1186 dev_err(&client->dev, "invalid clkout %d\n", num);
1192 return -EINVAL; 1187 return -EINVAL;
1193 } 1188 }
@@ -1226,7 +1221,7 @@ static int si5351_dt_parse(struct i2c_client *client)
1226 SI5351_CLKOUT_SRC_XTAL; 1221 SI5351_CLKOUT_SRC_XTAL;
1227 break; 1222 break;
1228 case 3: 1223 case 3:
1229 if (pdata->variant != SI5351_VARIANT_C) { 1224 if (variant != SI5351_VARIANT_C) {
1230 dev_err(&client->dev, 1225 dev_err(&client->dev,
1231 "invalid parent %d for clkout %d\n", 1226 "invalid parent %d for clkout %d\n",
1232 val, num); 1227 val, num);
@@ -1298,7 +1293,7 @@ static int si5351_dt_parse(struct i2c_client *client)
1298 return 0; 1293 return 0;
1299} 1294}
1300#else 1295#else
1301static int si5351_dt_parse(struct i2c_client *client) 1296static int si5351_dt_parse(struct i2c_client *client, enum si5351_variant variant)
1302{ 1297{
1303 return 0; 1298 return 0;
1304} 1299}
@@ -1307,6 +1302,7 @@ static int si5351_dt_parse(struct i2c_client *client)
1307static int si5351_i2c_probe(struct i2c_client *client, 1302static int si5351_i2c_probe(struct i2c_client *client,
1308 const struct i2c_device_id *id) 1303 const struct i2c_device_id *id)
1309{ 1304{
1305 enum si5351_variant variant = (enum si5351_variant)id->driver_data;
1310 struct si5351_platform_data *pdata; 1306 struct si5351_platform_data *pdata;
1311 struct si5351_driver_data *drvdata; 1307 struct si5351_driver_data *drvdata;
1312 struct clk_init_data init; 1308 struct clk_init_data init;
@@ -1315,7 +1311,7 @@ static int si5351_i2c_probe(struct i2c_client *client,
1315 u8 num_parents, num_clocks; 1311 u8 num_parents, num_clocks;
1316 int ret, n; 1312 int ret, n;
1317 1313
1318 ret = si5351_dt_parse(client); 1314 ret = si5351_dt_parse(client, variant);
1319 if (ret) 1315 if (ret)
1320 return ret; 1316 return ret;
1321 1317
@@ -1331,7 +1327,7 @@ static int si5351_i2c_probe(struct i2c_client *client,
1331 1327
1332 i2c_set_clientdata(client, drvdata); 1328 i2c_set_clientdata(client, drvdata);
1333 drvdata->client = client; 1329 drvdata->client = client;
1334 drvdata->variant = pdata->variant; 1330 drvdata->variant = variant;
1335 drvdata->pxtal = pdata->clk_xtal; 1331 drvdata->pxtal = pdata->clk_xtal;
1336 drvdata->pclkin = pdata->clk_clkin; 1332 drvdata->pclkin = pdata->clk_clkin;
1337 1333
@@ -1568,10 +1564,10 @@ static int si5351_i2c_probe(struct i2c_client *client,
1568} 1564}
1569 1565
1570static const struct i2c_device_id si5351_i2c_ids[] = { 1566static const struct i2c_device_id si5351_i2c_ids[] = {
1571 { "si5351a", 0 }, 1567 { "si5351a", SI5351_VARIANT_A },
1572 { "si5351a-msop", 0 }, 1568 { "si5351a-msop", SI5351_VARIANT_A3 },
1573 { "si5351b", 0 }, 1569 { "si5351b", SI5351_VARIANT_B },
1574 { "si5351c", 0 }, 1570 { "si5351c", SI5351_VARIANT_C },
1575 { } 1571 { }
1576}; 1572};
1577MODULE_DEVICE_TABLE(i2c, si5351_i2c_ids); 1573MODULE_DEVICE_TABLE(i2c, si5351_i2c_ids);
diff --git a/drivers/clk/clk-si5351.h b/drivers/clk/clk-si5351.h
index c0dbf2676872..4d0746b50c32 100644
--- a/drivers/clk/clk-si5351.h
+++ b/drivers/clk/clk-si5351.h
@@ -153,4 +153,18 @@
153#define SI5351_XTAL_ENABLE (1<<6) 153#define SI5351_XTAL_ENABLE (1<<6)
154#define SI5351_MULTISYNTH_ENABLE (1<<4) 154#define SI5351_MULTISYNTH_ENABLE (1<<4)
155 155
156/**
157 * enum si5351_variant - SiLabs Si5351 chip variant
158 * @SI5351_VARIANT_A: Si5351A (8 output clocks, XTAL input)
159 * @SI5351_VARIANT_A3: Si5351A MSOP10 (3 output clocks, XTAL input)
160 * @SI5351_VARIANT_B: Si5351B (8 output clocks, XTAL/VXCO input)
161 * @SI5351_VARIANT_C: Si5351C (8 output clocks, XTAL/CLKIN input)
162 */
163enum si5351_variant {
164 SI5351_VARIANT_A = 1,
165 SI5351_VARIANT_A3 = 2,
166 SI5351_VARIANT_B = 3,
167 SI5351_VARIANT_C = 4,
168};
169
156#endif 170#endif
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2b38dc99063f..5517944495d8 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -575,16 +575,19 @@ struct clk_hw *__clk_get_hw(struct clk *clk)
575{ 575{
576 return !clk ? NULL : clk->hw; 576 return !clk ? NULL : clk->hw;
577} 577}
578EXPORT_SYMBOL_GPL(__clk_get_hw);
578 579
579u8 __clk_get_num_parents(struct clk *clk) 580u8 __clk_get_num_parents(struct clk *clk)
580{ 581{
581 return !clk ? 0 : clk->num_parents; 582 return !clk ? 0 : clk->num_parents;
582} 583}
584EXPORT_SYMBOL_GPL(__clk_get_num_parents);
583 585
584struct clk *__clk_get_parent(struct clk *clk) 586struct clk *__clk_get_parent(struct clk *clk)
585{ 587{
586 return !clk ? NULL : clk->parent; 588 return !clk ? NULL : clk->parent;
587} 589}
590EXPORT_SYMBOL_GPL(__clk_get_parent);
588 591
589struct clk *clk_get_parent_by_index(struct clk *clk, u8 index) 592struct clk *clk_get_parent_by_index(struct clk *clk, u8 index)
590{ 593{
@@ -598,6 +601,7 @@ struct clk *clk_get_parent_by_index(struct clk *clk, u8 index)
598 else 601 else
599 return clk->parents[index]; 602 return clk->parents[index];
600} 603}
604EXPORT_SYMBOL_GPL(clk_get_parent_by_index);
601 605
602unsigned int __clk_get_enable_count(struct clk *clk) 606unsigned int __clk_get_enable_count(struct clk *clk)
603{ 607{
@@ -629,6 +633,7 @@ unsigned long __clk_get_rate(struct clk *clk)
629out: 633out:
630 return ret; 634 return ret;
631} 635}
636EXPORT_SYMBOL_GPL(__clk_get_rate);
632 637
633unsigned long __clk_get_accuracy(struct clk *clk) 638unsigned long __clk_get_accuracy(struct clk *clk)
634{ 639{
@@ -685,6 +690,7 @@ bool __clk_is_enabled(struct clk *clk)
685out: 690out:
686 return !!ret; 691 return !!ret;
687} 692}
693EXPORT_SYMBOL_GPL(__clk_is_enabled);
688 694
689static struct clk *__clk_lookup_subtree(const char *name, struct clk *clk) 695static struct clk *__clk_lookup_subtree(const char *name, struct clk *clk)
690{ 696{
@@ -776,6 +782,7 @@ out:
776 782
777 return best; 783 return best;
778} 784}
785EXPORT_SYMBOL_GPL(__clk_mux_determine_rate);
779 786
780/*** clk api ***/ 787/*** clk api ***/
781 788
@@ -2373,8 +2380,6 @@ struct of_clk_provider {
2373 void *data; 2380 void *data;
2374}; 2381};
2375 2382
2376extern struct of_device_id __clk_of_table[];
2377
2378static const struct of_device_id __clk_of_table_sentinel 2383static const struct of_device_id __clk_of_table_sentinel
2379 __used __section(__clk_of_table_end); 2384 __used __section(__clk_of_table_end);
2380 2385
@@ -2534,7 +2539,7 @@ void __init of_clk_init(const struct of_device_id *matches)
2534 struct device_node *np; 2539 struct device_node *np;
2535 2540
2536 if (!matches) 2541 if (!matches)
2537 matches = __clk_of_table; 2542 matches = &__clk_of_table;
2538 2543
2539 for_each_matching_node_and_match(np, matches, &match) { 2544 for_each_matching_node_and_match(np, matches, &match) {
2540 of_clk_init_cb_t clk_init_cb = match->data; 2545 of_clk_init_cb_t clk_init_cb = match->data;
diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
index 190d38433202..f60db2ef1aee 100644
--- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile
@@ -1,11 +1,11 @@
1obj-$(CONFIG_COMMON_CLK_QCOM) += clk-qcom.o 1obj-$(CONFIG_COMMON_CLK_QCOM) += clk-qcom.o
2 2
3clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-regmap.o 3clk-qcom-y += clk-regmap.o
4clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-pll.o 4clk-qcom-y += clk-pll.o
5clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-rcg.o 5clk-qcom-y += clk-rcg.o
6clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-rcg2.o 6clk-qcom-y += clk-rcg2.o
7clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-branch.o 7clk-qcom-y += clk-branch.o
8clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += reset.o 8clk-qcom-y += reset.o
9 9
10obj-$(CONFIG_MSM_GCC_8660) += gcc-msm8660.o 10obj-$(CONFIG_MSM_GCC_8660) += gcc-msm8660.o
11obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o 11obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 529e11dc2c6b..81e6d2f49aa0 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -375,7 +375,7 @@ static int samsung_pll45xx_set_rate(struct clk_hw *hw, unsigned long drate,
375 break; 375 break;
376 default: 376 default:
377 break; 377 break;
378 }; 378 }
379 379
380 /* Set new configuration. */ 380 /* Set new configuration. */
381 __raw_writel(con1, pll->con_reg + 0x4); 381 __raw_writel(con1, pll->con_reg + 0x4);
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 659e4ea31893..abb6c5ac8a10 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -875,7 +875,7 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
875 if (!clk_data) 875 if (!clk_data)
876 return; 876 return;
877 877
878 clks = kzalloc(SUNXI_DIVS_MAX_QTY * sizeof(struct clk *), GFP_KERNEL); 878 clks = kzalloc((SUNXI_DIVS_MAX_QTY+1) * sizeof(*clks), GFP_KERNEL);
879 if (!clks) 879 if (!clks)
880 goto free_clkdata; 880 goto free_clkdata;
881 881
diff --git a/drivers/clk/ti/Makefile b/drivers/clk/ti/Makefile
new file mode 100644
index 000000000000..4319d4031aa3
--- /dev/null
+++ b/drivers/clk/ti/Makefile
@@ -0,0 +1,11 @@
1ifneq ($(CONFIG_OF),)
2obj-y += clk.o autoidle.o clockdomain.o
3clk-common = dpll.o composite.o divider.o gate.o \
4 fixed-factor.o mux.o apll.o
5obj-$(CONFIG_SOC_AM33XX) += $(clk-common) clk-33xx.o
6obj-$(CONFIG_ARCH_OMAP3) += $(clk-common) interface.o clk-3xxx.o
7obj-$(CONFIG_ARCH_OMAP4) += $(clk-common) clk-44xx.o
8obj-$(CONFIG_SOC_OMAP5) += $(clk-common) clk-54xx.o
9obj-$(CONFIG_SOC_DRA7XX) += $(clk-common) clk-7xx.o
10obj-$(CONFIG_SOC_AM43XX) += $(clk-common) clk-43xx.o
11endif
diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
new file mode 100644
index 000000000000..b986f61f5a77
--- /dev/null
+++ b/drivers/clk/ti/apll.c
@@ -0,0 +1,223 @@
1/*
2 * OMAP APLL clock support
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * J Keerthy <j-keerthy@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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/module.h>
20#include <linux/slab.h>
21#include <linux/io.h>
22#include <linux/err.h>
23#include <linux/string.h>
24#include <linux/log2.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/clk/ti.h>
28#include <linux/delay.h>
29
30#define APLL_FORCE_LOCK 0x1
31#define APLL_AUTO_IDLE 0x2
32#define MAX_APLL_WAIT_TRIES 1000000
33
34#undef pr_fmt
35#define pr_fmt(fmt) "%s: " fmt, __func__
36
37static int dra7_apll_enable(struct clk_hw *hw)
38{
39 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
40 int r = 0, i = 0;
41 struct dpll_data *ad;
42 const char *clk_name;
43 u8 state = 1;
44 u32 v;
45
46 ad = clk->dpll_data;
47 if (!ad)
48 return -EINVAL;
49
50 clk_name = __clk_get_name(clk->hw.clk);
51
52 state <<= __ffs(ad->idlest_mask);
53
54 /* Check is already locked */
55 v = ti_clk_ll_ops->clk_readl(ad->idlest_reg);
56
57 if ((v & ad->idlest_mask) == state)
58 return r;
59
60 v = ti_clk_ll_ops->clk_readl(ad->control_reg);
61 v &= ~ad->enable_mask;
62 v |= APLL_FORCE_LOCK << __ffs(ad->enable_mask);
63 ti_clk_ll_ops->clk_writel(v, ad->control_reg);
64
65 state <<= __ffs(ad->idlest_mask);
66
67 while (1) {
68 v = ti_clk_ll_ops->clk_readl(ad->idlest_reg);
69 if ((v & ad->idlest_mask) == state)
70 break;
71 if (i > MAX_APLL_WAIT_TRIES)
72 break;
73 i++;
74 udelay(1);
75 }
76
77 if (i == MAX_APLL_WAIT_TRIES) {
78 pr_warn("clock: %s failed transition to '%s'\n",
79 clk_name, (state) ? "locked" : "bypassed");
80 } else {
81 pr_debug("clock: %s transition to '%s' in %d loops\n",
82 clk_name, (state) ? "locked" : "bypassed", i);
83
84 r = 0;
85 }
86
87 return r;
88}
89
90static void dra7_apll_disable(struct clk_hw *hw)
91{
92 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
93 struct dpll_data *ad;
94 u8 state = 1;
95 u32 v;
96
97 ad = clk->dpll_data;
98
99 state <<= __ffs(ad->idlest_mask);
100
101 v = ti_clk_ll_ops->clk_readl(ad->control_reg);
102 v &= ~ad->enable_mask;
103 v |= APLL_AUTO_IDLE << __ffs(ad->enable_mask);
104 ti_clk_ll_ops->clk_writel(v, ad->control_reg);
105}
106
107static int dra7_apll_is_enabled(struct clk_hw *hw)
108{
109 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
110 struct dpll_data *ad;
111 u32 v;
112
113 ad = clk->dpll_data;
114
115 v = ti_clk_ll_ops->clk_readl(ad->control_reg);
116 v &= ad->enable_mask;
117
118 v >>= __ffs(ad->enable_mask);
119
120 return v == APLL_AUTO_IDLE ? 0 : 1;
121}
122
123static u8 dra7_init_apll_parent(struct clk_hw *hw)
124{
125 return 0;
126}
127
128static const struct clk_ops apll_ck_ops = {
129 .enable = &dra7_apll_enable,
130 .disable = &dra7_apll_disable,
131 .is_enabled = &dra7_apll_is_enabled,
132 .get_parent = &dra7_init_apll_parent,
133};
134
135static void __init omap_clk_register_apll(struct clk_hw *hw,
136 struct device_node *node)
137{
138 struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
139 struct dpll_data *ad = clk_hw->dpll_data;
140 struct clk *clk;
141
142 ad->clk_ref = of_clk_get(node, 0);
143 ad->clk_bypass = of_clk_get(node, 1);
144
145 if (IS_ERR(ad->clk_ref) || IS_ERR(ad->clk_bypass)) {
146 pr_debug("clk-ref or clk-bypass for %s not ready, retry\n",
147 node->name);
148 if (!ti_clk_retry_init(node, hw, omap_clk_register_apll))
149 return;
150
151 goto cleanup;
152 }
153
154 clk = clk_register(NULL, &clk_hw->hw);
155 if (!IS_ERR(clk)) {
156 of_clk_add_provider(node, of_clk_src_simple_get, clk);
157 kfree(clk_hw->hw.init->parent_names);
158 kfree(clk_hw->hw.init);
159 return;
160 }
161
162cleanup:
163 kfree(clk_hw->dpll_data);
164 kfree(clk_hw->hw.init->parent_names);
165 kfree(clk_hw->hw.init);
166 kfree(clk_hw);
167}
168
169static void __init of_dra7_apll_setup(struct device_node *node)
170{
171 struct dpll_data *ad = NULL;
172 struct clk_hw_omap *clk_hw = NULL;
173 struct clk_init_data *init = NULL;
174 const char **parent_names = NULL;
175 int i;
176
177 ad = kzalloc(sizeof(*ad), GFP_KERNEL);
178 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
179 init = kzalloc(sizeof(*init), GFP_KERNEL);
180 if (!ad || !clk_hw || !init)
181 goto cleanup;
182
183 clk_hw->dpll_data = ad;
184 clk_hw->hw.init = init;
185 clk_hw->flags = MEMMAP_ADDRESSING;
186
187 init->name = node->name;
188 init->ops = &apll_ck_ops;
189
190 init->num_parents = of_clk_get_parent_count(node);
191 if (init->num_parents < 1) {
192 pr_err("dra7 apll %s must have parent(s)\n", node->name);
193 goto cleanup;
194 }
195
196 parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL);
197 if (!parent_names)
198 goto cleanup;
199
200 for (i = 0; i < init->num_parents; i++)
201 parent_names[i] = of_clk_get_parent_name(node, i);
202
203 init->parent_names = parent_names;
204
205 ad->control_reg = ti_clk_get_reg_addr(node, 0);
206 ad->idlest_reg = ti_clk_get_reg_addr(node, 1);
207
208 if (!ad->control_reg || !ad->idlest_reg)
209 goto cleanup;
210
211 ad->idlest_mask = 0x1;
212 ad->enable_mask = 0x3;
213
214 omap_clk_register_apll(&clk_hw->hw, node);
215 return;
216
217cleanup:
218 kfree(parent_names);
219 kfree(ad);
220 kfree(clk_hw);
221 kfree(init);
222}
223CLK_OF_DECLARE(dra7_apll_clock, "ti,dra7-apll-clock", of_dra7_apll_setup);
diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c
new file mode 100644
index 000000000000..8912ff80af34
--- /dev/null
+++ b/drivers/clk/ti/autoidle.c
@@ -0,0 +1,133 @@
1/*
2 * TI clock autoidle support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/io.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25struct clk_ti_autoidle {
26 void __iomem *reg;
27 u8 shift;
28 u8 flags;
29 const char *name;
30 struct list_head node;
31};
32
33#define AUTOIDLE_LOW 0x1
34
35static LIST_HEAD(autoidle_clks);
36
37static void ti_allow_autoidle(struct clk_ti_autoidle *clk)
38{
39 u32 val;
40
41 val = ti_clk_ll_ops->clk_readl(clk->reg);
42
43 if (clk->flags & AUTOIDLE_LOW)
44 val &= ~(1 << clk->shift);
45 else
46 val |= (1 << clk->shift);
47
48 ti_clk_ll_ops->clk_writel(val, clk->reg);
49}
50
51static void ti_deny_autoidle(struct clk_ti_autoidle *clk)
52{
53 u32 val;
54
55 val = ti_clk_ll_ops->clk_readl(clk->reg);
56
57 if (clk->flags & AUTOIDLE_LOW)
58 val |= (1 << clk->shift);
59 else
60 val &= ~(1 << clk->shift);
61
62 ti_clk_ll_ops->clk_writel(val, clk->reg);
63}
64
65/**
66 * of_ti_clk_allow_autoidle_all - enable autoidle for all clocks
67 *
68 * Enables hardware autoidle for all registered DT clocks, which have
69 * the feature.
70 */
71void of_ti_clk_allow_autoidle_all(void)
72{
73 struct clk_ti_autoidle *c;
74
75 list_for_each_entry(c, &autoidle_clks, node)
76 ti_allow_autoidle(c);
77}
78
79/**
80 * of_ti_clk_deny_autoidle_all - disable autoidle for all clocks
81 *
82 * Disables hardware autoidle for all registered DT clocks, which have
83 * the feature.
84 */
85void of_ti_clk_deny_autoidle_all(void)
86{
87 struct clk_ti_autoidle *c;
88
89 list_for_each_entry(c, &autoidle_clks, node)
90 ti_deny_autoidle(c);
91}
92
93/**
94 * of_ti_clk_autoidle_setup - sets up hardware autoidle for a clock
95 * @node: pointer to the clock device node
96 *
97 * Checks if a clock has hardware autoidle support or not (check
98 * for presence of 'ti,autoidle-shift' property in the device tree
99 * node) and sets up the hardware autoidle feature for the clock
100 * if available. If autoidle is available, the clock is also added
101 * to the autoidle list for later processing. Returns 0 on success,
102 * negative error value on failure.
103 */
104int __init of_ti_clk_autoidle_setup(struct device_node *node)
105{
106 u32 shift;
107 struct clk_ti_autoidle *clk;
108
109 /* Check if this clock has autoidle support or not */
110 if (of_property_read_u32(node, "ti,autoidle-shift", &shift))
111 return 0;
112
113 clk = kzalloc(sizeof(*clk), GFP_KERNEL);
114
115 if (!clk)
116 return -ENOMEM;
117
118 clk->shift = shift;
119 clk->name = node->name;
120 clk->reg = ti_clk_get_reg_addr(node, 0);
121
122 if (!clk->reg) {
123 kfree(clk);
124 return -EINVAL;
125 }
126
127 if (of_property_read_bool(node, "ti,invert-autoidle-bit"))
128 clk->flags |= AUTOIDLE_LOW;
129
130 list_add(&clk->node, &autoidle_clks);
131
132 return 0;
133}
diff --git a/drivers/clk/ti/clk-33xx.c b/drivers/clk/ti/clk-33xx.c
new file mode 100644
index 000000000000..776ee4594bd4
--- /dev/null
+++ b/drivers/clk/ti/clk-33xx.c
@@ -0,0 +1,161 @@
1/*
2 * AM33XX Clock init
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc
5 * Tero Kristo (t-kristo@ti.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-provider.h>
20#include <linux/clk/ti.h>
21
22static struct ti_dt_clk am33xx_clks[] = {
23 DT_CLK(NULL, "clk_32768_ck", "clk_32768_ck"),
24 DT_CLK(NULL, "clk_rc32k_ck", "clk_rc32k_ck"),
25 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
26 DT_CLK(NULL, "virt_24000000_ck", "virt_24000000_ck"),
27 DT_CLK(NULL, "virt_25000000_ck", "virt_25000000_ck"),
28 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
29 DT_CLK(NULL, "sys_clkin_ck", "sys_clkin_ck"),
30 DT_CLK(NULL, "tclkin_ck", "tclkin_ck"),
31 DT_CLK(NULL, "dpll_core_ck", "dpll_core_ck"),
32 DT_CLK(NULL, "dpll_core_x2_ck", "dpll_core_x2_ck"),
33 DT_CLK(NULL, "dpll_core_m4_ck", "dpll_core_m4_ck"),
34 DT_CLK(NULL, "dpll_core_m5_ck", "dpll_core_m5_ck"),
35 DT_CLK(NULL, "dpll_core_m6_ck", "dpll_core_m6_ck"),
36 DT_CLK(NULL, "dpll_mpu_ck", "dpll_mpu_ck"),
37 DT_CLK("cpu0", NULL, "dpll_mpu_ck"),
38 DT_CLK(NULL, "dpll_mpu_m2_ck", "dpll_mpu_m2_ck"),
39 DT_CLK(NULL, "dpll_ddr_ck", "dpll_ddr_ck"),
40 DT_CLK(NULL, "dpll_ddr_m2_ck", "dpll_ddr_m2_ck"),
41 DT_CLK(NULL, "dpll_ddr_m2_div2_ck", "dpll_ddr_m2_div2_ck"),
42 DT_CLK(NULL, "dpll_disp_ck", "dpll_disp_ck"),
43 DT_CLK(NULL, "dpll_disp_m2_ck", "dpll_disp_m2_ck"),
44 DT_CLK(NULL, "dpll_per_ck", "dpll_per_ck"),
45 DT_CLK(NULL, "dpll_per_m2_ck", "dpll_per_m2_ck"),
46 DT_CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", "dpll_per_m2_div4_wkupdm_ck"),
47 DT_CLK(NULL, "dpll_per_m2_div4_ck", "dpll_per_m2_div4_ck"),
48 DT_CLK(NULL, "adc_tsc_fck", "adc_tsc_fck"),
49 DT_CLK(NULL, "cefuse_fck", "cefuse_fck"),
50 DT_CLK(NULL, "clkdiv32k_ck", "clkdiv32k_ck"),
51 DT_CLK(NULL, "clkdiv32k_ick", "clkdiv32k_ick"),
52 DT_CLK(NULL, "dcan0_fck", "dcan0_fck"),
53 DT_CLK("481cc000.d_can", NULL, "dcan0_fck"),
54 DT_CLK(NULL, "dcan1_fck", "dcan1_fck"),
55 DT_CLK("481d0000.d_can", NULL, "dcan1_fck"),
56 DT_CLK(NULL, "pruss_ocp_gclk", "pruss_ocp_gclk"),
57 DT_CLK(NULL, "mcasp0_fck", "mcasp0_fck"),
58 DT_CLK(NULL, "mcasp1_fck", "mcasp1_fck"),
59 DT_CLK(NULL, "mmu_fck", "mmu_fck"),
60 DT_CLK(NULL, "smartreflex0_fck", "smartreflex0_fck"),
61 DT_CLK(NULL, "smartreflex1_fck", "smartreflex1_fck"),
62 DT_CLK(NULL, "sha0_fck", "sha0_fck"),
63 DT_CLK(NULL, "aes0_fck", "aes0_fck"),
64 DT_CLK(NULL, "rng_fck", "rng_fck"),
65 DT_CLK(NULL, "timer1_fck", "timer1_fck"),
66 DT_CLK(NULL, "timer2_fck", "timer2_fck"),
67 DT_CLK(NULL, "timer3_fck", "timer3_fck"),
68 DT_CLK(NULL, "timer4_fck", "timer4_fck"),
69 DT_CLK(NULL, "timer5_fck", "timer5_fck"),
70 DT_CLK(NULL, "timer6_fck", "timer6_fck"),
71 DT_CLK(NULL, "timer7_fck", "timer7_fck"),
72 DT_CLK(NULL, "usbotg_fck", "usbotg_fck"),
73 DT_CLK(NULL, "ieee5000_fck", "ieee5000_fck"),
74 DT_CLK(NULL, "wdt1_fck", "wdt1_fck"),
75 DT_CLK(NULL, "l4_rtc_gclk", "l4_rtc_gclk"),
76 DT_CLK(NULL, "l3_gclk", "l3_gclk"),
77 DT_CLK(NULL, "dpll_core_m4_div2_ck", "dpll_core_m4_div2_ck"),
78 DT_CLK(NULL, "l4hs_gclk", "l4hs_gclk"),
79 DT_CLK(NULL, "l3s_gclk", "l3s_gclk"),
80 DT_CLK(NULL, "l4fw_gclk", "l4fw_gclk"),
81 DT_CLK(NULL, "l4ls_gclk", "l4ls_gclk"),
82 DT_CLK(NULL, "clk_24mhz", "clk_24mhz"),
83 DT_CLK(NULL, "sysclk_div_ck", "sysclk_div_ck"),
84 DT_CLK(NULL, "cpsw_125mhz_gclk", "cpsw_125mhz_gclk"),
85 DT_CLK(NULL, "cpsw_cpts_rft_clk", "cpsw_cpts_rft_clk"),
86 DT_CLK(NULL, "gpio0_dbclk_mux_ck", "gpio0_dbclk_mux_ck"),
87 DT_CLK(NULL, "gpio0_dbclk", "gpio0_dbclk"),
88 DT_CLK(NULL, "gpio1_dbclk", "gpio1_dbclk"),
89 DT_CLK(NULL, "gpio2_dbclk", "gpio2_dbclk"),
90 DT_CLK(NULL, "gpio3_dbclk", "gpio3_dbclk"),
91 DT_CLK(NULL, "lcd_gclk", "lcd_gclk"),
92 DT_CLK(NULL, "mmc_clk", "mmc_clk"),
93 DT_CLK(NULL, "gfx_fclk_clksel_ck", "gfx_fclk_clksel_ck"),
94 DT_CLK(NULL, "gfx_fck_div_ck", "gfx_fck_div_ck"),
95 DT_CLK(NULL, "sysclkout_pre_ck", "sysclkout_pre_ck"),
96 DT_CLK(NULL, "clkout2_div_ck", "clkout2_div_ck"),
97 DT_CLK(NULL, "timer_32k_ck", "clkdiv32k_ick"),
98 DT_CLK(NULL, "timer_sys_ck", "sys_clkin_ck"),
99 DT_CLK(NULL, "dbg_sysclk_ck", "dbg_sysclk_ck"),
100 DT_CLK(NULL, "dbg_clka_ck", "dbg_clka_ck"),
101 DT_CLK(NULL, "stm_pmd_clock_mux_ck", "stm_pmd_clock_mux_ck"),
102 DT_CLK(NULL, "trace_pmd_clk_mux_ck", "trace_pmd_clk_mux_ck"),
103 DT_CLK(NULL, "stm_clk_div_ck", "stm_clk_div_ck"),
104 DT_CLK(NULL, "trace_clk_div_ck", "trace_clk_div_ck"),
105 DT_CLK(NULL, "clkout2_ck", "clkout2_ck"),
106 DT_CLK("48300200.ehrpwm", "tbclk", "ehrpwm0_tbclk"),
107 DT_CLK("48302200.ehrpwm", "tbclk", "ehrpwm1_tbclk"),
108 DT_CLK("48304200.ehrpwm", "tbclk", "ehrpwm2_tbclk"),
109 { .node_name = NULL },
110};
111
112static const char *enable_init_clks[] = {
113 "dpll_ddr_m2_ck",
114 "dpll_mpu_m2_ck",
115 "l3_gclk",
116 "l4hs_gclk",
117 "l4fw_gclk",
118 "l4ls_gclk",
119 /* Required for external peripherals like, Audio codecs */
120 "clkout2_ck",
121};
122
123int __init am33xx_dt_clk_init(void)
124{
125 struct clk *clk1, *clk2;
126
127 ti_dt_clocks_register(am33xx_clks);
128
129 omap2_clk_disable_autoidle_all();
130
131 omap2_clk_enable_init_clocks(enable_init_clks,
132 ARRAY_SIZE(enable_init_clks));
133
134 /* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
135 * physically present, in such a case HWMOD enabling of
136 * clock would be failure with default parent. And timer
137 * probe thinks clock is already enabled, this leads to
138 * crash upon accessing timer 3 & 6 registers in probe.
139 * Fix by setting parent of both these timers to master
140 * oscillator clock.
141 */
142
143 clk1 = clk_get_sys(NULL, "sys_clkin_ck");
144 clk2 = clk_get_sys(NULL, "timer3_fck");
145 clk_set_parent(clk2, clk1);
146
147 clk2 = clk_get_sys(NULL, "timer6_fck");
148 clk_set_parent(clk2, clk1);
149 /*
150 * The On-Chip 32K RC Osc clock is not an accurate clock-source as per
151 * the design/spec, so as a result, for example, timer which supposed
152 * to get expired @60Sec, but will expire somewhere ~@40Sec, which is
153 * not expected by any use-case, so change WDT1 clock source to PRCM
154 * 32KHz clock.
155 */
156 clk1 = clk_get_sys(NULL, "wdt1_fck");
157 clk2 = clk_get_sys(NULL, "clkdiv32k_ick");
158 clk_set_parent(clk1, clk2);
159
160 return 0;
161}
diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c
new file mode 100644
index 000000000000..d3230234f07b
--- /dev/null
+++ b/drivers/clk/ti/clk-3xxx.c
@@ -0,0 +1,401 @@
1/*
2 * OMAP3 Clock init
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc
5 * Tero Kristo (t-kristo@ti.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-provider.h>
20#include <linux/clk/ti.h>
21
22
23static struct ti_dt_clk omap3xxx_clks[] = {
24 DT_CLK(NULL, "apb_pclk", "dummy_apb_pclk"),
25 DT_CLK(NULL, "omap_32k_fck", "omap_32k_fck"),
26 DT_CLK(NULL, "virt_12m_ck", "virt_12m_ck"),
27 DT_CLK(NULL, "virt_13m_ck", "virt_13m_ck"),
28 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
29 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
30 DT_CLK(NULL, "virt_38_4m_ck", "virt_38_4m_ck"),
31 DT_CLK(NULL, "osc_sys_ck", "osc_sys_ck"),
32 DT_CLK("twl", "fck", "osc_sys_ck"),
33 DT_CLK(NULL, "sys_ck", "sys_ck"),
34 DT_CLK(NULL, "omap_96m_alwon_fck", "omap_96m_alwon_fck"),
35 DT_CLK("etb", "emu_core_alwon_ck", "emu_core_alwon_ck"),
36 DT_CLK(NULL, "sys_altclk", "sys_altclk"),
37 DT_CLK(NULL, "mcbsp_clks", "mcbsp_clks"),
38 DT_CLK(NULL, "sys_clkout1", "sys_clkout1"),
39 DT_CLK(NULL, "dpll1_ck", "dpll1_ck"),
40 DT_CLK(NULL, "dpll1_x2_ck", "dpll1_x2_ck"),
41 DT_CLK(NULL, "dpll1_x2m2_ck", "dpll1_x2m2_ck"),
42 DT_CLK(NULL, "dpll3_ck", "dpll3_ck"),
43 DT_CLK(NULL, "core_ck", "core_ck"),
44 DT_CLK(NULL, "dpll3_x2_ck", "dpll3_x2_ck"),
45 DT_CLK(NULL, "dpll3_m2_ck", "dpll3_m2_ck"),
46 DT_CLK(NULL, "dpll3_m2x2_ck", "dpll3_m2x2_ck"),
47 DT_CLK(NULL, "dpll3_m3_ck", "dpll3_m3_ck"),
48 DT_CLK(NULL, "dpll3_m3x2_ck", "dpll3_m3x2_ck"),
49 DT_CLK(NULL, "dpll4_ck", "dpll4_ck"),
50 DT_CLK(NULL, "dpll4_x2_ck", "dpll4_x2_ck"),
51 DT_CLK(NULL, "omap_96m_fck", "omap_96m_fck"),
52 DT_CLK(NULL, "cm_96m_fck", "cm_96m_fck"),
53 DT_CLK(NULL, "omap_54m_fck", "omap_54m_fck"),
54 DT_CLK(NULL, "omap_48m_fck", "omap_48m_fck"),
55 DT_CLK(NULL, "omap_12m_fck", "omap_12m_fck"),
56 DT_CLK(NULL, "dpll4_m2_ck", "dpll4_m2_ck"),
57 DT_CLK(NULL, "dpll4_m2x2_ck", "dpll4_m2x2_ck"),
58 DT_CLK(NULL, "dpll4_m3_ck", "dpll4_m3_ck"),
59 DT_CLK(NULL, "dpll4_m3x2_ck", "dpll4_m3x2_ck"),
60 DT_CLK(NULL, "dpll4_m4_ck", "dpll4_m4_ck"),
61 DT_CLK(NULL, "dpll4_m4x2_ck", "dpll4_m4x2_ck"),
62 DT_CLK(NULL, "dpll4_m5_ck", "dpll4_m5_ck"),
63 DT_CLK(NULL, "dpll4_m5x2_ck", "dpll4_m5x2_ck"),
64 DT_CLK(NULL, "dpll4_m6_ck", "dpll4_m6_ck"),
65 DT_CLK(NULL, "dpll4_m6x2_ck", "dpll4_m6x2_ck"),
66 DT_CLK("etb", "emu_per_alwon_ck", "emu_per_alwon_ck"),
67 DT_CLK(NULL, "clkout2_src_ck", "clkout2_src_ck"),
68 DT_CLK(NULL, "sys_clkout2", "sys_clkout2"),
69 DT_CLK(NULL, "corex2_fck", "corex2_fck"),
70 DT_CLK(NULL, "dpll1_fck", "dpll1_fck"),
71 DT_CLK(NULL, "mpu_ck", "mpu_ck"),
72 DT_CLK(NULL, "arm_fck", "arm_fck"),
73 DT_CLK("etb", "emu_mpu_alwon_ck", "emu_mpu_alwon_ck"),
74 DT_CLK(NULL, "l3_ick", "l3_ick"),
75 DT_CLK(NULL, "l4_ick", "l4_ick"),
76 DT_CLK(NULL, "rm_ick", "rm_ick"),
77 DT_CLK(NULL, "gpt10_fck", "gpt10_fck"),
78 DT_CLK(NULL, "gpt11_fck", "gpt11_fck"),
79 DT_CLK(NULL, "core_96m_fck", "core_96m_fck"),
80 DT_CLK(NULL, "mmchs2_fck", "mmchs2_fck"),
81 DT_CLK(NULL, "mmchs1_fck", "mmchs1_fck"),
82 DT_CLK(NULL, "i2c3_fck", "i2c3_fck"),
83 DT_CLK(NULL, "i2c2_fck", "i2c2_fck"),
84 DT_CLK(NULL, "i2c1_fck", "i2c1_fck"),
85 DT_CLK(NULL, "mcbsp5_fck", "mcbsp5_fck"),
86 DT_CLK(NULL, "mcbsp1_fck", "mcbsp1_fck"),
87 DT_CLK(NULL, "core_48m_fck", "core_48m_fck"),
88 DT_CLK(NULL, "mcspi4_fck", "mcspi4_fck"),
89 DT_CLK(NULL, "mcspi3_fck", "mcspi3_fck"),
90 DT_CLK(NULL, "mcspi2_fck", "mcspi2_fck"),
91 DT_CLK(NULL, "mcspi1_fck", "mcspi1_fck"),
92 DT_CLK(NULL, "uart2_fck", "uart2_fck"),
93 DT_CLK(NULL, "uart1_fck", "uart1_fck"),
94 DT_CLK(NULL, "core_12m_fck", "core_12m_fck"),
95 DT_CLK("omap_hdq.0", "fck", "hdq_fck"),
96 DT_CLK(NULL, "hdq_fck", "hdq_fck"),
97 DT_CLK(NULL, "core_l3_ick", "core_l3_ick"),
98 DT_CLK(NULL, "sdrc_ick", "sdrc_ick"),
99 DT_CLK(NULL, "gpmc_fck", "gpmc_fck"),
100 DT_CLK(NULL, "core_l4_ick", "core_l4_ick"),
101 DT_CLK("omap_hsmmc.1", "ick", "mmchs2_ick"),
102 DT_CLK("omap_hsmmc.0", "ick", "mmchs1_ick"),
103 DT_CLK(NULL, "mmchs2_ick", "mmchs2_ick"),
104 DT_CLK(NULL, "mmchs1_ick", "mmchs1_ick"),
105 DT_CLK("omap_hdq.0", "ick", "hdq_ick"),
106 DT_CLK(NULL, "hdq_ick", "hdq_ick"),
107 DT_CLK("omap2_mcspi.4", "ick", "mcspi4_ick"),
108 DT_CLK("omap2_mcspi.3", "ick", "mcspi3_ick"),
109 DT_CLK("omap2_mcspi.2", "ick", "mcspi2_ick"),
110 DT_CLK("omap2_mcspi.1", "ick", "mcspi1_ick"),
111 DT_CLK(NULL, "mcspi4_ick", "mcspi4_ick"),
112 DT_CLK(NULL, "mcspi3_ick", "mcspi3_ick"),
113 DT_CLK(NULL, "mcspi2_ick", "mcspi2_ick"),
114 DT_CLK(NULL, "mcspi1_ick", "mcspi1_ick"),
115 DT_CLK("omap_i2c.3", "ick", "i2c3_ick"),
116 DT_CLK("omap_i2c.2", "ick", "i2c2_ick"),
117 DT_CLK("omap_i2c.1", "ick", "i2c1_ick"),
118 DT_CLK(NULL, "i2c3_ick", "i2c3_ick"),
119 DT_CLK(NULL, "i2c2_ick", "i2c2_ick"),
120 DT_CLK(NULL, "i2c1_ick", "i2c1_ick"),
121 DT_CLK(NULL, "uart2_ick", "uart2_ick"),
122 DT_CLK(NULL, "uart1_ick", "uart1_ick"),
123 DT_CLK(NULL, "gpt11_ick", "gpt11_ick"),
124 DT_CLK(NULL, "gpt10_ick", "gpt10_ick"),
125 DT_CLK("omap-mcbsp.5", "ick", "mcbsp5_ick"),
126 DT_CLK("omap-mcbsp.1", "ick", "mcbsp1_ick"),
127 DT_CLK(NULL, "mcbsp5_ick", "mcbsp5_ick"),
128 DT_CLK(NULL, "mcbsp1_ick", "mcbsp1_ick"),
129 DT_CLK(NULL, "omapctrl_ick", "omapctrl_ick"),
130 DT_CLK(NULL, "dss_tv_fck", "dss_tv_fck"),
131 DT_CLK(NULL, "dss_96m_fck", "dss_96m_fck"),
132 DT_CLK(NULL, "dss2_alwon_fck", "dss2_alwon_fck"),
133 DT_CLK(NULL, "utmi_p1_gfclk", "dummy_ck"),
134 DT_CLK(NULL, "utmi_p2_gfclk", "dummy_ck"),
135 DT_CLK(NULL, "xclk60mhsp1_ck", "dummy_ck"),
136 DT_CLK(NULL, "xclk60mhsp2_ck", "dummy_ck"),
137 DT_CLK(NULL, "init_60m_fclk", "dummy_ck"),
138 DT_CLK(NULL, "gpt1_fck", "gpt1_fck"),
139 DT_CLK(NULL, "aes2_ick", "aes2_ick"),
140 DT_CLK(NULL, "wkup_32k_fck", "wkup_32k_fck"),
141 DT_CLK(NULL, "gpio1_dbck", "gpio1_dbck"),
142 DT_CLK(NULL, "sha12_ick", "sha12_ick"),
143 DT_CLK(NULL, "wdt2_fck", "wdt2_fck"),
144 DT_CLK("omap_wdt", "ick", "wdt2_ick"),
145 DT_CLK(NULL, "wdt2_ick", "wdt2_ick"),
146 DT_CLK(NULL, "wdt1_ick", "wdt1_ick"),
147 DT_CLK(NULL, "gpio1_ick", "gpio1_ick"),
148 DT_CLK(NULL, "omap_32ksync_ick", "omap_32ksync_ick"),
149 DT_CLK(NULL, "gpt12_ick", "gpt12_ick"),
150 DT_CLK(NULL, "gpt1_ick", "gpt1_ick"),
151 DT_CLK(NULL, "per_96m_fck", "per_96m_fck"),
152 DT_CLK(NULL, "per_48m_fck", "per_48m_fck"),
153 DT_CLK(NULL, "uart3_fck", "uart3_fck"),
154 DT_CLK(NULL, "gpt2_fck", "gpt2_fck"),
155 DT_CLK(NULL, "gpt3_fck", "gpt3_fck"),
156 DT_CLK(NULL, "gpt4_fck", "gpt4_fck"),
157 DT_CLK(NULL, "gpt5_fck", "gpt5_fck"),
158 DT_CLK(NULL, "gpt6_fck", "gpt6_fck"),
159 DT_CLK(NULL, "gpt7_fck", "gpt7_fck"),
160 DT_CLK(NULL, "gpt8_fck", "gpt8_fck"),
161 DT_CLK(NULL, "gpt9_fck", "gpt9_fck"),
162 DT_CLK(NULL, "per_32k_alwon_fck", "per_32k_alwon_fck"),
163 DT_CLK(NULL, "gpio6_dbck", "gpio6_dbck"),
164 DT_CLK(NULL, "gpio5_dbck", "gpio5_dbck"),
165 DT_CLK(NULL, "gpio4_dbck", "gpio4_dbck"),
166 DT_CLK(NULL, "gpio3_dbck", "gpio3_dbck"),
167 DT_CLK(NULL, "gpio2_dbck", "gpio2_dbck"),
168 DT_CLK(NULL, "wdt3_fck", "wdt3_fck"),
169 DT_CLK(NULL, "per_l4_ick", "per_l4_ick"),
170 DT_CLK(NULL, "gpio6_ick", "gpio6_ick"),
171 DT_CLK(NULL, "gpio5_ick", "gpio5_ick"),
172 DT_CLK(NULL, "gpio4_ick", "gpio4_ick"),
173 DT_CLK(NULL, "gpio3_ick", "gpio3_ick"),
174 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"),
175 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"),
176 DT_CLK(NULL, "uart3_ick", "uart3_ick"),
177 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
178 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"),
179 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"),
180 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"),
181 DT_CLK(NULL, "gpt6_ick", "gpt6_ick"),
182 DT_CLK(NULL, "gpt5_ick", "gpt5_ick"),
183 DT_CLK(NULL, "gpt4_ick", "gpt4_ick"),
184 DT_CLK(NULL, "gpt3_ick", "gpt3_ick"),
185 DT_CLK(NULL, "gpt2_ick", "gpt2_ick"),
186 DT_CLK("omap-mcbsp.2", "ick", "mcbsp2_ick"),
187 DT_CLK("omap-mcbsp.3", "ick", "mcbsp3_ick"),
188 DT_CLK("omap-mcbsp.4", "ick", "mcbsp4_ick"),
189 DT_CLK(NULL, "mcbsp4_ick", "mcbsp2_ick"),
190 DT_CLK(NULL, "mcbsp3_ick", "mcbsp3_ick"),
191 DT_CLK(NULL, "mcbsp2_ick", "mcbsp4_ick"),
192 DT_CLK(NULL, "mcbsp2_fck", "mcbsp2_fck"),
193 DT_CLK(NULL, "mcbsp3_fck", "mcbsp3_fck"),
194 DT_CLK(NULL, "mcbsp4_fck", "mcbsp4_fck"),
195 DT_CLK("etb", "emu_src_ck", "emu_src_ck"),
196 DT_CLK(NULL, "emu_src_ck", "emu_src_ck"),
197 DT_CLK(NULL, "pclk_fck", "pclk_fck"),
198 DT_CLK(NULL, "pclkx2_fck", "pclkx2_fck"),
199 DT_CLK(NULL, "atclk_fck", "atclk_fck"),
200 DT_CLK(NULL, "traceclk_src_fck", "traceclk_src_fck"),
201 DT_CLK(NULL, "traceclk_fck", "traceclk_fck"),
202 DT_CLK(NULL, "secure_32k_fck", "secure_32k_fck"),
203 DT_CLK(NULL, "gpt12_fck", "gpt12_fck"),
204 DT_CLK(NULL, "wdt1_fck", "wdt1_fck"),
205 DT_CLK(NULL, "timer_32k_ck", "omap_32k_fck"),
206 DT_CLK(NULL, "timer_sys_ck", "sys_ck"),
207 DT_CLK(NULL, "cpufreq_ck", "dpll1_ck"),
208 { .node_name = NULL },
209};
210
211static struct ti_dt_clk omap34xx_omap36xx_clks[] = {
212 DT_CLK(NULL, "aes1_ick", "aes1_ick"),
213 DT_CLK("omap_rng", "ick", "rng_ick"),
214 DT_CLK("omap3-rom-rng", "ick", "rng_ick"),
215 DT_CLK(NULL, "sha11_ick", "sha11_ick"),
216 DT_CLK(NULL, "des1_ick", "des1_ick"),
217 DT_CLK(NULL, "cam_mclk", "cam_mclk"),
218 DT_CLK(NULL, "cam_ick", "cam_ick"),
219 DT_CLK(NULL, "csi2_96m_fck", "csi2_96m_fck"),
220 DT_CLK(NULL, "security_l3_ick", "security_l3_ick"),
221 DT_CLK(NULL, "pka_ick", "pka_ick"),
222 DT_CLK(NULL, "icr_ick", "icr_ick"),
223 DT_CLK("omap-aes", "ick", "aes2_ick"),
224 DT_CLK("omap-sham", "ick", "sha12_ick"),
225 DT_CLK(NULL, "des2_ick", "des2_ick"),
226 DT_CLK(NULL, "mspro_ick", "mspro_ick"),
227 DT_CLK(NULL, "mailboxes_ick", "mailboxes_ick"),
228 DT_CLK(NULL, "ssi_l4_ick", "ssi_l4_ick"),
229 DT_CLK(NULL, "sr1_fck", "sr1_fck"),
230 DT_CLK(NULL, "sr2_fck", "sr2_fck"),
231 DT_CLK(NULL, "sr_l4_ick", "sr_l4_ick"),
232 DT_CLK(NULL, "security_l4_ick2", "security_l4_ick2"),
233 DT_CLK(NULL, "wkup_l4_ick", "wkup_l4_ick"),
234 DT_CLK(NULL, "dpll2_fck", "dpll2_fck"),
235 DT_CLK(NULL, "iva2_ck", "iva2_ck"),
236 DT_CLK(NULL, "modem_fck", "modem_fck"),
237 DT_CLK(NULL, "sad2d_ick", "sad2d_ick"),
238 DT_CLK(NULL, "mad2d_ick", "mad2d_ick"),
239 DT_CLK(NULL, "mspro_fck", "mspro_fck"),
240 DT_CLK(NULL, "dpll2_ck", "dpll2_ck"),
241 DT_CLK(NULL, "dpll2_m2_ck", "dpll2_m2_ck"),
242 { .node_name = NULL },
243};
244
245static struct ti_dt_clk omap36xx_omap3430es2plus_clks[] = {
246 DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es2"),
247 DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es2"),
248 DT_CLK("musb-omap2430", "ick", "hsotgusb_ick_3430es2"),
249 DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es2"),
250 DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es2"),
251 DT_CLK(NULL, "usim_fck", "usim_fck"),
252 DT_CLK(NULL, "usim_ick", "usim_ick"),
253 { .node_name = NULL },
254};
255
256static struct ti_dt_clk omap3430es1_clks[] = {
257 DT_CLK(NULL, "gfx_l3_ck", "gfx_l3_ck"),
258 DT_CLK(NULL, "gfx_l3_fck", "gfx_l3_fck"),
259 DT_CLK(NULL, "gfx_l3_ick", "gfx_l3_ick"),
260 DT_CLK(NULL, "gfx_cg1_ck", "gfx_cg1_ck"),
261 DT_CLK(NULL, "gfx_cg2_ck", "gfx_cg2_ck"),
262 DT_CLK(NULL, "d2d_26m_fck", "d2d_26m_fck"),
263 DT_CLK(NULL, "fshostusb_fck", "fshostusb_fck"),
264 DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es1"),
265 DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es1"),
266 DT_CLK("musb-omap2430", "ick", "hsotgusb_ick_3430es1"),
267 DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es1"),
268 DT_CLK(NULL, "fac_ick", "fac_ick"),
269 DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es1"),
270 DT_CLK(NULL, "usb_l4_ick", "usb_l4_ick"),
271 DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es1"),
272 DT_CLK("omapdss_dss", "ick", "dss_ick_3430es1"),
273 DT_CLK(NULL, "dss_ick", "dss_ick_3430es1"),
274 { .node_name = NULL },
275};
276
277static struct ti_dt_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
278 DT_CLK(NULL, "virt_16_8m_ck", "virt_16_8m_ck"),
279 DT_CLK(NULL, "dpll5_ck", "dpll5_ck"),
280 DT_CLK(NULL, "dpll5_m2_ck", "dpll5_m2_ck"),
281 DT_CLK(NULL, "sgx_fck", "sgx_fck"),
282 DT_CLK(NULL, "sgx_ick", "sgx_ick"),
283 DT_CLK(NULL, "cpefuse_fck", "cpefuse_fck"),
284 DT_CLK(NULL, "ts_fck", "ts_fck"),
285 DT_CLK(NULL, "usbtll_fck", "usbtll_fck"),
286 DT_CLK(NULL, "usbtll_ick", "usbtll_ick"),
287 DT_CLK("omap_hsmmc.2", "ick", "mmchs3_ick"),
288 DT_CLK(NULL, "mmchs3_ick", "mmchs3_ick"),
289 DT_CLK(NULL, "mmchs3_fck", "mmchs3_fck"),
290 DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es2"),
291 DT_CLK("omapdss_dss", "ick", "dss_ick_3430es2"),
292 DT_CLK(NULL, "dss_ick", "dss_ick_3430es2"),
293 DT_CLK(NULL, "usbhost_120m_fck", "usbhost_120m_fck"),
294 DT_CLK(NULL, "usbhost_48m_fck", "usbhost_48m_fck"),
295 DT_CLK(NULL, "usbhost_ick", "usbhost_ick"),
296 { .node_name = NULL },
297};
298
299static struct ti_dt_clk am35xx_clks[] = {
300 DT_CLK(NULL, "ipss_ick", "ipss_ick"),
301 DT_CLK(NULL, "rmii_ck", "rmii_ck"),
302 DT_CLK(NULL, "pclk_ck", "pclk_ck"),
303 DT_CLK(NULL, "emac_ick", "emac_ick"),
304 DT_CLK(NULL, "emac_fck", "emac_fck"),
305 DT_CLK("davinci_emac.0", NULL, "emac_ick"),
306 DT_CLK("davinci_mdio.0", NULL, "emac_fck"),
307 DT_CLK("vpfe-capture", "master", "vpfe_ick"),
308 DT_CLK("vpfe-capture", "slave", "vpfe_fck"),
309 DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_am35xx"),
310 DT_CLK(NULL, "hsotgusb_fck", "hsotgusb_fck_am35xx"),
311 DT_CLK(NULL, "hecc_ck", "hecc_ck"),
312 DT_CLK(NULL, "uart4_ick", "uart4_ick_am35xx"),
313 DT_CLK(NULL, "uart4_fck", "uart4_fck_am35xx"),
314 { .node_name = NULL },
315};
316
317static struct ti_dt_clk omap36xx_clks[] = {
318 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"),
319 DT_CLK(NULL, "uart4_fck", "uart4_fck"),
320 { .node_name = NULL },
321};
322
323static const char *enable_init_clks[] = {
324 "sdrc_ick",
325 "gpmc_fck",
326 "omapctrl_ick",
327};
328
329enum {
330 OMAP3_SOC_AM35XX,
331 OMAP3_SOC_OMAP3430_ES1,
332 OMAP3_SOC_OMAP3430_ES2_PLUS,
333 OMAP3_SOC_OMAP3630,
334 OMAP3_SOC_TI81XX,
335};
336
337static int __init omap3xxx_dt_clk_init(int soc_type)
338{
339 if (soc_type == OMAP3_SOC_AM35XX || soc_type == OMAP3_SOC_OMAP3630 ||
340 soc_type == OMAP3_SOC_OMAP3430_ES1 ||
341 soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
342 ti_dt_clocks_register(omap3xxx_clks);
343
344 if (soc_type == OMAP3_SOC_AM35XX)
345 ti_dt_clocks_register(am35xx_clks);
346
347 if (soc_type == OMAP3_SOC_OMAP3630 || soc_type == OMAP3_SOC_AM35XX ||
348 soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
349 ti_dt_clocks_register(omap36xx_am35xx_omap3430es2plus_clks);
350
351 if (soc_type == OMAP3_SOC_OMAP3430_ES1)
352 ti_dt_clocks_register(omap3430es1_clks);
353
354 if (soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS ||
355 soc_type == OMAP3_SOC_OMAP3630)
356 ti_dt_clocks_register(omap36xx_omap3430es2plus_clks);
357
358 if (soc_type == OMAP3_SOC_OMAP3430_ES1 ||
359 soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS ||
360 soc_type == OMAP3_SOC_OMAP3630)
361 ti_dt_clocks_register(omap34xx_omap36xx_clks);
362
363 if (soc_type == OMAP3_SOC_OMAP3630)
364 ti_dt_clocks_register(omap36xx_clks);
365
366 omap2_clk_disable_autoidle_all();
367
368 omap2_clk_enable_init_clocks(enable_init_clks,
369 ARRAY_SIZE(enable_init_clks));
370
371 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
372 (clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 1000000),
373 (clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 100000) % 10,
374 (clk_get_rate(clk_get_sys(NULL, "core_ck")) / 1000000),
375 (clk_get_rate(clk_get_sys(NULL, "arm_fck")) / 1000000));
376
377 if (soc_type != OMAP3_SOC_TI81XX && soc_type != OMAP3_SOC_OMAP3430_ES1)
378 omap3_clk_lock_dpll5();
379
380 return 0;
381}
382
383int __init omap3430_dt_clk_init(void)
384{
385 return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3430_ES2_PLUS);
386}
387
388int __init omap3630_dt_clk_init(void)
389{
390 return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3630);
391}
392
393int __init am35xx_dt_clk_init(void)
394{
395 return omap3xxx_dt_clk_init(OMAP3_SOC_AM35XX);
396}
397
398int __init ti81xx_dt_clk_init(void)
399{
400 return omap3xxx_dt_clk_init(OMAP3_SOC_TI81XX);
401}
diff --git a/drivers/clk/ti/clk-43xx.c b/drivers/clk/ti/clk-43xx.c
new file mode 100644
index 000000000000..67c8de572c50
--- /dev/null
+++ b/drivers/clk/ti/clk-43xx.c
@@ -0,0 +1,118 @@
1/*
2 * AM43XX Clock init
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc
5 * Tero Kristo (t-kristo@ti.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-provider.h>
20#include <linux/clk/ti.h>
21
22static struct ti_dt_clk am43xx_clks[] = {
23 DT_CLK(NULL, "clk_32768_ck", "clk_32768_ck"),
24 DT_CLK(NULL, "clk_rc32k_ck", "clk_rc32k_ck"),
25 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
26 DT_CLK(NULL, "virt_24000000_ck", "virt_24000000_ck"),
27 DT_CLK(NULL, "virt_25000000_ck", "virt_25000000_ck"),
28 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
29 DT_CLK(NULL, "sys_clkin_ck", "sys_clkin_ck"),
30 DT_CLK(NULL, "tclkin_ck", "tclkin_ck"),
31 DT_CLK(NULL, "dpll_core_ck", "dpll_core_ck"),
32 DT_CLK(NULL, "dpll_core_x2_ck", "dpll_core_x2_ck"),
33 DT_CLK(NULL, "dpll_core_m4_ck", "dpll_core_m4_ck"),
34 DT_CLK(NULL, "dpll_core_m5_ck", "dpll_core_m5_ck"),
35 DT_CLK(NULL, "dpll_core_m6_ck", "dpll_core_m6_ck"),
36 DT_CLK(NULL, "dpll_mpu_ck", "dpll_mpu_ck"),
37 DT_CLK(NULL, "dpll_mpu_m2_ck", "dpll_mpu_m2_ck"),
38 DT_CLK(NULL, "dpll_ddr_ck", "dpll_ddr_ck"),
39 DT_CLK(NULL, "dpll_ddr_m2_ck", "dpll_ddr_m2_ck"),
40 DT_CLK(NULL, "dpll_disp_ck", "dpll_disp_ck"),
41 DT_CLK(NULL, "dpll_disp_m2_ck", "dpll_disp_m2_ck"),
42 DT_CLK(NULL, "dpll_per_ck", "dpll_per_ck"),
43 DT_CLK(NULL, "dpll_per_m2_ck", "dpll_per_m2_ck"),
44 DT_CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", "dpll_per_m2_div4_wkupdm_ck"),
45 DT_CLK(NULL, "dpll_per_m2_div4_ck", "dpll_per_m2_div4_ck"),
46 DT_CLK(NULL, "adc_tsc_fck", "adc_tsc_fck"),
47 DT_CLK(NULL, "clkdiv32k_ck", "clkdiv32k_ck"),
48 DT_CLK(NULL, "clkdiv32k_ick", "clkdiv32k_ick"),
49 DT_CLK(NULL, "dcan0_fck", "dcan0_fck"),
50 DT_CLK(NULL, "dcan1_fck", "dcan1_fck"),
51 DT_CLK(NULL, "pruss_ocp_gclk", "pruss_ocp_gclk"),
52 DT_CLK(NULL, "mcasp0_fck", "mcasp0_fck"),
53 DT_CLK(NULL, "mcasp1_fck", "mcasp1_fck"),
54 DT_CLK(NULL, "smartreflex0_fck", "smartreflex0_fck"),
55 DT_CLK(NULL, "smartreflex1_fck", "smartreflex1_fck"),
56 DT_CLK(NULL, "sha0_fck", "sha0_fck"),
57 DT_CLK(NULL, "aes0_fck", "aes0_fck"),
58 DT_CLK(NULL, "timer1_fck", "timer1_fck"),
59 DT_CLK(NULL, "timer2_fck", "timer2_fck"),
60 DT_CLK(NULL, "timer3_fck", "timer3_fck"),
61 DT_CLK(NULL, "timer4_fck", "timer4_fck"),
62 DT_CLK(NULL, "timer5_fck", "timer5_fck"),
63 DT_CLK(NULL, "timer6_fck", "timer6_fck"),
64 DT_CLK(NULL, "timer7_fck", "timer7_fck"),
65 DT_CLK(NULL, "wdt1_fck", "wdt1_fck"),
66 DT_CLK(NULL, "l3_gclk", "l3_gclk"),
67 DT_CLK(NULL, "dpll_core_m4_div2_ck", "dpll_core_m4_div2_ck"),
68 DT_CLK(NULL, "l4hs_gclk", "l4hs_gclk"),
69 DT_CLK(NULL, "l3s_gclk", "l3s_gclk"),
70 DT_CLK(NULL, "l4ls_gclk", "l4ls_gclk"),
71 DT_CLK(NULL, "clk_24mhz", "clk_24mhz"),
72 DT_CLK(NULL, "cpsw_125mhz_gclk", "cpsw_125mhz_gclk"),
73 DT_CLK(NULL, "cpsw_cpts_rft_clk", "cpsw_cpts_rft_clk"),
74 DT_CLK(NULL, "gpio0_dbclk_mux_ck", "gpio0_dbclk_mux_ck"),
75 DT_CLK(NULL, "gpio0_dbclk", "gpio0_dbclk"),
76 DT_CLK(NULL, "gpio1_dbclk", "gpio1_dbclk"),
77 DT_CLK(NULL, "gpio2_dbclk", "gpio2_dbclk"),
78 DT_CLK(NULL, "gpio3_dbclk", "gpio3_dbclk"),
79 DT_CLK(NULL, "gpio4_dbclk", "gpio4_dbclk"),
80 DT_CLK(NULL, "gpio5_dbclk", "gpio5_dbclk"),
81 DT_CLK(NULL, "mmc_clk", "mmc_clk"),
82 DT_CLK(NULL, "gfx_fclk_clksel_ck", "gfx_fclk_clksel_ck"),
83 DT_CLK(NULL, "gfx_fck_div_ck", "gfx_fck_div_ck"),
84 DT_CLK(NULL, "timer_32k_ck", "clkdiv32k_ick"),
85 DT_CLK(NULL, "timer_sys_ck", "sys_clkin_ck"),
86 DT_CLK(NULL, "sysclk_div", "sysclk_div"),
87 DT_CLK(NULL, "disp_clk", "disp_clk"),
88 DT_CLK(NULL, "clk_32k_mosc_ck", "clk_32k_mosc_ck"),
89 DT_CLK(NULL, "clk_32k_tpm_ck", "clk_32k_tpm_ck"),
90 DT_CLK(NULL, "dpll_extdev_ck", "dpll_extdev_ck"),
91 DT_CLK(NULL, "dpll_extdev_m2_ck", "dpll_extdev_m2_ck"),
92 DT_CLK(NULL, "mux_synctimer32k_ck", "mux_synctimer32k_ck"),
93 DT_CLK(NULL, "synctimer_32kclk", "synctimer_32kclk"),
94 DT_CLK(NULL, "timer8_fck", "timer8_fck"),
95 DT_CLK(NULL, "timer9_fck", "timer9_fck"),
96 DT_CLK(NULL, "timer10_fck", "timer10_fck"),
97 DT_CLK(NULL, "timer11_fck", "timer11_fck"),
98 DT_CLK(NULL, "cpsw_50m_clkdiv", "cpsw_50m_clkdiv"),
99 DT_CLK(NULL, "cpsw_5m_clkdiv", "cpsw_5m_clkdiv"),
100 DT_CLK(NULL, "dpll_ddr_x2_ck", "dpll_ddr_x2_ck"),
101 DT_CLK(NULL, "dpll_ddr_m4_ck", "dpll_ddr_m4_ck"),
102 DT_CLK(NULL, "dpll_per_clkdcoldo", "dpll_per_clkdcoldo"),
103 DT_CLK(NULL, "dll_aging_clk_div", "dll_aging_clk_div"),
104 DT_CLK(NULL, "div_core_25m_ck", "div_core_25m_ck"),
105 DT_CLK(NULL, "func_12m_clk", "func_12m_clk"),
106 DT_CLK(NULL, "vtp_clk_div", "vtp_clk_div"),
107 DT_CLK(NULL, "usbphy_32khz_clkmux", "usbphy_32khz_clkmux"),
108 { .node_name = NULL },
109};
110
111int __init am43xx_dt_clk_init(void)
112{
113 ti_dt_clocks_register(am43xx_clks);
114
115 omap2_clk_disable_autoidle_all();
116
117 return 0;
118}
diff --git a/drivers/clk/ti/clk-44xx.c b/drivers/clk/ti/clk-44xx.c
new file mode 100644
index 000000000000..ae00218b5da3
--- /dev/null
+++ b/drivers/clk/ti/clk-44xx.c
@@ -0,0 +1,316 @@
1/*
2 * OMAP4 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-private.h>
16#include <linux/clkdev.h>
17#include <linux/clk/ti.h>
18
19/*
20 * OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section
21 * "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK
22 * must be set to 196.608 MHz" and hence, the DPLL locked frequency is
23 * half of this value.
24 */
25#define OMAP4_DPLL_ABE_DEFFREQ 98304000
26
27/*
28 * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section
29 * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred
30 * locked frequency for the USB DPLL is 960MHz.
31 */
32#define OMAP4_DPLL_USB_DEFFREQ 960000000
33
34static struct ti_dt_clk omap44xx_clks[] = {
35 DT_CLK(NULL, "extalt_clkin_ck", "extalt_clkin_ck"),
36 DT_CLK(NULL, "pad_clks_src_ck", "pad_clks_src_ck"),
37 DT_CLK(NULL, "pad_clks_ck", "pad_clks_ck"),
38 DT_CLK(NULL, "pad_slimbus_core_clks_ck", "pad_slimbus_core_clks_ck"),
39 DT_CLK(NULL, "secure_32k_clk_src_ck", "secure_32k_clk_src_ck"),
40 DT_CLK(NULL, "slimbus_src_clk", "slimbus_src_clk"),
41 DT_CLK(NULL, "slimbus_clk", "slimbus_clk"),
42 DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"),
43 DT_CLK(NULL, "virt_12000000_ck", "virt_12000000_ck"),
44 DT_CLK(NULL, "virt_13000000_ck", "virt_13000000_ck"),
45 DT_CLK(NULL, "virt_16800000_ck", "virt_16800000_ck"),
46 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
47 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
48 DT_CLK(NULL, "virt_27000000_ck", "virt_27000000_ck"),
49 DT_CLK(NULL, "virt_38400000_ck", "virt_38400000_ck"),
50 DT_CLK(NULL, "sys_clkin_ck", "sys_clkin_ck"),
51 DT_CLK(NULL, "tie_low_clock_ck", "tie_low_clock_ck"),
52 DT_CLK(NULL, "utmi_phy_clkout_ck", "utmi_phy_clkout_ck"),
53 DT_CLK(NULL, "xclk60mhsp1_ck", "xclk60mhsp1_ck"),
54 DT_CLK(NULL, "xclk60mhsp2_ck", "xclk60mhsp2_ck"),
55 DT_CLK(NULL, "xclk60motg_ck", "xclk60motg_ck"),
56 DT_CLK(NULL, "abe_dpll_bypass_clk_mux_ck", "abe_dpll_bypass_clk_mux_ck"),
57 DT_CLK(NULL, "abe_dpll_refclk_mux_ck", "abe_dpll_refclk_mux_ck"),
58 DT_CLK(NULL, "dpll_abe_ck", "dpll_abe_ck"),
59 DT_CLK(NULL, "dpll_abe_x2_ck", "dpll_abe_x2_ck"),
60 DT_CLK(NULL, "dpll_abe_m2x2_ck", "dpll_abe_m2x2_ck"),
61 DT_CLK(NULL, "abe_24m_fclk", "abe_24m_fclk"),
62 DT_CLK(NULL, "abe_clk", "abe_clk"),
63 DT_CLK(NULL, "aess_fclk", "aess_fclk"),
64 DT_CLK(NULL, "dpll_abe_m3x2_ck", "dpll_abe_m3x2_ck"),
65 DT_CLK(NULL, "core_hsd_byp_clk_mux_ck", "core_hsd_byp_clk_mux_ck"),
66 DT_CLK(NULL, "dpll_core_ck", "dpll_core_ck"),
67 DT_CLK(NULL, "dpll_core_x2_ck", "dpll_core_x2_ck"),
68 DT_CLK(NULL, "dpll_core_m6x2_ck", "dpll_core_m6x2_ck"),
69 DT_CLK(NULL, "dbgclk_mux_ck", "dbgclk_mux_ck"),
70 DT_CLK(NULL, "dpll_core_m2_ck", "dpll_core_m2_ck"),
71 DT_CLK(NULL, "ddrphy_ck", "ddrphy_ck"),
72 DT_CLK(NULL, "dpll_core_m5x2_ck", "dpll_core_m5x2_ck"),
73 DT_CLK(NULL, "div_core_ck", "div_core_ck"),
74 DT_CLK(NULL, "div_iva_hs_clk", "div_iva_hs_clk"),
75 DT_CLK(NULL, "div_mpu_hs_clk", "div_mpu_hs_clk"),
76 DT_CLK(NULL, "dpll_core_m4x2_ck", "dpll_core_m4x2_ck"),
77 DT_CLK(NULL, "dll_clk_div_ck", "dll_clk_div_ck"),
78 DT_CLK(NULL, "dpll_abe_m2_ck", "dpll_abe_m2_ck"),
79 DT_CLK(NULL, "dpll_core_m3x2_ck", "dpll_core_m3x2_ck"),
80 DT_CLK(NULL, "dpll_core_m7x2_ck", "dpll_core_m7x2_ck"),
81 DT_CLK(NULL, "iva_hsd_byp_clk_mux_ck", "iva_hsd_byp_clk_mux_ck"),
82 DT_CLK(NULL, "dpll_iva_ck", "dpll_iva_ck"),
83 DT_CLK(NULL, "dpll_iva_x2_ck", "dpll_iva_x2_ck"),
84 DT_CLK(NULL, "dpll_iva_m4x2_ck", "dpll_iva_m4x2_ck"),
85 DT_CLK(NULL, "dpll_iva_m5x2_ck", "dpll_iva_m5x2_ck"),
86 DT_CLK(NULL, "dpll_mpu_ck", "dpll_mpu_ck"),
87 DT_CLK(NULL, "dpll_mpu_m2_ck", "dpll_mpu_m2_ck"),
88 DT_CLK(NULL, "per_hs_clk_div_ck", "per_hs_clk_div_ck"),
89 DT_CLK(NULL, "per_hsd_byp_clk_mux_ck", "per_hsd_byp_clk_mux_ck"),
90 DT_CLK(NULL, "dpll_per_ck", "dpll_per_ck"),
91 DT_CLK(NULL, "dpll_per_m2_ck", "dpll_per_m2_ck"),
92 DT_CLK(NULL, "dpll_per_x2_ck", "dpll_per_x2_ck"),
93 DT_CLK(NULL, "dpll_per_m2x2_ck", "dpll_per_m2x2_ck"),
94 DT_CLK(NULL, "dpll_per_m3x2_ck", "dpll_per_m3x2_ck"),
95 DT_CLK(NULL, "dpll_per_m4x2_ck", "dpll_per_m4x2_ck"),
96 DT_CLK(NULL, "dpll_per_m5x2_ck", "dpll_per_m5x2_ck"),
97 DT_CLK(NULL, "dpll_per_m6x2_ck", "dpll_per_m6x2_ck"),
98 DT_CLK(NULL, "dpll_per_m7x2_ck", "dpll_per_m7x2_ck"),
99 DT_CLK(NULL, "usb_hs_clk_div_ck", "usb_hs_clk_div_ck"),
100 DT_CLK(NULL, "dpll_usb_ck", "dpll_usb_ck"),
101 DT_CLK(NULL, "dpll_usb_clkdcoldo_ck", "dpll_usb_clkdcoldo_ck"),
102 DT_CLK(NULL, "dpll_usb_m2_ck", "dpll_usb_m2_ck"),
103 DT_CLK(NULL, "ducati_clk_mux_ck", "ducati_clk_mux_ck"),
104 DT_CLK(NULL, "func_12m_fclk", "func_12m_fclk"),
105 DT_CLK(NULL, "func_24m_clk", "func_24m_clk"),
106 DT_CLK(NULL, "func_24mc_fclk", "func_24mc_fclk"),
107 DT_CLK(NULL, "func_48m_fclk", "func_48m_fclk"),
108 DT_CLK(NULL, "func_48mc_fclk", "func_48mc_fclk"),
109 DT_CLK(NULL, "func_64m_fclk", "func_64m_fclk"),
110 DT_CLK(NULL, "func_96m_fclk", "func_96m_fclk"),
111 DT_CLK(NULL, "init_60m_fclk", "init_60m_fclk"),
112 DT_CLK(NULL, "l3_div_ck", "l3_div_ck"),
113 DT_CLK(NULL, "l4_div_ck", "l4_div_ck"),
114 DT_CLK(NULL, "lp_clk_div_ck", "lp_clk_div_ck"),
115 DT_CLK(NULL, "l4_wkup_clk_mux_ck", "l4_wkup_clk_mux_ck"),
116 DT_CLK("smp_twd", NULL, "mpu_periphclk"),
117 DT_CLK(NULL, "ocp_abe_iclk", "ocp_abe_iclk"),
118 DT_CLK(NULL, "per_abe_24m_fclk", "per_abe_24m_fclk"),
119 DT_CLK(NULL, "per_abe_nc_fclk", "per_abe_nc_fclk"),
120 DT_CLK(NULL, "syc_clk_div_ck", "syc_clk_div_ck"),
121 DT_CLK(NULL, "aes1_fck", "aes1_fck"),
122 DT_CLK(NULL, "aes2_fck", "aes2_fck"),
123 DT_CLK(NULL, "dmic_sync_mux_ck", "dmic_sync_mux_ck"),
124 DT_CLK(NULL, "func_dmic_abe_gfclk", "func_dmic_abe_gfclk"),
125 DT_CLK(NULL, "dss_sys_clk", "dss_sys_clk"),
126 DT_CLK(NULL, "dss_tv_clk", "dss_tv_clk"),
127 DT_CLK(NULL, "dss_dss_clk", "dss_dss_clk"),
128 DT_CLK(NULL, "dss_48mhz_clk", "dss_48mhz_clk"),
129 DT_CLK(NULL, "dss_fck", "dss_fck"),
130 DT_CLK("omapdss_dss", "ick", "dss_fck"),
131 DT_CLK(NULL, "fdif_fck", "fdif_fck"),
132 DT_CLK(NULL, "gpio1_dbclk", "gpio1_dbclk"),
133 DT_CLK(NULL, "gpio2_dbclk", "gpio2_dbclk"),
134 DT_CLK(NULL, "gpio3_dbclk", "gpio3_dbclk"),
135 DT_CLK(NULL, "gpio4_dbclk", "gpio4_dbclk"),
136 DT_CLK(NULL, "gpio5_dbclk", "gpio5_dbclk"),
137 DT_CLK(NULL, "gpio6_dbclk", "gpio6_dbclk"),
138 DT_CLK(NULL, "sgx_clk_mux", "sgx_clk_mux"),
139 DT_CLK(NULL, "hsi_fck", "hsi_fck"),
140 DT_CLK(NULL, "iss_ctrlclk", "iss_ctrlclk"),
141 DT_CLK(NULL, "mcasp_sync_mux_ck", "mcasp_sync_mux_ck"),
142 DT_CLK(NULL, "func_mcasp_abe_gfclk", "func_mcasp_abe_gfclk"),
143 DT_CLK(NULL, "mcbsp1_sync_mux_ck", "mcbsp1_sync_mux_ck"),
144 DT_CLK(NULL, "func_mcbsp1_gfclk", "func_mcbsp1_gfclk"),
145 DT_CLK(NULL, "mcbsp2_sync_mux_ck", "mcbsp2_sync_mux_ck"),
146 DT_CLK(NULL, "func_mcbsp2_gfclk", "func_mcbsp2_gfclk"),
147 DT_CLK(NULL, "mcbsp3_sync_mux_ck", "mcbsp3_sync_mux_ck"),
148 DT_CLK(NULL, "func_mcbsp3_gfclk", "func_mcbsp3_gfclk"),
149 DT_CLK(NULL, "mcbsp4_sync_mux_ck", "mcbsp4_sync_mux_ck"),
150 DT_CLK(NULL, "per_mcbsp4_gfclk", "per_mcbsp4_gfclk"),
151 DT_CLK(NULL, "hsmmc1_fclk", "hsmmc1_fclk"),
152 DT_CLK(NULL, "hsmmc2_fclk", "hsmmc2_fclk"),
153 DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "ocp2scp_usb_phy_phy_48m"),
154 DT_CLK(NULL, "sha2md5_fck", "sha2md5_fck"),
155 DT_CLK(NULL, "slimbus1_fclk_1", "slimbus1_fclk_1"),
156 DT_CLK(NULL, "slimbus1_fclk_0", "slimbus1_fclk_0"),
157 DT_CLK(NULL, "slimbus1_fclk_2", "slimbus1_fclk_2"),
158 DT_CLK(NULL, "slimbus1_slimbus_clk", "slimbus1_slimbus_clk"),
159 DT_CLK(NULL, "slimbus2_fclk_1", "slimbus2_fclk_1"),
160 DT_CLK(NULL, "slimbus2_fclk_0", "slimbus2_fclk_0"),
161 DT_CLK(NULL, "slimbus2_slimbus_clk", "slimbus2_slimbus_clk"),
162 DT_CLK(NULL, "smartreflex_core_fck", "smartreflex_core_fck"),
163 DT_CLK(NULL, "smartreflex_iva_fck", "smartreflex_iva_fck"),
164 DT_CLK(NULL, "smartreflex_mpu_fck", "smartreflex_mpu_fck"),
165 DT_CLK(NULL, "dmt1_clk_mux", "dmt1_clk_mux"),
166 DT_CLK(NULL, "cm2_dm10_mux", "cm2_dm10_mux"),
167 DT_CLK(NULL, "cm2_dm11_mux", "cm2_dm11_mux"),
168 DT_CLK(NULL, "cm2_dm2_mux", "cm2_dm2_mux"),
169 DT_CLK(NULL, "cm2_dm3_mux", "cm2_dm3_mux"),
170 DT_CLK(NULL, "cm2_dm4_mux", "cm2_dm4_mux"),
171 DT_CLK(NULL, "timer5_sync_mux", "timer5_sync_mux"),
172 DT_CLK(NULL, "timer6_sync_mux", "timer6_sync_mux"),
173 DT_CLK(NULL, "timer7_sync_mux", "timer7_sync_mux"),
174 DT_CLK(NULL, "timer8_sync_mux", "timer8_sync_mux"),
175 DT_CLK(NULL, "cm2_dm9_mux", "cm2_dm9_mux"),
176 DT_CLK(NULL, "usb_host_fs_fck", "usb_host_fs_fck"),
177 DT_CLK("usbhs_omap", "fs_fck", "usb_host_fs_fck"),
178 DT_CLK(NULL, "utmi_p1_gfclk", "utmi_p1_gfclk"),
179 DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "usb_host_hs_utmi_p1_clk"),
180 DT_CLK(NULL, "utmi_p2_gfclk", "utmi_p2_gfclk"),
181 DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "usb_host_hs_utmi_p2_clk"),
182 DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "usb_host_hs_utmi_p3_clk"),
183 DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "usb_host_hs_hsic480m_p1_clk"),
184 DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "usb_host_hs_hsic60m_p1_clk"),
185 DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "usb_host_hs_hsic60m_p2_clk"),
186 DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "usb_host_hs_hsic480m_p2_clk"),
187 DT_CLK(NULL, "usb_host_hs_func48mclk", "usb_host_hs_func48mclk"),
188 DT_CLK(NULL, "usb_host_hs_fck", "usb_host_hs_fck"),
189 DT_CLK("usbhs_omap", "hs_fck", "usb_host_hs_fck"),
190 DT_CLK(NULL, "otg_60m_gfclk", "otg_60m_gfclk"),
191 DT_CLK(NULL, "usb_otg_hs_xclk", "usb_otg_hs_xclk"),
192 DT_CLK(NULL, "usb_otg_hs_ick", "usb_otg_hs_ick"),
193 DT_CLK("musb-omap2430", "ick", "usb_otg_hs_ick"),
194 DT_CLK(NULL, "usb_phy_cm_clk32k", "usb_phy_cm_clk32k"),
195 DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "usb_tll_hs_usb_ch2_clk"),
196 DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "usb_tll_hs_usb_ch0_clk"),
197 DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "usb_tll_hs_usb_ch1_clk"),
198 DT_CLK(NULL, "usb_tll_hs_ick", "usb_tll_hs_ick"),
199 DT_CLK("usbhs_omap", "usbtll_ick", "usb_tll_hs_ick"),
200 DT_CLK("usbhs_tll", "usbtll_ick", "usb_tll_hs_ick"),
201 DT_CLK(NULL, "usim_ck", "usim_ck"),
202 DT_CLK(NULL, "usim_fclk", "usim_fclk"),
203 DT_CLK(NULL, "pmd_stm_clock_mux_ck", "pmd_stm_clock_mux_ck"),
204 DT_CLK(NULL, "pmd_trace_clk_mux_ck", "pmd_trace_clk_mux_ck"),
205 DT_CLK(NULL, "stm_clk_div_ck", "stm_clk_div_ck"),
206 DT_CLK(NULL, "trace_clk_div_ck", "trace_clk_div_ck"),
207 DT_CLK(NULL, "auxclk0_src_ck", "auxclk0_src_ck"),
208 DT_CLK(NULL, "auxclk0_ck", "auxclk0_ck"),
209 DT_CLK(NULL, "auxclkreq0_ck", "auxclkreq0_ck"),
210 DT_CLK(NULL, "auxclk1_src_ck", "auxclk1_src_ck"),
211 DT_CLK(NULL, "auxclk1_ck", "auxclk1_ck"),
212 DT_CLK(NULL, "auxclkreq1_ck", "auxclkreq1_ck"),
213 DT_CLK(NULL, "auxclk2_src_ck", "auxclk2_src_ck"),
214 DT_CLK(NULL, "auxclk2_ck", "auxclk2_ck"),
215 DT_CLK(NULL, "auxclkreq2_ck", "auxclkreq2_ck"),
216 DT_CLK(NULL, "auxclk3_src_ck", "auxclk3_src_ck"),
217 DT_CLK(NULL, "auxclk3_ck", "auxclk3_ck"),
218 DT_CLK(NULL, "auxclkreq3_ck", "auxclkreq3_ck"),
219 DT_CLK(NULL, "auxclk4_src_ck", "auxclk4_src_ck"),
220 DT_CLK(NULL, "auxclk4_ck", "auxclk4_ck"),
221 DT_CLK(NULL, "auxclkreq4_ck", "auxclkreq4_ck"),
222 DT_CLK(NULL, "auxclk5_src_ck", "auxclk5_src_ck"),
223 DT_CLK(NULL, "auxclk5_ck", "auxclk5_ck"),
224 DT_CLK(NULL, "auxclkreq5_ck", "auxclkreq5_ck"),
225 DT_CLK("50000000.gpmc", "fck", "dummy_ck"),
226 DT_CLK("omap_i2c.1", "ick", "dummy_ck"),
227 DT_CLK("omap_i2c.2", "ick", "dummy_ck"),
228 DT_CLK("omap_i2c.3", "ick", "dummy_ck"),
229 DT_CLK("omap_i2c.4", "ick", "dummy_ck"),
230 DT_CLK(NULL, "mailboxes_ick", "dummy_ck"),
231 DT_CLK("omap_hsmmc.0", "ick", "dummy_ck"),
232 DT_CLK("omap_hsmmc.1", "ick", "dummy_ck"),
233 DT_CLK("omap_hsmmc.2", "ick", "dummy_ck"),
234 DT_CLK("omap_hsmmc.3", "ick", "dummy_ck"),
235 DT_CLK("omap_hsmmc.4", "ick", "dummy_ck"),
236 DT_CLK("omap-mcbsp.1", "ick", "dummy_ck"),
237 DT_CLK("omap-mcbsp.2", "ick", "dummy_ck"),
238 DT_CLK("omap-mcbsp.3", "ick", "dummy_ck"),
239 DT_CLK("omap-mcbsp.4", "ick", "dummy_ck"),
240 DT_CLK("omap2_mcspi.1", "ick", "dummy_ck"),
241 DT_CLK("omap2_mcspi.2", "ick", "dummy_ck"),
242 DT_CLK("omap2_mcspi.3", "ick", "dummy_ck"),
243 DT_CLK("omap2_mcspi.4", "ick", "dummy_ck"),
244 DT_CLK(NULL, "uart1_ick", "dummy_ck"),
245 DT_CLK(NULL, "uart2_ick", "dummy_ck"),
246 DT_CLK(NULL, "uart3_ick", "dummy_ck"),
247 DT_CLK(NULL, "uart4_ick", "dummy_ck"),
248 DT_CLK("usbhs_omap", "usbhost_ick", "dummy_ck"),
249 DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"),
250 DT_CLK("usbhs_tll", "usbtll_fck", "dummy_ck"),
251 DT_CLK("omap_wdt", "ick", "dummy_ck"),
252 DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"),
253 DT_CLK("omap_timer.1", "timer_sys_ck", "sys_clkin_ck"),
254 DT_CLK("omap_timer.2", "timer_sys_ck", "sys_clkin_ck"),
255 DT_CLK("omap_timer.3", "timer_sys_ck", "sys_clkin_ck"),
256 DT_CLK("omap_timer.4", "timer_sys_ck", "sys_clkin_ck"),
257 DT_CLK("omap_timer.9", "timer_sys_ck", "sys_clkin_ck"),
258 DT_CLK("omap_timer.10", "timer_sys_ck", "sys_clkin_ck"),
259 DT_CLK("omap_timer.11", "timer_sys_ck", "sys_clkin_ck"),
260 DT_CLK("omap_timer.5", "timer_sys_ck", "syc_clk_div_ck"),
261 DT_CLK("omap_timer.6", "timer_sys_ck", "syc_clk_div_ck"),
262 DT_CLK("omap_timer.7", "timer_sys_ck", "syc_clk_div_ck"),
263 DT_CLK("omap_timer.8", "timer_sys_ck", "syc_clk_div_ck"),
264 DT_CLK("4a318000.timer", "timer_sys_ck", "sys_clkin_ck"),
265 DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin_ck"),
266 DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin_ck"),
267 DT_CLK("48036000.timer", "timer_sys_ck", "sys_clkin_ck"),
268 DT_CLK("4803e000.timer", "timer_sys_ck", "sys_clkin_ck"),
269 DT_CLK("48086000.timer", "timer_sys_ck", "sys_clkin_ck"),
270 DT_CLK("48088000.timer", "timer_sys_ck", "sys_clkin_ck"),
271 DT_CLK("40138000.timer", "timer_sys_ck", "syc_clk_div_ck"),
272 DT_CLK("4013a000.timer", "timer_sys_ck", "syc_clk_div_ck"),
273 DT_CLK("4013c000.timer", "timer_sys_ck", "syc_clk_div_ck"),
274 DT_CLK("4013e000.timer", "timer_sys_ck", "syc_clk_div_ck"),
275 DT_CLK(NULL, "cpufreq_ck", "dpll_mpu_ck"),
276 DT_CLK(NULL, "bandgap_fclk", "bandgap_fclk"),
277 DT_CLK(NULL, "div_ts_ck", "div_ts_ck"),
278 DT_CLK(NULL, "bandgap_ts_fclk", "bandgap_ts_fclk"),
279 { .node_name = NULL },
280};
281
282int __init omap4xxx_dt_clk_init(void)
283{
284 int rc;
285 struct clk *abe_dpll_ref, *abe_dpll, *sys_32k_ck, *usb_dpll;
286
287 ti_dt_clocks_register(omap44xx_clks);
288
289 omap2_clk_disable_autoidle_all();
290
291 /*
292 * Lock USB DPLL on OMAP4 devices so that the L3INIT power
293 * domain can transition to retention state when not in use.
294 */
295 usb_dpll = clk_get_sys(NULL, "dpll_usb_ck");
296 rc = clk_set_rate(usb_dpll, OMAP4_DPLL_USB_DEFFREQ);
297 if (rc)
298 pr_err("%s: failed to configure USB DPLL!\n", __func__);
299
300 /*
301 * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power
302 * state when turning the ABE clock domain. Workaround this by
303 * locking the ABE DPLL on boot.
304 * Lock the ABE DPLL in any case to avoid issues with audio.
305 */
306 abe_dpll_ref = clk_get_sys(NULL, "abe_dpll_refclk_mux_ck");
307 sys_32k_ck = clk_get_sys(NULL, "sys_32k_ck");
308 rc = clk_set_parent(abe_dpll_ref, sys_32k_ck);
309 abe_dpll = clk_get_sys(NULL, "dpll_abe_ck");
310 if (!rc)
311 rc = clk_set_rate(abe_dpll, OMAP4_DPLL_ABE_DEFFREQ);
312 if (rc)
313 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
314
315 return 0;
316}
diff --git a/drivers/clk/ti/clk-54xx.c b/drivers/clk/ti/clk-54xx.c
new file mode 100644
index 000000000000..0ef9f581286b
--- /dev/null
+++ b/drivers/clk/ti/clk-54xx.c
@@ -0,0 +1,255 @@
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-private.h>
16#include <linux/clkdev.h>
17#include <linux/io.h>
18#include <linux/clk/ti.h>
19
20#define OMAP5_DPLL_ABE_DEFFREQ 98304000
21
22/*
23 * OMAP543x TRM, section "3.6.3.9.5 DPLL_USB Preferred Settings"
24 * states it must be at 960MHz
25 */
26#define OMAP5_DPLL_USB_DEFFREQ 960000000
27
28static struct ti_dt_clk omap54xx_clks[] = {
29 DT_CLK(NULL, "pad_clks_src_ck", "pad_clks_src_ck"),
30 DT_CLK(NULL, "pad_clks_ck", "pad_clks_ck"),
31 DT_CLK(NULL, "secure_32k_clk_src_ck", "secure_32k_clk_src_ck"),
32 DT_CLK(NULL, "slimbus_src_clk", "slimbus_src_clk"),
33 DT_CLK(NULL, "slimbus_clk", "slimbus_clk"),
34 DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"),
35 DT_CLK(NULL, "virt_12000000_ck", "virt_12000000_ck"),
36 DT_CLK(NULL, "virt_13000000_ck", "virt_13000000_ck"),
37 DT_CLK(NULL, "virt_16800000_ck", "virt_16800000_ck"),
38 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
39 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
40 DT_CLK(NULL, "virt_27000000_ck", "virt_27000000_ck"),
41 DT_CLK(NULL, "virt_38400000_ck", "virt_38400000_ck"),
42 DT_CLK(NULL, "sys_clkin", "sys_clkin"),
43 DT_CLK(NULL, "xclk60mhsp1_ck", "xclk60mhsp1_ck"),
44 DT_CLK(NULL, "xclk60mhsp2_ck", "xclk60mhsp2_ck"),
45 DT_CLK(NULL, "abe_dpll_bypass_clk_mux", "abe_dpll_bypass_clk_mux"),
46 DT_CLK(NULL, "abe_dpll_clk_mux", "abe_dpll_clk_mux"),
47 DT_CLK(NULL, "dpll_abe_ck", "dpll_abe_ck"),
48 DT_CLK(NULL, "dpll_abe_x2_ck", "dpll_abe_x2_ck"),
49 DT_CLK(NULL, "dpll_abe_m2x2_ck", "dpll_abe_m2x2_ck"),
50 DT_CLK(NULL, "abe_24m_fclk", "abe_24m_fclk"),
51 DT_CLK(NULL, "abe_clk", "abe_clk"),
52 DT_CLK(NULL, "abe_iclk", "abe_iclk"),
53 DT_CLK(NULL, "abe_lp_clk_div", "abe_lp_clk_div"),
54 DT_CLK(NULL, "dpll_abe_m3x2_ck", "dpll_abe_m3x2_ck"),
55 DT_CLK(NULL, "dpll_core_ck", "dpll_core_ck"),
56 DT_CLK(NULL, "dpll_core_x2_ck", "dpll_core_x2_ck"),
57 DT_CLK(NULL, "dpll_core_h21x2_ck", "dpll_core_h21x2_ck"),
58 DT_CLK(NULL, "c2c_fclk", "c2c_fclk"),
59 DT_CLK(NULL, "c2c_iclk", "c2c_iclk"),
60 DT_CLK(NULL, "custefuse_sys_gfclk_div", "custefuse_sys_gfclk_div"),
61 DT_CLK(NULL, "dpll_core_h11x2_ck", "dpll_core_h11x2_ck"),
62 DT_CLK(NULL, "dpll_core_h12x2_ck", "dpll_core_h12x2_ck"),
63 DT_CLK(NULL, "dpll_core_h13x2_ck", "dpll_core_h13x2_ck"),
64 DT_CLK(NULL, "dpll_core_h14x2_ck", "dpll_core_h14x2_ck"),
65 DT_CLK(NULL, "dpll_core_h22x2_ck", "dpll_core_h22x2_ck"),
66 DT_CLK(NULL, "dpll_core_h23x2_ck", "dpll_core_h23x2_ck"),
67 DT_CLK(NULL, "dpll_core_h24x2_ck", "dpll_core_h24x2_ck"),
68 DT_CLK(NULL, "dpll_core_m2_ck", "dpll_core_m2_ck"),
69 DT_CLK(NULL, "dpll_core_m3x2_ck", "dpll_core_m3x2_ck"),
70 DT_CLK(NULL, "iva_dpll_hs_clk_div", "iva_dpll_hs_clk_div"),
71 DT_CLK(NULL, "dpll_iva_ck", "dpll_iva_ck"),
72 DT_CLK(NULL, "dpll_iva_x2_ck", "dpll_iva_x2_ck"),
73 DT_CLK(NULL, "dpll_iva_h11x2_ck", "dpll_iva_h11x2_ck"),
74 DT_CLK(NULL, "dpll_iva_h12x2_ck", "dpll_iva_h12x2_ck"),
75 DT_CLK(NULL, "mpu_dpll_hs_clk_div", "mpu_dpll_hs_clk_div"),
76 DT_CLK(NULL, "dpll_mpu_ck", "dpll_mpu_ck"),
77 DT_CLK(NULL, "dpll_mpu_m2_ck", "dpll_mpu_m2_ck"),
78 DT_CLK(NULL, "per_dpll_hs_clk_div", "per_dpll_hs_clk_div"),
79 DT_CLK(NULL, "dpll_per_ck", "dpll_per_ck"),
80 DT_CLK(NULL, "dpll_per_x2_ck", "dpll_per_x2_ck"),
81 DT_CLK(NULL, "dpll_per_h11x2_ck", "dpll_per_h11x2_ck"),
82 DT_CLK(NULL, "dpll_per_h12x2_ck", "dpll_per_h12x2_ck"),
83 DT_CLK(NULL, "dpll_per_h14x2_ck", "dpll_per_h14x2_ck"),
84 DT_CLK(NULL, "dpll_per_m2_ck", "dpll_per_m2_ck"),
85 DT_CLK(NULL, "dpll_per_m2x2_ck", "dpll_per_m2x2_ck"),
86 DT_CLK(NULL, "dpll_per_m3x2_ck", "dpll_per_m3x2_ck"),
87 DT_CLK(NULL, "dpll_unipro1_ck", "dpll_unipro1_ck"),
88 DT_CLK(NULL, "dpll_unipro1_clkdcoldo", "dpll_unipro1_clkdcoldo"),
89 DT_CLK(NULL, "dpll_unipro1_m2_ck", "dpll_unipro1_m2_ck"),
90 DT_CLK(NULL, "dpll_unipro2_ck", "dpll_unipro2_ck"),
91 DT_CLK(NULL, "dpll_unipro2_clkdcoldo", "dpll_unipro2_clkdcoldo"),
92 DT_CLK(NULL, "dpll_unipro2_m2_ck", "dpll_unipro2_m2_ck"),
93 DT_CLK(NULL, "usb_dpll_hs_clk_div", "usb_dpll_hs_clk_div"),
94 DT_CLK(NULL, "dpll_usb_ck", "dpll_usb_ck"),
95 DT_CLK(NULL, "dpll_usb_clkdcoldo", "dpll_usb_clkdcoldo"),
96 DT_CLK(NULL, "dpll_usb_m2_ck", "dpll_usb_m2_ck"),
97 DT_CLK(NULL, "dss_syc_gfclk_div", "dss_syc_gfclk_div"),
98 DT_CLK(NULL, "func_128m_clk", "func_128m_clk"),
99 DT_CLK(NULL, "func_12m_fclk", "func_12m_fclk"),
100 DT_CLK(NULL, "func_24m_clk", "func_24m_clk"),
101 DT_CLK(NULL, "func_48m_fclk", "func_48m_fclk"),
102 DT_CLK(NULL, "func_96m_fclk", "func_96m_fclk"),
103 DT_CLK(NULL, "l3_iclk_div", "l3_iclk_div"),
104 DT_CLK(NULL, "gpu_l3_iclk", "gpu_l3_iclk"),
105 DT_CLK(NULL, "l3init_60m_fclk", "l3init_60m_fclk"),
106 DT_CLK(NULL, "wkupaon_iclk_mux", "wkupaon_iclk_mux"),
107 DT_CLK(NULL, "l3instr_ts_gclk_div", "l3instr_ts_gclk_div"),
108 DT_CLK(NULL, "l4_root_clk_div", "l4_root_clk_div"),
109 DT_CLK(NULL, "dss_32khz_clk", "dss_32khz_clk"),
110 DT_CLK(NULL, "dss_48mhz_clk", "dss_48mhz_clk"),
111 DT_CLK(NULL, "dss_dss_clk", "dss_dss_clk"),
112 DT_CLK(NULL, "dss_sys_clk", "dss_sys_clk"),
113 DT_CLK(NULL, "gpio1_dbclk", "gpio1_dbclk"),
114 DT_CLK(NULL, "gpio2_dbclk", "gpio2_dbclk"),
115 DT_CLK(NULL, "gpio3_dbclk", "gpio3_dbclk"),
116 DT_CLK(NULL, "gpio4_dbclk", "gpio4_dbclk"),
117 DT_CLK(NULL, "gpio5_dbclk", "gpio5_dbclk"),
118 DT_CLK(NULL, "gpio6_dbclk", "gpio6_dbclk"),
119 DT_CLK(NULL, "gpio7_dbclk", "gpio7_dbclk"),
120 DT_CLK(NULL, "gpio8_dbclk", "gpio8_dbclk"),
121 DT_CLK(NULL, "iss_ctrlclk", "iss_ctrlclk"),
122 DT_CLK(NULL, "lli_txphy_clk", "lli_txphy_clk"),
123 DT_CLK(NULL, "lli_txphy_ls_clk", "lli_txphy_ls_clk"),
124 DT_CLK(NULL, "mmc1_32khz_clk", "mmc1_32khz_clk"),
125 DT_CLK(NULL, "sata_ref_clk", "sata_ref_clk"),
126 DT_CLK(NULL, "slimbus1_slimbus_clk", "slimbus1_slimbus_clk"),
127 DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "usb_host_hs_hsic480m_p1_clk"),
128 DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "usb_host_hs_hsic480m_p2_clk"),
129 DT_CLK(NULL, "usb_host_hs_hsic480m_p3_clk", "usb_host_hs_hsic480m_p3_clk"),
130 DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "usb_host_hs_hsic60m_p1_clk"),
131 DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "usb_host_hs_hsic60m_p2_clk"),
132 DT_CLK(NULL, "usb_host_hs_hsic60m_p3_clk", "usb_host_hs_hsic60m_p3_clk"),
133 DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "usb_host_hs_utmi_p1_clk"),
134 DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "usb_host_hs_utmi_p2_clk"),
135 DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "usb_host_hs_utmi_p3_clk"),
136 DT_CLK(NULL, "usb_otg_ss_refclk960m", "usb_otg_ss_refclk960m"),
137 DT_CLK(NULL, "usb_phy_cm_clk32k", "usb_phy_cm_clk32k"),
138 DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "usb_tll_hs_usb_ch0_clk"),
139 DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "usb_tll_hs_usb_ch1_clk"),
140 DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "usb_tll_hs_usb_ch2_clk"),
141 DT_CLK(NULL, "aess_fclk", "aess_fclk"),
142 DT_CLK(NULL, "dmic_sync_mux_ck", "dmic_sync_mux_ck"),
143 DT_CLK(NULL, "dmic_gfclk", "dmic_gfclk"),
144 DT_CLK(NULL, "fdif_fclk", "fdif_fclk"),
145 DT_CLK(NULL, "gpu_core_gclk_mux", "gpu_core_gclk_mux"),
146 DT_CLK(NULL, "gpu_hyd_gclk_mux", "gpu_hyd_gclk_mux"),
147 DT_CLK(NULL, "hsi_fclk", "hsi_fclk"),
148 DT_CLK(NULL, "mcasp_sync_mux_ck", "mcasp_sync_mux_ck"),
149 DT_CLK(NULL, "mcasp_gfclk", "mcasp_gfclk"),
150 DT_CLK(NULL, "mcbsp1_sync_mux_ck", "mcbsp1_sync_mux_ck"),
151 DT_CLK(NULL, "mcbsp1_gfclk", "mcbsp1_gfclk"),
152 DT_CLK(NULL, "mcbsp2_sync_mux_ck", "mcbsp2_sync_mux_ck"),
153 DT_CLK(NULL, "mcbsp2_gfclk", "mcbsp2_gfclk"),
154 DT_CLK(NULL, "mcbsp3_sync_mux_ck", "mcbsp3_sync_mux_ck"),
155 DT_CLK(NULL, "mcbsp3_gfclk", "mcbsp3_gfclk"),
156 DT_CLK(NULL, "mmc1_fclk_mux", "mmc1_fclk_mux"),
157 DT_CLK(NULL, "mmc1_fclk", "mmc1_fclk"),
158 DT_CLK(NULL, "mmc2_fclk_mux", "mmc2_fclk_mux"),
159 DT_CLK(NULL, "mmc2_fclk", "mmc2_fclk"),
160 DT_CLK(NULL, "timer10_gfclk_mux", "timer10_gfclk_mux"),
161 DT_CLK(NULL, "timer11_gfclk_mux", "timer11_gfclk_mux"),
162 DT_CLK(NULL, "timer1_gfclk_mux", "timer1_gfclk_mux"),
163 DT_CLK(NULL, "timer2_gfclk_mux", "timer2_gfclk_mux"),
164 DT_CLK(NULL, "timer3_gfclk_mux", "timer3_gfclk_mux"),
165 DT_CLK(NULL, "timer4_gfclk_mux", "timer4_gfclk_mux"),
166 DT_CLK(NULL, "timer5_gfclk_mux", "timer5_gfclk_mux"),
167 DT_CLK(NULL, "timer6_gfclk_mux", "timer6_gfclk_mux"),
168 DT_CLK(NULL, "timer7_gfclk_mux", "timer7_gfclk_mux"),
169 DT_CLK(NULL, "timer8_gfclk_mux", "timer8_gfclk_mux"),
170 DT_CLK(NULL, "timer9_gfclk_mux", "timer9_gfclk_mux"),
171 DT_CLK(NULL, "utmi_p1_gfclk", "utmi_p1_gfclk"),
172 DT_CLK(NULL, "utmi_p2_gfclk", "utmi_p2_gfclk"),
173 DT_CLK(NULL, "auxclk0_src_ck", "auxclk0_src_ck"),
174 DT_CLK(NULL, "auxclk0_ck", "auxclk0_ck"),
175 DT_CLK(NULL, "auxclkreq0_ck", "auxclkreq0_ck"),
176 DT_CLK(NULL, "auxclk1_src_ck", "auxclk1_src_ck"),
177 DT_CLK(NULL, "auxclk1_ck", "auxclk1_ck"),
178 DT_CLK(NULL, "auxclkreq1_ck", "auxclkreq1_ck"),
179 DT_CLK(NULL, "auxclk2_src_ck", "auxclk2_src_ck"),
180 DT_CLK(NULL, "auxclk2_ck", "auxclk2_ck"),
181 DT_CLK(NULL, "auxclkreq2_ck", "auxclkreq2_ck"),
182 DT_CLK(NULL, "auxclk3_src_ck", "auxclk3_src_ck"),
183 DT_CLK(NULL, "auxclk3_ck", "auxclk3_ck"),
184 DT_CLK(NULL, "auxclkreq3_ck", "auxclkreq3_ck"),
185 DT_CLK(NULL, "gpmc_ck", "dummy_ck"),
186 DT_CLK("omap_i2c.1", "ick", "dummy_ck"),
187 DT_CLK("omap_i2c.2", "ick", "dummy_ck"),
188 DT_CLK("omap_i2c.3", "ick", "dummy_ck"),
189 DT_CLK("omap_i2c.4", "ick", "dummy_ck"),
190 DT_CLK(NULL, "mailboxes_ick", "dummy_ck"),
191 DT_CLK("omap_hsmmc.0", "ick", "dummy_ck"),
192 DT_CLK("omap_hsmmc.1", "ick", "dummy_ck"),
193 DT_CLK("omap_hsmmc.2", "ick", "dummy_ck"),
194 DT_CLK("omap_hsmmc.3", "ick", "dummy_ck"),
195 DT_CLK("omap_hsmmc.4", "ick", "dummy_ck"),
196 DT_CLK("omap-mcbsp.1", "ick", "dummy_ck"),
197 DT_CLK("omap-mcbsp.2", "ick", "dummy_ck"),
198 DT_CLK("omap-mcbsp.3", "ick", "dummy_ck"),
199 DT_CLK("omap-mcbsp.4", "ick", "dummy_ck"),
200 DT_CLK("omap2_mcspi.1", "ick", "dummy_ck"),
201 DT_CLK("omap2_mcspi.2", "ick", "dummy_ck"),
202 DT_CLK("omap2_mcspi.3", "ick", "dummy_ck"),
203 DT_CLK("omap2_mcspi.4", "ick", "dummy_ck"),
204 DT_CLK(NULL, "uart1_ick", "dummy_ck"),
205 DT_CLK(NULL, "uart2_ick", "dummy_ck"),
206 DT_CLK(NULL, "uart3_ick", "dummy_ck"),
207 DT_CLK(NULL, "uart4_ick", "dummy_ck"),
208 DT_CLK("usbhs_omap", "usbhost_ick", "dummy_ck"),
209 DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"),
210 DT_CLK("omap_wdt", "ick", "dummy_ck"),
211 DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"),
212 DT_CLK("omap_timer.1", "sys_ck", "sys_clkin"),
213 DT_CLK("omap_timer.2", "sys_ck", "sys_clkin"),
214 DT_CLK("omap_timer.3", "sys_ck", "sys_clkin"),
215 DT_CLK("omap_timer.4", "sys_ck", "sys_clkin"),
216 DT_CLK("omap_timer.9", "sys_ck", "sys_clkin"),
217 DT_CLK("omap_timer.10", "sys_ck", "sys_clkin"),
218 DT_CLK("omap_timer.11", "sys_ck", "sys_clkin"),
219 DT_CLK("omap_timer.5", "sys_ck", "dss_syc_gfclk_div"),
220 DT_CLK("omap_timer.6", "sys_ck", "dss_syc_gfclk_div"),
221 DT_CLK("omap_timer.7", "sys_ck", "dss_syc_gfclk_div"),
222 DT_CLK("omap_timer.8", "sys_ck", "dss_syc_gfclk_div"),
223 { .node_name = NULL },
224};
225
226int __init omap5xxx_dt_clk_init(void)
227{
228 int rc;
229 struct clk *abe_dpll_ref, *abe_dpll, *sys_32k_ck, *usb_dpll;
230
231 ti_dt_clocks_register(omap54xx_clks);
232
233 omap2_clk_disable_autoidle_all();
234
235 abe_dpll_ref = clk_get_sys(NULL, "abe_dpll_clk_mux");
236 sys_32k_ck = clk_get_sys(NULL, "sys_32k_ck");
237 rc = clk_set_parent(abe_dpll_ref, sys_32k_ck);
238 abe_dpll = clk_get_sys(NULL, "dpll_abe_ck");
239 if (!rc)
240 rc = clk_set_rate(abe_dpll, OMAP5_DPLL_ABE_DEFFREQ);
241 if (rc)
242 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
243
244 usb_dpll = clk_get_sys(NULL, "dpll_usb_ck");
245 rc = clk_set_rate(usb_dpll, OMAP5_DPLL_USB_DEFFREQ);
246 if (rc)
247 pr_err("%s: failed to configure USB DPLL!\n", __func__);
248
249 usb_dpll = clk_get_sys(NULL, "dpll_usb_m2_ck");
250 rc = clk_set_rate(usb_dpll, OMAP5_DPLL_USB_DEFFREQ/2);
251 if (rc)
252 pr_err("%s: failed to set USB_DPLL M2 OUT\n", __func__);
253
254 return 0;
255}
diff --git a/drivers/clk/ti/clk-7xx.c b/drivers/clk/ti/clk-7xx.c
new file mode 100644
index 000000000000..9977653f2d63
--- /dev/null
+++ b/drivers/clk/ti/clk-7xx.c
@@ -0,0 +1,332 @@
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-private.h>
16#include <linux/clkdev.h>
17#include <linux/clk/ti.h>
18
19#define DRA7_DPLL_ABE_DEFFREQ 361267200
20#define DRA7_DPLL_GMAC_DEFFREQ 1000000000
21
22
23static struct ti_dt_clk dra7xx_clks[] = {
24 DT_CLK(NULL, "atl_clkin0_ck", "atl_clkin0_ck"),
25 DT_CLK(NULL, "atl_clkin1_ck", "atl_clkin1_ck"),
26 DT_CLK(NULL, "atl_clkin2_ck", "atl_clkin2_ck"),
27 DT_CLK(NULL, "atlclkin3_ck", "atlclkin3_ck"),
28 DT_CLK(NULL, "hdmi_clkin_ck", "hdmi_clkin_ck"),
29 DT_CLK(NULL, "mlb_clkin_ck", "mlb_clkin_ck"),
30 DT_CLK(NULL, "mlbp_clkin_ck", "mlbp_clkin_ck"),
31 DT_CLK(NULL, "pciesref_acs_clk_ck", "pciesref_acs_clk_ck"),
32 DT_CLK(NULL, "ref_clkin0_ck", "ref_clkin0_ck"),
33 DT_CLK(NULL, "ref_clkin1_ck", "ref_clkin1_ck"),
34 DT_CLK(NULL, "ref_clkin2_ck", "ref_clkin2_ck"),
35 DT_CLK(NULL, "ref_clkin3_ck", "ref_clkin3_ck"),
36 DT_CLK(NULL, "rmii_clk_ck", "rmii_clk_ck"),
37 DT_CLK(NULL, "sdvenc_clkin_ck", "sdvenc_clkin_ck"),
38 DT_CLK(NULL, "secure_32k_clk_src_ck", "secure_32k_clk_src_ck"),
39 DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"),
40 DT_CLK(NULL, "virt_12000000_ck", "virt_12000000_ck"),
41 DT_CLK(NULL, "virt_13000000_ck", "virt_13000000_ck"),
42 DT_CLK(NULL, "virt_16800000_ck", "virt_16800000_ck"),
43 DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
44 DT_CLK(NULL, "virt_20000000_ck", "virt_20000000_ck"),
45 DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
46 DT_CLK(NULL, "virt_27000000_ck", "virt_27000000_ck"),
47 DT_CLK(NULL, "virt_38400000_ck", "virt_38400000_ck"),
48 DT_CLK(NULL, "sys_clkin1", "sys_clkin1"),
49 DT_CLK(NULL, "sys_clkin2", "sys_clkin2"),
50 DT_CLK(NULL, "usb_otg_clkin_ck", "usb_otg_clkin_ck"),
51 DT_CLK(NULL, "video1_clkin_ck", "video1_clkin_ck"),
52 DT_CLK(NULL, "video1_m2_clkin_ck", "video1_m2_clkin_ck"),
53 DT_CLK(NULL, "video2_clkin_ck", "video2_clkin_ck"),
54 DT_CLK(NULL, "video2_m2_clkin_ck", "video2_m2_clkin_ck"),
55 DT_CLK(NULL, "abe_dpll_sys_clk_mux", "abe_dpll_sys_clk_mux"),
56 DT_CLK(NULL, "abe_dpll_bypass_clk_mux", "abe_dpll_bypass_clk_mux"),
57 DT_CLK(NULL, "abe_dpll_clk_mux", "abe_dpll_clk_mux"),
58 DT_CLK(NULL, "dpll_abe_ck", "dpll_abe_ck"),
59 DT_CLK(NULL, "dpll_abe_x2_ck", "dpll_abe_x2_ck"),
60 DT_CLK(NULL, "dpll_abe_m2x2_ck", "dpll_abe_m2x2_ck"),
61 DT_CLK(NULL, "abe_24m_fclk", "abe_24m_fclk"),
62 DT_CLK(NULL, "abe_clk", "abe_clk"),
63 DT_CLK(NULL, "aess_fclk", "aess_fclk"),
64 DT_CLK(NULL, "abe_giclk_div", "abe_giclk_div"),
65 DT_CLK(NULL, "abe_lp_clk_div", "abe_lp_clk_div"),
66 DT_CLK(NULL, "abe_sys_clk_div", "abe_sys_clk_div"),
67 DT_CLK(NULL, "adc_gfclk_mux", "adc_gfclk_mux"),
68 DT_CLK(NULL, "dpll_pcie_ref_ck", "dpll_pcie_ref_ck"),
69 DT_CLK(NULL, "dpll_pcie_ref_m2ldo_ck", "dpll_pcie_ref_m2ldo_ck"),
70 DT_CLK(NULL, "apll_pcie_ck", "apll_pcie_ck"),
71 DT_CLK(NULL, "apll_pcie_clkvcoldo", "apll_pcie_clkvcoldo"),
72 DT_CLK(NULL, "apll_pcie_clkvcoldo_div", "apll_pcie_clkvcoldo_div"),
73 DT_CLK(NULL, "apll_pcie_m2_ck", "apll_pcie_m2_ck"),
74 DT_CLK(NULL, "sys_clk1_dclk_div", "sys_clk1_dclk_div"),
75 DT_CLK(NULL, "sys_clk2_dclk_div", "sys_clk2_dclk_div"),
76 DT_CLK(NULL, "dpll_abe_m2_ck", "dpll_abe_m2_ck"),
77 DT_CLK(NULL, "per_abe_x1_dclk_div", "per_abe_x1_dclk_div"),
78 DT_CLK(NULL, "dpll_abe_m3x2_ck", "dpll_abe_m3x2_ck"),
79 DT_CLK(NULL, "dpll_core_ck", "dpll_core_ck"),
80 DT_CLK(NULL, "dpll_core_x2_ck", "dpll_core_x2_ck"),
81 DT_CLK(NULL, "dpll_core_h12x2_ck", "dpll_core_h12x2_ck"),
82 DT_CLK(NULL, "mpu_dpll_hs_clk_div", "mpu_dpll_hs_clk_div"),
83 DT_CLK(NULL, "dpll_mpu_ck", "dpll_mpu_ck"),
84 DT_CLK(NULL, "dpll_mpu_m2_ck", "dpll_mpu_m2_ck"),
85 DT_CLK(NULL, "mpu_dclk_div", "mpu_dclk_div"),
86 DT_CLK(NULL, "dsp_dpll_hs_clk_div", "dsp_dpll_hs_clk_div"),
87 DT_CLK(NULL, "dpll_dsp_ck", "dpll_dsp_ck"),
88 DT_CLK(NULL, "dpll_dsp_m2_ck", "dpll_dsp_m2_ck"),
89 DT_CLK(NULL, "dsp_gclk_div", "dsp_gclk_div"),
90 DT_CLK(NULL, "iva_dpll_hs_clk_div", "iva_dpll_hs_clk_div"),
91 DT_CLK(NULL, "dpll_iva_ck", "dpll_iva_ck"),
92 DT_CLK(NULL, "dpll_iva_m2_ck", "dpll_iva_m2_ck"),
93 DT_CLK(NULL, "iva_dclk", "iva_dclk"),
94 DT_CLK(NULL, "dpll_gpu_ck", "dpll_gpu_ck"),
95 DT_CLK(NULL, "dpll_gpu_m2_ck", "dpll_gpu_m2_ck"),
96 DT_CLK(NULL, "gpu_dclk", "gpu_dclk"),
97 DT_CLK(NULL, "dpll_core_m2_ck", "dpll_core_m2_ck"),
98 DT_CLK(NULL, "core_dpll_out_dclk_div", "core_dpll_out_dclk_div"),
99 DT_CLK(NULL, "dpll_ddr_ck", "dpll_ddr_ck"),
100 DT_CLK(NULL, "dpll_ddr_m2_ck", "dpll_ddr_m2_ck"),
101 DT_CLK(NULL, "emif_phy_dclk_div", "emif_phy_dclk_div"),
102 DT_CLK(NULL, "dpll_gmac_ck", "dpll_gmac_ck"),
103 DT_CLK(NULL, "dpll_gmac_m2_ck", "dpll_gmac_m2_ck"),
104 DT_CLK(NULL, "gmac_250m_dclk_div", "gmac_250m_dclk_div"),
105 DT_CLK(NULL, "video2_dclk_div", "video2_dclk_div"),
106 DT_CLK(NULL, "video1_dclk_div", "video1_dclk_div"),
107 DT_CLK(NULL, "hdmi_dclk_div", "hdmi_dclk_div"),
108 DT_CLK(NULL, "per_dpll_hs_clk_div", "per_dpll_hs_clk_div"),
109 DT_CLK(NULL, "dpll_per_ck", "dpll_per_ck"),
110 DT_CLK(NULL, "dpll_per_m2_ck", "dpll_per_m2_ck"),
111 DT_CLK(NULL, "func_96m_aon_dclk_div", "func_96m_aon_dclk_div"),
112 DT_CLK(NULL, "usb_dpll_hs_clk_div", "usb_dpll_hs_clk_div"),
113 DT_CLK(NULL, "dpll_usb_ck", "dpll_usb_ck"),
114 DT_CLK(NULL, "dpll_usb_m2_ck", "dpll_usb_m2_ck"),
115 DT_CLK(NULL, "l3init_480m_dclk_div", "l3init_480m_dclk_div"),
116 DT_CLK(NULL, "usb_otg_dclk_div", "usb_otg_dclk_div"),
117 DT_CLK(NULL, "sata_dclk_div", "sata_dclk_div"),
118 DT_CLK(NULL, "dpll_pcie_ref_m2_ck", "dpll_pcie_ref_m2_ck"),
119 DT_CLK(NULL, "pcie2_dclk_div", "pcie2_dclk_div"),
120 DT_CLK(NULL, "pcie_dclk_div", "pcie_dclk_div"),
121 DT_CLK(NULL, "emu_dclk_div", "emu_dclk_div"),
122 DT_CLK(NULL, "secure_32k_dclk_div", "secure_32k_dclk_div"),
123 DT_CLK(NULL, "eve_dpll_hs_clk_div", "eve_dpll_hs_clk_div"),
124 DT_CLK(NULL, "dpll_eve_ck", "dpll_eve_ck"),
125 DT_CLK(NULL, "dpll_eve_m2_ck", "dpll_eve_m2_ck"),
126 DT_CLK(NULL, "eve_dclk_div", "eve_dclk_div"),
127 DT_CLK(NULL, "clkoutmux0_clk_mux", "clkoutmux0_clk_mux"),
128 DT_CLK(NULL, "clkoutmux1_clk_mux", "clkoutmux1_clk_mux"),
129 DT_CLK(NULL, "clkoutmux2_clk_mux", "clkoutmux2_clk_mux"),
130 DT_CLK(NULL, "custefuse_sys_gfclk_div", "custefuse_sys_gfclk_div"),
131 DT_CLK(NULL, "dpll_core_h13x2_ck", "dpll_core_h13x2_ck"),
132 DT_CLK(NULL, "dpll_core_h14x2_ck", "dpll_core_h14x2_ck"),
133 DT_CLK(NULL, "dpll_core_h22x2_ck", "dpll_core_h22x2_ck"),
134 DT_CLK(NULL, "dpll_core_h23x2_ck", "dpll_core_h23x2_ck"),
135 DT_CLK(NULL, "dpll_core_h24x2_ck", "dpll_core_h24x2_ck"),
136 DT_CLK(NULL, "dpll_ddr_x2_ck", "dpll_ddr_x2_ck"),
137 DT_CLK(NULL, "dpll_ddr_h11x2_ck", "dpll_ddr_h11x2_ck"),
138 DT_CLK(NULL, "dpll_dsp_x2_ck", "dpll_dsp_x2_ck"),
139 DT_CLK(NULL, "dpll_dsp_m3x2_ck", "dpll_dsp_m3x2_ck"),
140 DT_CLK(NULL, "dpll_gmac_x2_ck", "dpll_gmac_x2_ck"),
141 DT_CLK(NULL, "dpll_gmac_h11x2_ck", "dpll_gmac_h11x2_ck"),
142 DT_CLK(NULL, "dpll_gmac_h12x2_ck", "dpll_gmac_h12x2_ck"),
143 DT_CLK(NULL, "dpll_gmac_h13x2_ck", "dpll_gmac_h13x2_ck"),
144 DT_CLK(NULL, "dpll_gmac_m3x2_ck", "dpll_gmac_m3x2_ck"),
145 DT_CLK(NULL, "dpll_per_x2_ck", "dpll_per_x2_ck"),
146 DT_CLK(NULL, "dpll_per_h11x2_ck", "dpll_per_h11x2_ck"),
147 DT_CLK(NULL, "dpll_per_h12x2_ck", "dpll_per_h12x2_ck"),
148 DT_CLK(NULL, "dpll_per_h13x2_ck", "dpll_per_h13x2_ck"),
149 DT_CLK(NULL, "dpll_per_h14x2_ck", "dpll_per_h14x2_ck"),
150 DT_CLK(NULL, "dpll_per_m2x2_ck", "dpll_per_m2x2_ck"),
151 DT_CLK(NULL, "dpll_usb_clkdcoldo", "dpll_usb_clkdcoldo"),
152 DT_CLK(NULL, "eve_clk", "eve_clk"),
153 DT_CLK(NULL, "func_128m_clk", "func_128m_clk"),
154 DT_CLK(NULL, "func_12m_fclk", "func_12m_fclk"),
155 DT_CLK(NULL, "func_24m_clk", "func_24m_clk"),
156 DT_CLK(NULL, "func_48m_fclk", "func_48m_fclk"),
157 DT_CLK(NULL, "func_96m_fclk", "func_96m_fclk"),
158 DT_CLK(NULL, "gmii_m_clk_div", "gmii_m_clk_div"),
159 DT_CLK(NULL, "hdmi_clk2_div", "hdmi_clk2_div"),
160 DT_CLK(NULL, "hdmi_div_clk", "hdmi_div_clk"),
161 DT_CLK(NULL, "hdmi_dpll_clk_mux", "hdmi_dpll_clk_mux"),
162 DT_CLK(NULL, "l3_iclk_div", "l3_iclk_div"),
163 DT_CLK(NULL, "l3init_60m_fclk", "l3init_60m_fclk"),
164 DT_CLK(NULL, "l4_root_clk_div", "l4_root_clk_div"),
165 DT_CLK(NULL, "mlb_clk", "mlb_clk"),
166 DT_CLK(NULL, "mlbp_clk", "mlbp_clk"),
167 DT_CLK(NULL, "per_abe_x1_gfclk2_div", "per_abe_x1_gfclk2_div"),
168 DT_CLK(NULL, "timer_sys_clk_div", "timer_sys_clk_div"),
169 DT_CLK(NULL, "video1_clk2_div", "video1_clk2_div"),
170 DT_CLK(NULL, "video1_div_clk", "video1_div_clk"),
171 DT_CLK(NULL, "video1_dpll_clk_mux", "video1_dpll_clk_mux"),
172 DT_CLK(NULL, "video2_clk2_div", "video2_clk2_div"),
173 DT_CLK(NULL, "video2_div_clk", "video2_div_clk"),
174 DT_CLK(NULL, "video2_dpll_clk_mux", "video2_dpll_clk_mux"),
175 DT_CLK(NULL, "wkupaon_iclk_mux", "wkupaon_iclk_mux"),
176 DT_CLK(NULL, "dss_32khz_clk", "dss_32khz_clk"),
177 DT_CLK(NULL, "dss_48mhz_clk", "dss_48mhz_clk"),
178 DT_CLK(NULL, "dss_dss_clk", "dss_dss_clk"),
179 DT_CLK(NULL, "dss_hdmi_clk", "dss_hdmi_clk"),
180 DT_CLK(NULL, "dss_video1_clk", "dss_video1_clk"),
181 DT_CLK(NULL, "dss_video2_clk", "dss_video2_clk"),
182 DT_CLK(NULL, "gpio1_dbclk", "gpio1_dbclk"),
183 DT_CLK(NULL, "gpio2_dbclk", "gpio2_dbclk"),
184 DT_CLK(NULL, "gpio3_dbclk", "gpio3_dbclk"),
185 DT_CLK(NULL, "gpio4_dbclk", "gpio4_dbclk"),
186 DT_CLK(NULL, "gpio5_dbclk", "gpio5_dbclk"),
187 DT_CLK(NULL, "gpio6_dbclk", "gpio6_dbclk"),
188 DT_CLK(NULL, "gpio7_dbclk", "gpio7_dbclk"),
189 DT_CLK(NULL, "gpio8_dbclk", "gpio8_dbclk"),
190 DT_CLK(NULL, "mmc1_clk32k", "mmc1_clk32k"),
191 DT_CLK(NULL, "mmc2_clk32k", "mmc2_clk32k"),
192 DT_CLK(NULL, "mmc3_clk32k", "mmc3_clk32k"),
193 DT_CLK(NULL, "mmc4_clk32k", "mmc4_clk32k"),
194 DT_CLK(NULL, "sata_ref_clk", "sata_ref_clk"),
195 DT_CLK(NULL, "usb_otg_ss1_refclk960m", "usb_otg_ss1_refclk960m"),
196 DT_CLK(NULL, "usb_otg_ss2_refclk960m", "usb_otg_ss2_refclk960m"),
197 DT_CLK(NULL, "usb_phy1_always_on_clk32k", "usb_phy1_always_on_clk32k"),
198 DT_CLK(NULL, "usb_phy2_always_on_clk32k", "usb_phy2_always_on_clk32k"),
199 DT_CLK(NULL, "usb_phy3_always_on_clk32k", "usb_phy3_always_on_clk32k"),
200 DT_CLK(NULL, "atl_dpll_clk_mux", "atl_dpll_clk_mux"),
201 DT_CLK(NULL, "atl_gfclk_mux", "atl_gfclk_mux"),
202 DT_CLK(NULL, "dcan1_sys_clk_mux", "dcan1_sys_clk_mux"),
203 DT_CLK(NULL, "gmac_gmii_ref_clk_div", "gmac_gmii_ref_clk_div"),
204 DT_CLK(NULL, "gmac_rft_clk_mux", "gmac_rft_clk_mux"),
205 DT_CLK(NULL, "gpu_core_gclk_mux", "gpu_core_gclk_mux"),
206 DT_CLK(NULL, "gpu_hyd_gclk_mux", "gpu_hyd_gclk_mux"),
207 DT_CLK(NULL, "ipu1_gfclk_mux", "ipu1_gfclk_mux"),
208 DT_CLK(NULL, "l3instr_ts_gclk_div", "l3instr_ts_gclk_div"),
209 DT_CLK(NULL, "mcasp1_ahclkr_mux", "mcasp1_ahclkr_mux"),
210 DT_CLK(NULL, "mcasp1_ahclkx_mux", "mcasp1_ahclkx_mux"),
211 DT_CLK(NULL, "mcasp1_aux_gfclk_mux", "mcasp1_aux_gfclk_mux"),
212 DT_CLK(NULL, "mcasp2_ahclkr_mux", "mcasp2_ahclkr_mux"),
213 DT_CLK(NULL, "mcasp2_ahclkx_mux", "mcasp2_ahclkx_mux"),
214 DT_CLK(NULL, "mcasp2_aux_gfclk_mux", "mcasp2_aux_gfclk_mux"),
215 DT_CLK(NULL, "mcasp3_ahclkx_mux", "mcasp3_ahclkx_mux"),
216 DT_CLK(NULL, "mcasp3_aux_gfclk_mux", "mcasp3_aux_gfclk_mux"),
217 DT_CLK(NULL, "mcasp4_ahclkx_mux", "mcasp4_ahclkx_mux"),
218 DT_CLK(NULL, "mcasp4_aux_gfclk_mux", "mcasp4_aux_gfclk_mux"),
219 DT_CLK(NULL, "mcasp5_ahclkx_mux", "mcasp5_ahclkx_mux"),
220 DT_CLK(NULL, "mcasp5_aux_gfclk_mux", "mcasp5_aux_gfclk_mux"),
221 DT_CLK(NULL, "mcasp6_ahclkx_mux", "mcasp6_ahclkx_mux"),
222 DT_CLK(NULL, "mcasp6_aux_gfclk_mux", "mcasp6_aux_gfclk_mux"),
223 DT_CLK(NULL, "mcasp7_ahclkx_mux", "mcasp7_ahclkx_mux"),
224 DT_CLK(NULL, "mcasp7_aux_gfclk_mux", "mcasp7_aux_gfclk_mux"),
225 DT_CLK(NULL, "mcasp8_ahclk_mux", "mcasp8_ahclk_mux"),
226 DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "mcasp8_aux_gfclk_mux"),
227 DT_CLK(NULL, "mmc1_fclk_mux", "mmc1_fclk_mux"),
228 DT_CLK(NULL, "mmc1_fclk_div", "mmc1_fclk_div"),
229 DT_CLK(NULL, "mmc2_fclk_mux", "mmc2_fclk_mux"),
230 DT_CLK(NULL, "mmc2_fclk_div", "mmc2_fclk_div"),
231 DT_CLK(NULL, "mmc3_gfclk_mux", "mmc3_gfclk_mux"),
232 DT_CLK(NULL, "mmc3_gfclk_div", "mmc3_gfclk_div"),
233 DT_CLK(NULL, "mmc4_gfclk_mux", "mmc4_gfclk_mux"),
234 DT_CLK(NULL, "mmc4_gfclk_div", "mmc4_gfclk_div"),
235 DT_CLK(NULL, "qspi_gfclk_mux", "qspi_gfclk_mux"),
236 DT_CLK(NULL, "qspi_gfclk_div", "qspi_gfclk_div"),
237 DT_CLK(NULL, "timer10_gfclk_mux", "timer10_gfclk_mux"),
238 DT_CLK(NULL, "timer11_gfclk_mux", "timer11_gfclk_mux"),
239 DT_CLK(NULL, "timer13_gfclk_mux", "timer13_gfclk_mux"),
240 DT_CLK(NULL, "timer14_gfclk_mux", "timer14_gfclk_mux"),
241 DT_CLK(NULL, "timer15_gfclk_mux", "timer15_gfclk_mux"),
242 DT_CLK(NULL, "timer16_gfclk_mux", "timer16_gfclk_mux"),
243 DT_CLK(NULL, "timer1_gfclk_mux", "timer1_gfclk_mux"),
244 DT_CLK(NULL, "timer2_gfclk_mux", "timer2_gfclk_mux"),
245 DT_CLK(NULL, "timer3_gfclk_mux", "timer3_gfclk_mux"),
246 DT_CLK(NULL, "timer4_gfclk_mux", "timer4_gfclk_mux"),
247 DT_CLK(NULL, "timer5_gfclk_mux", "timer5_gfclk_mux"),
248 DT_CLK(NULL, "timer6_gfclk_mux", "timer6_gfclk_mux"),
249 DT_CLK(NULL, "timer7_gfclk_mux", "timer7_gfclk_mux"),
250 DT_CLK(NULL, "timer8_gfclk_mux", "timer8_gfclk_mux"),
251 DT_CLK(NULL, "timer9_gfclk_mux", "timer9_gfclk_mux"),
252 DT_CLK(NULL, "uart10_gfclk_mux", "uart10_gfclk_mux"),
253 DT_CLK(NULL, "uart1_gfclk_mux", "uart1_gfclk_mux"),
254 DT_CLK(NULL, "uart2_gfclk_mux", "uart2_gfclk_mux"),
255 DT_CLK(NULL, "uart3_gfclk_mux", "uart3_gfclk_mux"),
256 DT_CLK(NULL, "uart4_gfclk_mux", "uart4_gfclk_mux"),
257 DT_CLK(NULL, "uart5_gfclk_mux", "uart5_gfclk_mux"),
258 DT_CLK(NULL, "uart6_gfclk_mux", "uart6_gfclk_mux"),
259 DT_CLK(NULL, "uart7_gfclk_mux", "uart7_gfclk_mux"),
260 DT_CLK(NULL, "uart8_gfclk_mux", "uart8_gfclk_mux"),
261 DT_CLK(NULL, "uart9_gfclk_mux", "uart9_gfclk_mux"),
262 DT_CLK(NULL, "vip1_gclk_mux", "vip1_gclk_mux"),
263 DT_CLK(NULL, "vip2_gclk_mux", "vip2_gclk_mux"),
264 DT_CLK(NULL, "vip3_gclk_mux", "vip3_gclk_mux"),
265 DT_CLK(NULL, "gpmc_ck", "dummy_ck"),
266 DT_CLK("omap_i2c.1", "ick", "dummy_ck"),
267 DT_CLK("omap_i2c.2", "ick", "dummy_ck"),
268 DT_CLK("omap_i2c.3", "ick", "dummy_ck"),
269 DT_CLK("omap_i2c.4", "ick", "dummy_ck"),
270 DT_CLK(NULL, "mailboxes_ick", "dummy_ck"),
271 DT_CLK("omap_hsmmc.0", "ick", "dummy_ck"),
272 DT_CLK("omap_hsmmc.1", "ick", "dummy_ck"),
273 DT_CLK("omap_hsmmc.2", "ick", "dummy_ck"),
274 DT_CLK("omap_hsmmc.3", "ick", "dummy_ck"),
275 DT_CLK("omap_hsmmc.4", "ick", "dummy_ck"),
276 DT_CLK("omap-mcbsp.1", "ick", "dummy_ck"),
277 DT_CLK("omap-mcbsp.2", "ick", "dummy_ck"),
278 DT_CLK("omap-mcbsp.3", "ick", "dummy_ck"),
279 DT_CLK("omap-mcbsp.4", "ick", "dummy_ck"),
280 DT_CLK("omap2_mcspi.1", "ick", "dummy_ck"),
281 DT_CLK("omap2_mcspi.2", "ick", "dummy_ck"),
282 DT_CLK("omap2_mcspi.3", "ick", "dummy_ck"),
283 DT_CLK("omap2_mcspi.4", "ick", "dummy_ck"),
284 DT_CLK(NULL, "uart1_ick", "dummy_ck"),
285 DT_CLK(NULL, "uart2_ick", "dummy_ck"),
286 DT_CLK(NULL, "uart3_ick", "dummy_ck"),
287 DT_CLK(NULL, "uart4_ick", "dummy_ck"),
288 DT_CLK("usbhs_omap", "usbhost_ick", "dummy_ck"),
289 DT_CLK("usbhs_omap", "usbtll_fck", "dummy_ck"),
290 DT_CLK("omap_wdt", "ick", "dummy_ck"),
291 DT_CLK(NULL, "timer_32k_ck", "sys_32k_ck"),
292 DT_CLK("4ae18000.timer", "timer_sys_ck", "sys_clkin2"),
293 DT_CLK("48032000.timer", "timer_sys_ck", "sys_clkin2"),
294 DT_CLK("48034000.timer", "timer_sys_ck", "sys_clkin2"),
295 DT_CLK("48036000.timer", "timer_sys_ck", "sys_clkin2"),
296 DT_CLK("4803e000.timer", "timer_sys_ck", "sys_clkin2"),
297 DT_CLK("48086000.timer", "timer_sys_ck", "sys_clkin2"),
298 DT_CLK("48088000.timer", "timer_sys_ck", "sys_clkin2"),
299 DT_CLK("48820000.timer", "timer_sys_ck", "timer_sys_clk_div"),
300 DT_CLK("48822000.timer", "timer_sys_ck", "timer_sys_clk_div"),
301 DT_CLK("48824000.timer", "timer_sys_ck", "timer_sys_clk_div"),
302 DT_CLK("48826000.timer", "timer_sys_ck", "timer_sys_clk_div"),
303 DT_CLK(NULL, "sys_clkin", "sys_clkin1"),
304 { .node_name = NULL },
305};
306
307int __init dra7xx_dt_clk_init(void)
308{
309 int rc;
310 struct clk *abe_dpll_mux, *sys_clkin2, *dpll_ck;
311
312 ti_dt_clocks_register(dra7xx_clks);
313
314 omap2_clk_disable_autoidle_all();
315
316 abe_dpll_mux = clk_get_sys(NULL, "abe_dpll_sys_clk_mux");
317 sys_clkin2 = clk_get_sys(NULL, "sys_clkin2");
318 dpll_ck = clk_get_sys(NULL, "dpll_abe_ck");
319
320 rc = clk_set_parent(abe_dpll_mux, sys_clkin2);
321 if (!rc)
322 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ);
323 if (rc)
324 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
325
326 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck");
327 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ);
328 if (rc)
329 pr_err("%s: failed to configure GMAC DPLL!\n", __func__);
330
331 return rc;
332}
diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
new file mode 100644
index 000000000000..b1a6f7144f3f
--- /dev/null
+++ b/drivers/clk/ti/clk.c
@@ -0,0 +1,167 @@
1/*
2 * TI clock support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/clkdev.h>
20#include <linux/clk/ti.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/list.h>
24
25#undef pr_fmt
26#define pr_fmt(fmt) "%s: " fmt, __func__
27
28static int ti_dt_clk_memmap_index;
29struct ti_clk_ll_ops *ti_clk_ll_ops;
30
31/**
32 * ti_dt_clocks_register - register DT alias clocks during boot
33 * @oclks: list of clocks to register
34 *
35 * Register alias or non-standard DT clock entries during boot. By
36 * default, DT clocks are found based on their node name. If any
37 * additional con-id / dev-id -> clock mapping is required, use this
38 * function to list these.
39 */
40void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
41{
42 struct ti_dt_clk *c;
43 struct device_node *node;
44 struct clk *clk;
45 struct of_phandle_args clkspec;
46
47 for (c = oclks; c->node_name != NULL; c++) {
48 node = of_find_node_by_name(NULL, c->node_name);
49 clkspec.np = node;
50 clk = of_clk_get_from_provider(&clkspec);
51
52 if (!IS_ERR(clk)) {
53 c->lk.clk = clk;
54 clkdev_add(&c->lk);
55 } else {
56 pr_warn("failed to lookup clock node %s\n",
57 c->node_name);
58 }
59 }
60}
61
62struct clk_init_item {
63 struct device_node *node;
64 struct clk_hw *hw;
65 ti_of_clk_init_cb_t func;
66 struct list_head link;
67};
68
69static LIST_HEAD(retry_list);
70
71/**
72 * ti_clk_retry_init - retries a failed clock init at later phase
73 * @node: device not for the clock
74 * @hw: partially initialized clk_hw struct for the clock
75 * @func: init function to be called for the clock
76 *
77 * Adds a failed clock init to the retry list. The retry list is parsed
78 * once all the other clocks have been initialized.
79 */
80int __init ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
81 ti_of_clk_init_cb_t func)
82{
83 struct clk_init_item *retry;
84
85 pr_debug("%s: adding to retry list...\n", node->name);
86 retry = kzalloc(sizeof(*retry), GFP_KERNEL);
87 if (!retry)
88 return -ENOMEM;
89
90 retry->node = node;
91 retry->func = func;
92 retry->hw = hw;
93 list_add(&retry->link, &retry_list);
94
95 return 0;
96}
97
98/**
99 * ti_clk_get_reg_addr - get register address for a clock register
100 * @node: device node for the clock
101 * @index: register index from the clock node
102 *
103 * Builds clock register address from device tree information. This
104 * is a struct of type clk_omap_reg.
105 */
106void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index)
107{
108 struct clk_omap_reg *reg;
109 u32 val;
110 u32 tmp;
111
112 reg = (struct clk_omap_reg *)&tmp;
113 reg->index = ti_dt_clk_memmap_index;
114
115 if (of_property_read_u32_index(node, "reg", index, &val)) {
116 pr_err("%s must have reg[%d]!\n", node->name, index);
117 return NULL;
118 }
119
120 reg->offset = val;
121
122 return (void __iomem *)tmp;
123}
124
125/**
126 * ti_dt_clk_init_provider - init master clock provider
127 * @parent: master node
128 * @index: internal index for clk_reg_ops
129 *
130 * Initializes a master clock IP block and its child clock nodes.
131 * Regmap is provided for accessing the register space for the
132 * IP block and all the clocks under it.
133 */
134void ti_dt_clk_init_provider(struct device_node *parent, int index)
135{
136 const struct of_device_id *match;
137 struct device_node *np;
138 struct device_node *clocks;
139 of_clk_init_cb_t clk_init_cb;
140 struct clk_init_item *retry;
141 struct clk_init_item *tmp;
142
143 ti_dt_clk_memmap_index = index;
144
145 /* get clocks for this parent */
146 clocks = of_get_child_by_name(parent, "clocks");
147 if (!clocks) {
148 pr_err("%s missing 'clocks' child node.\n", parent->name);
149 return;
150 }
151
152 for_each_child_of_node(clocks, np) {
153 match = of_match_node(&__clk_of_table, np);
154 if (!match)
155 continue;
156 clk_init_cb = (of_clk_init_cb_t)match->data;
157 pr_debug("%s: initializing: %s\n", __func__, np->name);
158 clk_init_cb(np);
159 }
160
161 list_for_each_entry_safe(retry, tmp, &retry_list, link) {
162 pr_debug("retry-init: %s\n", retry->node->name);
163 retry->func(retry->hw, retry->node);
164 list_del(&retry->link);
165 kfree(retry);
166 }
167}
diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
new file mode 100644
index 000000000000..f1e0038d76ac
--- /dev/null
+++ b/drivers/clk/ti/clockdomain.c
@@ -0,0 +1,70 @@
1/*
2 * OMAP clockdomain support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/clk/ti.h>
23
24#undef pr_fmt
25#define pr_fmt(fmt) "%s: " fmt, __func__
26
27static void __init of_ti_clockdomain_setup(struct device_node *node)
28{
29 struct clk *clk;
30 struct clk_hw *clk_hw;
31 const char *clkdm_name = node->name;
32 int i;
33 int num_clks;
34
35 num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells");
36
37 for (i = 0; i < num_clks; i++) {
38 clk = of_clk_get(node, i);
39 if (__clk_get_flags(clk) & CLK_IS_BASIC) {
40 pr_warn("can't setup clkdm for basic clk %s\n",
41 __clk_get_name(clk));
42 continue;
43 }
44 clk_hw = __clk_get_hw(clk);
45 to_clk_hw_omap(clk_hw)->clkdm_name = clkdm_name;
46 omap2_init_clk_clkdm(clk_hw);
47 }
48}
49
50static struct of_device_id ti_clkdm_match_table[] __initdata = {
51 { .compatible = "ti,clockdomain" },
52 { }
53};
54
55/**
56 * ti_dt_clockdomains_setup - setup device tree clockdomains
57 *
58 * Initializes clockdomain nodes for a SoC. This parses through all the
59 * nodes with compatible = "ti,clockdomain", and add the clockdomain
60 * info for all the clocks listed under these. This function shall be
61 * called after rest of the DT clock init has completed and all
62 * clock nodes have been registered.
63 */
64void __init ti_dt_clockdomains_setup(void)
65{
66 struct device_node *np;
67 for_each_matching_node(np, ti_clkdm_match_table) {
68 of_ti_clockdomain_setup(np);
69 }
70}
diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c
new file mode 100644
index 000000000000..19d8980ba458
--- /dev/null
+++ b/drivers/clk/ti/composite.c
@@ -0,0 +1,269 @@
1/*
2 * TI composite clock support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/io.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24#include <linux/list.h>
25
26#undef pr_fmt
27#define pr_fmt(fmt) "%s: " fmt, __func__
28
29#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
30
31static unsigned long ti_composite_recalc_rate(struct clk_hw *hw,
32 unsigned long parent_rate)
33{
34 return ti_clk_divider_ops.recalc_rate(hw, parent_rate);
35}
36
37static long ti_composite_round_rate(struct clk_hw *hw, unsigned long rate,
38 unsigned long *prate)
39{
40 return -EINVAL;
41}
42
43static int ti_composite_set_rate(struct clk_hw *hw, unsigned long rate,
44 unsigned long parent_rate)
45{
46 return -EINVAL;
47}
48
49static const struct clk_ops ti_composite_divider_ops = {
50 .recalc_rate = &ti_composite_recalc_rate,
51 .round_rate = &ti_composite_round_rate,
52 .set_rate = &ti_composite_set_rate,
53};
54
55static const struct clk_ops ti_composite_gate_ops = {
56 .enable = &omap2_dflt_clk_enable,
57 .disable = &omap2_dflt_clk_disable,
58 .is_enabled = &omap2_dflt_clk_is_enabled,
59};
60
61struct component_clk {
62 int num_parents;
63 const char **parent_names;
64 struct device_node *node;
65 int type;
66 struct clk_hw *hw;
67 struct list_head link;
68};
69
70static const char * __initconst component_clk_types[] = {
71 "gate", "divider", "mux"
72};
73
74static LIST_HEAD(component_clks);
75
76static struct device_node *_get_component_node(struct device_node *node, int i)
77{
78 int rc;
79 struct of_phandle_args clkspec;
80
81 rc = of_parse_phandle_with_args(node, "clocks", "#clock-cells", i,
82 &clkspec);
83 if (rc)
84 return NULL;
85
86 return clkspec.np;
87}
88
89static struct component_clk *_lookup_component(struct device_node *node)
90{
91 struct component_clk *comp;
92
93 list_for_each_entry(comp, &component_clks, link) {
94 if (comp->node == node)
95 return comp;
96 }
97 return NULL;
98}
99
100struct clk_hw_omap_comp {
101 struct clk_hw hw;
102 struct device_node *comp_nodes[CLK_COMPONENT_TYPE_MAX];
103 struct component_clk *comp_clks[CLK_COMPONENT_TYPE_MAX];
104};
105
106static inline struct clk_hw *_get_hw(struct clk_hw_omap_comp *clk, int idx)
107{
108 if (!clk)
109 return NULL;
110
111 if (!clk->comp_clks[idx])
112 return NULL;
113
114 return clk->comp_clks[idx]->hw;
115}
116
117#define to_clk_hw_comp(_hw) container_of(_hw, struct clk_hw_omap_comp, hw)
118
119static void __init ti_clk_register_composite(struct clk_hw *hw,
120 struct device_node *node)
121{
122 struct clk *clk;
123 struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw);
124 struct component_clk *comp;
125 int num_parents = 0;
126 const char **parent_names = NULL;
127 int i;
128
129 /* Check for presence of each component clock */
130 for (i = 0; i < CLK_COMPONENT_TYPE_MAX; i++) {
131 if (!cclk->comp_nodes[i])
132 continue;
133
134 comp = _lookup_component(cclk->comp_nodes[i]);
135 if (!comp) {
136 pr_debug("component %s not ready for %s, retry\n",
137 cclk->comp_nodes[i]->name, node->name);
138 if (!ti_clk_retry_init(node, hw,
139 ti_clk_register_composite))
140 return;
141
142 goto cleanup;
143 }
144 if (cclk->comp_clks[comp->type] != NULL) {
145 pr_err("duplicate component types for %s (%s)!\n",
146 node->name, component_clk_types[comp->type]);
147 goto cleanup;
148 }
149
150 cclk->comp_clks[comp->type] = comp;
151
152 /* Mark this node as found */
153 cclk->comp_nodes[i] = NULL;
154 }
155
156 /* All components exists, proceed with registration */
157 for (i = CLK_COMPONENT_TYPE_MAX - 1; i >= 0; i--) {
158 comp = cclk->comp_clks[i];
159 if (!comp)
160 continue;
161 if (comp->num_parents) {
162 num_parents = comp->num_parents;
163 parent_names = comp->parent_names;
164 break;
165 }
166 }
167
168 if (!num_parents) {
169 pr_err("%s: no parents found for %s!\n", __func__, node->name);
170 goto cleanup;
171 }
172
173 clk = clk_register_composite(NULL, node->name,
174 parent_names, num_parents,
175 _get_hw(cclk, CLK_COMPONENT_TYPE_MUX),
176 &ti_clk_mux_ops,
177 _get_hw(cclk, CLK_COMPONENT_TYPE_DIVIDER),
178 &ti_composite_divider_ops,
179 _get_hw(cclk, CLK_COMPONENT_TYPE_GATE),
180 &ti_composite_gate_ops, 0);
181
182 if (!IS_ERR(clk))
183 of_clk_add_provider(node, of_clk_src_simple_get, clk);
184
185cleanup:
186 /* Free component clock list entries */
187 for (i = 0; i < CLK_COMPONENT_TYPE_MAX; i++) {
188 if (!cclk->comp_clks[i])
189 continue;
190 list_del(&cclk->comp_clks[i]->link);
191 kfree(cclk->comp_clks[i]);
192 }
193
194 kfree(cclk);
195}
196
197static void __init of_ti_composite_clk_setup(struct device_node *node)
198{
199 int num_clks;
200 int i;
201 struct clk_hw_omap_comp *cclk;
202
203 /* Number of component clocks to be put inside this clock */
204 num_clks = of_clk_get_parent_count(node);
205
206 if (num_clks < 1) {
207 pr_err("composite clk %s must have component(s)\n", node->name);
208 return;
209 }
210
211 cclk = kzalloc(sizeof(*cclk), GFP_KERNEL);
212 if (!cclk)
213 return;
214
215 /* Get device node pointers for each component clock */
216 for (i = 0; i < num_clks; i++)
217 cclk->comp_nodes[i] = _get_component_node(node, i);
218
219 ti_clk_register_composite(&cclk->hw, node);
220}
221CLK_OF_DECLARE(ti_composite_clock, "ti,composite-clock",
222 of_ti_composite_clk_setup);
223
224/**
225 * ti_clk_add_component - add a component clock to the pool
226 * @node: device node of the component clock
227 * @hw: hardware clock definition for the component clock
228 * @type: type of the component clock
229 *
230 * Adds a component clock to the list of available components, so that
231 * it can be registered by a composite clock.
232 */
233int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
234 int type)
235{
236 int num_parents;
237 const char **parent_names;
238 struct component_clk *clk;
239 int i;
240
241 num_parents = of_clk_get_parent_count(node);
242
243 if (num_parents < 1) {
244 pr_err("component-clock %s must have parent(s)\n", node->name);
245 return -EINVAL;
246 }
247
248 parent_names = kzalloc((sizeof(char *) * num_parents), GFP_KERNEL);
249 if (!parent_names)
250 return -ENOMEM;
251
252 for (i = 0; i < num_parents; i++)
253 parent_names[i] = of_clk_get_parent_name(node, i);
254
255 clk = kzalloc(sizeof(*clk), GFP_KERNEL);
256 if (!clk) {
257 kfree(parent_names);
258 return -ENOMEM;
259 }
260
261 clk->num_parents = num_parents;
262 clk->parent_names = parent_names;
263 clk->hw = hw;
264 clk->node = node;
265 clk->type = type;
266 list_add(&clk->link, &component_clks);
267
268 return 0;
269}
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c
new file mode 100644
index 000000000000..a15e445570b2
--- /dev/null
+++ b/drivers/clk/ti/divider.c
@@ -0,0 +1,487 @@
1/*
2 * TI Divider Clock
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25#undef pr_fmt
26#define pr_fmt(fmt) "%s: " fmt, __func__
27
28#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
29
30#define div_mask(d) ((1 << ((d)->width)) - 1)
31
32static unsigned int _get_table_maxdiv(const struct clk_div_table *table)
33{
34 unsigned int maxdiv = 0;
35 const struct clk_div_table *clkt;
36
37 for (clkt = table; clkt->div; clkt++)
38 if (clkt->div > maxdiv)
39 maxdiv = clkt->div;
40 return maxdiv;
41}
42
43static unsigned int _get_maxdiv(struct clk_divider *divider)
44{
45 if (divider->flags & CLK_DIVIDER_ONE_BASED)
46 return div_mask(divider);
47 if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
48 return 1 << div_mask(divider);
49 if (divider->table)
50 return _get_table_maxdiv(divider->table);
51 return div_mask(divider) + 1;
52}
53
54static unsigned int _get_table_div(const struct clk_div_table *table,
55 unsigned int val)
56{
57 const struct clk_div_table *clkt;
58
59 for (clkt = table; clkt->div; clkt++)
60 if (clkt->val == val)
61 return clkt->div;
62 return 0;
63}
64
65static unsigned int _get_div(struct clk_divider *divider, unsigned int val)
66{
67 if (divider->flags & CLK_DIVIDER_ONE_BASED)
68 return val;
69 if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
70 return 1 << val;
71 if (divider->table)
72 return _get_table_div(divider->table, val);
73 return val + 1;
74}
75
76static unsigned int _get_table_val(const struct clk_div_table *table,
77 unsigned int div)
78{
79 const struct clk_div_table *clkt;
80
81 for (clkt = table; clkt->div; clkt++)
82 if (clkt->div == div)
83 return clkt->val;
84 return 0;
85}
86
87static unsigned int _get_val(struct clk_divider *divider, u8 div)
88{
89 if (divider->flags & CLK_DIVIDER_ONE_BASED)
90 return div;
91 if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
92 return __ffs(div);
93 if (divider->table)
94 return _get_table_val(divider->table, div);
95 return div - 1;
96}
97
98static unsigned long ti_clk_divider_recalc_rate(struct clk_hw *hw,
99 unsigned long parent_rate)
100{
101 struct clk_divider *divider = to_clk_divider(hw);
102 unsigned int div, val;
103
104 val = ti_clk_ll_ops->clk_readl(divider->reg) >> divider->shift;
105 val &= div_mask(divider);
106
107 div = _get_div(divider, val);
108 if (!div) {
109 WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO),
110 "%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n",
111 __clk_get_name(hw->clk));
112 return parent_rate;
113 }
114
115 return parent_rate / div;
116}
117
118/*
119 * The reverse of DIV_ROUND_UP: The maximum number which
120 * divided by m is r
121 */
122#define MULT_ROUND_UP(r, m) ((r) * (m) + (m) - 1)
123
124static bool _is_valid_table_div(const struct clk_div_table *table,
125 unsigned int div)
126{
127 const struct clk_div_table *clkt;
128
129 for (clkt = table; clkt->div; clkt++)
130 if (clkt->div == div)
131 return true;
132 return false;
133}
134
135static bool _is_valid_div(struct clk_divider *divider, unsigned int div)
136{
137 if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
138 return is_power_of_2(div);
139 if (divider->table)
140 return _is_valid_table_div(divider->table, div);
141 return true;
142}
143
144static int ti_clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
145 unsigned long *best_parent_rate)
146{
147 struct clk_divider *divider = to_clk_divider(hw);
148 int i, bestdiv = 0;
149 unsigned long parent_rate, best = 0, now, maxdiv;
150 unsigned long parent_rate_saved = *best_parent_rate;
151
152 if (!rate)
153 rate = 1;
154
155 maxdiv = _get_maxdiv(divider);
156
157 if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) {
158 parent_rate = *best_parent_rate;
159 bestdiv = DIV_ROUND_UP(parent_rate, rate);
160 bestdiv = bestdiv == 0 ? 1 : bestdiv;
161 bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv;
162 return bestdiv;
163 }
164
165 /*
166 * The maximum divider we can use without overflowing
167 * unsigned long in rate * i below
168 */
169 maxdiv = min(ULONG_MAX / rate, maxdiv);
170
171 for (i = 1; i <= maxdiv; i++) {
172 if (!_is_valid_div(divider, i))
173 continue;
174 if (rate * i == parent_rate_saved) {
175 /*
176 * It's the most ideal case if the requested rate can be
177 * divided from parent clock without needing to change
178 * parent rate, so return the divider immediately.
179 */
180 *best_parent_rate = parent_rate_saved;
181 return i;
182 }
183 parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
184 MULT_ROUND_UP(rate, i));
185 now = parent_rate / i;
186 if (now <= rate && now > best) {
187 bestdiv = i;
188 best = now;
189 *best_parent_rate = parent_rate;
190 }
191 }
192
193 if (!bestdiv) {
194 bestdiv = _get_maxdiv(divider);
195 *best_parent_rate =
196 __clk_round_rate(__clk_get_parent(hw->clk), 1);
197 }
198
199 return bestdiv;
200}
201
202static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
203 unsigned long *prate)
204{
205 int div;
206 div = ti_clk_divider_bestdiv(hw, rate, prate);
207
208 return *prate / div;
209}
210
211static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
212 unsigned long parent_rate)
213{
214 struct clk_divider *divider = to_clk_divider(hw);
215 unsigned int div, value;
216 unsigned long flags = 0;
217 u32 val;
218
219 div = parent_rate / rate;
220 value = _get_val(divider, div);
221
222 if (value > div_mask(divider))
223 value = div_mask(divider);
224
225 if (divider->lock)
226 spin_lock_irqsave(divider->lock, flags);
227
228 if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
229 val = div_mask(divider) << (divider->shift + 16);
230 } else {
231 val = ti_clk_ll_ops->clk_readl(divider->reg);
232 val &= ~(div_mask(divider) << divider->shift);
233 }
234 val |= value << divider->shift;
235 ti_clk_ll_ops->clk_writel(val, divider->reg);
236
237 if (divider->lock)
238 spin_unlock_irqrestore(divider->lock, flags);
239
240 return 0;
241}
242
243const struct clk_ops ti_clk_divider_ops = {
244 .recalc_rate = ti_clk_divider_recalc_rate,
245 .round_rate = ti_clk_divider_round_rate,
246 .set_rate = ti_clk_divider_set_rate,
247};
248
249static struct clk *_register_divider(struct device *dev, const char *name,
250 const char *parent_name,
251 unsigned long flags, void __iomem *reg,
252 u8 shift, u8 width, u8 clk_divider_flags,
253 const struct clk_div_table *table,
254 spinlock_t *lock)
255{
256 struct clk_divider *div;
257 struct clk *clk;
258 struct clk_init_data init;
259
260 if (clk_divider_flags & CLK_DIVIDER_HIWORD_MASK) {
261 if (width + shift > 16) {
262 pr_warn("divider value exceeds LOWORD field\n");
263 return ERR_PTR(-EINVAL);
264 }
265 }
266
267 /* allocate the divider */
268 div = kzalloc(sizeof(*div), GFP_KERNEL);
269 if (!div) {
270 pr_err("%s: could not allocate divider clk\n", __func__);
271 return ERR_PTR(-ENOMEM);
272 }
273
274 init.name = name;
275 init.ops = &ti_clk_divider_ops;
276 init.flags = flags | CLK_IS_BASIC;
277 init.parent_names = (parent_name ? &parent_name : NULL);
278 init.num_parents = (parent_name ? 1 : 0);
279
280 /* struct clk_divider assignments */
281 div->reg = reg;
282 div->shift = shift;
283 div->width = width;
284 div->flags = clk_divider_flags;
285 div->lock = lock;
286 div->hw.init = &init;
287 div->table = table;
288
289 /* register the clock */
290 clk = clk_register(dev, &div->hw);
291
292 if (IS_ERR(clk))
293 kfree(div);
294
295 return clk;
296}
297
298static struct clk_div_table
299__init *ti_clk_get_div_table(struct device_node *node)
300{
301 struct clk_div_table *table;
302 const __be32 *divspec;
303 u32 val;
304 u32 num_div;
305 u32 valid_div;
306 int i;
307
308 divspec = of_get_property(node, "ti,dividers", &num_div);
309
310 if (!divspec)
311 return NULL;
312
313 num_div /= 4;
314
315 valid_div = 0;
316
317 /* Determine required size for divider table */
318 for (i = 0; i < num_div; i++) {
319 of_property_read_u32_index(node, "ti,dividers", i, &val);
320 if (val)
321 valid_div++;
322 }
323
324 if (!valid_div) {
325 pr_err("no valid dividers for %s table\n", node->name);
326 return ERR_PTR(-EINVAL);
327 }
328
329 table = kzalloc(sizeof(*table) * (valid_div + 1), GFP_KERNEL);
330
331 if (!table)
332 return ERR_PTR(-ENOMEM);
333
334 valid_div = 0;
335
336 for (i = 0; i < num_div; i++) {
337 of_property_read_u32_index(node, "ti,dividers", i, &val);
338 if (val) {
339 table[valid_div].div = val;
340 table[valid_div].val = i;
341 valid_div++;
342 }
343 }
344
345 return table;
346}
347
348static int _get_divider_width(struct device_node *node,
349 const struct clk_div_table *table,
350 u8 flags)
351{
352 u32 min_div;
353 u32 max_div;
354 u32 val = 0;
355 u32 div;
356
357 if (!table) {
358 /* Clk divider table not provided, determine min/max divs */
359 if (of_property_read_u32(node, "ti,min-div", &min_div))
360 min_div = 1;
361
362 if (of_property_read_u32(node, "ti,max-div", &max_div)) {
363 pr_err("no max-div for %s!\n", node->name);
364 return -EINVAL;
365 }
366
367 /* Determine bit width for the field */
368 if (flags & CLK_DIVIDER_ONE_BASED)
369 val = 1;
370
371 div = min_div;
372
373 while (div < max_div) {
374 if (flags & CLK_DIVIDER_POWER_OF_TWO)
375 div <<= 1;
376 else
377 div++;
378 val++;
379 }
380 } else {
381 div = 0;
382
383 while (table[div].div) {
384 val = table[div].val;
385 div++;
386 }
387 }
388
389 return fls(val);
390}
391
392static int __init ti_clk_divider_populate(struct device_node *node,
393 void __iomem **reg, const struct clk_div_table **table,
394 u32 *flags, u8 *div_flags, u8 *width, u8 *shift)
395{
396 u32 val;
397
398 *reg = ti_clk_get_reg_addr(node, 0);
399 if (!*reg)
400 return -EINVAL;
401
402 if (!of_property_read_u32(node, "ti,bit-shift", &val))
403 *shift = val;
404 else
405 *shift = 0;
406
407 *flags = 0;
408 *div_flags = 0;
409
410 if (of_property_read_bool(node, "ti,index-starts-at-one"))
411 *div_flags |= CLK_DIVIDER_ONE_BASED;
412
413 if (of_property_read_bool(node, "ti,index-power-of-two"))
414 *div_flags |= CLK_DIVIDER_POWER_OF_TWO;
415
416 if (of_property_read_bool(node, "ti,set-rate-parent"))
417 *flags |= CLK_SET_RATE_PARENT;
418
419 *table = ti_clk_get_div_table(node);
420
421 if (IS_ERR(*table))
422 return PTR_ERR(*table);
423
424 *width = _get_divider_width(node, *table, *div_flags);
425
426 return 0;
427}
428
429/**
430 * of_ti_divider_clk_setup - Setup function for simple div rate clock
431 * @node: device node for this clock
432 *
433 * Sets up a basic divider clock.
434 */
435static void __init of_ti_divider_clk_setup(struct device_node *node)
436{
437 struct clk *clk;
438 const char *parent_name;
439 void __iomem *reg;
440 u8 clk_divider_flags = 0;
441 u8 width = 0;
442 u8 shift = 0;
443 const struct clk_div_table *table = NULL;
444 u32 flags = 0;
445
446 parent_name = of_clk_get_parent_name(node, 0);
447
448 if (ti_clk_divider_populate(node, &reg, &table, &flags,
449 &clk_divider_flags, &width, &shift))
450 goto cleanup;
451
452 clk = _register_divider(NULL, node->name, parent_name, flags, reg,
453 shift, width, clk_divider_flags, table, NULL);
454
455 if (!IS_ERR(clk)) {
456 of_clk_add_provider(node, of_clk_src_simple_get, clk);
457 of_ti_clk_autoidle_setup(node);
458 return;
459 }
460
461cleanup:
462 kfree(table);
463}
464CLK_OF_DECLARE(divider_clk, "ti,divider-clock", of_ti_divider_clk_setup);
465
466static void __init of_ti_composite_divider_clk_setup(struct device_node *node)
467{
468 struct clk_divider *div;
469 u32 val;
470
471 div = kzalloc(sizeof(*div), GFP_KERNEL);
472 if (!div)
473 return;
474
475 if (ti_clk_divider_populate(node, &div->reg, &div->table, &val,
476 &div->flags, &div->width, &div->shift) < 0)
477 goto cleanup;
478
479 if (!ti_clk_add_component(node, &div->hw, CLK_COMPONENT_TYPE_DIVIDER))
480 return;
481
482cleanup:
483 kfree(div->table);
484 kfree(div);
485}
486CLK_OF_DECLARE(ti_composite_divider_clk, "ti,composite-divider-clock",
487 of_ti_composite_divider_clk_setup);
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
new file mode 100644
index 000000000000..7e498a44f97d
--- /dev/null
+++ b/drivers/clk/ti/dpll.c
@@ -0,0 +1,558 @@
1/*
2 * OMAP DPLL clock support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25#undef pr_fmt
26#define pr_fmt(fmt) "%s: " fmt, __func__
27
28#define DPLL_HAS_AUTOIDLE 0x1
29
30#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
31 defined(CONFIG_SOC_DRA7XX)
32static const struct clk_ops dpll_m4xen_ck_ops = {
33 .enable = &omap3_noncore_dpll_enable,
34 .disable = &omap3_noncore_dpll_disable,
35 .recalc_rate = &omap4_dpll_regm4xen_recalc,
36 .round_rate = &omap4_dpll_regm4xen_round_rate,
37 .set_rate = &omap3_noncore_dpll_set_rate,
38 .get_parent = &omap2_init_dpll_parent,
39};
40#endif
41
42static const struct clk_ops dpll_core_ck_ops = {
43 .recalc_rate = &omap3_dpll_recalc,
44 .get_parent = &omap2_init_dpll_parent,
45};
46
47#ifdef CONFIG_ARCH_OMAP3
48static const struct clk_ops omap3_dpll_core_ck_ops = {
49 .get_parent = &omap2_init_dpll_parent,
50 .recalc_rate = &omap3_dpll_recalc,
51 .round_rate = &omap2_dpll_round_rate,
52};
53#endif
54
55static const struct clk_ops dpll_ck_ops = {
56 .enable = &omap3_noncore_dpll_enable,
57 .disable = &omap3_noncore_dpll_disable,
58 .recalc_rate = &omap3_dpll_recalc,
59 .round_rate = &omap2_dpll_round_rate,
60 .set_rate = &omap3_noncore_dpll_set_rate,
61 .get_parent = &omap2_init_dpll_parent,
62};
63
64static const struct clk_ops dpll_no_gate_ck_ops = {
65 .recalc_rate = &omap3_dpll_recalc,
66 .get_parent = &omap2_init_dpll_parent,
67 .round_rate = &omap2_dpll_round_rate,
68 .set_rate = &omap3_noncore_dpll_set_rate,
69};
70
71#ifdef CONFIG_ARCH_OMAP3
72static const struct clk_ops omap3_dpll_ck_ops = {
73 .enable = &omap3_noncore_dpll_enable,
74 .disable = &omap3_noncore_dpll_disable,
75 .get_parent = &omap2_init_dpll_parent,
76 .recalc_rate = &omap3_dpll_recalc,
77 .set_rate = &omap3_noncore_dpll_set_rate,
78 .round_rate = &omap2_dpll_round_rate,
79};
80
81static const struct clk_ops omap3_dpll_per_ck_ops = {
82 .enable = &omap3_noncore_dpll_enable,
83 .disable = &omap3_noncore_dpll_disable,
84 .get_parent = &omap2_init_dpll_parent,
85 .recalc_rate = &omap3_dpll_recalc,
86 .set_rate = &omap3_dpll4_set_rate,
87 .round_rate = &omap2_dpll_round_rate,
88};
89#endif
90
91static const struct clk_ops dpll_x2_ck_ops = {
92 .recalc_rate = &omap3_clkoutx2_recalc,
93};
94
95/**
96 * ti_clk_register_dpll - low level registration of a DPLL clock
97 * @hw: hardware clock definition for the clock
98 * @node: device node for the clock
99 *
100 * Finalizes DPLL registration process. In case a failure (clk-ref or
101 * clk-bypass is missing), the clock is added to retry list and
102 * the initialization is retried on later stage.
103 */
104static void __init ti_clk_register_dpll(struct clk_hw *hw,
105 struct device_node *node)
106{
107 struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
108 struct dpll_data *dd = clk_hw->dpll_data;
109 struct clk *clk;
110
111 dd->clk_ref = of_clk_get(node, 0);
112 dd->clk_bypass = of_clk_get(node, 1);
113
114 if (IS_ERR(dd->clk_ref) || IS_ERR(dd->clk_bypass)) {
115 pr_debug("clk-ref or clk-bypass missing for %s, retry later\n",
116 node->name);
117 if (!ti_clk_retry_init(node, hw, ti_clk_register_dpll))
118 return;
119
120 goto cleanup;
121 }
122
123 /* register the clock */
124 clk = clk_register(NULL, &clk_hw->hw);
125
126 if (!IS_ERR(clk)) {
127 omap2_init_clk_hw_omap_clocks(clk);
128 of_clk_add_provider(node, of_clk_src_simple_get, clk);
129 kfree(clk_hw->hw.init->parent_names);
130 kfree(clk_hw->hw.init);
131 return;
132 }
133
134cleanup:
135 kfree(clk_hw->dpll_data);
136 kfree(clk_hw->hw.init->parent_names);
137 kfree(clk_hw->hw.init);
138 kfree(clk_hw);
139}
140
141#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
142 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX)
143/**
144 * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock
145 * @node: device node for this clock
146 * @ops: clk_ops for this clock
147 * @hw_ops: clk_hw_ops for this clock
148 *
149 * Initializes a DPLL x 2 clock from device tree data.
150 */
151static void ti_clk_register_dpll_x2(struct device_node *node,
152 const struct clk_ops *ops,
153 const struct clk_hw_omap_ops *hw_ops)
154{
155 struct clk *clk;
156 struct clk_init_data init = { NULL };
157 struct clk_hw_omap *clk_hw;
158 const char *name = node->name;
159 const char *parent_name;
160
161 parent_name = of_clk_get_parent_name(node, 0);
162 if (!parent_name) {
163 pr_err("%s must have parent\n", node->name);
164 return;
165 }
166
167 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
168 if (!clk_hw)
169 return;
170
171 clk_hw->ops = hw_ops;
172 clk_hw->hw.init = &init;
173
174 init.name = name;
175 init.ops = ops;
176 init.parent_names = &parent_name;
177 init.num_parents = 1;
178
179 /* register the clock */
180 clk = clk_register(NULL, &clk_hw->hw);
181
182 if (IS_ERR(clk)) {
183 kfree(clk_hw);
184 } else {
185 omap2_init_clk_hw_omap_clocks(clk);
186 of_clk_add_provider(node, of_clk_src_simple_get, clk);
187 }
188}
189#endif
190
191/**
192 * of_ti_dpll_setup - Setup function for OMAP DPLL clocks
193 * @node: device node containing the DPLL info
194 * @ops: ops for the DPLL
195 * @ddt: DPLL data template to use
196 * @init_flags: flags for controlling init types
197 *
198 * Initializes a DPLL clock from device tree data.
199 */
200static void __init of_ti_dpll_setup(struct device_node *node,
201 const struct clk_ops *ops,
202 const struct dpll_data *ddt,
203 u8 init_flags)
204{
205 struct clk_hw_omap *clk_hw = NULL;
206 struct clk_init_data *init = NULL;
207 const char **parent_names = NULL;
208 struct dpll_data *dd = NULL;
209 int i;
210 u8 dpll_mode = 0;
211
212 dd = kzalloc(sizeof(*dd), GFP_KERNEL);
213 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
214 init = kzalloc(sizeof(*init), GFP_KERNEL);
215 if (!dd || !clk_hw || !init)
216 goto cleanup;
217
218 memcpy(dd, ddt, sizeof(*dd));
219
220 clk_hw->dpll_data = dd;
221 clk_hw->ops = &clkhwops_omap3_dpll;
222 clk_hw->hw.init = init;
223 clk_hw->flags = MEMMAP_ADDRESSING;
224
225 init->name = node->name;
226 init->ops = ops;
227
228 init->num_parents = of_clk_get_parent_count(node);
229 if (init->num_parents < 1) {
230 pr_err("%s must have parent(s)\n", node->name);
231 goto cleanup;
232 }
233
234 parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL);
235 if (!parent_names)
236 goto cleanup;
237
238 for (i = 0; i < init->num_parents; i++)
239 parent_names[i] = of_clk_get_parent_name(node, i);
240
241 init->parent_names = parent_names;
242
243 dd->control_reg = ti_clk_get_reg_addr(node, 0);
244 dd->idlest_reg = ti_clk_get_reg_addr(node, 1);
245 dd->mult_div1_reg = ti_clk_get_reg_addr(node, 2);
246
247 if (!dd->control_reg || !dd->idlest_reg || !dd->mult_div1_reg)
248 goto cleanup;
249
250 if (init_flags & DPLL_HAS_AUTOIDLE) {
251 dd->autoidle_reg = ti_clk_get_reg_addr(node, 3);
252 if (!dd->autoidle_reg)
253 goto cleanup;
254 }
255
256 if (of_property_read_bool(node, "ti,low-power-stop"))
257 dpll_mode |= 1 << DPLL_LOW_POWER_STOP;
258
259 if (of_property_read_bool(node, "ti,low-power-bypass"))
260 dpll_mode |= 1 << DPLL_LOW_POWER_BYPASS;
261
262 if (of_property_read_bool(node, "ti,lock"))
263 dpll_mode |= 1 << DPLL_LOCKED;
264
265 if (dpll_mode)
266 dd->modes = dpll_mode;
267
268 ti_clk_register_dpll(&clk_hw->hw, node);
269 return;
270
271cleanup:
272 kfree(dd);
273 kfree(parent_names);
274 kfree(init);
275 kfree(clk_hw);
276}
277
278#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
279 defined(CONFIG_SOC_DRA7XX)
280static void __init of_ti_omap4_dpll_x2_setup(struct device_node *node)
281{
282 ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx);
283}
284CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock",
285 of_ti_omap4_dpll_x2_setup);
286#endif
287
288#ifdef CONFIG_SOC_AM33XX
289static void __init of_ti_am3_dpll_x2_setup(struct device_node *node)
290{
291 ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL);
292}
293CLK_OF_DECLARE(ti_am3_dpll_x2_clock, "ti,am3-dpll-x2-clock",
294 of_ti_am3_dpll_x2_setup);
295#endif
296
297#ifdef CONFIG_ARCH_OMAP3
298static void __init of_ti_omap3_dpll_setup(struct device_node *node)
299{
300 const struct dpll_data dd = {
301 .idlest_mask = 0x1,
302 .enable_mask = 0x7,
303 .autoidle_mask = 0x7,
304 .mult_mask = 0x7ff << 8,
305 .div1_mask = 0x7f,
306 .max_multiplier = 2047,
307 .max_divider = 128,
308 .min_divider = 1,
309 .freqsel_mask = 0xf0,
310 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
311 };
312
313 of_ti_dpll_setup(node, &omap3_dpll_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
314}
315CLK_OF_DECLARE(ti_omap3_dpll_clock, "ti,omap3-dpll-clock",
316 of_ti_omap3_dpll_setup);
317
318static void __init of_ti_omap3_core_dpll_setup(struct device_node *node)
319{
320 const struct dpll_data dd = {
321 .idlest_mask = 0x1,
322 .enable_mask = 0x7,
323 .autoidle_mask = 0x7,
324 .mult_mask = 0x7ff << 16,
325 .div1_mask = 0x7f << 8,
326 .max_multiplier = 2047,
327 .max_divider = 128,
328 .min_divider = 1,
329 .freqsel_mask = 0xf0,
330 };
331
332 of_ti_dpll_setup(node, &omap3_dpll_core_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
333}
334CLK_OF_DECLARE(ti_omap3_core_dpll_clock, "ti,omap3-dpll-core-clock",
335 of_ti_omap3_core_dpll_setup);
336
337static void __init of_ti_omap3_per_dpll_setup(struct device_node *node)
338{
339 const struct dpll_data dd = {
340 .idlest_mask = 0x1 << 1,
341 .enable_mask = 0x7 << 16,
342 .autoidle_mask = 0x7 << 3,
343 .mult_mask = 0x7ff << 8,
344 .div1_mask = 0x7f,
345 .max_multiplier = 2047,
346 .max_divider = 128,
347 .min_divider = 1,
348 .freqsel_mask = 0xf00000,
349 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
350 };
351
352 of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
353}
354CLK_OF_DECLARE(ti_omap3_per_dpll_clock, "ti,omap3-dpll-per-clock",
355 of_ti_omap3_per_dpll_setup);
356
357static void __init of_ti_omap3_per_jtype_dpll_setup(struct device_node *node)
358{
359 const struct dpll_data dd = {
360 .idlest_mask = 0x1 << 1,
361 .enable_mask = 0x7 << 16,
362 .autoidle_mask = 0x7 << 3,
363 .mult_mask = 0xfff << 8,
364 .div1_mask = 0x7f,
365 .max_multiplier = 4095,
366 .max_divider = 128,
367 .min_divider = 1,
368 .sddiv_mask = 0xff << 24,
369 .dco_mask = 0xe << 20,
370 .flags = DPLL_J_TYPE,
371 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
372 };
373
374 of_ti_dpll_setup(node, &omap3_dpll_per_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
375}
376CLK_OF_DECLARE(ti_omap3_per_jtype_dpll_clock, "ti,omap3-dpll-per-j-type-clock",
377 of_ti_omap3_per_jtype_dpll_setup);
378#endif
379
380static void __init of_ti_omap4_dpll_setup(struct device_node *node)
381{
382 const struct dpll_data dd = {
383 .idlest_mask = 0x1,
384 .enable_mask = 0x7,
385 .autoidle_mask = 0x7,
386 .mult_mask = 0x7ff << 8,
387 .div1_mask = 0x7f,
388 .max_multiplier = 2047,
389 .max_divider = 128,
390 .min_divider = 1,
391 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
392 };
393
394 of_ti_dpll_setup(node, &dpll_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
395}
396CLK_OF_DECLARE(ti_omap4_dpll_clock, "ti,omap4-dpll-clock",
397 of_ti_omap4_dpll_setup);
398
399static void __init of_ti_omap4_core_dpll_setup(struct device_node *node)
400{
401 const struct dpll_data dd = {
402 .idlest_mask = 0x1,
403 .enable_mask = 0x7,
404 .autoidle_mask = 0x7,
405 .mult_mask = 0x7ff << 8,
406 .div1_mask = 0x7f,
407 .max_multiplier = 2047,
408 .max_divider = 128,
409 .min_divider = 1,
410 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
411 };
412
413 of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
414}
415CLK_OF_DECLARE(ti_omap4_core_dpll_clock, "ti,omap4-dpll-core-clock",
416 of_ti_omap4_core_dpll_setup);
417
418#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
419 defined(CONFIG_SOC_DRA7XX)
420static void __init of_ti_omap4_m4xen_dpll_setup(struct device_node *node)
421{
422 const struct dpll_data dd = {
423 .idlest_mask = 0x1,
424 .enable_mask = 0x7,
425 .autoidle_mask = 0x7,
426 .mult_mask = 0x7ff << 8,
427 .div1_mask = 0x7f,
428 .max_multiplier = 2047,
429 .max_divider = 128,
430 .min_divider = 1,
431 .m4xen_mask = 0x800,
432 .lpmode_mask = 1 << 10,
433 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
434 };
435
436 of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
437}
438CLK_OF_DECLARE(ti_omap4_m4xen_dpll_clock, "ti,omap4-dpll-m4xen-clock",
439 of_ti_omap4_m4xen_dpll_setup);
440
441static void __init of_ti_omap4_jtype_dpll_setup(struct device_node *node)
442{
443 const struct dpll_data dd = {
444 .idlest_mask = 0x1,
445 .enable_mask = 0x7,
446 .autoidle_mask = 0x7,
447 .mult_mask = 0xfff << 8,
448 .div1_mask = 0xff,
449 .max_multiplier = 4095,
450 .max_divider = 256,
451 .min_divider = 1,
452 .sddiv_mask = 0xff << 24,
453 .flags = DPLL_J_TYPE,
454 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
455 };
456
457 of_ti_dpll_setup(node, &dpll_m4xen_ck_ops, &dd, DPLL_HAS_AUTOIDLE);
458}
459CLK_OF_DECLARE(ti_omap4_jtype_dpll_clock, "ti,omap4-dpll-j-type-clock",
460 of_ti_omap4_jtype_dpll_setup);
461#endif
462
463static void __init of_ti_am3_no_gate_dpll_setup(struct device_node *node)
464{
465 const struct dpll_data dd = {
466 .idlest_mask = 0x1,
467 .enable_mask = 0x7,
468 .autoidle_mask = 0x7,
469 .mult_mask = 0x7ff << 8,
470 .div1_mask = 0x7f,
471 .max_multiplier = 2047,
472 .max_divider = 128,
473 .min_divider = 1,
474 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
475 };
476
477 of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd, 0);
478}
479CLK_OF_DECLARE(ti_am3_no_gate_dpll_clock, "ti,am3-dpll-no-gate-clock",
480 of_ti_am3_no_gate_dpll_setup);
481
482static void __init of_ti_am3_jtype_dpll_setup(struct device_node *node)
483{
484 const struct dpll_data dd = {
485 .idlest_mask = 0x1,
486 .enable_mask = 0x7,
487 .autoidle_mask = 0x7,
488 .mult_mask = 0x7ff << 8,
489 .div1_mask = 0x7f,
490 .max_multiplier = 4095,
491 .max_divider = 256,
492 .min_divider = 2,
493 .flags = DPLL_J_TYPE,
494 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
495 };
496
497 of_ti_dpll_setup(node, &dpll_ck_ops, &dd, 0);
498}
499CLK_OF_DECLARE(ti_am3_jtype_dpll_clock, "ti,am3-dpll-j-type-clock",
500 of_ti_am3_jtype_dpll_setup);
501
502static void __init of_ti_am3_no_gate_jtype_dpll_setup(struct device_node *node)
503{
504 const struct dpll_data dd = {
505 .idlest_mask = 0x1,
506 .enable_mask = 0x7,
507 .autoidle_mask = 0x7,
508 .mult_mask = 0x7ff << 8,
509 .div1_mask = 0x7f,
510 .max_multiplier = 2047,
511 .max_divider = 128,
512 .min_divider = 1,
513 .flags = DPLL_J_TYPE,
514 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
515 };
516
517 of_ti_dpll_setup(node, &dpll_no_gate_ck_ops, &dd, 0);
518}
519CLK_OF_DECLARE(ti_am3_no_gate_jtype_dpll_clock,
520 "ti,am3-dpll-no-gate-j-type-clock",
521 of_ti_am3_no_gate_jtype_dpll_setup);
522
523static void __init of_ti_am3_dpll_setup(struct device_node *node)
524{
525 const struct dpll_data dd = {
526 .idlest_mask = 0x1,
527 .enable_mask = 0x7,
528 .autoidle_mask = 0x7,
529 .mult_mask = 0x7ff << 8,
530 .div1_mask = 0x7f,
531 .max_multiplier = 2047,
532 .max_divider = 128,
533 .min_divider = 1,
534 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
535 };
536
537 of_ti_dpll_setup(node, &dpll_ck_ops, &dd, 0);
538}
539CLK_OF_DECLARE(ti_am3_dpll_clock, "ti,am3-dpll-clock", of_ti_am3_dpll_setup);
540
541static void __init of_ti_am3_core_dpll_setup(struct device_node *node)
542{
543 const struct dpll_data dd = {
544 .idlest_mask = 0x1,
545 .enable_mask = 0x7,
546 .autoidle_mask = 0x7,
547 .mult_mask = 0x7ff << 8,
548 .div1_mask = 0x7f,
549 .max_multiplier = 2047,
550 .max_divider = 128,
551 .min_divider = 1,
552 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
553 };
554
555 of_ti_dpll_setup(node, &dpll_core_ck_ops, &dd, 0);
556}
557CLK_OF_DECLARE(ti_am3_core_dpll_clock, "ti,am3-dpll-core-clock",
558 of_ti_am3_core_dpll_setup);
diff --git a/drivers/clk/ti/fixed-factor.c b/drivers/clk/ti/fixed-factor.c
new file mode 100644
index 000000000000..c2c8a287408c
--- /dev/null
+++ b/drivers/clk/ti/fixed-factor.c
@@ -0,0 +1,66 @@
1/*
2 * TI Fixed Factor Clock
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25#undef pr_fmt
26#define pr_fmt(fmt) "%s: " fmt, __func__
27
28/**
29 * of_ti_fixed_factor_clk_setup - Setup function for TI fixed factor clock
30 * @node: device node for this clock
31 *
32 * Sets up a simple fixed factor clock based on device tree info.
33 */
34static void __init of_ti_fixed_factor_clk_setup(struct device_node *node)
35{
36 struct clk *clk;
37 const char *clk_name = node->name;
38 const char *parent_name;
39 u32 div, mult;
40 u32 flags = 0;
41
42 if (of_property_read_u32(node, "ti,clock-div", &div)) {
43 pr_err("%s must have a clock-div property\n", node->name);
44 return;
45 }
46
47 if (of_property_read_u32(node, "ti,clock-mult", &mult)) {
48 pr_err("%s must have a clock-mult property\n", node->name);
49 return;
50 }
51
52 if (of_property_read_bool(node, "ti,set-rate-parent"))
53 flags |= CLK_SET_RATE_PARENT;
54
55 parent_name = of_clk_get_parent_name(node, 0);
56
57 clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
58 mult, div);
59
60 if (!IS_ERR(clk)) {
61 of_clk_add_provider(node, of_clk_src_simple_get, clk);
62 of_ti_clk_autoidle_setup(node);
63 }
64}
65CLK_OF_DECLARE(ti_fixed_factor_clk, "ti,fixed-factor-clock",
66 of_ti_fixed_factor_clk_setup);
diff --git a/drivers/clk/ti/gate.c b/drivers/clk/ti/gate.c
new file mode 100644
index 000000000000..3e2999d11d15
--- /dev/null
+++ b/drivers/clk/ti/gate.c
@@ -0,0 +1,249 @@
1/*
2 * OMAP gate clock support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/io.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
26
27#undef pr_fmt
28#define pr_fmt(fmt) "%s: " fmt, __func__
29
30static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *clk);
31
32static const struct clk_ops omap_gate_clkdm_clk_ops = {
33 .init = &omap2_init_clk_clkdm,
34 .enable = &omap2_clkops_enable_clkdm,
35 .disable = &omap2_clkops_disable_clkdm,
36};
37
38static const struct clk_ops omap_gate_clk_ops = {
39 .init = &omap2_init_clk_clkdm,
40 .enable = &omap2_dflt_clk_enable,
41 .disable = &omap2_dflt_clk_disable,
42 .is_enabled = &omap2_dflt_clk_is_enabled,
43};
44
45static const struct clk_ops omap_gate_clk_hsdiv_restore_ops = {
46 .init = &omap2_init_clk_clkdm,
47 .enable = &omap36xx_gate_clk_enable_with_hsdiv_restore,
48 .disable = &omap2_dflt_clk_disable,
49 .is_enabled = &omap2_dflt_clk_is_enabled,
50};
51
52/**
53 * omap36xx_gate_clk_enable_with_hsdiv_restore - enable clocks suffering
54 * from HSDivider PWRDN problem Implements Errata ID: i556.
55 * @clk: DPLL output struct clk
56 *
57 * 3630 only: dpll3_m3_ck, dpll4_m2_ck, dpll4_m3_ck, dpll4_m4_ck,
58 * dpll4_m5_ck & dpll4_m6_ck dividers gets loaded with reset
59 * valueafter their respective PWRDN bits are set. Any dummy write
60 * (Any other value different from the Read value) to the
61 * corresponding CM_CLKSEL register will refresh the dividers.
62 */
63static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
64{
65 struct clk_divider *parent;
66 struct clk_hw *parent_hw;
67 u32 dummy_v, orig_v;
68 int ret;
69
70 /* Clear PWRDN bit of HSDIVIDER */
71 ret = omap2_dflt_clk_enable(clk);
72
73 /* Parent is the x2 node, get parent of parent for the m2 div */
74 parent_hw = __clk_get_hw(__clk_get_parent(__clk_get_parent(clk->clk)));
75 parent = to_clk_divider(parent_hw);
76
77 /* Restore the dividers */
78 if (!ret) {
79 orig_v = ti_clk_ll_ops->clk_readl(parent->reg);
80 dummy_v = orig_v;
81
82 /* Write any other value different from the Read value */
83 dummy_v ^= (1 << parent->shift);
84 ti_clk_ll_ops->clk_writel(dummy_v, parent->reg);
85
86 /* Write the original divider */
87 ti_clk_ll_ops->clk_writel(orig_v, parent->reg);
88 }
89
90 return ret;
91}
92
93static void __init _of_ti_gate_clk_setup(struct device_node *node,
94 const struct clk_ops *ops,
95 const struct clk_hw_omap_ops *hw_ops)
96{
97 struct clk *clk;
98 struct clk_init_data init = { NULL };
99 struct clk_hw_omap *clk_hw;
100 const char *clk_name = node->name;
101 const char *parent_name;
102 u32 val;
103
104 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
105 if (!clk_hw)
106 return;
107
108 clk_hw->hw.init = &init;
109
110 init.name = clk_name;
111 init.ops = ops;
112
113 if (ops != &omap_gate_clkdm_clk_ops) {
114 clk_hw->enable_reg = ti_clk_get_reg_addr(node, 0);
115 if (!clk_hw->enable_reg)
116 goto cleanup;
117
118 if (!of_property_read_u32(node, "ti,bit-shift", &val))
119 clk_hw->enable_bit = val;
120 }
121
122 clk_hw->ops = hw_ops;
123
124 clk_hw->flags = MEMMAP_ADDRESSING;
125
126 if (of_clk_get_parent_count(node) != 1) {
127 pr_err("%s must have 1 parent\n", clk_name);
128 goto cleanup;
129 }
130
131 parent_name = of_clk_get_parent_name(node, 0);
132 init.parent_names = &parent_name;
133 init.num_parents = 1;
134
135 if (of_property_read_bool(node, "ti,set-rate-parent"))
136 init.flags |= CLK_SET_RATE_PARENT;
137
138 if (of_property_read_bool(node, "ti,set-bit-to-disable"))
139 clk_hw->flags |= INVERT_ENABLE;
140
141 clk = clk_register(NULL, &clk_hw->hw);
142
143 if (!IS_ERR(clk)) {
144 of_clk_add_provider(node, of_clk_src_simple_get, clk);
145 return;
146 }
147
148cleanup:
149 kfree(clk_hw);
150}
151
152static void __init
153_of_ti_composite_gate_clk_setup(struct device_node *node,
154 const struct clk_hw_omap_ops *hw_ops)
155{
156 struct clk_hw_omap *gate;
157 u32 val = 0;
158
159 gate = kzalloc(sizeof(*gate), GFP_KERNEL);
160 if (!gate)
161 return;
162
163 gate->enable_reg = ti_clk_get_reg_addr(node, 0);
164 if (!gate->enable_reg)
165 goto cleanup;
166
167 of_property_read_u32(node, "ti,bit-shift", &val);
168
169 gate->enable_bit = val;
170 gate->ops = hw_ops;
171 gate->flags = MEMMAP_ADDRESSING;
172
173 if (!ti_clk_add_component(node, &gate->hw, CLK_COMPONENT_TYPE_GATE))
174 return;
175
176cleanup:
177 kfree(gate);
178}
179
180static void __init
181of_ti_composite_no_wait_gate_clk_setup(struct device_node *node)
182{
183 _of_ti_composite_gate_clk_setup(node, NULL);
184}
185CLK_OF_DECLARE(ti_composite_no_wait_gate_clk, "ti,composite-no-wait-gate-clock",
186 of_ti_composite_no_wait_gate_clk_setup);
187
188#ifdef CONFIG_ARCH_OMAP3
189static void __init of_ti_composite_interface_clk_setup(struct device_node *node)
190{
191 _of_ti_composite_gate_clk_setup(node, &clkhwops_iclk_wait);
192}
193CLK_OF_DECLARE(ti_composite_interface_clk, "ti,composite-interface-clock",
194 of_ti_composite_interface_clk_setup);
195#endif
196
197static void __init of_ti_composite_gate_clk_setup(struct device_node *node)
198{
199 _of_ti_composite_gate_clk_setup(node, &clkhwops_wait);
200}
201CLK_OF_DECLARE(ti_composite_gate_clk, "ti,composite-gate-clock",
202 of_ti_composite_gate_clk_setup);
203
204
205static void __init of_ti_clkdm_gate_clk_setup(struct device_node *node)
206{
207 _of_ti_gate_clk_setup(node, &omap_gate_clkdm_clk_ops, NULL);
208}
209CLK_OF_DECLARE(ti_clkdm_gate_clk, "ti,clkdm-gate-clock",
210 of_ti_clkdm_gate_clk_setup);
211
212static void __init of_ti_hsdiv_gate_clk_setup(struct device_node *node)
213{
214 _of_ti_gate_clk_setup(node, &omap_gate_clk_hsdiv_restore_ops,
215 &clkhwops_wait);
216}
217CLK_OF_DECLARE(ti_hsdiv_gate_clk, "ti,hsdiv-gate-clock",
218 of_ti_hsdiv_gate_clk_setup);
219
220static void __init of_ti_gate_clk_setup(struct device_node *node)
221{
222 _of_ti_gate_clk_setup(node, &omap_gate_clk_ops, NULL);
223}
224CLK_OF_DECLARE(ti_gate_clk, "ti,gate-clock", of_ti_gate_clk_setup)
225
226static void __init of_ti_wait_gate_clk_setup(struct device_node *node)
227{
228 _of_ti_gate_clk_setup(node, &omap_gate_clk_ops, &clkhwops_wait);
229}
230CLK_OF_DECLARE(ti_wait_gate_clk, "ti,wait-gate-clock",
231 of_ti_wait_gate_clk_setup);
232
233#ifdef CONFIG_ARCH_OMAP3
234static void __init of_ti_am35xx_gate_clk_setup(struct device_node *node)
235{
236 _of_ti_gate_clk_setup(node, &omap_gate_clk_ops,
237 &clkhwops_am35xx_ipss_module_wait);
238}
239CLK_OF_DECLARE(ti_am35xx_gate_clk, "ti,am35xx-gate-clock",
240 of_ti_am35xx_gate_clk_setup);
241
242static void __init of_ti_dss_gate_clk_setup(struct device_node *node)
243{
244 _of_ti_gate_clk_setup(node, &omap_gate_clk_ops,
245 &clkhwops_omap3430es2_dss_usbhost_wait);
246}
247CLK_OF_DECLARE(ti_dss_gate_clk, "ti,dss-gate-clock",
248 of_ti_dss_gate_clk_setup);
249#endif
diff --git a/drivers/clk/ti/interface.c b/drivers/clk/ti/interface.c
new file mode 100644
index 000000000000..320a2b168bb2
--- /dev/null
+++ b/drivers/clk/ti/interface.c
@@ -0,0 +1,125 @@
1/*
2 * OMAP interface clock support
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/clk/ti.h>
23
24#undef pr_fmt
25#define pr_fmt(fmt) "%s: " fmt, __func__
26
27static const struct clk_ops ti_interface_clk_ops = {
28 .init = &omap2_init_clk_clkdm,
29 .enable = &omap2_dflt_clk_enable,
30 .disable = &omap2_dflt_clk_disable,
31 .is_enabled = &omap2_dflt_clk_is_enabled,
32};
33
34static void __init _of_ti_interface_clk_setup(struct device_node *node,
35 const struct clk_hw_omap_ops *ops)
36{
37 struct clk *clk;
38 struct clk_init_data init = { NULL };
39 struct clk_hw_omap *clk_hw;
40 const char *parent_name;
41 u32 val;
42
43 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
44 if (!clk_hw)
45 return;
46
47 clk_hw->hw.init = &init;
48 clk_hw->ops = ops;
49 clk_hw->flags = MEMMAP_ADDRESSING;
50
51 clk_hw->enable_reg = ti_clk_get_reg_addr(node, 0);
52 if (!clk_hw->enable_reg)
53 goto cleanup;
54
55 if (!of_property_read_u32(node, "ti,bit-shift", &val))
56 clk_hw->enable_bit = val;
57
58 init.name = node->name;
59 init.ops = &ti_interface_clk_ops;
60 init.flags = 0;
61
62 parent_name = of_clk_get_parent_name(node, 0);
63 if (!parent_name) {
64 pr_err("%s must have a parent\n", node->name);
65 goto cleanup;
66 }
67
68 init.num_parents = 1;
69 init.parent_names = &parent_name;
70
71 clk = clk_register(NULL, &clk_hw->hw);
72
73 if (!IS_ERR(clk)) {
74 of_clk_add_provider(node, of_clk_src_simple_get, clk);
75 omap2_init_clk_hw_omap_clocks(clk);
76 return;
77 }
78
79cleanup:
80 kfree(clk_hw);
81}
82
83static void __init of_ti_interface_clk_setup(struct device_node *node)
84{
85 _of_ti_interface_clk_setup(node, &clkhwops_iclk_wait);
86}
87CLK_OF_DECLARE(ti_interface_clk, "ti,omap3-interface-clock",
88 of_ti_interface_clk_setup);
89
90static void __init of_ti_no_wait_interface_clk_setup(struct device_node *node)
91{
92 _of_ti_interface_clk_setup(node, &clkhwops_iclk);
93}
94CLK_OF_DECLARE(ti_no_wait_interface_clk, "ti,omap3-no-wait-interface-clock",
95 of_ti_no_wait_interface_clk_setup);
96
97static void __init of_ti_hsotgusb_interface_clk_setup(struct device_node *node)
98{
99 _of_ti_interface_clk_setup(node,
100 &clkhwops_omap3430es2_iclk_hsotgusb_wait);
101}
102CLK_OF_DECLARE(ti_hsotgusb_interface_clk, "ti,omap3-hsotgusb-interface-clock",
103 of_ti_hsotgusb_interface_clk_setup);
104
105static void __init of_ti_dss_interface_clk_setup(struct device_node *node)
106{
107 _of_ti_interface_clk_setup(node,
108 &clkhwops_omap3430es2_iclk_dss_usbhost_wait);
109}
110CLK_OF_DECLARE(ti_dss_interface_clk, "ti,omap3-dss-interface-clock",
111 of_ti_dss_interface_clk_setup);
112
113static void __init of_ti_ssi_interface_clk_setup(struct device_node *node)
114{
115 _of_ti_interface_clk_setup(node, &clkhwops_omap3430es2_iclk_ssi_wait);
116}
117CLK_OF_DECLARE(ti_ssi_interface_clk, "ti,omap3-ssi-interface-clock",
118 of_ti_ssi_interface_clk_setup);
119
120static void __init of_ti_am35xx_interface_clk_setup(struct device_node *node)
121{
122 _of_ti_interface_clk_setup(node, &clkhwops_am35xx_ipss_wait);
123}
124CLK_OF_DECLARE(ti_am35xx_interface_clk, "ti,am35xx-interface-clock",
125 of_ti_am35xx_interface_clk_setup);
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
new file mode 100644
index 000000000000..0197a478720c
--- /dev/null
+++ b/drivers/clk/ti/mux.c
@@ -0,0 +1,246 @@
1/*
2 * TI Multiplexer Clock
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 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/clk-provider.h>
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/clk/ti.h>
24
25#undef pr_fmt
26#define pr_fmt(fmt) "%s: " fmt, __func__
27
28#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
29
30static u8 ti_clk_mux_get_parent(struct clk_hw *hw)
31{
32 struct clk_mux *mux = to_clk_mux(hw);
33 int num_parents = __clk_get_num_parents(hw->clk);
34 u32 val;
35
36 /*
37 * FIXME need a mux-specific flag to determine if val is bitwise or
38 * numeric. e.g. sys_clkin_ck's clksel field is 3 bits wide, but ranges
39 * from 0x1 to 0x7 (index starts at one)
40 * OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so
41 * val = 0x4 really means "bit 2, index starts at bit 0"
42 */
43 val = ti_clk_ll_ops->clk_readl(mux->reg) >> mux->shift;
44 val &= mux->mask;
45
46 if (mux->table) {
47 int i;
48
49 for (i = 0; i < num_parents; i++)
50 if (mux->table[i] == val)
51 return i;
52 return -EINVAL;
53 }
54
55 if (val && (mux->flags & CLK_MUX_INDEX_BIT))
56 val = ffs(val) - 1;
57
58 if (val && (mux->flags & CLK_MUX_INDEX_ONE))
59 val--;
60
61 if (val >= num_parents)
62 return -EINVAL;
63
64 return val;
65}
66
67static int ti_clk_mux_set_parent(struct clk_hw *hw, u8 index)
68{
69 struct clk_mux *mux = to_clk_mux(hw);
70 u32 val;
71 unsigned long flags = 0;
72
73 if (mux->table) {
74 index = mux->table[index];
75 } else {
76 if (mux->flags & CLK_MUX_INDEX_BIT)
77 index = (1 << ffs(index));
78
79 if (mux->flags & CLK_MUX_INDEX_ONE)
80 index++;
81 }
82
83 if (mux->lock)
84 spin_lock_irqsave(mux->lock, flags);
85
86 if (mux->flags & CLK_MUX_HIWORD_MASK) {
87 val = mux->mask << (mux->shift + 16);
88 } else {
89 val = ti_clk_ll_ops->clk_readl(mux->reg);
90 val &= ~(mux->mask << mux->shift);
91 }
92 val |= index << mux->shift;
93 ti_clk_ll_ops->clk_writel(val, mux->reg);
94
95 if (mux->lock)
96 spin_unlock_irqrestore(mux->lock, flags);
97
98 return 0;
99}
100
101const struct clk_ops ti_clk_mux_ops = {
102 .get_parent = ti_clk_mux_get_parent,
103 .set_parent = ti_clk_mux_set_parent,
104 .determine_rate = __clk_mux_determine_rate,
105};
106
107static struct clk *_register_mux(struct device *dev, const char *name,
108 const char **parent_names, u8 num_parents,
109 unsigned long flags, void __iomem *reg,
110 u8 shift, u32 mask, u8 clk_mux_flags,
111 u32 *table, spinlock_t *lock)
112{
113 struct clk_mux *mux;
114 struct clk *clk;
115 struct clk_init_data init;
116
117 /* allocate the mux */
118 mux = kzalloc(sizeof(*mux), GFP_KERNEL);
119 if (!mux) {
120 pr_err("%s: could not allocate mux clk\n", __func__);
121 return ERR_PTR(-ENOMEM);
122 }
123
124 init.name = name;
125 init.ops = &ti_clk_mux_ops;
126 init.flags = flags | CLK_IS_BASIC;
127 init.parent_names = parent_names;
128 init.num_parents = num_parents;
129
130 /* struct clk_mux assignments */
131 mux->reg = reg;
132 mux->shift = shift;
133 mux->mask = mask;
134 mux->flags = clk_mux_flags;
135 mux->lock = lock;
136 mux->table = table;
137 mux->hw.init = &init;
138
139 clk = clk_register(dev, &mux->hw);
140
141 if (IS_ERR(clk))
142 kfree(mux);
143
144 return clk;
145}
146
147/**
148 * of_mux_clk_setup - Setup function for simple mux rate clock
149 * @node: DT node for the clock
150 *
151 * Sets up a basic clock multiplexer.
152 */
153static void of_mux_clk_setup(struct device_node *node)
154{
155 struct clk *clk;
156 void __iomem *reg;
157 int num_parents;
158 const char **parent_names;
159 int i;
160 u8 clk_mux_flags = 0;
161 u32 mask = 0;
162 u32 shift = 0;
163 u32 flags = 0;
164
165 num_parents = of_clk_get_parent_count(node);
166 if (num_parents < 2) {
167 pr_err("mux-clock %s must have parents\n", node->name);
168 return;
169 }
170 parent_names = kzalloc((sizeof(char *) * num_parents), GFP_KERNEL);
171 if (!parent_names)
172 goto cleanup;
173
174 for (i = 0; i < num_parents; i++)
175 parent_names[i] = of_clk_get_parent_name(node, i);
176
177 reg = ti_clk_get_reg_addr(node, 0);
178
179 if (!reg)
180 goto cleanup;
181
182 of_property_read_u32(node, "ti,bit-shift", &shift);
183
184 if (of_property_read_bool(node, "ti,index-starts-at-one"))
185 clk_mux_flags |= CLK_MUX_INDEX_ONE;
186
187 if (of_property_read_bool(node, "ti,set-rate-parent"))
188 flags |= CLK_SET_RATE_PARENT;
189
190 /* Generate bit-mask based on parent info */
191 mask = num_parents;
192 if (!(clk_mux_flags & CLK_MUX_INDEX_ONE))
193 mask--;
194
195 mask = (1 << fls(mask)) - 1;
196
197 clk = _register_mux(NULL, node->name, parent_names, num_parents, flags,
198 reg, shift, mask, clk_mux_flags, NULL, NULL);
199
200 if (!IS_ERR(clk))
201 of_clk_add_provider(node, of_clk_src_simple_get, clk);
202
203cleanup:
204 kfree(parent_names);
205}
206CLK_OF_DECLARE(mux_clk, "ti,mux-clock", of_mux_clk_setup);
207
208static void __init of_ti_composite_mux_clk_setup(struct device_node *node)
209{
210 struct clk_mux *mux;
211 int num_parents;
212 u32 val;
213
214 mux = kzalloc(sizeof(*mux), GFP_KERNEL);
215 if (!mux)
216 return;
217
218 mux->reg = ti_clk_get_reg_addr(node, 0);
219
220 if (!mux->reg)
221 goto cleanup;
222
223 if (!of_property_read_u32(node, "ti,bit-shift", &val))
224 mux->shift = val;
225
226 if (of_property_read_bool(node, "ti,index-starts-at-one"))
227 mux->flags |= CLK_MUX_INDEX_ONE;
228
229 num_parents = of_clk_get_parent_count(node);
230
231 if (num_parents < 2) {
232 pr_err("%s must have parents\n", node->name);
233 goto cleanup;
234 }
235
236 mux->mask = num_parents - 1;
237 mux->mask = (1 << fls(mux->mask)) - 1;
238
239 if (!ti_clk_add_component(node, &mux->hw, CLK_COMPONENT_TYPE_MUX))
240 return;
241
242cleanup:
243 kfree(mux);
244}
245CLK_OF_DECLARE(ti_composite_mux_clk_setup, "ti,composite-mux-clock",
246 of_ti_composite_mux_clk_setup);