Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000-2002 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 5 | * Copyright (C) 2004-2007 Freescale Semiconductor, Inc. |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 6 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <mpc83xx.h> |
Kim Phillips | d82b077 | 2007-04-30 15:26:21 -0500 | [diff] [blame] | 12 | #include <command.h> |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 13 | #include <asm/processor.h> |
| 14 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 17 | /* ----------------------------------------------------------------- */ |
| 18 | |
| 19 | typedef enum { |
| 20 | _unk, |
| 21 | _off, |
| 22 | _byp, |
| 23 | _x8, |
| 24 | _x4, |
| 25 | _x2, |
| 26 | _x1, |
| 27 | _1x, |
| 28 | _1_5x, |
| 29 | _2x, |
| 30 | _2_5x, |
| 31 | _3x |
| 32 | } mult_t; |
| 33 | |
| 34 | typedef struct { |
| 35 | mult_t core_csb_ratio; |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 36 | mult_t vco_divider; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 37 | } corecnf_t; |
| 38 | |
Kim Phillips | b5c312a | 2012-10-29 13:34:39 +0000 | [diff] [blame] | 39 | static corecnf_t corecnf_tab[] = { |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 40 | {_byp, _byp}, /* 0x00 */ |
| 41 | {_byp, _byp}, /* 0x01 */ |
| 42 | {_byp, _byp}, /* 0x02 */ |
| 43 | {_byp, _byp}, /* 0x03 */ |
| 44 | {_byp, _byp}, /* 0x04 */ |
| 45 | {_byp, _byp}, /* 0x05 */ |
| 46 | {_byp, _byp}, /* 0x06 */ |
| 47 | {_byp, _byp}, /* 0x07 */ |
| 48 | {_1x, _x2}, /* 0x08 */ |
| 49 | {_1x, _x4}, /* 0x09 */ |
| 50 | {_1x, _x8}, /* 0x0A */ |
| 51 | {_1x, _x8}, /* 0x0B */ |
| 52 | {_1_5x, _x2}, /* 0x0C */ |
| 53 | {_1_5x, _x4}, /* 0x0D */ |
| 54 | {_1_5x, _x8}, /* 0x0E */ |
| 55 | {_1_5x, _x8}, /* 0x0F */ |
| 56 | {_2x, _x2}, /* 0x10 */ |
| 57 | {_2x, _x4}, /* 0x11 */ |
| 58 | {_2x, _x8}, /* 0x12 */ |
| 59 | {_2x, _x8}, /* 0x13 */ |
| 60 | {_2_5x, _x2}, /* 0x14 */ |
| 61 | {_2_5x, _x4}, /* 0x15 */ |
| 62 | {_2_5x, _x8}, /* 0x16 */ |
| 63 | {_2_5x, _x8}, /* 0x17 */ |
| 64 | {_3x, _x2}, /* 0x18 */ |
| 65 | {_3x, _x4}, /* 0x19 */ |
| 66 | {_3x, _x8}, /* 0x1A */ |
| 67 | {_3x, _x8}, /* 0x1B */ |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | /* ----------------------------------------------------------------- */ |
| 71 | |
| 72 | /* |
| 73 | * |
| 74 | */ |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 75 | int get_clocks(void) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 76 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 77 | volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 78 | u32 pci_sync_in; |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 79 | u8 spmf; |
| 80 | u8 clkin_div; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 81 | u32 sccr; |
| 82 | u32 corecnf_tab_index; |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 83 | u8 corepll; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 84 | u32 lcrr; |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 85 | |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 86 | u32 csb_clk; |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 87 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 88 | defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 89 | u32 tsec1_clk; |
| 90 | u32 tsec2_clk; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 91 | u32 usbdr_clk; |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 92 | #elif defined(CONFIG_MPC8309) |
| 93 | u32 usbdr_clk; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 94 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 95 | #ifdef CONFIG_MPC834x |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 96 | u32 usbmph_clk; |
| 97 | #endif |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 98 | u32 core_clk; |
| 99 | u32 i2c1_clk; |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 100 | #if !defined(CONFIG_MPC832x) |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 101 | u32 i2c2_clk; |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 102 | #endif |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 103 | #if defined(CONFIG_MPC8315) |
| 104 | u32 tdm_clk; |
| 105 | #endif |
Rini van Zetten | a249617 | 2010-04-15 16:03:05 +0200 | [diff] [blame] | 106 | #if defined(CONFIG_FSL_ESDHC) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 107 | u32 sdhc_clk; |
| 108 | #endif |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 109 | #if !defined(CONFIG_MPC8309) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 110 | u32 enc_clk; |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 111 | #endif |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 112 | u32 lbiu_clk; |
| 113 | u32 lclk_clk; |
Kim Phillips | c02cf1e | 2008-03-28 10:18:40 -0500 | [diff] [blame] | 114 | u32 mem_clk; |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 115 | #if defined(CONFIG_MPC8360) |
Kim Phillips | c02cf1e | 2008-03-28 10:18:40 -0500 | [diff] [blame] | 116 | u32 mem_sec_clk; |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 117 | #endif |
Gerlando Falauto | 77cf283 | 2012-10-10 22:13:06 +0000 | [diff] [blame] | 118 | #if defined(CONFIG_QE) |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 119 | u32 qepmf; |
| 120 | u32 qepdf; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 121 | u32 qe_clk; |
| 122 | u32 brg_clk; |
| 123 | #endif |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 124 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 125 | defined(CONFIG_MPC837x) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 126 | u32 pciexp1_clk; |
| 127 | u32 pciexp2_clk; |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 128 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 129 | #if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 130 | u32 sata_clk; |
| 131 | #endif |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 132 | |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 133 | if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 134 | return -1; |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 135 | |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 136 | clkin_div = ((im->clk.spmr & SPMR_CKID) >> SPMR_CKID_SHIFT); |
Marian Balakowicz | 513b4a1 | 2005-10-11 19:09:42 +0200 | [diff] [blame] | 137 | |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 138 | if (im->reset.rcwh & HRCWH_PCI_HOST) { |
| 139 | #if defined(CONFIG_83XX_CLKIN) |
| 140 | pci_sync_in = CONFIG_83XX_CLKIN / (1 + clkin_div); |
| 141 | #else |
| 142 | pci_sync_in = 0xDEADBEEF; |
| 143 | #endif |
| 144 | } else { |
| 145 | #if defined(CONFIG_83XX_PCICLK) |
| 146 | pci_sync_in = CONFIG_83XX_PCICLK; |
| 147 | #else |
| 148 | pci_sync_in = 0xDEADBEEF; |
| 149 | #endif |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 150 | } |
Marian Balakowicz | 513b4a1 | 2005-10-11 19:09:42 +0200 | [diff] [blame] | 151 | |
Joakim Tjernlund | f2af1bb | 2011-01-27 16:30:54 +0100 | [diff] [blame] | 152 | spmf = (im->clk.spmr & SPMR_SPMF) >> SPMR_SPMF_SHIFT; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 153 | csb_clk = pci_sync_in * (1 + clkin_div) * spmf; |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 154 | |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 155 | sccr = im->clk.sccr; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 156 | |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 157 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 158 | defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 159 | switch ((sccr & SCCR_TSEC1CM) >> SCCR_TSEC1CM_SHIFT) { |
| 160 | case 0: |
| 161 | tsec1_clk = 0; |
| 162 | break; |
| 163 | case 1: |
| 164 | tsec1_clk = csb_clk; |
| 165 | break; |
| 166 | case 2: |
| 167 | tsec1_clk = csb_clk / 2; |
| 168 | break; |
| 169 | case 3: |
| 170 | tsec1_clk = csb_clk / 3; |
| 171 | break; |
| 172 | default: |
| 173 | /* unkown SCCR_TSEC1CM value */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 174 | return -2; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 175 | } |
Gerlando Falauto | 7473555 | 2012-10-10 22:13:07 +0000 | [diff] [blame] | 176 | #endif |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 177 | |
Gerlando Falauto | 7473555 | 2012-10-10 22:13:07 +0000 | [diff] [blame] | 178 | #if defined(CONFIG_MPC830x) || defined(CONFIG_MPC831x) || \ |
| 179 | defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 180 | switch ((sccr & SCCR_USBDRCM) >> SCCR_USBDRCM_SHIFT) { |
| 181 | case 0: |
| 182 | usbdr_clk = 0; |
| 183 | break; |
| 184 | case 1: |
| 185 | usbdr_clk = csb_clk; |
| 186 | break; |
| 187 | case 2: |
| 188 | usbdr_clk = csb_clk / 2; |
| 189 | break; |
| 190 | case 3: |
| 191 | usbdr_clk = csb_clk / 3; |
| 192 | break; |
| 193 | default: |
| 194 | /* unkown SCCR_USBDRCM value */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 195 | return -3; |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 196 | } |
| 197 | #endif |
| 198 | |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 199 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC8315) || \ |
| 200 | defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 201 | switch ((sccr & SCCR_TSEC2CM) >> SCCR_TSEC2CM_SHIFT) { |
| 202 | case 0: |
| 203 | tsec2_clk = 0; |
| 204 | break; |
| 205 | case 1: |
| 206 | tsec2_clk = csb_clk; |
| 207 | break; |
| 208 | case 2: |
| 209 | tsec2_clk = csb_clk / 2; |
| 210 | break; |
| 211 | case 3: |
| 212 | tsec2_clk = csb_clk / 3; |
| 213 | break; |
| 214 | default: |
| 215 | /* unkown SCCR_TSEC2CM value */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 216 | return -4; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 217 | } |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 218 | #elif defined(CONFIG_MPC8313) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 219 | tsec2_clk = tsec1_clk; |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 220 | |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 221 | if (!(sccr & SCCR_TSEC1ON)) |
| 222 | tsec1_clk = 0; |
| 223 | if (!(sccr & SCCR_TSEC2ON)) |
| 224 | tsec2_clk = 0; |
| 225 | #endif |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 226 | |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 227 | #if defined(CONFIG_MPC834x) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 228 | switch ((sccr & SCCR_USBMPHCM) >> SCCR_USBMPHCM_SHIFT) { |
| 229 | case 0: |
| 230 | usbmph_clk = 0; |
| 231 | break; |
| 232 | case 1: |
| 233 | usbmph_clk = csb_clk; |
| 234 | break; |
| 235 | case 2: |
| 236 | usbmph_clk = csb_clk / 2; |
| 237 | break; |
| 238 | case 3: |
| 239 | usbmph_clk = csb_clk / 3; |
| 240 | break; |
| 241 | default: |
| 242 | /* unkown SCCR_USBMPHCM value */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 243 | return -5; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 244 | } |
| 245 | |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 246 | if (usbmph_clk != 0 && usbdr_clk != 0 && usbmph_clk != usbdr_clk) { |
| 247 | /* if USB MPH clock is not disabled and |
| 248 | * USB DR clock is not disabled then |
| 249 | * USB MPH & USB DR must have the same rate |
| 250 | */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 251 | return -6; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 252 | } |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 253 | #endif |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 254 | #if !defined(CONFIG_MPC8309) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 255 | switch ((sccr & SCCR_ENCCM) >> SCCR_ENCCM_SHIFT) { |
| 256 | case 0: |
| 257 | enc_clk = 0; |
| 258 | break; |
| 259 | case 1: |
| 260 | enc_clk = csb_clk; |
| 261 | break; |
| 262 | case 2: |
| 263 | enc_clk = csb_clk / 2; |
| 264 | break; |
| 265 | case 3: |
| 266 | enc_clk = csb_clk / 3; |
| 267 | break; |
| 268 | default: |
| 269 | /* unkown SCCR_ENCCM value */ |
| 270 | return -7; |
| 271 | } |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 272 | #endif |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 273 | |
Rini van Zetten | a249617 | 2010-04-15 16:03:05 +0200 | [diff] [blame] | 274 | #if defined(CONFIG_FSL_ESDHC) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 275 | switch ((sccr & SCCR_SDHCCM) >> SCCR_SDHCCM_SHIFT) { |
| 276 | case 0: |
| 277 | sdhc_clk = 0; |
| 278 | break; |
| 279 | case 1: |
| 280 | sdhc_clk = csb_clk; |
| 281 | break; |
| 282 | case 2: |
| 283 | sdhc_clk = csb_clk / 2; |
| 284 | break; |
| 285 | case 3: |
| 286 | sdhc_clk = csb_clk / 3; |
| 287 | break; |
| 288 | default: |
| 289 | /* unkown SCCR_SDHCCM value */ |
| 290 | return -8; |
| 291 | } |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 292 | #endif |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 293 | #if defined(CONFIG_MPC8315) |
| 294 | switch ((sccr & SCCR_TDMCM) >> SCCR_TDMCM_SHIFT) { |
| 295 | case 0: |
| 296 | tdm_clk = 0; |
| 297 | break; |
| 298 | case 1: |
| 299 | tdm_clk = csb_clk; |
| 300 | break; |
| 301 | case 2: |
| 302 | tdm_clk = csb_clk / 2; |
| 303 | break; |
| 304 | case 3: |
| 305 | tdm_clk = csb_clk / 3; |
| 306 | break; |
| 307 | default: |
| 308 | /* unkown SCCR_TDMCM value */ |
| 309 | return -8; |
| 310 | } |
| 311 | #endif |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 312 | |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 313 | #if defined(CONFIG_MPC834x) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 314 | i2c1_clk = tsec2_clk; |
| 315 | #elif defined(CONFIG_MPC8360) |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 316 | i2c1_clk = csb_clk; |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 317 | #elif defined(CONFIG_MPC832x) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 318 | i2c1_clk = enc_clk; |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 319 | #elif defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 320 | i2c1_clk = enc_clk; |
Rini van Zetten | a249617 | 2010-04-15 16:03:05 +0200 | [diff] [blame] | 321 | #elif defined(CONFIG_FSL_ESDHC) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 322 | i2c1_clk = sdhc_clk; |
Andre Schwarz | a76cc61 | 2011-04-14 14:57:40 +0200 | [diff] [blame] | 323 | #elif defined(CONFIG_MPC837x) |
| 324 | i2c1_clk = enc_clk; |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 325 | #elif defined(CONFIG_MPC8309) |
| 326 | i2c1_clk = csb_clk; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 327 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 328 | #if !defined(CONFIG_MPC832x) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 329 | i2c2_clk = csb_clk; /* i2c-2 clk is equal to csb clk */ |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 330 | #endif |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 331 | |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 332 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 333 | defined(CONFIG_MPC837x) |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 334 | switch ((sccr & SCCR_PCIEXP1CM) >> SCCR_PCIEXP1CM_SHIFT) { |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 335 | case 0: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 336 | pciexp1_clk = 0; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 337 | break; |
| 338 | case 1: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 339 | pciexp1_clk = csb_clk; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 340 | break; |
| 341 | case 2: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 342 | pciexp1_clk = csb_clk / 2; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 343 | break; |
| 344 | case 3: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 345 | pciexp1_clk = csb_clk / 3; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 346 | break; |
| 347 | default: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 348 | /* unkown SCCR_PCIEXP1CM value */ |
| 349 | return -9; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 350 | } |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 351 | |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 352 | switch ((sccr & SCCR_PCIEXP2CM) >> SCCR_PCIEXP2CM_SHIFT) { |
| 353 | case 0: |
| 354 | pciexp2_clk = 0; |
| 355 | break; |
| 356 | case 1: |
| 357 | pciexp2_clk = csb_clk; |
| 358 | break; |
| 359 | case 2: |
| 360 | pciexp2_clk = csb_clk / 2; |
| 361 | break; |
| 362 | case 3: |
| 363 | pciexp2_clk = csb_clk / 3; |
| 364 | break; |
| 365 | default: |
| 366 | /* unkown SCCR_PCIEXP2CM value */ |
| 367 | return -10; |
| 368 | } |
| 369 | #endif |
| 370 | |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 371 | #if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315) |
Dave Liu | b7896ad | 2008-01-17 18:23:19 +0800 | [diff] [blame] | 372 | switch ((sccr & SCCR_SATA1CM) >> SCCR_SATA1CM_SHIFT) { |
| 373 | case 0: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 374 | sata_clk = 0; |
| 375 | break; |
Dave Liu | b7896ad | 2008-01-17 18:23:19 +0800 | [diff] [blame] | 376 | case 1: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 377 | sata_clk = csb_clk; |
| 378 | break; |
Dave Liu | b7896ad | 2008-01-17 18:23:19 +0800 | [diff] [blame] | 379 | case 2: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 380 | sata_clk = csb_clk / 2; |
| 381 | break; |
Dave Liu | b7896ad | 2008-01-17 18:23:19 +0800 | [diff] [blame] | 382 | case 3: |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 383 | sata_clk = csb_clk / 3; |
| 384 | break; |
| 385 | default: |
Kim Phillips | 19a91de | 2008-01-16 12:06:16 -0600 | [diff] [blame] | 386 | /* unkown SCCR_SATACM value */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 387 | return -11; |
| 388 | } |
| 389 | #endif |
| 390 | |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 391 | lbiu_clk = csb_clk * |
Joakim Tjernlund | f2af1bb | 2011-01-27 16:30:54 +0100 | [diff] [blame] | 392 | (1 + ((im->clk.spmr & SPMR_LBIUCM) >> SPMR_LBIUCM_SHIFT)); |
Becky Bruce | 0d4cee1 | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 393 | lcrr = (im->im_lbc.lcrr & LCRR_CLKDIV) >> LCRR_CLKDIV_SHIFT; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 394 | switch (lcrr) { |
| 395 | case 2: |
| 396 | case 4: |
| 397 | case 8: |
| 398 | lclk_clk = lbiu_clk / lcrr; |
| 399 | break; |
| 400 | default: |
| 401 | /* unknown lcrr */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 402 | return -12; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 403 | } |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 404 | |
Kim Phillips | c02cf1e | 2008-03-28 10:18:40 -0500 | [diff] [blame] | 405 | mem_clk = csb_clk * |
Joakim Tjernlund | f2af1bb | 2011-01-27 16:30:54 +0100 | [diff] [blame] | 406 | (1 + ((im->clk.spmr & SPMR_DDRCM) >> SPMR_DDRCM_SHIFT)); |
| 407 | corepll = (im->clk.spmr & SPMR_COREPLL) >> SPMR_COREPLL_SHIFT; |
| 408 | |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 409 | #if defined(CONFIG_MPC8360) |
Kim Phillips | c02cf1e | 2008-03-28 10:18:40 -0500 | [diff] [blame] | 410 | mem_sec_clk = csb_clk * (1 + |
Joakim Tjernlund | f2af1bb | 2011-01-27 16:30:54 +0100 | [diff] [blame] | 411 | ((im->clk.spmr & SPMR_LBIUCM) >> SPMR_LBIUCM_SHIFT)); |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 412 | #endif |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 413 | |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 414 | corecnf_tab_index = ((corepll & 0x1F) << 2) | ((corepll & 0x60) >> 5); |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 415 | if (corecnf_tab_index > (sizeof(corecnf_tab) / sizeof(corecnf_t))) { |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 416 | /* corecnf_tab_index is too high, possibly worng value */ |
| 417 | return -11; |
| 418 | } |
| 419 | switch (corecnf_tab[corecnf_tab_index].core_csb_ratio) { |
| 420 | case _byp: |
| 421 | case _x1: |
| 422 | case _1x: |
| 423 | core_clk = csb_clk; |
| 424 | break; |
| 425 | case _1_5x: |
| 426 | core_clk = (3 * csb_clk) / 2; |
| 427 | break; |
| 428 | case _2x: |
| 429 | core_clk = 2 * csb_clk; |
| 430 | break; |
| 431 | case _2_5x: |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 432 | core_clk = (5 * csb_clk) / 2; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 433 | break; |
| 434 | case _3x: |
| 435 | core_clk = 3 * csb_clk; |
| 436 | break; |
| 437 | default: |
| 438 | /* unkown core to csb ratio */ |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 439 | return -13; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 440 | } |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 441 | |
Gerlando Falauto | 77cf283 | 2012-10-10 22:13:06 +0000 | [diff] [blame] | 442 | #if defined(CONFIG_QE) |
Joakim Tjernlund | f2af1bb | 2011-01-27 16:30:54 +0100 | [diff] [blame] | 443 | qepmf = (im->clk.spmr & SPMR_CEPMF) >> SPMR_CEPMF_SHIFT; |
| 444 | qepdf = (im->clk.spmr & SPMR_CEPDF) >> SPMR_CEPDF_SHIFT; |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 445 | qe_clk = (pci_sync_in * qepmf) / (1 + qepdf); |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 446 | brg_clk = qe_clk / 2; |
| 447 | #endif |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 448 | |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 449 | gd->arch.csb_clk = csb_clk; |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 450 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 451 | defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 452 | gd->arch.tsec1_clk = tsec1_clk; |
| 453 | gd->arch.tsec2_clk = tsec2_clk; |
| 454 | gd->arch.usbdr_clk = usbdr_clk; |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 455 | #elif defined(CONFIG_MPC8309) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 456 | gd->arch.usbdr_clk = usbdr_clk; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 457 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 458 | #if defined(CONFIG_MPC834x) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 459 | gd->arch.usbmph_clk = usbmph_clk; |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 460 | #endif |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 461 | #if defined(CONFIG_MPC8315) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 462 | gd->arch.tdm_clk = tdm_clk; |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 463 | #endif |
Rini van Zetten | a249617 | 2010-04-15 16:03:05 +0200 | [diff] [blame] | 464 | #if defined(CONFIG_FSL_ESDHC) |
Simon Glass | 9e247d1 | 2012-12-13 20:49:05 +0000 | [diff] [blame] | 465 | gd->arch.sdhc_clk = sdhc_clk; |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 466 | #endif |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 467 | gd->arch.core_clk = core_clk; |
Simon Glass | c2baaec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 468 | gd->arch.i2c1_clk = i2c1_clk; |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 469 | #if !defined(CONFIG_MPC832x) |
Simon Glass | c2baaec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 470 | gd->arch.i2c2_clk = i2c2_clk; |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 471 | #endif |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 472 | #if !defined(CONFIG_MPC8309) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 473 | gd->arch.enc_clk = enc_clk; |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 474 | #endif |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 475 | gd->arch.lbiu_clk = lbiu_clk; |
| 476 | gd->arch.lclk_clk = lclk_clk; |
Kim Phillips | c02cf1e | 2008-03-28 10:18:40 -0500 | [diff] [blame] | 477 | gd->mem_clk = mem_clk; |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 478 | #if defined(CONFIG_MPC8360) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 479 | gd->arch.mem_sec_clk = mem_sec_clk; |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 480 | #endif |
Gerlando Falauto | 77cf283 | 2012-10-10 22:13:06 +0000 | [diff] [blame] | 481 | #if defined(CONFIG_QE) |
Simon Glass | 8518b17 | 2012-12-13 20:48:50 +0000 | [diff] [blame] | 482 | gd->arch.qe_clk = qe_clk; |
Simon Glass | 34a194f | 2012-12-13 20:48:44 +0000 | [diff] [blame] | 483 | gd->arch.brg_clk = brg_clk; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 484 | #endif |
Bill Cook | 5a043d9 | 2011-05-25 15:51:07 -0400 | [diff] [blame] | 485 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 486 | defined(CONFIG_MPC837x) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 487 | gd->arch.pciexp1_clk = pciexp1_clk; |
| 488 | gd->arch.pciexp2_clk = pciexp2_clk; |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 489 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 490 | #if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 491 | gd->arch.sata_clk = sata_clk; |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 492 | #endif |
Kim Phillips | cd9fd70 | 2007-08-15 22:30:19 -0500 | [diff] [blame] | 493 | gd->pci_clk = pci_sync_in; |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 494 | gd->cpu_clk = gd->arch.core_clk; |
| 495 | gd->bus_clk = gd->arch.csb_clk; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 496 | return 0; |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 497 | |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | /******************************************** |
| 501 | * get_bus_freq |
| 502 | * return system bus freq in Hz |
| 503 | *********************************************/ |
Kim Phillips | bae2479 | 2006-11-02 19:47:11 -0600 | [diff] [blame] | 504 | ulong get_bus_freq(ulong dummy) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 505 | { |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 506 | return gd->arch.csb_clk; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 507 | } |
| 508 | |
York Sun | e12ce98 | 2011-08-26 11:32:44 -0700 | [diff] [blame] | 509 | /******************************************** |
| 510 | * get_ddr_freq |
| 511 | * return ddr bus freq in Hz |
| 512 | *********************************************/ |
| 513 | ulong get_ddr_freq(ulong dummy) |
| 514 | { |
| 515 | return gd->mem_clk; |
| 516 | } |
| 517 | |
Kim Phillips | b5c312a | 2012-10-29 13:34:39 +0000 | [diff] [blame] | 518 | static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 519 | { |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 520 | char buf[32]; |
| 521 | |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 522 | printf("Clock configuration:\n"); |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 523 | printf(" Core: %-4s MHz\n", |
| 524 | strmhz(buf, gd->arch.core_clk)); |
| 525 | printf(" Coherent System Bus: %-4s MHz\n", |
| 526 | strmhz(buf, gd->arch.csb_clk)); |
Gerlando Falauto | 77cf283 | 2012-10-10 22:13:06 +0000 | [diff] [blame] | 527 | #if defined(CONFIG_QE) |
Simon Glass | 8518b17 | 2012-12-13 20:48:50 +0000 | [diff] [blame] | 528 | printf(" QE: %-4s MHz\n", |
| 529 | strmhz(buf, gd->arch.qe_clk)); |
Simon Glass | 34a194f | 2012-12-13 20:48:44 +0000 | [diff] [blame] | 530 | printf(" BRG: %-4s MHz\n", |
| 531 | strmhz(buf, gd->arch.brg_clk)); |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 532 | #endif |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 533 | printf(" Local Bus Controller:%-4s MHz\n", |
| 534 | strmhz(buf, gd->arch.lbiu_clk)); |
| 535 | printf(" Local Bus: %-4s MHz\n", |
| 536 | strmhz(buf, gd->arch.lclk_clk)); |
Wolfgang Denk | 2059104 | 2008-10-19 02:35:49 +0200 | [diff] [blame] | 537 | printf(" DDR: %-4s MHz\n", strmhz(buf, gd->mem_clk)); |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 538 | #if defined(CONFIG_MPC8360) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 539 | printf(" DDR Secondary: %-4s MHz\n", |
| 540 | strmhz(buf, gd->arch.mem_sec_clk)); |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 541 | #endif |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 542 | #if !defined(CONFIG_MPC8309) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 543 | printf(" SEC: %-4s MHz\n", |
| 544 | strmhz(buf, gd->arch.enc_clk)); |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 545 | #endif |
Simon Glass | c2baaec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 546 | printf(" I2C1: %-4s MHz\n", |
| 547 | strmhz(buf, gd->arch.i2c1_clk)); |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 548 | #if !defined(CONFIG_MPC832x) |
Simon Glass | c2baaec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 549 | printf(" I2C2: %-4s MHz\n", |
| 550 | strmhz(buf, gd->arch.i2c2_clk)); |
Dave Liu | e740c46 | 2006-12-07 21:13:15 +0800 | [diff] [blame] | 551 | #endif |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 552 | #if defined(CONFIG_MPC8315) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 553 | printf(" TDM: %-4s MHz\n", |
| 554 | strmhz(buf, gd->arch.tdm_clk)); |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 555 | #endif |
Rini van Zetten | a249617 | 2010-04-15 16:03:05 +0200 | [diff] [blame] | 556 | #if defined(CONFIG_FSL_ESDHC) |
Simon Glass | 9e247d1 | 2012-12-13 20:49:05 +0000 | [diff] [blame] | 557 | printf(" SDHC: %-4s MHz\n", |
| 558 | strmhz(buf, gd->arch.sdhc_clk)); |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 559 | #endif |
Ilya Yanok | a3e5fd5 | 2010-06-28 16:44:33 +0400 | [diff] [blame] | 560 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 561 | defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 562 | printf(" TSEC1: %-4s MHz\n", |
| 563 | strmhz(buf, gd->arch.tsec1_clk)); |
| 564 | printf(" TSEC2: %-4s MHz\n", |
| 565 | strmhz(buf, gd->arch.tsec2_clk)); |
| 566 | printf(" USB DR: %-4s MHz\n", |
| 567 | strmhz(buf, gd->arch.usbdr_clk)); |
Gerlando Falauto | fe201cb | 2012-10-10 22:13:08 +0000 | [diff] [blame] | 568 | #elif defined(CONFIG_MPC8309) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 569 | printf(" USB DR: %-4s MHz\n", |
| 570 | strmhz(buf, gd->arch.usbdr_clk)); |
Dave Liu | a46daea | 2006-11-03 19:33:44 -0600 | [diff] [blame] | 571 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 572 | #if defined(CONFIG_MPC834x) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 573 | printf(" USB MPH: %-4s MHz\n", |
| 574 | strmhz(buf, gd->arch.usbmph_clk)); |
Scott Wood | c036fc9 | 2007-04-16 14:34:19 -0500 | [diff] [blame] | 575 | #endif |
Bill Cook | 5a043d9 | 2011-05-25 15:51:07 -0400 | [diff] [blame] | 576 | #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ |
| 577 | defined(CONFIG_MPC837x) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 578 | printf(" PCIEXP1: %-4s MHz\n", |
| 579 | strmhz(buf, gd->arch.pciexp1_clk)); |
| 580 | printf(" PCIEXP2: %-4s MHz\n", |
| 581 | strmhz(buf, gd->arch.pciexp2_clk)); |
Dave Liu | e0cfec8 | 2007-09-18 12:36:58 +0800 | [diff] [blame] | 582 | #endif |
Peter Tyser | 72f2d39 | 2009-05-22 17:23:25 -0500 | [diff] [blame] | 583 | #if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315) |
Simon Glass | cc76e9e | 2012-12-13 20:48:47 +0000 | [diff] [blame] | 584 | printf(" SATA: %-4s MHz\n", |
| 585 | strmhz(buf, gd->arch.sata_clk)); |
Dave Liu | 5245ff5 | 2007-09-18 12:36:11 +0800 | [diff] [blame] | 586 | #endif |
Jon Loeliger | ebc7224 | 2005-08-01 13:20:47 -0500 | [diff] [blame] | 587 | return 0; |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 588 | } |
Kim Phillips | d82b077 | 2007-04-30 15:26:21 -0500 | [diff] [blame] | 589 | |
| 590 | U_BOOT_CMD(clocks, 1, 0, do_clocks, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 591 | "print clock configuration", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 592 | " clocks" |
Kim Phillips | d82b077 | 2007-04-30 15:26:21 -0500 | [diff] [blame] | 593 | ); |