This patch moves ARM core and DRAM timing functions around to simplify
the dependencies for system_clock_init().
The original code was architected such that the system_clock_init()
function called other functions to obtain core and memory timings.
Due to the way memory timing information must be obtained on Snow,
which entails decoding platform-specific board straps, the bottom-
up approach resulted in having the low-level clock init code
implicitly depend on board and vendor-specific info:
main()
->system_clock_init()
-> get_arm_ratios()
-> CPU-specific code
-> clock_get_mem_timings()
-> board_get_revision()
-> read GPIOs (3-state logic)
-> Decode GPIOs in a vendor-specific manner
-> Choose memory timings from module-specific look-up table
...then proceed to init clocks
...come back to main()
The new approach gathers all board and vendor-specific info in a
more appropriate location and passes it into system_clock_init():
main()
-> get_arm_ratios()
-> CPU-specific code
-> get_mem_timings()
-> board_get_config()
-> read GPIOs (3-state logic)
-> Decode GPIOs in a vendor-specific manner
-> Choose memory timings from module-specific look-up table
-> system_clock_init()
...back to main()
Change-Id: Ie237ebff76fc2d8a4d2f4577a226ac3909e4d4e8
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/2271
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
60 lines
1.7 KiB
C
60 lines
1.7 KiB
C
/*
|
|
* Clock initialization routines
|
|
*
|
|
* Copyright (c) 2011 The Chromium OS Authors.
|
|
*
|
|
* See file CREDITS for list of people who contributed to this
|
|
* project.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of
|
|
* the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
* MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef __EXYNOS_CLOCK_INIT_H
|
|
#define __EXYNOS_CLOCK_INIT_H
|
|
|
|
/* These are the ratio's for configuring ARM clock */
|
|
struct arm_clk_ratios {
|
|
unsigned int arm_freq_mhz; /* Frequency of ARM core in MHz */
|
|
|
|
unsigned int apll_mdiv;
|
|
unsigned int apll_pdiv;
|
|
unsigned int apll_sdiv;
|
|
|
|
unsigned int arm2_ratio;
|
|
unsigned int apll_ratio;
|
|
unsigned int pclk_dbg_ratio;
|
|
unsigned int atb_ratio;
|
|
unsigned int periph_ratio;
|
|
unsigned int acp_ratio;
|
|
unsigned int cpud_ratio;
|
|
unsigned int arm_ratio;
|
|
};
|
|
|
|
/**
|
|
* Get the clock ratios for CPU configuration
|
|
*
|
|
* @return pointer to the clock ratios that we should use
|
|
*/
|
|
struct arm_clk_ratios *get_arm_clk_ratios(void);
|
|
|
|
/*
|
|
* Initialize clock for the device
|
|
*/
|
|
struct mem_timings;
|
|
void system_clock_init(struct mem_timings *mem,
|
|
struct arm_clk_ratios *arm_clk_ratio);
|
|
#endif
|