TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 1 | /* |
| 2 | * |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 3 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 4 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
| 5 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <asm/processor.h> |
| 11 | |
| 12 | #include <asm/immap.h> |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 13 | #include <asm/io.h> |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | /* |
| 18 | * Low Power Divider specifications |
| 19 | */ |
| 20 | #define CLOCK_LPD_MIN (1 << 0) /* Divider (decoded) */ |
| 21 | #define CLOCK_LPD_MAX (1 << 15) /* Divider (decoded) */ |
| 22 | |
| 23 | #define CLOCK_PLL_FVCO_MAX 540000000 |
| 24 | #define CLOCK_PLL_FVCO_MIN 300000000 |
| 25 | |
| 26 | #define CLOCK_PLL_FSYS_MAX 266666666 |
| 27 | #define CLOCK_PLL_FSYS_MIN 100000000 |
| 28 | #define MHZ 1000000 |
| 29 | |
| 30 | void clock_enter_limp(int lpdiv) |
| 31 | { |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 32 | ccm_t *ccm = (ccm_t *)MMAP_CCM; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 33 | int i, j; |
| 34 | |
| 35 | /* Check bounds of divider */ |
| 36 | if (lpdiv < CLOCK_LPD_MIN) |
| 37 | lpdiv = CLOCK_LPD_MIN; |
| 38 | if (lpdiv > CLOCK_LPD_MAX) |
| 39 | lpdiv = CLOCK_LPD_MAX; |
| 40 | |
| 41 | /* Round divider down to nearest power of two */ |
| 42 | for (i = 0, j = lpdiv; j != 1; j >>= 1, i++) ; |
| 43 | |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 44 | #ifdef CONFIG_MCF5445x |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 45 | /* Apply the divider to the system clock */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 46 | clrsetbits_be16(&ccm->cdr, 0x0f00, CCM_CDR_LPDIV(i)); |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 47 | #endif |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 48 | |
| 49 | /* Enable Limp Mode */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 50 | setbits_be16(&ccm->misccr, CCM_MISCCR_LIMP); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /* |
| 54 | * brief Exit Limp mode |
| 55 | * warning The PLL should be set and locked prior to exiting Limp mode |
| 56 | */ |
| 57 | void clock_exit_limp(void) |
| 58 | { |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 59 | ccm_t *ccm = (ccm_t *)MMAP_CCM; |
| 60 | pll_t *pll = (pll_t *)MMAP_PLL; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 61 | |
| 62 | /* Exit Limp mode */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 63 | clrbits_be16(&ccm->misccr, CCM_MISCCR_LIMP); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 64 | |
| 65 | /* Wait for the PLL to lock */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 66 | while (!(in_be32(&pll->psr) & PLL_PSR_LOCK)) |
| 67 | ; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 68 | } |
| 69 | |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 70 | #ifdef CONFIG_MCF5441x |
| 71 | void setup_5441x_clocks(void) |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 72 | { |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 73 | ccm_t *ccm = (ccm_t *)MMAP_CCM; |
| 74 | pll_t *pll = (pll_t *)MMAP_PLL; |
| 75 | int temp, vco = 0, bootmod_ccr, pdr; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 76 | |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 77 | bootmod_ccr = (in_be16(&ccm->ccr) & CCM_CCR_BOOTMOD) >> 14; |
| 78 | |
| 79 | switch (bootmod_ccr) { |
| 80 | case 0: |
| 81 | out_be32(&pll->pcr, 0x00000013); |
| 82 | out_be32(&pll->pdr, 0x00e70c61); |
| 83 | clock_exit_limp(); |
| 84 | break; |
| 85 | case 2: |
| 86 | break; |
| 87 | case 3: |
| 88 | break; |
| 89 | } |
| 90 | |
| 91 | /*Change frequency for Modelo SER1 USB host*/ |
| 92 | #ifdef CONFIG_LOW_MCFCLK |
| 93 | temp = in_be32(&pll->pcr); |
| 94 | temp &= ~0x3f; |
| 95 | temp |= 5; |
| 96 | out_be32(&pll->pcr, temp); |
| 97 | |
| 98 | temp = in_be32(&pll->pdr); |
| 99 | temp &= ~0x001f0000; |
| 100 | temp |= 0x00040000; |
| 101 | out_be32(&pll->pdr, temp); |
| 102 | __asm__("tpf"); |
| 103 | #endif |
| 104 | |
| 105 | setbits_be16(&ccm->misccr2, 0x02); |
| 106 | |
| 107 | vco = ((in_be32(&pll->pcr) & PLL_CR_FBKDIV_BITS) + 1) * |
| 108 | CONFIG_SYS_INPUT_CLKSRC; |
Jason Jin | 1b9591c | 2013-06-26 10:21:31 +0800 | [diff] [blame] | 109 | gd->arch.vco_clk = vco; |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 110 | |
Jason Jin | 1b9591c | 2013-06-26 10:21:31 +0800 | [diff] [blame] | 111 | gd->arch.inp_clk = CONFIG_SYS_INPUT_CLKSRC; /* Input clock */ |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 112 | |
| 113 | pdr = in_be32(&pll->pdr); |
| 114 | temp = (pdr & PLL_DR_OUTDIV1_BITS) + 1; |
| 115 | gd->cpu_clk = vco / temp; /* cpu clock */ |
Jason Jin | 1b9591c | 2013-06-26 10:21:31 +0800 | [diff] [blame] | 116 | gd->arch.flb_clk = vco / temp; /* FlexBus clock */ |
| 117 | gd->arch.flb_clk >>= 1; |
Vasili Galka | 6b02d06 | 2014-06-30 12:59:06 +0300 | [diff] [blame] | 118 | if (in_be16(&ccm->misccr2) & 2) /* fsys/4 */ |
Jason Jin | 1b9591c | 2013-06-26 10:21:31 +0800 | [diff] [blame] | 119 | gd->arch.flb_clk >>= 1; |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 120 | |
| 121 | temp = ((pdr & PLL_DR_OUTDIV2_BITS) >> 5) + 1; |
| 122 | gd->bus_clk = vco / temp; /* bus clock */ |
| 123 | |
| 124 | } |
| 125 | #endif |
| 126 | |
| 127 | #ifdef CONFIG_MCF5445x |
| 128 | void setup_5445x_clocks(void) |
| 129 | { |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 130 | ccm_t *ccm = (ccm_t *)MMAP_CCM; |
| 131 | pll_t *pll = (pll_t *)MMAP_PLL; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 132 | int pllmult_nopci[] = { 20, 10, 24, 18, 12, 6, 16, 8 }; |
| 133 | int pllmult_pci[] = { 12, 6, 16, 8 }; |
Marek Vasut | c1568ca5 | 2012-10-03 13:28:45 +0000 | [diff] [blame] | 134 | int vco = 0, temp, fbtemp, pcrvalue; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 135 | int *pPllmult = NULL; |
| 136 | u16 fbpll_mask; |
Marek Vasut | c1568ca5 | 2012-10-03 13:28:45 +0000 | [diff] [blame] | 137 | #ifdef CONFIG_PCI |
| 138 | int bPci; |
| 139 | #endif |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 140 | |
| 141 | #ifdef CONFIG_M54455EVB |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 142 | u8 *cpld = (u8 *)(CONFIG_SYS_CS2_BASE + 3); |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 143 | #endif |
| 144 | u8 bootmode; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 145 | |
| 146 | /* To determine PCI is present or not */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 147 | if (((in_be16(&ccm->ccr) & CCM_CCR_360_FBCONFIG_MASK) == 0x00e0) || |
| 148 | ((in_be16(&ccm->ccr) & CCM_CCR_360_FBCONFIG_MASK) == 0x0060)) { |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 149 | pPllmult = &pllmult_pci[0]; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 150 | fbpll_mask = 3; /* 11b */ |
Marek Vasut | c1568ca5 | 2012-10-03 13:28:45 +0000 | [diff] [blame] | 151 | #ifdef CONFIG_PCI |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 152 | bPci = 1; |
Marek Vasut | c1568ca5 | 2012-10-03 13:28:45 +0000 | [diff] [blame] | 153 | #endif |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 154 | } else { |
| 155 | pPllmult = &pllmult_nopci[0]; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 156 | fbpll_mask = 7; /* 111b */ |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 157 | #ifdef CONFIG_PCI |
| 158 | gd->pci_clk = 0; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 159 | bPci = 0; |
Marek Vasut | c1568ca5 | 2012-10-03 13:28:45 +0000 | [diff] [blame] | 160 | #endif |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | #ifdef CONFIG_M54455EVB |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 164 | bootmode = (in_8(cpld) & 0x03); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 165 | |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 166 | if (bootmode != 3) { |
| 167 | /* Temporary read from CCR- fixed fb issue, must be the same clock |
| 168 | as pci or input clock, causing cpld/fpga read inconsistancy */ |
| 169 | fbtemp = pPllmult[ccm->ccr & fbpll_mask]; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 170 | |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 171 | /* Break down into small pieces, code still in flex bus */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 172 | pcrvalue = in_be32(&pll->pcr) & 0xFFFFF0FF; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 173 | temp = fbtemp - 1; |
| 174 | pcrvalue |= PLL_PCR_OUTDIV3(temp); |
| 175 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 176 | out_be32(&pll->pcr, pcrvalue); |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 177 | } |
| 178 | #endif |
| 179 | #ifdef CONFIG_M54451EVB |
| 180 | /* No external logic to read the bootmode, hard coded from built */ |
| 181 | #ifdef CONFIG_CF_SBF |
| 182 | bootmode = 3; |
| 183 | #else |
| 184 | bootmode = 2; |
| 185 | |
| 186 | /* default value is 16 mul, set to 20 mul */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 187 | pcrvalue = (in_be32(&pll->pcr) & 0x00FFFFFF) | 0x14000000; |
| 188 | out_be32(&pll->pcr, pcrvalue); |
| 189 | while ((in_be32(&pll->psr) & PLL_PSR_LOCK) != PLL_PSR_LOCK) |
| 190 | ; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 191 | #endif |
| 192 | #endif |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 193 | |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 194 | if (bootmode == 0) { |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 195 | /* RCON mode */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 196 | vco = pPllmult[ccm->rcon & fbpll_mask] * CONFIG_SYS_INPUT_CLKSRC; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 197 | |
| 198 | if ((vco < CLOCK_PLL_FVCO_MIN) || (vco > CLOCK_PLL_FVCO_MAX)) { |
| 199 | /* invaild range, re-set in PCR */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 200 | int temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV2_MASK) >> 4) + 1; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 201 | int i, j, bus; |
| 202 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 203 | j = (in_be32(&pll->pcr) & 0xFF000000) >> 24; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 204 | for (i = j; i < 0xFF; i++) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 205 | vco = i * CONFIG_SYS_INPUT_CLKSRC; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 206 | if (vco >= CLOCK_PLL_FVCO_MIN) { |
| 207 | bus = vco / temp; |
| 208 | if (bus <= CLOCK_PLL_FSYS_MIN - MHZ) |
| 209 | continue; |
| 210 | else |
| 211 | break; |
| 212 | } |
| 213 | } |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 214 | pcrvalue = in_be32(&pll->pcr) & 0x00FF00FF; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 215 | fbtemp = ((i - 1) << 8) | ((i - 1) << 12); |
| 216 | pcrvalue |= ((i << 24) | fbtemp); |
| 217 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 218 | out_be32(&pll->pcr, pcrvalue); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 219 | } |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 220 | gd->arch.vco_clk = vco; /* Vco clock */ |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 221 | } else if (bootmode == 2) { |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 222 | /* Normal mode */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 223 | vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 224 | if ((vco < CLOCK_PLL_FVCO_MIN) || (vco > CLOCK_PLL_FVCO_MAX)) { |
| 225 | /* Default value */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 226 | pcrvalue = (in_be32(&pll->pcr) & 0x00FFFFFF); |
| 227 | pcrvalue |= pPllmult[in_be16(&ccm->ccr) & fbpll_mask] << 24; |
| 228 | out_be32(&pll->pcr, pcrvalue); |
| 229 | vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 230 | } |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 231 | gd->arch.vco_clk = vco; /* Vco clock */ |
TsiChung Liew | 9f75155 | 2008-07-23 20:38:53 -0500 | [diff] [blame] | 232 | } else if (bootmode == 3) { |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 233 | /* serial mode */ |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 234 | vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC; |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 235 | gd->arch.vco_clk = vco; /* Vco clock */ |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 236 | } |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 237 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 238 | if ((in_be16(&ccm->ccr) & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) { |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 239 | /* Limp mode */ |
| 240 | } else { |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 241 | gd->arch.inp_clk = CONFIG_SYS_INPUT_CLKSRC; /* Input clock */ |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 242 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 243 | temp = (in_be32(&pll->pcr) & PLL_PCR_OUTDIV1_MASK) + 1; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 244 | gd->cpu_clk = vco / temp; /* cpu clock */ |
| 245 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 246 | temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV2_MASK) >> 4) + 1; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 247 | gd->bus_clk = vco / temp; /* bus clock */ |
| 248 | |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 249 | temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV3_MASK) >> 8) + 1; |
Simon Glass | 7e2592f | 2012-12-13 20:49:07 +0000 | [diff] [blame] | 250 | gd->arch.flb_clk = vco / temp; /* FlexBus clock */ |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 251 | |
| 252 | #ifdef CONFIG_PCI |
| 253 | if (bPci) { |
Alison Wang | 198cafb | 2012-03-26 21:49:08 +0000 | [diff] [blame] | 254 | temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV4_MASK) >> 12) + 1; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 255 | gd->pci_clk = vco / temp; /* PCI clock */ |
| 256 | } |
| 257 | #endif |
| 258 | } |
| 259 | |
Heiko Schocher | 00f792e | 2012-10-24 13:48:22 +0200 | [diff] [blame] | 260 | #ifdef CONFIG_SYS_I2C_FSL |
Simon Glass | 609e6ec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 261 | gd->arch.i2c1_clk = gd->bus_clk; |
TsiChung Liew | eec567a | 2008-08-19 03:01:19 +0600 | [diff] [blame] | 262 | #endif |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 263 | } |
| 264 | #endif |
| 265 | |
| 266 | /* get_clocks() fills in gd->cpu_clock and gd->bus_clk */ |
| 267 | int get_clocks(void) |
| 268 | { |
| 269 | #ifdef CONFIG_MCF5441x |
| 270 | setup_5441x_clocks(); |
| 271 | #endif |
| 272 | #ifdef CONFIG_MCF5445x |
| 273 | setup_5445x_clocks(); |
| 274 | #endif |
| 275 | |
Heiko Schocher | 00f792e | 2012-10-24 13:48:22 +0200 | [diff] [blame] | 276 | #ifdef CONFIG_SYS_FSL_I2C |
Simon Glass | 609e6ec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 277 | gd->arch.i2c1_clk = gd->bus_clk; |
Alison Wang | 45370e1 | 2012-10-18 19:25:51 +0000 | [diff] [blame] | 278 | #endif |
TsiChung Liew | eec567a | 2008-08-19 03:01:19 +0600 | [diff] [blame] | 279 | |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 280 | return (0); |
| 281 | } |