blob: a7e1b3c98a9d358d55b1ee0d1bafd89949233844 [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
Simon Glass33d1e702019-11-14 12:57:32 -070012#include <cpu_func.h>
Tom Rinif7246c22021-08-21 13:50:17 -040013#include <clock_legacy.h>
wdenk9c53f402003-10-15 23:53:47 +000014#include <ppc_asm.tmpl>
Simon Glass3ba929a2020-10-30 21:38:53 -060015#include <asm/global_data.h>
Haiying Wang8cb2af72011-02-11 01:25:30 -060016#include <linux/compiler.h>
wdenk9c53f402003-10-15 23:53:47 +000017#include <asm/processor.h>
Trent Piepho0b691fc2008-12-03 15:16:37 -080018#include <asm/io.h>
wdenk9c53f402003-10-15 23:53:47 +000019
Wolfgang Denk6405a152006-03-31 18:32:53 +020020DECLARE_GLOBAL_DATA_PTR;
21
wdenk9c53f402003-10-15 23:53:47 +000022/* --------------------------------------------------------------- */
23
Prabhakar Kushwahad1698082013-08-16 14:52:26 +053024void get_sys_info(sys_info_t *sys_info)
wdenk9c53f402003-10-15 23:53:47 +000025{
Tom Rinid5c3bf22022-10-28 20:27:12 -040026 volatile ccsr_gur_t *gur = (void *)(CFG_SYS_MPC85xx_GUTS_ADDR);
Kumar Galadccd9e32009-03-19 02:46:19 -050027#ifdef CONFIG_FSL_CORENET
Tom Rini376b88a2022-10-28 20:27:13 -040028 volatile ccsr_clk_t *clk = (void *)(CFG_SYS_FSL_CORENET_CLK_ADDR);
Timur Tabi47289422011-08-05 16:15:24 -050029 unsigned int cpu;
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +053030#ifdef CONFIG_HETROGENOUS_CLUSTERS
31 unsigned int dsp_cpu;
32 uint rcw_tmp1, rcw_tmp2;
33#endif
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053034#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2
Tom Rini376b88a2022-10-28 20:27:13 -040035 int cc_group[12] = CFG_SYS_FSL_CLUSTER_CLOCKS;
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053036#endif
York Sun7c355f52014-10-27 11:31:33 -070037 __maybe_unused u32 svr;
Kumar Galadccd9e32009-03-19 02:46:19 -050038
39 const u8 core_cplx_PLL[16] = {
40 [ 0] = 0, /* CC1 PPL / 1 */
41 [ 1] = 0, /* CC1 PPL / 2 */
42 [ 2] = 0, /* CC1 PPL / 4 */
43 [ 4] = 1, /* CC2 PPL / 1 */
44 [ 5] = 1, /* CC2 PPL / 2 */
45 [ 6] = 1, /* CC2 PPL / 4 */
46 [ 8] = 2, /* CC3 PPL / 1 */
47 [ 9] = 2, /* CC3 PPL / 2 */
48 [10] = 2, /* CC3 PPL / 4 */
49 [12] = 3, /* CC4 PPL / 1 */
50 [13] = 3, /* CC4 PPL / 2 */
51 [14] = 3, /* CC4 PPL / 4 */
52 };
53
Prabhakar Kushwahad1698082013-08-16 14:52:26 +053054 const u8 core_cplx_pll_div[16] = {
Kumar Galadccd9e32009-03-19 02:46:19 -050055 [ 0] = 1, /* CC1 PPL / 1 */
56 [ 1] = 2, /* CC1 PPL / 2 */
57 [ 2] = 4, /* CC1 PPL / 4 */
58 [ 4] = 1, /* CC2 PPL / 1 */
59 [ 5] = 2, /* CC2 PPL / 2 */
60 [ 6] = 4, /* CC2 PPL / 4 */
61 [ 8] = 1, /* CC3 PPL / 1 */
62 [ 9] = 2, /* CC3 PPL / 2 */
63 [10] = 4, /* CC3 PPL / 4 */
64 [12] = 1, /* CC4 PPL / 1 */
65 [13] = 2, /* CC4 PPL / 2 */
66 [14] = 4, /* CC4 PPL / 4 */
67 };
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053068 uint i, freq_c_pll[CONFIG_SYS_FSL_NUM_CC_PLLS];
Tom Rinibf5fab32022-12-04 10:13:32 -050069#if !defined(CFG_FM_PLAT_CLK_DIV) || !defined(CFG_PME_PLAT_CLK_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +053070 uint rcw_tmp;
71#endif
72 uint ratio[CONFIG_SYS_FSL_NUM_CC_PLLS];
Tom Rini8c70baa2021-12-14 13:36:40 -050073 unsigned long sysclk = get_board_sys_clk();
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +080074 uint mem_pll_rat;
Kumar Galadccd9e32009-03-19 02:46:19 -050075
Prabhakar Kushwahad1698082013-08-16 14:52:26 +053076 sys_info->freq_systembus = sysclk;
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053077#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
vijay raid84fd502014-04-15 11:34:12 +053078 uint ddr_refclk_sel;
79 unsigned int porsr1_sys_clk;
80 porsr1_sys_clk = in_be32(&gur->porsr1) >> FSL_DCFG_PORSR1_SYSCLK_SHIFT
81 & FSL_DCFG_PORSR1_SYSCLK_MASK;
82 if (porsr1_sys_clk == FSL_DCFG_PORSR1_SYSCLK_DIFF)
83 sys_info->diff_sysclk = 1;
84 else
85 sys_info->diff_sysclk = 0;
86
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053087 /*
88 * DDR_REFCLK_SEL rcw bit is used to determine if DDR PLLS
89 * are driven by separate DDR Refclock or single source
90 * differential clock.
91 */
vijay raid84fd502014-04-15 11:34:12 +053092 ddr_refclk_sel = (in_be32(&gur->rcwsr[5]) >>
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053093 FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_SHIFT) &
94 FSL_CORENET2_RCWSR5_DDR_REFCLK_SEL_MASK;
95 /*
vijay raid84fd502014-04-15 11:34:12 +053096 * For single source clocking, both ddrclock and sysclock
Priyanka Jaine9dcaa82013-12-17 14:25:52 +053097 * are driven by differential sysclock.
98 */
vijay raid84fd502014-04-15 11:34:12 +053099 if (ddr_refclk_sel == FSL_CORENET2_RCWSR5_DDR_REFCLK_SINGLE_CLK)
Tom Rini8c70baa2021-12-14 13:36:40 -0500100 sys_info->freq_ddrbus = get_board_sys_clk();
vijay raid84fd502014-04-15 11:34:12 +0530101 else
Priyanka Jaine9dcaa82013-12-17 14:25:52 +0530102#endif
Tom Rinif7246c22021-08-21 13:50:17 -0400103#if defined(CONFIG_DYNAMIC_DDR_CLK_FREQ) || defined(CONFIG_STATIC_DDR_CLK_FREQ)
104 sys_info->freq_ddrbus = get_board_ddr_clk();
York Sun3b5179f2012-10-08 07:44:31 +0000105#else
Priyanka Jaine9dcaa82013-12-17 14:25:52 +0530106 sys_info->freq_ddrbus = sysclk;
York Sun3b5179f2012-10-08 07:44:31 +0000107#endif
Kumar Galadccd9e32009-03-19 02:46:19 -0500108
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530109 sys_info->freq_systembus *= (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
York Sunb8a076b2012-10-08 07:44:09 +0000110 mem_pll_rat = (in_be32(&gur->rcwsr[0]) >>
111 FSL_CORENET_RCWSR0_MEM_PLL_RAT_SHIFT)
112 & FSL_CORENET_RCWSR0_MEM_PLL_RAT_MASK;
York Sun7b083df2014-03-28 15:07:27 -0700113#ifdef CONFIG_SYS_FSL_ERRATUM_A007212
114 if (mem_pll_rat == 0) {
115 mem_pll_rat = (in_be32(&gur->rcwsr[0]) >>
116 FSL_CORENET_RCWSR0_MEM_PLL_RAT_RESV_SHIFT) &
117 FSL_CORENET_RCWSR0_MEM_PLL_RAT_MASK;
118 }
119#endif
Zang Roy-R619111b1e5cf2013-11-28 13:23:37 +0800120 /* T4240/T4160 Rev2.0 MEM_PLL_RAT uses a value which is half of
121 * T4240/T4160 Rev1.0. eg. It's 12 in Rev1.0, however, for Rev2.0
122 * it uses 6.
York Sun7c355f52014-10-27 11:31:33 -0700123 * T2080 rev 1.1 and later also use half mem_pll comparing with rev 1.0
Zang Roy-R619111b1e5cf2013-11-28 13:23:37 +0800124 */
Tom Rinia7ffa3d2021-05-23 10:58:05 -0400125#if defined(CONFIG_ARCH_T4240) || defined(CONFIG_ARCH_T2080)
York Sun7c355f52014-10-27 11:31:33 -0700126 svr = get_svr();
127 switch (SVR_SOC_VER(svr)) {
128 case SVR_T4240:
129 case SVR_T4160:
130 case SVR_T4120:
131 case SVR_T4080:
132 if (SVR_MAJ(svr) >= 2)
133 mem_pll_rat *= 2;
134 break;
135 case SVR_T2080:
136 case SVR_T2081:
137 if ((SVR_MAJ(svr) > 1) || (SVR_MIN(svr) >= 1))
138 mem_pll_rat *= 2;
139 break;
140 default:
141 break;
142 }
Zang Roy-R619111b1e5cf2013-11-28 13:23:37 +0800143#endif
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800144 if (mem_pll_rat > 2)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530145 sys_info->freq_ddrbus *= mem_pll_rat;
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800146 else
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530147 sys_info->freq_ddrbus = sys_info->freq_systembus * mem_pll_rat;
Kumar Galadccd9e32009-03-19 02:46:19 -0500148
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530149 for (i = 0; i < CONFIG_SYS_FSL_NUM_CC_PLLS; i++) {
150 ratio[i] = (in_be32(&clk->pllcgsr[i].pllcngsr) >> 1) & 0x3f;
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800151 if (ratio[i] > 4)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530152 freq_c_pll[i] = sysclk * ratio[i];
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800153 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530154 freq_c_pll[i] = sys_info->freq_systembus * ratio[i];
Srikanth Srinivasanf58c2a42010-02-10 17:32:43 +0800155 }
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +0530156
York Sund7778f72012-10-08 07:44:11 +0000157#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2
158 /*
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530159 * As per CHASSIS2 architeture total 12 clusters are posible and
York Sund7778f72012-10-08 07:44:11 +0000160 * Each cluster has up to 4 cores, sharing the same PLL selection.
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530161 * The cluster clock assignment is SoC defined.
162 *
163 * Total 4 clock groups are possible with 3 PLLs each.
164 * as per array indices, clock group A has 0, 1, 2 numbered PLLs &
165 * clock group B has 3, 4, 6 and so on.
166 *
167 * Clock group A having PLL1, PLL2, PLL3, feeding cores of any cluster
168 * depends upon the SoC architeture. Same applies to other
169 * clock groups and clusters.
170 *
York Sund7778f72012-10-08 07:44:11 +0000171 */
Timur Tabi47289422011-08-05 16:15:24 -0500172 for_each_cpu(i, cpu, cpu_numcores(), cpu_mask()) {
York Sunaa150bb2013-03-25 07:40:07 +0000173 int cluster = fsl_qoriq_core_to_cluster(cpu);
174 u32 c_pll_sel = (in_be32(&clk->clkcsr[cluster].clkcncsr) >> 27)
York Sund7778f72012-10-08 07:44:11 +0000175 & 0xf;
Kumar Galadccd9e32009-03-19 02:46:19 -0500176 u32 cplx_pll = core_cplx_PLL[c_pll_sel];
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530177 cplx_pll += cc_group[cluster] - 1;
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530178 sys_info->freq_processor[cpu] =
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530179 freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
Kumar Galadccd9e32009-03-19 02:46:19 -0500180 }
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +0530181
182#ifdef CONFIG_HETROGENOUS_CLUSTERS
183 for_each_cpu(i, dsp_cpu, cpu_num_dspcores(), cpu_dsp_mask()) {
184 int dsp_cluster = fsl_qoriq_dsp_core_to_cluster(dsp_cpu);
185 u32 c_pll_sel = (in_be32
186 (&clk->clkcsr[dsp_cluster].clkcncsr) >> 27)
187 & 0xf;
188 u32 cplx_pll = core_cplx_PLL[c_pll_sel];
189 cplx_pll += cc_group[dsp_cluster] - 1;
190 sys_info->freq_processor_dsp[dsp_cpu] =
191 freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
192 }
193#endif
194
York Sunfda566d2016-11-18 11:56:57 -0800195#if defined(CONFIG_ARCH_B4860) || defined(CONFIG_ARCH_B4420) || \
Tom Rini3ec582b2021-02-20 20:06:21 -0500196 defined(CONFIG_ARCH_T2080)
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000197#define FM1_CLK_SEL 0xe0000000
198#define FM1_CLK_SHIFT 29
Tom Rinib4e60262021-05-14 21:34:22 -0400199#elif defined(CONFIG_ARCH_T1024)
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800200#define FM1_CLK_SEL 0x00000007
201#define FM1_CLK_SHIFT 0
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000202#else
York Sund7778f72012-10-08 07:44:11 +0000203#define PME_CLK_SEL 0xe0000000
204#define PME_CLK_SHIFT 29
205#define FM1_CLK_SEL 0x1c000000
206#define FM1_CLK_SHIFT 26
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000207#endif
Tom Rinibf5fab32022-12-04 10:13:32 -0500208#if !defined(CFG_FM_PLAT_CLK_DIV) || !defined(CFG_PME_PLAT_CLK_DIV)
Tom Rinib4e60262021-05-14 21:34:22 -0400209#if defined(CONFIG_ARCH_T1024)
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800210 rcw_tmp = in_be32(&gur->rcwsr[15]) - 4;
211#else
York Sund7778f72012-10-08 07:44:11 +0000212 rcw_tmp = in_be32(&gur->rcwsr[7]);
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530213#endif
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800214#endif
York Sund7778f72012-10-08 07:44:11 +0000215
216#ifdef CONFIG_SYS_DPAA_PME
Tom Rinibf5fab32022-12-04 10:13:32 -0500217#ifndef CFG_PME_PLAT_CLK_DIV
York Sund7778f72012-10-08 07:44:11 +0000218 switch ((rcw_tmp & PME_CLK_SEL) >> PME_CLK_SHIFT) {
219 case 1:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500220 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK];
York Sund7778f72012-10-08 07:44:11 +0000221 break;
222 case 2:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500223 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK] / 2;
York Sund7778f72012-10-08 07:44:11 +0000224 break;
225 case 3:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500226 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK] / 3;
York Sund7778f72012-10-08 07:44:11 +0000227 break;
228 case 4:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500229 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK] / 4;
York Sund7778f72012-10-08 07:44:11 +0000230 break;
231 case 6:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500232 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK + 1] / 2;
York Sund7778f72012-10-08 07:44:11 +0000233 break;
234 case 7:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500235 sys_info->freq_pme = freq_c_pll[CFG_SYS_PME_CLK + 1] / 3;
York Sund7778f72012-10-08 07:44:11 +0000236 break;
237 default:
238 printf("Error: Unknown PME clock select!\n");
239 case 0:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530240 sys_info->freq_pme = sys_info->freq_systembus / 2;
York Sund7778f72012-10-08 07:44:11 +0000241 break;
242
243 }
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530244#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500245 sys_info->freq_pme = sys_info->freq_systembus / CFG_SYS_PME_CLK;
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530246
247#endif
York Sund7778f72012-10-08 07:44:11 +0000248#endif
249
Haiying Wang09d0aa92012-10-11 07:13:39 +0000250#ifdef CONFIG_SYS_DPAA_QBMAN
Tom Rini74538cd2022-12-04 10:13:38 -0500251#ifndef CFG_QBMAN_CLK_DIV
252#define CFG_QBMAN_CLK_DIV 2
Shengzhou Liue6fb7702014-11-24 17:11:54 +0800253#endif
Tom Rini74538cd2022-12-04 10:13:38 -0500254 sys_info->freq_qman = sys_info->freq_systembus / CFG_QBMAN_CLK_DIV;
Haiying Wang09d0aa92012-10-11 07:13:39 +0000255#endif
256
Shaveta Leekhadbf0bc82015-01-19 12:46:54 +0530257#if defined(CONFIG_SYS_MAPLE)
258#define CPRI_CLK_SEL 0x1C000000
259#define CPRI_CLK_SHIFT 26
260#define CPRI_ALT_CLK_SEL 0x00007000
261#define CPRI_ALT_CLK_SHIFT 12
262
263 rcw_tmp1 = in_be32(&gur->rcwsr[7]); /* Reading RCW bits: 224-255*/
264 rcw_tmp2 = in_be32(&gur->rcwsr[15]); /* Reading RCW bits: 480-511*/
265 /* For MAPLE and CPRI frequency */
266 switch ((rcw_tmp1 & CPRI_CLK_SEL) >> CPRI_CLK_SHIFT) {
267 case 1:
268 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK];
269 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK];
270 break;
271 case 2:
272 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 2;
273 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 2;
274 break;
275 case 3:
276 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 3;
277 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 3;
278 break;
279 case 4:
280 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 4;
281 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK] / 4;
282 break;
283 case 5:
284 if (((rcw_tmp2 & CPRI_ALT_CLK_SEL)
285 >> CPRI_ALT_CLK_SHIFT) == 6) {
286 sys_info->freq_maple =
287 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 2;
288 sys_info->freq_cpri =
289 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 2;
290 }
291 if (((rcw_tmp2 & CPRI_ALT_CLK_SEL)
292 >> CPRI_ALT_CLK_SHIFT) == 7) {
293 sys_info->freq_maple =
294 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 3;
295 sys_info->freq_cpri =
296 freq_c_pll[CONFIG_SYS_CPRI_CLK - 2] / 3;
297 }
298 break;
299 case 6:
300 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 2;
301 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 2;
302 break;
303 case 7:
304 sys_info->freq_maple = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 3;
305 sys_info->freq_cpri = freq_c_pll[CONFIG_SYS_CPRI_CLK + 1] / 3;
306 break;
307 default:
308 printf("Error: Unknown MAPLE/CPRI clock select!\n");
309 }
310
311 /* For MAPLE ULB and eTVPE frequencies */
312#define ULB_CLK_SEL 0x00000038
313#define ULB_CLK_SHIFT 3
314#define ETVPE_CLK_SEL 0x00000007
315#define ETVPE_CLK_SHIFT 0
316
317 switch ((rcw_tmp2 & ULB_CLK_SEL) >> ULB_CLK_SHIFT) {
318 case 1:
319 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK];
320 break;
321 case 2:
322 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK] / 2;
323 break;
324 case 3:
325 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK] / 3;
326 break;
327 case 4:
328 sys_info->freq_maple_ulb = freq_c_pll[CONFIG_SYS_ULB_CLK] / 4;
329 break;
330 case 5:
331 sys_info->freq_maple_ulb = sys_info->freq_systembus;
332 break;
333 case 6:
334 sys_info->freq_maple_ulb =
335 freq_c_pll[CONFIG_SYS_ULB_CLK - 1] / 2;
336 break;
337 case 7:
338 sys_info->freq_maple_ulb =
339 freq_c_pll[CONFIG_SYS_ULB_CLK - 1] / 3;
340 break;
341 default:
342 printf("Error: Unknown MAPLE ULB clock select!\n");
343 }
344
345 switch ((rcw_tmp2 & ETVPE_CLK_SEL) >> ETVPE_CLK_SHIFT) {
346 case 1:
347 sys_info->freq_maple_etvpe = freq_c_pll[CONFIG_SYS_ETVPE_CLK];
348 break;
349 case 2:
350 sys_info->freq_maple_etvpe =
351 freq_c_pll[CONFIG_SYS_ETVPE_CLK] / 2;
352 break;
353 case 3:
354 sys_info->freq_maple_etvpe =
355 freq_c_pll[CONFIG_SYS_ETVPE_CLK] / 3;
356 break;
357 case 4:
358 sys_info->freq_maple_etvpe =
359 freq_c_pll[CONFIG_SYS_ETVPE_CLK] / 4;
360 break;
361 case 5:
362 sys_info->freq_maple_etvpe = sys_info->freq_systembus;
363 break;
364 case 6:
365 sys_info->freq_maple_etvpe =
366 freq_c_pll[CONFIG_SYS_ETVPE_CLK - 1] / 2;
367 break;
368 case 7:
369 sys_info->freq_maple_etvpe =
370 freq_c_pll[CONFIG_SYS_ETVPE_CLK - 1] / 3;
371 break;
372 default:
373 printf("Error: Unknown MAPLE eTVPE clock select!\n");
374 }
375
376#endif
377
York Sund7778f72012-10-08 07:44:11 +0000378#ifdef CONFIG_SYS_DPAA_FMAN
Tom Rini775168e2022-12-04 10:03:56 -0500379#ifndef CFG_FM_PLAT_CLK_DIV
York Sund7778f72012-10-08 07:44:11 +0000380 switch ((rcw_tmp & FM1_CLK_SEL) >> FM1_CLK_SHIFT) {
381 case 1:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500382 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK];
York Sund7778f72012-10-08 07:44:11 +0000383 break;
384 case 2:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500385 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK] / 2;
York Sund7778f72012-10-08 07:44:11 +0000386 break;
387 case 3:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500388 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK] / 3;
York Sund7778f72012-10-08 07:44:11 +0000389 break;
390 case 4:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500391 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK] / 4;
York Sund7778f72012-10-08 07:44:11 +0000392 break;
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000393 case 5:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530394 sys_info->freq_fman[0] = sys_info->freq_systembus;
Sandeep Singhf7dfe252013-03-25 07:33:09 +0000395 break;
York Sund7778f72012-10-08 07:44:11 +0000396 case 6:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500397 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK + 1] / 2;
York Sund7778f72012-10-08 07:44:11 +0000398 break;
399 case 7:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500400 sys_info->freq_fman[0] = freq_c_pll[CFG_SYS_FM1_CLK + 1] / 3;
York Sund7778f72012-10-08 07:44:11 +0000401 break;
402 default:
403 printf("Error: Unknown FMan1 clock select!\n");
404 case 0:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530405 sys_info->freq_fman[0] = sys_info->freq_systembus / 2;
York Sund7778f72012-10-08 07:44:11 +0000406 break;
407 }
Tom Rini0a2bac72022-11-16 13:10:29 -0500408#if (CFG_SYS_NUM_FMAN) == 2
Tom Rini6a5dccc2022-11-16 13:10:41 -0500409#ifdef CFG_SYS_FM2_CLK
York Sund7778f72012-10-08 07:44:11 +0000410#define FM2_CLK_SEL 0x00000038
411#define FM2_CLK_SHIFT 3
412 rcw_tmp = in_be32(&gur->rcwsr[15]);
413 switch ((rcw_tmp & FM2_CLK_SEL) >> FM2_CLK_SHIFT) {
414 case 1:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500415 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1];
York Sund7778f72012-10-08 07:44:11 +0000416 break;
417 case 2:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500418 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1] / 2;
York Sund7778f72012-10-08 07:44:11 +0000419 break;
420 case 3:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500421 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1] / 3;
York Sund7778f72012-10-08 07:44:11 +0000422 break;
423 case 4:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500424 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK + 1] / 4;
York Sund7778f72012-10-08 07:44:11 +0000425 break;
Shaohui Xie45359a32013-11-28 13:52:51 +0800426 case 5:
427 sys_info->freq_fman[1] = sys_info->freq_systembus;
428 break;
York Sund7778f72012-10-08 07:44:11 +0000429 case 6:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500430 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK] / 2;
York Sund7778f72012-10-08 07:44:11 +0000431 break;
432 case 7:
Tom Rini6a5dccc2022-11-16 13:10:41 -0500433 sys_info->freq_fman[1] = freq_c_pll[CFG_SYS_FM2_CLK] / 3;
York Sund7778f72012-10-08 07:44:11 +0000434 break;
435 default:
436 printf("Error: Unknown FMan2 clock select!\n");
437 case 0:
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530438 sys_info->freq_fman[1] = sys_info->freq_systembus / 2;
York Sund7778f72012-10-08 07:44:11 +0000439 break;
440 }
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530441#endif
Tom Rini0a2bac72022-11-16 13:10:29 -0500442#endif /* CFG_SYS_NUM_FMAN == 2 */
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530443#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500444 sys_info->freq_fman[0] = sys_info->freq_systembus / CFG_SYS_FM1_CLK;
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530445#endif
446#endif
Kumar Galadccd9e32009-03-19 02:46:19 -0500447
York Sund7778f72012-10-08 07:44:11 +0000448#else /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
449
450 for_each_cpu(i, cpu, cpu_numcores(), cpu_mask()) {
York Sunaa150bb2013-03-25 07:40:07 +0000451 u32 c_pll_sel = (in_be32(&clk->clkcsr[cpu].clkcncsr) >> 27)
452 & 0xf;
York Sund7778f72012-10-08 07:44:11 +0000453 u32 cplx_pll = core_cplx_PLL[c_pll_sel];
454
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530455 sys_info->freq_processor[cpu] =
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530456 freq_c_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel];
York Sund7778f72012-10-08 07:44:11 +0000457 }
Kumar Galadccd9e32009-03-19 02:46:19 -0500458#define PME_CLK_SEL 0x80000000
459#define FM1_CLK_SEL 0x40000000
460#define FM2_CLK_SEL 0x20000000
Kumar Gala3842bb52011-02-16 02:03:29 -0600461#define HWA_ASYNC_DIV 0x04000000
462#if (CONFIG_SYS_FSL_NUM_CC_PLLS == 2)
463#define HWA_CC_PLL 1
Timur Tabid5e13882012-10-05 11:09:19 +0000464#elif (CONFIG_SYS_FSL_NUM_CC_PLLS == 3)
465#define HWA_CC_PLL 2
Kumar Gala3842bb52011-02-16 02:03:29 -0600466#elif (CONFIG_SYS_FSL_NUM_CC_PLLS == 4)
Wolfgang Denk80f70212011-05-19 22:21:41 +0200467#define HWA_CC_PLL 2
Kumar Gala3842bb52011-02-16 02:03:29 -0600468#else
469#error CONFIG_SYS_FSL_NUM_CC_PLLS not set or unknown case
470#endif
Kumar Galadccd9e32009-03-19 02:46:19 -0500471 rcw_tmp = in_be32(&gur->rcwsr[7]);
472
473#ifdef CONFIG_SYS_DPAA_PME
Kumar Gala3842bb52011-02-16 02:03:29 -0600474 if (rcw_tmp & PME_CLK_SEL) {
475 if (rcw_tmp & HWA_ASYNC_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530476 sys_info->freq_pme = freq_c_pll[HWA_CC_PLL] / 4;
Kumar Gala3842bb52011-02-16 02:03:29 -0600477 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530478 sys_info->freq_pme = freq_c_pll[HWA_CC_PLL] / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600479 } else {
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530480 sys_info->freq_pme = sys_info->freq_systembus / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600481 }
Kumar Galadccd9e32009-03-19 02:46:19 -0500482#endif
483
484#ifdef CONFIG_SYS_DPAA_FMAN
Kumar Gala3842bb52011-02-16 02:03:29 -0600485 if (rcw_tmp & FM1_CLK_SEL) {
486 if (rcw_tmp & HWA_ASYNC_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530487 sys_info->freq_fman[0] = freq_c_pll[HWA_CC_PLL] / 4;
Kumar Gala3842bb52011-02-16 02:03:29 -0600488 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530489 sys_info->freq_fman[0] = freq_c_pll[HWA_CC_PLL] / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600490 } else {
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530491 sys_info->freq_fman[0] = sys_info->freq_systembus / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600492 }
Tom Rini0a2bac72022-11-16 13:10:29 -0500493#if (CFG_SYS_NUM_FMAN) == 2
Kumar Gala3842bb52011-02-16 02:03:29 -0600494 if (rcw_tmp & FM2_CLK_SEL) {
495 if (rcw_tmp & HWA_ASYNC_DIV)
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530496 sys_info->freq_fman[1] = freq_c_pll[HWA_CC_PLL] / 4;
Kumar Gala3842bb52011-02-16 02:03:29 -0600497 else
Prabhakar Kushwaha7e8382f2013-09-03 11:20:15 +0530498 sys_info->freq_fman[1] = freq_c_pll[HWA_CC_PLL] / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600499 } else {
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530500 sys_info->freq_fman[1] = sys_info->freq_systembus / 2;
Kumar Gala3842bb52011-02-16 02:03:29 -0600501 }
Kumar Galadccd9e32009-03-19 02:46:19 -0500502#endif
503#endif
504
Shaohui Xie835c9ad2013-03-25 07:33:25 +0000505#ifdef CONFIG_SYS_DPAA_QBMAN
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530506 sys_info->freq_qman = sys_info->freq_systembus / 2;
Shaohui Xie835c9ad2013-03-25 07:33:25 +0000507#endif
508
York Sund7778f72012-10-08 07:44:11 +0000509#endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
510
Zhao Qiangb818ba22014-03-21 16:21:45 +0800511#ifdef CONFIG_U_QE
512 sys_info->freq_qe = sys_info->freq_systembus / 2;
513#endif
514
York Sund7778f72012-10-08 07:44:11 +0000515#else /* CONFIG_FSL_CORENET */
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530516 uint plat_ratio, e500_ratio, half_freq_systembus;
Haiying Wangbb8aea72009-01-15 11:58:35 -0500517 int i;
Haiying Wang61414682009-05-20 12:30:29 -0400518#ifdef CONFIG_QE
Haiying Wang8cb2af72011-02-11 01:25:30 -0600519 __maybe_unused u32 qe_ratio;
Haiying Wang61414682009-05-20 12:30:29 -0400520#endif
wdenk9c53f402003-10-15 23:53:47 +0000521
522 plat_ratio = (gur->porpllsr) & 0x0000003e;
523 plat_ratio >>= 1;
Tom Rini8c70baa2021-12-14 13:36:40 -0500524 sys_info->freq_systembus = plat_ratio * get_board_sys_clk();
Andy Fleming6d972762007-04-23 02:37:47 -0500525
526 /* Divide before multiply to avoid integer
527 * overflow for processor speeds above 2GHz */
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530528 half_freq_systembus = sys_info->freq_systembus/2;
Poonam Aggrwal4baef822009-07-31 12:08:14 +0530529 for (i = 0; i < cpu_numcores(); i++) {
Haiying Wangbb8aea72009-01-15 11:58:35 -0500530 e500_ratio = ((gur->porpllsr) >> (i * 8 + 16)) & 0x3f;
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530531 sys_info->freq_processor[i] = e500_ratio * half_freq_systembus;
Haiying Wangbb8aea72009-01-15 11:58:35 -0500532 }
James Yangd1d51ad2008-02-08 18:05:08 -0600533
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530534 /* Note: freq_ddrbus is the MCLK frequency, not the data rate. */
535 sys_info->freq_ddrbus = sys_info->freq_systembus;
Kumar Gala07db1702007-12-07 04:59:26 -0600536
Tom Rinif7246c22021-08-21 13:50:17 -0400537#if defined(CONFIG_DYNAMIC_DDR_CLK_FREQ) || defined(CONFIG_STATIC_DDR_CLK_FREQ)
Kumar Gala07db1702007-12-07 04:59:26 -0600538 {
Jason Jinbfcd6c32008-09-27 14:40:57 +0800539 u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO)
540 >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
Kumar Gala07db1702007-12-07 04:59:26 -0600541 if (ddr_ratio != 0x7)
Tom Rinif7246c22021-08-21 13:50:17 -0400542 sys_info->freq_ddrbus = ddr_ratio * get_board_ddr_clk();
Kumar Gala07db1702007-12-07 04:59:26 -0600543 }
544#endif
Trent Piepho0b691fc2008-12-03 15:16:37 -0800545
Haiying Wang61414682009-05-20 12:30:29 -0400546#ifdef CONFIG_QE
York Sun0f577972016-11-18 11:05:38 -0800547#if defined(CONFIG_ARCH_P1021) || defined(CONFIG_ARCH_P1025)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530548 sys_info->freq_qe = sys_info->freq_systembus;
Haiying Wang8cb2af72011-02-11 01:25:30 -0600549#else
Haiying Wang61414682009-05-20 12:30:29 -0400550 qe_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_QE_RATIO)
551 >> MPC85xx_PORPLLSR_QE_RATIO_SHIFT;
Tom Rini8c70baa2021-12-14 13:36:40 -0500552 sys_info->freq_qe = qe_ratio * get_board_sys_clk();
Haiying Wang61414682009-05-20 12:30:29 -0400553#endif
Haiying Wang8cb2af72011-02-11 01:25:30 -0600554#endif
Haiying Wang325a12f2011-01-20 22:26:31 +0000555
556#ifdef CONFIG_SYS_DPAA_FMAN
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530557 sys_info->freq_fman[0] = sys_info->freq_systembus;
Haiying Wang325a12f2011-01-20 22:26:31 +0000558#endif
559
560#endif /* CONFIG_FSL_CORENET */
Haiying Wang61414682009-05-20 12:30:29 -0400561
Dipen Dudhat5d51bf92011-01-19 12:46:27 +0530562#if defined(CONFIG_FSL_LBC)
Prabhakar Kushwahabedc5622017-02-02 15:02:00 +0530563 sys_info->freq_localbus = sys_info->freq_systembus /
564 CONFIG_SYS_FSL_LBC_CLK_DIV;
Dipen Dudhat5d51bf92011-01-19 12:46:27 +0530565#endif
Kumar Gala17ec6fa2012-10-08 07:44:06 +0000566
567#if defined(CONFIG_FSL_IFC)
Prabhakar Kushwaha3c48f582017-02-02 15:01:26 +0530568 sys_info->freq_localbus = sys_info->freq_systembus /
569 CONFIG_SYS_FSL_IFC_CLK_DIV;
Kumar Gala17ec6fa2012-10-08 07:44:06 +0000570#endif
wdenk9c53f402003-10-15 23:53:47 +0000571}
572
Simon Glass85d65312019-12-28 10:44:58 -0700573int get_clocks(void)
wdenk9c53f402003-10-15 23:53:47 +0000574{
wdenk9c53f402003-10-15 23:53:47 +0000575 sys_info_t sys_info;
York Sun5ac012a2016-11-15 13:57:15 -0800576#ifdef CONFIG_ARCH_MPC8544
Tom Rinid5c3bf22022-10-28 20:27:12 -0400577 volatile ccsr_gur_t *gur = (void *) CFG_SYS_MPC85xx_GUTS_ADDR;
Timur Tabi44befe02008-04-04 11:15:58 -0500578#endif
wdenk9c53f402003-10-15 23:53:47 +0000579 get_sys_info (&sys_info);
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530580 gd->cpu_clk = sys_info.freq_processor[0];
581 gd->bus_clk = sys_info.freq_systembus;
582 gd->mem_clk = sys_info.freq_ddrbus;
583 gd->arch.lbc_clk = sys_info.freq_localbus;
Timur Tabi44befe02008-04-04 11:15:58 -0500584
Haiying Wang61414682009-05-20 12:30:29 -0400585#ifdef CONFIG_QE
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530586 gd->arch.qe_clk = sys_info.freq_qe;
Simon Glass8518b172012-12-13 20:48:50 +0000587 gd->arch.brg_clk = gd->arch.qe_clk / 2;
Haiying Wang61414682009-05-20 12:30:29 -0400588#endif
Timur Tabi44befe02008-04-04 11:15:58 -0500589 /*
590 * The base clock for I2C depends on the actual SOC. Unfortunately,
591 * there is no pattern that can be used to determine the frequency, so
592 * the only choice is to look up the actual SOC number and use the value
593 * for that SOC. This information is taken from application note
594 * AN2919.
595 */
Tom Rini0b730a02021-05-14 21:34:21 -0400596#if defined(CONFIG_ARCH_MPC8540) || defined(CONFIG_ARCH_MPC8560)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530597 gd->arch.i2c1_clk = sys_info.freq_systembus;
York Sun5ac012a2016-11-15 13:57:15 -0800598#elif defined(CONFIG_ARCH_MPC8544)
Timur Tabi44befe02008-04-04 11:15:58 -0500599 /*
600 * On the 8544, the I2C clock is the same as the SEC clock. This can be
601 * either CCB/2 or CCB/3, depending on the value of cfg_sec_freq. See
602 * 4.4.3.3 of the 8544 RM. Note that this might actually work for all
603 * 85xx, but only the 8544 has cfg_sec_freq, so it's unknown if the
604 * PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544.
605 */
606 if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG)
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530607 gd->arch.i2c1_clk = sys_info.freq_systembus / 3;
Kumar Gala9632f662008-10-16 21:58:49 -0500608 else
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530609 gd->arch.i2c1_clk = sys_info.freq_systembus / 2;
Timur Tabi44befe02008-04-04 11:15:58 -0500610#else
611 /* Most 85xx SOCs use CCB/2, so this is the default behavior. */
Prabhakar Kushwahad1698082013-08-16 14:52:26 +0530612 gd->arch.i2c1_clk = sys_info.freq_systembus / 2;
Timur Tabi44befe02008-04-04 11:15:58 -0500613#endif
Simon Glassc2baaec2012-12-13 20:48:49 +0000614 gd->arch.i2c2_clk = gd->arch.i2c1_clk;
Timur Tabic1499f482008-01-09 14:35:26 -0600615
Dipen Dudhat9af188d2009-09-01 17:27:00 +0530616#if defined(CONFIG_FSL_ESDHC)
Tom Rini12084d22021-02-20 20:06:29 -0500617#if defined(CONFIG_ARCH_P1010)
Simon Glass9e247d12012-12-13 20:49:05 +0000618 gd->arch.sdhc_clk = gd->bus_clk;
Anton Vorontsovda225942009-10-15 17:47:06 +0400619#else
Simon Glass9e247d12012-12-13 20:49:05 +0000620 gd->arch.sdhc_clk = gd->bus_clk / 2;
Kumar Galacd777282008-08-12 11:14:19 -0500621#endif
Anton Vorontsovda225942009-10-15 17:47:06 +0400622#endif /* defined(CONFIG_FSL_ESDHC) */
Kumar Galacd777282008-08-12 11:14:19 -0500623
wdenk9c53f402003-10-15 23:53:47 +0000624 if(gd->cpu_clk != 0) return (0);
625 else return (1);
626}
627
628
629/********************************************
630 * get_bus_freq
631 * return system bus freq in Hz
632 *********************************************/
Simon Glass85d65312019-12-28 10:44:58 -0700633ulong get_bus_freq(ulong dummy)
wdenk9c53f402003-10-15 23:53:47 +0000634{
James Yangd1d51ad2008-02-08 18:05:08 -0600635 return gd->bus_clk;
wdenk9c53f402003-10-15 23:53:47 +0000636}
Kumar Gala07db1702007-12-07 04:59:26 -0600637
638/********************************************
639 * get_ddr_freq
640 * return ddr bus freq in Hz
641 *********************************************/
642ulong get_ddr_freq (ulong dummy)
643{
James Yangd1d51ad2008-02-08 18:05:08 -0600644 return gd->mem_clk;
Kumar Gala07db1702007-12-07 04:59:26 -0600645}