summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/common/block/gpio
diff options
context:
space:
mode:
authorMichael Niewöhner <foss@mniewoehner.de>2020-12-11 22:13:44 +0100
committerMichael Niewöhner <foss@mniewoehner.de>2020-12-30 00:30:04 +0000
commit8913b783b9d3ffea2eda7cfd1c9e7319ae889246 (patch)
treedf102d125f0465a007689df4e07e6772b53723c3 /src/soc/intel/common/block/gpio
parent979a071b0e3b5a3e578a25f1553a3a32f618d4b2 (diff)
downloadcoreboot-8913b783b9d3ffea2eda7cfd1c9e7319ae889246.tar.gz
coreboot-8913b783b9d3ffea2eda7cfd1c9e7319ae889246.tar.bz2
coreboot-8913b783b9d3ffea2eda7cfd1c9e7319ae889246.zip
soc/intel: hook up new gpio device in the soc chips
This change adds the required gpio operations struct to soc/common gpio code and hooks them up in all socs currently using the gpio block code, except DNV-NS, which is handled in a separate change. Also, add the gpio device to existing chipset devicetrees. Successfully tested on Supermicro X11SSM-F with CB:48097, X11SSH-TF with CB:48711 and OCP DeltaLake with CB:48672. Change-Id: I81dbbf5397b28ffa7537465c53332779245b39f6 Tested-by: Johnny Lin <Johnny_Lin@wiwynn.com> Tested-by: Michael Niewöhner <foss@mniewoehner.de> Tested-by: Patrick Rudolph <siro@das-labor.org> Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48583 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/common/block/gpio')
-rw-r--r--src/soc/intel/common/block/gpio/Makefile.inc2
-rw-r--r--src/soc/intel/common/block/gpio/gpio.c1
-rw-r--r--src/soc/intel/common/block/gpio/gpio_dev.c28
3 files changed, 31 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/gpio/Makefile.inc b/src/soc/intel/common/block/gpio/Makefile.inc
index b0ffee308ace..0379e92250ff 100644
--- a/src/soc/intel/common/block/gpio/Makefile.inc
+++ b/src/soc/intel/common/block/gpio/Makefile.inc
@@ -3,3 +3,5 @@ ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GPIO) += gpio.c
romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GPIO) += gpio.c
smm-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GPIO) += gpio.c
verstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GPIO) += gpio.c
+
+ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_GPIO) += gpio_dev.c
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c
index fb9287c1f763..28e78fb3667b 100644
--- a/src/soc/intel/common/block/gpio/gpio.c
+++ b/src/soc/intel/common/block/gpio/gpio.c
@@ -2,6 +2,7 @@
#include <assert.h>
#include <console/console.h>
+#include <device/device.h>
#include <intelblocks/gpio.h>
#include <gpio.h>
#include <intelblocks/itss.h>
diff --git a/src/soc/intel/common/block/gpio/gpio_dev.c b/src/soc/intel/common/block/gpio/gpio_dev.c
new file mode 100644
index 000000000000..c47d3a28ffba
--- /dev/null
+++ b/src/soc/intel/common/block/gpio/gpio_dev.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <assert.h>
+#include <device/device.h>
+#include <device/gpio.h>
+#include <intelblocks/gpio.h>
+#include <gpio.h>
+
+static struct gpio_operations gpio_ops = {
+ .get = gpio_get,
+ .set = gpio_set,
+ .input_pulldown = gpio_input_pulldown,
+ .input_pullup = gpio_input_pullup,
+ .input = gpio_input,
+ .output = gpio_output,
+};
+
+static struct device_operations block_gpio_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+ .ops_gpio = &gpio_ops,
+};
+
+void block_gpio_enable(struct device *dev)
+{
+ assert(dev->path.type == DEVICE_PATH_GPIO);
+ dev->ops = &block_gpio_ops;
+}