blob: 8c62f36a7b04a00b8d05f68405567f9d3e1fd687 [file] [log] [blame]
Jimmy Zhangc5b34a22012-04-10 05:17:06 +00001/*
2 * Copyright (c) 2011 The Chromium OS Authors.
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Jimmy Zhangc5b34a22012-04-10 05:17:06 +00005 */
6
7#include <common.h>
Jeroen Hofstee19d7bf32014-10-08 22:57:46 +02008#include "emc.h"
Jimmy Zhangc5b34a22012-04-10 05:17:06 +00009#include <asm/io.h>
Jimmy Zhangc5b34a22012-04-10 05:17:06 +000010#include <asm/arch/clock.h>
11#include <asm/arch/emc.h>
12#include <asm/arch/pmu.h>
Tom Warren150c2492012-09-19 15:50:56 -070013#include <asm/arch/tegra.h>
14#include <asm/arch-tegra/ap.h>
15#include <asm/arch-tegra/clk_rst.h>
16#include <asm/arch-tegra/sys_proto.h>
Jimmy Zhangc5b34a22012-04-10 05:17:06 +000017
18DECLARE_GLOBAL_DATA_PTR;
19
20/* These rates are hard-coded for now, until fdt provides them */
21#define EMC_SDRAM_RATE_T20 (333000 * 2 * 1000)
22#define EMC_SDRAM_RATE_T25 (380000 * 2 * 1000)
23
24int board_emc_init(void)
25{
26 unsigned rate;
27
Tom Warren49493cb2013-04-10 10:32:32 -070028 switch (tegra_get_chip_sku()) {
Jimmy Zhangc5b34a22012-04-10 05:17:06 +000029 default:
30 case TEGRA_SOC_T20:
31 rate = EMC_SDRAM_RATE_T20;
32 break;
33 case TEGRA_SOC_T25:
34 rate = EMC_SDRAM_RATE_T25;
35 break;
36 }
37 return tegra_set_emc(gd->fdt_blob, rate);
38}