diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/kernel/setup.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 638da7b3a653..c05e5e3bad68 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -81,6 +81,8 @@ static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata; | |||
81 | 81 | ||
82 | DEFINE_PER_CPU(struct blackfin_cpudata, cpu_data); | 82 | DEFINE_PER_CPU(struct blackfin_cpudata, cpu_data); |
83 | 83 | ||
84 | static int early_init_clkin_hz(char *buf); | ||
85 | |||
84 | #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) | 86 | #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) |
85 | void __init generate_cplb_tables(void) | 87 | void __init generate_cplb_tables(void) |
86 | { | 88 | { |
@@ -436,6 +438,9 @@ static __init void parse_cmdline_early(char *cmdline_p) | |||
436 | reserved_mem_icache_on = 1; | 438 | reserved_mem_icache_on = 1; |
437 | } | 439 | } |
438 | } | 440 | } |
441 | } else if (!memcmp(to, "clkin_hz=", 9)) { | ||
442 | to += 9; | ||
443 | early_init_clkin_hz(to); | ||
439 | } else if (!memcmp(to, "earlyprintk=", 12)) { | 444 | } else if (!memcmp(to, "earlyprintk=", 12)) { |
440 | to += 12; | 445 | to += 12; |
441 | setup_early_printk(to); | 446 | setup_early_printk(to); |
@@ -937,6 +942,19 @@ static int __init topology_init(void) | |||
937 | 942 | ||
938 | subsys_initcall(topology_init); | 943 | subsys_initcall(topology_init); |
939 | 944 | ||
945 | /* Get the input clock frequency */ | ||
946 | static u_long cached_clkin_hz = CONFIG_CLKIN_HZ; | ||
947 | static u_long get_clkin_hz(void) | ||
948 | { | ||
949 | return cached_clkin_hz; | ||
950 | } | ||
951 | static int __init early_init_clkin_hz(char *buf) | ||
952 | { | ||
953 | cached_clkin_hz = simple_strtoul(buf, NULL, 0); | ||
954 | return 1; | ||
955 | } | ||
956 | early_param("clkin_hz=", early_init_clkin_hz); | ||
957 | |||
940 | /* Get the voltage input multiplier */ | 958 | /* Get the voltage input multiplier */ |
941 | static u_long cached_vco_pll_ctl, cached_vco; | 959 | static u_long cached_vco_pll_ctl, cached_vco; |
942 | static u_long get_vco(void) | 960 | static u_long get_vco(void) |
@@ -953,7 +971,7 @@ static u_long get_vco(void) | |||
953 | if (0 == msel) | 971 | if (0 == msel) |
954 | msel = 64; | 972 | msel = 64; |
955 | 973 | ||
956 | cached_vco = CONFIG_CLKIN_HZ; | 974 | cached_vco = get_clkin_hz(); |
957 | cached_vco >>= (1 & pll_ctl); /* DF bit */ | 975 | cached_vco >>= (1 & pll_ctl); /* DF bit */ |
958 | cached_vco *= msel; | 976 | cached_vco *= msel; |
959 | return cached_vco; | 977 | return cached_vco; |
@@ -966,7 +984,7 @@ u_long get_cclk(void) | |||
966 | u_long csel, ssel; | 984 | u_long csel, ssel; |
967 | 985 | ||
968 | if (bfin_read_PLL_STAT() & 0x1) | 986 | if (bfin_read_PLL_STAT() & 0x1) |
969 | return CONFIG_CLKIN_HZ; | 987 | return get_clkin_hz(); |
970 | 988 | ||
971 | ssel = bfin_read_PLL_DIV(); | 989 | ssel = bfin_read_PLL_DIV(); |
972 | if (ssel == cached_cclk_pll_div) | 990 | if (ssel == cached_cclk_pll_div) |
@@ -991,7 +1009,7 @@ u_long get_sclk(void) | |||
991 | u_long ssel; | 1009 | u_long ssel; |
992 | 1010 | ||
993 | if (bfin_read_PLL_STAT() & 0x1) | 1011 | if (bfin_read_PLL_STAT() & 0x1) |
994 | return CONFIG_CLKIN_HZ; | 1012 | return get_clkin_hz(); |
995 | 1013 | ||
996 | ssel = bfin_read_PLL_DIV(); | 1014 | ssel = bfin_read_PLL_DIV(); |
997 | if (ssel == cached_sclk_pll_div) | 1015 | if (ssel == cached_sclk_pll_div) |