TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 1 | /* |
2 | * | ||||
3 | * (C) Copyright 2000-2003 | ||||
4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||||
5 | * | ||||
Alison Wang | c6d8863 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 6 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 7 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
8 | * | ||||
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 10 | */ |
11 | |||||
12 | #include <common.h> | ||||
13 | #include <asm/processor.h> | ||||
14 | |||||
15 | #include <asm/immap.h> | ||||
Alison Wang | c6d8863 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 16 | #include <asm/io.h> |
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 17 | |
18 | DECLARE_GLOBAL_DATA_PTR; | ||||
19 | /* | ||||
20 | * get_clocks() fills in gd->cpu_clock and gd->bus_clk | ||||
21 | */ | ||||
22 | int get_clocks(void) | ||||
23 | { | ||||
Alison Wang | c6d8863 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 24 | pll_t *pll = (pll_t *)(MMAP_PLL); |
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 25 | |
Alison Wang | c6d8863 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 26 | out_be32(&pll->syncr, PLL_SYNCR_MFD(1)); |
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 27 | |
Alison Wang | c6d8863 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 28 | while (!(in_be32(&pll->synsr) & PLL_SYNSR_LOCK)) |
29 | ; | ||||
Stefan Roese | 8280f6a | 2007-08-18 14:33:02 +0200 | [diff] [blame] | 30 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 31 | gd->bus_clk = CONFIG_SYS_CLK; |
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 32 | gd->cpu_clk = (gd->bus_clk * 2); |
Stefan Roese | 8280f6a | 2007-08-18 14:33:02 +0200 | [diff] [blame] | 33 | |
Heiko Schocher | 00f792e | 2012-10-24 13:48:22 +0200 | [diff] [blame] | 34 | #ifdef CONFIG_SYS_I2C_FSL |
Simon Glass | 609e6ec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 35 | gd->arch.i2c1_clk = gd->bus_clk; |
TsiChung Liew | eec567a | 2008-08-19 03:01:19 +0600 | [diff] [blame] | 36 | #endif |
37 | |||||
TsiChungLiew | 4a442d3 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 38 | return (0); |
39 | } |