.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. |
---|
3 | 4 | * Author: Chanwoo Choi <cw00.choi@samsung.com> |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 as |
---|
7 | | - * published by the Free Software Foundation. |
---|
8 | 5 | * |
---|
9 | 6 | * Common Clock Framework support for Exynos5433 SoC. |
---|
10 | 7 | */ |
---|
.. | .. |
---|
176 | 173 | ENABLE_IP_TOP, |
---|
177 | 174 | ENABLE_CMU_TOP, |
---|
178 | 175 | ENABLE_CMU_TOP_DIV_STAT, |
---|
| 176 | +}; |
---|
| 177 | + |
---|
| 178 | +static const struct samsung_clk_reg_dump top_suspend_regs[] = { |
---|
| 179 | + /* force all aclk clocks enabled */ |
---|
| 180 | + { ENABLE_ACLK_TOP, 0x67ecffed }, |
---|
| 181 | + /* force all sclk_uart clocks enabled */ |
---|
| 182 | + { ENABLE_SCLK_TOP_PERIC, 0x38 }, |
---|
| 183 | + /* ISP PLL has to be enabled for suspend: reset value + ENABLE bit */ |
---|
| 184 | + { ISP_PLL_CON0, 0x85cc0502 }, |
---|
| 185 | + /* ISP PLL has to be enabled for suspend: reset value + ENABLE bit */ |
---|
| 186 | + { AUD_PLL_CON0, 0x84830202 }, |
---|
179 | 187 | }; |
---|
180 | 188 | |
---|
181 | 189 | /* list of all parent clock list */ |
---|
.. | .. |
---|
549 | 557 | /* ENABLE_ACLK_TOP */ |
---|
550 | 558 | GATE(CLK_ACLK_G3D_400, "aclk_g3d_400", "div_aclk_g3d_400", |
---|
551 | 559 | ENABLE_ACLK_TOP, 30, CLK_IS_CRITICAL, 0), |
---|
552 | | - GATE(CLK_ACLK_IMEM_SSX_266, "aclk_imem_ssx_266", |
---|
| 560 | + GATE(CLK_ACLK_IMEM_SSSX_266, "aclk_imem_sssx_266", |
---|
553 | 561 | "div_aclk_imem_sssx_266", ENABLE_ACLK_TOP, |
---|
554 | 562 | 29, CLK_IGNORE_UNUSED, 0), |
---|
555 | 563 | GATE(CLK_ACLK_BUS0_400, "aclk_bus0_400", "div_aclk_bus0_400", |
---|
.. | .. |
---|
558 | 566 | GATE(CLK_ACLK_BUS1_400, "aclk_bus1_400", "div_aclk_bus1_400", |
---|
559 | 567 | ENABLE_ACLK_TOP, 25, |
---|
560 | 568 | CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0), |
---|
561 | | - GATE(CLK_ACLK_IMEM_200, "aclk_imem_200", "div_aclk_imem_266", |
---|
| 569 | + GATE(CLK_ACLK_IMEM_200, "aclk_imem_200", "div_aclk_imem_200", |
---|
562 | 570 | ENABLE_ACLK_TOP, 24, |
---|
563 | 571 | CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0), |
---|
564 | | - GATE(CLK_ACLK_IMEM_266, "aclk_imem_266", "div_aclk_imem_200", |
---|
| 572 | + GATE(CLK_ACLK_IMEM_266, "aclk_imem_266", "div_aclk_imem_266", |
---|
565 | 573 | ENABLE_ACLK_TOP, 23, |
---|
566 | 574 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0), |
---|
567 | 575 | GATE(CLK_ACLK_PERIC_66, "aclk_peric_66", "div_aclk_peric_66_b", |
---|
.. | .. |
---|
793 | 801 | .nr_clk_ids = TOP_NR_CLK, |
---|
794 | 802 | .clk_regs = top_clk_regs, |
---|
795 | 803 | .nr_clk_regs = ARRAY_SIZE(top_clk_regs), |
---|
| 804 | + .suspend_regs = top_suspend_regs, |
---|
| 805 | + .nr_suspend_regs = ARRAY_SIZE(top_suspend_regs), |
---|
796 | 806 | }; |
---|
797 | 807 | |
---|
798 | 808 | static void __init exynos5433_cmu_top_init(struct device_node *np) |
---|
.. | .. |
---|
821 | 831 | MUX_SEL_CPIF0, |
---|
822 | 832 | DIV_CPIF, |
---|
823 | 833 | ENABLE_SCLK_CPIF, |
---|
| 834 | +}; |
---|
| 835 | + |
---|
| 836 | +static const struct samsung_clk_reg_dump cpif_suspend_regs[] = { |
---|
| 837 | + /* force all sclk clocks enabled */ |
---|
| 838 | + { ENABLE_SCLK_CPIF, 0x3ff }, |
---|
| 839 | + /* MPHY PLL has to be enabled for suspend: reset value + ENABLE bit */ |
---|
| 840 | + { MPHY_PLL_CON0, 0x81c70601 }, |
---|
824 | 841 | }; |
---|
825 | 842 | |
---|
826 | 843 | /* list of all parent clock list */ |
---|
.. | .. |
---|
863 | 880 | .nr_clk_ids = CPIF_NR_CLK, |
---|
864 | 881 | .clk_regs = cpif_clk_regs, |
---|
865 | 882 | .nr_clk_regs = ARRAY_SIZE(cpif_clk_regs), |
---|
| 883 | + .suspend_regs = cpif_suspend_regs, |
---|
| 884 | + .nr_suspend_regs = ARRAY_SIZE(cpif_suspend_regs), |
---|
866 | 885 | }; |
---|
867 | 886 | |
---|
868 | 887 | static void __init exynos5433_cmu_cpif_init(struct device_node *np) |
---|
.. | .. |
---|
1548 | 1567 | ENABLE_IP_PERIC2, |
---|
1549 | 1568 | }; |
---|
1550 | 1569 | |
---|
| 1570 | +static const struct samsung_clk_reg_dump peric_suspend_regs[] = { |
---|
| 1571 | + /* pclk: sci, pmu, sysreg, gpio_{finger, ese, touch, nfc}, uart2-0 */ |
---|
| 1572 | + { ENABLE_PCLK_PERIC0, 0xe00ff000 }, |
---|
| 1573 | + /* sclk: uart2-0 */ |
---|
| 1574 | + { ENABLE_SCLK_PERIC, 0x7 }, |
---|
| 1575 | +}; |
---|
| 1576 | + |
---|
1551 | 1577 | static const struct samsung_div_clock peric_div_clks[] __initconst = { |
---|
1552 | 1578 | /* DIV_PERIC */ |
---|
1553 | 1579 | DIV(CLK_DIV_SCLK_SCI, "div_sclk_sci", "oscclk", DIV_PERIC, 4, 4), |
---|
.. | .. |
---|
1707 | 1733 | .nr_clk_ids = PERIC_NR_CLK, |
---|
1708 | 1734 | .clk_regs = peric_clk_regs, |
---|
1709 | 1735 | .nr_clk_regs = ARRAY_SIZE(peric_clk_regs), |
---|
| 1736 | + .suspend_regs = peric_suspend_regs, |
---|
| 1737 | + .nr_suspend_regs = ARRAY_SIZE(peric_suspend_regs), |
---|
1710 | 1738 | }; |
---|
1711 | 1739 | |
---|
1712 | 1740 | static void __init exynos5433_cmu_peric_init(struct device_node *np) |
---|
.. | .. |
---|
3651 | 3679 | { |
---|
3652 | 3680 | void __iomem *reg_base; |
---|
3653 | 3681 | struct samsung_clk_provider *ctx; |
---|
| 3682 | + struct clk_hw **hws; |
---|
3654 | 3683 | |
---|
3655 | 3684 | reg_base = of_iomap(np, 0); |
---|
3656 | 3685 | if (!reg_base) { |
---|
.. | .. |
---|
3673 | 3702 | samsung_clk_register_gate(ctx, apollo_gate_clks, |
---|
3674 | 3703 | ARRAY_SIZE(apollo_gate_clks)); |
---|
3675 | 3704 | |
---|
| 3705 | + hws = ctx->clk_data.hws; |
---|
| 3706 | + |
---|
3676 | 3707 | exynos_register_cpu_clock(ctx, CLK_SCLK_APOLLO, "apolloclk", |
---|
3677 | | - mout_apollo_p[0], mout_apollo_p[1], 0x200, |
---|
| 3708 | + hws[CLK_MOUT_APOLLO_PLL], hws[CLK_MOUT_BUS_PLL_APOLLO_USER], 0x200, |
---|
3678 | 3709 | exynos5433_apolloclk_d, ARRAY_SIZE(exynos5433_apolloclk_d), |
---|
3679 | 3710 | CLK_CPU_HAS_E5433_REGS_LAYOUT); |
---|
3680 | 3711 | |
---|
.. | .. |
---|
3905 | 3936 | { |
---|
3906 | 3937 | void __iomem *reg_base; |
---|
3907 | 3938 | struct samsung_clk_provider *ctx; |
---|
| 3939 | + struct clk_hw **hws; |
---|
3908 | 3940 | |
---|
3909 | 3941 | reg_base = of_iomap(np, 0); |
---|
3910 | 3942 | if (!reg_base) { |
---|
.. | .. |
---|
3927 | 3959 | samsung_clk_register_gate(ctx, atlas_gate_clks, |
---|
3928 | 3960 | ARRAY_SIZE(atlas_gate_clks)); |
---|
3929 | 3961 | |
---|
| 3962 | + hws = ctx->clk_data.hws; |
---|
| 3963 | + |
---|
3930 | 3964 | exynos_register_cpu_clock(ctx, CLK_SCLK_ATLAS, "atlasclk", |
---|
3931 | | - mout_atlas_p[0], mout_atlas_p[1], 0x200, |
---|
| 3965 | + hws[CLK_MOUT_ATLAS_PLL], hws[CLK_MOUT_BUS_PLL_ATLAS_USER], 0x200, |
---|
3932 | 3966 | exynos5433_atlasclk_d, ARRAY_SIZE(exynos5433_atlasclk_d), |
---|
3933 | 3967 | CLK_CPU_HAS_E5433_REGS_LAYOUT); |
---|
3934 | 3968 | |
---|
.. | .. |
---|
5438 | 5472 | .clk_name = "aclk_cam1_400", |
---|
5439 | 5473 | }; |
---|
5440 | 5474 | |
---|
| 5475 | +/* |
---|
| 5476 | + * Register offset definitions for CMU_IMEM |
---|
| 5477 | + */ |
---|
| 5478 | +#define ENABLE_ACLK_IMEM_SLIMSSS 0x080c |
---|
| 5479 | +#define ENABLE_PCLK_IMEM_SLIMSSS 0x0908 |
---|
| 5480 | + |
---|
| 5481 | +static const unsigned long imem_clk_regs[] __initconst = { |
---|
| 5482 | + ENABLE_ACLK_IMEM_SLIMSSS, |
---|
| 5483 | + ENABLE_PCLK_IMEM_SLIMSSS, |
---|
| 5484 | +}; |
---|
| 5485 | + |
---|
| 5486 | +static const struct samsung_gate_clock imem_gate_clks[] __initconst = { |
---|
| 5487 | + /* ENABLE_ACLK_IMEM_SLIMSSS */ |
---|
| 5488 | + GATE(CLK_ACLK_SLIMSSS, "aclk_slimsss", "aclk_imem_sssx_266", |
---|
| 5489 | + ENABLE_ACLK_IMEM_SLIMSSS, 0, CLK_IGNORE_UNUSED, 0), |
---|
| 5490 | + |
---|
| 5491 | + /* ENABLE_PCLK_IMEM_SLIMSSS */ |
---|
| 5492 | + GATE(CLK_PCLK_SLIMSSS, "pclk_slimsss", "aclk_imem_200", |
---|
| 5493 | + ENABLE_PCLK_IMEM_SLIMSSS, 0, CLK_IGNORE_UNUSED, 0), |
---|
| 5494 | +}; |
---|
| 5495 | + |
---|
| 5496 | +static const struct samsung_cmu_info imem_cmu_info __initconst = { |
---|
| 5497 | + .gate_clks = imem_gate_clks, |
---|
| 5498 | + .nr_gate_clks = ARRAY_SIZE(imem_gate_clks), |
---|
| 5499 | + .nr_clk_ids = IMEM_NR_CLK, |
---|
| 5500 | + .clk_regs = imem_clk_regs, |
---|
| 5501 | + .nr_clk_regs = ARRAY_SIZE(imem_clk_regs), |
---|
| 5502 | + .clk_name = "aclk_imem_200", |
---|
| 5503 | +}; |
---|
5441 | 5504 | |
---|
5442 | 5505 | struct exynos5433_cmu_data { |
---|
5443 | 5506 | struct samsung_clk_reg_dump *clk_save; |
---|
.. | .. |
---|
5534 | 5597 | data->nr_clk_save = info->nr_clk_regs; |
---|
5535 | 5598 | data->clk_suspend = info->suspend_regs; |
---|
5536 | 5599 | data->nr_clk_suspend = info->nr_suspend_regs; |
---|
5537 | | - data->nr_pclks = of_count_phandle_with_args(dev->of_node, "clocks", |
---|
5538 | | - "#clock-cells"); |
---|
| 5600 | + data->nr_pclks = of_clk_get_parent_count(dev->of_node); |
---|
| 5601 | + |
---|
5539 | 5602 | if (data->nr_pclks > 0) { |
---|
5540 | 5603 | data->pclks = devm_kcalloc(dev, sizeof(struct clk *), |
---|
5541 | 5604 | data->nr_pclks, GFP_KERNEL); |
---|
.. | .. |
---|
5635 | 5698 | .compatible = "samsung,exynos5433-cmu-mscl", |
---|
5636 | 5699 | .data = &mscl_cmu_info, |
---|
5637 | 5700 | }, { |
---|
| 5701 | + .compatible = "samsung,exynos5433-cmu-imem", |
---|
| 5702 | + .data = &imem_cmu_info, |
---|
| 5703 | + }, { |
---|
5638 | 5704 | }, |
---|
5639 | 5705 | }; |
---|
5640 | 5706 | |
---|