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