diff options
author | Michael Niewöhner <foss@mniewoehner.de> | 2020-12-11 22:13:44 +0100 |
---|---|---|
committer | Michael Niewöhner <foss@mniewoehner.de> | 2020-12-30 00:30:04 +0000 |
commit | 8913b783b9d3ffea2eda7cfd1c9e7319ae889246 (patch) | |
tree | df102d125f0465a007689df4e07e6772b53723c3 /src/soc | |
parent | 979a071b0e3b5a3e578a25f1553a3a32f618d4b2 (diff) |
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')
-rw-r--r-- | src/soc/intel/alderlake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/alderlake/chipset.cb | 1 | ||||
-rw-r--r-- | src/soc/intel/apollolake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/cannonlake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/common/block/gpio/Makefile.inc | 2 | ||||
-rw-r--r-- | src/soc/intel/common/block/gpio/gpio.c | 1 | ||||
-rw-r--r-- | src/soc/intel/common/block/gpio/gpio_dev.c | 28 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/gpio.h | 7 | ||||
-rw-r--r-- | src/soc/intel/elkhartlake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/icelake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/icelake/chip.h | 1 | ||||
-rw-r--r-- | src/soc/intel/jasperlake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/jasperlake/chip.h | 1 | ||||
-rw-r--r-- | src/soc/intel/skylake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/skylake/chipset.cb | 1 | ||||
-rw-r--r-- | src/soc/intel/tigerlake/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/tigerlake/chip.h | 1 | ||||
-rw-r--r-- | src/soc/intel/tigerlake/chipset.cb | 1 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/cpx/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/cpx/chip.h | 1 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/skx/chip.c | 3 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/skx/chip.h | 1 |
22 files changed, 76 insertions, 0 deletions
diff --git a/src/soc/intel/alderlake/chip.c b/src/soc/intel/alderlake/chip.c index 794c3bae0f..95b6b8f307 100644 --- a/src/soc/intel/alderlake/chip.c +++ b/src/soc/intel/alderlake/chip.c @@ -6,6 +6,7 @@ #include <fsp/util.h> #include <intelblocks/acpi.h> #include <intelblocks/cfg.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/pcie_rp.h> #include <intelblocks/xdci.h> @@ -182,6 +183,8 @@ static void soc_enable(struct device *dev) else if (dev->path.type == DEVICE_PATH_PCI && dev->path.pci.devfn == PCH_DEVFN_PMC) dev->ops = &pmc_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_alderlake_ops = { diff --git a/src/soc/intel/alderlake/chipset.cb b/src/soc/intel/alderlake/chipset.cb index de97a5780b..173d3e037f 100644 --- a/src/soc/intel/alderlake/chipset.cb +++ b/src/soc/intel/alderlake/chipset.cb @@ -1,5 +1,6 @@ chip soc/intel/alderlake device domain 0 on + device gpio 0 alias pch_gpio on end device pci 00.0 alias system_agent on end device pci 01.0 alias pcie5 off end device pci 02.0 alias igpu off end diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c index a4ed8bdcbb..fdbeef2d88 100644 --- a/src/soc/intel/apollolake/chip.c +++ b/src/soc/intel/apollolake/chip.c @@ -19,6 +19,7 @@ #include <fsp/api.h> #include <fsp/util.h> #include <intelblocks/cpulib.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/pmclib.h> #include <romstage_handoff.h> @@ -216,6 +217,8 @@ static void enable_dev(struct device *dev) dev->ops = &pci_domain_ops; else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) dev->ops = &cpu_bus_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } /* diff --git a/src/soc/intel/cannonlake/chip.c b/src/soc/intel/cannonlake/chip.c index 17698460f7..0958aace02 100644 --- a/src/soc/intel/cannonlake/chip.c +++ b/src/soc/intel/cannonlake/chip.c @@ -6,6 +6,7 @@ #include <fsp/util.h> #include <intelblocks/acpi.h> #include <intelblocks/cfg.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/pcie_rp.h> #include <intelblocks/xdci.h> @@ -209,6 +210,8 @@ static void soc_enable(struct device *dev) dev->ops = &pci_domain_ops; else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) dev->ops = &cpu_bus_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_cannonlake_ops = { diff --git a/src/soc/intel/common/block/gpio/Makefile.inc b/src/soc/intel/common/block/gpio/Makefile.inc index b0ffee308a..0379e92250 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 fb9287c1f7..28e78fb366 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 0000000000..c47d3a28ff --- /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; +} diff --git a/src/soc/intel/common/block/include/intelblocks/gpio.h b/src/soc/intel/common/block/include/intelblocks/gpio.h index 173a383f1e..4c29a0c5ba 100644 --- a/src/soc/intel/common/block/include/intelblocks/gpio.h +++ b/src/soc/intel/common/block/include/intelblocks/gpio.h @@ -25,6 +25,7 @@ #ifndef __ACPI__ #include <types.h> +#include <device/device.h> /* * GPIO numbers may not be contiguous and instead will have a different @@ -222,5 +223,11 @@ void gpi_clear_int_cfg(void); /* The function performs GPIO Power Management programming. */ void gpio_pm_configure(const uint8_t *misccfg_pm_values, size_t num); +/* + * Set gpio ops of the device to gpio block ops. + * Shall be called by all SoCs that use intelblocks/gpio. + */ +void block_gpio_enable(struct device *dev); + #endif #endif /* _SOC_INTELBLOCKS_GPIO_H_ */ diff --git a/src/soc/intel/elkhartlake/chip.c b/src/soc/intel/elkhartlake/chip.c index 8b4cf0cad9..359aa11c07 100644 --- a/src/soc/intel/elkhartlake/chip.c +++ b/src/soc/intel/elkhartlake/chip.c @@ -6,6 +6,7 @@ #include <fsp/util.h> #include <intelblocks/acpi.h> #include <intelblocks/cfg.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/pcie_rp.h> #include <intelblocks/xdci.h> @@ -163,6 +164,8 @@ static void soc_enable(struct device *dev) else if (dev->path.type == DEVICE_PATH_PCI && dev->path.pci.devfn == PCH_DEVFN_PMC) dev->ops = &pmc_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_elkhartlake_ops = { diff --git a/src/soc/intel/icelake/chip.c b/src/soc/intel/icelake/chip.c index d0ea732df3..d493f81bba 100644 --- a/src/soc/intel/icelake/chip.c +++ b/src/soc/intel/icelake/chip.c @@ -6,6 +6,7 @@ #include <fsp/util.h> #include <intelblocks/acpi.h> #include <intelblocks/cfg.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/xdci.h> #include <romstage_handoff.h> @@ -144,6 +145,8 @@ static void soc_enable(struct device *dev) dev->ops = &pci_domain_ops; else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) dev->ops = &cpu_bus_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_icelake_ops = { diff --git a/src/soc/intel/icelake/chip.h b/src/soc/intel/icelake/chip.h index cd0a9b03d8..64bc70ba53 100644 --- a/src/soc/intel/icelake/chip.h +++ b/src/soc/intel/icelake/chip.h @@ -9,6 +9,7 @@ #include <intelblocks/gspi.h> #include <stdint.h> #include <soc/gpe.h> +#include <soc/gpio.h> #include <soc/pch.h> #include <soc/gpio_defs.h> #include <soc/pci_devs.h> diff --git a/src/soc/intel/jasperlake/chip.c b/src/soc/intel/jasperlake/chip.c index d34ef557df..1f58f84c18 100644 --- a/src/soc/intel/jasperlake/chip.c +++ b/src/soc/intel/jasperlake/chip.c @@ -6,6 +6,7 @@ #include <fsp/util.h> #include <intelblocks/acpi.h> #include <intelblocks/cfg.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/pcie_rp.h> #include <intelblocks/xdci.h> @@ -169,6 +170,8 @@ static void soc_enable(struct device *dev) else if (dev->path.type == DEVICE_PATH_PCI && dev->path.pci.devfn == PCH_DEVFN_PMC) dev->ops = &pmc_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_jasperlake_ops = { diff --git a/src/soc/intel/jasperlake/chip.h b/src/soc/intel/jasperlake/chip.h index 9d4bc5c80a..884071fdbd 100644 --- a/src/soc/intel/jasperlake/chip.h +++ b/src/soc/intel/jasperlake/chip.h @@ -9,6 +9,7 @@ #include <intelblocks/gspi.h> #include <intelblocks/power_limit.h> #include <soc/gpe.h> +#include <soc/gpio.h> #include <soc/pch.h> #include <soc/pci_devs.h> #include <soc/pmc.h> diff --git a/src/soc/intel/skylake/chip.c b/src/soc/intel/skylake/chip.c index 2707353225..5b05dd20b2 100644 --- a/src/soc/intel/skylake/chip.c +++ b/src/soc/intel/skylake/chip.c @@ -7,6 +7,7 @@ #include <device/device.h> #include <device/pci_ids.h> #include <fsp/util.h> +#include <gpio.h> #include <intelblocks/cfg.h> #include <intelblocks/itss.h> #include <intelblocks/lpc_lib.h> @@ -103,6 +104,8 @@ static void soc_enable(struct device *dev) dev->ops = &pci_domain_ops; else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) dev->ops = &cpu_bus_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_skylake_ops = { diff --git a/src/soc/intel/skylake/chipset.cb b/src/soc/intel/skylake/chipset.cb index 28ee53d3ad..428db67d3a 100644 --- a/src/soc/intel/skylake/chipset.cb +++ b/src/soc/intel/skylake/chipset.cb @@ -1,5 +1,6 @@ chip soc/intel/skylake device domain 0 on + device gpio 0 alias pch_gpio on end # GPIO device pci 00.0 alias system_agent on end # Host Bridge device pci 01.0 alias peg0 off end # PEG0 device pci 01.1 alias peg1 off end # PEG1 diff --git a/src/soc/intel/tigerlake/chip.c b/src/soc/intel/tigerlake/chip.c index 62201a2f4f..f07cc58c95 100644 --- a/src/soc/intel/tigerlake/chip.c +++ b/src/soc/intel/tigerlake/chip.c @@ -7,6 +7,7 @@ #include <fsp/util.h> #include <intelblocks/acpi.h> #include <intelblocks/cfg.h> +#include <intelblocks/gpio.h> #include <intelblocks/itss.h> #include <intelblocks/pcie_rp.h> #include <intelblocks/xdci.h> @@ -177,6 +178,8 @@ static void soc_enable(struct device *dev) else if (dev->path.type == DEVICE_PATH_PCI && dev->path.pci.devfn == PCH_DEVFN_PMC) dev->ops = &pmc_ops; + else if (dev->path.type == DEVICE_PATH_GPIO) + block_gpio_enable(dev); } struct chip_operations soc_intel_tigerlake_ops = { diff --git a/src/soc/intel/tigerlake/chip.h b/src/soc/intel/tigerlake/chip.h index fe10d0dbcb..f38330b988 100644 --- a/src/soc/intel/tigerlake/chip.h +++ b/src/soc/intel/tigerlake/chip.h @@ -9,6 +9,7 @@ #include <intelblocks/gspi.h> #include <intelblocks/power_limit.h> #include <soc/gpe.h> +#include <soc/gpio.h> #include <soc/pch.h> #include <soc/pci_devs.h> #include <soc/pmc.h> diff --git a/src/soc/intel/tigerlake/chipset.cb b/src/soc/intel/tigerlake/chipset.cb index 54f7924b37..d4bc76c2a4 100644 --- a/src/soc/intel/tigerlake/chipset.cb +++ b/src/soc/intel/tigerlake/chipset.cb @@ -1,5 +1,6 @@ chip soc/intel/tigerlake device domain 0 on + device gpio 0 alias pch_gpio on end device pci 00.0 alias system_agent on end device pci 02.0 alias igpu off end device pci 04.0 alias dptf off end diff --git a/src/soc/intel/xeon_sp/cpx/chip.c b/src/soc/intel/xeon_sp/cpx/chip.c index a3076a8035..778d277a0c 100644 --- a/src/soc/intel/xeon_sp/cpx/chip.c +++ b/src/soc/intel/xeon_sp/cpx/chip.c @@ -5,6 +5,7 @@ #include <console/debug.h> #include <cpu/x86/lapic.h> #include <device/pci.h> +#include <intelblocks/gpio.h> #include <intelblocks/lpc_lib.h> #include <intelblocks/p2sb.h> #include <soc/acpi.h> @@ -61,6 +62,8 @@ static void chip_enable_dev(struct device *dev) attach_iio_stacks(dev); } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { dev->ops = &cpu_bus_ops; + } else if (dev->path.type == DEVICE_PATH_GPIO) { + block_gpio_enable(dev); } } diff --git a/src/soc/intel/xeon_sp/cpx/chip.h b/src/soc/intel/xeon_sp/cpx/chip.h index 434b343bb2..630bc8e979 100644 --- a/src/soc/intel/xeon_sp/cpx/chip.h +++ b/src/soc/intel/xeon_sp/cpx/chip.h @@ -4,6 +4,7 @@ #define _SOC_CHIP_H_ #include <intelblocks/cfg.h> +#include <soc/gpio.h> #include <soc/irq.h> #include <stdint.h> diff --git a/src/soc/intel/xeon_sp/skx/chip.c b/src/soc/intel/xeon_sp/skx/chip.c index f101973864..8b08326fb6 100644 --- a/src/soc/intel/xeon_sp/skx/chip.c +++ b/src/soc/intel/xeon_sp/skx/chip.c @@ -3,6 +3,7 @@ #include <cbfs.h> #include <console/console.h> #include <device/pci.h> +#include <intelblocks/gpio.h> #include <soc/acpi.h> #include <soc/chip_common.h> #include <soc/pch.h> @@ -37,6 +38,8 @@ static void soc_enable_dev(struct device *dev) attach_iio_stacks(dev); } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { dev->ops = &cpu_bus_ops; + } else if (dev->path.type == DEVICE_PATH_GPIO) { + block_gpio_enable(dev); } } diff --git a/src/soc/intel/xeon_sp/skx/chip.h b/src/soc/intel/xeon_sp/skx/chip.h index 08608997b3..4ee1ac0a0d 100644 --- a/src/soc/intel/xeon_sp/skx/chip.h +++ b/src/soc/intel/xeon_sp/skx/chip.h @@ -5,6 +5,7 @@ #include <stdint.h> #include <intelblocks/cfg.h> +#include <soc/gpio.h> #include <soc/irq.h> struct soc_intel_xeon_sp_skx_config { |