coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
mainboard.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <bootstate.h>
4 #include <device/pci_def.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
7 #include <gpio.h>
8 #include <hwilib.h>
9 #include <intelblocks/lpc_lib.h>
10 #include <intelblocks/pcr.h>
11 #include <soc/pcr_ids.h>
12 #include <baseboard/variants.h>
13 #include <types.h>
14 
15 #define TX_DWORD3 0xa8c
16 
18 {
19  struct device *dev = NULL;
20 
21  /*
22  * PIR6 register mapping for PCIe root ports
23  * INTA#->PIRQB#, INTB#->PIRQC#, INTC#->PIRQD#, INTD#-> PIRQA#
24  */
25  pcr_write16(PID_ITSS, 0x314c, 0x0321);
26 
27  /* Enable CLKRUN_EN for power gating LPC */
29 
30  /*
31  * Enable LPC PCE (Power Control Enable) by setting IOSF-SB port 0xD2
32  * offset 0x341D bit3 and bit0.
33  * Enable LPC CCE (Clock Control Enable) by setting IOSF-SB port 0xD2
34  * offset 0x341C bit [3:0].
35  */
37 
38  /*
39  * Correct the SATA transmit signal via the High Speed I/O Transmit
40  * Control Register 3.
41  * Bit [23:16] set the output voltage swing for TX line.
42  * The value 0x4a sets the swing level to 0.58 V.
43  */
44  pcr_rmw32(PID_MODPHY, TX_DWORD3, (0x00 << 16), (0x4a << 16));
45 
46  /* Set Master Enable for on-board PCI device if allowed. */
47  dev = dev_find_device(PCI_VID_SIEMENS, 0x403e, 0);
48  if (dev) {
49  if (CONFIG(PCI_ALLOW_BUS_MASTER_ANY_DEVICE))
51 
52  /* Disable clock outputs 0-3 (CLKOUT) for upstream XIO2001 PCIe
53  * to PCI Bridge. */
54  struct device *parent = dev->bus->dev;
55  if (parent && parent->device == PCI_DID_TI_XIO2001)
56  pci_write_config8(parent, 0xd8, 0x0f);
57  }
58 
59  /* Disable clock outputs 1-5 (CLKOUT) for another XIO2001 PCIe to PCI
60  * Bridge on this mainboard.
61  */
62  dev = dev_find_device(PCI_VID_SIEMENS, 0x403f, 0);
63  if (dev) {
64  struct device *parent = dev->bus->dev;
65  if (parent && parent->device == PCI_DID_TI_XIO2001)
66  pci_write_config8(parent, 0xd8, 0x3e);
67  }
68 }
69 
70 static void finalize_boot(void *unused)
71 {
72  /* Set coreboot ready LED. */
74 }
75 
#define PID_LPC
Definition: pcr_ids.h:21
#define PID_MODPHY
Definition: pcr_ids.h:22
@ BS_PAYLOAD_BOOT
Definition: bootstate.h:89
@ BS_ON_ENTRY
Definition: bootstate.h:95
void pcr_write16(uint8_t pid, uint16_t offset, uint16_t indata)
Definition: pcr.c:134
void pcr_rmw32(uint8_t pid, uint16_t offset, uint32_t anddata, uint32_t ordata)
Definition: pcr.c:154
void pcr_or32(uint8_t pid, uint16_t offset, uint32_t ordata)
Definition: pcr.c:184
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_EXIT, sch5545_ec_hwm_init, NULL)
@ PID_ITSS
Definition: pcr.h:16
struct device * dev_find_device(u16 vendor, u16 device, struct device *from)
Find a device of a given vendor and type.
Definition: device_util.c:42
@ CONFIG
Definition: dsi_common.h:201
#define CNV_RGI_DT
Definition: gpio_apl.h:138
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
void gpio_output(gpio_t gpio, int value)
Definition: gpio.c:194
#define PCR_LPC_PCE_EN
Definition: lpc_lib.h:31
void lpc_enable_pci_clk_cntl(void)
Definition: lpc_lib.c:292
#define PCR_LPC_CCE_EN
Definition: lpc_lib.h:30
#define PCR_LPC_PRC
Definition: lpc_lib.h:29
#define PCI_COMMAND_MASTER
Definition: pci_def.h:13
#define PCI_COMMAND
Definition: pci_def.h:10
#define PCI_VID_SIEMENS
Definition: pci_ids.h:1491
#define PCI_DID_TI_XIO2001
Definition: pci_ids.h:868
void __weak variant_mainboard_final(void)
Definition: mainboard.c:245
static void finalize_boot(void *unused)
Definition: mainboard.c:70
#define TX_DWORD3
Definition: mainboard.c:15
#define NULL
Definition: stddef.h:19
DEVTREE_CONST struct device * dev
Definition: device.h:78
Definition: device.h:107
DEVTREE_CONST struct bus * bus
Definition: device.h:108
unsigned int device
Definition: device.h:117