wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 1 | /* |
Dipen Dudhat | beba93e | 2011-01-19 12:46:27 +0530 | [diff] [blame] | 2 | * Copyright 2004, 2007-2011 Freescale Semiconductor, Inc. |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 3 | * |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 4 | * (C) Copyright 2003 Motorola Inc. |
| 5 | * Xianghua Xiao, (X.Xiao@motorola.com) |
| 6 | * |
| 7 | * (C) Copyright 2000 |
| 8 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 9 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <common.h> |
| 14 | #include <ppc_asm.tmpl> |
Haiying Wang | a52d2f8 | 2011-02-11 01:25:30 -0600 | [diff] [blame] | 15 | #include <linux/compiler.h> |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 16 | #include <asm/processor.h> |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 17 | #include <asm/io.h> |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 18 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 21 | /* --------------------------------------------------------------- */ |
| 22 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 23 | void get_sys_info(sys_info_t *sys_info) |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 24 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 25 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
Kumar Gala | 800c73c | 2012-10-08 07:44:06 +0000 | [diff] [blame] | 26 | #ifdef CONFIG_FSL_IFC |
| 27 | struct fsl_ifc *ifc_regs = (void *)CONFIG_SYS_IFC_ADDR; |
| 28 | u32 ccr; |
| 29 | #endif |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 30 | #ifdef CONFIG_FSL_CORENET |
| 31 | volatile ccsr_clk_t *clk = (void *)(CONFIG_SYS_FSL_CORENET_CLK_ADDR); |
Timur Tabi | fbb9ecf | 2011-08-05 16:15:24 -0500 | [diff] [blame] | 32 | unsigned int cpu; |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 33 | |
| 34 | const u8 core_cplx_PLL[16] = { |
| 35 | [ 0] = 0, /* CC1 PPL / 1 */ |
| 36 | [ 1] = 0, /* CC1 PPL / 2 */ |
| 37 | [ 2] = 0, /* CC1 PPL / 4 */ |
| 38 | [ 4] = 1, /* CC2 PPL / 1 */ |
| 39 | [ 5] = 1, /* CC2 PPL / 2 */ |
| 40 | [ 6] = 1, /* CC2 PPL / 4 */ |
| 41 | [ 8] = 2, /* CC3 PPL / 1 */ |
| 42 | [ 9] = 2, /* CC3 PPL / 2 */ |
| 43 | [10] = 2, /* CC3 PPL / 4 */ |
| 44 | [12] = 3, /* CC4 PPL / 1 */ |
| 45 | [13] = 3, /* CC4 PPL / 2 */ |
| 46 | [14] = 3, /* CC4 PPL / 4 */ |
| 47 | }; |
| 48 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 49 | const u8 core_cplx_pll_div[16] = { |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 50 | [ 0] = 1, /* CC1 PPL / 1 */ |
| 51 | [ 1] = 2, /* CC1 PPL / 2 */ |
| 52 | [ 2] = 4, /* CC1 PPL / 4 */ |
| 53 | [ 4] = 1, /* CC2 PPL / 1 */ |
| 54 | [ 5] = 2, /* CC2 PPL / 2 */ |
| 55 | [ 6] = 4, /* CC2 PPL / 4 */ |
| 56 | [ 8] = 1, /* CC3 PPL / 1 */ |
| 57 | [ 9] = 2, /* CC3 PPL / 2 */ |
| 58 | [10] = 4, /* CC3 PPL / 4 */ |
| 59 | [12] = 1, /* CC4 PPL / 1 */ |
| 60 | [13] = 2, /* CC4 PPL / 2 */ |
| 61 | [14] = 4, /* CC4 PPL / 4 */ |
| 62 | }; |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 63 | uint i, freq_cc_pll[6], rcw_tmp; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 64 | uint ratio[6]; |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 65 | unsigned long sysclk = CONFIG_SYS_CLK_FREQ; |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 66 | uint mem_pll_rat; |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 67 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 68 | sys_info->freq_systembus = sysclk; |
York Sun | 98ffa19 | 2012-10-08 07:44:31 +0000 | [diff] [blame] | 69 | #ifdef CONFIG_DDR_CLK_FREQ |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 70 | sys_info->freq_ddrbus = CONFIG_DDR_CLK_FREQ; |
York Sun | 98ffa19 | 2012-10-08 07:44:31 +0000 | [diff] [blame] | 71 | #else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 72 | sys_info->freq_ddrbus = sysclk; |
York Sun | 98ffa19 | 2012-10-08 07:44:31 +0000 | [diff] [blame] | 73 | #endif |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 74 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 75 | sys_info->freq_systembus *= (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f; |
York Sun | f77329c | 2012-10-08 07:44:09 +0000 | [diff] [blame] | 76 | mem_pll_rat = (in_be32(&gur->rcwsr[0]) >> |
| 77 | FSL_CORENET_RCWSR0_MEM_PLL_RAT_SHIFT) |
| 78 | & FSL_CORENET_RCWSR0_MEM_PLL_RAT_MASK; |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 79 | if (mem_pll_rat > 2) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 80 | sys_info->freq_ddrbus *= mem_pll_rat; |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 81 | else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 82 | sys_info->freq_ddrbus = sys_info->freq_systembus * mem_pll_rat; |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 83 | |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 84 | ratio[0] = (in_be32(&clk->pllc1gsr) >> 1) & 0x3f; |
| 85 | ratio[1] = (in_be32(&clk->pllc2gsr) >> 1) & 0x3f; |
| 86 | ratio[2] = (in_be32(&clk->pllc3gsr) >> 1) & 0x3f; |
| 87 | ratio[3] = (in_be32(&clk->pllc4gsr) >> 1) & 0x3f; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 88 | ratio[4] = (in_be32(&clk->pllc5gsr) >> 1) & 0x3f; |
| 89 | ratio[5] = (in_be32(&clk->pllc6gsr) >> 1) & 0x3f; |
| 90 | for (i = 0; i < 6; i++) { |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 91 | if (ratio[i] > 4) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 92 | freq_cc_pll[i] = sysclk * ratio[i]; |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 93 | else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 94 | freq_cc_pll[i] = sys_info->freq_systembus * ratio[i]; |
Srikanth Srinivasan | ab48ca1 | 2010-02-10 17:32:43 +0800 | [diff] [blame] | 95 | } |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 96 | #ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 |
| 97 | /* |
| 98 | * Each cluster has up to 4 cores, sharing the same PLL selection. |
York Sun | f698143 | 2013-03-25 07:40:07 +0000 | [diff] [blame] | 99 | * The cluster assignment is fixed per SoC. PLL1, PLL2, PLL3 are |
| 100 | * cluster group A, feeding cores on cluster 1 and cluster 2. |
| 101 | * PLL4, PLL5, PLL6 are cluster group B, feeding cores on cluster 3 |
| 102 | * and cluster 4 if existing. |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 103 | */ |
| 104 | for_each_cpu(i, cpu, cpu_numcores(), cpu_mask()) { |
York Sun | f698143 | 2013-03-25 07:40:07 +0000 | [diff] [blame] | 105 | int cluster = fsl_qoriq_core_to_cluster(cpu); |
| 106 | u32 c_pll_sel = (in_be32(&clk->clkcsr[cluster].clkcncsr) >> 27) |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 107 | & 0xf; |
| 108 | u32 cplx_pll = core_cplx_PLL[c_pll_sel]; |
| 109 | if (cplx_pll > 3) |
| 110 | printf("Unsupported architecture configuration" |
| 111 | " in function %s\n", __func__); |
York Sun | f698143 | 2013-03-25 07:40:07 +0000 | [diff] [blame] | 112 | cplx_pll += (cluster / 2) * 3; |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 113 | sys_info->freq_processor[cpu] = |
| 114 | freq_cc_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel]; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 115 | } |
Sandeep Singh | 0cb3325 | 2013-03-25 07:33:09 +0000 | [diff] [blame] | 116 | #ifdef CONFIG_PPC_B4860 |
| 117 | #define FM1_CLK_SEL 0xe0000000 |
| 118 | #define FM1_CLK_SHIFT 29 |
| 119 | #else |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 120 | #define PME_CLK_SEL 0xe0000000 |
| 121 | #define PME_CLK_SHIFT 29 |
| 122 | #define FM1_CLK_SEL 0x1c000000 |
| 123 | #define FM1_CLK_SHIFT 26 |
Sandeep Singh | 0cb3325 | 2013-03-25 07:33:09 +0000 | [diff] [blame] | 124 | #endif |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 125 | rcw_tmp = in_be32(&gur->rcwsr[7]); |
| 126 | |
| 127 | #ifdef CONFIG_SYS_DPAA_PME |
| 128 | switch ((rcw_tmp & PME_CLK_SEL) >> PME_CLK_SHIFT) { |
| 129 | case 1: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 130 | sys_info->freq_pme = freq_cc_pll[0]; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 131 | break; |
| 132 | case 2: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 133 | sys_info->freq_pme = freq_cc_pll[0] / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 134 | break; |
| 135 | case 3: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 136 | sys_info->freq_pme = freq_cc_pll[0] / 3; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 137 | break; |
| 138 | case 4: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 139 | sys_info->freq_pme = freq_cc_pll[0] / 4; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 140 | break; |
| 141 | case 6: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 142 | sys_info->freq_pme = freq_cc_pll[1] / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 143 | break; |
| 144 | case 7: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 145 | sys_info->freq_pme = freq_cc_pll[1] / 3; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 146 | break; |
| 147 | default: |
| 148 | printf("Error: Unknown PME clock select!\n"); |
| 149 | case 0: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 150 | sys_info->freq_pme = sys_info->freq_systembus / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 151 | break; |
| 152 | |
| 153 | } |
| 154 | #endif |
| 155 | |
Haiying Wang | 990e1a8 | 2012-10-11 07:13:39 +0000 | [diff] [blame] | 156 | #ifdef CONFIG_SYS_DPAA_QBMAN |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 157 | sys_info->freq_qman = sys_info->freq_systembus / 2; |
Haiying Wang | 990e1a8 | 2012-10-11 07:13:39 +0000 | [diff] [blame] | 158 | #endif |
| 159 | |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 160 | #ifdef CONFIG_SYS_DPAA_FMAN |
| 161 | switch ((rcw_tmp & FM1_CLK_SEL) >> FM1_CLK_SHIFT) { |
| 162 | case 1: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 163 | sys_info->freq_fman[0] = freq_cc_pll[3]; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 164 | break; |
| 165 | case 2: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 166 | sys_info->freq_fman[0] = freq_cc_pll[3] / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 167 | break; |
| 168 | case 3: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 169 | sys_info->freq_fman[0] = freq_cc_pll[3] / 3; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 170 | break; |
| 171 | case 4: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 172 | sys_info->freq_fman[0] = freq_cc_pll[3] / 4; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 173 | break; |
Sandeep Singh | 0cb3325 | 2013-03-25 07:33:09 +0000 | [diff] [blame] | 174 | case 5: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 175 | sys_info->freq_fman[0] = sys_info->freq_systembus; |
Sandeep Singh | 0cb3325 | 2013-03-25 07:33:09 +0000 | [diff] [blame] | 176 | break; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 177 | case 6: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 178 | sys_info->freq_fman[0] = freq_cc_pll[4] / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 179 | break; |
| 180 | case 7: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 181 | sys_info->freq_fman[0] = freq_cc_pll[4] / 3; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 182 | break; |
| 183 | default: |
| 184 | printf("Error: Unknown FMan1 clock select!\n"); |
| 185 | case 0: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 186 | sys_info->freq_fman[0] = sys_info->freq_systembus / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 187 | break; |
| 188 | } |
| 189 | #if (CONFIG_SYS_NUM_FMAN) == 2 |
| 190 | #define FM2_CLK_SEL 0x00000038 |
| 191 | #define FM2_CLK_SHIFT 3 |
| 192 | rcw_tmp = in_be32(&gur->rcwsr[15]); |
| 193 | switch ((rcw_tmp & FM2_CLK_SEL) >> FM2_CLK_SHIFT) { |
| 194 | case 1: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 195 | sys_info->freq_fman[1] = freq_cc_pll[4]; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 196 | break; |
| 197 | case 2: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 198 | sys_info->freq_fman[1] = freq_cc_pll[4] / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 199 | break; |
| 200 | case 3: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 201 | sys_info->freq_fman[1] = freq_cc_pll[4] / 3; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 202 | break; |
| 203 | case 4: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 204 | sys_info->freq_fman[1] = freq_cc_pll[4] / 4; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 205 | break; |
| 206 | case 6: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 207 | sys_info->freq_fman[1] = freq_cc_pll[3] / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 208 | break; |
| 209 | case 7: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 210 | sys_info->freq_fman[1] = freq_cc_pll[3] / 3; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 211 | break; |
| 212 | default: |
| 213 | printf("Error: Unknown FMan2 clock select!\n"); |
| 214 | case 0: |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 215 | sys_info->freq_fman[1] = sys_info->freq_systembus / 2; |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 216 | break; |
| 217 | } |
| 218 | #endif /* CONFIG_SYS_NUM_FMAN == 2 */ |
| 219 | #endif /* CONFIG_SYS_DPAA_FMAN */ |
| 220 | |
| 221 | #else /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */ |
| 222 | |
Timur Tabi | fbb9ecf | 2011-08-05 16:15:24 -0500 | [diff] [blame] | 223 | for_each_cpu(i, cpu, cpu_numcores(), cpu_mask()) { |
York Sun | f698143 | 2013-03-25 07:40:07 +0000 | [diff] [blame] | 224 | u32 c_pll_sel = (in_be32(&clk->clkcsr[cpu].clkcncsr) >> 27) |
| 225 | & 0xf; |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 226 | u32 cplx_pll = core_cplx_PLL[c_pll_sel]; |
| 227 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 228 | sys_info->freq_processor[cpu] = |
| 229 | freq_cc_pll[cplx_pll] / core_cplx_pll_div[c_pll_sel]; |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 230 | } |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 231 | #define PME_CLK_SEL 0x80000000 |
| 232 | #define FM1_CLK_SEL 0x40000000 |
| 233 | #define FM2_CLK_SEL 0x20000000 |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 234 | #define HWA_ASYNC_DIV 0x04000000 |
| 235 | #if (CONFIG_SYS_FSL_NUM_CC_PLLS == 2) |
| 236 | #define HWA_CC_PLL 1 |
Timur Tabi | 4905443 | 2012-10-05 11:09:19 +0000 | [diff] [blame] | 237 | #elif (CONFIG_SYS_FSL_NUM_CC_PLLS == 3) |
| 238 | #define HWA_CC_PLL 2 |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 239 | #elif (CONFIG_SYS_FSL_NUM_CC_PLLS == 4) |
Wolfgang Denk | cd6881b | 2011-05-19 22:21:41 +0200 | [diff] [blame] | 240 | #define HWA_CC_PLL 2 |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 241 | #else |
| 242 | #error CONFIG_SYS_FSL_NUM_CC_PLLS not set or unknown case |
| 243 | #endif |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 244 | rcw_tmp = in_be32(&gur->rcwsr[7]); |
| 245 | |
| 246 | #ifdef CONFIG_SYS_DPAA_PME |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 247 | if (rcw_tmp & PME_CLK_SEL) { |
| 248 | if (rcw_tmp & HWA_ASYNC_DIV) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 249 | sys_info->freq_pme = freq_cc_pll[HWA_CC_PLL] / 4; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 250 | else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 251 | sys_info->freq_pme = freq_cc_pll[HWA_CC_PLL] / 2; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 252 | } else { |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 253 | sys_info->freq_pme = sys_info->freq_systembus / 2; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 254 | } |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 255 | #endif |
| 256 | |
| 257 | #ifdef CONFIG_SYS_DPAA_FMAN |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 258 | if (rcw_tmp & FM1_CLK_SEL) { |
| 259 | if (rcw_tmp & HWA_ASYNC_DIV) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 260 | sys_info->freq_fman[0] = freq_cc_pll[HWA_CC_PLL] / 4; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 261 | else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 262 | sys_info->freq_fman[0] = freq_cc_pll[HWA_CC_PLL] / 2; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 263 | } else { |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 264 | sys_info->freq_fman[0] = sys_info->freq_systembus / 2; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 265 | } |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 266 | #if (CONFIG_SYS_NUM_FMAN) == 2 |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 267 | if (rcw_tmp & FM2_CLK_SEL) { |
| 268 | if (rcw_tmp & HWA_ASYNC_DIV) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 269 | sys_info->freq_fman[1] = freq_cc_pll[HWA_CC_PLL] / 4; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 270 | else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 271 | sys_info->freq_fman[1] = freq_cc_pll[HWA_CC_PLL] / 2; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 272 | } else { |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 273 | sys_info->freq_fman[1] = sys_info->freq_systembus / 2; |
Kumar Gala | b5c8753 | 2011-02-16 02:03:29 -0600 | [diff] [blame] | 274 | } |
Kumar Gala | 39aaca1 | 2009-03-19 02:46:19 -0500 | [diff] [blame] | 275 | #endif |
| 276 | #endif |
| 277 | |
Shaohui Xie | 3e83fc9 | 2013-03-25 07:33:25 +0000 | [diff] [blame] | 278 | #ifdef CONFIG_SYS_DPAA_QBMAN |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 279 | sys_info->freq_qman = sys_info->freq_systembus / 2; |
Shaohui Xie | 3e83fc9 | 2013-03-25 07:33:25 +0000 | [diff] [blame] | 280 | #endif |
| 281 | |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 282 | #endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */ |
| 283 | |
| 284 | #else /* CONFIG_FSL_CORENET */ |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 285 | uint plat_ratio, e500_ratio, half_freq_systembus; |
Haiying Wang | 2fc7eb0 | 2009-01-15 11:58:35 -0500 | [diff] [blame] | 286 | int i; |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 287 | #ifdef CONFIG_QE |
Haiying Wang | a52d2f8 | 2011-02-11 01:25:30 -0600 | [diff] [blame] | 288 | __maybe_unused u32 qe_ratio; |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 289 | #endif |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 290 | |
| 291 | plat_ratio = (gur->porpllsr) & 0x0000003e; |
| 292 | plat_ratio >>= 1; |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 293 | sys_info->freq_systembus = plat_ratio * CONFIG_SYS_CLK_FREQ; |
Andy Fleming | 66ed6cc | 2007-04-23 02:37:47 -0500 | [diff] [blame] | 294 | |
| 295 | /* Divide before multiply to avoid integer |
| 296 | * overflow for processor speeds above 2GHz */ |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 297 | half_freq_systembus = sys_info->freq_systembus/2; |
Poonam Aggrwal | 0e87098 | 2009-07-31 12:08:14 +0530 | [diff] [blame] | 298 | for (i = 0; i < cpu_numcores(); i++) { |
Haiying Wang | 2fc7eb0 | 2009-01-15 11:58:35 -0500 | [diff] [blame] | 299 | e500_ratio = ((gur->porpllsr) >> (i * 8 + 16)) & 0x3f; |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 300 | sys_info->freq_processor[i] = e500_ratio * half_freq_systembus; |
Haiying Wang | 2fc7eb0 | 2009-01-15 11:58:35 -0500 | [diff] [blame] | 301 | } |
James Yang | a3e77fa | 2008-02-08 18:05:08 -0600 | [diff] [blame] | 302 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 303 | /* Note: freq_ddrbus is the MCLK frequency, not the data rate. */ |
| 304 | sys_info->freq_ddrbus = sys_info->freq_systembus; |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 305 | |
| 306 | #ifdef CONFIG_DDR_CLK_FREQ |
| 307 | { |
Jason Jin | c039111 | 2008-09-27 14:40:57 +0800 | [diff] [blame] | 308 | u32 ddr_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO) |
| 309 | >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT; |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 310 | if (ddr_ratio != 0x7) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 311 | sys_info->freq_ddrbus = ddr_ratio * CONFIG_DDR_CLK_FREQ; |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 312 | } |
| 313 | #endif |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 314 | |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 315 | #ifdef CONFIG_QE |
York Sun | be7bebe | 2012-08-10 11:07:26 +0000 | [diff] [blame] | 316 | #if defined(CONFIG_P1012) || defined(CONFIG_P1021) || defined(CONFIG_P1025) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 317 | sys_info->freq_qe = sys_info->freq_systembus; |
Haiying Wang | a52d2f8 | 2011-02-11 01:25:30 -0600 | [diff] [blame] | 318 | #else |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 319 | qe_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_QE_RATIO) |
| 320 | >> MPC85xx_PORPLLSR_QE_RATIO_SHIFT; |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 321 | sys_info->freq_qe = qe_ratio * CONFIG_SYS_CLK_FREQ; |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 322 | #endif |
Haiying Wang | a52d2f8 | 2011-02-11 01:25:30 -0600 | [diff] [blame] | 323 | #endif |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 324 | |
Haiying Wang | 24995d8 | 2011-01-20 22:26:31 +0000 | [diff] [blame] | 325 | #ifdef CONFIG_SYS_DPAA_FMAN |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 326 | sys_info->freq_fman[0] = sys_info->freq_systembus; |
Haiying Wang | 24995d8 | 2011-01-20 22:26:31 +0000 | [diff] [blame] | 327 | #endif |
| 328 | |
| 329 | #endif /* CONFIG_FSL_CORENET */ |
| 330 | |
Dipen Dudhat | beba93e | 2011-01-19 12:46:27 +0530 | [diff] [blame] | 331 | #if defined(CONFIG_FSL_LBC) |
York Sun | 9a653a9 | 2012-10-08 07:44:11 +0000 | [diff] [blame] | 332 | uint lcrr_div; |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 333 | #if defined(CONFIG_SYS_LBC_LCRR) |
| 334 | /* We will program LCRR to this value later */ |
| 335 | lcrr_div = CONFIG_SYS_LBC_LCRR & LCRR_CLKDIV; |
| 336 | #else |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 337 | lcrr_div = in_be32(&(LBC_BASE_ADDR)->lcrr) & LCRR_CLKDIV; |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 338 | #endif |
| 339 | if (lcrr_div == 2 || lcrr_div == 4 || lcrr_div == 8) { |
Dave Liu | 0fd2fa6 | 2009-11-17 20:49:05 +0800 | [diff] [blame] | 340 | #if defined(CONFIG_FSL_CORENET) |
| 341 | /* If this is corenet based SoC, bit-representation |
| 342 | * for four times the clock divider values. |
| 343 | */ |
| 344 | lcrr_div *= 4; |
| 345 | #elif !defined(CONFIG_MPC8540) && !defined(CONFIG_MPC8541) && \ |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 346 | !defined(CONFIG_MPC8555) && !defined(CONFIG_MPC8560) |
| 347 | /* |
| 348 | * Yes, the entire PQ38 family use the same |
| 349 | * bit-representation for twice the clock divider values. |
| 350 | */ |
| 351 | lcrr_div *= 2; |
| 352 | #endif |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 353 | sys_info->freq_localbus = sys_info->freq_systembus / lcrr_div; |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 354 | } else { |
| 355 | /* In case anyone cares what the unknown value is */ |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 356 | sys_info->freq_localbus = lcrr_div; |
Trent Piepho | ada591d | 2008-12-03 15:16:37 -0800 | [diff] [blame] | 357 | } |
Dipen Dudhat | beba93e | 2011-01-19 12:46:27 +0530 | [diff] [blame] | 358 | #endif |
Kumar Gala | 800c73c | 2012-10-08 07:44:06 +0000 | [diff] [blame] | 359 | |
| 360 | #if defined(CONFIG_FSL_IFC) |
| 361 | ccr = in_be32(&ifc_regs->ifc_ccr); |
| 362 | ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1; |
| 363 | |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 364 | sys_info->freq_localbus = sys_info->freq_systembus / ccr; |
Kumar Gala | 800c73c | 2012-10-08 07:44:06 +0000 | [diff] [blame] | 365 | #endif |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 366 | } |
| 367 | |
Andy Fleming | 66ed6cc | 2007-04-23 02:37:47 -0500 | [diff] [blame] | 368 | |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 369 | int get_clocks (void) |
| 370 | { |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 371 | sys_info_t sys_info; |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 372 | #ifdef CONFIG_MPC8544 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 373 | volatile ccsr_gur_t *gur = (void *) CONFIG_SYS_MPC85xx_GUTS_ADDR; |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 374 | #endif |
Jon Loeliger | 9c4c5ae | 2005-07-23 10:37:35 -0500 | [diff] [blame] | 375 | #if defined(CONFIG_CPM2) |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 376 | volatile ccsr_cpm_t *cpm = (ccsr_cpm_t *)CONFIG_SYS_MPC85xx_CPM_ADDR; |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 377 | uint sccr, dfbrg; |
| 378 | |
| 379 | /* set VCO = 4 * BRG */ |
Kumar Gala | aafeefb | 2007-11-28 00:36:33 -0600 | [diff] [blame] | 380 | cpm->im_cpm_intctl.sccr &= 0xfffffffc; |
| 381 | sccr = cpm->im_cpm_intctl.sccr; |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 382 | dfbrg = (sccr & SCCR_DFBRG_MSK) >> SCCR_DFBRG_SHIFT; |
| 383 | #endif |
| 384 | get_sys_info (&sys_info); |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 385 | gd->cpu_clk = sys_info.freq_processor[0]; |
| 386 | gd->bus_clk = sys_info.freq_systembus; |
| 387 | gd->mem_clk = sys_info.freq_ddrbus; |
| 388 | gd->arch.lbc_clk = sys_info.freq_localbus; |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 389 | |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 390 | #ifdef CONFIG_QE |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 391 | gd->arch.qe_clk = sys_info.freq_qe; |
Simon Glass | 45bae2e | 2012-12-13 20:48:50 +0000 | [diff] [blame] | 392 | gd->arch.brg_clk = gd->arch.qe_clk / 2; |
Haiying Wang | b3d7f20 | 2009-05-20 12:30:29 -0400 | [diff] [blame] | 393 | #endif |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 394 | /* |
| 395 | * The base clock for I2C depends on the actual SOC. Unfortunately, |
| 396 | * there is no pattern that can be used to determine the frequency, so |
| 397 | * the only choice is to look up the actual SOC number and use the value |
| 398 | * for that SOC. This information is taken from application note |
| 399 | * AN2919. |
| 400 | */ |
| 401 | #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
Tang Yuantian | f62b123 | 2013-09-06 10:45:40 +0800 | [diff] [blame] | 402 | defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555) || \ |
| 403 | defined(CONFIG_P1022) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 404 | gd->arch.i2c1_clk = sys_info.freq_systembus; |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 405 | #elif defined(CONFIG_MPC8544) |
| 406 | /* |
| 407 | * On the 8544, the I2C clock is the same as the SEC clock. This can be |
| 408 | * either CCB/2 or CCB/3, depending on the value of cfg_sec_freq. See |
| 409 | * 4.4.3.3 of the 8544 RM. Note that this might actually work for all |
| 410 | * 85xx, but only the 8544 has cfg_sec_freq, so it's unknown if the |
| 411 | * PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544. |
| 412 | */ |
| 413 | if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 414 | gd->arch.i2c1_clk = sys_info.freq_systembus / 3; |
Kumar Gala | 42653b8 | 2008-10-16 21:58:49 -0500 | [diff] [blame] | 415 | else |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 416 | gd->arch.i2c1_clk = sys_info.freq_systembus / 2; |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 417 | #else |
| 418 | /* Most 85xx SOCs use CCB/2, so this is the default behavior. */ |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 419 | gd->arch.i2c1_clk = sys_info.freq_systembus / 2; |
Timur Tabi | 88353a9 | 2008-04-04 11:15:58 -0500 | [diff] [blame] | 420 | #endif |
Simon Glass | 609e6ec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 421 | gd->arch.i2c2_clk = gd->arch.i2c1_clk; |
Timur Tabi | 943afa2 | 2008-01-09 14:35:26 -0600 | [diff] [blame] | 422 | |
Dipen Dudhat | 6b9ea08 | 2009-09-01 17:27:00 +0530 | [diff] [blame] | 423 | #if defined(CONFIG_FSL_ESDHC) |
Priyanka Jain | 7d640e9 | 2011-02-08 15:45:25 +0530 | [diff] [blame] | 424 | #if defined(CONFIG_MPC8569) || defined(CONFIG_P1010) ||\ |
| 425 | defined(CONFIG_P1014) |
Simon Glass | e9adeca | 2012-12-13 20:49:05 +0000 | [diff] [blame] | 426 | gd->arch.sdhc_clk = gd->bus_clk; |
Anton Vorontsov | 7f52ed5 | 2009-10-15 17:47:06 +0400 | [diff] [blame] | 427 | #else |
Simon Glass | e9adeca | 2012-12-13 20:49:05 +0000 | [diff] [blame] | 428 | gd->arch.sdhc_clk = gd->bus_clk / 2; |
Kumar Gala | ef50d6c | 2008-08-12 11:14:19 -0500 | [diff] [blame] | 429 | #endif |
Anton Vorontsov | 7f52ed5 | 2009-10-15 17:47:06 +0400 | [diff] [blame] | 430 | #endif /* defined(CONFIG_FSL_ESDHC) */ |
Kumar Gala | ef50d6c | 2008-08-12 11:14:19 -0500 | [diff] [blame] | 431 | |
Jon Loeliger | 9c4c5ae | 2005-07-23 10:37:35 -0500 | [diff] [blame] | 432 | #if defined(CONFIG_CPM2) |
Prabhakar Kushwaha | 997399f | 2013-08-16 14:52:26 +0530 | [diff] [blame] | 433 | gd->arch.vco_out = 2*sys_info.freq_systembus; |
Simon Glass | 748cd05 | 2012-12-13 20:48:46 +0000 | [diff] [blame] | 434 | gd->arch.cpm_clk = gd->arch.vco_out / 2; |
| 435 | gd->arch.scc_clk = gd->arch.vco_out / 4; |
| 436 | gd->arch.brg_clk = gd->arch.vco_out / (1 << (2 * (dfbrg + 1))); |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 437 | #endif |
| 438 | |
| 439 | if(gd->cpu_clk != 0) return (0); |
| 440 | else return (1); |
| 441 | } |
| 442 | |
| 443 | |
| 444 | /******************************************** |
| 445 | * get_bus_freq |
| 446 | * return system bus freq in Hz |
| 447 | *********************************************/ |
| 448 | ulong get_bus_freq (ulong dummy) |
| 449 | { |
James Yang | a3e77fa | 2008-02-08 18:05:08 -0600 | [diff] [blame] | 450 | return gd->bus_clk; |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 451 | } |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 452 | |
| 453 | /******************************************** |
| 454 | * get_ddr_freq |
| 455 | * return ddr bus freq in Hz |
| 456 | *********************************************/ |
| 457 | ulong get_ddr_freq (ulong dummy) |
| 458 | { |
James Yang | a3e77fa | 2008-02-08 18:05:08 -0600 | [diff] [blame] | 459 | return gd->mem_clk; |
Kumar Gala | d435793 | 2007-12-07 04:59:26 -0600 | [diff] [blame] | 460 | } |