Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5237
-gerrit
commit d682ff7aec91780ec7c9c23aed3551bee283e649
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Fri Feb 14 12:45:09 2014 +0200
OxPCIe uart: Split PCI bridge control
None of the bridge management here is specific to the PCI UART
device/function. Also the Kconfig variable defaults are not globally
valid but originate from lumpy and/or stumpy devices.
Change-Id: Id22631412379af1d6bf62c996357d36d7ec47ca3
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/console/console.c | 5 +-
src/device/Kconfig | 29 ++++++++
src/device/Makefile.inc | 1 +
src/device/pci_early.c | 115 +++++++++++++++++++++++++++++++
src/drivers/oxford/oxpcie/Kconfig | 64 +----------------
src/drivers/oxford/oxpcie/oxpcie_early.c | 89 +++++-------------------
src/include/console/uart.h | 1 -
src/include/device/pci.h | 2 +
src/southbridge/intel/bd82x6x/Kconfig | 16 +++++
9 files changed, 187 insertions(+), 135 deletions(-)
diff --git a/src/console/console.c b/src/console/console.c
index 9e9e4e2..3eedb84 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -27,6 +27,7 @@
#include <build.h>
#include <arch/hlt.h>
#include <arch/io.h>
+#include <device/pci.h>
#ifndef __PRE_RAM__
#include <string.h>
@@ -101,8 +102,8 @@ void console_init(void)
#if defined(__BOOT_BLOCK__) && CONFIG_BOOTBLOCK_CONSOLE || \
!defined(__BOOT_BLOCK__) && CONFIG_EARLY_CONSOLE
-#if CONFIG_DRIVERS_OXFORD_OXPCIE
- oxford_init();
+#if CONFIG_EARLY_PCI_BRIDGE
+ pci_early_bridge_init();
#endif
#if CONFIG_CONSOLE_SERIAL
uart_init();
diff --git a/src/device/Kconfig b/src/device/Kconfig
index eaa0c04..932b4de 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -237,6 +237,35 @@ config PCIEXP_ASPM
config PCI_BUS_SEGN_BITS
int
default 0
+
+config EARLY_PCI_BRIDGE
+ bool "Early PCI bridge"
+ depends on PCI
+ default n
+ help
+ While coreboot is executing code from ROM, the coreboot resource
+ allocator has not been running yet. Hence PCI devices living behind
+ a bridge are not yet visible to the system.
+
+ This option enables static configuration for a single pre-defined
+ PCI bridge function on bus 0.
+
+if EARLY_PCI_BRIDGE
+
+config EARLY_PCI_BRIDGE_DEVICE
+ hex "bridge device"
+ default 0x0
+
+config EARLY_PCI_BRIDGE_FUNCTION
+ hex "bridge function"
+ default 0x0
+
+config EARLY_PCI_MMIO_BASE
+ hex "MMIO window base"
+ default 0x0
+
+endif # EARLY_PCI_BRIDGE
+
endmenu
menu "VGA BIOS"
diff --git a/src/device/Makefile.inc b/src/device/Makefile.inc
index ce412b7..bd41b12 100644
--- a/src/device/Makefile.inc
+++ b/src/device/Makefile.inc
@@ -11,6 +11,7 @@ ramstage-$(CONFIG_CARDBUS_PLUGIN_SUPPORT) += cardbus_device.c
ramstage-$(CONFIG_AZALIA_PLUGIN_SUPPORT) += azalia_device.c
ramstage-$(CONFIG_ARCH_X86) += pnp_device.c
ramstage-$(CONFIG_PCI) += pci_ops.c
+ramstage-$(CONFIG_PCI) += pci_early.c
ramstage-y += smbus_ops.c
romstage-y += device_romstage.c
diff --git a/src/device/pci_early.c b/src/device/pci_early.c
index c15a4d0..627e5ac 100644
--- a/src/device/pci_early.c
+++ b/src/device/pci_early.c
@@ -1,6 +1,8 @@
/*
* This file is part of the coreboot project.
*
+ * Copyright (C) 2011 Google Inc
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
@@ -15,9 +17,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
*/
+#define __SIMPLE_DEVICE__
+
#include <arch/io.h>
#include <device/pci.h>
#include <device/pci_def.h>
+#include <delay.h>
+
+#ifdef __PRE_RAM__
unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last)
{
@@ -66,3 +73,111 @@ unsigned pci_find_capability(device_t dev, unsigned cap)
{
return pci_find_next_capability(dev, cap, 0);
}
+#endif
+
+
+#if CONFIG_EARLY_PCI_BRIDGE
+
+static void pci_bridge_reset_secondary(device_t p2p_bridge)
+{
+ u16 reg16;
+ /* Disable all access through bridge. */
+ reg16 = pci_read_config16(p2p_bridge, PCI_COMMAND);
+ reg16 &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
+ pci_write_config16(p2p_bridge, PCI_COMMAND, reg16);
+
+ /* First we reset the secondary bus. */
+ reg16 = pci_read_config16(p2p_bridge, PCI_BRIDGE_CONTROL);
+ reg16 |= (1 << 6); /* SRESET */
+ pci_write_config16(p2p_bridge, PCI_BRIDGE_CONTROL, reg16);
+
+ /* Assume we don't have to wait here forever */
+
+ /* Read back and clear reset bit. */
+ reg16 = pci_read_config16(p2p_bridge, PCI_BRIDGE_CONTROL);
+ reg16 &= ~(1 << 6); /* SRESET */
+ pci_write_config16(p2p_bridge, PCI_BRIDGE_CONTROL, reg16);
+}
+
+static void pci_bridge_set_secondary(device_t p2p_bridge, u8 secondary)
+{
+ /* Disable config transaction forwarding. */
+ pci_write_config8(p2p_bridge, PCI_SUBORDINATE_BUS, 0x00);
+ pci_write_config8(p2p_bridge, PCI_SECONDARY_BUS, 0x00);
+ /* Enable config transaction forwarding. */
+ pci_write_config8(p2p_bridge, PCI_SECONDARY_BUS, secondary);
+ pci_write_config8(p2p_bridge, PCI_SUBORDINATE_BUS, secondary);
+}
+
+static void pci_bridge_set_mmio(device_t p2p_bridge, u32 base, u32 size)
+{
+ u16 reg16;
+
+ /* Disable MMIO window behind the bridge. */
+ reg16 = pci_read_config16(p2p_bridge, PCI_COMMAND);
+ reg16 &= ~PCI_COMMAND_MEMORY;
+ pci_write_config16(p2p_bridge, PCI_COMMAND, reg16);
+ pci_write_config32(p2p_bridge, PCI_MEMORY_BASE, 0x10);
+
+ if (!size)
+ return;
+
+ /* Enable MMIO window behind the bridge. */
+ pci_write_config32(p2p_bridge, PCI_MEMORY_BASE,
+ ((base + size - 1) & 0xfff00000) | ((base >> 16) & 0xfff0));
+
+ reg16 = pci_read_config16(p2p_bridge, PCI_COMMAND);
+ reg16 |= PCI_COMMAND_MEMORY;
+ pci_write_config16(p2p_bridge, PCI_COMMAND, reg16);
+}
+
+void pci_early_bridge_init(void)
+{
+ int timeout, ret = -1;
+
+ /* No PCI-to-PCI bridges are enabled yet, so the one we try to
+ * configure must have its primary on bus 0.
+ */
+ pci_devfn_t p2p_bridge = PCI_DEV(0, CONFIG_EARLY_PCI_BRIDGE_DEVICE,
+ CONFIG_EARLY_PCI_BRIDGE_FUNCTION);
+
+ /* Secondary bus number is mostly irrelevant as we disable
+ * configuration transactions right after the probe.
+ */
+ u8 secondary = 15;
+ u8 dev = 0;
+ u32 mmio_base = CONFIG_EARLY_PCI_MMIO_BASE;
+
+ /* Enable configuration and MMIO over bridge. */
+ pci_bridge_reset_secondary(p2p_bridge);
+ pci_bridge_set_secondary(p2p_bridge, secondary);
+ pci_bridge_set_mmio(p2p_bridge, mmio_base, 0x4000);
+
+ for (timeout = 20000; timeout && (dev < 32) && ret; timeout--) {
+ u32 id = pci_read_config32(PCI_DEV(secondary, dev, 0), PCI_VENDOR_ID);
+
+ /* Retry request. */
+ if (id == 0xffff0001) {
+ udelay(10);
+ continue;
+ }
+
+ /* Empty slot. */
+ if (id == 0xffffffff || id == 0) {
+ dev++;
+ continue;
+ }
+ ret = pci_early_device_probe(secondary, dev, mmio_base);
+ }
+
+ /* Disable MMIO window if we found no suitable device. */
+ if (ret)
+ pci_bridge_set_mmio(p2p_bridge, 0, 0);
+
+ /* Resource allocator will reconfigure bridges and secondary bus
+ * number may change. Thus early device cannot reliably use config
+ * transactions from here on, so we may as well disable them.
+ */
+ pci_bridge_set_secondary(p2p_bridge, 0);
+}
+#endif /* CONFIG_EARLY_PCI_BRIDGE */
diff --git a/src/drivers/oxford/oxpcie/Kconfig b/src/drivers/oxford/oxpcie/Kconfig
index 5ad42aa..c2ea7b6 100644
--- a/src/drivers/oxford/oxpcie/Kconfig
+++ b/src/drivers/oxford/oxpcie/Kconfig
@@ -1,68 +1,10 @@
config DRIVERS_OXFORD_OXPCIE
bool "Oxford OXPCIe952"
default n
+ depends on PCI
select DRIVERS_UART_8250MEM
+ select EARLY_PCI_BRIDGE
help
Support for Oxford OXPCIe952 serial port PCIe cards.
Currently only devices with the vendor ID 0x1415 and device ID
- 0xc158 will work.
- NOTE: Right now you have to set the base address of your OXPCIe952
- card to exactly the value that the device allocator would set them
- later on, or serial console functionality will stop as soon as the
- resource allocator assigns a new base address to the device.
-
-config OXFORD_OXPCIE_BRIDGE_BUS
- hex "OXPCIe's PCIe bridge bus number"
- default 0x0
- depends on DRIVERS_OXFORD_OXPCIE
- help
- While coreboot is executing code from ROM, the coreboot resource
- allocator has not been running yet. Hence PCI devices living behind
- a bridge are not yet visible to the system. In order to use an
- OXPCIe952 based PCIe card, coreboot has to set up the PCIe bridge
- that controls the OXPCIe952 controller first.
-
-config OXFORD_OXPCIE_BRIDGE_DEVICE
- hex "OXPCIe's PCIe bridge device number"
- default 0x1c
- depends on DRIVERS_OXFORD_OXPCIE
- help
- While coreboot is executing code from ROM, the coreboot resource
- allocator has not been running yet. Hence PCI devices living behind
- a bridge are not yet visible to the system. In order to use an
- OXPCIe952 based PCIe card, coreboot has to set up the PCIe bridge
- that controls the OXPCIe952 controller first.
-
-config OXFORD_OXPCIE_BRIDGE_FUNCTION
- hex "OXPCIe's PCIe bridge function number"
- default 0x2
- depends on DRIVERS_OXFORD_OXPCIE
- help
- While coreboot is executing code from ROM, the coreboot resource
- allocator has not been running yet. Hence PCI devices living behind
- a bridge are not yet visible to the system. In order to use an
- OXPCIe952 based PCIe card, coreboot has to set up the PCIe bridge
- that controls the OXPCIe952 controller first.
-
-config OXFORD_OXPCIE_BRIDGE_SUBORDINATE
- hex "OXPCIe's PCIe bridge subordinate bus"
- default 0x3
- depends on DRIVERS_OXFORD_OXPCIE
- help
- While coreboot is executing code from ROM, the coreboot resource
- allocator has not been running yet. Hence PCI devices living behind
- a bridge are not yet visible to the system. In order to use an
- OXPCIe952 based PCIe card, coreboot has to set up the PCIe bridge
- that controls the OXPCIe952 controller first.
-
-config OXFORD_OXPCIE_BASE_ADDRESS
- hex "Base address for rom stage console"
- default 0xe0400000
- depends on DRIVERS_OXFORD_OXPCIE
- help
- While coreboot is executing code from ROM, the coreboot resource
- allocator has not been running yet. Hence PCI devices living behind
- a bridge are not yet visible to the system. In order to use an
- OXPCIe952 based PCIe card, coreboot has to set up a temporary address
- for the OXPCIe952 controller.
-
+ 0xc158 or 0xc11b will work.
diff --git a/src/drivers/oxford/oxpcie/oxpcie_early.c b/src/drivers/oxford/oxpcie/oxpcie_early.c
index 7de9da6..b81fa89 100644
--- a/src/drivers/oxford/oxpcie/oxpcie_early.c
+++ b/src/drivers/oxford/oxpcie/oxpcie_early.c
@@ -23,101 +23,53 @@
#include <stddef.h>
#include <arch/io.h>
#include <arch/early_variables.h>
-#include <delay.h>
#include <boot/coreboot_tables.h>
#include <console/uart.h>
#include <device/pci.h>
#include <device/pci_def.h>
static unsigned int oxpcie_present CAR_GLOBAL;
-static ROMSTAGE_CONST u32 uart0_base = CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000;
-static ROMSTAGE_CONST u32 uart1_base = CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x2000;
+static ROMSTAGE_CONST u32 uart0_base = CONFIG_EARLY_PCI_MMIO_BASE + 0x1000;
+static ROMSTAGE_CONST u32 uart1_base = CONFIG_EARLY_PCI_MMIO_BASE + 0x2000;
-#define PCIE_BRIDGE \
- PCI_DEV(CONFIG_OXFORD_OXPCIE_BRIDGE_BUS, \
- CONFIG_OXFORD_OXPCIE_BRIDGE_DEVICE, \
- CONFIG_OXFORD_OXPCIE_BRIDGE_FUNCTION)
-
-#define OXPCIE_DEVICE \
- PCI_DEV(CONFIG_OXFORD_OXPCIE_BRIDGE_SUBORDINATE, 0, 0)
-
-#define OXPCIE_DEVICE_3 \
- PCI_DEV(CONFIG_OXFORD_OXPCIE_BRIDGE_SUBORDINATE, 0, 3)
-
-static void oxpcie_init_bridge(void)
+int pci_early_device_probe(u8 bus, u8 dev, u32 mmio_base)
{
- u16 reg16;
-
- /* First we reset the secondary bus */
- reg16 = pci_read_config16(PCIE_BRIDGE, PCI_BRIDGE_CONTROL);
- reg16 |= (1 << 6); /* SRESET */
- pci_write_config16(PCIE_BRIDGE, PCI_BRIDGE_CONTROL, reg16);
-
- /* Assume we don't have to wait here forever */
+ pci_devfn_t device = PCI_DEV(bus, dev, 0);
- /* Read back and clear reset bit. */
- reg16 = pci_read_config16(PCIE_BRIDGE, PCI_BRIDGE_CONTROL);
- reg16 &= ~(1 << 6); /* SRESET */
- pci_write_config16(PCIE_BRIDGE, PCI_BRIDGE_CONTROL, reg16);
-
- /* Set up subordinate bus number */
- pci_write_config8(PCIE_BRIDGE, PCI_SECONDARY_BUS, 0x00);
- pci_write_config8(PCIE_BRIDGE, PCI_SUBORDINATE_BUS, 0x00);
- pci_write_config8(PCIE_BRIDGE, PCI_SECONDARY_BUS,
- CONFIG_OXFORD_OXPCIE_BRIDGE_SUBORDINATE);
- pci_write_config8(PCIE_BRIDGE, PCI_SUBORDINATE_BUS,
- CONFIG_OXFORD_OXPCIE_BRIDGE_SUBORDINATE);
-
- /* Memory window for the OXPCIe952 card */
- // XXX is the calculation of base and limit correct?
- pci_write_config32(PCIE_BRIDGE, PCI_MEMORY_BASE,
- ((CONFIG_OXFORD_OXPCIE_BASE_ADDRESS & 0xffff0000) |
- ((CONFIG_OXFORD_OXPCIE_BASE_ADDRESS >> 16) & 0xff00)));
-
- /* Enable memory access through bridge */
- reg16 = pci_read_config16(PCIE_BRIDGE, PCI_COMMAND);
- reg16 |= PCI_COMMAND_MEMORY;
- pci_write_config16(PCIE_BRIDGE, PCI_COMMAND, reg16);
-
- u32 timeout = 20000; // Timeout in 10s of microseconds.
- u32 id = 0;
- for (;;) {
- id = pci_read_config32(OXPCIE_DEVICE, PCI_VENDOR_ID);
- if (!timeout-- || (id != 0 && id != 0xffffffff))
- break;
- udelay(10);
- }
-
- u32 device = OXPCIE_DEVICE; /* unknown default */
+ u32 id = pci_read_config32(device, PCI_VENDOR_ID);
switch (id) {
- case 0xc1181415: /* e.g. Startech PEX1S1PMINI */
+ case 0xc1181415: /* e.g. Startech PEX1S1PMINI function 0 */
/* On this device function 0 is the parallel port, and
* function 3 is the serial port. So let's go look for
* the UART.
*/
- id = pci_read_config32(OXPCIE_DEVICE_3, PCI_VENDOR_ID);
+ device = PCI_DEV(bus, dev, 3);
+ id = pci_read_config32(device, PCI_VENDOR_ID);
if (id != 0xc11b1415)
- return;
- device = OXPCIE_DEVICE_3;
+ return -1;
break;
+ case 0xc11b1415: /* e.g. Startech PEX1S1PMINI function 3 */
case 0xc1581415: /* e.g. Startech MPEX2S952 */
- device = OXPCIE_DEVICE;
break;
default:
/* No UART here. */
- return;
+ return -1;
}
+ /* Sanity-check, we assume fixed location. */
+ if (mmio_base != CONFIG_EARLY_PCI_MMIO_BASE)
+ return -1;
+
/* Setup base address on device */
- pci_write_config32(device, PCI_BASE_ADDRESS_0,
- CONFIG_OXFORD_OXPCIE_BASE_ADDRESS);
+ pci_write_config32(device, PCI_BASE_ADDRESS_0, mmio_base);
/* Enable memory on device */
- reg16 = pci_read_config16(device, PCI_COMMAND);
+ u16 reg16 = pci_read_config16(device, PCI_COMMAND);
reg16 |= PCI_COMMAND_MEMORY;
pci_write_config16(device, PCI_COMMAND, reg16);
car_set_var(oxpcie_present, 1);
+ return 0;
}
static int oxpcie_uart_active(void)
@@ -157,8 +109,3 @@ unsigned int uart_platform_refclk(void)
{
return 62500000;
}
-
-void oxford_init(void)
-{
- oxpcie_init_bridge();
-}
diff --git a/src/include/console/uart.h b/src/include/console/uart.h
index 4516b71..7d92a21 100644
--- a/src/include/console/uart.h
+++ b/src/include/console/uart.h
@@ -47,7 +47,6 @@ int uart_can_rx_byte(void);
unsigned int uart_platform_base(int idx);
-void oxford_init(void);
void oxford_remap(unsigned int new_base);
#endif /* CONSOLE_UART_H */
diff --git a/src/include/device/pci.h b/src/include/device/pci.h
index 29d988f..f729c27 100644
--- a/src/include/device/pci.h
+++ b/src/include/device/pci.h
@@ -102,6 +102,8 @@ static inline const struct pci_operations *ops_pci(device_t dev)
unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last);
unsigned pci_find_capability(device_t dev, unsigned cap);
+void pci_early_bridge_init(void);
+int pci_early_device_probe(u8 bus, u8 dev, u32 mmio_base);
#endif /* CONFIG_PCI */
diff --git a/src/southbridge/intel/bd82x6x/Kconfig b/src/southbridge/intel/bd82x6x/Kconfig
index 9cfa5d5..14281e6 100644
--- a/src/southbridge/intel/bd82x6x/Kconfig
+++ b/src/southbridge/intel/bd82x6x/Kconfig
@@ -41,6 +41,22 @@ config EHCI_BAR
hex
default 0xfef00000
+if EARLY_PCI_BRIDGE
+
+config EARLY_PCI_BRIDGE_DEVICE
+ hex
+ default 0x1c
+
+config EARLY_PCI_BRIDGE_FUNCTION
+ hex
+ default 0x2
+
+config EARLY_PCI_MMIO_BASE
+ hex
+ default 0xe0400000
+
+endif
+
config DRAM_RESET_GATE_GPIO
int
default 60
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4926
-gerrit
commit 64a23d670690b2e30d2fa458fbf882d6e94a9a04
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Oct 30 17:07:46 2013 -0500
baytrail: HDA function disable workaround
Parts of the audio path are common between the HDA and LPE.
However, those parts are power-controlled by the D-state of
the HDA device. Therefore, one cannot put the HDA into D3Hot
because those audio paths will be shutdown.
BUG=chrome-os-partner:22871
BRANCH=None
TEST=Built and booted through depthcharge. Disabling HDA still
causes a shutdown when performing warm reset, however I
was able to verify the magic sequence was being performed.
Change-Id: I3b01356d85a4b7b902bd896b8eb9e7bc509fcc42
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175491
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/soc/intel/baytrail/baytrail/iomap.h | 1 +
src/soc/intel/baytrail/southcluster.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/soc/intel/baytrail/baytrail/iomap.h b/src/soc/intel/baytrail/baytrail/iomap.h
index fa34105..d46a0fe 100644
--- a/src/soc/intel/baytrail/baytrail/iomap.h
+++ b/src/soc/intel/baytrail/baytrail/iomap.h
@@ -31,6 +31,7 @@
#define PUNIT_BASE_ADDRESS 0xfed05000
#define RCBA_BASE_ADDRESS 0xfed1c000
#define HPET_BASE_ADDRESS 0xfed00000
+#define TEMP_BASE_ADDRESS 0xfd000000
/* IO Port base */
#define ACPI_BASE_ADDRESS 0x0400
diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c
index 42349fa..c71ab7e 100644
--- a/src/soc/intel/baytrail/southcluster.c
+++ b/src/soc/intel/baytrail/southcluster.c
@@ -238,10 +238,37 @@ static inline void set_d3hot_bits(device_t dev, int offset)
pci_write_config8(dev, offset + 4, reg8);
}
+/* Parts of the audio subsystem are powered by the HDA device. Therefore, one
+ * cannot put HDA into D3Hot. Instead perform this workaround to make some of
+ * the audio paths work for LPE audio. */
+static void hda_work_around(device_t dev)
+{
+ unsigned long gctl = TEMP_BASE_ADDRESS + 0x8;
+
+ /* Need to set magic register 0x43 to 0xd7 in config space. */
+ pci_write_config8(dev, 0x43, 0xd7);
+
+ /* Need to set bit 0 of GCTL to take the device out of reset. However,
+ * that requires setting up the 64-bit BAR. */
+ pci_write_config32(dev, PCI_BASE_ADDRESS_0, TEMP_BASE_ADDRESS);
+ pci_write_config32(dev, PCI_BASE_ADDRESS_1, 0);
+ pci_write_config8(dev, PCI_COMMAND, PCI_COMMAND_MEMORY);
+ write32(gctl, read32(gctl) | 0x1);
+ pci_write_config8(dev, PCI_COMMAND, 0);
+ pci_write_config32(dev, PCI_BASE_ADDRESS_0, 0);
+}
+
static int place_device_in_d3hot(device_t dev)
{
unsigned offset;
+ /* Parts of the HDA block are used for LPE audio as well.
+ * Therefore assume the HDA will never be put into D3Hot. */
+ if (dev->path.pci.devfn == PCI_DEVFN(HDA_DEV, HDA_FUNC)) {
+ hda_work_around(dev);
+ return 0;
+ }
+
offset = pci_find_capability(dev, PCI_CAP_ID_PM);
if (offset != 0) {
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4925
-gerrit
commit 41dead2a123f6700a55dfcc1141769855c4e35c9
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Oct 30 17:08:59 2013 -0500
baytrail: allow function disable on TXE
Previously it was not known how to put the TXE pci device
into D3Hot. It's been disseminated that this is not a requirement
for disabling the TXE pci device in the function disable register.
Therefore, allow this by returning 0 from place_device_in_d3hot().
BUG=chrome-os-partner:22871
BRANCH=None
TEST=Temporarily set TXE to be disabled. Noted FUNC_DIS was being
set accordingly.
Change-Id: Ibf537bf8ba718859591dc89bdf41e57c1ea9d836
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175490
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/soc/intel/baytrail/southcluster.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/baytrail/southcluster.c b/src/soc/intel/baytrail/southcluster.c
index eacabf3..42349fa 100644
--- a/src/soc/intel/baytrail/southcluster.c
+++ b/src/soc/intel/baytrail/southcluster.c
@@ -322,7 +322,8 @@ static int place_device_in_d3hot(device_t dev)
offset = 0x50;
break;
case PCI_DEVFN(TXE_DEV, TXE_FUNC):
- break;
+ /* TXE cannot be placed in D3Hot. */
+ return 0;
case PCI_DEVFN(PCIE_PORT1_DEV, PCIE_PORT1_FUNC):
offset = 0xa0;
break;
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4932
-gerrit
commit e9d5be9468e0e67e6c5788fc1cad8e87a2af6cf6
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Sun Nov 3 19:38:12 2013 -0800
baytrail: Reserve memory between ASEG and 1MB and for ramoops
Low system tables are in this region, and it is probably safer
to keep ASEG reserved.
Also keep the region used by ramoops from being used by the OS
and from being cleared by developer mode boots.
Lots more work needed to make the ACPI tables fully functional.
BUG=chrome-os-partner:23505
BRANCH=rambi
TEST=boot on rambi and see that the kernel finds RSDP and uses ACPI
Change-Id: I4f7064d3cff14a3ecf15b194a1f20c1fa9d5e134
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175554
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/soc/intel/baytrail/northcluster.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/soc/intel/baytrail/northcluster.c b/src/soc/intel/baytrail/northcluster.c
index 714d532..eca122c 100644
--- a/src/soc/intel/baytrail/northcluster.c
+++ b/src/soc/intel/baytrail/northcluster.c
@@ -117,6 +117,20 @@ static void nc_read_resources(device_t dev)
if (bmbound_hi > four_gig_kib)
ram_resource(dev, index++, four_gig_kib,
bmbound_hi - four_gig_kib);
+
+ /* Reserve everything between A segment and 1MB:
+ *
+ * 0xa0000 - 0xbffff: legacy VGA
+ * 0xc0000 - 0xfffff: RAM
+ */
+ mmio_resource(dev, index++, (0xa0000 >> 10), (0xc0000 - 0xa0000) >> 10);
+ reserved_ram_resource(dev, index++, (0xc0000 >> 10),
+ (0x100000 - 0xc0000) >> 10);
+#if CONFIG_CHROMEOS_RAMOOPS
+ reserved_ram_resource(dev, index++,
+ CONFIG_CHROMEOS_RAMOOPS_RAM_START >> 10,
+ CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE >> 10);
+#endif
}
static struct device_operations nc_ops = {
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4928
-gerrit
commit 095dad2e1b5567d77ba590defba627c2752846b3
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Nov 1 14:36:03 2013 -0500
baytrail: add audio clock workaround for LPE
Apparently the LPE device needs a 25MHz clock. Provide
the work around to enable this clock.
BUG=chrome-os-partner:23791
BRANCH=None
TEST=Built and booted. Confirmed setting being applied.
Change-Id: Ibff5563436b3025eb8b61ffee3302bd2da872b39
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175493
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/soc/intel/baytrail/Makefile.inc | 1 +
src/soc/intel/baytrail/lpe.c | 53 +++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/src/soc/intel/baytrail/Makefile.inc b/src/soc/intel/baytrail/Makefile.inc
index d414057..2149e97 100644
--- a/src/soc/intel/baytrail/Makefile.inc
+++ b/src/soc/intel/baytrail/Makefile.inc
@@ -35,6 +35,7 @@ ramstage-y += southcluster.c
ramstage-$(CONFIG_HAVE_REFCODE_BLOB) += refcode.c
ramstage-y += sata.c
ramstage-y += acpi.c
+ramstage-y += lpe.c
# Remove as ramstage gets fleshed out
ramstage-y += placeholders.c
diff --git a/src/soc/intel/baytrail/lpe.c b/src/soc/intel/baytrail/lpe.c
new file mode 100644
index 0000000..e422ff6
--- /dev/null
+++ b/src/soc/intel/baytrail/lpe.c
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+
+#include <baytrail/iosf.h>
+#include <baytrail/ramstage.h>
+
+static void lpe_init(device_t dev)
+{
+ uint32_t reg;
+
+ /* Work around for Audio Clock. */
+ reg = iosf_ccu_read(PLT_CLK_CTRL_3);
+ reg &= ~0xff;
+ reg |= PLT_CLK_CTRL_25MHZ_FREQ | PLT_CLK_CTRL_SELECT_FREQ;
+ iosf_ccu_write(PLT_CLK_CTRL_3, reg);
+}
+
+static const struct device_operations device_ops = {
+ .read_resources = pci_dev_read_resources,
+ .set_resources = pci_dev_set_resources,
+ .enable_resources = NULL,
+ .init = lpe_init,
+ .enable = NULL,
+ .scan_bus = NULL,
+ .ops_pci = &soc_pci_ops,
+};
+
+static const struct pci_driver southcluster __pci_driver = {
+ .ops = &device_ops,
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .device = LPE_DEVID,
+};