xref: /openbmc/u-boot/arch/arm/mach-tegra/emc.c (revision ebce73f0)
1 /*
2  * Copyright (c) 2011 The Chromium OS Authors.
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include "emc.h"
9 #include <asm/io.h>
10 #include <asm/arch/clock.h>
11 #include <asm/arch/emc.h>
12 #include <asm/arch/pmu.h>
13 #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>
17 
18 DECLARE_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 
24 int board_emc_init(void)
25 {
26 	unsigned rate;
27 
28 	switch (tegra_get_chip_sku()) {
29 	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 }
39