Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) Marvell International Ltd. and its affiliates |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _DDR_TOPOLOGY_DEF_H |
| 7 | #define _DDR_TOPOLOGY_DEF_H |
| 8 | |
| 9 | #include "ddr3_training_ip_def.h" |
| 10 | #include "ddr3_topology_def.h" |
| 11 | |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 12 | #if defined(CONFIG_ARMADA_38X) || defined(CONFIG_ARMADA_39X) |
| 13 | #include "mv_ddr_plat.h" |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 14 | #endif |
| 15 | |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 16 | #include "mv_ddr_topology.h" |
| 17 | #include "mv_ddr_spd.h" |
| 18 | #include "ddr3_logging_def.h" |
Marek BehĂșn | f8bf75f | 2017-06-09 19:28:40 +0200 | [diff] [blame] | 19 | |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 20 | struct bus_params { |
| 21 | /* Chip Select (CS) bitmask (bits 0-CS0, bit 1- CS1 ...) */ |
| 22 | u8 cs_bitmask; |
| 23 | |
| 24 | /* |
| 25 | * mirror enable/disable |
| 26 | * (bits 0-CS0 mirroring, bit 1- CS1 mirroring ...) |
| 27 | */ |
| 28 | int mirror_enable_bitmask; |
| 29 | |
| 30 | /* DQS Swap (polarity) - true if enable */ |
| 31 | int is_dqs_swap; |
| 32 | |
| 33 | /* CK swap (polarity) - true if enable */ |
| 34 | int is_ck_swap; |
| 35 | }; |
| 36 | |
| 37 | struct if_params { |
| 38 | /* bus configuration */ |
| 39 | struct bus_params as_bus_params[MAX_BUS_NUM]; |
| 40 | |
| 41 | /* Speed Bin Table */ |
| 42 | enum hws_speed_bin speed_bin_index; |
| 43 | |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 44 | /* sdram device width */ |
| 45 | enum mv_ddr_dev_width bus_width; |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 46 | |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 47 | /* total sdram capacity per die, megabits */ |
| 48 | enum mv_ddr_die_capacity memory_size; |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 49 | |
| 50 | /* The DDR frequency for each interfaces */ |
| 51 | enum hws_ddr_freq memory_freq; |
| 52 | |
| 53 | /* |
| 54 | * delay CAS Write Latency |
| 55 | * - 0 for using default value (jedec suggested) |
| 56 | */ |
| 57 | u8 cas_wl; |
| 58 | |
| 59 | /* |
| 60 | * delay CAS Latency |
| 61 | * - 0 for using default value (jedec suggested) |
| 62 | */ |
| 63 | u8 cas_l; |
| 64 | |
| 65 | /* operation temperature */ |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 66 | enum mv_ddr_temperature interface_temp; |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 67 | }; |
| 68 | |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 69 | struct mv_ddr_topology_map { |
| 70 | /* debug level configuration */ |
| 71 | enum mv_ddr_debug_level debug_level; |
| 72 | |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 73 | /* Number of interfaces (default is 12) */ |
| 74 | u8 if_act_mask; |
| 75 | |
| 76 | /* Controller configuration per interface */ |
| 77 | struct if_params interface_params[MAX_INTERFACE_NUM]; |
| 78 | |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 79 | /* Bit mask for active buses */ |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 80 | u16 bus_act_mask; |
| 81 | |
| 82 | /* source of ddr configuration data */ |
| 83 | enum mv_ddr_cfg_src cfg_src; |
| 84 | |
| 85 | /* raw spd data */ |
| 86 | union mv_ddr_spd_data spd_data; |
| 87 | |
| 88 | /* timing parameters */ |
| 89 | unsigned int timing_data[MV_DDR_TDATA_LAST]; |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | /* DDR3 training global configuration parameters */ |
| 93 | struct tune_train_params { |
| 94 | u32 ck_delay; |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 95 | u32 phy_reg3_val; |
Chris Packham | 1a07d21 | 2018-05-10 13:28:29 +1200 | [diff] [blame^] | 96 | u32 g_zpri_data; |
| 97 | u32 g_znri_data; |
| 98 | u32 g_zpri_ctrl; |
| 99 | u32 g_znri_ctrl; |
| 100 | u32 g_zpodt_data; |
| 101 | u32 g_znodt_data; |
| 102 | u32 g_zpodt_ctrl; |
| 103 | u32 g_znodt_ctrl; |
| 104 | u32 g_dic; |
| 105 | u32 g_odt_config; |
| 106 | u32 g_rtt_nom; |
| 107 | u32 g_rtt_wr; |
| 108 | u32 g_rtt_park; |
Stefan Roese | 5ffceb8 | 2015-03-26 15:36:56 +0100 | [diff] [blame] | 109 | }; |
| 110 | |
| 111 | #endif /* _DDR_TOPOLOGY_DEF_H */ |