blob: 9af40310b46fccfa726238c865aba49ef5efc2b3 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
wdenk9c53f402003-10-15 23:53:47 +00002/*
Dipen Dudhat5d51bf92011-01-19 12:46:27 +05303 * Copyright 2004, 2007-2011 Freescale Semiconductor, Inc.
Kumar Galadccd9e32009-03-19 02:46:19 -05004 *
wdenk9c53f402003-10-15 23:53:47 +00005 * (C) Copyright 2003 Motorola Inc.
6 * Xianghua Xiao, (X.Xiao@motorola.com)
7 *
8 * (C) Copyright 2000
9 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk9c53f402003-10-15 23:53:47 +000010 */
11
12#include <common.h>
Simon Glass33d1e702019-11-14 12:57:32 -070013#include <cpu_func.h>
Tom Rinif7246c22021-08-21 13:50:17 -040014#include <clock_legacy.h>
wdenk9c53f402003-10-15 23:53:47 +000015#include <ppc_asm.tmpl>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Haiying Wang8cb2af72011-02-11 01:25:30 -060017#include <linux/compiler.h>
wdenk9c53f402003-10-15 23:53:47 +000018#include <asm/processor.h>
Trent Piepho0b691fc2008-12-03 15:16:37 -080019#include <asm/io.h>
wdenk9c53f402003-10-15 23:53:47 +000020
Wolfgang Denk6405a152006-03-31 18:32:53 +020021DECLARE_GLOBAL_DATA_PTR;
22
wdenk9c53f402003-10-15 23:53:47 +000023/* --------------------------------------------------------------- */
24
Prabhakar Kushwahad1698082013-08-16 14:52:26 +053025void get_sys_info(sys_info_t *sys_info)
wdenk9c53f402003-10-15 23:53:47 +000026{
Tom Rinid5c3bf22022-10-28 20:27:12 -040027 volatile ccsr_gur_t *gur = (void *)(CFG_SYS_MPC85xx_GUTS_ADDR);
Kumar Galadccd9e32009-03-19 02:46:19 -050028#ifdef CONFIG_FSL_CORENET
Tom Rini376b88a2022-10-28 20:27:13 -040029 volatile ccsr_clk_t *clk = (void *)(CFG_SYS_FSL_CORENET_CLK_ADDR);
Timur Tabi47289422011-08-05 16:15:24 -050030 unsigned int cpu;
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +053031#ifdef CONFIG_HETROGENOUS_CLUSTERS
32 unsigned int dsp_cpu;
33 uint rcw_tmp1, rcw_tmp2;
34#endif
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053035#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2
Tom Rini376b88a2022-10-28 20:27:13 -040036 int cc_group[12] = CFG_SYS_FSL_CLUSTER_CLOCKS;
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053037#endif
York Sun7c355f52014-10-27 11:31:33 -070038 __maybe_unused u32 svr;
Kumar Galadccd9e32009-03-19 02:46:19 -050039
40 const u8 core_cplx_PLL[16] = {
41 [ 0] = 0, /* CC1 PPL / 1 */
42 [ 1] = 0, /* CC1 PPL / 2 */
43 [ 2] = 0, /* CC1 PPL / 4 */
44 [ 4] = 1, /* CC2 PPL / 1 */
45 [ 5] = 1, /* CC2 PPL / 2 */
46 [ 6] = 1, /* CC2 PPL / 4 */
47 [ 8] = 2, /* CC3 PPL / 1 */
48 [ 9] = 2, /* CC3 PPL / 2 */
49 [10] = 2, /* CC3 PPL / 4 */
50 [12] = 3, /* CC4 PPL / 1 */
51 [13] = 3, /* CC4 PPL / 2 */
52 [14] = 3, /* CC4 PPL / 4 */
53 };
54
Prabhakar Kushwahad1698082013-08-16 14:52:26 +053055 const u8 core_cplx_pll_div[16] = {
Kumar Galadccd9e32009-03-19 02:46:19 -050056 [ 0] = 1, /* CC1 PPL / 1 */
57 [ 1] = 2, /* CC1 PPL / 2 */
58 [ 2] = 4, /* CC1 PPL / 4 */
59 [ 4] = 1, /* CC2 PPL / 1 */
60 [ 5] = 2, /* CC2 PPL / 2 */
61 [ 6] = 4, /* CC2 PPL / 4 */
62 [ 8] = 1, /* CC3 PPL / 1 */
63 [ 9] = 2, /* CC3 PPL / 2 */
64 [10] = 4, /* CC3 PPL / 4 */
65 [12] = 1, /* CC4 PPL / 1 */
66 [13] = 2, /* CC4 PPL / 2 */
67 [14] = 4, /* CC4 PPL / 4 */
68 };
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053069 uint i, freq_c_pll[CONFIG_SYS_FSL_NUM_CC_PLLS];
Tom Rinibf5fab32022-12-04 10:13:32 -050070#if !defined(CFG_FM_PLAT_CLK_DIV) || !defined(CFG_PME_PLAT_CLK_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053071 uint rcw_tmp;
72#endif
73 uint ratio[CONFIG_SYS_FSL_NUM_CC_PLLS];
Tom Rini8c70baa2021-12-14 13:36:40 -050074 unsigned long sysclk = get_board_sys_clk();
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +080075 uint mem_pll_rat;
Kumar Galadccd9e32009-03-19 02:46:19 -050076
Prabhakar Kushwahad1698082013-08-16 14:52:26 +053077 sys_info->freq_systembus = sysclk;
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053078#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
vijay raid84fd502014-04-15 11:34:12 +053079 uint ddr_refclk_sel;
80 unsigned int porsr1_sys_clk;
81 porsr1_sys_clk = in_be32(&gur->porsr1) >> FSL_DCFG_PORSR1_SYSCLK_SHIFT
82 & FSL_DCFG_PORSR1_SYSCLK_MASK;
83 if (porsr1_sys_clk == FSL_DCFG_PORSR1_SYSCLK_DIFF)
84 sys_info->diff_sysclk = 1;
85 else
86 sys_info->diff_sysclk = 0;
87
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053088 /*
89 * DDR_REFCLK_SEL rcw bit is used to determine if DDR PLLS
90 * are driven by separate DDR Refclock or single source
91 * differential clock.
92 */
vijay raid84fd502014-04-15 11:34:12 +053093 ddr_refclk_sel = (in_be32(&gur->rcwsr[5]) >>
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053094 FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_SHIFT) &
95 FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_MASK;
96 /*
vijay raid84fd502014-04-15 11:34:12 +053097 * For single source clocking, both ddrclock and sysclock
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053098 * are driven by differential sysclock.
99 */
vijay raid84fd502014-04-15 11:34:12 +0530100 if (ddr_refclk_sel == FSL_CORENET2_RCWSR5_DDR_REFCLK_SINGLE_CLK)
Tom Rini8c70baa2021-12-14 13:36:40 -0500101 sys_info->freq_ddrbus = get_board_sys_clk();
vijay raid84fd502014-04-15 11:34:12 +0530102 else
Priyanka Jaine9dcaa82013-12-17 14:25:52 +0530103#endif
Tom Rinif7246c22021-08-21 13:50:17 -0400104#if defined(CONFIG_DYNAMIC_DDR_CLK_FREQ) || defined(CONFIG_STATIC_DDR_CLK_FREQ)
105 sys_info->freq_ddrbus = get_board_ddr_clk();
York Sun3b5179f2012-10-08 07:44:31 +0000106#else
Priyanka Jaine9dcaa82013-12-17 14:25:52 +0530107 sys_info->freq_ddrbus = sysclk;
York Sun3b5179f2012-10-08 07:44:31 +0000108#endif
Kumar Galadccd9e32009-03-19 02:46:19 -0500109
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530110 sys_info->freq_systembus *= (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
York Sunb8a076b2012-10-08 07:44:09 +0000111 mem_pll_rat = (in_be32(&gur->rcwsr[0]) >>
112 FSL_CORENET_RCWSR0_MEM_PLL_RAT_SHIFT)
113 & FSL_CORENET_RCWSR0_MEM_PLL_RAT_MASK;
York Sun7b083df2014-03-28 15:07:27 -0700114#ifdef CONFIG_SYS_FSL_ERRATUM_A007212
115 if (mem_pll_rat == 0) {
116 mem_pll_rat = (in_be32(&gur->rcwsr[0]) >>
117 FSL_CORENET_RCWSR0_MEM_PLL_RAT_RESV_SHIFT) &
118 FSL_CORENET_RCWSR0_MEM_PLL_RAT_MASK;
119 }
120#endif
Zang Roy-R619111b1e5cf2013-11-28 13:23:37 +0800121 /* T4240/T4160 Rev2.0 MEM_PLL_RAT uses a value which is half of
122 * T4240/T4160 Rev1.0. eg. It's 12 in Rev1.0, however, for Rev2.0
123 * it uses 6.
York Sun7c355f52014-10-27 11:31:33 -0700124 * T2080 rev 1.1 and later also use half mem_pll comparing with rev 1.0
Zang Roy-R619111b1e5cf2013-11-28 13:23:37 +0800125 */
Tom Rinia7ffa3d2021-05-23 10:58:05 -0400126#if defined(CONFIG_ARCH_T4240) || defined(CONFIG_ARCH_T2080)
York Sun7c355f52014-10-27 11:31:33 -0700127 svr = get_svr();
128 switch (SVR_SOC_VER(svr)) {
129 case SVR_T4240:
130 case SVR_T4160:
131 case SVR_T4120:
132 case SVR_T4080:
133 if (SVR_MAJ(svr) >= 2)
134 mem_pll_rat *= 2;
135 break;
136 case SVR_T2080:
137 case SVR_T2081:
138 if ((SVR_MAJ(svr) > 1) || (SVR_MIN(svr) >= 1))
139 mem_pll_rat *= 2;
140 break;
141 default:
142 break;
143 }
Zang Roy-R619111b1e5cf2013-11-28 13:23:37 +0800144#endif
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800145 if (mem_pll_rat > 2)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530146 sys_info->freq_ddrbus *= mem_pll_rat;
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800147 else
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530148 sys_info->freq_ddrbus = sys_info->freq_systembus * mem_pll_rat;
Kumar Galadccd9e32009-03-19 02:46:19 -0500149
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530150 for (i = 0; i < CONFIG_SYS_FSL_NUM_CC_PLLS; i++) {
151 ratio[i] = (in_be32(&clk->pllcgsr[i].pllcngsr) >> 1) & 0x3f;
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800152 if (ratio[i] > 4)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530153 freq_c_pll[i] = sysclk * ratio[i];
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800154 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530155 freq_c_pll[i] = sys_info->freq_systembus * ratio[i];
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800156 }
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +0530157
York Sund7778f72012-10-08 07:44:11 +0000158#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2
159 /*
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530160 * As per CHASSIS2 architeture total 12 clusters are posible and
York Sund7778f72012-10-08 07:44:11 +0000161 * Each cluster has up to 4 cores, sharing the same PLL selection.
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530162 * The cluster clock assignment is SoC defined.
163 *
164 * Total 4 clock groups are possible with 3 PLLs each.
165 * as per array indices, clock group A has 0, 1, 2 numbered PLLs &
166 * clock group B has 3, 4, 6 and so on.
167 *
168 * Clock group A having PLL1, PLL2, PLL3, feeding cores of any cluster
169 * depends upon the SoC architeture. Same applies to other
170 * clock groups and clusters.
171 *
York Sund7778f72012-10-08 07:44:11 +0000172 */
Timur Tabi47289422011-08-05 16:15:24 -0500173 for_each_cpu(i, cpu, cpu_numcores(), cpu_mask()) {
York Sunaa150bb2013-03-25 07:40:07 +0000174 int cluster = fsl_qoriq_core_to_cluster(cpu);
175 u32 c_pll_sel = (in_be32(&clk->clkcsr[cluster].clkcncsr) >> 27)
York Sund7778f72012-10-08 07:44:11 +0000176 & 0xf;
Kumar Galadccd9e32009-03-19 02:46:19 -0500177 u32 cplx_pll = core_cplx_PLL[c_pll_sel];
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530178 cplx_pll += cc_group[cluster] - 1;
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530179 sys_info->freq_processor[cpu] =
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530180 freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
Kumar Galadccd9e32009-03-19 02:46:19 -0500181 }
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +0530182
183#ifdef CONFIG_HETROGENOUS_CLUSTERS
184 for_each_cpu(i, dsp_cpu, cpu_num_dspcores(), cpu_dsp_mask()) {
185 int dsp_cluster = fsl_qoriq_dsp_core_to_cluster(dsp_cpu);
186 u32 c_pll_sel = (in_be32
187 (&clk->clkcsr[dsp_cluster].clkcncsr) >> 27)
188 & 0xf;
189 u32 cplx_pll = core_cplx_PLL[c_pll_sel];
190 cplx_pll += cc_group[dsp_cluster] - 1;
191 sys_info->freq_processor_dsp[dsp_cpu] =
192 freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
193 }
194#endif
195
York Sunfda566d2016-11-18 11:56:57 -0800196#if defined(CONFIG_ARCH_B4860) || defined(CONFIG_ARCH_B4420) || \
Tom Rini3ec582b2021-02-20 20:06:21 -0500197 defined(CONFIG_ARCH_T2080)
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000198#define FM1_CLK_SEL 0xe0000000
199#define FM1_CLK_SHIFT 29
Tom Rinib4e60262021-05-14 21:34:22 -0400200#elif defined(CONFIG_ARCH_T1024)
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800201#define FM1_CLK_SEL 0x00000007
202#define FM1_CLK_SHIFT 0
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000203#else
York Sund7778f72012-10-08 07:44:11 +0000204#define PME_CLK_SEL 0xe0000000
205#define PME_CLK_SHIFT 29
206#define FM1_CLK_SEL 0x1c000000
207#define FM1_CLK_SHIFT 26
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000208#endif
Tom Rinibf5fab32022-12-04 10:13:32 -0500209#if !defined(CFG_FM_PLAT_CLK_DIV) || !defined(CFG_PME_PLAT_CLK_DIV)
Tom Rinib4e60262021-05-14 21:34:22 -0400210#if defined(CONFIG_ARCH_T1024)
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800211 rcw_tmp = in_be32(&gur->rcwsr[15]) - 4;
212#else
York Sund7778f72012-10-08 07:44:11 +0000213 rcw_tmp = in_be32(&gur->rcwsr[7]);
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530214#endif
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800215#endif
York Sund7778f72012-10-08 07:44:11 +0000216
217#ifdef CONFIG_SYS_DPAA_PME
Tom Rinibf5fab32022-12-04 10:13:32 -0500218#ifndef CFG_PME_PLAT_CLK_DIV
York Sund7778f72012-10-08 07:44:11 +0000219 switch ((rcw_tmp & PME_CLK_SEL) >> PME_CLK_SHIFT) {
220 case 1:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500221 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK];
York Sund7778f72012-10-08 07:44:11 +0000222 break;
223 case 2:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500224 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK] / 2;
York Sund7778f72012-10-08 07:44:11 +0000225 break;
226 case 3:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500227 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK] / 3;
York Sund7778f72012-10-08 07:44:11 +0000228 break;
229 case 4:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500230 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK] / 4;
York Sund7778f72012-10-08 07:44:11 +0000231 break;
232 case 6:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500233 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK + 1] / 2;
York Sund7778f72012-10-08 07:44:11 +0000234 break;
235 case 7:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500236 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK + 1] / 3;
York Sund7778f72012-10-08 07:44:11 +0000237 break;
238 default:
239 printf("Error: Unknown PME clock select!\n");
240 case 0:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530241 sys_info->freq_pme = sys_info->freq_systembus / 2;
York Sund7778f72012-10-08 07:44:11 +0000242 break;
243
244 }
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530245#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500246 sys_info->freq_pme = sys_info->freq_systembus / CFG_SYS_PME_CLK;
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530247
248#endif
York Sund7778f72012-10-08 07:44:11 +0000249#endif
250
Haiying Wang09d0aa92012-10-11 07:13:39 +0000251#ifdef CONFIG_SYS_DPAA_QBMAN
Tom Rini74538cd2022-12-04 10:13:38 -0500252#ifndef CFG_QBMAN_CLK_DIV
253#define CFG_QBMAN_CLK_DIV 2
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800254#endif
Tom Rini74538cd2022-12-04 10:13:38 -0500255 sys_info->freq_qman = sys_info->freq_systembus / CFG_QBMAN_CLK_DIV;
Haiying Wang09d0aa92012-10-11 07:13:39 +0000256#endif
257
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +0530258#if defined(CONFIG_SYS_MAPLE)
259#define CPRI_CLK_SEL 0x1C000000
260#define CPRI_CLK_SHIFT 26
261#define CPRI_ALT_CLK_SEL 0x00007000
262#define CPRI_ALT_CLK_SHIFT 12
263
264 rcw_tmp1 = in_be32(&gur->rcwsr[7]); /* Reading RCW bits: 224-255*/
265 rcw_tmp2 = in_be32(&gur->rcwsr[15]); /* Reading RCW bits: 480-511*/
266 /* For MAPLE and CPRI frequency */
267 switch ((rcw_tmp1 & CPRI_CLK_SEL) >> CPRI_CLK_SHIFT) {
268 case 1:
269 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK];
270 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK];
271 break;
272 case 2:
273 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 2;
274 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 2;
275 break;
276 case 3:
277 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 3;
278 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 3;
279 break;
280 case 4:
281 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 4;
282 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 4;
283 break;
284 case 5:
285 if (((rcw_tmp2 & CPRI_ALT_CLK_SEL)
286 >> CPRI_ALT_CLK_SHIFT) == 6) {
287 sys_info->freq_maple =
288 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 2;
289 sys_info->freq_cpri =
290 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 2;
291 }
292 if (((rcw_tmp2 & CPRI_ALT_CLK_SEL)
293 >> CPRI_ALT_CLK_SHIFT) == 7) {
294 sys_info->freq_maple =
295 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 3;
296 sys_info->freq_cpri =
297 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 3;
298 }
299 break;
300 case 6:
301 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 2;
302 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 2;
303 break;
304 case 7:
305 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 3;
306 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 3;
307 break;
308 default:
309 printf("Error: Unknown MAPLE/CPRI clock select!\n");
310 }
311
312 /* For MAPLE ULB and eTVPE frequencies */
313#define ULB_CLK_SEL 0x00000038
314#define ULB_CLK_SHIFT 3
315#define ETVPE_CLK_SEL 0x00000007
316#define ETVPE_CLK_SHIFT 0
317
318 switch ((rcw_tmp2 & ULB_CLK_SEL) >> ULB_CLK_SHIFT) {
319 case 1:
320 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK];
321 break;
322 case 2:
323 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK] / 2;
324 break;
325 case 3:
326 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK] / 3;
327 break;
328 case 4:
329 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK] / 4;
330 break;
331 case 5:
332 sys_info->freq_maple_ulb = sys_info->freq_systembus;
333 break;
334 case 6:
335 sys_info->freq_maple_ulb =
336 freq_c_pll[CONFIG_SYS_ULB_CLK - 1] / 2;
337 break;
338 case 7:
339 sys_info->freq_maple_ulb =
340 freq_c_pll[CONFIG_SYS_ULB_CLK - 1] / 3;
341 break;
342 default:
343 printf("Error: Unknown MAPLE ULB clock select!\n");
344 }
345
346 switch ((rcw_tmp2 & ETVPE_CLK_SEL) >> ETVPE_CLK_SHIFT) {
347 case 1:
348 sys_info->freq_maple_etvpe = freq_c_pll[CONFIG_SYS_ETVPE_CLK];
349 break;
350 case 2:
351 sys_info->freq_maple_etvpe =
352 freq_c_pll[CONFIG_SYS_ETVPE_CLK] / 2;
353 break;
354 case 3:
355 sys_info->freq_maple_etvpe =
356 freq_c_pll[CONFIG_SYS_ETVPE_CLK] / 3;
357 break;
358 case 4:
359 sys_info->freq_maple_etvpe =
360 freq_c_pll[CONFIG_SYS_ETVPE_CLK] / 4;
361 break;
362 case 5:
363 sys_info->freq_maple_etvpe = sys_info->freq_systembus;
364 break;
365 case 6:
366 sys_info->freq_maple_etvpe =
367 freq_c_pll[CONFIG_SYS_ETVPE_CLK - 1] / 2;
368 break;
369 case 7:
370 sys_info->freq_maple_etvpe =
371 freq_c_pll[CONFIG_SYS_ETVPE_CLK - 1] / 3;
372 break;
373 default:
374 printf("Error: Unknown MAPLE eTVPE clock select!\n");
375 }
376
377#endif
378
York Sund7778f72012-10-08 07:44:11 +0000379#ifdef CONFIG_SYS_DPAA_FMAN
Tom Rini775168e2022-12-04 10:03:56 -0500380#ifndef CFG_FM_PLAT_CLK_DIV
York Sund7778f72012-10-08 07:44:11 +0000381 switch ((rcw_tmp & FM1_CLK_SEL) >> FM1_CLK_SHIFT) {
382 case 1:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500383 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK];
York Sund7778f72012-10-08 07:44:11 +0000384 break;
385 case 2:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500386 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK] / 2;
York Sund7778f72012-10-08 07:44:11 +0000387 break;
388 case 3:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500389 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK] / 3;
York Sund7778f72012-10-08 07:44:11 +0000390 break;
391 case 4:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500392 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK] / 4;
York Sund7778f72012-10-08 07:44:11 +0000393 break;
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000394 case 5:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530395 sys_info->freq_fman[0] = sys_info->freq_systembus;
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000396 break;
York Sund7778f72012-10-08 07:44:11 +0000397 case 6:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500398 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK + 1] / 2;
York Sund7778f72012-10-08 07:44:11 +0000399 break;
400 case 7:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500401 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK + 1] / 3;
York Sund7778f72012-10-08 07:44:11 +0000402 break;
403 default:
404 printf("Error: Unknown FMan1 clock select!\n");
405 case 0:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530406 sys_info->freq_fman[0] = sys_info->freq_systembus / 2;
York Sund7778f72012-10-08 07:44:11 +0000407 break;
408 }
Tom Rini0a2bac72022-11-16 13:10:29 -0500409#if (CFG_SYS_NUM_FMAN) == 2
Tom Rini6a5dccc2022-11-16 13:10:41 -0500410#ifdef CFG_SYS_FM2_CLK
York Sund7778f72012-10-08 07:44:11 +0000411#define FM2_CLK_SEL 0x00000038
412#define FM2_CLK_SHIFT 3
413 rcw_tmp = in_be32(&gur->rcwsr[15]);
414 switch ((rcw_tmp & FM2_CLK_SEL) >> FM2_CLK_SHIFT) {
415 case 1:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500416 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1];
York Sund7778f72012-10-08 07:44:11 +0000417 break;
418 case 2:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500419 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1] / 2;
York Sund7778f72012-10-08 07:44:11 +0000420 break;
421 case 3:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500422 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1] / 3;
York Sund7778f72012-10-08 07:44:11 +0000423 break;
424 case 4:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500425 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1] / 4;
York Sund7778f72012-10-08 07:44:11 +0000426 break;
Shaohui Xie45359a32013-11-28 13:52:51 +0800427 case 5:
428 sys_info->freq_fman[1] = sys_info->freq_systembus;
429 break;
York Sund7778f72012-10-08 07:44:11 +0000430 case 6:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500431 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK] / 2;
York Sund7778f72012-10-08 07:44:11 +0000432 break;
433 case 7:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500434 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK] / 3;
York Sund7778f72012-10-08 07:44:11 +0000435 break;
436 default:
437 printf("Error: Unknown FMan2 clock select!\n");
438 case 0:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530439 sys_info->freq_fman[1] = sys_info->freq_systembus / 2;
York Sund7778f72012-10-08 07:44:11 +0000440 break;
441 }
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530442#endif
Tom Rini0a2bac72022-11-16 13:10:29 -0500443#endif /* CFG_SYS_NUM_FMAN == 2 */
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530444#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500445 sys_info->freq_fman[0] = sys_info->freq_systembus / CFG_SYS_FM1_CLK;
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530446#endif
447#endif
Kumar Galadccd9e32009-03-19 02:46:19 -0500448
York Sund7778f72012-10-08 07:44:11 +0000449#else /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
450
451 for_each_cpu(i, cpu, cpu_numcores(), cpu_mask()) {
York Sunaa150bb2013-03-25 07:40:07 +0000452 u32 c_pll_sel = (in_be32(&clk->clkcsr[cpu].clkcncsr) >> 27)
453 & 0xf;
York Sund7778f72012-10-08 07:44:11 +0000454 u32 cplx_pll = core_cplx_PLL[c_pll_sel];
455
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530456 sys_info->freq_processor[cpu] =
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530457 freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
York Sund7778f72012-10-08 07:44:11 +0000458 }
Kumar Galadccd9e32009-03-19 02:46:19 -0500459#define PME_CLK_SEL 0x80000000
460#define FM1_CLK_SEL 0x40000000
461#define FM2_CLK_SEL 0x20000000
Kumar Gala3842bb52011-02-16 02:03:29 -0600462#define HWA_ASYNC_DIV 0x04000000
463#if (CONFIG_SYS_FSL_NUM_CC_PLLS == 2)
464#define HWA_CC_PLL 1
Timur Tabid5e13882012-10-05 11:09:19 +0000465#elif (CONFIG_SYS_FSL_NUM_CC_PLLS == 3)
466#define HWA_CC_PLL 2
Kumar Gala3842bb52011-02-16 02:03:29 -0600467#elif (CONFIG_SYS_FSL_NUM_CC_PLLS == 4)
Wolfgang Denk80f70212011-05-19 22:21:41 +0200468#define HWA_CC_PLL 2
Kumar Gala3842bb52011-02-16 02:03:29 -0600469#else
470#error CONFIG_SYS_FSL_NUM_CC_PLLS not set or unknown case
471#endif
Kumar Galadccd9e32009-03-19 02:46:19 -0500472 rcw_tmp = in_be32(&gur->rcwsr[7]);
473
474#ifdef CONFIG_SYS_DPAA_PME
Kumar Gala3842bb52011-02-16 02:03:29 -0600475 if (rcw_tmp & PME_CLK_SEL) {
476 if (rcw_tmp & HWA_ASYNC_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530477 sys_info->freq_pme = freq_c_pll[HWA_CC_PLL] / 4;
Kumar Gala3842bb52011-02-16 02:03:29 -0600478 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530479 sys_info->freq_pme = freq_c_pll[HWA_CC_PLL] / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600480 } else {
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530481 sys_info->freq_pme = sys_info->freq_systembus / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600482 }
Kumar Galadccd9e32009-03-19 02:46:19 -0500483#endif
484
485#ifdef CONFIG_SYS_DPAA_FMAN
Kumar Gala3842bb52011-02-16 02:03:29 -0600486 if (rcw_tmp & FM1_CLK_SEL) {
487 if (rcw_tmp & HWA_ASYNC_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530488 sys_info->freq_fman[0] = freq_c_pll[HWA_CC_PLL] / 4;
Kumar Gala3842bb52011-02-16 02:03:29 -0600489 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530490 sys_info->freq_fman[0] = freq_c_pll[HWA_CC_PLL] / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600491 } else {
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530492 sys_info->freq_fman[0] = sys_info->freq_systembus / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600493 }
Tom Rini0a2bac72022-11-16 13:10:29 -0500494#if (CFG_SYS_NUM_FMAN) == 2
Kumar Gala3842bb52011-02-16 02:03:29 -0600495 if (rcw_tmp & FM2_CLK_SEL) {
496 if (rcw_tmp & HWA_ASYNC_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530497 sys_info->freq_fman[1] = freq_c_pll[HWA_CC_PLL] / 4;
Kumar Gala3842bb52011-02-16 02:03:29 -0600498 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530499 sys_info->freq_fman[1] = freq_c_pll[HWA_CC_PLL] / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600500 } else {
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530501 sys_info->freq_fman[1] = sys_info->freq_systembus / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600502 }
Kumar Galadccd9e32009-03-19 02:46:19 -0500503#endif
504#endif
505
Shaohui Xie835c9ad2013-03-25 07:33:25 +0000506#ifdef CONFIG_SYS_DPAA_QBMAN
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530507 sys_info->freq_qman = sys_info->freq_systembus / 2;
Shaohui Xie835c9ad2013-03-25 07:33:25 +0000508#endif
509
York Sund7778f72012-10-08 07:44:11 +0000510#endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
511
Zhao Qiangb818ba22014-03-21 16:21:45 +0800512#ifdef CONFIG_U_QE
513 sys_info->freq_qe = sys_info->freq_systembus / 2;
514#endif
515
York Sund7778f72012-10-08 07:44:11 +0000516#else /* CONFIG_FSL_CORENET */
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530517 uint plat_ratio, e500_ratio, half_freq_systembus;
Haiying Wangbb8aea72009-01-15 11:58:35 -0500518 int i;
Haiying Wang61414682009-05-20 12:30:29 -0400519#ifdef CONFIG_QE
Haiying Wang8cb2af72011-02-11 01:25:30 -0600520 __maybe_unused u32 qe_ratio;
Haiying Wang61414682009-05-20 12:30:29 -0400521#endif
wdenk9c53f402003-10-15 23:53:47 +0000522
523 plat_ratio = (gur->porpllsr) & 0x0000003e;
524 plat_ratio >>= 1;
Tom Rini8c70baa2021-12-14 13:36:40 -0500525 sys_info->freq_systembus = plat_ratio * get_board_sys_clk();
Andy Fleming6d972762007-04-23 02:37:47 -0500526
527 /* Divide before multiply to avoid integer
528 * overflow for processor speeds above 2GHz */
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530529 half_freq_systembus = sys_info->freq_systembus/2;
Poonam Aggrwal4baef822009-07-31 12:08:14 +0530530 for (i = 0; i < cpu_numcores(); i++) {
Haiying Wangbb8aea72009-01-15 11:58:35 -0500531 e500_ratio = ((gur->porpllsr) >> (i * 8 + 16)) & 0x3f;
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530532 sys_info->freq_processor[i] = e500_ratio * half_freq_systembus;
Haiying Wangbb8aea72009-01-15 11:58:35 -0500533 }
James Yangd1d51ad2008-02-08 18:05:08 -0600534
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530535 /* Note: freq_ddrbus is the MCLK frequency, not the data rate. */
536 sys_info->freq_ddrbus = sys_info->freq_systembus;
Kumar Gala07db1702007-12-07 04:59:26 -0600537
Tom Rinif7246c22021-08-21 13:50:17 -0400538#if defined(CONFIG_DYNAMIC_DDR_CLK_FREQ) || defined(CONFIG_STATIC_DDR_CLK_FREQ)
Kumar Gala07db1702007-12-07 04:59:26 -0600539 {
Jason Jinbfcd6c32008-09-27 14:40:57 +0800540 u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO)
541 >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
Kumar Gala07db1702007-12-07 04:59:26 -0600542 if (ddr_ratio != 0x7)
Tom Rinif7246c22021-08-21 13:50:17 -0400543 sys_info->freq_ddrbus = ddr_ratio * get_board_ddr_clk();
Kumar Gala07db1702007-12-07 04:59:26 -0600544 }
545#endif
Trent Piepho0b691fc2008-12-03 15:16:37 -0800546
Haiying Wang61414682009-05-20 12:30:29 -0400547#ifdef CONFIG_QE
York Sun0f577972016-11-18 11:05:38 -0800548#if defined(CONFIG_ARCH_P1021) || defined(CONFIG_ARCH_P1025)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530549 sys_info->freq_qe = sys_info->freq_systembus;
Haiying Wang8cb2af72011-02-11 01:25:30 -0600550#else
Haiying Wang61414682009-05-20 12:30:29 -0400551 qe_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_QE_RATIO)
552 >> MPC85xx_PORPLLSR_QE_RATIO_SHIFT;
Tom Rini8c70baa2021-12-14 13:36:40 -0500553 sys_info->freq_qe = qe_ratio * get_board_sys_clk();
Haiying Wang61414682009-05-20 12:30:29 -0400554#endif
Haiying Wang8cb2af72011-02-11 01:25:30 -0600555#endif
Haiying Wang325a12f2011-01-20 22:26:31 +0000556
557#ifdef CONFIG_SYS_DPAA_FMAN
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530558 sys_info->freq_fman[0] = sys_info->freq_systembus;
Haiying Wang325a12f2011-01-20 22:26:31 +0000559#endif
560
561#endif /* CONFIG_FSL_CORENET */
Haiying Wang61414682009-05-20 12:30:29 -0400562
Dipen Dudhat5d51bf92011-01-19 12:46:27 +0530563#if defined(CONFIG_FSL_LBC)
Prabhakar Kushwahabedc5622017-02-02 15:02:00 +0530564 sys_info->freq_localbus = sys_info->freq_systembus /
565 CONFIG_SYS_FSL_LBC_CLK_DIV;
Dipen Dudhat5d51bf92011-01-19 12:46:27 +0530566#endif
Kumar Gala17ec6fa2012-10-08 07:44:06 +0000567
568#if defined(CONFIG_FSL_IFC)
Prabhakar Kushwaha3c48f582017-02-02 15:01:26 +0530569 sys_info->freq_localbus = sys_info->freq_systembus /
570 CONFIG_SYS_FSL_IFC_CLK_DIV;
Kumar Gala17ec6fa2012-10-08 07:44:06 +0000571#endif
wdenk9c53f402003-10-15 23:53:47 +0000572}
573
Simon Glass85d65312019-12-28 10:44:58 -0700574int get_clocks(void)
wdenk9c53f402003-10-15 23:53:47 +0000575{
wdenk9c53f402003-10-15 23:53:47 +0000576 sys_info_t sys_info;
York Sun5ac012a2016-11-15 13:57:15 -0800577#ifdef CONFIG_ARCH_MPC8544
Tom Rinid5c3bf22022-10-28 20:27:12 -0400578 volatile ccsr_gur_t *gur = (void *) CFG_SYS_MPC85xx_GUTS_ADDR;
Timur Tabi44befe02008-04-04 11:15:58 -0500579#endif
wdenk9c53f402003-10-15 23:53:47 +0000580 get_sys_info (&sys_info);
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530581 gd->cpu_clk = sys_info.freq_processor[0];
582 gd->bus_clk = sys_info.freq_systembus;
583 gd->mem_clk = sys_info.freq_ddrbus;
584 gd->arch.lbc_clk = sys_info.freq_localbus;
Timur Tabi44befe02008-04-04 11:15:58 -0500585
Haiying Wang61414682009-05-20 12:30:29 -0400586#ifdef CONFIG_QE
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530587 gd->arch.qe_clk = sys_info.freq_qe;
Simon Glass8518b172012-12-13 20:48:50 +0000588 gd->arch.brg_clk = gd->arch.qe_clk / 2;
Haiying Wang61414682009-05-20 12:30:29 -0400589#endif
Timur Tabi44befe02008-04-04 11:15:58 -0500590 /*
591 * The base clock for I2C depends on the actual SOC. Unfortunately,
592 * there is no pattern that can be used to determine the frequency, so
593 * the only choice is to look up the actual SOC number and use the value
594 * for that SOC. This information is taken from application note
595 * AN2919.
596 */
Tom Rini0b730a02021-05-14 21:34:21 -0400597#if defined(CONFIG_ARCH_MPC8540) || defined(CONFIG_ARCH_MPC8560)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530598 gd->arch.i2c1_clk = sys_info.freq_systembus;
York Sun5ac012a2016-11-15 13:57:15 -0800599#elif defined(CONFIG_ARCH_MPC8544)
Timur Tabi44befe02008-04-04 11:15:58 -0500600 /*
601 * On the 8544, the I2C clock is the same as the SEC clock. This can be
602 * either CCB/2 or CCB/3, depending on the value of cfg_sec_freq. See
603 * 4.4.3.3 of the 8544 RM. Note that this might actually work for all
604 * 85xx, but only the 8544 has cfg_sec_freq, so it's unknown if the
605 * PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544.
606 */
607 if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530608 gd->arch.i2c1_clk = sys_info.freq_systembus / 3;
Kumar Gala9632f662008-10-16 21:58:49 -0500609 else
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530610 gd->arch.i2c1_clk = sys_info.freq_systembus / 2;
Timur Tabi44befe02008-04-04 11:15:58 -0500611#else
612 /* Most 85xx SOCs use CCB/2, so this is the default behavior. */
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530613 gd->arch.i2c1_clk = sys_info.freq_systembus / 2;
Timur Tabi44befe02008-04-04 11:15:58 -0500614#endif
Simon Glassc2baaec2012-12-13 20:48:49 +0000615 gd->arch.i2c2_clk = gd->arch.i2c1_clk;
Timur Tabic1499f482008-01-09 14:35:26 -0600616
Dipen Dudhat9af188d2009-09-01 17:27:00 +0530617#if defined(CONFIG_FSL_ESDHC)
Tom Rini12084d22021-02-20 20:06:29 -0500618#if defined(CONFIG_ARCH_P1010)
Simon Glass9e247d12012-12-13 20:49:05 +0000619 gd->arch.sdhc_clk = gd->bus_clk;
Anton Vorontsovda225942009-10-15 17:47:06 +0400620#else
Simon Glass9e247d12012-12-13 20:49:05 +0000621 gd->arch.sdhc_clk = gd->bus_clk / 2;
Kumar Galacd777282008-08-12 11:14:19 -0500622#endif
Anton Vorontsovda225942009-10-15 17:47:06 +0400623#endif /* defined(CONFIG_FSL_ESDHC) */
Kumar Galacd777282008-08-12 11:14:19 -0500624
wdenk9c53f402003-10-15 23:53:47 +0000625 if(gd->cpu_clk != 0) return (0);
626 else return (1);
627}
628
629
630/********************************************
631 * get_bus_freq
632 * return system bus freq in Hz
633 *********************************************/
Simon Glass85d65312019-12-28 10:44:58 -0700634ulong get_bus_freq(ulong dummy)
wdenk9c53f402003-10-15 23:53:47 +0000635{
James Yangd1d51ad2008-02-08 18:05:08 -0600636 return gd->bus_clk;
wdenk9c53f402003-10-15 23:53:47 +0000637}
Kumar Gala07db1702007-12-07 04:59:26 -0600638
639/********************************************
640 * get_ddr_freq
641 * return ddr bus freq in Hz
642 *********************************************/
643ulong get_ddr_freq (ulong dummy)
644{
James Yangd1d51ad2008-02-08 18:05:08 -0600645 return gd->mem_clk;
Kumar Gala07db1702007-12-07 04:59:26 -0600646}