diff options
author | Aaron Durbin <adurbin@chromium.org> | 2016-07-06 22:51:05 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2016-07-07 20:45:02 +0200 |
commit | fe767a7dc063ce05f546ced7238e5c535960b3ec (patch) | |
tree | 8487cf7a45b326257ae92b7ef610b0fc0a3dc141 /src/mainboard/google/reef/romstage.c | |
parent | 87579aee69d8a82eac46f8d1f249560efab8afd4 (diff) | |
download | coreboot-fe767a7dc063ce05f546ced7238e5c535960b3ec.tar.xz |
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@chromuim.org>
Reviewed-on: https://review.coreboot.org/15560
Tested-by: build bot (Jenkins)
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/mainboard/google/reef/romstage.c')
-rw-r--r-- | src/mainboard/google/reef/romstage.c | 66 |
1 files changed, 58 insertions, 8 deletions
diff --git a/src/mainboard/google/reef/romstage.c b/src/mainboard/google/reef/romstage.c index ecf6fa502d..2c68b60d46 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); } |