blob: a5e3d9eeb9aaf1073561006df03a798e79521a39 [file] [log] [blame]
Gabe Blackd3163ab2013-05-16 05:53:40 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Copyright 2013 Google Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Gabe Blackd3163ab2013-05-16 05:53:40 -070015 */
16
Julius Werner80af4422014-10-20 13:18:56 -070017#include <soc/clk.h>
18#include <soc/dmc.h>
19#include <soc/gpio.h>
20#include <soc/setup.h>
Gabe Blackd3163ab2013-05-16 05:53:40 -070021#include <stddef.h>
22#include <stdlib.h>
Gabe Blackd3163ab2013-05-16 05:53:40 -070023
Ronald G. Minniche6af9292013-06-03 13:03:50 -070024const struct mem_timings mem_timings = {
Gabe Blackd3163ab2013-05-16 05:53:40 -070025 .mem_manuf = MEM_MANUF_SAMSUNG,
26 .mem_type = DDR_MODE_DDR3,
27 .frequency_mhz = 800,
Gabe Blackd3163ab2013-05-16 05:53:40 -070028 .direct_cmd_msr = {
David Hendricks42b1b802013-08-26 15:12:12 -070029 0x00020018, 0x00030000, 0x00010046, 0x00000d70,
30 0x00000c70
Gabe Blackd3163ab2013-05-16 05:53:40 -070031 },
32 .timing_ref = 0x000000bb,
Ronald G. Minniche6af9292013-06-03 13:03:50 -070033 .timing_row = 0x6836650f,
Gabe Blackd3163ab2013-05-16 05:53:40 -070034 .timing_data = 0x3630580b,
Ronald G. Minniche6af9292013-06-03 13:03:50 -070035 .timing_power = 0x41000a26,
Gabe Blackd3163ab2013-05-16 05:53:40 -070036 .phy0_dqs = 0x08080808,
37 .phy1_dqs = 0x08080808,
38 .phy0_dq = 0x08080808,
39 .phy1_dq = 0x08080808,
40 .phy0_tFS = 0x8,
41 .phy1_tFS = 0x8,
42 .phy0_pulld_dqs = 0xf,
43 .phy1_pulld_dqs = 0xf,
44
45 .lpddr3_ctrl_phy_reset = 0x1,
46 .ctrl_start_point = 0x10,
47 .ctrl_inc = 0x10,
48 .ctrl_start = 0x1,
49 .ctrl_dll_on = 0x1,
50 .ctrl_ref = 0x8,
51
52 .ctrl_force = 0x1a,
53 .ctrl_rdlat = 0x0b,
54 .ctrl_bstlen = 0x08,
55
56 .fp_resync = 0x8,
57 .iv_size = 0x7,
58 .dfi_init_start = 1,
59 .aref_en = 1,
60
61 .rd_fetch = 0x3,
62
David Hendricks42b1b802013-08-26 15:12:12 -070063 .zq_mode_dds = 0x7,
Gabe Blackd3163ab2013-05-16 05:53:40 -070064 .zq_mode_term = 0x1,
65 .zq_mode_noterm = 1,
66
67 /*
68 * Dynamic Clock: Always Running
69 * Memory Burst length: 8
70 * Number of chips: 1
71 * Memory Bus width: 32 bit
72 * Memory Type: DDR3
73 * Additional Latancy for PLL: 0 Cycle
74 */
75 .memcontrol = DMC_MEMCONTROL_CLK_STOP_DISABLE |
76 DMC_MEMCONTROL_DPWRDN_DISABLE |
77 DMC_MEMCONTROL_DPWRDN_ACTIVE_PRECHARGE |
Ronald G. Minniche6af9292013-06-03 13:03:50 -070078 DMC_MEMCONTROL_DSREF_DISABLE |
Gabe Blackd3163ab2013-05-16 05:53:40 -070079 DMC_MEMCONTROL_ADD_LAT_PALL_CYCLE(0) |
80 DMC_MEMCONTROL_MEM_TYPE_DDR3 |
81 DMC_MEMCONTROL_MEM_WIDTH_32BIT |
David Hendricks72a42882013-08-23 15:25:07 -070082 DMC_MEMCONTROL_NUM_CHIP_1 |
Gabe Blackd3163ab2013-05-16 05:53:40 -070083 DMC_MEMCONTROL_BL_8 |
84 DMC_MEMCONTROL_PZQ_DISABLE |
85 DMC_MEMCONTROL_MRR_BYTE_7_0,
David Hendricks122b6d62013-08-29 14:05:21 -070086 /*
87 * For channel interleaving, the chip_base needs to be set to
88 * half the bus address. So for a base address of 0x2000_0000,
89 * the chip_base value is 0x20 without interleaving and 0x10
90 * with channel interleaving. See note in section 17.14.
91 */
92 .membaseconfig0 = (0x10 << 16) | DMC_CHIP_MASK_1GB,
Ronald G. Minniche6af9292013-06-03 13:03:50 -070093 .memconfig = DMC_MEMCONFIG_CHIP_MAP_SPLIT |
Gabe Blackd3163ab2013-05-16 05:53:40 -070094 DMC_MEMCONFIGx_CHIP_COL_10 |
95 DMC_MEMCONFIGx_CHIP_ROW_15 |
96 DMC_MEMCONFIGx_CHIP_BANK_8,
Gabe Blackd3163ab2013-05-16 05:53:40 -070097 .prechconfig_tp_cnt = 0xff,
98 .dpwrdn_cyc = 0xff,
99 .dsref_cyc = 0xffff,
100 .concontrol = DMC_CONCONTROL_DFI_INIT_START_DISABLE |
101 DMC_CONCONTROL_TIMEOUT_LEVEL0 |
102 DMC_CONCONTROL_RD_FETCH_DISABLE |
Gabe Blackd3163ab2013-05-16 05:53:40 -0700103 DMC_CONCONTROL_AREF_EN_DISABLE |
104 DMC_CONCONTROL_IO_PD_CON_DISABLE,
Ronald G. Minniche6af9292013-06-03 13:03:50 -0700105 .dmc_channels = 1,
David Hendricks72a42882013-08-23 15:25:07 -0700106 .chips_per_channel = 1,
107 .chips_to_configure = 1,
Gabe Blackd3163ab2013-05-16 05:53:40 -0700108 .send_zq_init = 1,
Gabe Blackd3163ab2013-05-16 05:53:40 -0700109 .gate_leveling_enable = 1,
Gabe Blackd3163ab2013-05-16 05:53:40 -0700110};