[PATCH v3 07/12] clk: samsung: exynos5433: Add clocks for CMU_DISP domain

2015-01-20 Thread Chanwoo Choi
This patch adds the the mux/divider/gate clocks for CMU_DISP domain which
includes the clocks of Display IPs (DECON/HDMI/DSIM/MIXER). The CMU_DISP clocks
is used to need the source clock of CMU_MIF domain so, the CMU_MIF's clocks
related to CMU_DISP should be always on state.

Also, CMU_DISP must need the source clock of 'sclk_hdmi_spdif_disp'
from CMU_TOP domain. This patch adds the clocks of CMU_TOP related to HDMI.

Cc: Sylwester Nawrocki 
Cc: Tomasz Figa 
Signed-off-by: Chanwoo Choi 
Acked-by: Inki Dae 
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   9 +
 drivers/clk/samsung/clk-exynos5433.c   | 437 +
 include/dt-bindings/clock/exynos5433.h | 114 +-
 3 files changed, 559 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 27dd77b..8d3dad4 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -21,6 +21,8 @@ Required Properties:
 which generates clocks for USB/UFS/SDMMC/TSI/PDMA IPs.
   - "samsung,exynos5433-cmu-g2d"   - clock controller compatible for CMU_G2D
 which generates clocks for G2D/MDMA IPs.
+  - "samsung,exynos5433-cmu-disp"  - clock controller compatible for CMU_DISP
+which generates clocks for Display (DECON/HDMI/DSIM/MIXER) IPs.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -78,6 +80,13 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = <1>;
};
 
+   cmu_disp: clock-controller@0x13b9 {
+   compatible = "samsung,exynos5433-cmu-disp";
+   reg = <0x13b9 0x0c04>;
+   #clock-cells = <1>;
+   };
+
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 7e33c68..3a3e64b 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -245,6 +245,8 @@ PNAME(mout_sclk_audio1_p)   = { "ioclk_audiocdclk1", 
"fin_pll",
 PNAME(mout_sclk_audio0_p)  = { "ioclk_audiocdclk0", "fin_pll",
"mout_aud_pll_user_t",};
 
+PNAME(mout_sclk_hdmi_spdif_p)  = { "sclk_audio1", "ioclk_spdif_extclk", };
+
 static struct samsung_fixed_factor_clock top_fixed_factor_clks[] __initdata = {
FFACTOR(0, "oscclk_efuse_common", "fin_pll", 1, 1, 0),
 };
@@ -395,6 +397,10 @@ static struct samsung_mux_clock top_mux_clks[] __initdata 
= {
MUX_SEL_TOP_PERIC1, 4, 2),
MUX(CLK_MOUT_SCLK_AUDIO0, "mout_sclk_audio0", mout_sclk_audio0_p,
MUX_SEL_TOP_PERIC1, 0, 2),
+
+   /* MUX_SEL_TOP_DISP */
+   MUX(CLK_MOUT_SCLK_HDMI_SPDIF, "mout_sclk_hdmi_spdif",
+   mout_sclk_hdmi_spdif_p, MUX_SEL_TOP_DISP, 0, 1),
 };
 
 static struct samsung_div_clock top_div_clks[] __initdata = {
@@ -1360,6 +1366,11 @@ static struct samsung_gate_clock mif_gate_clks[] 
__initdata = {
ENABLE_SCLK_MIF, 1, CLK_IGNORE_UNUSED, 0),
GATE(CLK_SCLK_BUS_PLL_ATLAS, "sclk_bus_pll_atlas", "sclk_bus_pll",
ENABLE_SCLK_MIF, 0, CLK_IGNORE_UNUSED, 0),
+
+   /* ENABLE_SCLK_TOP_DISP */
+   GATE(CLK_SCLK_HDMI_SPDIF_DISP, "sclk_hdmi_spdif_disp",
+   "mout_sclk_hdmi_spdif", ENABLE_SCLK_TOP_DISP, 0,
+   CLK_IGNORE_UNUSED, 0),
 };
 
 static struct samsung_cmu_info mif_cmu_info __initdata = {
@@ -2022,3 +2033,429 @@ static void __init exynos5433_cmu_g2d_init(struct 
device_node *np)
 
 CLK_OF_DECLARE(exynos5433_cmu_g2d, "samsung,exynos5433-cmu-g2d",
exynos5433_cmu_g2d_init);
+
+/*
+ * Register offset definitions for CMU_DISP
+ */
+#define DISP_PLL_LOCK  0x
+#define DISP_PLL_CON0  0x0100
+#define DISP_PLL_CON1  0x0104
+#define DISP_PLL_FREQ_DET  0x0108
+#define MUX_SEL_DISP0  0x0200
+#define MUX_SEL_DISP1  0x0204
+#define MUX_SEL_DISP2  0x0208
+#define MUX_SEL_DISP3  0x020c
+#define MUX_SEL_DISP4  0x0210
+#define MUX_ENABLE_DISP0   0x0300
+#define MUX_ENABLE_DISP1   0x0304
+#define MUX_ENABLE_DISP2   0x0308
+#define MUX_ENABLE_DISP3   0x030c
+#define MUX_ENABLE_DISP4   0x0310
+#define MUX_STAT_DISP0 0x0400
+#define MUX_STAT_DISP1 0x0404
+#define MUX_STAT_DISP2 0x0408
+#define MUX_STAT_DISP3 0x040c
+#define MUX_STAT_DISP4 0x0410
+#define MUX_IGNORE_DISP2   0x0508
+#define DIV_DISP   0x0600
+#define DIV_DISP_PLL_FREQ_DET  0x0604

[PATCH v3 07/12] clk: samsung: exynos5433: Add clocks for CMU_DISP domain

2015-01-20 Thread Chanwoo Choi
This patch adds the the mux/divider/gate clocks for CMU_DISP domain which
includes the clocks of Display IPs (DECON/HDMI/DSIM/MIXER). The CMU_DISP clocks
is used to need the source clock of CMU_MIF domain so, the CMU_MIF's clocks
related to CMU_DISP should be always on state.

Also, CMU_DISP must need the source clock of 'sclk_hdmi_spdif_disp'
from CMU_TOP domain. This patch adds the clocks of CMU_TOP related to HDMI.

Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Tomasz Figa tomasz.f...@gmail.com
Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Acked-by: Inki Dae inki@samsung.com
---
 .../devicetree/bindings/clock/exynos5433-clock.txt |   9 +
 drivers/clk/samsung/clk-exynos5433.c   | 437 +
 include/dt-bindings/clock/exynos5433.h | 114 +-
 3 files changed, 559 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
index 27dd77b..8d3dad4 100644
--- a/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5433-clock.txt
@@ -21,6 +21,8 @@ Required Properties:
 which generates clocks for USB/UFS/SDMMC/TSI/PDMA IPs.
   - samsung,exynos5433-cmu-g2d   - clock controller compatible for CMU_G2D
 which generates clocks for G2D/MDMA IPs.
+  - samsung,exynos5433-cmu-disp  - clock controller compatible for CMU_DISP
+which generates clocks for Display (DECON/HDMI/DSIM/MIXER) IPs.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
@@ -78,6 +80,13 @@ Example 1: Examples of clock controller nodes are listed 
below.
#clock-cells = 1;
};
 
+   cmu_disp: clock-controller@0x13b9 {
+   compatible = samsung,exynos5433-cmu-disp;
+   reg = 0x13b9 0x0c04;
+   #clock-cells = 1;
+   };
+
+
 Example 2: UART controller node that consumes the clock generated by the clock
   controller.
 
diff --git a/drivers/clk/samsung/clk-exynos5433.c 
b/drivers/clk/samsung/clk-exynos5433.c
index 7e33c68..3a3e64b 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -245,6 +245,8 @@ PNAME(mout_sclk_audio1_p)   = { ioclk_audiocdclk1, 
fin_pll,
 PNAME(mout_sclk_audio0_p)  = { ioclk_audiocdclk0, fin_pll,
mout_aud_pll_user_t,};
 
+PNAME(mout_sclk_hdmi_spdif_p)  = { sclk_audio1, ioclk_spdif_extclk, };
+
 static struct samsung_fixed_factor_clock top_fixed_factor_clks[] __initdata = {
FFACTOR(0, oscclk_efuse_common, fin_pll, 1, 1, 0),
 };
@@ -395,6 +397,10 @@ static struct samsung_mux_clock top_mux_clks[] __initdata 
= {
MUX_SEL_TOP_PERIC1, 4, 2),
MUX(CLK_MOUT_SCLK_AUDIO0, mout_sclk_audio0, mout_sclk_audio0_p,
MUX_SEL_TOP_PERIC1, 0, 2),
+
+   /* MUX_SEL_TOP_DISP */
+   MUX(CLK_MOUT_SCLK_HDMI_SPDIF, mout_sclk_hdmi_spdif,
+   mout_sclk_hdmi_spdif_p, MUX_SEL_TOP_DISP, 0, 1),
 };
 
 static struct samsung_div_clock top_div_clks[] __initdata = {
@@ -1360,6 +1366,11 @@ static struct samsung_gate_clock mif_gate_clks[] 
__initdata = {
ENABLE_SCLK_MIF, 1, CLK_IGNORE_UNUSED, 0),
GATE(CLK_SCLK_BUS_PLL_ATLAS, sclk_bus_pll_atlas, sclk_bus_pll,
ENABLE_SCLK_MIF, 0, CLK_IGNORE_UNUSED, 0),
+
+   /* ENABLE_SCLK_TOP_DISP */
+   GATE(CLK_SCLK_HDMI_SPDIF_DISP, sclk_hdmi_spdif_disp,
+   mout_sclk_hdmi_spdif, ENABLE_SCLK_TOP_DISP, 0,
+   CLK_IGNORE_UNUSED, 0),
 };
 
 static struct samsung_cmu_info mif_cmu_info __initdata = {
@@ -2022,3 +2033,429 @@ static void __init exynos5433_cmu_g2d_init(struct 
device_node *np)
 
 CLK_OF_DECLARE(exynos5433_cmu_g2d, samsung,exynos5433-cmu-g2d,
exynos5433_cmu_g2d_init);
+
+/*
+ * Register offset definitions for CMU_DISP
+ */
+#define DISP_PLL_LOCK  0x
+#define DISP_PLL_CON0  0x0100
+#define DISP_PLL_CON1  0x0104
+#define DISP_PLL_FREQ_DET  0x0108
+#define MUX_SEL_DISP0  0x0200
+#define MUX_SEL_DISP1  0x0204
+#define MUX_SEL_DISP2  0x0208
+#define MUX_SEL_DISP3  0x020c
+#define MUX_SEL_DISP4  0x0210
+#define MUX_ENABLE_DISP0   0x0300
+#define MUX_ENABLE_DISP1   0x0304
+#define MUX_ENABLE_DISP2   0x0308
+#define MUX_ENABLE_DISP3   0x030c
+#define MUX_ENABLE_DISP4   0x0310
+#define MUX_STAT_DISP0 0x0400
+#define MUX_STAT_DISP1 0x0404
+#define MUX_STAT_DISP2 0x0408
+#define MUX_STAT_DISP3 0x040c
+#define MUX_STAT_DISP4 0x0410
+#define MUX_IGNORE_DISP2   0x0508
+#define DIV_DISP   0x0600
+#define