coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
OemCustomize.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
5 #include <gpio.h>
6 #include <console/console.h>
7 #include <soc/pci_devs.h>
8 
9 #define DIMMS_PER_CHANNEL 1
10 #if DIMMS_PER_CHANNEL > MAX_DIMMS_PER_CH
11 #error "Too many DIMM sockets defined for the mainboard"
12 #endif
13 
14 static const PSO_ENTRY DDR4PlatformMemoryConfiguration[] = {
15  DRAM_TECHNOLOGY(ANY_SOCKET, DDR4_TECHNOLOGY),
16  NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, DIMMS_PER_CHANNEL),
17  NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, MAX_DRAM_CH),
18  MOTHER_BOARD_LAYERS(LAYERS_6),
19  MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL,
20  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00),
21  CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff),
22  ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff),
23  CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL,
24  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00),
25  PSO_END
26 };
27 /* Liara-specific 2T memory configuration */
28 static const PSO_ENTRY DDR4_2T_MemoryConfiguration[] = {
29  DRAM_TECHNOLOGY(ANY_SOCKET, DDR4_TECHNOLOGY),
30  NUMBER_OF_DIMMS_SUPPORTED(ANY_SOCKET, ANY_CHANNEL, DIMMS_PER_CHANNEL),
31  NUMBER_OF_CHANNELS_SUPPORTED(ANY_SOCKET, MAX_DRAM_CH),
32  MOTHER_BOARD_LAYERS(LAYERS_6),
33  MEMCLK_DIS_MAP(ANY_SOCKET, ANY_CHANNEL,
34  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00),
35  CKE_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff),
36  ODT_TRI_MAP(ANY_SOCKET, ANY_CHANNEL, 0xff, 0xff, 0xff, 0xff),
37  CS_TRI_MAP(ANY_SOCKET, ANY_CHANNEL,
38  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00),
39  TBLDRV_CONFIG_TO_OVERRIDE(DIMMS_PER_CHANNEL, ANY_SPEED, VOLT_ANY_,
40  ANY_),
41  TBLDRV_CONFIG_ENTRY_SLOWACCMODE(1),
42  PSO_END
43 };
44 
45 void OemPostParams(AMD_POST_PARAMS *PostParams)
46 {
47  if (CONFIG(BOARD_GOOGLE_LIARA) || CONFIG(BOARD_GOOGLE_TREEYA))
48  PostParams->MemConfig.PlatformMemoryConfiguration =
49  (PSO_ENTRY *)DDR4_2T_MemoryConfiguration;
50  else
51  PostParams->MemConfig.PlatformMemoryConfiguration =
53  /*
54  * Bank interleaving is enabled by default in AGESA. However, from AMD's
55  * explanation, bank interleaving is really chip select interleave,
56  * requiring 2 chip select arriving to the DIMM (rank interleaving). As
57  * both kahlee and grunt are hardware limited to a single chip select
58  * arriving at the DIMM, interleave will not work. This causes AGESA to
59  * throw a warning. To avoid the warning, interleaving needs to be
60  * disabled.
61  */
62  PostParams->MemConfig.EnableBankIntlv = FALSE;
63 }
64 
65 void set_board_env_params(GNB_ENV_CONFIGURATION *params)
66 {
67  const struct soc_amd_stoneyridge_config *cfg;
68  const struct device *dev = pcidev_path_on_root(GNB_DEVFN);
69  if (!dev || !dev->chip_info) {
70  printk(BIOS_WARNING, "Cannot find SoC devicetree config\n");
71  return;
72  }
73  cfg = dev->chip_info;
75  /*
76  * GPIO 133 - Backlight enable (active low)
77  * Pass control of the backlight to the video BIOS
78  */
79  gpio_set(GPIO_133, 0);
80  printk(BIOS_INFO, "Change panel init timing\n");
81  params->LvdsPowerOnSeqVaryBlToBlon =
83  params->LvdsPowerOnSeqBlonToVaryBl =
85  printk(BIOS_INFO, "LvdsPowerOnSeqVaryBlToBlon: %dms\n",
86  (params->LvdsPowerOnSeqVaryBlToBlon)*4);
87  printk(BIOS_INFO, "LvdsPowerOnSeqBlonToVaryBl: %dms\n",
88  (params->LvdsPowerOnSeqBlonToVaryBl)*4);
89  }
90  params->EDPv1_4VSMode = EDP_VS_HIGH_VDIFF_MODE;
91 }
void OemPostParams(AMD_POST_PARAMS *PostParams)
Definition: OemCustomize.c:25
static struct sdram_info params
Definition: sdram_configs.c:83
#define printk(level,...)
Definition: stdlib.h:16
DEVTREE_CONST struct device * pcidev_path_on_root(pci_devfn_t devfn)
Definition: device_const.c:255
@ CONFIG
Definition: dsi_common.h:201
static const PSO_ENTRY DDR4PlatformMemoryConfiguration[]
Definition: OemCustomize.c:14
static const PSO_ENTRY DDR4_2T_MemoryConfiguration[]
Definition: OemCustomize.c:28
#define DIMMS_PER_CHANNEL
Definition: OemCustomize.c:9
void set_board_env_params(GNB_ENV_CONFIGURATION *params)
Definition: OemCustomize.c:65
void gpio_set(gpio_t gpio, int value)
Definition: gpio.c:174
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
#define GNB_DEVFN
Definition: pci_devs.h:13
#define MAX_DRAM_CH
Definition: chip.h:19
#define GPIO_133
Definition: gpio.h:97
Definition: device.h:107
DEVTREE_CONST void * chip_info
Definition: device.h:164