summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2018-03-06 09:33:09 -0500
committerSylwester Nawrocki <s.nawrocki@samsung.com>2018-03-06 11:39:16 -0500
commitec4016ff6e60fffab2e34fe87578c6362147cb98 (patch)
tree4574de4d8afc60c5765bfc48e43484a06f4f06a2 /drivers
parentb06a532bf1fa99af0d9364e5dfb8654fa78d490b (diff)
clk: samsung: exynos5420: Move PD-dependent clocks to Exynos5 sub-CMU
Clocks related to DISP, GSC and MFC blocks require special handling for power domain turn on/off sequences. Till now this was handled by Exynos power domain driver, but that approach was limited only to some special cases. This patch moves handling of those operations to clock controller driver. This gives more flexibility and allows fine tune values of some clock-specific registers. This patch moves handling of those mentioned clocks to Exynos5 sub-CMU driver instantiated from Exynos5420 driver. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/samsung/Makefile1
-rw-r--r--drivers/clk/samsung/clk-exynos5-subcmu.c2
-rw-r--r--drivers/clk/samsung/clk-exynos5420.c121
-rw-r--r--drivers/soc/samsung/pm_domains.c2
4 files changed, 100 insertions, 26 deletions
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index ef8900bc077f..b23d6cfac723 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o
11obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o 11obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o
12obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o 12obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o
13obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o 13obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
14obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5-subcmu.o
14obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o 15obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o
15obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o 16obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
16obj-$(CONFIG_EXYNOS_AUDSS_CLK_CON) += clk-exynos-audss.o 17obj-$(CONFIG_EXYNOS_AUDSS_CLK_CON) += clk-exynos-audss.o
diff --git a/drivers/clk/samsung/clk-exynos5-subcmu.c b/drivers/clk/samsung/clk-exynos5-subcmu.c
index ac3983c8adf2..bea10f4b3ee2 100644
--- a/drivers/clk/samsung/clk-exynos5-subcmu.c
+++ b/drivers/clk/samsung/clk-exynos5-subcmu.c
@@ -165,6 +165,8 @@ static int __init exynos5_clk_probe(struct platform_device *pdev)
165} 165}
166 166
167static const struct of_device_id exynos5_clk_of_match[] = { 167static const struct of_device_id exynos5_clk_of_match[] = {
168 { .compatible = "samsung,exynos5420-clock", },
169 { .compatible = "samsung,exynos5800-clock", },
168 { }, 170 { },
169}; 171};
170 172
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
index 6b10b70f7d72..c7b0f55dfbb6 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -19,6 +19,7 @@
19 19
20#include "clk.h" 20#include "clk.h"
21#include "clk-cpu.h" 21#include "clk-cpu.h"
22#include "clk-exynos5-subcmu.h"
22 23
23#define APLL_LOCK 0x0 24#define APLL_LOCK 0x0
24#define APLL_CON0 0x100 25#define APLL_CON0 0x100
@@ -863,7 +864,6 @@ static const struct samsung_div_clock exynos5x_div_clks[] __initconst = {
863 DIV(0, "dout_mipi1", "mout_mipi1", DIV_DISP10, 16, 8), 864 DIV(0, "dout_mipi1", "mout_mipi1", DIV_DISP10, 16, 8),
864 DIV(0, "dout_dp1", "mout_dp1", DIV_DISP10, 24, 4), 865 DIV(0, "dout_dp1", "mout_dp1", DIV_DISP10, 24, 4),
865 DIV(CLK_DOUT_PIXEL, "dout_hdmi_pixel", "mout_pixel", DIV_DISP10, 28, 4), 866 DIV(CLK_DOUT_PIXEL, "dout_hdmi_pixel", "mout_pixel", DIV_DISP10, 28, 4),
866 DIV(0, "dout_disp1_blk", "aclk200_disp1", DIV2_RATIO0, 16, 2),
867 DIV(CLK_DOUT_ACLK400_DISP1, "dout_aclk400_disp1", 867 DIV(CLK_DOUT_ACLK400_DISP1, "dout_aclk400_disp1",
868 "mout_aclk400_disp1", DIV_TOP2, 4, 3), 868 "mout_aclk400_disp1", DIV_TOP2, 4, 3),
869 869
@@ -912,8 +912,6 @@ static const struct samsung_div_clock exynos5x_div_clks[] __initconst = {
912 DIV(0, "dout_spi1", "mout_spi1", DIV_PERIC1, 24, 4), 912 DIV(0, "dout_spi1", "mout_spi1", DIV_PERIC1, 24, 4),
913 DIV(0, "dout_spi2", "mout_spi2", DIV_PERIC1, 28, 4), 913 DIV(0, "dout_spi2", "mout_spi2", DIV_PERIC1, 28, 4),
914 914
915 /* Mfc Block */
916 DIV(0, "dout_mfc_blk", "mout_user_aclk333", DIV4_RATIO, 0, 2),
917 915
918 /* PCM */ 916 /* PCM */
919 DIV(0, "dout_pcm1", "dout_audio1", DIV_PERIC2, 16, 8), 917 DIV(0, "dout_pcm1", "dout_audio1", DIV_PERIC2, 16, 8),
@@ -932,8 +930,6 @@ static const struct samsung_div_clock exynos5x_div_clks[] __initconst = {
932 DIV(0, "dout_spi2_pre", "dout_spi2", DIV_PERIC4, 24, 8), 930 DIV(0, "dout_spi2_pre", "dout_spi2", DIV_PERIC4, 24, 8),
933 931
934 /* GSCL Block */ 932 /* GSCL Block */
935 DIV(0, "dout_gscl_blk_300", "mout_user_aclk300_gscl",
936 DIV2_RATIO0, 4, 2),
937 DIV(0, "dout_gscl_blk_333", "aclk333_432_gscl", DIV2_RATIO0, 6, 2), 933 DIV(0, "dout_gscl_blk_333", "aclk333_432_gscl", DIV2_RATIO0, 6, 2),
938 934
939 /* MSCL Block */ 935 /* MSCL Block */
@@ -1190,8 +1186,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = {
1190 GATE(CLK_SCLK_GSCL_WB, "sclk_gscl_wb", "mout_user_aclk333_432_gscl", 1186 GATE(CLK_SCLK_GSCL_WB, "sclk_gscl_wb", "mout_user_aclk333_432_gscl",
1191 GATE_TOP_SCLK_GSCL, 7, 0, 0), 1187 GATE_TOP_SCLK_GSCL, 7, 0, 0),
1192 1188
1193 GATE(CLK_GSCL0, "gscl0", "aclk300_gscl", GATE_IP_GSCL0, 0, 0, 0),
1194 GATE(CLK_GSCL1, "gscl1", "aclk300_gscl", GATE_IP_GSCL0, 1, 0, 0),
1195 GATE(CLK_FIMC_3AA, "fimc_3aa", "aclk333_432_gscl", 1189 GATE(CLK_FIMC_3AA, "fimc_3aa", "aclk333_432_gscl",
1196 GATE_IP_GSCL0, 4, 0, 0), 1190 GATE_IP_GSCL0, 4, 0, 0),
1197 GATE(CLK_FIMC_LITE0, "fimc_lite0", "aclk333_432_gscl", 1191 GATE(CLK_FIMC_LITE0, "fimc_lite0", "aclk333_432_gscl",
@@ -1205,10 +1199,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = {
1205 GATE_IP_GSCL1, 3, 0, 0), 1199 GATE_IP_GSCL1, 3, 0, 0),
1206 GATE(CLK_SMMU_FIMCL1, "smmu_fimcl1", "dout_gscl_blk_333", 1200 GATE(CLK_SMMU_FIMCL1, "smmu_fimcl1", "dout_gscl_blk_333",
1207 GATE_IP_GSCL1, 4, 0, 0), 1201 GATE_IP_GSCL1, 4, 0, 0),
1208 GATE(CLK_SMMU_GSCL0, "smmu_gscl0", "dout_gscl_blk_300",
1209 GATE_IP_GSCL1, 6, 0, 0),
1210 GATE(CLK_SMMU_GSCL1, "smmu_gscl1", "dout_gscl_blk_300",
1211 GATE_IP_GSCL1, 7, 0, 0),
1212 GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, 0, 0), 1202 GATE(CLK_GSCL_WA, "gscl_wa", "sclk_gscl_wa", GATE_IP_GSCL1, 12, 0, 0),
1213 GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, 0, 0), 1203 GATE(CLK_GSCL_WB, "gscl_wb", "sclk_gscl_wb", GATE_IP_GSCL1, 13, 0, 0),
1214 GATE(CLK_SMMU_FIMCL3, "smmu_fimcl3,", "dout_gscl_blk_333", 1204 GATE(CLK_SMMU_FIMCL3, "smmu_fimcl3,", "dout_gscl_blk_333",
@@ -1227,18 +1217,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = {
1227 GATE(CLK_SMMU_MSCL2, "smmu_mscl2", "dout_mscl_blk", 1217 GATE(CLK_SMMU_MSCL2, "smmu_mscl2", "dout_mscl_blk",
1228 GATE_IP_MSCL, 10, 0, 0), 1218 GATE_IP_MSCL, 10, 0, 0),
1229 1219
1230 GATE(CLK_FIMD1, "fimd1", "aclk300_disp1", GATE_IP_DISP1, 0, 0, 0),
1231 GATE(CLK_DSIM1, "dsim1", "aclk200_disp1", GATE_IP_DISP1, 3, 0, 0),
1232 GATE(CLK_DP1, "dp1", "aclk200_disp1", GATE_IP_DISP1, 4, 0, 0),
1233 GATE(CLK_MIXER, "mixer", "aclk200_disp1", GATE_IP_DISP1, 5, 0, 0),
1234 GATE(CLK_HDMI, "hdmi", "aclk200_disp1", GATE_IP_DISP1, 6, 0, 0),
1235 GATE(CLK_SMMU_FIMD1M0, "smmu_fimd1m0", "dout_disp1_blk",
1236 GATE_IP_DISP1, 7, 0, 0),
1237 GATE(CLK_SMMU_FIMD1M1, "smmu_fimd1m1", "dout_disp1_blk",
1238 GATE_IP_DISP1, 8, 0, 0),
1239 GATE(CLK_SMMU_MIXER, "smmu_mixer", "aclk200_disp1",
1240 GATE_IP_DISP1, 9, 0, 0),
1241
1242 /* ISP */ 1220 /* ISP */
1243 GATE(CLK_SCLK_UART_ISP, "sclk_uart_isp", "dout_uart_isp", 1221 GATE(CLK_SCLK_UART_ISP, "sclk_uart_isp", "dout_uart_isp",
1244 GATE_TOP_SCLK_ISP, 0, CLK_SET_RATE_PARENT, 0), 1222 GATE_TOP_SCLK_ISP, 0, CLK_SET_RATE_PARENT, 0),
@@ -1255,11 +1233,98 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = {
1255 GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "dout_isp_sensor2", 1233 GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "dout_isp_sensor2",
1256 GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0), 1234 GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0),
1257 1235
1236 GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
1237};
1238
1239static const struct samsung_div_clock exynos5x_disp_div_clks[] __initconst = {
1240 DIV(0, "dout_disp1_blk", "aclk200_disp1", DIV2_RATIO0, 16, 2),
1241};
1242
1243static const struct samsung_gate_clock exynos5x_disp_gate_clks[] __initconst = {
1244 GATE(CLK_FIMD1, "fimd1", "aclk300_disp1", GATE_IP_DISP1, 0, 0, 0),
1245 GATE(CLK_DSIM1, "dsim1", "aclk200_disp1", GATE_IP_DISP1, 3, 0, 0),
1246 GATE(CLK_DP1, "dp1", "aclk200_disp1", GATE_IP_DISP1, 4, 0, 0),
1247 GATE(CLK_MIXER, "mixer", "aclk200_disp1", GATE_IP_DISP1, 5, 0, 0),
1248 GATE(CLK_HDMI, "hdmi", "aclk200_disp1", GATE_IP_DISP1, 6, 0, 0),
1249 GATE(CLK_SMMU_FIMD1M0, "smmu_fimd1m0", "dout_disp1_blk",
1250 GATE_IP_DISP1, 7, 0, 0),
1251 GATE(CLK_SMMU_FIMD1M1, "smmu_fimd1m1", "dout_disp1_blk",
1252 GATE_IP_DISP1, 8, 0, 0),
1253 GATE(CLK_SMMU_MIXER, "smmu_mixer", "aclk200_disp1",
1254 GATE_IP_DISP1, 9, 0, 0),
1255};
1256
1257static struct exynos5_subcmu_reg_dump exynos5x_disp_suspend_regs[] = {
1258 { GATE_IP_DISP1, 0xffffffff, 0xffffffff }, /* DISP1 gates */
1259 { SRC_TOP5, 0, BIT(0) }, /* MUX mout_user_aclk400_disp1 */
1260 { SRC_TOP5, 0, BIT(24) }, /* MUX mout_user_aclk300_disp1 */
1261 { SRC_TOP3, 0, BIT(8) }, /* MUX mout_user_aclk200_disp1 */
1262 { DIV2_RATIO0, 0, 0x30000 }, /* DIV dout_disp1_blk */
1263};
1264
1265static const struct samsung_div_clock exynos5x_gsc_div_clks[] __initconst = {
1266 DIV(0, "dout_gscl_blk_300", "mout_user_aclk300_gscl",
1267 DIV2_RATIO0, 4, 2),
1268};
1269
1270static const struct samsung_gate_clock exynos5x_gsc_gate_clks[] __initconst = {
1271 GATE(CLK_GSCL0, "gscl0", "aclk300_gscl", GATE_IP_GSCL0, 0, 0, 0),
1272 GATE(CLK_GSCL1, "gscl1", "aclk300_gscl", GATE_IP_GSCL0, 1, 0, 0),
1273 GATE(CLK_SMMU_GSCL0, "smmu_gscl0", "dout_gscl_blk_300",
1274 GATE_IP_GSCL1, 6, 0, 0),
1275 GATE(CLK_SMMU_GSCL1, "smmu_gscl1", "dout_gscl_blk_300",
1276 GATE_IP_GSCL1, 7, 0, 0),
1277};
1278
1279static struct exynos5_subcmu_reg_dump exynos5x_gsc_suspend_regs[] = {
1280 { GATE_IP_GSCL0, 0x3, 0x3 }, /* GSC gates */
1281 { GATE_IP_GSCL1, 0xc0, 0xc0 }, /* GSC gates */
1282 { SRC_TOP5, 0, BIT(28) }, /* MUX mout_user_aclk300_gscl */
1283 { DIV2_RATIO0, 0, 0x30 }, /* DIV dout_gscl_blk_300 */
1284};
1285
1286static const struct samsung_div_clock exynos5x_mfc_div_clks[] __initconst = {
1287 DIV(0, "dout_mfc_blk", "mout_user_aclk333", DIV4_RATIO, 0, 2),
1288};
1289
1290static const struct samsung_gate_clock exynos5x_mfc_gate_clks[] __initconst = {
1258 GATE(CLK_MFC, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0), 1291 GATE(CLK_MFC, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0),
1259 GATE(CLK_SMMU_MFCL, "smmu_mfcl", "dout_mfc_blk", GATE_IP_MFC, 1, 0, 0), 1292 GATE(CLK_SMMU_MFCL, "smmu_mfcl", "dout_mfc_blk", GATE_IP_MFC, 1, 0, 0),
1260 GATE(CLK_SMMU_MFCR, "smmu_mfcr", "dout_mfc_blk", GATE_IP_MFC, 2, 0, 0), 1293 GATE(CLK_SMMU_MFCR, "smmu_mfcr", "dout_mfc_blk", GATE_IP_MFC, 2, 0, 0),
1294};
1261 1295
1262 GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0), 1296static struct exynos5_subcmu_reg_dump exynos5x_mfc_suspend_regs[] = {
1297 { GATE_IP_MFC, 0xffffffff, 0xffffffff }, /* MFC gates */
1298 { SRC_TOP4, 0, BIT(28) }, /* MUX mout_user_aclk333 */
1299 { DIV4_RATIO, 0, 0x3 }, /* DIV dout_mfc_blk */
1300};
1301
1302static const struct exynos5_subcmu_info exynos5x_subcmus[] = {
1303 {
1304 .div_clks = exynos5x_disp_div_clks,
1305 .nr_div_clks = ARRAY_SIZE(exynos5x_disp_div_clks),
1306 .gate_clks = exynos5x_disp_gate_clks,
1307 .nr_gate_clks = ARRAY_SIZE(exynos5x_disp_gate_clks),
1308 .suspend_regs = exynos5x_disp_suspend_regs,
1309 .nr_suspend_regs = ARRAY_SIZE(exynos5x_disp_suspend_regs),
1310 .pd_name = "DISP",
1311 }, {
1312 .div_clks = exynos5x_gsc_div_clks,
1313 .nr_div_clks = ARRAY_SIZE(exynos5x_gsc_div_clks),
1314 .gate_clks = exynos5x_gsc_gate_clks,
1315 .nr_gate_clks = ARRAY_SIZE(exynos5x_gsc_gate_clks),
1316 .suspend_regs = exynos5x_gsc_suspend_regs,
1317 .nr_suspend_regs = ARRAY_SIZE(exynos5x_gsc_suspend_regs),
1318 .pd_name = "GSC",
1319 }, {
1320 .div_clks = exynos5x_mfc_div_clks,
1321 .nr_div_clks = ARRAY_SIZE(exynos5x_mfc_div_clks),
1322 .gate_clks = exynos5x_mfc_gate_clks,
1323 .nr_gate_clks = ARRAY_SIZE(exynos5x_mfc_gate_clks),
1324 .suspend_regs = exynos5x_mfc_suspend_regs,
1325 .nr_suspend_regs = ARRAY_SIZE(exynos5x_mfc_suspend_regs),
1326 .pd_name = "MFC",
1327 },
1263}; 1328};
1264 1329
1265static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] __initconst = { 1330static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] __initconst = {
@@ -1472,6 +1537,8 @@ static void __init exynos5x_clk_init(struct device_node *np,
1472 exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0); 1537 exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0);
1473 1538
1474 exynos5420_clk_sleep_init(); 1539 exynos5420_clk_sleep_init();
1540 exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5x_subcmus),
1541 exynos5x_subcmus);
1475 1542
1476 samsung_clk_of_add_provider(np, ctx); 1543 samsung_clk_of_add_provider(np, ctx);
1477} 1544}
@@ -1480,10 +1547,12 @@ static void __init exynos5420_clk_init(struct device_node *np)
1480{ 1547{
1481 exynos5x_clk_init(np, EXYNOS5420); 1548 exynos5x_clk_init(np, EXYNOS5420);
1482} 1549}
1483CLK_OF_DECLARE(exynos5420_clk, "samsung,exynos5420-clock", exynos5420_clk_init); 1550CLK_OF_DECLARE_DRIVER(exynos5420_clk, "samsung,exynos5420-clock",
1551 exynos5420_clk_init);
1484 1552
1485static void __init exynos5800_clk_init(struct device_node *np) 1553static void __init exynos5800_clk_init(struct device_node *np)
1486{ 1554{
1487 exynos5x_clk_init(np, EXYNOS5800); 1555 exynos5x_clk_init(np, EXYNOS5800);
1488} 1556}
1489CLK_OF_DECLARE(exynos5800_clk, "samsung,exynos5800-clock", exynos5800_clk_init); 1557CLK_OF_DECLARE_DRIVER(exynos5800_clk, "samsung,exynos5800-clock",
1558 exynos5800_clk_init);
diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c
index cef30bdf19b1..f2d6d7a09c16 100644
--- a/drivers/soc/samsung/pm_domains.c
+++ b/drivers/soc/samsung/pm_domains.c
@@ -148,6 +148,8 @@ static __init const char *exynos_get_domain_name(struct device_node *node)
148} 148}
149 149
150static const char *soc_force_no_clk[] = { 150static const char *soc_force_no_clk[] = {
151 "samsung,exynos5420-clock",
152 "samsung,exynos5800-clock",
151}; 153};
152 154
153static __init int exynos4_pm_init_power_domain(void) 155static __init int exynos4_pm_init_power_domain(void)