Alexandru Gagniuc | 7d31e7c | 2013-06-08 11:49:10 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Alexandru Gagniuc <mr.nuke.me@gmail.com> |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 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. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef RAMINIT_VX900_H |
| 21 | #define RAMINIT_VX900_H |
| 22 | |
| 23 | #include <device/dram/ddr3.h> |
| 24 | #include "vx900.h" |
| 25 | |
| 26 | #define SPD_END_LIST 0xff |
| 27 | |
| 28 | typedef struct dimm_layout_st |
| 29 | { |
| 30 | /* The address of the DIMM on the SMBUS * |
| 31 | * 0xFF to terminate the array*/ |
| 32 | u8 spd_addr[VX900_MAX_DIMM_SLOTS + 1]; |
| 33 | } dimm_layout; |
| 34 | |
| 35 | typedef struct dimm_info_st |
| 36 | { |
| 37 | dimm_attr dimm[VX900_MAX_DIMM_SLOTS]; |
| 38 | } dimm_info; |
| 39 | |
| 40 | typedef struct mem_rank_st { |
| 41 | u16 start_addr; |
| 42 | u16 end_addr; |
| 43 | } mem_rank; |
| 44 | |
| 45 | typedef struct rank_layout_st { |
| 46 | u32 phys_rank_size_mb[VX900_MAX_MEM_RANKS]; |
| 47 | mem_rank virt[VX900_MAX_MEM_RANKS]; |
| 48 | dimm_flags_t flags[VX900_MAX_MEM_RANKS]; |
| 49 | } rank_layout; |
| 50 | |
| 51 | typedef struct pci_reg8_st { |
| 52 | u8 addr; |
| 53 | u8 val; |
| 54 | } pci_reg8; |
| 55 | |
| 56 | typedef u8 timing_dly[8]; |
| 57 | |
| 58 | typedef struct delay_range_st { |
| 59 | timing_dly low; |
| 60 | timing_dly avg; |
| 61 | timing_dly high; |
| 62 | } delay_range; |
| 63 | |
| 64 | typedef struct vx900_delay_calib_st { |
| 65 | delay_range rx_dq_cr; |
| 66 | delay_range rx_dqs; |
| 67 | /* Transmit delays are calibrated for each dimm */ |
| 68 | delay_range tx_dq[VX900_MAX_DIMM_SLOTS]; |
| 69 | delay_range tx_dqs[VX900_MAX_DIMM_SLOTS]; |
| 70 | } vx900_delay_calib; |
| 71 | |
| 72 | typedef struct ramctr_timing_st { |
| 73 | enum spd_memory_type dram_type; |
Vladimir Serbinenko | daf7680 | 2014-12-07 13:58:15 +0100 | [diff] [blame] | 74 | enum spd_dimm_type dimm_type; |
Alexandru Gagniuc | 7d31e7c | 2013-06-08 11:49:10 -0500 | [diff] [blame] | 75 | u16 cas_supported; |
| 76 | /* tLatencies are in units of ns, scaled by x256 */ |
| 77 | u32 tCK; |
| 78 | u32 tAA; |
| 79 | u32 tWR; |
| 80 | u32 tRCD; |
| 81 | u32 tRRD; |
| 82 | u32 tRP; |
| 83 | u32 tRAS; |
| 84 | u32 tRC; |
| 85 | u32 tRFC; |
| 86 | u32 tWTR; |
| 87 | u32 tRTP; |
| 88 | u32 tFAW; |
| 89 | /* Latencies in terms of clock cycles |
| 90 | * They are saved separately as they are needed for DRAM MRS commands*/ |
| 91 | u8 CAS; /* CAS read latency */ |
| 92 | u8 CWL; /* CAS write latency */ |
| 93 | u8 WR; /* write recovery time */ |
| 94 | /* Number of dimms currently connected */ |
| 95 | u8 n_dimms; |
| 96 | |
| 97 | } ramctr_timing; |
| 98 | |
| 99 | void vx900_init_dram_ddr3(const dimm_layout *dimms); |
| 100 | |
| 101 | #endif /* RAMINIT_VX900_H */ |