[coreboot-gerrit] New patch to review for coreboot: mainboard/google/reef: add memory SKU id support

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Thu Jul 7 05:57:21 CEST 2016


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15560

-gerrit

commit c6ea41e1a3bcd69bc11eeff604c32c6079b54594
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Wed Jul 6 22:51:05 2016 -0500

    mainboard/google/reef: add memory SKU id support
    
    While the proto boards didn't have a memory SKU notion the
    EVT boards do. Therefore, provide support for selecting the
    proper memory SKU information based on the memory id straps.
    
    This works on EVT boards because the pins used for the
    strapping weren't used on proto. However, internal pullups
    need to be enabled so that proto boards read the correct
    id.
    
    BUG=chrome-os-partner:54949
    BRANCH=None
    TEST=Built and used on reef for memory config.
    
    Change-Id: I8653260e5d1b9adc83b78ea2770c683b72535e11
    Signed-off-by: Aaron Durbin <adurbin at chromuim.org>
---
 src/mainboard/google/reef/gpio.h     | 10 ++++++
 src/mainboard/google/reef/romstage.c | 66 +++++++++++++++++++++++++++++++-----
 2 files changed, 68 insertions(+), 8 deletions(-)

diff --git a/src/mainboard/google/reef/gpio.h b/src/mainboard/google/reef/gpio.h
index 91e8bb1..d541a34 100644
--- a/src/mainboard/google/reef/gpio.h
+++ b/src/mainboard/google/reef/gpio.h
@@ -346,5 +346,15 @@ static const struct pad_config early_gpio_table[] = {
 	PAD_CFG_GPI(GPIO_75, UP_20K, DEEP),	 /* I2S1_BCLK -- PCH_WP */
 };
 
+/*
+ * The proto boards didn't have memory SKU pins, but the same ones can be
+ * utilized as post proto boards because the pins used were never connected
+ * or no peripheral utilized the signals on proto boards.
+ */
+#define MEM_CONFIG3 GPIO_45
+#define MEM_CONFIG2 GPIO_38
+#define MEM_CONFIG1 GPIO_102
+#define MEM_CONFIG0 GPIO_101
+
 #endif /* __ACPI__ */
 #endif /* MAINBOARD_GPIO_H */
diff --git a/src/mainboard/google/reef/romstage.c b/src/mainboard/google/reef/romstage.c
index ecf6fa5..e1d8c57 100644
--- a/src/mainboard/google/reef/romstage.c
+++ b/src/mainboard/google/reef/romstage.c
@@ -13,8 +13,10 @@
  * GNU General Public License for more details.
  */
 
+#include <gpio.h>
 #include <soc/meminit.h>
 #include <soc/romstage.h>
+#include "gpio.h"
 
 static const struct lpddr4_swizzle_cfg board_swizzle = {
 	/* CH0_DQA[0:31] SoC pins -> U22 LPDDR4 module pins */
@@ -60,15 +62,63 @@ static const struct lpddr4_swizzle_cfg board_swizzle = {
 	},
 };
 
+/*
+ * Proto boards didn't have a memory SKU id. The configuration pins use
+ * an internal weak pullup with stronger pulldowns for the 0 bits. As
+ * proto boards didn't use the memory SKU pins the sku id reads as 4'b1111,
+ * i.e. 15.
+ */
+#define PROTO_SKU 15
+
+static const struct lpddr4_sku skus[] = {
+	/* K4F6E304HB-MGCJ - both logical channels */
+	[0] = {
+		.speed = LP4_SPEED_2400,
+		.ch0_density = LP4_16Gb_DENSITY,
+		.ch1_density = LP4_16Gb_DENSITY,
+	},
+	/* K4F8E304HB-MGCJ - both logical channels  */
+	[1] = {
+		.speed = LP4_SPEED_2400,
+		.ch0_density = LP4_8Gb_DENSITY,
+		.ch1_density = LP4_8Gb_DENSITY,
+	},
+	/* MT53B512M32D2NP-062WT:C - both logical channels */
+	[2] = {
+		.speed = LP4_SPEED_2400,
+		.ch0_density = LP4_16Gb_DENSITY,
+		.ch1_density = LP4_16Gb_DENSITY,
+	/* MT53B256M32D1NP-062 WT:C - both logical channels */
+	},
+	[3] = {
+		.speed = LP4_SPEED_2400,
+		.ch0_density = LP4_8Gb_DENSITY,
+		.ch1_density = LP4_8Gb_DENSITY,
+	},
+	/* K4F8E304HB-MGCH - both logical channels */
+	[PROTO_SKU] = {
+		.speed = LP4_SPEED_2400,
+		.ch0_density = LP4_8Gb_DENSITY,
+		.ch1_density = LP4_8Gb_DENSITY,
+	},
+};
+
+static const struct lpddr4_cfg lp4cfg = {
+	.skus = skus,
+	.num_skus = ARRAY_SIZE(skus),
+	.swizzle_config = &board_swizzle,
+};
+
 void mainboard_memory_init_params(struct FSPM_UPD *memupd)
 {
-	struct FSP_M_CONFIG *cfg = &memupd->FspmConfig;
+	int mem_sku;
+	gpio_t pads[] = { MEM_CONFIG3, MEM_CONFIG2, MEM_CONFIG1, MEM_CONFIG0 };
+
+	/*
+	 * Read memory SKU id with internal pullups enabled to handle
+	 * proto boards with no SKU id pins.
+	 */
+	mem_sku = gpio_pullup_base2_value(pads, ARRAY_SIZE(pads));
 
-	/* Use a default 2400 speed. */
-	meminit_lpddr4(cfg, LP4_SPEED_2400);
-	/* Enable both logical channels with a 8Gb density. */
-	meminit_lpddr4_enable_channel(cfg, LP4_LCH0, LP4_8Gb_DENSITY,
-		&board_swizzle);
-	meminit_lpddr4_enable_channel(cfg, LP4_LCH1, LP4_8Gb_DENSITY,
-		&board_swizzle);
+	meminit_lpddr4_by_sku(&memupd->FspmConfig, &lp4cfg, mem_sku);
 }



More information about the coreboot-gerrit mailing list