Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 2 | /* |
3 | * | ||||
4 | * (C) Copyright 2000-2003 | ||||
5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||||
6 | * | ||||
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 7 | * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc. |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 8 | * TsiChung Liew (Tsi-Chung.Liew@freescale.com) |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 9 | */ |
10 | |||||
11 | #include <common.h> | ||||
Simon Glass | 85d6531 | 2019-12-28 10:44:58 -0700 | [diff] [blame] | 12 | #include <clock_legacy.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 13 | #include <asm/global_data.h> |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 14 | #include <asm/processor.h> |
15 | |||||
16 | #include <asm/immap.h> | ||||
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 17 | #include <asm/io.h> |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 18 | |
19 | DECLARE_GLOBAL_DATA_PTR; | ||||
20 | /* | ||||
21 | * get_clocks() fills in gd->cpu_clock and gd->bus_clk | ||||
22 | */ | ||||
23 | int get_clocks(void) | ||||
24 | { | ||||
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 25 | pll_t *pll = (pll_t *)(MMAP_PLL); |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 26 | |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 27 | out_be32(&pll->syncr, PLL_SYNCR_MFD(1)); |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 28 | |
Alison Wang | d132fe6 | 2012-03-26 21:49:06 +0000 | [diff] [blame] | 29 | while (!(in_be32(&pll->synsr) & PLL_SYNSR_LOCK)) |
30 | ; | ||||
Stefan Roese | fe9dae6 | 2007-08-18 14:33:02 +0200 | [diff] [blame] | 31 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 32 | gd->bus_clk = CONFIG_SYS_CLK; |
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 33 | gd->cpu_clk = (gd->bus_clk * 2); |
Stefan Roese | fe9dae6 | 2007-08-18 14:33:02 +0200 | [diff] [blame] | 34 | |
Heiko Schocher | f285074 | 2012-10-24 13:48:22 +0200 | [diff] [blame] | 35 | #ifdef CONFIG_SYS_I2C_FSL |
Simon Glass | c2baaec | 2012-12-13 20:48:49 +0000 | [diff] [blame] | 36 | gd->arch.i2c1_clk = gd->bus_clk; |
TsiChung Liew | 0c1e325 | 2008-08-19 03:01:19 +0600 | [diff] [blame] | 37 | #endif |
38 | |||||
TsiChungLiew | b859ef1 | 2007-08-16 19:23:50 -0500 | [diff] [blame] | 39 | return (0); |
40 | } |