]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/powerpc/include/asm/fsl_ddr_dimm_params.h
Merge branch 'master' of git://git.denx.de/u-boot-video
[karo-tx-uboot.git] / arch / powerpc / include / asm / fsl_ddr_dimm_params.h
1 /*
2  * Copyright 2008 Freescale Semiconductor, Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * Version 2 as published by the Free Software Foundation.
7  */
8
9 #ifndef DDR2_DIMM_PARAMS_H
10 #define DDR2_DIMM_PARAMS_H
11
12 #define EDC_DATA_PARITY 1
13 #define EDC_ECC         2
14 #define EDC_AC_PARITY   4
15
16 /* Parameters for a DDR2 dimm computed from the SPD */
17 typedef struct dimm_params_s {
18
19         /* DIMM organization parameters */
20         char mpart[19];         /* guaranteed null terminated */
21
22         unsigned int n_ranks;
23         unsigned long long rank_density;
24         unsigned long long capacity;
25         unsigned int data_width;
26         unsigned int primary_sdram_width;
27         unsigned int ec_sdram_width;
28         unsigned int registered_dimm;
29
30         /* SDRAM device parameters */
31         unsigned int n_row_addr;
32         unsigned int n_col_addr;
33         unsigned int edc_config;        /* 0 = none, 1 = parity, 2 = ECC */
34         unsigned int n_banks_per_sdram_device;
35         unsigned int burst_lengths_bitmask;     /* BL=4 bit 2, BL=8 = bit 3 */
36         unsigned int row_density;
37
38         /* used in computing base address of DIMMs */
39         unsigned long long base_address;
40         /* mirrored DIMMs */
41         unsigned int mirrored_dimm;     /* only for ddr3 */
42
43         /* DIMM timing parameters */
44
45         unsigned int mtb_ps;    /* medium timebase ps, only for ddr3 */
46         unsigned int ftb_10th_ps; /* fine timebase, in 1/10 ps, only for ddr3 */
47         unsigned int tAA_ps;    /* minimum CAS latency time, only for ddr3 */
48         unsigned int tFAW_ps;   /* four active window delay, only for ddr3 */
49
50         /*
51          * SDRAM clock periods
52          * The range for these are 1000-10000 so a short should be sufficient
53          */
54         unsigned int tCKmin_X_ps;
55         unsigned int tCKmin_X_minus_1_ps;
56         unsigned int tCKmin_X_minus_2_ps;
57         unsigned int tCKmax_ps;
58
59         /* SPD-defined CAS latencies */
60         unsigned int caslat_X;
61         unsigned int caslat_X_minus_1;
62         unsigned int caslat_X_minus_2;
63
64         unsigned int caslat_lowest_derated;     /* Derated CAS latency */
65
66         /* basic timing parameters */
67         unsigned int tRCD_ps;
68         unsigned int tRP_ps;
69         unsigned int tRAS_ps;
70
71         unsigned int tWR_ps;    /* maximum = 63750 ps */
72         unsigned int tWTR_ps;   /* maximum = 63750 ps */
73         unsigned int tRFC_ps;   /* max = 255 ns + 256 ns + .75 ns
74                                        = 511750 ps */
75
76         unsigned int tRRD_ps;   /* maximum = 63750 ps */
77         unsigned int tRC_ps;    /* maximum = 254 ns + .75 ns = 254750 ps */
78
79         unsigned int refresh_rate_ps;
80
81         /* DDR3 doesn't need these as below */
82         unsigned int tIS_ps;    /* byte 32, spd->ca_setup */
83         unsigned int tIH_ps;    /* byte 33, spd->ca_hold */
84         unsigned int tDS_ps;    /* byte 34, spd->data_setup */
85         unsigned int tDH_ps;    /* byte 35, spd->data_hold */
86         unsigned int tRTP_ps;   /* byte 38, spd->trtp */
87         unsigned int tDQSQ_max_ps;      /* byte 44, spd->tdqsq */
88         unsigned int tQHS_ps;   /* byte 45, spd->tqhs */
89
90         /* DDR3 RDIMM */
91         unsigned char rcw[16];  /* Register Control Word 0-15 */
92 } dimm_params_t;
93
94 extern unsigned int ddr_compute_dimm_parameters(
95                                          const generic_spd_eeprom_t *spd,
96                                          dimm_params_t *pdimm,
97                                          unsigned int dimm_number);
98
99 #endif