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 517d302e5556ddda74f4d94e3a838610a0931932
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_ */
Hannah Williams (hannah.williams(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13425
-gerrit
commit c61522fa0ad7163cb6c21c032a31720b11b441aa
Author: Hannah Williams <hannah.williams(a)intel.com>
Date: Mon Jul 27 19:46:34 2015 -0700
soc/braswell: Fix for auto wake from S5
Disabling S5 wake from touch panel and trackpad
TEST=Build and boot the platform.
TEST=Poweroff platform -> enter PG3 -> remove AC -> close Lid
Plug AC in -> EC boots up and AP will shutdown the platform
and open Lid -> platform boots to OS.
Change-Id: I7b661a9f1327b97d904bac40e78612648f353e39
Signed-off-by: Hannah Williams <hannah.williams(a)intel.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/288970
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Divagar Mohandass <divagar.mohandass(a)intel.com>
Original-Tested-by: Divagar Mohandass <divagar.mohandass(a)intel.com>
---
src/mainboard/google/cyan/smihandler.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/mainboard/google/cyan/smihandler.c b/src/mainboard/google/cyan/smihandler.c
index 04cc899..9b363ca 100644
--- a/src/mainboard/google/cyan/smihandler.c
+++ b/src/mainboard/google/cyan/smihandler.c
@@ -28,6 +28,8 @@
/* The wake gpio is SUS_GPIO[0]. */
#define WAKE_GPIO_EN SUS_GPIO_EN0
+#define GPIO_SUS7_WAKE_MASK (1 << 12)
+#define GPIO_SUS1_WAKE_MASK (1 << 13)
int mainboard_io_trap_handler(int smif)
{
@@ -96,6 +98,9 @@ void mainboard_smi_gpi(uint32_t alt_gpio_smi)
void mainboard_smi_sleep(uint8_t slp_typ)
{
+ void *addr;
+ uint32_t mask;
+
/* Disable USB charging if required */
switch (slp_typ) {
case 3:
@@ -125,6 +130,16 @@ void mainboard_smi_sleep(uint8_t slp_typ)
/* Enable wake events */
google_chromeec_set_wake_mask(MAINBOARD_EC_S5_WAKE_EVENTS);
#endif
+
+ /* Disabling wake from SUS_GPIO1 (TOUCH INT) and
+ * SUS_GPIO7 (TRACKPAD INT) in North bank as they are not
+ * valid S5 wake sources
+ */
+ addr = (void *)(IO_BASE_ADDRESS + COMMUNITY_OFFSET_GPNORTH +
+ GPIO_WAKE_MASK_REG0);
+ mask = ~(GPIO_SUS1_WAKE_MASK | GPIO_SUS7_WAKE_MASK);
+ write32(addr, read32(addr) & mask);
+
break;
}
Hannah Williams (hannah.williams(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13424
-gerrit
commit 93005dd647e8f014f13f2e3ec71c26a0b88fc0a4
Author: Kumar, Gomathi <gomathi.kumar(a)intel.com>
Date: Fri Aug 7 16:39:48 2015 +0530
intel/strago: Fix for Crossystem "wpsw_cur" status
The GPIO mapping was incorrect for wpsw_cur. The GPIOs for East community are
in two ranges - 0: INT33FF:02 GPIOS [373 - 384] PINS [0 - 11] and
12: INT33FF:02 GPIOS [385 - 396] PINS [15 - 26]
The discontinuity was not accounted for, hence the error.Original offset was
0x16 whereas it should be 0x13
TEST=Run crossystem and test wpsw_cur entry. If screw is present, it should
be 1 and if not present, it should be 0
Change-Id: I29e19589b3a358a42818afbc6d017d6cbc6a9c4c
Original-Signed-off-by: Kumar, Gomathi <gomathi.kumar(a)intel.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/291572
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Icarus W Sparry <icarus.w.sparry(a)intel.com>
---
src/mainboard/intel/strago/acpi/chromeos.asl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mainboard/intel/strago/acpi/chromeos.asl b/src/mainboard/intel/strago/acpi/chromeos.asl
index 84c1313..c470ca3 100644
--- a/src/mainboard/intel/strago/acpi/chromeos.asl
+++ b/src/mainboard/intel/strago/acpi/chromeos.asl
@@ -23,11 +23,11 @@
*
* Note: We need to encode gpios within the 4 separate banks
* with the MMIO offset of each banks space. e.g. MF_ISH_GPIO_4 would be encoded
- * as 0x10016 where the SUS offset (COMMUNITY_OFFSET_GPEAST) is 0x10000.
+ * as 0x10013 where the SUS offset (COMMUNITY_OFFSET_GPEAST) is 0x10000.
*/
Name(OIPG, Package() {
/* No physical recovery button */
Package () { 0x0001, 0, 0xFFFFFFFF, "Braswell" },
- Package () { 0x0003, 1, 0x10016, "Braswell" },
+ Package () { 0x0003, 1, 0x10013, "Braswell" },
})