Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13302
-gerrit
commit 99367765103ea194c0e2b33bef4c16003621e1a8
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Wed Oct 7 11:06:14 2015 -0700
cpu/x86/tsc: Compile delay_tsc.c for the bootblock as well
This is needed in a follow-on patch to enable udelay() handling on
apollolake, which is a dependency for the console code.
Change-Id: I7da6a060a91b83f3b32c5c5d269c102ce7ae3b8a
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/cpu/x86/tsc/Makefile.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cpu/x86/tsc/Makefile.inc b/src/cpu/x86/tsc/Makefile.inc
index bbebda9..7e2eab2 100644
--- a/src/cpu/x86/tsc/Makefile.inc
+++ b/src/cpu/x86/tsc/Makefile.inc
@@ -1,3 +1,4 @@
+bootblock-$(CONFIG_UDELAY_TSC) += delay_tsc.c
ramstage-$(CONFIG_UDELAY_TSC) += delay_tsc.c
romstage-$(CONFIG_TSC_CONSTANT_RATE) += delay_tsc.c
verstage-$(CONFIG_TSC_CONSTANT_RATE) += delay_tsc.c
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13308
-gerrit
commit 3c67359072b0250b398a1cbbf1236e71b79c72b3
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Wed Oct 7 12:59:31 2015 -0700
soc/apollolake: Add UART and debug console support
The UART uses a standard 8250 32-bit register map, and some config
registers in the same memory window. Set it up for console.
Change-Id: I866ff67d121826594b634cd00b6ef693b1d64512
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 6 ++
src/soc/intel/apollolake/Makefile.inc | 3 +
src/soc/intel/apollolake/bootblock/bootblock_car.c | 8 +++
src/soc/intel/apollolake/include/soc/uart.h | 28 ++++++++
src/soc/intel/apollolake/uart.c | 22 ++++++
src/soc/intel/apollolake/uart_early.c | 78 ++++++++++++++++++++++
6 files changed, 145 insertions(+)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index 825a40f..3267737 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -20,6 +20,7 @@ config CPU_SPECIFIC_OPTIONS
# Misc options
select C_ENVIRONMENT_BOOTBLOCK
select COLLECT_TIMESTAMPS
+ select DRIVERS_UART_8250MEM_32
select HAVE_INTEL_FIRMWARE
select MMCONF_SUPPORT
select MMCONF_SUPPORT_DEFAULT
@@ -42,6 +43,11 @@ config IOSF_BASE_ADDRESS
hex "MMIO Base Address of sideband bus"
default 0xd0000000
+config CONSOLE_UART_BASE_ADDRESS
+ depends on CONSOLE_SERIAL
+ hex "MMIO base address for UART"
+ default 0xde000000
+
config DCACHE_RAM_BASE
hex "Base address of cache-as-RAM"
default 0xfef00000
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc
index 9d33fe5..9d3897f 100644
--- a/src/soc/intel/apollolake/Makefile.inc
+++ b/src/soc/intel/apollolake/Makefile.inc
@@ -12,12 +12,15 @@ bootblock-y += cpu.c
bootblock-y += gpio.c
bootblock-y += bootblock/cache_as_ram.S
bootblock-y += bootblock/early_chipset_config.S
+bootblock-y += uart_early.c
romstage-y += cpu.c
romstage-y += gpio.c
+romstage-y += uart_early.c
ramstage-y += cpu.c
ramstage-y += gpio.c
+ramstage-y += uart.c
romstage-y += placeholders.c
smm-y += placeholders.c
diff --git a/src/soc/intel/apollolake/bootblock/bootblock_car.c b/src/soc/intel/apollolake/bootblock/bootblock_car.c
index 4be0815..3a0110e 100644
--- a/src/soc/intel/apollolake/bootblock/bootblock_car.c
+++ b/src/soc/intel/apollolake/bootblock/bootblock_car.c
@@ -11,12 +11,20 @@
*/
#include <arch/io.h>
+#include <console/console.h>
#include <soc/bootblock.h>
+#include <soc/uart.h>
void bootblock_car_main(void)
{
/* Quick post code to show we made it to C code */
outb(0x30, 0x80);
+
+ if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)) {
+ lpss_console_uart_init();
+ console_init();
+ }
+
/* Don't return, so we see the above post code */
while (1)
;
diff --git a/src/soc/intel/apollolake/include/soc/uart.h b/src/soc/intel/apollolake/include/soc/uart.h
new file mode 100644
index 0000000..fd535fb
--- /dev/null
+++ b/src/soc/intel/apollolake/include/soc/uart.h
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _SOC_APOLLOLAKE_UART_H_
+#define _SOC_APOLLOLAKE_UART_H_
+
+/* Clock is 100MHz * (M / N).*/
+#define UART_CLK 0x200
+# define UART_CLK_UPDATE (1 << 31)
+# define UART_CLK_DIV_N(n) (((n) & 0x7fff) << 16)
+# define UART_CLK_DIV_M(m) (((m) & 0x7fff) << 1)
+# define UART_CLK_EN (1 << 0)
+#define UART_RESET 0x204
+# define UART_RESET_DMA_EN (1 << 2)
+# define UART_RESET_UART_EN (3 << 0)
+
+void lpss_console_uart_init(void);
+
+#endif /* _SOC_APOLLOLAKE_UART_H_ */
diff --git a/src/soc/intel/apollolake/uart.c b/src/soc/intel/apollolake/uart.c
new file mode 100644
index 0000000..9663130
--- /dev/null
+++ b/src/soc/intel/apollolake/uart.c
@@ -0,0 +1,22 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <console/uart.h>
+
+/*
+ * TODO: We need a mechanism to return the new BAR once the resource allocator
+ * gives us a new location.
+ */
+uintptr_t uart_platform_base(int idx)
+{
+ return (CONFIG_CONSOLE_UART_BASE_ADDRESS);
+}
diff --git a/src/soc/intel/apollolake/uart_early.c b/src/soc/intel/apollolake/uart_early.c
new file mode 100644
index 0000000..bc02776
--- /dev/null
+++ b/src/soc/intel/apollolake/uart_early.c
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <console/uart.h>
+#include <device/pci.h>
+#include <soc/gpio.h>
+#include <soc/uart.h>
+
+static const struct pad_config uart_tx_pad_configs[] = {
+ {
+ .community = GPIO_NORTH,
+ .pad = 39,
+ .config = {PAD_CFG0_DEFAULT_FUNC(1), PAD_CFG1_DEFAULT_NATIVE},
+ }, {
+ .community = GPIO_NORTH,
+ .pad = 42,
+ .config = {PAD_CFG0_DEFAULT_FUNC(1), PAD_CFG1_DEFAULT_NATIVE},
+ }, {
+ .community = GPIO_NORTH,
+ .pad = 47,
+ .config = {PAD_CFG0_DEFAULT_FUNC(1), PAD_CFG1_DEFAULT_NATIVE},
+ },
+};
+
+static void lpss_uart_write(uint16_t reg, uint32_t val)
+{
+ uintptr_t base = CONFIG_CONSOLE_UART_BASE_ADDRESS | reg;
+ write32((void *)base, val);
+}
+
+void lpss_console_uart_init(void)
+{
+ uint32_t clk_sel;
+ device_t uart = PCI_DEV(0, 0x18, CONFIG_UART_FOR_CONSOLE & 3);
+
+ if(CONFIG_UART_FOR_CONSOLE > 2)
+ return;
+
+ gpio_configure_pad(&uart_tx_pad_configs[CONFIG_UART_FOR_CONSOLE]);
+
+ /* Enable BAR0 for the UART -- this is where the 8250 registers hide */
+ pci_write_config32(uart, PCI_BASE_ADDRESS_0,
+ CONFIG_CONSOLE_UART_BASE_ADDRESS);
+
+ /* Enable memory access and bus master */
+ pci_write_config32(uart, PCI_COMMAND,
+ PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
+
+ /* Take UART out of reset */
+ lpss_uart_write(UART_RESET, UART_RESET_DMA_EN | UART_RESET_UART_EN);
+
+ /* These values get us a 1.836 MHz clock (ideally we want 1.843 MHz) */
+ clk_sel = UART_CLK_DIV_N(0x7fff) | UART_CLK_DIV_M(0x025a);
+ /* Set M and N divisor inputs and enable clock */
+ lpss_uart_write(UART_CLK, clk_sel | UART_CLK_UPDATE);
+ lpss_uart_write(UART_CLK, clk_sel | UART_CLK_EN);
+
+}
+
+uintptr_t uart_platform_base(int idx)
+{
+ return (CONFIG_CONSOLE_UART_BASE_ADDRESS);
+}
+
+unsigned int uart_platform_refclk(void)
+{
+ /* That's within 0.5% of the actual value we've set earlier */
+ return 115200 * 16;
+}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13304
-gerrit
commit b9869daf92a04ea6f4a94d873aea2b59077cdce1
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Mon Oct 5 13:45:22 2015 -0700
soc/apollolake: Add minimal assessors for sideband bus (IOSF)
Some configuration registers for the UART are placed behind the
sideband bus.
Change-Id: I84a620dbd0cf4b8f3fec119836d1c8f75c7f200a
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/soc/intel/apollolake/include/soc/iosf.h | 30 +++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/soc/intel/apollolake/include/soc/iosf.h b/src/soc/intel/apollolake/include/soc/iosf.h
new file mode 100644
index 0000000..5299075
--- /dev/null
+++ b/src/soc/intel/apollolake/include/soc/iosf.h
@@ -0,0 +1,30 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _SOC_APOLLOLAKE_IOSF_H_
+#define _SOC_APOLLOLAKE_IOSF_H_
+
+#include <arch/io.h>
+
+inline static void iosf_write(uint16_t port, uint16_t reg, uint32_t val)
+{
+ uintptr_t base = CONFIG_IOSF_BASE_ADDRESS | (port << 16) | (reg & ~3);
+ write32((void *)base, val);
+}
+
+inline static uint32_t iosf_read(uint16_t port, uint16_t reg)
+{
+ uintptr_t base = CONFIG_IOSF_BASE_ADDRESS | (port << 16) | (reg & ~3);
+ return read32((void *)base);
+}
+
+#endif /* _SOC_APOLLOLAKE_IOSF_H_ */
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13306
-gerrit
commit 9c84e12c3c6fbeb7ab9c003af6d17dfa48be9009
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Thu Oct 8 17:31:25 2015 -0700
soc/apollolake: Add minimal GPIO configuration infrastruucture
This adds the minimal functionality needed to configure SOC pads. The
only purpose right now is to allow configuration of UART pads, but
will be expanded later into a proper GPIO driver.
Change-Id: If01f41f94f8c506a865908d18f8b3d343c542b1b
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/soc/intel/apollolake/Makefile.inc | 3 +
src/soc/intel/apollolake/gpio.c | 21 ++++++
src/soc/intel/apollolake/include/soc/gpio.h | 32 +++++++++
src/soc/intel/apollolake/include/soc/gpio_defs.h | 85 ++++++++++++++++++++++++
4 files changed, 141 insertions(+)
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc
index d2d117a..9d33fe5 100644
--- a/src/soc/intel/apollolake/Makefile.inc
+++ b/src/soc/intel/apollolake/Makefile.inc
@@ -9,12 +9,15 @@ subdirs-y += ../../../cpu/x86/tsc
bootblock-y += bootblock/bootblock_car.c
bootblock-y += cpu.c
+bootblock-y += gpio.c
bootblock-y += bootblock/cache_as_ram.S
bootblock-y += bootblock/early_chipset_config.S
romstage-y += cpu.c
+romstage-y += gpio.c
ramstage-y += cpu.c
+ramstage-y += gpio.c
romstage-y += placeholders.c
smm-y += placeholders.c
diff --git a/src/soc/intel/apollolake/gpio.c b/src/soc/intel/apollolake/gpio.c
new file mode 100644
index 0000000..2796e42
--- /dev/null
+++ b/src/soc/intel/apollolake/gpio.c
@@ -0,0 +1,21 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <soc/gpio.h>
+#include <soc/iosf.h>
+
+void gpio_configure_pad(const struct pad_config *cfg)
+{
+ uint16_t config_offset = PAD_CFG_OFFSET(cfg->pad);
+ iosf_write(cfg->community, config_offset, cfg->config[0]);
+ iosf_write(cfg->community, config_offset + 4, cfg->config[1]);
+}
diff --git a/src/soc/intel/apollolake/include/soc/gpio.h b/src/soc/intel/apollolake/include/soc/gpio.h
new file mode 100644
index 0000000..5744f72
--- /dev/null
+++ b/src/soc/intel/apollolake/include/soc/gpio.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _SOC_APOLLOLAKE_GPIO_H_
+#define _SOC_APOLLOLAKE_GPIO_H_
+
+#include <types.h>
+#include <soc/gpio_defs.h>
+
+struct pad_config {
+ uint8_t community;
+ uint8_t pad;
+ uint32_t config[2];
+};
+
+/*
+ * Configuration for raw pads. Some pads are designated as only special function
+ * pins, and don't have an associated GPIO number, so we need to expose the raw
+ * pad configuration functionality.
+ */
+void gpio_configure_pad(const struct pad_config *cfg);
+
+#endif /* _SOC_APOLLOLAKE_GPIO_H_ */
diff --git a/src/soc/intel/apollolake/include/soc/gpio_defs.h b/src/soc/intel/apollolake/include/soc/gpio_defs.h
new file mode 100644
index 0000000..c581662
--- /dev/null
+++ b/src/soc/intel/apollolake/include/soc/gpio_defs.h
@@ -0,0 +1,85 @@
+/*
+ * Definitions for the GPIO subsystem on Apollolake
+ *
+ * Placed in a separate file since some of these definitions can be used from
+ * assembly code
+ *
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com> for Intel Corp.)
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef _SOC_APOLLOLAKE_GPIO_DEFS_H_
+#define _SOC_APOLLOLAKE_GPIO_DEFS_H_
+
+#define PAD_CFG0_TX_DISABLE (1 << 8)
+#define PAD_CFG0_RX_DISABLE (1 << 9)
+#define PAD_CFG0_MODE_MASK (7 << 10)
+#define PAD_CFG0_MODE_GPIO (0 << 10)
+#define PAD_CFG0_MODE_FUNC(x) ((x) << 10)
+#define PAD_CFG0_ROUTE_NMI (1 << 17)
+#define PAD_CFG0_ROUTE_SMI (1 << 18)
+#define PAD_CFG0_ROUTE_SCI (1 << 19)
+#define PAD_CFG0_ROUTE_IOAPIC (1 << 20)
+#define PAD_CFG0_RX_INVERT (1 << 23)
+#define PAD_CFG0_TRIG_MASK (3 << 25)
+#define PAD_CFG0_TRIG_LEVEL (0 << 25)
+#define PAD_CFG0_TRIG_EDGE_SINGLE (1 << 25) /* controlled by RX_INVERT*/
+#define PAD_CFG0_TRIG_OFF (2 << 25)
+#define PAD_CFG0_TRIG_EDGE_BOTH (3 << 25)
+#define PAD_CFG0_RESET_MASK (3 << 30)
+#define PAD_CFG0_RESET_STICKY (0 << 30)
+#define PAD_CFG0_RESET_DEEP (1 << 30)
+#define PAD_CFG0_RESET_GPIOR (2 << 30)
+#define PAD_CFG0_RESET_INACTIVE (3 << 30)
+
+#define PAD_CFG1_PULL_MASK (0xf << 12)
+#define PAD_CFG1_PULL_NONE (0x0 << 12)
+#define PAD_CFG1_PULL_DN_5K (0x2 << 12)
+#define PAD_CFG1_PULL_DN_20K (0x4 << 12)
+#define PAD_CFG1_PULL_UP_1K (0x9 << 12)
+#define PAD_CFG1_PULL_UP_5K (0xa << 12)
+#define PAD_CFG1_PULL_UP_2K (0xb << 12)
+#define PAD_CFG1_PULL_UP_20K (0xc << 12)
+#define PAD_CFG1_PULL_UP_667 (0xd << 12)
+#define PAD_CFG1_PULL_NATIVE (0xf << 12)
+
+#define PAD_CFG_BASE 0x500
+#define PAD_CFG_OFFSET(pad) (PAD_CFG_BASE + ((pad) * 8))
+
+/* IOSF port numbers for GPIO comminuties*/
+#define GPIO_SOUTHWEST 0xc0
+#define GPIO_SOUTH 0xc2
+#define GPIO_NORTHWEST 0xc4
+#define GPIO_NORTH 0xc5
+#define GPIO_WEST 0xc7
+
+/* Special function pads in southwest community */
+#define SMB_ALERTB 31
+#define SMB_CLK 32
+#define SMB_DATA 33
+#define LPC_ILB_SERIRQ 34
+#define LPC_CLKOUT0 35
+#define LPC_CLKOUT1 36
+#define LPC_AD0 37
+#define LPC_AD1 38
+#define LPC_AD2 39
+#define LPC_AD3 40
+#define LPC_CLKRUNB 41
+#define LPC_FRAMEB 42
+
+/* Default configurations */
+#define PAD_CFG0_DEFAULT_FUNC(x) (0x44000000 | PAD_CFG0_MODE_FUNC(x))
+#define PAD_CFG0_DEFAULT_NATIVE PAD_CFG0_DEFAULT_FUNC(1)
+
+#define PAD_CFG1_DEFAULT_NOPULL PAD_CFG1_PULL_NONE
+#define PAD_CFG1_DEFAULT_PULLUP PAD_CFG1_PULL_UP_20K
+#define PAD_CFG1_DEFAULT_NATIVE PAD_CFG1_PULL_NATIVE
+
+#endif /* _SOC_APOLLOLAKE_GPIO_DEFS_H_ */
the following patch was just integrated into master:
commit 32c4a06a43dd2b61b589e7f9c10f44c1902d7447
Author: Nico Huber <nico.huber(a)secunet.com>
Date: Mon Jan 25 18:30:57 2016 +0100
Revert "util/crossgcc: Build Ada frontend by default"
This reverts commit 89798bcb0cee369cd2aaeda8704d23d347dbe192.
Disable building gnat again as it turned out that many distros don't
ship with a sufficient recent version of gnat. We'll have to find a
reliable way to check for the installed gnat version and query the
user or bootstrap gcc in that case.
Change-Id: Ife7cf7c9d1567aca898ce308b120a7b9e146e5f5
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
Reviewed-on: https://review.coreboot.org/13422
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
Reviewed-by: Martin Roth <martinroth(a)google.com>
Reviewed-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Tested-by: build bot (Jenkins)
See https://review.coreboot.org/13422 for details.
-gerrit