diff options
| author | Stephen Boyd <sboyd@codeaurora.org> | 2014-01-15 13:47:31 -0500 |
|---|---|---|
| committer | Mike Turquette <mturquette@linaro.org> | 2014-01-16 15:01:05 -0500 |
| commit | d8b212014e69d6b6323773ce6898f224ef4ed0d6 (patch) | |
| tree | 8f8304d17e8880b4c6cb6ed77ae08090212d258b /drivers/clk | |
| parent | d33faa9ead8da261e75815b74b41ac7ff265da9a (diff) | |
clk: qcom: Add support for MSM8974's multimedia clock controller (MMCC)
Add a driver for the global clock controller found on MSM 8974
based platforms. This should allow most multimedia device drivers
to probe and control their clocks.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
| -rw-r--r-- | drivers/clk/qcom/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/clk/qcom/Makefile | 1 | ||||
| -rw-r--r-- | drivers/clk/qcom/mmcc-msm8974.c | 2625 |
3 files changed, 2635 insertions, 0 deletions
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 7a1325119637..7b582dd5cd08 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig | |||
| @@ -28,3 +28,12 @@ config MSM_GCC_8974 | |||
| 28 | Support for the global clock controller on msm8974 devices. | 28 | Support for the global clock controller on msm8974 devices. |
| 29 | Say Y if you want to use peripheral devices such as UART, SPI, | 29 | Say Y if you want to use peripheral devices such as UART, SPI, |
| 30 | i2c, USB, SD/eMMC, SATA, PCIe, etc. | 30 | i2c, USB, SD/eMMC, SATA, PCIe, etc. |
| 31 | |||
| 32 | config MSM_MMCC_8974 | ||
| 33 | tristate "MSM8974 Multimedia Clock Controller" | ||
| 34 | select MSM_GCC_8974 | ||
| 35 | depends on COMMON_CLK_QCOM | ||
| 36 | help | ||
| 37 | Support for the multimedia clock controller on msm8974 devices. | ||
| 38 | Say Y if you want to support multimedia devices such as display, | ||
| 39 | graphics, video encode/decode, camera, etc. | ||
diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index 10883e6306de..e00cb848a1ae 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile | |||
| @@ -10,3 +10,4 @@ clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += reset.o | |||
| 10 | obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o | 10 | obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o |
| 11 | obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o | 11 | obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o |
| 12 | obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o | 12 | obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o |
| 13 | obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o | ||
diff --git a/drivers/clk/qcom/mmcc-msm8974.c b/drivers/clk/qcom/mmcc-msm8974.c new file mode 100644 index 000000000000..c95774514b81 --- /dev/null +++ b/drivers/clk/qcom/mmcc-msm8974.c | |||
| @@ -0,0 +1,2625 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. | ||
| 3 | * | ||
| 4 | * This software is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2, as published by the Free Software Foundation, and | ||
| 6 | * may be copied, distributed, and modified under those terms. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/bitops.h> | ||
| 16 | #include <linux/err.h> | ||
| 17 | #include <linux/platform_device.h> | ||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/of.h> | ||
| 20 | #include <linux/of_device.h> | ||
| 21 | #include <linux/clk-provider.h> | ||
| 22 | #include <linux/regmap.h> | ||
| 23 | #include <linux/reset-controller.h> | ||
| 24 | |||
| 25 | #include <dt-bindings/clock/qcom,mmcc-msm8974.h> | ||
| 26 | #include <dt-bindings/reset/qcom,mmcc-msm8974.h> | ||
| 27 | |||
| 28 | #include "clk-regmap.h" | ||
| 29 | #include "clk-pll.h" | ||
| 30 | #include "clk-rcg.h" | ||
| 31 | #include "clk-branch.h" | ||
| 32 | #include "reset.h" | ||
| 33 | |||
| 34 | #define P_XO 0 | ||
| 35 | #define P_MMPLL0 1 | ||
| 36 | #define P_EDPLINK 1 | ||
| 37 | #define P_MMPLL1 2 | ||
| 38 | #define P_HDMIPLL 2 | ||
| 39 | #define P_GPLL0 3 | ||
| 40 | #define P_EDPVCO 3 | ||
| 41 | #define P_GPLL1 4 | ||
| 42 | #define P_DSI0PLL 4 | ||
| 43 | #define P_MMPLL2 4 | ||
| 44 | #define P_MMPLL3 4 | ||
| 45 | #define P_DSI1PLL 5 | ||
| 46 | |||
| 47 | static const u8 mmcc_xo_mmpll0_mmpll1_gpll0_map[] = { | ||
| 48 | [P_XO] = 0, | ||
| 49 | [P_MMPLL0] = 1, | ||
| 50 | [P_MMPLL1] = 2, | ||
| 51 | [P_GPLL0] = 5, | ||
| 52 | }; | ||
| 53 | |||
| 54 | static const char *mmcc_xo_mmpll0_mmpll1_gpll0[] = { | ||
| 55 | "xo", | ||
| 56 | "mmpll0_vote", | ||
| 57 | "mmpll1_vote", | ||
| 58 | "mmss_gpll0_vote", | ||
| 59 | }; | ||
| 60 | |||
| 61 | static const u8 mmcc_xo_mmpll0_dsi_hdmi_gpll0_map[] = { | ||
| 62 | [P_XO] = 0, | ||
| 63 | [P_MMPLL0] = 1, | ||
| 64 | [P_HDMIPLL] = 4, | ||
| 65 | [P_GPLL0] = 5, | ||
| 66 | [P_DSI0PLL] = 2, | ||
| 67 | [P_DSI1PLL] = 3, | ||
| 68 | }; | ||
| 69 | |||
| 70 | static const char *mmcc_xo_mmpll0_dsi_hdmi_gpll0[] = { | ||
| 71 | "xo", | ||
| 72 | "mmpll0_vote", | ||
| 73 | "hdmipll", | ||
| 74 | "mmss_gpll0_vote", | ||
| 75 | "dsi0pll", | ||
| 76 | "dsi1pll", | ||
| 77 | }; | ||
| 78 | |||
| 79 | static const u8 mmcc_xo_mmpll0_1_2_gpll0_map[] = { | ||
| 80 | [P_XO] = 0, | ||
| 81 | [P_MMPLL0] = 1, | ||
| 82 | [P_MMPLL1] = 2, | ||
| 83 | [P_GPLL0] = 5, | ||
| 84 | [P_MMPLL2] = 3, | ||
| 85 | }; | ||
| 86 | |||
| 87 | static const char *mmcc_xo_mmpll0_1_2_gpll0[] = { | ||
| 88 | "xo", | ||
| 89 | "mmpll0_vote", | ||
| 90 | "mmpll1_vote", | ||
| 91 | "mmss_gpll0_vote", | ||
| 92 | "mmpll2", | ||
| 93 | }; | ||
| 94 | |||
| 95 | static const u8 mmcc_xo_mmpll0_1_3_gpll0_map[] = { | ||
| 96 | [P_XO] = 0, | ||
| 97 | [P_MMPLL0] = 1, | ||
| 98 | [P_MMPLL1] = 2, | ||
| 99 | [P_GPLL0] = 5, | ||
| 100 | [P_MMPLL3] = 3, | ||
| 101 | }; | ||
| 102 | |||
| 103 | static const char *mmcc_xo_mmpll0_1_3_gpll0[] = { | ||
| 104 | "xo", | ||
| 105 | "mmpll0_vote", | ||
| 106 | "mmpll1_vote", | ||
| 107 | "mmss_gpll0_vote", | ||
| 108 | "mmpll3", | ||
| 109 | }; | ||
| 110 | |||
| 111 | static const u8 mmcc_xo_mmpll0_1_gpll1_0_map[] = { | ||
| 112 | [P_XO] = 0, | ||
| 113 | [P_MMPLL0] = 1, | ||
| 114 | [P_MMPLL1] = 2, | ||
| 115 | [P_GPLL0] = 5, | ||
| 116 | [P_GPLL1] = 4, | ||
| 117 | }; | ||
| 118 | |||
| 119 | static const char *mmcc_xo_mmpll0_1_gpll1_0[] = { | ||
| 120 | "xo", | ||
| 121 | "mmpll0_vote", | ||
| 122 | "mmpll1_vote", | ||
| 123 | "mmss_gpll0_vote", | ||
| 124 | "gpll1_vote", | ||
| 125 | }; | ||
| 126 | |||
| 127 | static const u8 mmcc_xo_dsi_hdmi_edp_map[] = { | ||
| 128 | [P_XO] = 0, | ||
| 129 | [P_EDPLINK] = 4, | ||
| 130 | [P_HDMIPLL] = 3, | ||
| 131 | [P_EDPVCO] = 5, | ||
| 132 | [P_DSI0PLL] = 1, | ||
| 133 | [P_DSI1PLL] = 2, | ||
| 134 | }; | ||
| 135 | |||
| 136 | static const char *mmcc_xo_dsi_hdmi_edp[] = { | ||
| 137 | "xo", | ||
| 138 | "edp_link_clk", | ||
| 139 | "hdmipll", | ||
| 140 | "edp_vco_div", | ||
| 141 | "dsi0pll", | ||
| 142 | "dsi1pll", | ||
| 143 | }; | ||
| 144 | |||
| 145 | static const u8 mmcc_xo_dsi_hdmi_edp_gpll0_map[] = { | ||
| 146 | [P_XO] = 0, | ||
| 147 | [P_EDPLINK] = 4, | ||
| 148 | [P_HDMIPLL] = 3, | ||
| 149 | [P_GPLL0] = 5, | ||
| 150 | [P_DSI0PLL] = 1, | ||
| 151 | [P_DSI1PLL] = 2, | ||
| 152 | }; | ||
| 153 | |||
| 154 | static const char *mmcc_xo_dsi_hdmi_edp_gpll0[] = { | ||
| 155 | "xo", | ||
| 156 | "edp_link_clk", | ||
| 157 | "hdmipll", | ||
| 158 | "gpll0_vote", | ||
| 159 | "dsi0pll", | ||
| 160 | "dsi1pll", | ||
| 161 | }; | ||
| 162 | |||
| 163 | #define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) } | ||
| 164 | |||
| 165 | static struct clk_pll mmpll0 = { | ||
| 166 | .l_reg = 0x0004, | ||
| 167 | .m_reg = 0x0008, | ||
| 168 | .n_reg = 0x000c, | ||
| 169 | .config_reg = 0x0014, | ||
| 170 | <|||
