diff options
author | Georgi Djakov <georgi.djakov@linaro.org> | 2015-03-20 19:30:26 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-03-24 02:09:19 +0300 |
commit | 293d2e97b37f545bb36aef78cd549d9e6cd66e7f (patch) | |
tree | 4b8ba1c40d681b198dd67696087cf03531f03ca0 /drivers/clk/qcom/mmcc-apq8084.c | |
parent | fae507afbdf3384227ced662c51c5b6cbff223c8 (diff) | |
download | linux-293d2e97b37f545bb36aef78cd549d9e6cd66e7f.tar.xz |
clk: qcom: Introduce parent_map tables
In the current parent mapping code, we can get duplicate or inconsistent
indexes, which leads to discrepancy between the number of elements in the
array and the number of parents. Until now, this was solved with some
reordering but this is not always possible.
This patch introduces index tables that are used to define the relations
between the PLL source and the hardware mux configuration value.
To accomplish this, here we do the following:
- Define a parent_map struct to map the relations between PLL source index
and register configuration value.
- Add a qcom_find_src_index() function for finding the index of a clock
matching the specific PLL configuration.
- Update the {set,get}_parent RCG functions use the newly introduced
parent_map struct.
- Convert all existing drivers to the new parent_map tables.
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/qcom/mmcc-apq8084.c')
-rw-r--r-- | drivers/clk/qcom/mmcc-apq8084.c | 168 |
1 files changed, 85 insertions, 83 deletions
diff --git a/drivers/clk/qcom/mmcc-apq8084.c b/drivers/clk/qcom/mmcc-apq8084.c index 157139a5c1ca..1b17df2cb0af 100644 --- a/drivers/clk/qcom/mmcc-apq8084.c +++ b/drivers/clk/qcom/mmcc-apq8084.c @@ -27,28 +27,30 @@ #include "clk-branch.h" #include "reset.h" -#define P_XO 0 -#define P_MMPLL0 1 -#define P_EDPLINK 1 -#define P_MMPLL1 2 -#define P_HDMIPLL 2 -#define P_GPLL0 3 -#define P_EDPVCO 3 -#define P_MMPLL4 4 -#define P_DSI0PLL 4 -#define P_DSI0PLL_BYTE 4 -#define P_MMPLL2 4 -#define P_MMPLL3 4 -#define P_GPLL1 5 -#define P_DSI1PLL 5 -#define P_DSI1PLL_BYTE 5 -#define P_MMSLEEP 6 - -static const u8 mmcc_xo_mmpll0_mmpll1_gpll0_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_MMPLL1] = 2, - [P_GPLL0] = 5, +enum { + P_XO, + P_MMPLL0, + P_EDPLINK, + P_MMPLL1, + P_HDMIPLL, + P_GPLL0, + P_EDPVCO, + P_MMPLL4, + P_DSI0PLL, + P_DSI0PLL_BYTE, + P_MMPLL2, + P_MMPLL3, + P_GPLL1, + P_DSI1PLL, + P_DSI1PLL_BYTE, + P_MMSLEEP, +}; + +static const struct parent_map mmcc_xo_mmpll0_mmpll1_gpll0_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_MMPLL1, 2 }, + { P_GPLL0, 5 } }; static const char *mmcc_xo_mmpll0_mmpll1_gpll0[] = { @@ -58,13 +60,13 @@ static const char *mmcc_xo_mmpll0_mmpll1_gpll0[] = { "mmss_gpll0_vote", }; -static const u8 mmcc_xo_mmpll0_dsi_hdmi_gpll0_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_HDMIPLL] = 4, - [P_GPLL0] = 5, - [P_DSI0PLL] = 2, - [P_DSI1PLL] = 3, +static const struct parent_map mmcc_xo_mmpll0_dsi_hdmi_gpll0_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_HDMIPLL, 4 }, + { P_GPLL0, 5 }, + { P_DSI0PLL, 2 }, + { P_DSI1PLL, 3 } }; static const char *mmcc_xo_mmpll0_dsi_hdmi_gpll0[] = { @@ -76,12 +78,12 @@ static const char *mmcc_xo_mmpll0_dsi_hdmi_gpll0[] = { "dsi1pll", }; -static const u8 mmcc_xo_mmpll0_1_2_gpll0_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_MMPLL1] = 2, - [P_GPLL0] = 5, - [P_MMPLL2] = 3, +static const struct parent_map mmcc_xo_mmpll0_1_2_gpll0_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_MMPLL1, 2 }, + { P_GPLL0, 5 }, + { P_MMPLL2, 3 } }; static const char *mmcc_xo_mmpll0_1_2_gpll0[] = { @@ -92,12 +94,12 @@ static const char *mmcc_xo_mmpll0_1_2_gpll0[] = { "mmpll2", }; -static const u8 mmcc_xo_mmpll0_1_3_gpll0_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_MMPLL1] = 2, - [P_GPLL0] = 5, - [P_MMPLL3] = 3, +static const struct parent_map mmcc_xo_mmpll0_1_3_gpll0_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_MMPLL1, 2 }, + { P_GPLL0, 5 }, + { P_MMPLL3, 3 } }; static const char *mmcc_xo_mmpll0_1_3_gpll0[] = { @@ -108,13 +110,13 @@ static const char *mmcc_xo_mmpll0_1_3_gpll0[] = { "mmpll3", }; -static const u8 mmcc_xo_dsi_hdmi_edp_map[] = { - [P_XO] = 0, - [P_EDPLINK] = 4, - [P_HDMIPLL] = 3, - [P_EDPVCO] = 5, - [P_DSI0PLL] = 1, - [P_DSI1PLL] = 2, +static const struct parent_map mmcc_xo_dsi_hdmi_edp_map[] = { + { P_XO, 0 }, + { P_EDPLINK, 4 }, + { P_HDMIPLL, 3 }, + { P_EDPVCO, 5 }, + { P_DSI0PLL, 1 }, + { P_DSI1PLL, 2 } }; static const char *mmcc_xo_dsi_hdmi_edp[] = { @@ -126,13 +128,13 @@ static const char *mmcc_xo_dsi_hdmi_edp[] = { "dsi1pll", }; -static const u8 mmcc_xo_dsi_hdmi_edp_gpll0_map[] = { - [P_XO] = 0, - [P_EDPLINK] = 4, - [P_HDMIPLL] = 3, - [P_GPLL0] = 5, - [P_DSI0PLL] = 1, - [P_DSI1PLL] = 2, +static const struct parent_map mmcc_xo_dsi_hdmi_edp_gpll0_map[] = { + { P_XO, 0 }, + { P_EDPLINK, 4 }, + { P_HDMIPLL, 3 }, + { P_GPLL0, 5 }, + { P_DSI0PLL, 1 }, + { P_DSI1PLL, 2 } }; static const char *mmcc_xo_dsi_hdmi_edp_gpll0[] = { @@ -144,13 +146,13 @@ static const char *mmcc_xo_dsi_hdmi_edp_gpll0[] = { "dsi1pll", }; -static const u8 mmcc_xo_dsibyte_hdmi_edp_gpll0_map[] = { - [P_XO] = 0, - [P_EDPLINK] = 4, - [P_HDMIPLL] = 3, - [P_GPLL0] = 5, - [P_DSI0PLL_BYTE] = 1, - [P_DSI1PLL_BYTE] = 2, +static const struct parent_map mmcc_xo_dsibyte_hdmi_edp_gpll0_map[] = { + { P_XO, 0 }, + { P_EDPLINK, 4 }, + { P_HDMIPLL, 3 }, + { P_GPLL0, 5 }, + { P_DSI0PLL_BYTE, 1 }, + { P_DSI1PLL_BYTE, 2 } }; static const char *mmcc_xo_dsibyte_hdmi_edp_gpll0[] = { @@ -162,12 +164,12 @@ static const char *mmcc_xo_dsibyte_hdmi_edp_gpll0[] = { "dsi1pllbyte", }; -static const u8 mmcc_xo_mmpll0_1_4_gpll0_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_MMPLL1] = 2, - [P_GPLL0] = 5, - [P_MMPLL4] = 3, +static const struct parent_map mmcc_xo_mmpll0_1_4_gpll0_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_MMPLL1, 2 }, + { P_GPLL0, 5 }, + { P_MMPLL4, 3 } }; static const char *mmcc_xo_mmpll0_1_4_gpll0[] = { @@ -178,13 +180,13 @@ static const char *mmcc_xo_mmpll0_1_4_gpll0[] = { "gpll0", }; -static const u8 mmcc_xo_mmpll0_1_4_gpll1_0_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_MMPLL1] = 2, - [P_MMPLL4] = 3, - [P_GPLL0] = 5, - [P_GPLL1] = 4, +static const struct parent_map mmcc_xo_mmpll0_1_4_gpll1_0_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_MMPLL1, 2 }, + { P_MMPLL4, 3 }, + { P_GPLL0, 5 }, + { P_GPLL1, 4 } }; static const char *mmcc_xo_mmpll0_1_4_gpll1_0[] = { @@ -196,14 +198,14 @@ static const char *mmcc_xo_mmpll0_1_4_gpll1_0[] = { "gpll0", }; -static const u8 mmcc_xo_mmpll0_1_4_gpll1_0_sleep_map[] = { - [P_XO] = 0, - [P_MMPLL0] = 1, - [P_MMPLL1] = 2, - [P_MMPLL4] = 3, - [P_GPLL0] = 5, - [P_GPLL1] = 4, - [P_MMSLEEP] = 6, +static const struct parent_map mmcc_xo_mmpll0_1_4_gpll1_0_sleep_map[] = { + { P_XO, 0 }, + { P_MMPLL0, 1 }, + { P_MMPLL1, 2 }, + { P_MMPLL4, 3 }, + { P_GPLL0, 5 }, + { P_GPLL1, 4 }, + { P_MMSLEEP, 6 } }; static const char *mmcc_xo_mmpll0_1_4_gpll1_0_sleep[] = { |