mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / lenovo / s230u / early_init.c
blobf4396cb617e2b2fc4bb8242526f4c07c85add2d6
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/pci_ops.h>
4 #include <console/console.h>
5 #include <northbridge/intel/sandybridge/raminit.h>
6 #include <southbridge/intel/bd82x6x/pch.h>
7 #include <southbridge/intel/common/gpio.h>
8 #include "ec.h"
10 void mainboard_pch_lpc_setup(void)
12 /* Memory map KB9012 EC registers */
13 pci_write_config32(
14 PCH_LPC_DEV, LGMR,
15 CONFIG_EC_BASE_ADDRESS | 1);
16 pci_write_config16(PCH_LPC_DEV, BIOS_DEC_EN1, 0xffc0);
18 /* Enable external USB port power. */
19 if (CONFIG(USBDEBUG))
20 ec_mm_set_bit(0x3b, 4);
23 static const char *mainboard_spd_names[9] = {
24 "ELPIDA 4GB",
25 "SAMSUNG 4GB",
26 "HYNIX 4GB",
27 "ELPIDA 8GB",
28 "SAMSUNG 8GB",
29 "HYNIX 8GB",
30 "ELPIDA 2GB",
31 "SAMSUNG 2GB",
32 "HYNIX 2GB",
35 static unsigned int get_spd_index(void)
37 const int spd_gpios[] = {71, 70, 16, 48, -1};
39 unsigned int spd_index = get_gpios(spd_gpios);
40 if (spd_index >= ARRAY_SIZE(mainboard_spd_names)) {
41 /* Fallback to pessimistic 2GB image (ELPIDA 2GB) */
42 spd_index = 6;
45 return spd_index;
48 void mb_get_spd_map(struct spd_info *spdi)
50 unsigned int spd_index = get_spd_index();
52 printk(BIOS_INFO, "SPD index %d (%s)\n",
53 spd_index, mainboard_spd_names[spd_index]);
55 /* C0S0 is a soldered RAM with no real SPD. Use stored SPD. */
56 spdi->addresses[0] = SPD_MEMORY_DOWN;
57 spdi->spd_index = spd_index;