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