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