coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
memory.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <baseboard/variants.h>
4 #include <gpio.h>
5 #include <soc/meminit.h>
6 #include <variant/gpio.h>
7 
9  /* CH0_DQA[0:31] SoC pins -> U22 LPDDR4 module pins */
10  .phys[LP4_PHYS_CH0A] = {
11  /* DQA[0:7] pins of LPDDR4 module. */
12  .dqs[LP4_DQS0] = { 6, 7, 5, 4, 3, 1, 0, 2 },
13  /* DQA[8:15] pins of LPDDR4 module. */
14  .dqs[LP4_DQS1] = { 12, 10, 11, 13, 14, 8, 9, 15 },
15  /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
16  .dqs[LP4_DQS2] = { 16, 22, 23, 20, 18, 17, 19, 21 },
17  /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
18  .dqs[LP4_DQS3] = { 30, 28, 29, 25, 24, 26, 27, 31 },
19  },
20  .phys[LP4_PHYS_CH0B] = {
21  /* DQA[0:7] pins of LPDDR4 module. */
22  .dqs[LP4_DQS0] = { 7, 3, 5, 2, 6, 0, 1, 4 },
23  /* DQA[8:15] pins of LPDDR4 module. */
24  .dqs[LP4_DQS1] = { 9, 14, 12, 13, 10, 11, 8, 15 },
25  /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
26  .dqs[LP4_DQS2] = { 20, 22, 23, 16, 19, 17, 18, 21 },
27  /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
28  .dqs[LP4_DQS3] = { 28, 24, 26, 27, 29, 30, 31, 25 },
29  },
30  .phys[LP4_PHYS_CH1A] = {
31  /* DQA[0:7] pins of LPDDR4 module. */
32  .dqs[LP4_DQS0] = { 2, 1, 6, 7, 5, 4, 3, 0 },
33  /* DQA[8:15] pins of LPDDR4 module. */
34  .dqs[LP4_DQS1] = { 11, 10, 8, 9, 12, 15, 13, 14 },
35  /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
36  .dqs[LP4_DQS2] = { 17, 23, 19, 16, 21, 22, 20, 18 },
37  /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
38  .dqs[LP4_DQS3] = { 31, 29, 26, 25, 28, 27, 24, 30 },
39  },
40  .phys[LP4_PHYS_CH1B] = {
41  /* DQA[0:7] pins of LPDDR4 module. */
42  .dqs[LP4_DQS0] = { 4, 3, 7, 5, 6, 1, 0, 2 },
43  /* DQA[8:15] pins of LPDDR4 module. */
44  .dqs[LP4_DQS1] = { 15, 9, 8, 11, 14, 13, 12, 10 },
45  /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
46  .dqs[LP4_DQS2] = { 20, 23, 22, 21, 18, 19, 16, 17 },
47  /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
48  .dqs[LP4_DQS3] = { 25, 28, 30, 31, 26, 27, 24, 29 },
49  },
50 };
51 
52 static const struct lpddr4_sku skus[] = {
53  /*
54  * K4F6E304HB-MGCJ - both logical channels While the parts
55  * are listed at 16Gb there are 2 ranks per channel so indicate
56  * the density as 8Gb per rank.
57  */
58  [0] = {
60  .ch0_rank_density = LP4_8Gb_DENSITY,
61  .ch1_rank_density = LP4_8Gb_DENSITY,
62  .ch0_dual_rank = 1,
63  .ch1_dual_rank = 1,
64  .part_num = "K4F6E304HB-MGCJ",
65  },
66  /* K4F8E304HB-MGCJ - both logical channels */
67  [1] = {
68  .speed = LP4_SPEED_2400,
69  .ch0_rank_density = LP4_8Gb_DENSITY,
70  .ch1_rank_density = LP4_8Gb_DENSITY,
71  .part_num = "K4F8E304HB-MGCJ",
72  },
73  /*
74  * MT53B512M32D2NP-062WT:C - both logical channels. While the parts
75  * are listed at 16Gb there are 2 ranks per channel so indicate
76  * the density as 8Gb per rank.
77  */
78  [2] = {
79  .speed = LP4_SPEED_2400,
80  .ch0_rank_density = LP4_8Gb_DENSITY,
81  .ch1_rank_density = LP4_8Gb_DENSITY,
82  .ch0_dual_rank = 1,
83  .ch1_dual_rank = 1,
84  .part_num = "MT53B512M32D2NP",
85  .disable_periodic_retraining = 1,
86  },
87  /* MT53B256M32D1NP-062 WT:C - both logical channels */
88  [3] = {
89  .speed = LP4_SPEED_2400,
90  .ch0_rank_density = LP4_8Gb_DENSITY,
91  .ch1_rank_density = LP4_8Gb_DENSITY,
92  .part_num = "MT53B256M32D1NP",
93  .disable_periodic_retraining = 1,
94  },
95  /*
96  * H9HCNNNBPUMLHR-NLE - both logical channels. While the parts
97  * are listed at 16Gb there are 2 ranks per channel so indicate the
98  * density as 8Gb per rank.
99  */
100  [4] = {
101  .speed = LP4_SPEED_2400,
102  .ch0_rank_density = LP4_8Gb_DENSITY,
103  .ch1_rank_density = LP4_8Gb_DENSITY,
104  .ch0_dual_rank = 1,
105  .ch1_dual_rank = 1,
106  .part_num = "H9HCNNNBPUMLHR",
107  },
108  /* H9HCNNN8KUMLHR-NLE - both logical channels */
109  [5] = {
110  .speed = LP4_SPEED_2400,
111  .ch0_rank_density = LP4_8Gb_DENSITY,
112  .ch1_rank_density = LP4_8Gb_DENSITY,
113  .part_num = "H9HCNNN8KUMLHR",
114  },
115 };
116 
117 static const struct lpddr4_cfg lp4cfg = {
118  .skus = skus,
119  .num_skus = ARRAY_SIZE(skus),
120  .swizzle_config = &baseboard_lpddr4_swizzle,
121 };
122 
124 {
125  return &lp4cfg;
126 }
127 
129 {
130  return 0;
131 }
@ LP4_PHYS_CH0B
Definition: meminit.h:19
@ LP4_PHYS_CH0A
Definition: meminit.h:18
@ LP4_PHYS_CH1A
Definition: meminit.h:20
@ LP4_PHYS_CH1B
Definition: meminit.h:21
@ LP4_DQS3
Definition: meminit.h:40
@ LP4_DQS1
Definition: meminit.h:38
@ LP4_DQS0
Definition: meminit.h:37
@ LP4_DQS2
Definition: meminit.h:39
@ LP4_SPEED_2400
Definition: meminit.h:49
@ LP4_8Gb_DENSITY
Definition: meminit.h:56
#define ARRAY_SIZE(a)
Definition: helpers.h:12
int __weak variant_memory_sku(void)
Definition: memory.c:74
const struct lpddr4_cfg *__weak variant_lpddr4_config(void)
Definition: memory.c:190
const struct lpddr4_swizzle_cfg baseboard_lpddr4_swizzle
Definition: memory.c:9
static const struct lpddr4_cfg lp4cfg
Definition: memory.c:117
static const struct lpddr4_sku skus[]
Definition: memory.c:52
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
const struct lpddr4_sku * skus
Definition: meminit.h:112
uint8_t dqs[LP4_NUM_BYTE_LANES][DQ_BITS_PER_DQS]
Definition: meminit.h:78
int speed
Definition: meminit.h:102
struct lpddr4_chan_swizzle_cfg phys[LP4_NUM_PHYS_CHANNELS]
Definition: meminit.h:82