diff options
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/samsung/clk-exynos4.c | 93 | ||||
-rw-r--r-- | drivers/clk/samsung/clk-exynos5250.c | 1 | ||||
-rw-r--r-- | drivers/clk/samsung/clk-exynos5440.c | 1 | ||||
-rw-r--r-- | drivers/clk/samsung/clk.h | 2 |
4 files changed, 42 insertions, 55 deletions
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index 71046694d9dd..d0940e69d034 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | #include <linux/of_address.h> | 17 | #include <linux/of_address.h> |
18 | 18 | ||
19 | #include <plat/cpu.h> | ||
20 | #include "clk.h" | 19 | #include "clk.h" |
21 | #include "clk-pll.h" | 20 | #include "clk-pll.h" |
22 | 21 | ||
@@ -910,16 +909,6 @@ struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { | |||
910 | CLK_IGNORE_UNUSED, 0), | 909 | CLK_IGNORE_UNUSED, 0), |
911 | }; | 910 | }; |
912 | 911 | ||
913 | #ifdef CONFIG_OF | ||
914 | static struct of_device_id exynos4_clk_ids[] __initdata = { | ||
915 | { .compatible = "samsung,exynos4210-clock", | ||
916 | .data = (void *)EXYNOS4210, }, | ||
917 | { .compatible = "samsung,exynos4412-clock", | ||
918 | .data = (void *)EXYNOS4X12, }, | ||
919 | { }, | ||
920 | }; | ||
921 | #endif | ||
922 | |||
923 | /* | 912 | /* |
924 | * The parent of the fin_pll clock is selected by the XOM[0] bit. This bit | 913 | * The parent of the fin_pll clock is selected by the XOM[0] bit. This bit |
925 | * resides in chipid register space, outside of the clock controller memory | 914 | * resides in chipid register space, outside of the clock controller memory |
@@ -927,33 +916,40 @@ static struct of_device_id exynos4_clk_ids[] __initdata = { | |||
927 | * controller is first remapped and the value of XOM[0] bit is read to | 916 | * controller is first remapped and the value of XOM[0] bit is read to |
928 | * determine the parent clock. | 917 | * determine the parent clock. |
929 | */ | 918 | */ |
930 | static void __init exynos4_clk_register_finpll(void) | 919 | static unsigned long exynos4_get_xom(void) |
931 | { | 920 | { |
932 | struct samsung_fixed_rate_clock fclk; | 921 | unsigned long xom = 0; |
922 | void __iomem *chipid_base; | ||
933 | struct device_node *np; | 923 | struct device_node *np; |
934 | struct clk *clk; | ||
935 | void __iomem *chipid_base = S5P_VA_CHIPID; | ||
936 | unsigned long xom, finpll_f = 24000000; | ||
937 | char *parent_name; | ||
938 | 924 | ||
939 | np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-chipid"); | 925 | np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-chipid"); |
940 | if (np) | 926 | if (np) { |
941 | chipid_base = of_iomap(np, 0); | 927 | chipid_base = of_iomap(np, 0); |
942 | 928 | ||
943 | if (chipid_base) { | 929 | if (chipid_base) |
944 | xom = readl(chipid_base + 8); | 930 | xom = readl(chipid_base + 8); |
945 | parent_name = xom & 1 ? "xusbxti" : "xxti"; | 931 | |
946 | clk = clk_get(NULL, parent_name); | 932 | iounmap(chipid_base); |
947 | if (IS_ERR(clk)) { | 933 | } |
948 | pr_err("%s: failed to lookup parent clock %s, assuming " | 934 | |
949 | "fin_pll clock frequency is 24MHz\n", __func__, | 935 | return xom; |
950 | parent_name); | 936 | } |
951 | } else { | 937 | |
952 | finpll_f = clk_get_rate(clk); | 938 | static void __init exynos4_clk_register_finpll(unsigned long xom) |
953 | } | 939 | { |
940 | struct samsung_fixed_rate_clock fclk; | ||
941 | struct clk *clk; | ||
942 | unsigned long finpll_f = 24000000; | ||
943 | char *parent_name; | ||
944 | |||
945 | parent_name = xom & 1 ? "xusbxti" : "xxti"; | ||
946 | clk = clk_get(NULL, parent_name); | ||
947 | if (IS_ERR(clk)) { | ||
948 | pr_err("%s: failed to lookup parent clock %s, assuming " | ||
949 | "fin_pll clock frequency is 24MHz\n", __func__, | ||
950 | parent_name); | ||
954 | } else { | 951 | } else { |
955 | pr_err("%s: failed to map chipid registers, assuming " | 952 | finpll_f = clk_get_rate(clk); |
956 | "fin_pll clock frequency is 24MHz\n", __func__); | ||
957 | } | 953 | } |
958 | 954 | ||
959 | fclk.id = fin_pll; | 955 | fclk.id = fin_pll; |
@@ -963,8 +959,6 @@ static void __init exynos4_clk_register_finpll(void) | |||
963 | fclk.fixed_rate = finpll_f; | 959 | fclk.fixed_rate = finpll_f; |
964 | samsung_clk_register_fixed_rate(&fclk, 1); | 960 | samsung_clk_register_fixed_rate(&fclk, 1); |
965 | 961 | ||
966 | if (np) | ||
967 | iounmap(chipid_base); | ||
968 | } | 962 | } |
969 | 963 | ||
970 | /* | 964 | /* |
@@ -988,28 +982,14 @@ static __initdata struct of_device_id ext_clk_match[] = { | |||
988 | }; | 982 | }; |
989 | 983 | ||
990 | /* register exynos4 clocks */ | 984 | /* register exynos4 clocks */ |
991 | void __init exynos4_clk_init(struct device_node *np) | 985 | void __init exynos4_clk_init(struct device_node *np, enum exynos4_soc exynos4_soc, void __iomem *reg_base, unsigned long xom) |
992 | { | 986 | { |
993 | void __iomem *reg_base; | ||
994 | struct clk *apll, *mpll, *epll, *vpll; | 987 | struct clk *apll, *mpll, *epll, *vpll; |
995 | u32 exynos4_soc; | ||
996 | 988 | ||
997 | if (np) { | 989 | if (np) { |
998 | const struct of_device_id *match; | ||
999 | match = of_match_node(exynos4_clk_ids, np); | ||
1000 | exynos4_soc = (u32)match->data; | ||
1001 | |||
1002 | reg_base = of_iomap(np, 0); | 990 | reg_base = of_iomap(np, 0); |
1003 | if (!reg_base) | 991 | if (!reg_base) |
1004 | panic("%s: failed to map registers\n", __func__); | 992 | panic("%s: failed to map registers\n", __func__); |
1005 | } else { | ||
1006 | reg_base = S5P_VA_CMU; | ||
1007 | if (soc_is_exynos4210()) | ||
1008 | exynos4_soc = EXYNOS4210; | ||
1009 | else if (soc_is_exynos4212() || soc_is_exynos4412()) | ||
1010 | exynos4_soc = EXYNOS4X12; | ||
1011 | else | ||
1012 | panic("%s: unable to determine soc\n", __func__); | ||
1013 | } | 993 | } |
1014 | 994 | ||
1015 | if (exynos4_soc == EXYNOS4210) | 995 | if (exynos4_soc == EXYNOS4210) |
@@ -1026,7 +1006,7 @@ void __init exynos4_clk_init(struct device_node *np) | |||
1026 | ARRAY_SIZE(exynos4_fixed_rate_ext_clks), | 1006 | ARRAY_SIZE(exynos4_fixed_rate_ext_clks), |
1027 | ext_clk_match); | 1007 | ext_clk_match); |
1028 | 1008 | ||
1029 | exynos4_clk_register_finpll(); | 1009 | exynos4_clk_register_finpll(xom); |
1030 | 1010 | ||
1031 | if (exynos4_soc == EXYNOS4210) { | 1011 | if (exynos4_soc == EXYNOS4210) { |
1032 | apll = samsung_clk_register_pll45xx("fout_apll", "fin_pll", | 1012 | apll = samsung_clk_register_pll45xx("fout_apll", "fin_pll", |
@@ -1087,5 +1067,16 @@ void __init exynos4_clk_init(struct device_node *np) | |||
1087 | _get_rate("sclk_epll"), _get_rate("sclk_vpll"), | 1067 | _get_rate("sclk_epll"), _get_rate("sclk_vpll"), |
1088 | _get_rate("arm_clk")); | 1068 | _get_rate("arm_clk")); |
1089 | } | 1069 | } |
1090 | CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4_clk_init); | 1070 | |
1091 | CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4_clk_init); | 1071 | |
1072 | static void __init exynos4210_clk_init(struct device_node *np) | ||
1073 | { | ||
1074 | exynos4_clk_init(np, EXYNOS4210, NULL, exynos4_get_xom()); | ||
1075 | } | ||
1076 | CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4210_clk_init); | ||
1077 | |||
1078 | static void __init exynos4412_clk_init(struct device_node *np) | ||
1079 | { | ||
1080 | exynos4_clk_init(np, EXYNOS4X12, NULL, exynos4_get_xom()); | ||
1081 | } | ||
1082 | CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4412_clk_init); | ||
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index bb54606ff035..5c97e75924a8 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | #include <linux/of_address.h> | 17 | #include <linux/of_address.h> |
18 | 18 | ||
19 | #include <plat/cpu.h> | ||
20 | #include "clk.h" | 19 | #include "clk.h" |
21 | #include "clk-pll.h" | 20 | #include "clk-pll.h" |
22 | 21 | ||
diff --git a/drivers/clk/samsung/clk-exynos5440.c b/drivers/clk/samsung/clk-exynos5440.c index a0a094c06f19..7d5434167a96 100644 --- a/drivers/clk/samsung/clk-exynos5440.c +++ b/drivers/clk/samsung/clk-exynos5440.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_address.h> | 16 | #include <linux/of_address.h> |
17 | 17 | ||
18 | #include <plat/cpu.h> | ||
19 | #include "clk.h" | 18 | #include "clk.h" |
20 | #include "clk-pll.h" | 19 | #include "clk-pll.h" |
21 | 20 | ||
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 10b2111f0c0f..e4ad6ea9aa76 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h | |||
@@ -20,8 +20,6 @@ | |||
20 | #include <linux/of.h> | 20 | #include <linux/of.h> |
21 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
22 | 22 | ||
23 | #include <mach/map.h> | ||
24 | |||
25 | /** | 23 | /** |
26 | * struct samsung_clock_alias: information about mux clock | 24 | * struct samsung_clock_alias: information about mux clock |
27 | * @id: platform specific id of the clock. | 25 | * @id: platform specific id of the clock. |