summaryrefslogtreecommitdiff
path: root/src/soc/nvidia
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-08-13 14:51:46 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-03-26 00:27:14 +0100
commit33f92e0d4b5f53f01eab4b3d3678e855e68d11d9 (patch)
treeae96a1f29f6e2d2fb1ec68cc0a09e36360acc3e5 /src/soc/nvidia
parent662d3bb982260fed7ceb86a99fe6be6b3baf1bf1 (diff)
downloadcoreboot-33f92e0d4b5f53f01eab4b3d3678e855e68d11d9.tar.xz
tegra132: break out clock config in funit library
In order to prepare for USB initialization move the clock configuration into a separate routine in the funit library. BUG=chrome-os-partner:31251 BRANCH=None TEST=Built and booted into recovery mode. Change-Id: I090b5d12c5805f0179c29cfc62499fad2f245c01 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: f7adaf969762b8296034f4373f550a902d1ed06b Original-Change-Id: Iea6cd2fbe8369a91c06b15d94b63c409ae83124f Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/212167 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/8932 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/nvidia')
-rw-r--r--src/soc/nvidia/tegra132/funitcfg.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/soc/nvidia/tegra132/funitcfg.c b/src/soc/nvidia/tegra132/funitcfg.c
index 9111a91e46..616e5d67a9 100644
--- a/src/soc/nvidia/tegra132/funitcfg.c
+++ b/src/soc/nvidia/tegra132/funitcfg.c
@@ -100,18 +100,39 @@ static inline uint32_t get_clk_src_freq(uint32_t clk_src)
return freq;
}
-void soc_configure_funits(const struct funit_cfg * const entries, size_t num)
+static void configure_clock(const struct funit_cfg * const entry,
+ const struct funit_cfg_data * const funit)
{
- size_t i;
const char *funit_i2c = "i2c";
uint32_t clk_div;
uint32_t clk_div_mask;
+ uint32_t clk_src_freq;
+
+ clk_src_freq = get_clk_src_freq(entry->clk_src_id);
+
+ if (strncmp(funit->name, funit_i2c, strlen(funit_i2c)) == 0) {
+ /* I2C funit */
+ clk_div = get_i2c_clk_div(clk_src_freq,
+ entry->clk_dev_freq_khz);
+ clk_div_mask = CLK_DIV_MASK_I2C;
+ } else {
+ /* Non I2C */
+ clk_div = get_clk_div(clk_src_freq, entry->clk_dev_freq_khz);
+ clk_div_mask = CLK_DIV_MASK;
+ }
+
+ _clock_set_div(funit->clk_src_reg, funit->name, clk_div,
+ clk_div_mask, entry->clk_src_id);
+}
+
+void soc_configure_funits(const struct funit_cfg * const entries, size_t num)
+{
+ size_t i;
for (i = 0; i < num; i++) {
const struct funit_cfg * const entry = &entries[i];
const struct funit_cfg_data *funit;
const struct clk_dev_control *dev_control;
- uint32_t clk_src_freq;
if (entry->funit_index >= FUNIT_INDEX_MAX) {
printk(BIOS_ERR, "Error: Index out of bounds\n");
@@ -121,22 +142,7 @@ void soc_configure_funits(const struct funit_cfg * const entries, size_t num)
funit = &funit_data[entry->funit_index];
dev_control = funit->dev_control;
- clk_src_freq = get_clk_src_freq(entry->clk_src_id);
-
- if (strncmp(funit->name,funit_i2c,strlen(funit_i2c)) == 0) {
- /* I2C funit */
- clk_div = get_i2c_clk_div(clk_src_freq,
- entry->clk_dev_freq_khz);
- clk_div_mask = CLK_DIV_MASK_I2C;
- } else {
- /* Non I2C */
- clk_div = get_clk_div(clk_src_freq,
- entry->clk_dev_freq_khz);
- clk_div_mask = CLK_DIV_MASK;
- }
-
- _clock_set_div(funit->clk_src_reg, funit->name, clk_div,
- clk_div_mask, entry->clk_src_id);
+ configure_clock(entry, funit);
clock_grp_enable_clear_reset(funit->clk_enb_val,
dev_control->clk_enb_set,